diff --git a/compiler/src/dotty/tools/dotc/parsing/Parsers.scala b/compiler/src/dotty/tools/dotc/parsing/Parsers.scala index 677ba880de8d..6c5eaf315ffa 100644 --- a/compiler/src/dotty/tools/dotc/parsing/Parsers.scala +++ b/compiler/src/dotty/tools/dotc/parsing/Parsers.scala @@ -3320,11 +3320,7 @@ object Parsers { mods1 = mods1.withAddedAnnotation(infixAnnot) val tparams = if in.token == LBRACKET then - if mods1.is(Extension) then - if leadingTparams.isEmpty then - deprecationWarning("type parameters in extension methods should be written after `def`") - else - syntaxError("no type parameters allowed here") + if mods1.is(Extension) then syntaxError("no type parameters allowed here") typeParamClause(ParamOwner.Def) else leadingTparams val vparamss = paramClauses() match diff --git a/tests/init/crash/i5606.scala b/tests/init/crash/i5606.scala index a7b9fc340b60..f84c752e9b90 100644 --- a/tests/init/crash/i5606.scala +++ b/tests/init/crash/i5606.scala @@ -1,6 +1,6 @@ object Test extends App { - def (f: A => B) `$`[A, B](a: A): B = f(a) + def [A, B](f: A => B) `$` (a: A): B = f(a) assert((((a: Int) => a.toString()) `$` 10) == "10") diff --git a/tests/neg/i6662.scala b/tests/neg/i6662.scala index 4f0d0eb11a28..3c50327e718b 100644 --- a/tests/neg/i6662.scala +++ b/tests/neg/i6662.scala @@ -1,9 +1,9 @@ opaque type Opt[A >: Null] = A -inline def (x: Opt[A]) nonEmpty[A >: Null]: Boolean = x.get != null // error: Implementation restriction -inline def (x: Opt[A]) isEmpty[A >: Null]: Boolean = x.get == null // error: Implementation restriction -inline def (x: Opt[A]) isDefined[A >: Null]: Boolean = x.nonEmpty // error: Implementation restriction -inline def (x: Opt[A]) get[A >: Null]: A = Opt.unOpt(x) // error: Implementation restriction +inline def [A >: Null](x: Opt[A]) nonEmpty: Boolean = x.get != null // error: Implementation restriction +inline def [A >: Null](x: Opt[A]) isEmpty: Boolean = x.get == null // error: Implementation restriction +inline def [A >: Null](x: Opt[A]) isDefined: Boolean = x.nonEmpty // error: Implementation restriction +inline def [A >: Null](x: Opt[A]) get: A = Opt.unOpt(x) // error: Implementation restriction object Opt { diff --git a/tests/neg/i6762b.scala b/tests/neg/i6762b.scala index 187313380eb5..e5ad5cee17ed 100644 --- a/tests/neg/i6762b.scala +++ b/tests/neg/i6762b.scala @@ -9,5 +9,5 @@ type Liftable given Liftable = ??? implicit object ExprOps { - def (x: T).toExpr[T](using Liftable): Expr[T] = ??? + def [T](x: T).toExpr(using Liftable): Expr[T] = ??? } diff --git a/tests/neg/i6779.scala b/tests/neg/i6779.scala index 28d11ae43ac8..dabf54f28db6 100644 --- a/tests/neg/i6779.scala +++ b/tests/neg/i6779.scala @@ -3,7 +3,7 @@ type G[T] type Stuff given Stuff = ??? -def (x: T).f[T](using Stuff): F[T] = ??? +def [T](x: T).f(using Stuff): F[T] = ??? def g1[T](x: T): F[G[T]] = x.f(using summon[Stuff]) // error diff --git a/tests/neg/i7438.scala b/tests/neg/i7438.scala index a263a5fe2f24..a3168d28e703 100644 --- a/tests/neg/i7438.scala +++ b/tests/neg/i7438.scala @@ -1,5 +1,5 @@ type Tr[+A] -inline def (tr: Tr[A]).map[A, B](f: A => B): Tr[B] = ??? +inline def [A, B](tr: Tr[A]).map(f: A => B): Tr[B] = ??? def (d: Double).func: None.type => Some[Double] = ??? diff --git a/tests/pos/i6565.scala b/tests/pos/i6565.scala index 5e199001ff4e..da08245804ca 100644 --- a/tests/pos/i6565.scala +++ b/tests/pos/i6565.scala @@ -3,8 +3,8 @@ class Err type Lifted[A] = Err | A def point[O](o: O): Lifted[O] = o -def (o: Lifted[O]) map [O, U] (f: O => U): Lifted[U] = ??? -def (o: Lifted[O]) flatMap [O, U] (f: O => Lifted[U]): Lifted[U] = ??? +def [O, U](o: Lifted[O]).map(f: O => U): Lifted[U] = ??? +def [O, U](o: Lifted[O]).flatMap(f: O => Lifted[U]): Lifted[U] = ??? val error: Err = Err() diff --git a/tests/run-macros/i6772/Macro_1.scala b/tests/run-macros/i6772/Macro_1.scala index 0cf3c4acca12..407b97ef87e6 100644 --- a/tests/run-macros/i6772/Macro_1.scala +++ b/tests/run-macros/i6772/Macro_1.scala @@ -7,7 +7,7 @@ object Macros { def mImpl()(using QuoteContext): Expr[Any] = List(Expr(1), Expr(2), Expr(3)).toExprOfList - def (list: List[Expr[T]]).toExprOfList[T](using Type[T], QuoteContext): Expr[List[T]] = '{ + def [T](list: List[Expr[T]]).toExprOfList(using Type[T], QuoteContext): Expr[List[T]] = '{ val buff = List.newBuilder[T] ${ Expr.block(list.map(v => '{ buff += $v }), '{ buff.result() }) } } diff --git a/tests/run-macros/reflect-sourceCode/Macro_1.scala b/tests/run-macros/reflect-sourceCode/Macro_1.scala index 33bd0e98af57..8be8239cae25 100644 --- a/tests/run-macros/reflect-sourceCode/Macro_1.scala +++ b/tests/run-macros/reflect-sourceCode/Macro_1.scala @@ -1,7 +1,7 @@ import scala.quoted._ object api { - inline def (x: => T) reflect[T] : String = + inline def [T](x: => T).reflect: String = ${ reflImpl('x) } private def reflImpl[T](x: Expr[T])(implicit qctx: QuoteContext): Expr[String] = {