Closed
Description
Based on OpenCB failure in jphmrst/scala-automata
- build logs
Affects also:
rssh/cps-async-connect
- build logs
The new givens syntax and its changes to the parser no longer accept valid old (pre 3.6.0) givens syntax, in cases when type of the type-class is moved to the next line. It's a common issue that might be introduced by automatic code formatters when dealing with long names or signatures of given.
Compiler version
Last good release: 3.6.0-RC1-bin-20241003-a672e05-NIGHTLY
First bad release: 3.6.0-RC1-bin-20241005-6fa81cf-NIGHTLY
Bisect points to: 14acdc0
Minimized code
trait Typeclass[T]:
def op(v: T): Unit
given namedGivenWithLongName[T]:
Typeclass[T] with
override def op(v: T): Unit = ???
given otherNamedGivenWithLongName[T]:
Typeclass[T] = new Typeclass[T]:
override def op(v: T): Unit = ???
Output
[error] ./test2.scala:5:16
[error] end of statement expected but 'with' found
[error] Typeclass[T] with
[error] ^^^^
[error] ./test2.scala:4:7
[error] Not found: type namedGivenWithLongName
[error] given namedGivenWithLongName[T]:
[error] ^^^^^^^^^^^^^^^^^^^^^^
[error] ./test2.scala:4:30
[error] Not found: type T
[error] given namedGivenWithLongName[T]:
[error] ^
[error] ./test2.scala:5:13
[error] Not found: type T
[error] Typeclass[T] with
[error] ^
[error] ./test2.scala:5:3
[error] Not found: Typeclass
[error] Typeclass[T] with
[error] ^^^^^^^^^
Workaround
Compile with -source:3.5
Expectation
It should compile and be parsable until deprecating the old syntax.