-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix #12267: Constraints should not cross phases #12300
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
Conversation
Use these changes to compile the stdlib. You need to comment out AnyVal.scala and then use the following command on community-projects/stdLib213: sc -Ydetailed-stats *.scala */*.scala */*/*.scala */*/*/*.scala What I see is: Calls to `translucentSuperType` 53152: try norm KO -> 53086 try norm OK -> 66 The only computationally relevant part of this are calls to tryMatchAlias try match alias -> 528 Those calls suceed in 66 cases try norm OK -> 66 The successful normalizations all return types like this: try norm OK F[T1] *: scala.Tuple.Map[(T2, T3, T4, T5, T6, T7, T8), F] -> 3 Now it could be that trying the normalizations is costly, or that the normalized types cause exhaustivity checking to explode. Tht remains to be found out.
To enforce the invariant, we need to ensure that tvars are instantiated at end of phases.
retest performance with #stdlib please |
performance test scheduled: 3 job(s) in queue, 1 running. |
Performance test finished successfully: Visit https://dotty-bench.epfl.ch/12300-1/ to see the changes. Benchmarks is based on merging with master (98ecc10) |
We might need something like that in the end, but it also hides errors. Before doing this, I wonder whether we could find sources of overflowing constraints and treat them in a more fine-grained manner that does not wait until the end of a phase to remove constraint entries. |
Maybe change With the following code, We get constraints like the following in compiling
This will leave the tvar that binds to |
I think we should do a gc() in the toplevel constraint and should assert that after that the constraint is empty. Right now that's not the case, it seems for several different reasons. I tracked one down to a shortcoming in mergeConstraints but that's not all it seems. |
This is now superseded by #12333 |
Use these changes to compile the stdlib. You need to comment out AnyVal.scala and then
use the following command on community-projects/stdLib213:
What I see is:
Calls to
translucentSuperType
53152:The only computationally relevant part of this are calls to tryMatchAlias
Those calls suceed in 66 cases
The successful normalizations all return types like this:
Now it could be that trying the normalizations is costly, or that the normalized types
cause exhaustivity checking to explode. Tht remains to be found out.