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