|
1 | 1 | scala> class Inv[T](x: T) |
2 | 2 | // defined class Inv |
3 | 3 | scala> val x: List[String] = List(1) |
4 | | --- Error: |
| 4 | +-- [E007] Type Mismatch Error: ------------------------------------------------- |
5 | 5 | 1 | val x: List[String] = List(1) |
6 | 6 | | ^ |
7 | 7 | | Found: (1 : Int) |
8 | 8 | | Required: String |
| 9 | +longer explanation available when compiling with `-explain` |
9 | 10 | scala> val y: List[List[String]] = List(List(1)) |
10 | | --- Error: |
| 11 | +-- [E007] Type Mismatch Error: ------------------------------------------------- |
11 | 12 | 1 | val y: List[List[String]] = List(List(1)) |
12 | 13 | | ^ |
13 | 14 | | Found: (1 : Int) |
14 | 15 | | Required: String |
| 16 | +longer explanation available when compiling with `-explain` |
15 | 17 | scala> val z: (List[String], List[Int]) = (List(1), List("a")) |
16 | | --- Error: |
| 18 | +-- [E007] Type Mismatch Error: ------------------------------------------------- |
17 | 19 | 1 | val z: (List[String], List[Int]) = (List(1), List("a")) |
18 | 20 | | ^ |
19 | 21 | | Found: (1 : Int) |
20 | 22 | | Required: String |
21 | | --- Error: |
| 23 | +longer explanation available when compiling with `-explain` |
| 24 | +-- [E007] Type Mismatch Error: ------------------------------------------------- |
22 | 25 | 1 | val z: (List[String], List[Int]) = (List(1), List("a")) |
23 | 26 | | ^^^ |
24 | 27 | | Found: ("a" : String) |
25 | 28 | | Required: Int |
| 29 | +longer explanation available when compiling with `-explain` |
26 | 30 | scala> val a: Inv[String] = new Inv(new Inv(1)) |
27 | | --- Error: |
| 31 | +-- [E007] Type Mismatch Error: ------------------------------------------------- |
28 | 32 | 1 | val a: Inv[String] = new Inv(new Inv(1)) |
29 | 33 | | ^^^^^^^^^^ |
30 | 34 | | Found: Inv[Int] |
31 | 35 | | Required: String |
| 36 | +longer explanation available when compiling with `-explain` |
32 | 37 | scala> val b: Inv[String] = new Inv(1) |
33 | | --- Error: |
| 38 | +-- [E007] Type Mismatch Error: ------------------------------------------------- |
34 | 39 | 1 | val b: Inv[String] = new Inv(1) |
35 | 40 | | ^ |
36 | 41 | | Found: (1 : Int) |
37 | 42 | | Required: String |
| 43 | +longer explanation available when compiling with `-explain` |
38 | 44 | scala> abstract class C { type T; val x: T; val s: Unit = { type T = String; var y: T = x; locally { def f() = { type T = Int; val z: T = y }; f() } }; } |
39 | | --- Error: |
| 45 | +-- [E007] Type Mismatch Error: ------------------------------------------------- |
40 | 46 | 1 | abstract class C { type T; val x: T; val s: Unit = { type T = String; var y: T = x; locally { def f() = { type T = Int; val z: T = y }; f() } }; } |
41 | 47 | | ^ |
42 | 48 | |Found: (C.this.x : C.this.T) |
43 | 49 | |Required: T² |
44 | 50 | | |
45 | 51 | |where: T is a type in class C |
46 | 52 | | T² is a type in the initializer of value s which is an alias of String |
47 | | --- Error: |
| 53 | +longer explanation available when compiling with `-explain` |
| 54 | +-- [E007] Type Mismatch Error: ------------------------------------------------- |
48 | 55 | 1 | abstract class C { type T; val x: T; val s: Unit = { type T = String; var y: T = x; locally { def f() = { type T = Int; val z: T = y }; f() } }; } |
49 | 56 | | ^ |
50 | 57 | |Found: (y : T) |
51 | 58 | |Required: T² |
52 | 59 | | |
53 | 60 | |where: T is a type in the initializer of value s which is an alias of String |
54 | 61 | | T² is a type in method f which is an alias of Int |
| 62 | +longer explanation available when compiling with `-explain` |
55 | 63 | scala> class Foo() { def bar: Int = 1 }; val foo = new Foo(); foo.barr |
56 | | --- Error: |
| 64 | +-- [E008] Not Found Error: ----------------------------------------------------- |
57 | 65 | 1 | class Foo() { def bar: Int = 1 }; val foo = new Foo(); foo.barr |
58 | 66 | | ^^^^^^^^ |
59 | 67 | | value barr is not a member of Foo - did you mean foo.bar? |
60 | 68 | scala> val x: List[Int] = "foo" :: List(1) |
61 | | --- Error: |
| 69 | +-- [E007] Type Mismatch Error: ------------------------------------------------- |
62 | 70 | 1 | val x: List[Int] = "foo" :: List(1) |
63 | 71 | | ^^^^^ |
64 | 72 | | Found: ("foo" : String) |
65 | 73 | | Required: Int |
| 74 | +longer explanation available when compiling with `-explain` |
66 | 75 | scala> while ((( foo ))) {} |
67 | | --- Error: |
| 76 | +-- [E006] Not Found Error: ----------------------------------------------------- |
68 | 77 | 1 | while ((( foo ))) {} |
69 | 78 | | ^^^ |
70 | 79 | | Not found: foo |
| 80 | +longer explanation available when compiling with `-explain` |
71 | 81 | scala> val a: iDontExist = 1 |
72 | | --- Error: |
| 82 | +-- [E006] Not Found Error: ----------------------------------------------------- |
73 | 83 | 1 | val a: iDontExist = 1 |
74 | 84 | | ^^^^^^^^^^ |
75 | 85 | | Not found: type iDontExist |
| 86 | +longer explanation available when compiling with `-explain` |
76 | 87 | scala> def foo1(x: => Int) = x _ |
77 | | --- Error: |
| 88 | +-- [E099] Syntax Error: -------------------------------------------------------- |
78 | 89 | 1 | def foo1(x: => Int) = x _ |
79 | 90 | | ^^^ |
80 | 91 | |Only function types can be followed by _ but the current expression has type Int |
| 92 | +longer explanation available when compiling with `-explain` |
81 | 93 | scala> def foo2(x: => Int): () => Int = x _ |
82 | | --- Error: |
| 94 | +-- [E099] Syntax Error: -------------------------------------------------------- |
83 | 95 | 1 | def foo2(x: => Int): () => Int = x _ |
84 | 96 | | ^^^ |
85 | 97 | |Only function types can be followed by _ but the current expression has type Int |
| 98 | +longer explanation available when compiling with `-explain` |
0 commit comments