Skip to content

Commit 1c7f0a4

Browse files
committed
Finalizing an upper bound during a compile-time type test may lead to cycles.
Fail the test instead, requiring a runtime test. This was introduced last week as https://codereview.chromium.org/1513493002/ in order to fix #25122. [email protected] Review URL: https://codereview.chromium.org/1528523002 .
1 parent dcf576a commit 1c7f0a4

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

runtime/vm/object.cc

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15684,13 +15684,9 @@ bool AbstractType::TypeTest(TypeTestKind test_kind,
1568415684
}
1568515685
const AbstractType& bound = AbstractType::Handle(type_param.bound());
1568615686
// We may be checking bounds at finalization time and can encounter
15687-
// a still unfinalized bound.
15688-
if (!bound.IsFinalized() && !bound.IsBeingFinalized()) {
15689-
ClassFinalizer::FinalizeType(
15690-
Class::Handle(type_param.parameterized_class()),
15691-
bound,
15692-
ClassFinalizer::kCanonicalize);
15693-
type_param.set_bound(bound);
15687+
// a still unfinalized bound. Finalizing the bound here may lead to cycles.
15688+
if (!bound.IsFinalized()) {
15689+
return false; // TODO(regis): Return "maybe after instantiation".
1569415690
}
1569515691
if (bound.IsMoreSpecificThan(other, bound_error)) {
1569615692
return true;

0 commit comments

Comments
 (0)