File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change 1+ -- [E103] Syntax Error: tests/neg/19087.scala:4:2 ----------------------------------------------------------------------
2+ 4 | Option.when(state.x == 0) body // error: Illegal start of toplevel definition
3+ | ^^^^^^
4+ | Illegal start of toplevel definition
5+ |
6+ | longer explanation available when compiling with `-explain`
7+ -- [E040] Syntax Error: tests/neg/19087.scala:15:6 ---------------------------------------------------------------------
8+ 15 | bar = 2 // error: ',' or ')' expected
9+ | ^^^
10+ | ',' or ')' expected, but identifier found
11+ -- [E067] Syntax Error: tests/neg/19087.scala:3:4 ----------------------------------------------------------------------
12+ 3 |def foo[T](state: State)(body: => T): Option[T] // error: only classes can have declared but undefined members
13+ | ^
14+ | Declaration of method foo not allowed here: only classes can have declared but undefined members
15+ -- [E050] Type Error: tests/neg/19087.scala:13:22 ----------------------------------------------------------------------
16+ 13 | foo(state.copy(x = 5): // Missing ")" // error: method copy in class State does not take more parameters
17+ | ^^^^^^^^^^^^^^^^^
18+ | method copy in class State does not take more parameters
19+ |
20+ | longer explanation available when compiling with `-explain`
Original file line number Diff line number Diff line change 1+ case class State (x : Int )
2+
3+ def foo [T ](state : State )(body : => T ): Option [T ] // error: only classes can have declared but undefined members
4+ Option .when(state.x == 0 ) body // error: Illegal start of toplevel definition
5+
6+ var bar = 0
7+ val state = State (0 )
8+
9+ def app : Function1 [Int , Unit ] =
10+ new Function1 [Int , Unit ]:
11+ def apply (x : Int ): Unit =
12+ foo(state):
13+ foo(state.copy(x = 5 ): // Missing ")" // error: method copy in class State does not take more parameters
14+ println(" a" )
15+ bar = 2 // error: ',' or ')' expected
You can’t perform that action at this time.
0 commit comments