Skip to content

Commit 740ac67

Browse files
committed
Drop language.postfixOps as a default option in build and test
1 parent 47760c4 commit 740ac67

20 files changed

+44
-26
lines changed

compiler/src/dotty/tools/backend/jvm/BytecodeWriters.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ trait BytecodeWriters {
100100
super.writeClass(label, jclassName, jclassBytes, outfile)
101101

102102
val segments = jclassName.split("[./]")
103-
val asmpFile = segments.foldLeft(baseDir: Path)(_ / _) changeExtension "asmp" toFile;
103+
val asmpFile = segments.foldLeft(baseDir: Path)(_ / _).changeExtension("asmp").toFile
104104

105105
asmpFile.parent.createDirectory()
106106
emitAsmp(jclassBytes, asmpFile)
@@ -131,7 +131,7 @@ trait BytecodeWriters {
131131
super.writeClass(label, jclassName, jclassBytes, outfile)
132132

133133
val pathName = jclassName
134-
val dumpFile = pathName.split("[./]").foldLeft(baseDir: Path) (_ / _) changeExtension "class" toFile;
134+
val dumpFile = pathName.split("[./]").foldLeft(baseDir: Path) (_ / _).changeExtension("class").toFile
135135
dumpFile.parent.createDirectory()
136136
val outstream = new DataOutputStream(new FileOutputStream(dumpFile.path))
137137

compiler/src/dotty/tools/dotc/config/PathResolver.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ object PathResolver {
3030
def ppcp(s: String): String = split(s) match {
3131
case Nil => ""
3232
case Seq(x) => x
33-
case xs => xs map ("\n" + _) mkString
33+
case xs => xs.map("\n" + _).mkString
3434
}
3535

3636
/** Values found solely by inspecting environment or property variables.

compiler/test/dotty/tools/dotc/CompilationTests.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ class CompilationTests {
5858
compileFile("tests/pos-special/kind-projector.scala", defaultOptions.and("-Ykind-projector")),
5959
compileFile("tests/pos-special/kind-projector-underscores.scala", defaultOptions.and("-Ykind-projector:underscores")),
6060
compileFile("tests/run/i5606.scala", defaultOptions.and("-Yretain-trees")),
61-
compileFile("tests/pos-custom-args/i5498-postfixOps.scala", defaultOptions withoutLanguageFeature "postfixOps"),
6261
compileFile("tests/pos-custom-args/i8875.scala", defaultOptions.and("-Xprint:getters")),
6362
compileFile("tests/pos-custom-args/i9267.scala", defaultOptions.and("-Ystop-after:erasure")),
6463
compileFile("tests/pos-special/extend-java-enum.scala", defaultOptions.and("-source", "3.0-migration")),
@@ -180,7 +179,6 @@ class CompilationTests {
180179
compileFile("tests/neg-custom-args/kind-projector.scala", defaultOptions.and("-Ykind-projector")),
181180
compileFile("tests/neg-custom-args/kind-projector-underscores.scala", defaultOptions.and("-Ykind-projector:underscores")),
182181
compileFile("tests/neg-custom-args/typeclass-derivation2.scala", defaultOptions.and("-language:experimental.erasedDefinitions")),
183-
compileFile("tests/neg-custom-args/i5498-postfixOps.scala", defaultOptions withoutLanguageFeature "postfixOps"),
184182
compileFile("tests/neg-custom-args/deptypes.scala", defaultOptions.and("-language:experimental.dependent")),
185183
compileFile("tests/neg-custom-args/matchable.scala", defaultOptions.and("-Xfatal-warnings", "-source", "future")),
186184
compileFile("tests/neg-custom-args/i7314.scala", defaultOptions.and("-Xfatal-warnings", "-source", "future")),

compiler/test/dotty/tools/vulpix/TestConfiguration.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ object TestConfiguration {
6262

6363
val yCheckOptions = Array("-Ycheck:all")
6464

65-
val commonOptions = Array("-indent", "-language:postfixOps") ++ checkOptions ++ noCheckOptions ++ yCheckOptions
65+
val commonOptions = Array("-indent") ++ checkOptions ++ noCheckOptions ++ yCheckOptions
6666
val defaultOptions = TestFlags(basicClasspath, commonOptions)
6767
val unindentOptions = TestFlags(basicClasspath, Array("-no-indent") ++ checkOptions ++ noCheckOptions ++ yCheckOptions)
6868
val withCompilerOptions =

project/Build.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ object Build {
170170
"-unchecked",
171171
"-Xfatal-warnings",
172172
"-encoding", "UTF8",
173-
"-language:existentials,higherKinds,implicitConversions,postfixOps"
173+
"-language:existentials,higherKinds,implicitConversions"
174174
),
175175

176176
(Compile / compile / javacOptions) ++= Seq("-Xlint:unchecked", "-Xlint:deprecation"),

tests/neg/i12361.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import language.postfixOps
12
object Test {
23
foo = macro Impls . foo [ U ] += // error // error
34
}

tests/neg/i14564.check

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
-- [E018] Syntax Error: tests/neg/i14564.scala:5:28 --------------------------------------------------------------------
2+
5 |def test = sum"${ List(42)* }" // error // error
3+
| ^
4+
| expression expected but '}' found
5+
|
6+
| longer explanation available when compiling with `-explain`
7+
-- [E008] Not Found Error: tests/neg/i14564.scala:5:26 -----------------------------------------------------------------
8+
5 |def test = sum"${ List(42)* }" // error // error
9+
| ^^^^^^^^^
10+
| value * is not a member of List[Int], but could be made available as an extension method.
11+
|
12+
| One of the following imports might make progress towards fixing the problem:
13+
|
14+
| import math.Fractional.Implicits.infixFractionalOps
15+
| import math.Integral.Implicits.infixIntegralOps
16+
| import math.Numeric.Implicits.infixNumericOps
17+
|

tests/neg/i14564.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import language.postfixOps as _
2+
3+
extension (sc: StringContext) def sum(xs: Int*): String = xs.sum.toString
4+
5+
def test = sum"${ List(42)* }" // error // error
6+

tests/neg/i1672.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
class Test {
33
implicit def compareComparables[T](x: T)(implicit ord: Ordering[T]) = // error: result type of implicit definition needs to be given explicitly
44
new ord.OrderingOps(x)
5-
class Bippy { def compare(y: Bippy) = util Random }
5+
class Bippy { def compare(y: Bippy) = util.Random }
66
() < () // error: value `<` is not a member of Unit
77
}

tests/neg/i1707.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import language.postfixOps
12
object DepBug {
23
class A {
34
class B
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
-- [E018] Syntax Error: tests/neg-custom-args/i5498-postfixOps.scala:4:10 ----------------------------------------------
1+
-- [E018] Syntax Error: tests/neg/i5498-postfixOps.scala:4:10 ----------------------------------------------------------
22
4 | 1 second // error: usage of postfix operator
33
| ^
44
| expression expected but end of statement found
55
|
66
| longer explanation available when compiling with `-explain`
7-
-- [E018] Syntax Error: tests/neg-custom-args/i5498-postfixOps.scala:6:37 ----------------------------------------------
7+
-- [E018] Syntax Error: tests/neg/i5498-postfixOps.scala:6:37 ----------------------------------------------------------
88
6 | Seq(1, 2).filter(List(1,2) contains) // error: usage of postfix operator // error
99
| ^
1010
| expression expected but ')' found
1111
|
1212
| longer explanation available when compiling with `-explain`
13-
-- Error: tests/neg-custom-args/i5498-postfixOps.scala:6:0 -------------------------------------------------------------
13+
-- Error: tests/neg/i5498-postfixOps.scala:6:0 -------------------------------------------------------------------------
1414
6 | Seq(1, 2).filter(List(1,2) contains) // error: usage of postfix operator // error
1515
|^
1616
|no implicit argument of type scala.concurrent.duration.DurationConversions.Classifier[Null] was found for parameter ev of method second in trait DurationConversions

tests/neg/i7438.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import language.postfixOps
12
type Tr[+A]
23
extension [A, B](tr: Tr[A]) inline def map(f: A => B): Tr[B] = ???
34

tests/neg/i9344.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
import language.postfixOps
22
object Test {
33
val I1: Int = 0 * * * 8 * 1 - 1 + 1 + // error
44
}

tests/neg/parser-stability-7.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import language.postfixOps
12
class x0[x1] {
23
def x2: x1
34
}

tests/neg/t6124.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
import language.postfixOps
22
trait T {
33
def f = 3_14_E-2 // error
44
def e = 3_14E-_2 // error

tests/pos-custom-args/i5498-postfixOps.scala

Lines changed: 0 additions & 9 deletions
This file was deleted.

tests/pos/i5498-postfixOps.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import scala.concurrent.duration.*
22

3+
import scala.language.postfixOps
4+
35
def test() = {
4-
// only OK since the defaultOptions in the TestConfiguration includes -language:postfixOps
56
1 second
67

7-
Seq(1, 2).filter(List(1,2) contains)
8-
}
8+
Seq(1, 2) filter (List(1,2) contains) toList
9+
}

tests/pos/test-desugar.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import language.postfixOps
12
object desugar {
23

34
// variables

tests/run/t8346.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ object Test extends App {
2727
inits foreach {case (name, singleton) =>
2828
print(s"${name}: ")
2929
val one = singleton(1)
30-
println(Seq(2,3,4).scanLeft(one)(_ + _) map sVarInfo toList)
30+
println(Seq(2,3,4).scanLeft(one)(_ + _).map(sVarInfo).toList)
3131
}
3232

3333
println(s"ValueSet: ${sVarInfo(SomeEnum.values)}")

0 commit comments

Comments
 (0)