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
Generated code fails to compile with option -Ymacro-annotations
#254
Comments
Thank you! Ok, so I actually removed this on purpose in https://github.com/ScalablyTyped/Converter/pull/206/files#diff-da6c28724a5d5545c5420f648170b6187962e05c09a9b02492d807ae44aed60f . Sufficient amount of time passed between me making that change and me writing the (already rather long) release note, so I completely forgot to put it in. I took out that transformation with a workaround out at the time because:
Anyways, I'll see whether it's easy to patch up a fix for, otherwise here are a two workarounds: Manual fix-upJust a few errors? you can manually delete them or rewrite them to - val a: A = js.native
+ object A extends org.scalablytyped.TopLevel[A] The source generator with checked in sources is a very flexible solution because it's easy to do small manual fixes like this. Split your buildOtherwise, split your project in two, where you compile the generated code without macro annotations, and add another sbt project which depends on the first where you enable macro annotations |
I should probably add that normal usage of ST ensures that the scala macro compiler flag is not set, because the plugin instantiates its own compiler. Only with the source-gen is this a possible scenario |
Thanks, splitting builds should work. |
@oyvindberg I updated https://github.com/ngbinh/scalablyTypedDemo to show another issue that seems to be a legitimate issue. running info] compiling 172 Scala sources to /home/binh/works/external/scalablyTypedDemo/target/scala-2.13/classes ...
[error] /home/binh/works/external/scalablyTypedDemo/src/main/scala/scalablytyped/anduin.facades/echarts/echarts/EChartOption.scala:3525:12: object Slider is defined twice;
[error] the conflicting method Slider was defined at line 3521:9
[error] object Slider {
[error] ^
[error] /home/binh/works/external/scalablyTypedDemo/src/main/scala/scalablytyped/anduin.facades/echarts/echarts/EChartOption.scala:3241:12: object Inside is defined twice;
[error] the conflicting method Inside was defined at line 3237:9
[error] object Inside {
[error] ^
[error] two errors found
[error] (Compile / compileIncremental) Compilation failed Looks into the code: @scala.inline
def Slider(): anduin.facades.echarts.echarts.EChartOption.DataZoom.Slider = {
val __obj = js.Dynamic.literal()
__obj.asInstanceOf[anduin.facades.echarts.echarts.EChartOption.DataZoom.Slider]
}
object Slider {
@scala.inline
def apply(): Slider = {
val __obj = js.Dynamic.literal()
__obj.asInstanceOf[Slider]
}
looks like I can obviously modify the code by hand and commit it in but not sure if this is the real issue as the code will not compile without macro annotation. It will not even compile with empty |
Thanks again @ngbinh ! I was vaguely aware that echarts had broken after running the CI build, ScalablyTyped/Distribution@9c9ccdc , but hadnt had time to investigate it. This will have to be fixed :) |
Cool, thanks |
great! I will try it out on the next release |
trying beta-31 now. Can confirm that the work around (remove |
Minimal reproduce: https://github.com/ngbinh/scalablyTypedDemo
Command to run
./sbt "stImport; compile"
With
-Ymacro-annotations
:without
-Ymacro-annotations
:The text was updated successfully, but these errors were encountered: