diff --git a/community-build/community-projects/intent b/community-build/community-projects/intent index 0cc2f9613e98..7625af676106 160000 --- a/community-build/community-projects/intent +++ b/community-build/community-projects/intent @@ -1 +1 @@ -Subproject commit 0cc2f9613e989f8d4e9cf2018d556cdd2bb9286a +Subproject commit 7625af676106c298e2a44d52c96b5ce947d5cc35 diff --git a/community-build/community-projects/scalatest b/community-build/community-projects/scalatest index e0ba43c80a10..4343430fd376 160000 --- a/community-build/community-projects/scalatest +++ b/community-build/community-projects/scalatest @@ -1 +1 @@ -Subproject commit e0ba43c80a10e94355ab4fa5a85c625c783cc3b4 +Subproject commit 4343430fd376ea3169cc3f052f560afe109747ba diff --git a/community-build/community-projects/scodec b/community-build/community-projects/scodec index fac1efba2bf9..e04ba7c17f84 160000 --- a/community-build/community-projects/scodec +++ b/community-build/community-projects/scodec @@ -1 +1 @@ -Subproject commit fac1efba2bf9ea353f026bb0f7a3b825a691584a +Subproject commit e04ba7c17f848a57425a7e0342c00c0314c9559d diff --git a/community-build/community-projects/scodec-bits b/community-build/community-projects/scodec-bits index fb362b135e0f..61bddaee1e8b 160000 --- a/community-build/community-projects/scodec-bits +++ b/community-build/community-projects/scodec-bits @@ -1 +1 @@ -Subproject commit fb362b135e0f9e700f584f9766bbc115cabb2501 +Subproject commit 61bddaee1e8bceb155fc8f1861200464c485d819 diff --git a/community-build/community-projects/shapeless b/community-build/community-projects/shapeless index ce4820deda2f..a7cb88516d62 160000 --- a/community-build/community-projects/shapeless +++ b/community-build/community-projects/shapeless @@ -1 +1 @@ -Subproject commit ce4820deda2f3a9bc7f5c2f7d3cfa7d42307a4a3 +Subproject commit a7cb88516d628c09e4e7fa8183bf2af0bf054370 diff --git a/community-build/community-projects/utest b/community-build/community-projects/utest index 338899d51a7a..ee30db53faf7 160000 --- a/community-build/community-projects/utest +++ b/community-build/community-projects/utest @@ -1 +1 @@ -Subproject commit 338899d51a7a530fdadb7b91f4b19148c0e496cc +Subproject commit ee30db53faf7ca1b42eb58087812f1c7ae087150 diff --git a/community-build/community-projects/xml-interpolator b/community-build/community-projects/xml-interpolator index 287e37c13557..b744dff4553b 160000 --- a/community-build/community-projects/xml-interpolator +++ b/community-build/community-projects/xml-interpolator @@ -1 +1 @@ -Subproject commit 287e37c13557f10b6e1fe31304b74f0df79ee51d +Subproject commit b744dff4553b7f7d9855bb9943a868fafc4db101 diff --git a/compiler/src/dotty/tools/dotc/parsing/Parsers.scala b/compiler/src/dotty/tools/dotc/parsing/Parsers.scala index 5aba3e43e368..5b838307f82c 100644 --- a/compiler/src/dotty/tools/dotc/parsing/Parsers.scala +++ b/compiler/src/dotty/tools/dotc/parsing/Parsers.scala @@ -3286,40 +3286,11 @@ object Parsers { makeConstructor(Nil, vparamss, rhs).withMods(mods).setComment(in.getDocComment(start)) } else { - var mods1 = addFlag(mods, Method) - var isInfix = false - def extParamss() = - try paramClause(0, prefix = true) :: Nil - finally - mods1 = addFlag(mods, ExtensionMethod) - if in.token == DOT then in.nextToken() - else - isInfix = true - newLineOpt() - val (leadingTparams, leadingVparamss) = - if in.token == LBRACKET then - (typeParamClause(ParamOwner.Def), extParamss()) - else if in.token == LPAREN then - (Nil, extParamss()) - else - (Nil, Nil) + val mods1 = addFlag(mods, Method) val ident = termIdent() var name = ident.name.asTermName - if mods1.is(ExtensionMethod) then name = name.toExtensionName - if isInfix && !name.isOperatorName then - val infixAnnot = Apply(wrapNew(scalaAnnotationDot(tpnme.infix)), Nil) - .withSpan(Span(start, start)) - mods1 = mods1.withAddedAnnotation(infixAnnot) - val tparams = - if in.token == LBRACKET then - if mods1.is(ExtensionMethod) then syntaxError("no type parameters allowed here") - typeParamClause(ParamOwner.Def) - else leadingTparams - val vparamss = paramClauses() match - case rparams :: rparamss if leadingVparamss.nonEmpty && ident.name.isRightAssocOperatorName => - rparams :: leadingVparamss ::: rparamss - case rparamss => - leadingVparamss ::: rparamss + val tparams = typeParamClauseOpt(ParamOwner.Def) + val vparamss = paramClauses() var tpt = fromWithinReturnType { if in.token == COLONEOL then in.token = COLON // a hack to allow diff --git a/compiler/test/dotty/tools/repl/ReplCompilerTests.scala b/compiler/test/dotty/tools/repl/ReplCompilerTests.scala index 681ce83d22a2..ac35f05c4727 100644 --- a/compiler/test/dotty/tools/repl/ReplCompilerTests.scala +++ b/compiler/test/dotty/tools/repl/ReplCompilerTests.scala @@ -170,8 +170,8 @@ class ReplCompilerTests extends ReplTest { run(""" |trait Ord[T] { | def compare(x: T, y: T): Int - | def (x: T) < (y: T) = compare(x, y) < 0 - | def (x: T) > (y: T) = compare(x, y) > 0 + | extension (x: T) def < (y: T) = compare(x, y) < 0 + | extension (x: T) def > (y: T) = compare(x, y) > 0 |} | |given IntOrd as Ord[Int] { diff --git a/tests/pos/i7700.scala b/tests/pos/i7700.scala index 6d19f0811cc4..fdcfc23c9105 100644 --- a/tests/pos/i7700.scala +++ b/tests/pos/i7700.scala @@ -7,6 +7,6 @@ object Macros: extension (sc: StringContext) inline def show(args: =>Any*): String = ??? object Show: - def[A] (a: A) show(using S: Show[A]): String = S.show(a) + extension [A] (a: A) def show(using S: Show[A]): String = S.show(a) export Macros.show \ No newline at end of file diff --git a/tests/pos/i8198.scala b/tests/pos/i8198.scala index 4d586fc34085..3946624acd83 100644 --- a/tests/pos/i8198.scala +++ b/tests/pos/i8198.scala @@ -1,10 +1,11 @@ trait Eq[A] { - def (x: A) === (y: A): Boolean - def (x: A) /== (y: A): Boolean = !(x === y) + extension (x: A) + def === (y: A): Boolean + def /== (y: A): Boolean = !(x === y) } case class Id[T](id: T) given idEq[A](using eqA: Eq[A]) as Eq[Id[A]] = new { - def (i1: Id[A]) === (i2: Id[A]) = !(i1.id /== i2.id) + extension (i1: Id[A]) def === (i2: Id[A]) = !(i1.id /== i2.id) } diff --git a/tests/run/extension-methods.scala b/tests/run/extension-methods.scala index 649c2c6aea93..897f3ff41896 100644 --- a/tests/run/extension-methods.scala +++ b/tests/run/extension-methods.scala @@ -62,8 +62,8 @@ object Test extends App { } class ListOrd[T: Ord] extends Ord[List[T]] { - def (xs: List[T]) - compareTo (ys: List[T]): Int = (xs, ys) match { + extension (xs: List[T]) + def compareTo (ys: List[T]): Int = (xs, ys) match { case (Nil, Nil) => 0 case (Nil, _) => -1 case (_, Nil) => +1 @@ -89,11 +89,9 @@ object Test extends App { } trait Monad[F[_]] extends Functor[F] { - def [A, B](x: F[A]) - flatMap (f: A => F[B]): F[B] - - def [A, B](x: F[A]) - map (f: A => B) = x.flatMap(f `andThen` pure) + extension [A, B](x: F[A]) + def flatMap (f: A => F[B]): F[B] + def map (f: A => B) = x.flatMap(f `andThen` pure) def pure[A](x: A): F[A] }