From 47760c4fea2d7727e4aa7c543fff729b53a80f4a Mon Sep 17 00:00:00 2001 From: odersky Date: Sat, 12 Mar 2022 13:08:20 +0100 Subject: [PATCH 1/3] Decide on postfix ops in parser Parse a postfix op only if language.postfixOps is imported. This helps avoiding non-sensical parses. Previously we always parsed, but issued errors in Typer if postfix ops were not enabled. --- .../src/dotty/tools/dotc/ast/Desugar.scala | 16 ++------- .../dotty/tools/dotc/parsing/Parsers.scala | 27 ++++++++------- .../dotty/tools/dotc/parsing/Scanners.scala | 9 +++++ tests/neg-custom-args/i5498-postfixOps.check | 34 ++++++++----------- tests/neg-custom-args/i5498-postfixOps.scala | 2 +- 5 files changed, 41 insertions(+), 47 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/ast/Desugar.scala b/compiler/src/dotty/tools/dotc/ast/Desugar.scala index 3578e4e0f10b..3ca7290d7c63 100644 --- a/compiler/src/dotty/tools/dotc/ast/Desugar.scala +++ b/compiler/src/dotty/tools/dotc/ast/Desugar.scala @@ -1722,28 +1722,16 @@ object desugar { // This is a deliberate departure from scalac, where StringContext is not rooted (See #4732) Apply(Select(Apply(scalaDot(nme.StringContext), strs), id).withSpan(tree.span), elems) case PostfixOp(t, op) => - if ((ctx.mode is Mode.Type) && !isBackquoted(op) && op.name == tpnme.raw.STAR) { + if (ctx.mode is Mode.Type) && !isBackquoted(op) && op.name == tpnme.raw.STAR then if ctx.isJava then AppliedTypeTree(ref(defn.RepeatedParamType), t) else Annotated( AppliedTypeTree(ref(defn.SeqType), t), New(ref(defn.RepeatedAnnot.typeRef), Nil :: Nil)) - } - else { + else assert(ctx.mode.isExpr || ctx.reporter.errorsReported || ctx.mode.is(Mode.Interactive), ctx.mode) - if (!enabled(nme.postfixOps)) { - report.error( - s"""postfix operator `${op.name}` needs to be enabled - |by making the implicit value scala.language.postfixOps visible. - |---- - |This can be achieved by adding the import clause 'import scala.language.postfixOps' - |or by setting the compiler option -language:postfixOps. - |See the Scaladoc for value scala.language.postfixOps for a discussion - |why the feature needs to be explicitly enabled.""".stripMargin, t.srcPos) - } Select(t, op.name) - } case PrefixOp(op, t) => val nspace = if (ctx.mode.is(Mode.Type)) tpnme else nme Select(t, nspace.UNARY_PREFIX ++ op.name) diff --git a/compiler/src/dotty/tools/dotc/parsing/Parsers.scala b/compiler/src/dotty/tools/dotc/parsing/Parsers.scala index ed993249c65b..893f797709e1 100644 --- a/compiler/src/dotty/tools/dotc/parsing/Parsers.scala +++ b/compiler/src/dotty/tools/dotc/parsing/Parsers.scala @@ -52,6 +52,9 @@ object Parsers { enum ParamOwner: case Class, Type, TypeParam, Def + enum ParseKind: + case Expr, Type, Pattern + type StageKind = Int object StageKind { val None = 0 @@ -939,18 +942,19 @@ object Parsers { def infixOps( first: Tree, canStartOperand: Token => Boolean, operand: Location => Tree, location: Location, - isType: Boolean, - isOperator: => Boolean, - maybePostfix: Boolean = false): Tree = { + kind: ParseKind, + isOperator: => Boolean): Tree = val base = opStack def recur(top: Tree): Tree = + val isType = kind == ParseKind.Type if (isIdent && isOperator) { - val op = if (isType) typeIdent() else termIdent() + val op = if isType then typeIdent() else termIdent() val top1 = reduceStack(base, top, precedence(op.name), !op.name.isRightAssocOperatorName, op.name, isType) opStack = OpInfo(top1, op, in.offset) :: opStack colonAtEOLOpt() newLineOptWhenFollowing(canStartOperand) + val maybePostfix = kind == ParseKind.Expr && in.postfixOpsEnabled if (maybePostfix && !canStartOperand(in.token)) { val topInfo = opStack.head opStack = opStack.tail @@ -973,7 +977,7 @@ object Parsers { else top recur(first) - } + end infixOps /* -------- IDENTIFIERS AND LITERALS ------------------------------------------- */ @@ -1525,8 +1529,7 @@ object Parsers { def infixType(): Tree = infixTypeRest(refinedType()) def infixTypeRest(t: Tree): Tree = - infixOps(t, canStartTypeTokens, refinedTypeFn, Location.ElseWhere, - isType = true, + infixOps(t, canStartTypeTokens, refinedTypeFn, Location.ElseWhere, ParseKind.Type, isOperator = !followingIsVararg()) /** RefinedType ::= WithType {[nl] Refinement} @@ -2218,10 +2221,8 @@ object Parsers { t def postfixExprRest(t: Tree, location: Location): Tree = - infixOps(t, in.canStartExprTokens, prefixExpr, location, - isType = false, - isOperator = !(location.inArgs && followingIsVararg()), - maybePostfix = true) + infixOps(t, in.canStartExprTokens, prefixExpr, location, ParseKind.Expr, + isOperator = !(location.inArgs && followingIsVararg())) /** PrefixExpr ::= [PrefixOperator'] SimpleExpr * PrefixOperator ::= ‘-’ | ‘+’ | ‘~’ | ‘!’ @@ -2708,8 +2709,8 @@ object Parsers { /** InfixPattern ::= SimplePattern {id [nl] SimplePattern} */ def infixPattern(): Tree = - infixOps(simplePattern(), in.canStartExprTokens, simplePatternFn, Location.InPattern, - isType = false, + infixOps( + simplePattern(), in.canStartExprTokens, simplePatternFn, Location.InPattern, ParseKind.Pattern, isOperator = in.name != nme.raw.BAR && !followingIsVararg()) /** SimplePattern ::= PatVar diff --git a/compiler/src/dotty/tools/dotc/parsing/Scanners.scala b/compiler/src/dotty/tools/dotc/parsing/Scanners.scala index f36176083792..bf3d667a4604 100644 --- a/compiler/src/dotty/tools/dotc/parsing/Scanners.scala +++ b/compiler/src/dotty/tools/dotc/parsing/Scanners.scala @@ -213,6 +213,15 @@ object Scanners { fewerBracesEnabledCtx = myLanguageImportContext fewerBracesEnabledCache + private var postfixOpsEnabledCache = false + private var postfixOpsEnabledCtx: Context = NoContext + + def postfixOpsEnabled = + if postfixOpsEnabledCtx ne myLanguageImportContext then + postfixOpsEnabledCache = featureEnabled(nme.postfixOps) + postfixOpsEnabledCtx = myLanguageImportContext + postfixOpsEnabledCache + /** All doc comments kept by their end position in a `Map`. * * Note: the map is necessary since the comments are looked up after an diff --git a/tests/neg-custom-args/i5498-postfixOps.check b/tests/neg-custom-args/i5498-postfixOps.check index 2360790035ed..be458d1bd930 100644 --- a/tests/neg-custom-args/i5498-postfixOps.check +++ b/tests/neg-custom-args/i5498-postfixOps.check @@ -1,20 +1,16 @@ --- Error: tests/neg-custom-args/i5498-postfixOps.scala:4:2 ------------------------------------------------------------- +-- [E018] Syntax Error: tests/neg-custom-args/i5498-postfixOps.scala:4:10 ---------------------------------------------- 4 | 1 second // error: usage of postfix operator - | ^ - | postfix operator `second` needs to be enabled - | by making the implicit value scala.language.postfixOps visible. - | ---- - | This can be achieved by adding the import clause 'import scala.language.postfixOps' - | or by setting the compiler option -language:postfixOps. - | See the Scaladoc for value scala.language.postfixOps for a discussion - | why the feature needs to be explicitly enabled. --- Error: tests/neg-custom-args/i5498-postfixOps.scala:6:23 ------------------------------------------------------------ -6 | Seq(1, 2).filter(List(1,2) contains) // error: usage of postfix operator - | ^^^^^^^^^ - | postfix operator `contains` needs to be enabled - | by making the implicit value scala.language.postfixOps visible. - | ---- - | This can be achieved by adding the import clause 'import scala.language.postfixOps' - | or by setting the compiler option -language:postfixOps. - | See the Scaladoc for value scala.language.postfixOps for a discussion - | why the feature needs to be explicitly enabled. \ No newline at end of file + | ^ + | expression expected but end of statement found + | + | longer explanation available when compiling with `-explain` +-- [E018] Syntax Error: tests/neg-custom-args/i5498-postfixOps.scala:6:37 ---------------------------------------------- +6 | Seq(1, 2).filter(List(1,2) contains) // error: usage of postfix operator // error + | ^ + | expression expected but ')' found + | + | longer explanation available when compiling with `-explain` +-- Error: tests/neg-custom-args/i5498-postfixOps.scala:6:0 ------------------------------------------------------------- +6 | Seq(1, 2).filter(List(1,2) contains) // error: usage of postfix operator // error + |^ + |no implicit argument of type scala.concurrent.duration.DurationConversions.Classifier[Null] was found for parameter ev of method second in trait DurationConversions diff --git a/tests/neg-custom-args/i5498-postfixOps.scala b/tests/neg-custom-args/i5498-postfixOps.scala index 79b73717db6a..6dd89517bf52 100644 --- a/tests/neg-custom-args/i5498-postfixOps.scala +++ b/tests/neg-custom-args/i5498-postfixOps.scala @@ -3,5 +3,5 @@ import scala.concurrent.duration.* def test() = { 1 second // error: usage of postfix operator - Seq(1, 2).filter(List(1,2) contains) // error: usage of postfix operator + Seq(1, 2).filter(List(1,2) contains) // error: usage of postfix operator // error } From 740ac67285d92d51ab3a6ae93c2306da48662f48 Mon Sep 17 00:00:00 2001 From: odersky Date: Sat, 12 Mar 2022 13:36:26 +0100 Subject: [PATCH 2/3] Drop language.postfixOps as a default option in build and test --- .../tools/backend/jvm/BytecodeWriters.scala | 4 ++-- .../dotty/tools/dotc/config/PathResolver.scala | 2 +- .../dotty/tools/dotc/CompilationTests.scala | 2 -- .../dotty/tools/vulpix/TestConfiguration.scala | 2 +- project/Build.scala | 2 +- tests/neg/i12361.scala | 1 + tests/neg/i14564.check | 17 +++++++++++++++++ tests/neg/i14564.scala | 6 ++++++ tests/neg/i1672.scala | 2 +- tests/neg/i1707.scala | 1 + .../i5498-postfixOps.check | 6 +++--- .../i5498-postfixOps.scala | 0 tests/neg/i7438.scala | 1 + tests/neg/i9344.scala | 2 +- tests/neg/parser-stability-7.scala | 1 + tests/neg/t6124.scala | 2 +- tests/pos-custom-args/i5498-postfixOps.scala | 9 --------- tests/pos/i5498-postfixOps.scala | 7 ++++--- tests/pos/test-desugar.scala | 1 + tests/run/t8346.scala | 2 +- 20 files changed, 44 insertions(+), 26 deletions(-) create mode 100644 tests/neg/i14564.check create mode 100644 tests/neg/i14564.scala rename tests/{neg-custom-args => neg}/i5498-postfixOps.check (72%) rename tests/{neg-custom-args => neg}/i5498-postfixOps.scala (100%) delete mode 100644 tests/pos-custom-args/i5498-postfixOps.scala diff --git a/compiler/src/dotty/tools/backend/jvm/BytecodeWriters.scala b/compiler/src/dotty/tools/backend/jvm/BytecodeWriters.scala index 4fcdee72b03a..06a787978a0b 100644 --- a/compiler/src/dotty/tools/backend/jvm/BytecodeWriters.scala +++ b/compiler/src/dotty/tools/backend/jvm/BytecodeWriters.scala @@ -100,7 +100,7 @@ trait BytecodeWriters { super.writeClass(label, jclassName, jclassBytes, outfile) val segments = jclassName.split("[./]") - val asmpFile = segments.foldLeft(baseDir: Path)(_ / _) changeExtension "asmp" toFile; + val asmpFile = segments.foldLeft(baseDir: Path)(_ / _).changeExtension("asmp").toFile asmpFile.parent.createDirectory() emitAsmp(jclassBytes, asmpFile) @@ -131,7 +131,7 @@ trait BytecodeWriters { super.writeClass(label, jclassName, jclassBytes, outfile) val pathName = jclassName - val dumpFile = pathName.split("[./]").foldLeft(baseDir: Path) (_ / _) changeExtension "class" toFile; + val dumpFile = pathName.split("[./]").foldLeft(baseDir: Path) (_ / _).changeExtension("class").toFile dumpFile.parent.createDirectory() val outstream = new DataOutputStream(new FileOutputStream(dumpFile.path)) diff --git a/compiler/src/dotty/tools/dotc/config/PathResolver.scala b/compiler/src/dotty/tools/dotc/config/PathResolver.scala index e3d912b16ed4..f9c49c1a7723 100644 --- a/compiler/src/dotty/tools/dotc/config/PathResolver.scala +++ b/compiler/src/dotty/tools/dotc/config/PathResolver.scala @@ -30,7 +30,7 @@ object PathResolver { def ppcp(s: String): String = split(s) match { case Nil => "" case Seq(x) => x - case xs => xs map ("\n" + _) mkString + case xs => xs.map("\n" + _).mkString } /** Values found solely by inspecting environment or property variables. diff --git a/compiler/test/dotty/tools/dotc/CompilationTests.scala b/compiler/test/dotty/tools/dotc/CompilationTests.scala index 25ad1846742b..f8089dfcabfa 100644 --- a/compiler/test/dotty/tools/dotc/CompilationTests.scala +++ b/compiler/test/dotty/tools/dotc/CompilationTests.scala @@ -58,7 +58,6 @@ class CompilationTests { compileFile("tests/pos-special/kind-projector.scala", defaultOptions.and("-Ykind-projector")), compileFile("tests/pos-special/kind-projector-underscores.scala", defaultOptions.and("-Ykind-projector:underscores")), compileFile("tests/run/i5606.scala", defaultOptions.and("-Yretain-trees")), - compileFile("tests/pos-custom-args/i5498-postfixOps.scala", defaultOptions withoutLanguageFeature "postfixOps"), compileFile("tests/pos-custom-args/i8875.scala", defaultOptions.and("-Xprint:getters")), compileFile("tests/pos-custom-args/i9267.scala", defaultOptions.and("-Ystop-after:erasure")), compileFile("tests/pos-special/extend-java-enum.scala", defaultOptions.and("-source", "3.0-migration")), @@ -180,7 +179,6 @@ class CompilationTests { compileFile("tests/neg-custom-args/kind-projector.scala", defaultOptions.and("-Ykind-projector")), compileFile("tests/neg-custom-args/kind-projector-underscores.scala", defaultOptions.and("-Ykind-projector:underscores")), compileFile("tests/neg-custom-args/typeclass-derivation2.scala", defaultOptions.and("-language:experimental.erasedDefinitions")), - compileFile("tests/neg-custom-args/i5498-postfixOps.scala", defaultOptions withoutLanguageFeature "postfixOps"), compileFile("tests/neg-custom-args/deptypes.scala", defaultOptions.and("-language:experimental.dependent")), compileFile("tests/neg-custom-args/matchable.scala", defaultOptions.and("-Xfatal-warnings", "-source", "future")), compileFile("tests/neg-custom-args/i7314.scala", defaultOptions.and("-Xfatal-warnings", "-source", "future")), diff --git a/compiler/test/dotty/tools/vulpix/TestConfiguration.scala b/compiler/test/dotty/tools/vulpix/TestConfiguration.scala index fb04b91b29d9..0f86dae82f5a 100644 --- a/compiler/test/dotty/tools/vulpix/TestConfiguration.scala +++ b/compiler/test/dotty/tools/vulpix/TestConfiguration.scala @@ -62,7 +62,7 @@ object TestConfiguration { val yCheckOptions = Array("-Ycheck:all") - val commonOptions = Array("-indent", "-language:postfixOps") ++ checkOptions ++ noCheckOptions ++ yCheckOptions + val commonOptions = Array("-indent") ++ checkOptions ++ noCheckOptions ++ yCheckOptions val defaultOptions = TestFlags(basicClasspath, commonOptions) val unindentOptions = TestFlags(basicClasspath, Array("-no-indent") ++ checkOptions ++ noCheckOptions ++ yCheckOptions) val withCompilerOptions = diff --git a/project/Build.scala b/project/Build.scala index c0c3b9dec320..7e2126b7adf6 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -170,7 +170,7 @@ object Build { "-unchecked", "-Xfatal-warnings", "-encoding", "UTF8", - "-language:existentials,higherKinds,implicitConversions,postfixOps" + "-language:existentials,higherKinds,implicitConversions" ), (Compile / compile / javacOptions) ++= Seq("-Xlint:unchecked", "-Xlint:deprecation"), diff --git a/tests/neg/i12361.scala b/tests/neg/i12361.scala index dfef0321d7c1..3baec5758248 100644 --- a/tests/neg/i12361.scala +++ b/tests/neg/i12361.scala @@ -1,3 +1,4 @@ +import language.postfixOps object Test { foo = macro Impls . foo [ U ] += // error // error } diff --git a/tests/neg/i14564.check b/tests/neg/i14564.check new file mode 100644 index 000000000000..c93e1317a95e --- /dev/null +++ b/tests/neg/i14564.check @@ -0,0 +1,17 @@ +-- [E018] Syntax Error: tests/neg/i14564.scala:5:28 -------------------------------------------------------------------- +5 |def test = sum"${ List(42)* }" // error // error + | ^ + | expression expected but '}' found + | + | longer explanation available when compiling with `-explain` +-- [E008] Not Found Error: tests/neg/i14564.scala:5:26 ----------------------------------------------------------------- +5 |def test = sum"${ List(42)* }" // error // error + | ^^^^^^^^^ + | value * is not a member of List[Int], but could be made available as an extension method. + | + | One of the following imports might make progress towards fixing the problem: + | + | import math.Fractional.Implicits.infixFractionalOps + | import math.Integral.Implicits.infixIntegralOps + | import math.Numeric.Implicits.infixNumericOps + | diff --git a/tests/neg/i14564.scala b/tests/neg/i14564.scala new file mode 100644 index 000000000000..c8d8c369575e --- /dev/null +++ b/tests/neg/i14564.scala @@ -0,0 +1,6 @@ +import language.postfixOps as _ + +extension (sc: StringContext) def sum(xs: Int*): String = xs.sum.toString + +def test = sum"${ List(42)* }" // error // error + diff --git a/tests/neg/i1672.scala b/tests/neg/i1672.scala index a3df6e2247bc..5885e61fe209 100644 --- a/tests/neg/i1672.scala +++ b/tests/neg/i1672.scala @@ -2,6 +2,6 @@ class Test { implicit def compareComparables[T](x: T)(implicit ord: Ordering[T]) = // error: result type of implicit definition needs to be given explicitly new ord.OrderingOps(x) - class Bippy { def compare(y: Bippy) = util Random } + class Bippy { def compare(y: Bippy) = util.Random } () < () // error: value `<` is not a member of Unit } diff --git a/tests/neg/i1707.scala b/tests/neg/i1707.scala index 7b0486539b7d..ede2dc75d3c7 100644 --- a/tests/neg/i1707.scala +++ b/tests/neg/i1707.scala @@ -1,3 +1,4 @@ +import language.postfixOps object DepBug { class A { class B diff --git a/tests/neg-custom-args/i5498-postfixOps.check b/tests/neg/i5498-postfixOps.check similarity index 72% rename from tests/neg-custom-args/i5498-postfixOps.check rename to tests/neg/i5498-postfixOps.check index be458d1bd930..5c776ec1c9d2 100644 --- a/tests/neg-custom-args/i5498-postfixOps.check +++ b/tests/neg/i5498-postfixOps.check @@ -1,16 +1,16 @@ --- [E018] Syntax Error: tests/neg-custom-args/i5498-postfixOps.scala:4:10 ---------------------------------------------- +-- [E018] Syntax Error: tests/neg/i5498-postfixOps.scala:4:10 ---------------------------------------------------------- 4 | 1 second // error: usage of postfix operator | ^ | expression expected but end of statement found | | longer explanation available when compiling with `-explain` --- [E018] Syntax Error: tests/neg-custom-args/i5498-postfixOps.scala:6:37 ---------------------------------------------- +-- [E018] Syntax Error: tests/neg/i5498-postfixOps.scala:6:37 ---------------------------------------------------------- 6 | Seq(1, 2).filter(List(1,2) contains) // error: usage of postfix operator // error | ^ | expression expected but ')' found | | longer explanation available when compiling with `-explain` --- Error: tests/neg-custom-args/i5498-postfixOps.scala:6:0 ------------------------------------------------------------- +-- Error: tests/neg/i5498-postfixOps.scala:6:0 ------------------------------------------------------------------------- 6 | Seq(1, 2).filter(List(1,2) contains) // error: usage of postfix operator // error |^ |no implicit argument of type scala.concurrent.duration.DurationConversions.Classifier[Null] was found for parameter ev of method second in trait DurationConversions diff --git a/tests/neg-custom-args/i5498-postfixOps.scala b/tests/neg/i5498-postfixOps.scala similarity index 100% rename from tests/neg-custom-args/i5498-postfixOps.scala rename to tests/neg/i5498-postfixOps.scala diff --git a/tests/neg/i7438.scala b/tests/neg/i7438.scala index 32c375d55674..c8737fd4acd4 100644 --- a/tests/neg/i7438.scala +++ b/tests/neg/i7438.scala @@ -1,3 +1,4 @@ +import language.postfixOps type Tr[+A] extension [A, B](tr: Tr[A]) inline def map(f: A => B): Tr[B] = ??? diff --git a/tests/neg/i9344.scala b/tests/neg/i9344.scala index c305c6a84805..a20bc477f5ac 100644 --- a/tests/neg/i9344.scala +++ b/tests/neg/i9344.scala @@ -1,4 +1,4 @@ - +import language.postfixOps object Test { val I1: Int = 0 * * * 8 * 1 - 1 + 1 + // error } diff --git a/tests/neg/parser-stability-7.scala b/tests/neg/parser-stability-7.scala index 27d391ed9396..7bfb24f7e540 100644 --- a/tests/neg/parser-stability-7.scala +++ b/tests/neg/parser-stability-7.scala @@ -1,3 +1,4 @@ +import language.postfixOps class x0[x1] { def x2: x1 } diff --git a/tests/neg/t6124.scala b/tests/neg/t6124.scala index a0c7e6fd7d26..c8d1944dd95e 100644 --- a/tests/neg/t6124.scala +++ b/tests/neg/t6124.scala @@ -1,4 +1,4 @@ - +import language.postfixOps trait T { def f = 3_14_E-2 // error def e = 3_14E-_2 // error diff --git a/tests/pos-custom-args/i5498-postfixOps.scala b/tests/pos-custom-args/i5498-postfixOps.scala deleted file mode 100644 index c85239c7440f..000000000000 --- a/tests/pos-custom-args/i5498-postfixOps.scala +++ /dev/null @@ -1,9 +0,0 @@ -import scala.concurrent.duration.* - -import scala.language.postfixOps - -def test() = { - 1 second - - Seq(1, 2) filter (List(1,2) contains) toList -} diff --git a/tests/pos/i5498-postfixOps.scala b/tests/pos/i5498-postfixOps.scala index f890f4d2c8f1..c85239c7440f 100644 --- a/tests/pos/i5498-postfixOps.scala +++ b/tests/pos/i5498-postfixOps.scala @@ -1,8 +1,9 @@ import scala.concurrent.duration.* +import scala.language.postfixOps + def test() = { - // only OK since the defaultOptions in the TestConfiguration includes -language:postfixOps 1 second - Seq(1, 2).filter(List(1,2) contains) -} \ No newline at end of file + Seq(1, 2) filter (List(1,2) contains) toList +} diff --git a/tests/pos/test-desugar.scala b/tests/pos/test-desugar.scala index abe358ce8874..89627ff63ce7 100644 --- a/tests/pos/test-desugar.scala +++ b/tests/pos/test-desugar.scala @@ -1,3 +1,4 @@ +import language.postfixOps object desugar { // variables diff --git a/tests/run/t8346.scala b/tests/run/t8346.scala index 0ac817dbc7ff..cae6756fdbb1 100644 --- a/tests/run/t8346.scala +++ b/tests/run/t8346.scala @@ -27,7 +27,7 @@ object Test extends App { inits foreach {case (name, singleton) => print(s"${name}: ") val one = singleton(1) - println(Seq(2,3,4).scanLeft(one)(_ + _) map sVarInfo toList) + println(Seq(2,3,4).scanLeft(one)(_ + _).map(sVarInfo).toList) } println(s"ValueSet: ${sVarInfo(SomeEnum.values)}") From 8c92ee1d5e5b680db86a79f7fe49263c0506c25a Mon Sep 17 00:00:00 2001 From: odersky Date: Sat, 12 Mar 2022 14:03:33 +0100 Subject: [PATCH 3/3] Fix postfixOps usages in build --- compiler/test/dotty/tools/repl/TabcompleteTests.scala | 4 ++-- .../src/dotty/tools/scaladoc/tasty/comments/wiki/Parser.scala | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/test/dotty/tools/repl/TabcompleteTests.scala b/compiler/test/dotty/tools/repl/TabcompleteTests.scala index ca38d0725141..6335e609de86 100644 --- a/compiler/test/dotty/tools/repl/TabcompleteTests.scala +++ b/compiler/test/dotty/tools/repl/TabcompleteTests.scala @@ -176,7 +176,7 @@ class TabcompleteTests extends ReplTest { | case dot_product_* | case __system | - |Foo."""stripMargin)) + |Foo.""".stripMargin)) } @@ -192,7 +192,7 @@ class TabcompleteTests extends ReplTest { | case dot_product_* | case __system | - |Foo.`bac"""stripMargin)) + |Foo.`bac""".stripMargin)) } @Test def commands = initially { diff --git a/scaladoc/src/dotty/tools/scaladoc/tasty/comments/wiki/Parser.scala b/scaladoc/src/dotty/tools/scaladoc/tasty/comments/wiki/Parser.scala index a844f3384793..bd39abb7d41f 100644 --- a/scaladoc/src/dotty/tools/scaladoc/tasty/comments/wiki/Parser.scala +++ b/scaladoc/src/dotty/tools/scaladoc/tasty/comments/wiki/Parser.scala @@ -461,7 +461,7 @@ final class Parser( stack.length > 0 && char != endOfText }) do {} - list mkString + list.mkString } def getInline(isInlineEnd: => Boolean, textTransform: String => String = identity): Inline = {