-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Nested inline
calls - unrelated code affects compilation
#18010
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
That's indeed a mystery. Maybe for experienced people in the Spree to find out? |
minimized somewhat: //> using scala 3.3.1-RC3
import scala.compiletime.erasedValue
class Typed[A]
transparent inline def computeType: Any =
inline erasedValue[Tuple1["a"]] match
case _ =>
inline (Typed[EmptyTuple]: Typed[_ <: Tuple]) match
case _: Typed[ts] =>
// println("") // compiles if uncommented
Typed["a" *: ts]
val x: Typed[Tuple1["a"]] = computeType not sure if actually-helpful minimization, or just minimization golf also not positive it can't be reduced further |
@SethTisue, thanks for the minimization. It does seem actually helpful as it shows that the nested |
transparent
calls - unrelated code affects compilationinline
calls - unrelated code affects compilation
This issue was picked for the Issue Spree No. 40 of December 5th, 2023 which takes place in 6 days. @mbovel, @EugeneFlesselle and @entangled90 will be working on it. If you have any insight into the issue or guidance on how to fix it, please leave it here. |
I tested both snippets on last commit on master (7a56da7) and both snippets provided compile with or without a println statement. Version 3.3.1 manifest the same issue as 3.3.0. |
I did not do a bisect, but a quick probe says it progressed in August, which makes sense. Either someone had a restful Aug 1 holiday, then came back and saw the problem immediately, or someone was restless during their extended summer break, uninterested in further conversations with family, and decided to tackle some bugs in their spare time. |
Run a bisect: commit that fixed the issue was 2b9a62b |
Excellent, thanks @entangled90! Let's close this issue then 🥳 |
Thanks for resolving this. Can anyone please briefly explain what was the root cause of the issue? |
Compiler version
3.3.0
Minimized code
While trying to work around #8739 (nested transparent calls) I stumbled upon some spooky compilation side-effects:
This fails to compile with the following message:
But if I add any other code in the second branch everything compiles just fine.
So this compiles:
And this:
And even this:
Expectation
The code should have a consistent type irrespective of code that is unrelated to the final result type.
Thanks
The text was updated successfully, but these errors were encountered: