|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In an effort to reduce the enormous amount of duplication
which now exists among methods which attempt to deduce something
about the relationship between two types, a sampling (and only
a sampling - this might not even be half of them) given here:
def isAsSpecific(ftpe1: Type, ftpe2: Type): Boolean
def isCompatibleByName(tp: Type, pt: Type): Boolean
def isConservativelyCompatible(tp: Type, pt: Type): Boolean
def isConsistent(tp1: Type, tp2: Type): Boolean
def isDifferentType(tp1: Type, tp2: Type): Boolean
def isDifferentTypeConstructor(tp1: Type, tp2: Type): Boolean
def isDistinguishableFrom(t1: Type, t2: Type): Boolean
def isNeverSubType(tp1: Type, tp2: Type): Boolean
def isNumericSubType(tp1: Type, tp2: Type): Boolean
def isPlausiblyCompatible(tp: Type, pt: Type): Boolean
def isPopulated(tp1: Type, tp2: Type): Boolean
def isSameType(tp1: Type, tp2: Type): Boolean
def isSameType2(tp1: Type, tp2: Type): Boolean
def isSubType(tp1: Type, tp2: Type): Boolean
def isWeakSubType(tp1: Type, tp2: Type): Boolean
def isWeaklyCompatible(tp: Type, pt: Type): Boolean
def matches(tpe1: Type, tpe2: Type): Boolean
def overlaps(tp1: Type, tp2: Type): Boolean
def typesConform(tp: Type, pt: Type): Boolean
I began pulling a thread left by moors in isPopulated:
need to investgate why this can't be made symmetric --
neg/gadts1 fails, and run/existials also.
Followed that to this code in TypeVar:
val newInst = wildcardToTypeVarMap(tp)
(constr isWithinBounds newInst) && { setInst(tp); true }
-------^
That was the obstacle to symmetry, because it creates a
cycle in e.g. run/existentials. Kept pulling the string,
came back to my own comment of long ago:
!!! Is it somehow guaranteed that this will not break
under nesting? In general one has to save and restore
the contents of the field...
Decided that uncertainty could no longer be tolerated.
Unless it can be proven somehow that there will never be
crosstalk among the save/suspension points, we should do
it this way even if nothing demands it yet.
What's in this commit:
- Made isPopulated symmetric.
- Made setInst resistant to TypeVar cycles.
- Fixed above mentioned bug in registerTypeEquality.
- Added some rigor to the suspension/unsuspension of TypeVars
so it will not break under nesting.
- Recovered pos/t0851.scala from its deletion.
|
|
I will again defer to a comment.
/** Given classes A and B, can it be shown that nothing which is
* an A will ever be a subclass of something which is a B? This
* entails not only showing that !(A isSubClass B) but that the
* same is true of all their subclasses. Restated for symmetry:
* the same value cannot be a member of both A and B.
*
* 1) A must not be a subclass of B, nor B of A (the trivial check)
* 2) One of A or B must be completely knowable (see isKnowable)
* 3) Assuming A is knowable, the proposition is true if
* !(A' isSubClass B) for all A', where A' is a subclass of A.
*
* Due to symmetry, the last condition applies as well in reverse.
*/
|