@@ -22,6 +22,17 @@ module MkUnification<unificationTarget/1 targetLeft, unificationTarget/1 targetR
2222 targetRight ( t2 ) and t2 .getGenericType ( ) = g
2323 }
2424
25+ pragma [ noinline]
26+ private predicate unificationTargetsWithCommonSourceDecl (
27+ ParameterizedType pt1 , ParameterizedType pt2
28+ ) {
29+ exists ( RefType commonSourceDecl |
30+ unificationTargets ( pt1 , pt2 ) and
31+ pragma [ only_bind_out ] ( pt1 ) .getSourceDeclaration ( ) = pragma [ only_bind_out ] ( commonSourceDecl ) and
32+ pragma [ only_bind_out ] ( pt2 ) .getSourceDeclaration ( ) = commonSourceDecl
33+ )
34+ }
35+
2536 private predicate unificationTargets ( Type t1 , Type t2 ) {
2637 exists ( GenericType g | unificationTargetLeft ( t1 , g ) and unificationTargetRight ( t2 , g ) )
2738 or
@@ -32,10 +43,9 @@ module MkUnification<unificationTarget/1 targetLeft, unificationTarget/1 targetR
3243 )
3344 or
3445 exists ( ParameterizedType pt1 , ParameterizedType pt2 , int pos |
35- unificationTargets ( pt1 , pt2 ) and
36- not pt1 .getSourceDeclaration ( ) != pt2 .getSourceDeclaration ( ) and
37- t1 = pt1 .getTypeArgument ( pos ) and
38- t2 = pt2 .getTypeArgument ( pos )
46+ unificationTargetsWithCommonSourceDecl ( pt1 , pt2 ) and
47+ t1 = pt1 .getTypeArgument ( pragma [ only_bind_into ] ( pos ) ) and
48+ t2 = pt2 .getTypeArgument ( pragma [ only_bind_into ] ( pos ) )
3949 )
4050 }
4151
@@ -44,8 +54,8 @@ module MkUnification<unificationTarget/1 targetLeft, unificationTarget/1 targetR
4454 ParameterizedType t1 , ParameterizedType t2 , int pos , RefType arg1 , RefType arg2
4555 ) {
4656 unificationTargets ( t1 , t2 ) and
47- arg1 = t1 .getTypeArgument ( pos ) and
48- arg2 = t2 .getTypeArgument ( pos )
57+ arg1 = t1 .getTypeArgument ( pragma [ only_bind_into ] ( pos ) ) and
58+ arg2 = t2 .getTypeArgument ( pragma [ only_bind_into ] ( pos ) )
4959 }
5060
5161 private RefType getUpperBound ( RefType t ) {
0 commit comments