-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Infinite loop for given ev with match types on dependently typed method args #7512
Comments
As a workaround for this issue, I have a draft implementation that adds a Would there be interest in a PR going in that direction? |
I believe @propensive begun some work towards this https://github.com/propensive/dotty/tree/typelevel-singleton-literal-type-arithmetic |
Now it takes around 1 minute to compile |
Now it takes around 1 minute to compile instead of 20+ minutes.
Now it takes around 17 seconds to compile |
Nice, I think we can close this and maybe with a sligtly smaller regression test (17 sec might be a bit much) |
Indeed, the loop is no longer infinite, so I'm fine closing the issue. But 17 seconds still suggests that there is some unnecessary work happening somewhere. I think it's okay to consider this a performance optimization task for the backlog; if it's tracked by a regression test, then that's already nice. I'll let you decide what to do with the issue tracking around this. |
If we do |
On my machine,
Stack trace
|
The newly added test is blacklisted for pickling tests because the after pickler code path doesn't go thought TypeApplications and keeps types un-normalized, albeit equivalant to their before pickling counterparts.
The newly added test is blacklisted for pickling tests because the after pickler code path doesn't go thought TypeApplications and keeps types un-normalized, albeit equivalant to their before pickling counterparts.
…ation Fix #7512: Normalize type arguments before instantiation
The newly added test is blacklisted for pickling tests because the after pickler code path doesn't go thought TypeApplications and keeps types un-normalized, albeit equivalant to their before pickling counterparts.
Minimized code
This code implements type-level addition and multiplication on top of
scala.compiletime.S
. ThetestProd
looks for given evidence that the multiplication commutes for two particular values.Behavior
The compiler loops infinitely (or at least for a very long time, 20+ minutes).
Expectation
The compiler should be able to reduce
2 * 3
and3 * 2
to6
, and trivially find an implicit for6 =:= 6
.Narrowing down the issue
The following compiles instantly, which leads me to believe that the issue is with dependently typed methods:
Alternatively, the following definition of type addition compiles faster (~10s) but still quite slowly compared to the
implicitly
:Related issues
I did not find any related issues.
The text was updated successfully, but these errors were encountered: