@@ -145,6 +145,8 @@ signature module InputSig1<LocationSig Location> {
145145 Location getLocation ( ) ;
146146 }
147147
148+ predicate isPseudoType ( Type t ) ;
149+
148150 /** A type parameter. */
149151 class TypeParameter extends Type ;
150152
@@ -413,7 +415,7 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
413415 * not at the path `"T2"`.
414416 */
415417 predicate typeAbstractionHasAmbiguousConstraintAt (
416- TypeAbstraction abs , Type constraint , TypePath path
418+ TypeAbstraction abs , Type constraint , TypeAbstraction other , TypePath path
417419 ) ;
418420
419421 /**
@@ -648,8 +650,22 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
648650 t = getTypeAt ( app , abs , constraint , path ) and
649651 not t = abs .getATypeParameter ( ) and
650652 app .getTypeAt ( path ) = t2 and
653+ not isPseudoType ( t2 ) and
651654 t2 != t
652655 )
656+ or
657+ // satisfiesConcreteTypes(app, abs, constraint) and
658+ exists ( TypeParameter tp , TypePath path2 , Type t , Type t2 |
659+ tp = getTypeAt ( app , abs , constraint , path ) and
660+ tp = getTypeAt ( app , abs , constraint , path2 ) and
661+ tp = abs .getATypeParameter ( ) and
662+ path != path2 and
663+ app .getTypeAt ( path ) = t and
664+ app .getTypeAt ( path2 ) = t2 and
665+ not isPseudoType ( t ) and
666+ not isPseudoType ( t2 ) and
667+ t != t2
668+ )
653669 }
654670 }
655671
@@ -1004,17 +1020,92 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
10041020 ) {
10051021 exists ( Type constraintRoot |
10061022 hasConstraintMention ( term , abs , sub , constraint , constraintRoot , constraintMention ) and
1007- conditionSatisfiesConstraintTypeAt ( abs , sub , constraintMention , path , t ) and
1008- if
1009- exists ( TypePath prefix |
1010- typeAbstractionHasAmbiguousConstraintAt ( abs , constraintRoot , prefix ) and
1011- prefix .isPrefixOf ( path )
1012- )
1013- then ambiguous = true
1014- else ambiguous = false
1023+ conditionSatisfiesConstraintTypeAt ( abs , sub , constraintMention , path , t )
1024+ |
1025+ exists ( TypePath prefix , TypeAbstraction other |
1026+ typeAbstractionHasAmbiguousConstraintAt ( abs , constraintRoot , other , prefix ) and
1027+ prefix .isPrefixOf ( path ) and
1028+ hasConstraintMention ( term , other , _, _, constraintRoot , _)
1029+ ) and
1030+ ambiguous = true
1031+ or
1032+ forall ( TypePath prefix , TypeAbstraction other |
1033+ typeAbstractionHasAmbiguousConstraintAt ( abs , constraintRoot , other , prefix )
1034+ |
1035+ not prefix .isPrefixOf ( path )
1036+ or
1037+ TermIsInstantiationOfCondition:: isNotInstantiationOf ( term , other , _, _)
1038+ ) and
1039+ ambiguous = false
10151040 )
10161041 }
10171042
1043+ // private predicate testsatisfiesConstraintTypeMention0(
1044+ // Term term, Constraint constraint, TypeMention constraintMention, TypeAbstraction abs,
1045+ // TypeMention sub, TypePath path, Type t, boolean ambiguous
1046+ // ) {
1047+ // exists(string filepath, int startline, int startcolumn, int endline, int endcolumn |
1048+ // term.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn) and
1049+ // filepath.matches("%/main.rs") and
1050+ // startline = 435
1051+ // ) and
1052+ // satisfiesConstraintTypeMention0(term, constraint, constraintMention, abs, sub, path, t,
1053+ // ambiguous)
1054+ // }
1055+ // private predicate testsatisfiesConstraintTypeMention1(
1056+ // Term term, Constraint constraint, TypeMention constraintMention, TypeAbstraction abs,
1057+ // TypeMention sub, TypePath path, Type t, boolean ambiguous, TypePath prefix,
1058+ // TypeAbstraction other, TypePath path2
1059+ // ) {
1060+ // exists(string filepath, int startline, int startcolumn, int endline, int endcolumn |
1061+ // term.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn) and
1062+ // filepath.matches("%/main.rs") and
1063+ // startline = 435
1064+ // ) and
1065+ // exists(Type constraintRoot |
1066+ // hasConstraintMention(term, abs, sub, constraint, constraintRoot, constraintMention) and
1067+ // conditionSatisfiesConstraintTypeAt(abs, sub, constraintMention, path, t)
1068+ // |
1069+ // // if
1070+ // // exists(TypePath prefix, TypeAbstraction other |
1071+ // // typeAbstractionHasAmbiguousConstraintAt(abs, constraintRoot, other, prefix) and
1072+ // // prefix.isPrefixOf(path)
1073+ // // )
1074+ // // then ambiguous = true
1075+ // // else ambiguous = false
1076+ // typeAbstractionHasAmbiguousConstraintAt(abs, constraintRoot, other, prefix) and
1077+ // // isNotInstantiationOf(term, other, _, constraintRoot) and
1078+ // // TermIsInstantiationOfConditionInput::potentialInstantiationOf(term, other, _) and
1079+ // prefix.isPrefixOf(path) and
1080+ // TermIsInstantiationOfCondition::isNotInstantiationOf(term, other, _, path2) and
1081+ // // not isNotInstantiationOf(term, other, _, constraintRoot) and
1082+ // ambiguous = false
1083+ // // exists(TypePath prefix, TypeAbstraction other |
1084+ // // typeAbstractionHasAmbiguousConstraintAt(abs, constraintRoot, other, prefix) and
1085+ // // prefix.isPrefixOf(path) and
1086+ // // hasConstraintMention(term, other, _, _, constraintRoot, _)
1087+ // // ) and
1088+ // // ambiguous = true
1089+ // // or
1090+ // // forall(TypePath prefix, TypeAbstraction other |
1091+ // // typeAbstractionHasAmbiguousConstraintAt(abs, constraintRoot, other, prefix)
1092+ // // |
1093+ // // not prefix.isPrefixOf(path)
1094+ // // or
1095+ // // // exists(Type type | hasTypeConstraint(term, type, constraint, constraintRoot) |
1096+ // // // // countConstraintImplementations(type, constraintRoot) = 0
1097+ // // // // or
1098+ // // // // not rootTypesSatisfaction(type, constraintRoot, _, _, _)
1099+ // // // // or
1100+ // // // multipleConstraintImplementations(type, constraintRoot) and
1101+ // // // isNotInstantiationOf(term, other, _, constraintRoot)
1102+ // // // )
1103+ // // isNotInstantiationOf(term, other, _, constraintRoot)
1104+ // // // TermIsInstantiationOfCondition::isNotInstantiationOf(term, other, _, _)
1105+ // // ) and
1106+ // // ambiguous = false
1107+ // )
1108+ // }
10181109 pragma [ nomagic]
10191110 private predicate conditionSatisfiesConstraintTypeAtForDisambiguation (
10201111 TypeAbstraction abs , TypeMention condition , TypeMention constraint , TypePath path , Type t
0 commit comments