File tree Expand file tree Collapse file tree 6 files changed +49
-0
lines changed Expand file tree Collapse file tree 6 files changed +49
-0
lines changed Original file line number Diff line number Diff line change
1
+ -- [E007] Type Mismatch Error: tests/neg/i20338a.scala:10:15 -----------------------------------------------------------
2
+ 10 | test.field = "hello" // error
3
+ | ^^^^^^^
4
+ | Found: ("hello" : String)
5
+ | Required: Int
6
+ |
7
+ | longer explanation available when compiling with `-explain`
Original file line number Diff line number Diff line change
1
+ object types :
2
+ opaque type Struct = Int
3
+ val test : Struct = 25
4
+ extension (s : Struct )
5
+ def field : Int = s
6
+ def field_= (other : Int ) = ()
7
+
8
+ @ main def hello =
9
+ import types .*
10
+ test.field = " hello" // error
Original file line number Diff line number Diff line change
1
+ -- [E007] Type Mismatch Error: tests/neg/i20338.scala:10:8 -------------------------------------------------------------
2
+ 10 | f.x = 42 // error
3
+ | ^^
4
+ | Found: (42 : Int)
5
+ | Required: String
6
+ |
7
+ | longer explanation available when compiling with `-explain`
Original file line number Diff line number Diff line change
1
+ class Foo (_x : Int )
2
+
3
+ extension (s : Foo )
4
+ def x_= (x : String ): Unit = ()
5
+ def x : Int = ???
6
+
7
+ @ main
8
+ def Test =
9
+ val f = Foo (42 )
10
+ f.x = 42 // error
Original file line number Diff line number Diff line change
1
+ -- [E052] Type Error: tests/neg/i20338c.scala:9:6 ----------------------------------------------------------------------
2
+ 9 | f.x = 42 // error
3
+ | ^^^^^^^^
4
+ | Reassignment to val x
5
+ |
6
+ | longer explanation available when compiling with `-explain`
Original file line number Diff line number Diff line change
1
+ class Foo (val x : Int )
2
+
3
+ extension (s : Foo )
4
+ def x : Int = 43
5
+
6
+ @ main
7
+ def Test =
8
+ val f = Foo (42 )
9
+ f.x = 42 // error
You can’t perform that action at this time.
0 commit comments