We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
3.3.1 3.5.0-RC1-bin-SNAPSHOT
Should happen in every version, and in Scala 2 as well
// JFun.java // Other annotations also fail, for example, @Deprecated @FunctionalInterface public interface JFun { String f(String s); }
with an empty scala file in order to trigger the compiling: Stest.scala.
Stest.scala
> scala-cli compile JFun.java Stest.scala Compiling project (Scala 3.3.1, JVM (17)) [error] ./JFun.java:2:1 [error] package expected but public found. [error] public interface JFun { [error] ^^^^^^ [error] ./JFun.java:6:1 [error] identifier expected but eof found. Error compiling project (Scala 3.3.1, JVM (17)) Compilation failed
> scala-cli compile --scala 2 JFun.java Stest.scala Compiling project (Scala 2.13.13, JVM (17)) [error] ./JFun.java:2:1 [error] `package` expected but `public` found. [error] public interface JFun { [error] ^ [error] ./JFun.java:5:1 [error] identifier expected but eof found. [error] ^ Error compiling project (Scala 2.13.13, JVM (17)) Compilation failed
Should compile.
In JavaParser, it tries to read annotations with the package.
JavaParser
/** CompilationUnit ::= [package QualId semi] TopStatSeq */ def compilationUnit(): Tree = { val start = in.offset val pkg: RefTree = if (in.token == AT || in.token == PACKAGE) { annotations() accept(PACKAGE) val pkg = qualId() accept(SEMI) pkg } ...
Scala 2 also has the same issue, since this part is a direct port (and there is a TODO there).
Removing in.token == AT || from the condition and annotations() from the body makes the code compile.
in.token == AT ||
annotations()
The text was updated successfully, but these errors were encountered:
Sounds like #20026
Sorry, something went wrong.
PR against the other ticket is forward-port of a fix on scala 2. #20064
The other ticket also implicates scala-cli, which I haven't tried yet.
No branches or pull requests
Compiler version
3.3.1
3.5.0-RC1-bin-SNAPSHOT
Should happen in every version, and in Scala 2 as well
Minimized code
with an empty scala file in order to trigger the compiling:
Stest.scala
.Output
Expectation
Should compile.
Analyze
In
JavaParser
, it tries to read annotations with the package.Scala 2 also has the same issue, since this part is a direct port (and there is a TODO there).
Removing
in.token == AT ||
from the condition andannotations()
from the body makes the code compile.The text was updated successfully, but these errors were encountered: