-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Macro expansion regression (Java 11) #9769
Comments
What's the output of |
At that line we seem to be calling the funcion of a foreach |
@smarter Good point. I forgot to mention that I'm using
The code example works fine with |
Java 9+ is stricter about the type signature of methods used to implement lambdas which means we sometimes have to create a forwarder method with a different signature, this is supposed to be handled by Erasure when retyping Closures: https://github.com/lampepfl/dotty/blob/760e50310e3913f704af369b8c0aaf1f254f0b14/compiler/src/dotty/tools/dotc/transform/Erasure.scala#L372-L421, I'm not sure why it's not working here. I think the first thing to do would be to try to reproduce the problem outside of a macro to simplify things, @nicolasstucki is this possible? |
Also we should try to bisect this, @michelou can you check older nightlies of dotty 0.28 (https://repo1.maven.org/maven2/ch/epfl/lamp/dotty_0.28/) to find the first one where this problem occurs? |
@smarter Ok, I'll try to bisect this from the Maven repository (between |
@smarter That was fast. $ dotc -version
Dotty compiler version 0.28.0-bin-20200827-757e431-NIGHTLY-git-757e431 -- Copyright 2002-2020, LAMP/EPFL
$ dotc -deprecation -feature -classpath "W:\examples\Interpolators\target\classes" -d "W:\examples\Interpolators\target\classes" W:\examples\Interpolators\src\main\scala\Main.scala
-- Error: W:\examples\Interpolators\src\main\scala\Main.scala:13:22 ------------
13 | val fInterpolator = f"The approximate value of pi is $lifeOfPi%4.2f"
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|Exception occurred while executing macro expansion.
|java.lang.BootstrapMethodError: bootstrap method initialization exception
...
| at dotty.tools.dotc.Driver.main(Driver.scala:203)
| at dotty.tools.dotc.Main.main(Main.scala)
|
| This location contains code that was inlined from Main.scala:13
1 error found |
That's very weird since there were no code changes between those: https://github.com/lampepfl/dotty/compare/f21775cb09e748091353fdb82eaeae32d2226dfe..757e4312b86e85832135f2cf2d8aeba598989e06 |
Are you cleaning the content of W:\examples\Interpolators\target\classes before every test? |
Yes. In my initial post I did only retranscript the two comands Here is the full output (using option $ build -debug clean compile
[build] Options : _DOTTY=1 _TASTY=0 _TIMER=0 _VERBOSE=0
[build] Subcommands: _CLEAN=1 _COMPILE=1 _DECOMPILE=0 _DOC=0 _LINT=0 _RUN=0 _TEST=0
[build] Variables : JAVA_HOME="C:\opt\jdk-11.0.8+10" DOTTY_HOME="C:\opt\dotty-0.27.0-RC1"
[build] Variables : _MAIN_CLASS=Main _MAIN_ARGS=
[build] rmdir /s /q "W:\examples\Interpolators\target"
[build] 00000000000000 'W:\examples\Interpolators\target\classes\.latest-build'
[build] 00000000000000 'W:\examples\Interpolators\src\main\java\*.java'
[build] _COMPILE_REQUIRED=0
[build] 00000000000000 'W:\examples\Interpolators\target\classes\.latest-build'
[build] 20200910202506 'W:\examples\Interpolators\src\main\scala\*.scala'
[build] _COMPILE_REQUIRED=1
[build] "C:\opt\dotty-0.27.0-RC1\bin\dotc.bat" "@W:\examples\Interpolators\target\scalac_opts.txt" "@W:\examples\Interpolators\target\scalac_sources.txt"
-- Error: W:\examples\Interpolators\src\main\scala\Main.scala:13:22 ------------
13 | val fInterpolator = f"The approximate value of pi is $lifeOfPi%4.2f"
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|Exception occurred while executing macro expansion.
|java.lang.BootstrapMethodError: bootstrap method initialization exception
...
| at dotty.tools.dotc.Driver.main(Driver.scala:203)
| at dotty.tools.dotc.Main.main(Main.scala)
|
| This location contains code that was inlined from Main.scala:13
1 error found
Error: Compilation of 1 Scala source files failed
[build] _EXITCODE=1
$ C:\opt\dotty-0.27.0-RC1\bin\dotc.bat -version
Dotty compiler version 0.28.0-bin-20200827-757e431-NIGHTLY-git-757e431 -- Copyright 2002-2020, LAMP/EPFL PS. In order to compare the behavior of the two versions
|
Fix scala#9769 Fix scala#9833 Fix scala#10389 Fix scala#10897 Fix scala#11163 Fix scala#11556 Fix scala#12474 Fix scala#10994 Fix scala#11729
Minimized code
Output (click arrow to expand)
Release
0.27.0-RC1
compiles (and runs) fine:Nightly build
0.28.0-bin-20200908-ce48f5a-NIGHTLY
crashes:The text was updated successfully, but these errors were encountered: