regression: Integer overflow in nesting level of a Macro expansion (PolyType/TypeBounds) between 3.1.1 and 3.1.2
See original GitHub issueCompiler version
3.1.2
Minimized code
It requires some macro magic to reproduce and I didn’t manage to extract the minimal reproducible code. But it manifests with one specific open source project https://github.com/davenverse/epimetheus
If you perform git clone and then run sbt (in my case JDK 17 was used) with these commands it will encounter compilation errors.
++ 3.1.2; Test / compile
Output
sbt log
[error] -- Error: ~/epimetheus/core/src/test/scala/io/chrisdavenport/epimetheus/CounterSpec.scala:30:68
[error] 30 | counter <- Counter.labelled(cr, Name("boo"), "Boo Counter", Sized(Label("foo")), {(s: String) => Sized(s)})
[error] | ^
[error] |Could not decrease the nesting level of a from 2147483647 to 6 in
And a lot more of PolyType
and TypeBounds
output.
Expectation
Compile w/o errors like it was with 3.1.1
++ 3.1.1; Test / compile
Issue Analytics
- State:
- Created a year ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Help to create a macro do avoid integer overflow
I need help to create a macro to do the following: On every integer operation, check if overflow will happen. If it does,...
Read more >Expansion of nested macros, from the inner to the outer?
The answer is these aren't nested macros, but macros in parameters. ... The number in the brackets [] is the nesting level during...
Read more >GNU MPFR 3.1.5
How to install and use GNU MPFR, a library for reliable multiple precision floating-point arithmetic, version 3.1.5.
Read more >The C Preprocessor - GCC, the GNU Compiler Collection
3.9.1 Misnesting . ... The '#' which begins a directive cannot come from a macro expansion. ... and patch level of the compiler,...
Read more >The SAS LGTPHCURV9 Macro
The %LGTPHCURV9 macro fits restricted cubic splines to unconditional logistic, pooled lo- gistic, conditional logistic, and proportional hazards regression ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
the example still fails for me without the macro, so I removed it
I managed to minimize it to 2 Scala sources (because Macros support is involved) - Base - with macro definitions and Test with failing example. It is still big, but I eliminated all external dependencies at least.
Base.scala
Test.scala
With 3.1.1 it compiles
With 3.1.2 it fails