Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Conversion of the list from #19998 (comment) to tests. For those which have been fixed in the meantime, I have use the
@testintersect
macro. There is one@test_skip
at the end because that one loops infinitely (?) or sometimes throws a stack overflow.A word about the fuzz testing that produced those:
I start with creating a random type that is an
Int64
, aFloat64
, aVal{T}
withT
being a random type again, or aTuple{T1,T2, ...}
of a random number of random typesT1
,T2
, etc. For the random types inside aVal
orTuple
, a constant integer is also possible. Note that these types may be large and deep, but don't containUnion
s,Vararg
s, orUnionAll
s, so I hoped these would still be easy ones... Anyway, the type thus obtained isx
.I then apply random widening by replacing random parts of the type
x
withTypeVar
s, potentially introducing the sameTypeVar
multiple times if the same type is to be replaced more than once. All introducedTypeVar
s are bound byUnionAll
s at the outermost layer. This process is done twice to obtaina
andb
, such thatx<:a
andx<:b
.With these types, it is verified that
typeintersect(a,b) == typeintersect(b,a)
x <: typeintersect(a,b)
typeintersect(a,b) <: a
typeintersect(a,b) <: b
If any of these conditions is violated, the combination
x
,a
,b
is reduced while maintaining the same violation. The reduction tries steps such as removing tuple elements or unwrapping (i.e.Tuple{T}
->T
orVal{T}
->T
).Once we get (most of) these right, I will add things like
Union
s,Vararg
s, innerUnionAll
s,TypeVar
bounds other thanBottom <: T <: Any
, ...