File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed
compiler/src/dotty/tools/dotc/parsing Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -1001,6 +1001,18 @@ object Parsers {
10011001 // def f = ...
10021002 lookahead.nextToken()
10031003 ! lookahead.isAfterLineEnd
1004+ } || {
1005+ // Support for for pre-3.6 syntax where type is put on the next line
1006+ // Examples:
1007+ // given namedGiven:
1008+ // X[T] with {}
1009+ // given otherGiven:
1010+ // X[T] = new X[T]{}
1011+ lookahead.isIdent && {
1012+ lookahead.nextToken()
1013+ skipParams()
1014+ lookahead.token == WITH || lookahead.token == EQUALS
1015+ }
10041016 }
10051017 }
10061018
Original file line number Diff line number Diff line change 1+
2+ trait Foo [T ]:
3+ def foo (v : T ): Unit
4+
5+ given myFooOfInt :
6+ Foo [Int ] with
7+ def foo (v : Int ): Unit = ???
8+
9+ given myFooOfLong :
10+ Foo [Long ] = new Foo [Long ] {
11+ def foo (v : Long ): Unit = ???
12+ }
You can’t perform that action at this time.
0 commit comments