@@ -1020,6 +1020,12 @@ private module Input3 implements InputSig3 {
10201020 }
10211021
10221022 predicate inferStep ( AstNode n1 , TypePath path1 , AstNode n2 , TypePath path2 ) {
1023+ // When `n2` is `*n1` propagate type information from a raw pointer type
1024+ // parameter at `n1` (all other deref expressions are handled as calls)
1025+ n1 = n2 .( DerefExpr ) .getExpr ( ) and
1026+ path1 = TypePath:: singleton ( getPtrTypeParameter ( ) ) and
1027+ path2 .isEmpty ( )
1028+ or
10231029 path1 .isEmpty ( ) and
10241030 (
10251031 n1 = n2 .( ArrayListExpr ) .getAnExpr ( ) and
@@ -1110,8 +1116,6 @@ private module Input3 implements InputSig3 {
11101116 or
11111117 result = inferAwaitExprType ( n , path )
11121118 or
1113- result = inferDereferencedExprPtrType ( n , path )
1114- or
11151119 result = inferForLoopExprType ( n , path )
11161120 or
11171121 result = inferArgList ( n , path )
@@ -3108,30 +3112,6 @@ private Type inferArrayExprType(ArrayExpr ae) { exists(ae) and result instanceof
31083112pragma [ nomagic]
31093113private Type inferRangeExprType ( RangeExpr re ) { result = TDataType ( getRangeType ( re ) ) }
31103114
3111- pragma [ nomagic]
3112- private Type getInferredDerefType ( DerefExpr de , TypePath path ) { result = inferType ( de , path ) }
3113-
3114- pragma [ nomagic]
3115- private PtrType getInferredDerefExprPtrType ( DerefExpr de ) { result = inferType ( de .getExpr ( ) ) }
3116-
3117- /**
3118- * Gets the inferred type of `n` at `path` when `n` occurs in a dereference
3119- * expression `*n` and when `n` is known to have a raw pointer type.
3120- */
3121- private Type inferDereferencedExprPtrType ( AstNode n , TypePath path ) {
3122- exists ( DerefExpr de , PtrType type , TypePath suffix |
3123- de .getExpr ( ) = n and
3124- type = getInferredDerefExprPtrType ( de ) and
3125- result = getInferredDerefType ( de , suffix ) and
3126- path = TypePath:: cons ( type .getPositionalTypeParameter ( 0 ) , suffix )
3127- )
3128- or
3129- exists ( TypePath path0 |
3130- result = inferType ( n .( DerefExpr ) .getExpr ( ) , path0 ) and
3131- path0 .isCons ( getPtrTypeParameter ( ) , path )
3132- )
3133- }
3134-
31353115/**
31363116 * A matching configuration for resolving types of deconstruction patterns like
31373117 * `let Foo { bar } = ...` or `let Some(x) = ...`.
0 commit comments