@@ -287,6 +287,16 @@ private predicate typeEquality(AstNode n1, TypePath prefix1, AstNode n2, TypePat
287
287
prefix2 .isEmpty ( )
288
288
)
289
289
)
290
+ or
291
+ // an array list expression (`[1, 2, 3]`) has the type of the first (any) element
292
+ n1 .( ArrayListExpr ) .getExpr ( 0 ) = n2 and
293
+ prefix1 = TypePath:: singleton ( TArrayTypeParameter ( ) ) and
294
+ prefix2 .isEmpty ( )
295
+ or
296
+ // an array repeat expression (`[1; 3]`) has the type of the repeat operand
297
+ n1 .( ArrayRepeatExpr ) .getRepeatOperand ( ) = n2 and
298
+ prefix1 = TypePath:: singleton ( TArrayTypeParameter ( ) ) and
299
+ prefix2 .isEmpty ( )
290
300
}
291
301
292
302
pragma [ nomagic]
@@ -1124,23 +1134,6 @@ private Type inferIndexExprType(IndexExpr ie, TypePath path) {
1124
1134
)
1125
1135
}
1126
1136
1127
- pragma [ nomagic]
1128
- private Type inferArrayExprType ( ArrayExpr ae , TypePath path ) {
1129
- // an array list expression (`[1, 2, 3]`) has the type of the first (any) element
1130
- exists ( Type type0 , TypePath path0 |
1131
- type0 = inferType ( ae .( ArrayListExpr ) .getExpr ( 0 ) , path0 ) and
1132
- result = type0 and
1133
- path = TypePath:: cons ( any ( ArrayTypeParameter tp ) , path0 )
1134
- )
1135
- or
1136
- // an array repeat expression (`[1; 3]`) has the type of the repeat operand
1137
- exists ( Type type0 , TypePath path0 |
1138
- type0 = inferType ( ae .( ArrayRepeatExpr ) .getRepeatOperand ( ) , path0 ) and
1139
- result = type0 and
1140
- path = TypePath:: cons ( any ( ArrayTypeParameter tp ) , path0 )
1141
- )
1142
- }
1143
-
1144
1137
pragma [ nomagic]
1145
1138
private Type inferForLoopExprType ( AstNode n , TypePath path ) {
1146
1139
// type of iterable -> type of pattern (loop variable)
@@ -1470,8 +1463,6 @@ private module Cached {
1470
1463
or
1471
1464
result = inferIndexExprType ( n , path )
1472
1465
or
1473
- result = inferArrayExprType ( n , path )
1474
- or
1475
1466
result = inferForLoopExprType ( n , path )
1476
1467
}
1477
1468
}
0 commit comments