mirror of
https://github.com/github/codeql.git
synced 2025-12-22 19:56:32 +01:00
Java: Address review comments.
This commit is contained in:
@@ -72,6 +72,8 @@ module MkUnification<unificationTarget/1 targetLeft, unificationTarget/1 targetR
|
|||||||
or
|
or
|
||||||
failsUnification(t1.(Array).getComponentType(), t2.(Array).getComponentType())
|
failsUnification(t1.(Array).getComponentType(), t2.(Array).getComponentType())
|
||||||
or
|
or
|
||||||
|
// Can't unify an `extends` bound against a concrete type that doesn't
|
||||||
|
// descend from that upper bound:
|
||||||
exists(RefType upperbound, RefType other |
|
exists(RefType upperbound, RefType other |
|
||||||
t1.(BoundedType).getAnUltimateUpperBoundType().getSourceDeclaration() = upperbound and
|
t1.(BoundedType).getAnUltimateUpperBoundType().getSourceDeclaration() = upperbound and
|
||||||
t2.(RefType).getSourceDeclaration() = other and
|
t2.(RefType).getSourceDeclaration() = other and
|
||||||
@@ -84,24 +86,28 @@ module MkUnification<unificationTarget/1 targetLeft, unificationTarget/1 targetR
|
|||||||
not other.getASourceSupertype*() = upperbound
|
not other.getASourceSupertype*() = upperbound
|
||||||
)
|
)
|
||||||
or
|
or
|
||||||
|
// Can't unify two `extends` bounds that don't intersect:
|
||||||
exists(RefType upperbound1, RefType upperbound2 |
|
exists(RefType upperbound1, RefType upperbound2 |
|
||||||
t1.(BoundedType).getAnUltimateUpperBoundType() = upperbound1 and
|
t1.(BoundedType).getAnUltimateUpperBoundType() = upperbound1 and
|
||||||
t2.(BoundedType).getAnUltimateUpperBoundType() = upperbound2 and
|
t2.(BoundedType).getAnUltimateUpperBoundType() = upperbound2 and
|
||||||
notHaveIntersection(upperbound1, upperbound2)
|
notHaveIntersection(upperbound1, upperbound2)
|
||||||
)
|
)
|
||||||
or
|
or
|
||||||
|
// Can't unify `? super X` against `Y` or `_ extends Y` where `Y` isn't an
|
||||||
|
// ancestor of `X`:
|
||||||
exists(RefType lowerbound, RefType upperbound |
|
exists(RefType lowerbound, RefType upperbound |
|
||||||
t1.(Wildcard).getLowerBoundType().(RefType).getSourceDeclaration() = lowerbound and
|
t1.(Wildcard).getLowerBoundType().(RefType).getSourceDeclaration() = lowerbound and
|
||||||
getUpperBound(t2).getSourceDeclaration() = upperbound and
|
getUpperBound(t2).getSourceDeclaration() = upperbound
|
||||||
not lowerbound instanceof BoundedType
|
|
||||||
or
|
or
|
||||||
t2.(Wildcard).getLowerBoundType().(RefType).getSourceDeclaration() = lowerbound and
|
t2.(Wildcard).getLowerBoundType().(RefType).getSourceDeclaration() = lowerbound and
|
||||||
getUpperBound(t1).getSourceDeclaration() = upperbound and
|
getUpperBound(t1).getSourceDeclaration() = upperbound
|
||||||
not lowerbound instanceof BoundedType
|
|
||||||
|
|
|
|
||||||
|
not lowerbound instanceof BoundedType and
|
||||||
not lowerbound.getASourceSupertype*() = upperbound
|
not lowerbound.getASourceSupertype*() = upperbound
|
||||||
)
|
)
|
||||||
or
|
or
|
||||||
|
// Can't unify `? super T`, where `T` is a type variable `T extends S`,
|
||||||
|
// with a type that doesn't intersect with `S`:
|
||||||
exists(BoundedType lowerbound, RefType upperbound |
|
exists(BoundedType lowerbound, RefType upperbound |
|
||||||
t1.(Wildcard).getLowerBoundType() = lowerbound and
|
t1.(Wildcard).getLowerBoundType() = lowerbound and
|
||||||
getUpperBound(t2) = upperbound
|
getUpperBound(t2) = upperbound
|
||||||
|
|||||||
Reference in New Issue
Block a user