@@ -609,12 +609,12 @@ private predicate typeEquality(AstNode n1, TypePath prefix1, AstNode n2, TypePat
609609 strictcount ( Expr e | bodyReturns ( n1 , e ) ) = 1
610610 )
611611 or
612- exists ( RefExpr re |
613- n2 = re and
614- n1 = re .getExpr ( ) and
615- prefix1 .isEmpty ( ) and
616- prefix2 = TypePath:: singleton ( inferRefExprType ( re ) .getPositionalTypeParameter ( 0 ) )
617- )
612+ n2 =
613+ any ( RefExpr re |
614+ n1 = re .getExpr ( ) and
615+ prefix1 .isEmpty ( ) and
616+ prefix2 = TypePath:: singleton ( inferRefExprType ( re ) .getPositionalTypeParameter ( 0 ) )
617+ )
618618 or
619619 n1 = n2 .( RefPat ) .getPat ( ) and
620620 prefix1 .isEmpty ( ) and
@@ -3162,6 +3162,12 @@ private Type inferIndexExprType(IndexExpr ie, TypePath path) {
31623162 )
31633163}
31643164
3165+ pragma [ nomagic]
3166+ private Type getInferredDerefType ( DerefExpr de , TypePath path ) { result = inferType ( de , path ) }
3167+
3168+ pragma [ nomagic]
3169+ private PtrType getInferredDerefExprPtrType ( DerefExpr de ) { result = inferType ( de .getExpr ( ) ) }
3170+
31653171/**
31663172 * Gets the inferred type of `n` at `path` when `n` occurs in a dereference
31673173 * expression `*n` and when `n` is known to have a raw pointer type.
@@ -3171,8 +3177,8 @@ private Type inferIndexExprType(IndexExpr ie, TypePath path) {
31713177private Type inferDereferencedExprPtrType ( AstNode n , TypePath path ) {
31723178 exists ( DerefExpr de , PtrType type , TypePath suffix |
31733179 de .getExpr ( ) = n and
3174- type = inferType ( de . getExpr ( ) ) and
3175- result = inferType ( de , suffix ) and
3180+ type = getInferredDerefExprPtrType ( de ) and
3181+ result = getInferredDerefType ( de , suffix ) and
31763182 path = TypePath:: cons ( type .getPositionalTypeParameter ( 0 ) , suffix )
31773183 )
31783184}
0 commit comments