mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 10:49:00 +00:00
Fix type argument finalization of some recursive generic types (fixes #29949).
Add regression test. R=asiva@google.com Review-Url: https://codereview.chromium.org/2952743003 .
This commit is contained in:
parent
95aaba5085
commit
eabcc23b33
2 changed files with 21 additions and 3 deletions
|
@ -980,12 +980,15 @@ void ClassFinalizer::FinalizeTypeArguments(const Class& cls,
|
|||
TypeArguments::Handle(ref_super_type_arg.arguments());
|
||||
// Mark as finalized before finalizing to avoid cycles.
|
||||
ref_super_type_arg.SetIsFinalized();
|
||||
// Since the instantiator is different, do not pass the current
|
||||
// instantiation trail, but create a new one by passing NULL.
|
||||
// Although the instantiator is different between cls and super_cls,
|
||||
// we still need to pass the current instantiation trail as to avoid
|
||||
// divergence. Finalizing the type arguments of super_cls may indeed
|
||||
// recursively require instantiating the same type_refs already
|
||||
// present in the trail (see issue #29949).
|
||||
FinalizeTypeArguments(
|
||||
super_cls, super_args,
|
||||
super_cls.NumTypeArguments() - super_cls.NumTypeParameters(),
|
||||
bound_error, pending_types, NULL);
|
||||
bound_error, pending_types, instantiation_trail);
|
||||
if (FLAG_trace_type_finalization) {
|
||||
THR_Print("Finalized instantiated TypeRef '%s': '%s'\n",
|
||||
String::Handle(super_type_arg.Name()).ToCString(),
|
||||
|
|
15
tests/language/regress_29949_test.dart
Normal file
15
tests/language/regress_29949_test.dart
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
abstract class S {}
|
||||
|
||||
abstract class M<T> {}
|
||||
|
||||
abstract class N<T> {}
|
||||
|
||||
class C<T> extends S with M<C<T>>, N<C<T>> {}
|
||||
|
||||
main() {
|
||||
new C<int>();
|
||||
}
|
Loading…
Reference in a new issue