@@ -48,6 +48,12 @@ module MkUnification<unificationTarget/1 targetLeft, unificationTarget/1 targetR
48
48
arg2 = t2 .getTypeArgument ( pos )
49
49
}
50
50
51
+ private RefType getUpperBound ( RefType t ) {
52
+ if t instanceof BoundedType
53
+ then result = t .( BoundedType ) .getAnUltimateUpperBoundType ( )
54
+ else result = t
55
+ }
56
+
51
57
/**
52
58
* Holds if `t1` and `t2` are not unifiable.
53
59
*
@@ -84,6 +90,28 @@ module MkUnification<unificationTarget/1 targetLeft, unificationTarget/1 targetR
84
90
notHaveIntersection ( upperbound1 , upperbound2 )
85
91
)
86
92
or
93
+ exists ( RefType lowerbound , RefType upperbound |
94
+ t1 .( Wildcard ) .getLowerBoundType ( ) .( RefType ) .getSourceDeclaration ( ) = lowerbound and
95
+ getUpperBound ( t2 ) .getSourceDeclaration ( ) = upperbound and
96
+ not lowerbound instanceof BoundedType
97
+ or
98
+ t2 .( Wildcard ) .getLowerBoundType ( ) .( RefType ) .getSourceDeclaration ( ) = lowerbound and
99
+ getUpperBound ( t1 ) .getSourceDeclaration ( ) = upperbound and
100
+ not lowerbound instanceof BoundedType
101
+ |
102
+ not lowerbound .getASourceSupertype * ( ) = upperbound
103
+ )
104
+ or
105
+ exists ( BoundedType lowerbound , RefType upperbound |
106
+ t1 .( Wildcard ) .getLowerBoundType ( ) = lowerbound and
107
+ getUpperBound ( t2 ) = upperbound
108
+ or
109
+ t2 .( Wildcard ) .getLowerBoundType ( ) = lowerbound and
110
+ getUpperBound ( t1 ) = upperbound
111
+ |
112
+ notHaveIntersection ( lowerbound .getUpperBoundType ( ) , upperbound )
113
+ )
114
+ or
87
115
not (
88
116
t1 instanceof Array and t2 instanceof Array
89
117
or
0 commit comments