-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Match error in backend using Java defined annotation with default parameters #2704
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
I managed to minimize the error into something that scalac compiles OK but dotc reports an error // bench.scala
package foo
@Fork(value = 16)
class Bar
// fork.java
package foo;
public @interface Fork {
int value() default -1;
int warmups() default -1;
} Running
I didn't manage to minimize a repro for the match error, but this might be a good start. |
@olafurpg, thanks for a nice minimization, but is this the same error? |
Correct, that minimization does not crash the compiler. I can open another issue if that makes more sense. |
Note, the benchmarks currently don't actually run with Dotty because of scala/scala3#2704. - scalac and dotc driver separated in src/main/{scalac,dotc}. - unit tests for rapic local iteration without the need to remember cli args. - `fork in run` is necessary for -usejavacp to work with compilation/run - `FileVisitOption.FOLLOW_LINKS` produces duplicate filenames, which causes "X is already compiled in this run" errors in Dotty.
Note, the benchmarks currently don't actually run with Dotty because of scala/scala3#2704. - scalac and dotc driver separated in src/main/{scalac,dotc}. - unit tests for rapic local iteration without the need to remember cli args. - `fork in run` is necessary for -usejavacp to work with compilation/run - `FileVisitOption.FOLLOW_LINKS` produces duplicate filenames, which causes "X is already compiled in this run" errors in Dotty.
Note, the benchmarks currently don't actually run with Dotty because of scala/scala3#2704. - scalac and dotc driver separated in src/main/{scalac,dotc}. - unit tests for rapic local iteration without the need to remember cli args. - `fork in run` is necessary for -usejavacp to work with compilation/run - `FileVisitOption.FOLLOW_LINKS` produces duplicate filenames, which causes "X is already compiled in this run" errors in Dotty.
Note, the benchmarks currently don't actually run with Dotty because of scala/scala3#2704. - scalac and dotc driver separated in src/main/{scalac,dotc}. - unit tests for rapic local iteration without the need to remember cli args. - `fork in run` is necessary for -usejavacp to work with compilation/run - `FileVisitOption.FOLLOW_LINKS` produces duplicate filenames, which causes "X is already compiled in this run" errors in Dotty.
Note, the benchmarks currently don't actually run with Dotty because of scala/scala3#2704. - When `scalaVersion := "0.x"`, then "src/main/dotc" is added to unmanagedSourceDirectories, otherwise "src/main/scalac" is added. - compilation/test checks the setup is OK without the need to remember cli args. - `fork in run` is necessary for -usejavacp to work with compilation/run - `FileVisitOption.FOLLOW_LINKS` produces duplicate filenames, which causes "X is already compiled in this run" errors in Dotty.
The PR to compile scala/compiler-benchmark with Dotty, scala/compiler-benchmark#31, is currently blocked by this issue (MatchError). @DarkDimius I opened #2760 for the "missing argument" error. |
@olafurpg, I'll prepare a fix to unblock you. |
Thanks @DarkDimius To reproduce the MatchError, you can clone this branch https://github.com/olafurpg/compiler-benchmark/tree/dotty2 (commit c30610306e9bc7b5ed0609f0f24ca1054a48d26f) and run
|
This is not a proper fix, it just fixes the crash. We need to figure out why this happens and handle it correctly.
I guess this is what you went in your previous commit?
Quick-fix #2704, to get Olaf unblocked.
@DarkDimius Is the issue really closed or should it stay open? |
@smarter I tested the fix locally and was no longer able to reproduce the match error, #2762 (comment) |
@smarter I've added logic to backed that tries to figure out what happened to a tree inside an annotation(made it more robust). I didn't investigate who restructured the tree in the first place. |
Ok, so let's keep this open until we've done that |
Note, the benchmarks currently don't actually run with Dotty because of scala/scala3#2704. - When `scalaVersion := "0.x"`, then "src/main/dotc" is added to unmanagedSourceDirectories, otherwise "src/main/scalac" is added. - compilation/test checks the setup is OK without the need to remember cli args. - `fork in run` is necessary for -usejavacp to work with compilation/run - `FileVisitOption.FOLLOW_LINKS` produces duplicate filenames, which causes "X is already compiled in this run" errors in Dotty.
Fixed in #2819 ? |
Yes |
While trying to compile the compiler-benchmark with Dotty I hit on a match error in the backend
With
-Xprint:all
The source file where the error happens ColdDotcBenchmark.scala: https://github.com/lampepfl/compiler-benchmark/blob/82392bc30df11946cb489d45afc2698e3b48bced/compilation/src/main/scala/dotty/tools/dotc/ColdDotcBenchmark.scala#L10-L18
The
@Fork
annotations is defined in Java from the JMH project, https://github.com/jacek-lewandowski/jmh-jl/blob/fc92780b525f6376b2433518b3dc90a5f511feef/jmh-core/src/main/java/org/openjdk/jmh/annotations/Fork.java#L44I made several attempts to minimize the error with Fork.java and a tiny Foo.scala but didn't manage to reproduce. To reproduce in the environment I hit the error:
sbt compilation/compile
The text was updated successfully, but these errors were encountered: