You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
traitAobjectTest {
givenA// declaration in 3.5, definition in 3.6givena:A// declaration in 3.5 and 3.6
}
Output
In 3.6.2:
Compiling project (Scala3.6.2, JVM (21))
[error] ./test.scala:7:9
[error] Declaration of giveninstance a not allowed here: only classes can have declared but undefined members
[error] givena:A
[error]
In 3.5.2:
Compiling project (Scala 3.5.2, JVM (21))
[error] ./test.scala:7:1
[error] anonymous given cannot be abstract
[error] given a: A
[error] ^^^^^
[error] ./test.scala:6:9
[error] Declaration of given instance given_A not allowed here: only classes can have declared but undefined members
[error] given A
[error] ^
[error] ./test.scala:7:9
[error] Declaration of given instance a not allowed here: only classes can have declared but undefined members
[error] given a: A
[error] ^
Expectation
Hi,
I'm still implementing the new/old given syntax in Intellij and I'm slightly confused what's the correct way to parse the above code with the new syntax.
Both givens are allowed under both grammar rules (grammar is ambiguous), but it seems that given A is parsed as a declaration in 3.5 and definition in 3.6, while given a: A is parsed as a declaration in both versions...
From what I can see given a: A should be a definition in 3.6, too. Or does the old syntax take precedence over the new syntax... but then given A should be a declaration in 3.6 as well 😕
(also note that the anonymous given cannot be abstract message is on the wrong given?)
The text was updated successfully, but these errors were encountered:
Compiler version
3.6.2
Minimized example
Output
In 3.6.2:
In 3.5.2:
Expectation
Hi,
I'm still implementing the new/old given syntax in Intellij and I'm slightly confused what's the correct way to parse the above code with the new syntax.
Both givens are allowed under both grammar rules (grammar is ambiguous), but it seems that
given A
is parsed as a declaration in 3.5 and definition in 3.6, whilegiven a: A
is parsed as a declaration in both versions...From what I can see
given a: A
should be a definition in 3.6, too. Or does the old syntax take precedence over the new syntax... but thengiven A
should be a declaration in 3.6 as well 😕(also note that the
anonymous given cannot be abstract
message is on the wrong given?)The text was updated successfully, but these errors were encountered: