mirror of
https://github.com/dart-lang/sdk
synced 2024-10-06 14:59:41 +00:00
[VM/kernel] Remove obsolete workaround when reading dynamic bound from kernel.
If the bound is not specified, CFE will use Object* in an opted-out library or Object? in an opted-in library, and not dynamic as before. This workaround is therefore not needed anymore, and actually harmful as shown in the regression tests. Closes https://github.com/dart-lang/sdk/issues/44136 Add regression tests. Change-Id: I11a96cbebcb592f66f3965e38cb2411200df332b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171380 Reviewed-by: Alexander Markov <alexmarkov@google.com> Commit-Queue: Régis Crelier <regis@google.com>
This commit is contained in:
parent
d7b3812f51
commit
9711b9a331
|
@ -3338,20 +3338,9 @@ void TypeTranslator::LoadAndSetupTypeParameters(
|
|||
TypeParameterHelper helper(helper_);
|
||||
helper.ReadUntilExcludingAndSetJustRead(TypeParameterHelper::kBound);
|
||||
|
||||
// TODO(github.com/dart-lang/kernel/issues/42): This should be handled
|
||||
// by the frontend.
|
||||
parameter ^= type_parameters.TypeAt(i);
|
||||
const Tag tag = helper_->PeekTag(); // peek ith bound type.
|
||||
if (tag == kDynamicType) {
|
||||
helper_->SkipDartType(); // read ith bound.
|
||||
parameter.set_bound(
|
||||
Type::Handle(Z, nnbd_mode == NNBDMode::kOptedInLib
|
||||
? I->object_store()->nullable_object_type()
|
||||
: I->object_store()->legacy_object_type()));
|
||||
} else {
|
||||
AbstractType& bound = BuildTypeWithoutFinalization(); // read ith bound.
|
||||
parameter.set_bound(bound);
|
||||
}
|
||||
AbstractType& bound = BuildTypeWithoutFinalization(); // read ith bound.
|
||||
parameter.set_bound(bound);
|
||||
helper.ReadUntilExcludingAndSetJustRead(TypeParameterHelper::kDefaultType);
|
||||
const AbstractType* default_arg = &Object::dynamic_type();
|
||||
if (helper_->ReadTag() == kSomething) {
|
||||
|
|
12
tests/language/regress/regress44136_test.dart
Normal file
12
tests/language/regress/regress44136_test.dart
Normal file
|
@ -0,0 +1,12 @@
|
|||
// Copyright (c) 2020, 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.
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
|
||||
typedef Foo = void Function<X extends dynamic>();
|
||||
typedef Bar = void Function<X extends Object?>();
|
||||
|
||||
void main() {
|
||||
Expect.notEquals(Foo, Bar);
|
||||
}
|
12
tests/language_2/regress/regress44136_test.dart
Normal file
12
tests/language_2/regress/regress44136_test.dart
Normal file
|
@ -0,0 +1,12 @@
|
|||
// Copyright (c) 2020, 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.
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
|
||||
typedef Foo = void Function<X extends dynamic>();
|
||||
typedef Bar = void Function<X extends Object>();
|
||||
|
||||
void main() {
|
||||
Expect.notEquals(Foo, Bar);
|
||||
}
|
Loading…
Reference in a new issue