Skip to content

Commit c97b84e

Browse files
alexmarkovCommit Queue
authored andcommitted
[tfa] Guard against recursive summary creation
TEST=ci Issue: #57084 Change-Id: Icacf44847cf5f53c256c62390c4c9ddfc0b80646 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/395400 Auto-Submit: Alexander Markov <[email protected]> Reviewed-by: Slava Egorov <[email protected]> Commit-Queue: Alexander Markov <[email protected]>
1 parent f856933 commit c97b84e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pkg/vm/lib/transformations/type_flow/summary_collector.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,9 @@ class SummaryCollector extends RecursiveResultVisitor<TypeExpr?> {
628628
summaryName += '::${localFunctionName(localFunction)}';
629629
}
630630
debugPrint("===== $summaryName =====");
631+
if (_enclosingMember != null) {
632+
throw 'Unable to create summary recursively, previous: $_enclosingMember, current: $summaryName';
633+
}
631634
assert(!member.isAbstract);
632635
_enclosingMember = member;
633636

@@ -2926,11 +2929,13 @@ class ConstantAllocationCollector implements ConstantVisitor<Type> {
29262929
for (int i = 0; i < constant.positional.length; ++i) {
29272930
final Field f = epl.getRecordPositionalField(recordShape, i);
29282931
final Type value = typeFor(constant.positional[i]);
2932+
assert(!f.isCovariantByClass);
29292933
epl.addFieldUsedInConstant(f, receiver, value);
29302934
}
29312935
constant.named.forEach((String fieldName, Constant fieldValue) {
29322936
final Field f = epl.getRecordNamedField(recordShape, fieldName);
29332937
final Type value = typeFor(fieldValue);
2938+
assert(!f.isCovariantByClass);
29342939
epl.addFieldUsedInConstant(f, receiver, value);
29352940
});
29362941
return receiver;
@@ -2941,6 +2946,7 @@ class ConstantAllocationCollector implements ConstantVisitor<Type> {
29412946
final resultClass = summaryCollector._entryPointsListener
29422947
.addAllocatedClass(constant.classNode);
29432948
constant.fieldValues.forEach((Reference fieldReference, Constant value) {
2949+
assert(!fieldReference.asField.isCovariantByClass);
29442950
summaryCollector._entryPointsListener.addFieldUsedInConstant(
29452951
fieldReference.asField, resultClass, typeFor(value));
29462952
});

0 commit comments

Comments
 (0)