diff --git a/compiler/src/dotty/tools/dotc/ast/Desugar.scala b/compiler/src/dotty/tools/dotc/ast/Desugar.scala index 2e47c34f8c5a..74998424ac43 100644 --- a/compiler/src/dotty/tools/dotc/ast/Desugar.scala +++ b/compiler/src/dotty/tools/dotc/ast/Desugar.scala @@ -819,13 +819,13 @@ object desugar { /** Expand * - * opaque type T = [Xs] => R + * opaque type T = [Xs] =>> R * * to * * opaque type T = T.T * synthetic object T { - * synthetic opaque type T >: [Xs] => R + * synthetic opaque type T >: [Xs] =>> R * } * * The generated companion object will later (in Namer) be merged with the user-defined diff --git a/compiler/src/dotty/tools/dotc/parsing/Parsers.scala b/compiler/src/dotty/tools/dotc/parsing/Parsers.scala index 1be923d6d778..5982bcdaf4cd 100644 --- a/compiler/src/dotty/tools/dotc/parsing/Parsers.scala +++ b/compiler/src/dotty/tools/dotc/parsing/Parsers.scala @@ -851,7 +851,7 @@ object Parsers { def toplevelTyp(): Tree = rejectWildcardType(typ()) /** Type ::= FunTypeMods FunArgTypes `=>' Type - * | HkTypeParamClause `->' Type + * | HkTypeParamClause `=>>' Type * | InfixType * FunArgTypes ::= InfixType * | `(' [ FunArgType {`,' FunArgType } ] `)' @@ -922,9 +922,9 @@ object Parsers { else if (in.token == LBRACKET) { val start = in.offset val tparams = typeParamClause(ParamOwner.TypeParam) - if (in.token == ARROW) + if (in.token == TLARROW) atSpan(start, in.skipToken())(LambdaTypeTree(tparams, toplevelTyp())) - else { accept(ARROW); typ() } + else { accept(TLARROW); typ() } } else infixType() diff --git a/compiler/src/dotty/tools/dotc/parsing/Tokens.scala b/compiler/src/dotty/tools/dotc/parsing/Tokens.scala index 962a596f5c0a..38785e436e79 100644 --- a/compiler/src/dotty/tools/dotc/parsing/Tokens.scala +++ b/compiler/src/dotty/tools/dotc/parsing/Tokens.scala @@ -195,13 +195,15 @@ object Tokens extends TokensCommon { final val SUPERTYPE = 81; enter(SUPERTYPE, ">:") final val HASH = 82; enter(HASH, "#") final val VIEWBOUND = 84; enter(VIEWBOUND, "<%") - final val QUOTE = 85; enter(QUOTE, "'") + final val TLARROW = 85; enter(TLARROW, "=>>") + + final val QUOTE = 86; enter(QUOTE, "'") /** XML mode */ final val XMLSTART = 96; enter(XMLSTART, "$XMLSTART$<") // TODO: deprecate final val alphaKeywords: TokenSet = tokenRange(IF, MACRO) - final val symbolicKeywords: TokenSet = tokenRange(USCORE, VIEWBOUND) + final val symbolicKeywords: TokenSet = tokenRange(USCORE, TLARROW) final val keywords: TokenSet = alphaKeywords | symbolicKeywords final val allTokens: TokenSet = tokenRange(minToken, maxToken) diff --git a/compiler/test-resources/repl/i6474 b/compiler/test-resources/repl/i6474 index 5937c9f7439a..da2763c07502 100644 --- a/compiler/test-resources/repl/i6474 +++ b/compiler/test-resources/repl/i6474 @@ -1,8 +1,8 @@ scala> object Foo1 { type T[+A] = (A, Int) } // defined object Foo1 -scala> object Foo2 { type T[+A] = [+B] => (A, B) } +scala> object Foo2 { type T[+A] = [+B] =>> (A, B) } // defined object Foo2 -scala> object Foo3 { type T[+A] = [+B] => [C] => (A, B) } +scala> object Foo3 { type T[+A] = [+B] =>> [C] =>> (A, B) } // defined object Foo3 scala> ((1, 2): Foo1.T[Int]): Foo1.T[Any] val res0: (Any, Int) = (1,2) @@ -14,7 +14,7 @@ scala> (1, 2): Foo3.T[Int][Int] | Missing type parameter for Foo3.T[Int][Int] scala> ((1, 2): Foo3.T[Int][Int][Int]): Foo3.T[Any][Int][Int] val res2: (Any, Int) = (1,2) -scala> object Foo3 { type T[A] = [B] => [C] => (A, B) } +scala> object Foo3 { type T[A] = [B] =>> [C] =>> (A, B) } // defined object Foo3 scala> ((1, 2): Foo3.T[Int][Int][Int]) val res3: (Int, Int) = (1,2) diff --git a/docs/blog/_posts/2018-04-27-eighth-dotty-milestone-release.md b/docs/blog/_posts/2018-04-27-eighth-dotty-milestone-release.md index 6df99e103c0b..4e042a103b30 100644 --- a/docs/blog/_posts/2018-04-27-eighth-dotty-milestone-release.md +++ b/docs/blog/_posts/2018-04-27-eighth-dotty-milestone-release.md @@ -68,8 +68,8 @@ def foo[T](x: T) = x match { Normally type parameters in Scala are partitioned into kinds. First-level types are types of values. Higher-kinded types are type constructors such as `List` or `Map`. The kind of a type is indicated by the top type of which it is a subtype. Normal types are subtypes of `Any`, covariant single -argument type constructors such as List are subtypes of `[+X] => Any`, and the `Map` type -constructor is a subtype of `[X, +Y] => Any`. +argument type constructors such as List are subtypes of `[+X] =>> Any`, and the `Map` type +constructor is a subtype of `[X, +Y] =>> Any`. Sometimes we would like to have type parameters that can have more than one kind, for instance to define an implicit value that works for parameters of any kind. This is now possible through a form @@ -87,7 +87,7 @@ legal: f[Int] f[List] f[Map] -f[[X] => String] +f[[X] =>> String] ``` **Note**: This feature is considered experimental and is only enabled under a compiler flag diff --git a/docs/docs/internals/syntax.md b/docs/docs/internals/syntax.md index 4729384f1cad..a8a02c5fe03e 100644 --- a/docs/docs/internals/syntax.md +++ b/docs/docs/internals/syntax.md @@ -99,6 +99,7 @@ package private protected override return super sealed then throw trait true try type val var while with yield : = <- => <: :> # @ +=>> ``` ### Soft keywords @@ -139,7 +140,7 @@ ClassQualifier ::= ‘[’ id ‘]’ ### Types ```ebnf Type ::= { ‘erased’ | ‘given’} FunArgTypes ‘=>’ Type Function(ts, t) - | HkTypeParamClause ‘=>’ Type TypeLambda(ps, t) + | HkTypeParamClause ‘=>>’ Type TypeLambda(ps, t) | MatchType | InfixType FunArgTypes ::= InfixType diff --git a/docs/docs/reference/contextual/typeclasses.md b/docs/docs/reference/contextual/typeclasses.md index e1547c82d069..943fa78d3484 100644 --- a/docs/docs/reference/contextual/typeclasses.md +++ b/docs/docs/reference/contextual/typeclasses.md @@ -55,7 +55,7 @@ implied ListMonad for Monad[List] { List(x) } -implied ReaderMonad[Ctx] for Monad[[X] => Ctx => X] { +implied ReaderMonad[Ctx] for Monad[[X] =>> Ctx => X] { def (r: Ctx => A) flatMap [A, B] (f: A => Ctx => B): Ctx => B = ctx => f(r(ctx))(ctx) def pure[A](x: A): Ctx => A = diff --git a/docs/docs/reference/new-types/type-lambdas-spec.md b/docs/docs/reference/new-types/type-lambdas-spec.md index c4580b6a635e..e989d72ae2a4 100644 --- a/docs/docs/reference/new-types/type-lambdas-spec.md +++ b/docs/docs/reference/new-types/type-lambdas-spec.md @@ -6,7 +6,7 @@ title: "Type Lambdas - More Details" ## Syntax ``` -Type ::= ... | HkTypeParamClause ‘=>’ Type +Type ::= ... | HkTypeParamClause ‘=>>’ Type HkTypeParamClause ::= ‘[’ HkTypeParam {‘,’ HkTypeParam} ‘]’ HkTypeParam ::= {Annotation} [‘+’ | ‘-’] (Id[HkTypeParamClause] | ‘_’) TypeBounds TypeBounds ::= [‘>:’ Type] [‘<:’ Type] @@ -14,14 +14,14 @@ TypeBounds ::= [‘>:’ Type] [‘<:’ Type] ### Type Checking -A type lambda such `[X] => F[X]` defines a function from types to types. The parameter(s) may carry bounds and variance annotations. -If a parameter is is bounded, as in `[X >: L <: H] => F[X]` it is checked that arguments to the parameters conform to the bounds `L` and `H`. +A type lambda such `[X] =>> F[X]` defines a function from types to types. The parameter(s) may carry bounds and variance annotations. +If a parameter is is bounded, as in `[X >: L <: H] =>> F[X]` it is checked that arguments to the parameters conform to the bounds `L` and `H`. Only the upper bound `H` can be F-bounded, i.e. `X` can appear in it. A variance annotation on a parameter indicates a subtyping relationship on type instances. For instance, given ```scala -type TL1 = [+A] => F[A] -type TL2 = [-A] => F[A] +type TL1 = [+A] =>> F[A] +type TL2 = [-A] =>> F[A] ``` and two types `S <: T`, we have ```scala @@ -37,8 +37,8 @@ It is checked that variance annotations on parameters of type lambdas are respec Assume two type lambdas ```scala -type TL1 = [v1 X >: L1 <: U1] => R1 -type TL2 = [v2 X >: L2 <: U2] => R2 +type TL1 = [v1 X >: L1 <: U1] =>> R1 +type TL2 = [v2 X >: L2 <: U2] =>> R2 ``` where `v1` and `v2` are optional variance annotations: `+`, `-`, or absent. Then `TL1 <: TL2`, if @@ -51,7 +51,7 @@ Then `TL1 <: TL2`, if Here we have relied on alpha renaming to bring match the two bound types `X`. A partially applied type constructor such as `List` is assumed to be equivalent to -its eta expansion. I.e, `List = [+X] => List[X]`. This allows type constructors +its eta expansion. I.e, `List = [+X] =>> List[X]`. This allows type constructors to be compared with type lambdas. ## Relationship with Parameterized Type Definitions @@ -62,7 +62,7 @@ type T[X] = R ``` is regarded as a shorthand for an unparameterized definition with a type lambda as right-hand side: ```scala -type T = [X] => R +type T = [X] =>> R ``` A parameterized abstract type @@ -71,7 +71,7 @@ type T[X] >: L <: U ``` is regarded as shorthand for an unparameterized abstract type with type lambdas as bounds. ```scala -type T >: ([X] => L) <: ([X] => U) +type T >: ([X] =>> L) <: ([X] =>> U) ``` However, if `L` is `Nothing` it is not parameterized, since `Nothing` is treated as a bottom type for all kinds. For instance, ```scala @@ -79,11 +79,11 @@ type T[-X] <: X => () ``` is expanded to ```scala -type T >: Nothing <: ([-X] => X => ()) +type T >: Nothing <: ([-X] =>> X => ()) ``` instead of ```scala -type T >: ([X] => Nothing) <: ([-X] => X => ()) +type T >: ([X] =>> Nothing) <: ([-X] =>> X => ()) ``` The same expansions apply to type parameters. E.g. @@ -92,7 +92,7 @@ The same expansions apply to type parameters. E.g. ``` is treated as a shorthand for ```scala -[F >: Nothing <: [X] => Coll[X]] +[F >: Nothing <: [X] =>> Coll[X]] ``` **Note**: The decision to treat `Nothing` as universal bottom type is provisional, and might be changed afer further discussion. @@ -103,7 +103,7 @@ is treated as a shorthand for The body of a type lambda can again be a type lambda. Example: ```scala -type TL = [X] => [Y] => (X, Y) +type TL = [X] =>> [Y] =>> (X, Y) ``` Currently, no special provision is made to infer type arguments to such curried type lambdas. This is left for future work. diff --git a/docs/docs/reference/new-types/type-lambdas.md b/docs/docs/reference/new-types/type-lambdas.md index 311438a0c77c..bcd40a378100 100644 --- a/docs/docs/reference/new-types/type-lambdas.md +++ b/docs/docs/reference/new-types/type-lambdas.md @@ -6,7 +6,7 @@ title: "Type Lambdas" A _type lambda_ lets one express a higher-kinded type directly, without a type definition. - [+X, Y] => Map[Y, X] + [+X, Y] =>> Map[Y, X] For instance, the type above defines a binary type constructor, with a covariant parameter `X` and a non-variant parameter `Y`. The @@ -19,6 +19,6 @@ definition or declaration such as is a shorthand for a plain type definition with a type-lambda as its right-hand side: - type T = [X] => (X, X) + type T = [X] =>> (X, X) [More details](./type-lambdas-spec.html) diff --git a/docs/docs/reference/other-new-features/kind-polymorphism.md b/docs/docs/reference/other-new-features/kind-polymorphism.md index 1703f4f429d5..2cdd89cf1669 100644 --- a/docs/docs/reference/other-new-features/kind-polymorphism.md +++ b/docs/docs/reference/other-new-features/kind-polymorphism.md @@ -5,10 +5,10 @@ title: "Kind Polymorphism" Normally type parameters in Scala are partitioned into _kinds_. First-level types are types of values. Higher-kinded types are type constructors such as `List` or `Map`. The kind of a type is indicated by the top type of which it is a subtype. Normal types are subtypes of `Any`, -covariant single argument type constructors such as `List` are subtypes of `[+X] => Any`, and the `Map` type constructor is -a subtype of `[X, +Y] => Any`. +covariant single argument type constructors such as `List` are subtypes of `[+X] =>> Any`, and the `Map` type constructor is +a subtype of `[X, +Y] =>> Any`. -A type can be used only as prescribed by its kind. Subtypes of `Any` cannot be applied to type arguments whereas subtypes of `[X] => Any` +A type can be used only as prescribed by its kind. Subtypes of `Any` cannot be applied to type arguments whereas subtypes of `[X] =>> Any` _must_ be applied to a type argument, unless they are passed to type parameters of the same kind. Sometimes we would like to have type parameters that can have more than one kind, for instance to define an implicit @@ -25,7 +25,7 @@ The actual type arguments of `f` can then be types of arbitrary kinds. So the fo f[Int] f[List] f[Map] -f[[X] => String] +f[[X] =>> String] ``` We call type parameters and abstract types with an `AnyKind` upper bound _any-kinded types_`. diff --git a/tests/neg/anykind.scala b/tests/neg/anykind.scala index 95f851fbb571..e73eab6ff0e9 100644 --- a/tests/neg/anykind.scala +++ b/tests/neg/anykind.scala @@ -12,7 +12,7 @@ object AnyKinds { } f[Int] // OK - f[[X] => X] // OK + f[[X] =>> X] // OK f[Nothing] // OK def g[X <: Any]: Any = { diff --git a/tests/neg/anykind2.scala b/tests/neg/anykind2.scala index 19972a686226..bde861e8202d 100644 --- a/tests/neg/anykind2.scala +++ b/tests/neg/anykind2.scala @@ -6,7 +6,7 @@ object AnyKinds { } f[Int] // OK - f[[X] => X] // OK + f[[X] =>> X] // OK f[Nothing] // OK def g[X <: Any]: Any = { diff --git a/tests/neg/enum-tparams.scala b/tests/neg/enum-tparams.scala index 7c951ca60b95..95ff54c6983b 100644 --- a/tests/neg/enum-tparams.scala +++ b/tests/neg/enum-tparams.scala @@ -11,11 +11,11 @@ object Test { type Id[_] enum E[F[_], G[_]] { - case C1() extends E[[X] => X, Id] - case C2() extends E[[F] => F, Id] - case C3() extends E[[X] => { type Y = F[Int] }, Id] - case C4() extends E[[X] => { type F = Int }, Id] - case C5() extends E[[F] => G[Int], Id] + case C1() extends E[[X] =>> X, Id] + case C2() extends E[[F] =>> F, Id] + case C3() extends E[[X] =>> { type Y = F[Int] }, Id] + case C4() extends E[[X] =>> { type F = Int }, Id] + case C5() extends E[[F] =>> G[Int], Id] } Opt.S[Int](1) // OK diff --git a/tests/neg/existentials.scala b/tests/neg/existentials.scala index 351febc7949b..c2128b2b91f5 100644 --- a/tests/neg/existentials.scala +++ b/tests/neg/existentials.scala @@ -1,7 +1,7 @@ object TestList { - var x: ([X] => List[List[X]])[_] = List(List(1)) // error: unreducible - var y: ([X] => List[Seq[X]])[_] = List(List(1)) // error: unreducible + var x: ([X] =>> List[List[X]])[_] = List(List(1)) // error: unreducible + var y: ([X] =>> List[Seq[X]])[_] = List(List(1)) // error: unreducible x = x y = y @@ -15,8 +15,8 @@ object TestList { } object TestSet { - var x: ([Y] => Set[Set[Y]])[_] = Set(Set("a")) // error: unreducible - var y: ([Y] => Set[Iterable[Y]])[_] = Set(Set("a")) // error: unreducible + var x: ([Y] =>> Set[Set[Y]])[_] = Set(Set("a")) // error: unreducible + var y: ([Y] =>> Set[Iterable[Y]])[_] = Set(Set("a")) // error: unreducible x = x y = y @@ -36,14 +36,14 @@ class TestX { def cmp: T => Boolean = (x == _) } - val x: ([Y] => C[C[Y]])[_] = new C(new C("a")) // error: unreducible + val x: ([Y] =>> C[C[Y]])[_] = new C(new C("a")) // error: unreducible type CC[X] = C[C[X]] val y: CC[_] = ??? // error: unreducible type D[X] <: C[X] - type DD = [X] => D[D[X]] + type DD = [X] =>> D[D[X]] val z: DD[_] = ??? // error: unreducible val g = x.get diff --git a/tests/neg/i1181c.scala b/tests/neg/i1181c.scala index 281640d95275..d7782f111977 100644 --- a/tests/neg/i1181c.scala +++ b/tests/neg/i1181c.scala @@ -1,6 +1,6 @@ // This program compiles with Dotty using refined types for application, but // does not compile with native applications. The reason is that in previous -// Dotty the parameter reference to the lambda [X, Y] => Foo[X, Y] was a TypeRef +// Dotty the parameter reference to the lambda [X, Y] =>> Foo[X, Y] was a TypeRef // which could be selected for partial application. But now the type lambda gets // substituted directly, which prevents that conversion. The program compiles // if the type lambda is replaced by a type alias (see pos/i1181c.scala). @@ -13,7 +13,7 @@ trait Bar[DD[_,_]] { object Test { type F[X, Y] = Foo[X] - trait Baz extends Bar[[X,Y] => Foo[X]] { + trait Baz extends Bar[[X,Y] =>> Foo[X]] { def foo[M[_,_]](x: M[Int, Int]) = x foo(x) // error: found: Foo[Int](Baz.this.x) required: M[Int, Int] diff --git a/tests/neg/i2151.scala b/tests/neg/i2151.scala index 1ae034c02fab..a492ecc5ec50 100644 --- a/tests/neg/i2151.scala +++ b/tests/neg/i2151.scala @@ -1,6 +1,6 @@ trait Test { - type Nil = [K] => K - type StrangeCons[H, Tail <: [H, A] => H] = Tail[H, H] + type Nil = [K] =>> K + type StrangeCons[H, Tail <: [H, A] =>> H] = Tail[H, H] def list: StrangeCons[Int, Nil] // error } diff --git a/tests/neg/i2232.scala b/tests/neg/i2232.scala index e0f83683d42a..f67d9d4a185c 100644 --- a/tests/neg/i2232.scala +++ b/tests/neg/i2232.scala @@ -3,9 +3,9 @@ object Cats { implicit def trivial[A]: Trivial[A] = new Trivial[A] { } type Obj[C[_[_[_], _[_, _]]]] = - [A] => C[({type l[c0[_], c1[_, _]] = c0[A] })#l] + [A] =>> C[({type l[c0[_], c1[_, _]] = c0[A] })#l] type Cat[C[_[_[_], _[_, _]]]] = - [A, B] => C[({type l[c0[_], c1[_, _]] = c1[A, B]})#l] + [A, B] =>> C[({type l[c0[_], c1[_, _]] = c1[A, B]})#l] trait Category[C[_[_[_], _[_, _]]]] { type -> = Cats.Cat[C] diff --git a/tests/neg/i3452.scala b/tests/neg/i3452.scala index c018c386b17d..1b16ff3d4d56 100644 --- a/tests/neg/i3452.scala +++ b/tests/neg/i3452.scala @@ -3,7 +3,7 @@ object Test { trait TC[A] - implicit def case1[F[_]](implicit t: => TC[F[Any]]): TC[Tuple2K[[_] => Any, F, Any]] = ??? + implicit def case1[F[_]](implicit t: => TC[F[Any]]): TC[Tuple2K[[_] =>> Any, F, Any]] = ??? implicit def case2[A, F[_]](implicit r: TC[F[Any]]): TC[A] = ??? implicitly[TC[Int]] // error diff --git a/tests/neg/i3976.scala b/tests/neg/i3976.scala index 6ffd7a9707a4..dc17fe927d64 100644 --- a/tests/neg/i3976.scala +++ b/tests/neg/i3976.scala @@ -1,7 +1,7 @@ object Test { enum Hoge[F[_]] derives Eql { case A extends Hoge[List] - case B extends Hoge[[X] => String] + case B extends Hoge[[X] =>> String] } import Hoge._ @@ -19,8 +19,8 @@ object Test { object Test2 { enum Hoge[F[G[_]]] derives Eql { - case A extends Hoge[[F[_]] => F[Int]] - case B extends Hoge[[F[_]] => F[String]] + case A extends Hoge[[F[_]] =>> F[Int]] + case B extends Hoge[[F[_]] =>> F[String]] } import Hoge._ @@ -38,8 +38,8 @@ object Test2 { object Test3 { enum Hoge[F[G[_]]] derives Eql { - case A extends Hoge[[X] => List] // error: wrong kind - case B extends Hoge[[X] => [Y] => String] // error: wrong kind + case A extends Hoge[[X] =>> List] // error: wrong kind + case B extends Hoge[[X] =>> [Y] =>> String] // error: wrong kind } import Hoge._ diff --git a/tests/neg/i4557a.scala b/tests/neg/i4557a.scala index 9cdec6a5391b..ad9b17f3058d 100644 --- a/tests/neg/i4557a.scala +++ b/tests/neg/i4557a.scala @@ -1,6 +1,6 @@ class A[X] object T { - type Foo[X, Y] = [Z] => A[X] + type Foo[X, Y] = [Z] =>> A[X] class B extends Foo[Int, Int] // error } diff --git a/tests/neg/i5592.scala b/tests/neg/i5592.scala index f86746f55396..699a858df5c0 100644 --- a/tests/neg/i5592.scala +++ b/tests/neg/i5592.scala @@ -4,7 +4,7 @@ object Test { trait EQ[A, B] { def sub[F[_]]: F[A] => F[B]; - def commute: EQ[B, A] = this.sub[[b] => EQ[b, A]](implicitly[EQ[A, A]]) + def commute: EQ[B, A] = this.sub[[b] =>> EQ[b, A]](implicitly[EQ[A, A]]) } implicit def typeEq[A]: EQ[A, A] = new EQ[A, A] { def sub[F[_]]: F[A] => F[A] = identity @@ -12,18 +12,18 @@ object Test { // these are both fine val eqReflexive1: (x: Obj) => (EQ[x.type, x.type]) = { x: Obj => implicitly } - val eqReflexive2: Forall[[x] => EQ[x, x]] = { x: Obj => implicitly } + val eqReflexive2: Forall[[x] =>> EQ[x, x]] = { x: Obj => implicitly } // this compiles val eqSymmetric1: (x: Obj) => (y: Obj) => EQ[x.type, y.type] => EQ[y.type, x.type] = { { x: Obj => { y: Obj => { xEqy: EQ[x.type, y.type] => xEqy.commute } } } } - val eqSymmetric2: Forall[[x] => (y: Obj) => (EQ[x, y.type]) => (EQ[y.type, x])] = { + val eqSymmetric2: Forall[[x] =>> (y: Obj) => (EQ[x, y.type]) => (EQ[y.type, x])] = { { x: Obj => { y: Obj => { xEqy: EQ[x.type, y.type] => xEqy.commute } } } // error // error } - val eqSymmetric3: Forall[[x] => Forall[[y] => EQ[x, y] => EQ[y, x]]] = { + val eqSymmetric3: Forall[[x] =>> Forall[[y] =>> EQ[x, y] => EQ[y, x]]] = { { x: Obj => { y: Obj => { xEqy: EQ[x.type, y.type] => xEqy.commute } } } // error // error } } \ No newline at end of file diff --git a/tests/neg/type-lambdas-posttyper.scala b/tests/neg/type-lambdas-posttyper.scala index 55fffd7e129b..5eed086ad632 100644 --- a/tests/neg/type-lambdas-posttyper.scala +++ b/tests/neg/type-lambdas-posttyper.scala @@ -2,7 +2,7 @@ object Test extends App { trait Ord[X] - type TL1 = [X <: Ord[X]] => (X, X) + type TL1 = [X <: Ord[X]] =>> (X, X) class C extends Ord[C] @@ -13,10 +13,10 @@ object Test extends App { var x: X = init } - type TL3 = [+X] => Ref[X] // error: covariant type parameter X occurs in nonvariant position in Test.Ref[X] + type TL3 = [+X] =>> Ref[X] // error: covariant type parameter X occurs in nonvariant position in Test.Ref[X] type TL4[-X] = X => X // error: contravariant type parameter X occurs in covariant position in X => X - def f[F <: [+X] => Any](x: F[String]): F[Any] = x + def f[F <: [+X] =>> Any](x: F[String]): F[Any] = x val sref = new Ref[String]("abc") val aref: Ref[Any] = f[TL3](sref) @@ -27,15 +27,15 @@ object Test extends App { type Neg2[-X] >: X // error type Neg3[-X] <: X // error - type Neg4 = [-X] => X // error - type Neg5 >: [-X] => X <: [-X] => Any // error - type Neg6 <: [-X] => X // error + type Neg4 = [-X] =>> X // error + type Neg5 >: [-X] =>> X <: [-X] =>> Any // error + type Neg6 <: [-X] =>> X // error type Pos1[+X] = Ref[X] // error type Pos2[+X] >: Ref[X] // error type Pos3[+X] <: Ref[X] // error - type Pos4 = [+X] => Ref[X] // error - type Pos5 >: [+X] => Ref[X] <: [+X] => Any // error - type Pos6 <: [+X] => Ref[X] // error + type Pos4 = [+X] =>> Ref[X] // error + type Pos5 >: [+X] =>> Ref[X] <: [+X] =>> Any // error + type Pos6 <: [+X] =>> Ref[X] // error } diff --git a/tests/neg/type-lambdas.scala b/tests/neg/type-lambdas.scala index 6c048c40f7a6..ebf5a5d58ced 100644 --- a/tests/neg/type-lambdas.scala +++ b/tests/neg/type-lambdas.scala @@ -2,7 +2,7 @@ object Test extends App { trait Ord[X] - type TL1 = [X <: Ord[X]] => (X, X) // OK - type TL2 = [X >: Ord[X]] => (X, X) // error: illegal cyclic reference: lower bound Test.Ord[X] of type X refers back to the type itself + type TL1 = [X <: Ord[X]] =>> (X, X) // OK + type TL2 = [X >: Ord[X]] =>> (X, X) // error: illegal cyclic reference: lower bound Test.Ord[X] of type X refers back to the type itself } diff --git a/tests/pos/i2989.scala b/tests/pos/i2989.scala index 4042b87059fe..0768b4898c58 100644 --- a/tests/pos/i2989.scala +++ b/tests/pos/i2989.scala @@ -2,11 +2,11 @@ class Foo[+X[_]] { // OK def foo1[Y[_]](right: Foo[Y]): Foo[Y] = right // OK - def foo2[Y[_]](right: Foo[[T] => Y[T]]): Foo[Y] = right + def foo2[Y[_]](right: Foo[[T] =>> Y[T]]): Foo[Y] = right // OK - def foo3[Y[_]](right: Foo[[T] => Y[T]]): Foo[[T] => Y[T]] = right + def foo3[Y[_]](right: Foo[[T] =>> Y[T]]): Foo[[T] =>> Y[T]] = right // Error: // found: Foo[Y](right) // required: Foo[Y] - def foo4[Y[_]](right: Foo[Y]): Foo[[T] => Y[T]] = right + def foo4[Y[_]](right: Foo[Y]): Foo[[T] =>> Y[T]] = right } diff --git a/tests/pos/i3381.scala b/tests/pos/i3381.scala index 432a0947a780..5ac6513e559a 100644 --- a/tests/pos/i3381.scala +++ b/tests/pos/i3381.scala @@ -1,7 +1,7 @@ case class Tuple2K[X, A[_], B[_]](a: A[X], b: B[X]) object Test { - def f[X](x: Tuple2K[X, Option, [Y] => Tuple2K[Y, Option, Option]]): Any = + def f[X](x: Tuple2K[X, Option, [Y] =>> Tuple2K[Y, Option, Option]]): Any = x match { case Tuple2K(_, Tuple2K(_, _)) => ??? } diff --git a/tests/pos/i3544.scala b/tests/pos/i3544.scala index 8a8b5fbc8a75..56493d1a9a96 100644 --- a/tests/pos/i3544.scala +++ b/tests/pos/i3544.scala @@ -1,6 +1,6 @@ object Test { case class Tuple2K[F[_], G[_], A](f: F[A], g: G[A]) - val p0: Tuple2K[[X] => Int, [X] => String, Any] = Tuple2K(1, "s") + val p0: Tuple2K[[X] =>> Int, [X] =>> String, Any] = Tuple2K(1, "s") p0 == Tuple2K(List(1), Option("s")) } diff --git a/tests/pos/i3976.scala b/tests/pos/i3976.scala index 03ae4bb146cf..a17738903115 100644 --- a/tests/pos/i3976.scala +++ b/tests/pos/i3976.scala @@ -1,7 +1,7 @@ object Test { enum Hoge[F[_]] { case A extends Hoge[List] - case B extends Hoge[[X] => String] + case B extends Hoge[[X] =>> String] } import Hoge._ diff --git a/tests/pos/i4884.scala b/tests/pos/i4884.scala index 0270bbe8129f..cb1f8bd6f3b6 100644 --- a/tests/pos/i4884.scala +++ b/tests/pos/i4884.scala @@ -39,8 +39,8 @@ object Test { type Q2[c <: C] = g.H[c] type R1[c <: C] = f.G[c] & g.H[c] type R2[c <: C] = f.G[c] | g.H[c] - type S1[c <: C] = ([X <: C] => f.F[X] & g.G[X])[c] - type S2[c <: C] = ([X <: C] => f.F[X] | g.G[X])[c] + type S1[c <: C] = ([X <: C] =>> f.F[X] & g.G[X])[c] + type S2[c <: C] = ([X <: C] =>> f.F[X] | g.G[X])[c] } def f3(f: TestConstructor4[A], g: f.TestConstructor5[B]): Unit = { type P1[c <: C] = g.MSet[c] diff --git a/tests/pos/i5720.scala b/tests/pos/i5720.scala index 3906b288c1ec..c9151df27138 100644 --- a/tests/pos/i5720.scala +++ b/tests/pos/i5720.scala @@ -23,73 +23,73 @@ package object opaquetypes { opaque type Logarithm = Double object Logarithm { class ALogarithm[B[_] <: Logarithm] - type ALog = ALogarithm[[x] => Logarithm] - type ALogD = ALogarithm[[x] => Double] - type ALogN = ALogarithm[[x] => Nothing] + type ALog = ALogarithm[[x] =>> Logarithm] + type ALogD = ALogarithm[[x] =>> Double] + type ALogN = ALogarithm[[x] =>> Nothing] - type A1Log = opaquetypes.ALogarithm[[x] => Logarithm] - // type A1LogD = opaquetypes.ALogarithm[[x] => Double] - type A1LogN = opaquetypes.ALogarithm[[x] => Nothing] + type A1Log = opaquetypes.ALogarithm[[x] =>> Logarithm] + // type A1LogD = opaquetypes.ALogarithm[[x] =>> Double] + type A1LogN = opaquetypes.ALogarithm[[x] =>> Nothing] class ALogNested[B[_] <: Logarithm] class ValClLogNested(val i: Logarithm) extends AnyVal class AValClLogNested[B[_] <: ValClLogNested] - type A = AValClLogNested[[x] => ValClLogNested] - type AN = AValClLogNested[[x] => Nothing] + type A = AValClLogNested[[x] =>> ValClLogNested] + type AN = AValClLogNested[[x] =>> Nothing] } class ValClLog(val i: Logarithm) extends AnyVal class AValClLog[B[_] <: ValClLog] - type AClLog = AValClLog[[x] => ValClLog] - type AClLogN = AValClLog[[x] => Nothing] + type AClLog = AValClLog[[x] =>> ValClLog] + type AClLogN = AValClLog[[x] =>> Nothing] class ADouble[B[_] <: Double] - type AD = ADouble[[x] => Double] - type ADN = ADouble[[x] => Nothing] + type AD = ADouble[[x] =>> Double] + type ADN = ADouble[[x] =>> Nothing] class ALogarithm[B[_] <: Logarithm] - type ALog = ALogarithm[[x] => Logarithm] - type ALogN = ALogarithm[[x] => Nothing] + type ALog = ALogarithm[[x] =>> Logarithm] + type ALogN = ALogarithm[[x] =>> Nothing] - type A1Log = Logarithm.ALogarithm[[x] => Logarithm] - type A1LogN = Logarithm.ALogarithm[[x] => Nothing] + type A1Log = Logarithm.ALogarithm[[x] =>> Logarithm] + type A1LogN = Logarithm.ALogarithm[[x] =>> Nothing] } object Main { - type AU = AUnit[[x] => Unit] - type AUN = AUnit[[x] => Nothing] + type AU = AUnit[[x] =>> Unit] + type AUN = AUnit[[x] =>> Nothing] - type AB = ABoolean[[x] => Boolean] - type ABN = ABoolean[[x] => Nothing] + type AB = ABoolean[[x] =>> Boolean] + type ABN = ABoolean[[x] =>> Nothing] - type ABy = AByte[[x] => Byte] - type AByN = AByte[[x] => Nothing] + type ABy = AByte[[x] =>> Byte] + type AByN = AByte[[x] =>> Nothing] - type AC = AChar[[x] => Char] - type ACN = AChar[[x] => Nothing] + type AC = AChar[[x] =>> Char] + type ACN = AChar[[x] =>> Nothing] - type AS = AShort[[x] => Short] - type ASN = AShort[[x] => Nothing] + type AS = AShort[[x] =>> Short] + type ASN = AShort[[x] =>> Nothing] - type AI = AInt[[x] => Int] - type AIN = AInt[[x] => Nothing] + type AI = AInt[[x] =>> Int] + type AIN = AInt[[x] =>> Nothing] - type AL = ALong[[x] => Long] - type ALN = ALong[[x] => Nothing] + type AL = ALong[[x] =>> Long] + type ALN = ALong[[x] =>> Nothing] - type AF = AFloat[[x] => Float] - type AFN = AFloat[[x] => Nothing] + type AF = AFloat[[x] =>> Float] + type AFN = AFloat[[x] =>> Nothing] - type AD = ADouble[[x] => Double] - type ADN = ADouble[[x] => Nothing] + type AD = ADouble[[x] =>> Double] + type ADN = ADouble[[x] =>> Nothing] - type ACU = AValClU[[x] => ValClU] - type ACUN = AValClU[[x] => Nothing] + type ACU = AValClU[[x] =>> ValClU] + type ACUN = AValClU[[x] =>> Nothing] - type ACI = AValClI[[x] => ValClI] - type ACIN = AValClI[[x] => Nothing] + type ACI = AValClI[[x] =>> ValClI] + type ACIN = AValClI[[x] =>> Nothing] } diff --git a/tests/pos/i6014-gadt.scala b/tests/pos/i6014-gadt.scala index 721c638051f0..39d2222fb76c 100644 --- a/tests/pos/i6014-gadt.scala +++ b/tests/pos/i6014-gadt.scala @@ -29,7 +29,7 @@ object Test3 { case t: T => t } - type K1Top = [t] => Any + type K1Top = [t] =>> Any class Foo[F <: K1Top] diff --git a/tests/pos/i6451.scala b/tests/pos/i6451.scala index 4ab1cc93209e..35dd1a625e37 100644 --- a/tests/pos/i6451.scala +++ b/tests/pos/i6451.scala @@ -1,6 +1,6 @@ object Test { - type YZ = [Y[_]] => [Z[_]] => [T] => Y[Z[T]] + type YZ = [Y[_]] =>> [Z[_]] =>> [T] =>> Y[Z[T]] val r1: List[List[Int]] = ??? def r2(): List[List[Int]] = ??? diff --git a/tests/pos/nestedLambdas.scala b/tests/pos/nestedLambdas.scala index 2e96fa225bc0..869c11bfc838 100644 --- a/tests/pos/nestedLambdas.scala +++ b/tests/pos/nestedLambdas.scala @@ -1,8 +1,8 @@ class Test { - type T = [X] => [Y] => (X, Y) + type T = [X] =>> [Y] =>> (X, Y) - type A[X] = [Y] => (X, Y) + type A[X] = [Y] =>> (X, Y) type B[X] = (X, X) diff --git a/tests/pos/polytypes.scala b/tests/pos/polytypes.scala index e0e2224b8496..66f8e946c4cd 100644 --- a/tests/pos/polytypes.scala +++ b/tests/pos/polytypes.scala @@ -1,6 +1,6 @@ object Test { - type T = [X] => (List[X] => List[X]) + type T = [X] =>> (List[X] => List[X]) def reverse[X](xs: List[X]): List[X] = ??? diff --git a/tests/pos/quotedPatterns.scala b/tests/pos/quotedPatterns.scala index 1309c8067845..51ab38df54be 100644 --- a/tests/pos/quotedPatterns.scala +++ b/tests/pos/quotedPatterns.scala @@ -28,7 +28,7 @@ object Test { val a: quoted.matching.Bind[Int => Int => Int] = ff z case '{ def $ff[T](i: T): Int = $z; 2 } => - val a: quoted.matching.Bind[[T] => T => Int] = ff + val a: quoted.matching.Bind[[T] =>> T => Int] = ff z case _ => '{1} } diff --git a/tests/pos/reference/instances.scala b/tests/pos/reference/instances.scala index 23f99bc207ee..2be625f1460b 100644 --- a/tests/pos/reference/instances.scala +++ b/tests/pos/reference/instances.scala @@ -66,7 +66,7 @@ object Instances extends Common { List(x) } - implied ReaderMonad[Ctx] for Monad[[X] => Ctx => X] { + implied ReaderMonad[Ctx] for Monad[[X] =>> Ctx => X] { def (r: Ctx => A) flatMap[A, B] (f: A => Ctx => B): Ctx => B = ctx => f(r(ctx))(ctx) def pure[A](x: A): Ctx => A = diff --git a/tests/pos/reference/type-lambdas.scala b/tests/pos/reference/type-lambdas.scala index 7456456dc113..a6fdcc42460d 100644 --- a/tests/pos/reference/type-lambdas.scala +++ b/tests/pos/reference/type-lambdas.scala @@ -2,9 +2,9 @@ package typeLambdas object Test { - type T = [+X, Y] => Map[Y, X] + type T = [+X, Y] =>> Map[Y, X] - type CTL = [X] => [Y] => (X, Y) + type CTL = [X] =>> [Y] =>> (X, Y) type T3 = CTL[Int][String] type T2[+X <: X => X] = Any // OK - variance is not checked in param bounds diff --git a/tests/pos/simpleRefinement.scala b/tests/pos/simpleRefinement.scala index 3b6500feddd3..010c46659fad 100644 --- a/tests/pos/simpleRefinement.scala +++ b/tests/pos/simpleRefinement.scala @@ -3,7 +3,7 @@ class Foo { val bar = new Bar { type S = Int type T = Int => Int - type U = [X] => Int + type U = [X] =>> Int val x: Long = 2L def y: Boolean = true def z(): Char = 'f' @@ -16,7 +16,7 @@ class Foo { trait Bar { type S type T - type U <: [X] => Any + type U <: [X] =>> Any val x: Any def y: Any def z(): Any diff --git a/tests/pos/tcpoly_bounds1.scala b/tests/pos/tcpoly_bounds1.scala index 651ae48a6846..b01797656c8a 100644 --- a/tests/pos/tcpoly_bounds1.scala +++ b/tests/pos/tcpoly_bounds1.scala @@ -1,5 +1,5 @@ trait Monad[m[x <: Bound[x]], Bound[x], a] // TODO: variances! -trait ListMonad[a] extends Monad[List, [X] => Any, a] // Dotty difference: Any is not a legal argument for hk type. +trait ListMonad[a] extends Monad[List, [X] =>> Any, a] // Dotty difference: Any is not a legal argument for hk type. trait MyOrdered[a] trait MySet[x <: MyOrdered[x]] diff --git a/tests/pos/tcpoly_overloaded.scala b/tests/pos/tcpoly_overloaded.scala index f272590f72c8..99705284aae4 100644 --- a/tests/pos/tcpoly_overloaded.scala +++ b/tests/pos/tcpoly_overloaded.scala @@ -11,7 +11,7 @@ trait Monad[T <: Bound[T], MyType[x <: Bound[x]], Bound[_]] { trait Test { def moo: MList[Int] - class MList[T](el: T) extends Monad[T, List, [X] => Any] { + class MList[T](el: T) extends Monad[T, List, [X] =>> Any] { def flatMap[S <: RBound[S], RContainer[x <: RBound[x]], RBound[_], Result[x <: RBound[x]] <: Monad[x, RContainer, RBound]] (f: T => Result[S]): Result[S] = sys.error("foo") @@ -21,5 +21,5 @@ trait Test { def flatMap[S] (f: T => List[S], foo: Int): List[S] = sys.error("foo") } - val l: MList[String] = moo.flatMap[String, List, [X] => Any, MList]((x: Int) => new MList("String")) + val l: MList[String] = moo.flatMap[String, List, [X] =>> Any, MList]((x: Int) => new MList("String")) } diff --git a/tests/pos/typeclass-encoding3.scala b/tests/pos/typeclass-encoding3.scala index e3a9c5e5f4ab..925ba911e3a3 100644 --- a/tests/pos/typeclass-encoding3.scala +++ b/tests/pos/typeclass-encoding3.scala @@ -315,7 +315,7 @@ object Test { implicit def $eq$gt_Monad[Ctx]: $eq$gt_Monad[Ctx] = new $eq$gt_Monad[Ctx] - g[F = [X] => Int => X]((ctx: Int) => 1, x => (ctx: Int) => x.toString) + g[F = [X] =>> Int => X]((ctx: Int) => 1, x => (ctx: Int) => x.toString) /* --------------------------------------------------------------------------------- diff --git a/tests/run/extension-methods.scala b/tests/run/extension-methods.scala index 93df1c946483..dd0091c9c8c4 100644 --- a/tests/run/extension-methods.scala +++ b/tests/run/extension-methods.scala @@ -100,7 +100,7 @@ object Test extends App { List(x) } - class ReaderMonad[Ctx] extends Monad[[X] => Ctx => X] { + class ReaderMonad[Ctx] extends Monad[[X] =>> Ctx => X] { def (r: Ctx => A) flatMap [A, B](f: A => Ctx => B): Ctx => B = ctx => f(r(ctx))(ctx) def pure[A](x: A): Ctx => A = diff --git a/tests/run/implicit-functors.scala b/tests/run/implicit-functors.scala index 7788b68c7e56..a37c932923d7 100644 --- a/tests/run/implicit-functors.scala +++ b/tests/run/implicit-functors.scala @@ -1,6 +1,6 @@ object Utils { type Id[t] = t - type Const[c] = [t] => c + type Const[c] = [t] =>> c } import Utils._ diff --git a/tests/run/implicit-functors2.scala b/tests/run/implicit-functors2.scala index 9a813253e9a3..783b7ac5e7a4 100644 --- a/tests/run/implicit-functors2.scala +++ b/tests/run/implicit-functors2.scala @@ -1,6 +1,6 @@ object Utils { type Id[t] = t - type Const[c] = [t] => c + type Const[c] = [t] =>> c } import Utils._ @@ -20,7 +20,7 @@ object Functor { implicit val functorId: Functor[Id] = new Functor("functorId") - implicit def functorNested[F[_], G[_]](implicit ff: Functor[F], fg: Functor[G]): Functor[[t] => F[G[t]]] = new Functor(s"functorNested($ff, $fg)") + implicit def functorNested[F[_], G[_]](implicit ff: Functor[F], fg: Functor[G]): Functor[[t] =>> F[G[t]]] = new Functor(s"functorNested($ff, $fg)") implicit def functorGen[F[_]](implicit inst: K1.Instances[Functor, F]): Functor[F] = new Functor(s"functorGen($inst") @@ -29,7 +29,7 @@ object Functor { sealed trait Opt[+A] object Opt { - implicit def optInstances[F[_[_]]](implicit fs: F[Sm], fn: F[[t] => Nn.type]): ErasedCoproductInstances { type FT = F[Opt] ; type C = F } = + implicit def optInstances[F[_[_]]](implicit fs: F[Sm], fn: F[[t] =>> Nn.type]): ErasedCoproductInstances { type FT = F[Opt] ; type C = F } = new ErasedCoproductInstances(s"optInstances($fs, $fn)") { type FT = F[Opt] ; type C = F } } @@ -45,6 +45,6 @@ object Test extends App { assert(Functor[Const[Nn.type]].toString == "functorConst") assert(Functor[Sm].toString == "functorGen(smInstances(functorId)") assert(Functor[Opt].toString == "functorGen(optInstances(functorGen(smInstances(functorId), functorConst)") - assert(Functor[[t] => Opt[Opt[t]]].toString == "functorNested(functorGen(optInstances(functorGen(smInstances(functorId), functorConst), functorGen(optInstances(functorGen(smInstances(functorId), functorConst))") + assert(Functor[[t] =>> Opt[Opt[t]]].toString == "functorNested(functorGen(optInstances(functorGen(smInstances(functorId), functorConst), functorGen(optInstances(functorGen(smInstances(functorId), functorConst))") } diff --git a/tests/run/instances-anonymous.scala b/tests/run/instances-anonymous.scala index 1c41cb25e19e..d29771db7b9d 100644 --- a/tests/run/instances-anonymous.scala +++ b/tests/run/instances-anonymous.scala @@ -109,7 +109,7 @@ object Test extends App { List(x) } - implied [Ctx] for Monad[[X] => Ctx => X] { + implied [Ctx] for Monad[[X] =>> Ctx => X] { def (r: Ctx => A) flatMap[A, B] (f: A => Ctx => B): Ctx => B = ctx => f(r(ctx))(ctx) def pure[A](x: A): Ctx => A = diff --git a/tests/run/instances.scala b/tests/run/instances.scala index fc3fe8e9f5c2..711675a51603 100644 --- a/tests/run/instances.scala +++ b/tests/run/instances.scala @@ -117,7 +117,7 @@ object Test extends App { List(x) } - implied ReaderMonad[Ctx] for Monad[[X] => Ctx => X] { + implied ReaderMonad[Ctx] for Monad[[X] =>> Ctx => X] { def (r: Ctx => A) flatMap[A, B] (f: A => Ctx => B): Ctx => B = ctx => f(r(ctx))(ctx) def pure[A](x: A): Ctx => A =