-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
Copy pathi6474
24 lines (24 loc) · 964 Bytes
/
i6474
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
scala> object Foo1 { type T[+A] = (A, Int) }
// defined object Foo1
scala> object Foo2 { type T[+A] = [B] =>> (A, B) }
// defined object Foo2
scala> object Foo3 { type T[+A] = [B] =>> [C] =>> (A, B) }
// defined object Foo3
scala> ((1, 2): Foo1.T[Int]): Foo1.T[Any]
val res0: Foo1.T[Any] = (1,2)
scala> ((1, 2): Foo2.T[Int][Int]): Foo2.T[Any][Int]
val res1: Foo2.T[Any][Int] = (1,2)
scala> (1, 2): Foo3.T[Int][Int]
-- [E056] Syntax Error: --------------------------------------------------------
1 | (1, 2): Foo3.T[Int][Int]
| ^^^^^^^^^^^^^^^^
| Missing type parameter for Foo3.T[Int][Int]
1 error found
scala> ((1, 2): Foo3.T[Int][Int][Int]): Foo3.T[Any][Int][Int]
val res2: Foo3.T[Any][Int][Int] = (1,2)
scala> object Foo3 { type T[A] = [B] =>> [C] =>> (A, B) }
// defined object Foo3
scala> ((1, 2): Foo3.T[Int][Int][Int])
val res3: Foo3.T[Int][Int][Int] = (1,2)
scala> ((1, 2): Foo3.T[Int][Int][Int])
val res4: Foo3.T[Int][Int][Int] = (1,2)