-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Assertion error when compiling invalid @annotation #3557
New issue
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
Comments
Not sure why it compiles with scalac. $ scalac -d out tests/allan/Test.scala -Xprint:typer
[[syntax trees at end of typer]] // Test.scala
package <empty> {
class C1 extends scala.AnyRef {
def <init>(): C1 = {
C1.super.<init>();
()
};
@scala.annotation.varargs def f(values: String*): Unit = ()
};
class C2 extends scala.AnyRef {
def <init>(): C2 = {
C2.super.<init>();
()
};
@scala.annotation.varargs def f(values: String*): Unit = ();
def g: String => Int = ((s: String) => C2.this.hashCode());
class C3 extends scala.AnyRef {
def <init>(): C2.this.C3 = {
C3.super.<init>();
()
};
@<error> def f(values: String): Unit = ()
}
}
} |
Here is a minimised test case: class C2 {
def f(values: String*) = ()
class C3 {
@f.varargs
def f(values: String) = ()
}
} Stacktrace> dotc -d out tests/allan/Test.scala [warn] Multiple main classes detected. Run 'show discoveredMainClasses' to see the list [warn] Multiple main classes detected. Run 'show discoveredMainClasses' to see the list [info] Running dotty.tools.dotc.Main -classpath /Users/renucci/projects/dotty/library/target/scala-2.12/dotty-library_2.12-0.5.0-bin-SNAPSHOT-nonbootstrapped.jar -d out tests/allan/Test.scala -- [E080] Syntax Error: tests/allan/Test.scala:4:5 ----------------------------- 4 | @f.varargs | ^ | missing parameter type for parameter values, expected = ?{ varargs: ? } |
The test now compiles with errors, which is what we would expect.
scalac can compile but dotc crashes.
$ dotc -version
$ dotc abc.scala
$ cat abc.scala
The text was updated successfully, but these errors were encountered: