-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Change : freeze bounds #805
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
Note that this PR is based on #802. |
Can assume P#T <: Q#T if P <: Q. This follows from the rules how we expand # to existentials.
Some subtype tests should not instantiate type variables, in particular those having to do with & and |.
withMode sets the whole mode, nit an individual bits. This was used wrongly in several places. Make this less of a trap by renaming withMode -> withModeBits.
Logging while printing messes up the recursion counts.
make successive underlying values an iterator (so that we do not run into a stackoverflow in case of cycles).
Avoid redundant computations when already in printing mode.
We had problems printing constraints which are ill-formed, because the basic operations & , | cause exceptions themselves. toString serves as a fallback if show does not work.
Cases like these (in fact one of the operads was a type variable the other its underlying polyparam) arose in pos/overloads.scala and caused deep subtype recursions.
Checking whether two alternatives are the same should not unify them by instantiating type variables.
Overall goal: Push backtracking deeper into the tree.
Iter2.scala fails with 6 errors, but succeeds once lubs and glbs do not try to unify under invariant type constructors.
There is a diff, but a minor one. Instead of (T? >: Int <: Int) we get (T? = Int) after pickling.
aae7783
to
6497d02
Compare
Rebased to master |
If there are no more reviewing comments I am going to merge this later today. |
da16e8b
to
6f8741a
Compare
@DarkDimius I added some explanations to the And/Or rewritings. I did see some code fail which got fixed by the rewriting, but currently all tests pass with or without the rewriting. So it would still be good to get a test which pinpoints the difference at some point. But since the PR is important for many other things it should not be held up by this, I think. |
23e8437
to
cd17e26
Compare
I did not understand that remark. Can you elaborate? |
According to the new subtyping rules, T <: U ==> T#X <: U#X and T#x <: U#x Therefore type maps should treat the prefix of a named type covariantly.
10c9a1e
to
0a48b2a
Compare
I dropped the strawman from this PR, in order to resubmit this as a separate PR. |
This reverts commit 0a48b2a.
Going to merge now, I think we got all the reviews we could expect. |
There was a big hole in the type system so far in that lubs and glbs (and some other ops as well) used isSubType instead of isSubTypeWhenFrozen. Consequently, taking the lub of, say Set[A] and Set[B]
would have unified A and B! Keeps the constraints nice and tidy but is wrong. Fixing this uncovered several other problems which needed to be fixed in turn.
Review by @DarkDimius