File tree Expand file tree Collapse file tree 8 files changed +23
-12
lines changed
compiler/src/dotty/tools/dotc/parsing Expand file tree Collapse file tree 8 files changed +23
-12
lines changed Original file line number Diff line number Diff line change @@ -341,6 +341,7 @@ object Parsers {
341341 case NEWLINE | NEWLINES => in.nextToken()
342342 case SEMI => in.nextToken()
343343 case _ =>
344+ syntaxError(" end of statement expected" )
344345 in.nextToken() // needed to ensure progress; otherwise we might cycle forever
345346 accept(SEMI )
346347 }
Original file line number Diff line number Diff line change @@ -8,6 +8,6 @@ object Test {
88 def f = {
99 val _parent = 3
1010 q " val hello = $_parent"
11- q " class $_" // error
11+ q " class $_" // error // error
1212 } // error
1313}
Original file line number Diff line number Diff line change 1+ object Foo {
2+ val a = " " ); // error: end of statement expected
3+ }
4+ // From #5824:
5+ object Main {
6+ def main (args : Array [String ]): Unit = {
7+ val foo = 123 " " ; // error: end of statement expected
8+ println(foo)
9+ }
10+ }
Original file line number Diff line number Diff line change @@ -2,5 +2,5 @@ class x0[x0] {
22 val x1 : x0
33}
44trait x3 extends x0 { // error
5- x1 = 0 object // error
5+ x1 = 0 object // error // error
66// error
Original file line number Diff line number Diff line change 11trait x0 [] { x0 : x0 => } // error // error
2- class x0 [x1] extends x0[x0 x0] x2 x0 // error // error
2+ class x0 [x1] extends x0[x0 x0] x2 x0 // error // error // error
Original file line number Diff line number Diff line change 11object i0 {
2- import Ordering .{ implicitly => } (true: Boolean ) match { case _: i1 => true } // error // error
2+ import Ordering .{ implicitly => } (true: Boolean ) match { case _: i1 => true } // error // error // error
33}
Original file line number Diff line number Diff line change 11class x0 {
2- def x0 : x0 = (x0 => x0) => x0) // error
2+ def x0 : x0 = (x0 => x0) => x0) // error // error
33// error
Original file line number Diff line number Diff line change @@ -42,12 +42,12 @@ object Test extends App {
4242 locally {
4343 def f (): Int = b + 1
4444 val x1 = if (true ) b else if (true ) 33 else 5.5 ; x1 : Double // b is an inline val
45- val x2 = if (true ) f() else if (true ) 33 else 5.5 ) ; x2 : AnyVal // f() is not a constant
46- val x3 = if (true ) 5 else 11L ) ; x3 : Long
47- val x4 = if (true ) 5 else if (true ) 11L else 5.5 ) ; x4 : AnyVal // Long and Double found
48- val x5 = if (true ) 1.0f else 2 ) ; x5 : Float
49- val x6 = if (true ) 1.0f else 1234567890 ) ; x6 : AnyVal // loss of precision
50- val x7 = if (true ) b else if (true ) 33 else 'a' ) ; x7 : Char
51- val x8 = if (true ) 5 .toByte else 11 ) ; x8 : Byte
45+ val x2 = if (true ) f() else if (true ) 33 else 5.5 ; x2 : AnyVal // f() is not a constant
46+ val x3 = if (true ) 5 else 11L ; x3 : Long
47+ val x4 = if (true ) 5 else if (true ) 11L else 5.5 ; x4 : AnyVal // Long and Double found
48+ val x5 = if (true ) 1.0f else 2 ; x5 : Float
49+ val x6 = if (true ) 1.0f else 1234567890 ; x6 : AnyVal // loss of precision
50+ val x7 = if (true ) b else if (true ) 33 else 'a' ; x7 : Char
51+ val x8 = if (true ) 5 .toByte else 11 ; x8 : Byte
5252 }
5353}
You can’t perform that action at this time.
0 commit comments