Skip to content

Commit 9711b9a

Browse files
creliercommit-bot@chromium.org
authored andcommitted
[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 #44136 Add regression tests. Change-Id: I11a96cbebcb592f66f3965e38cb2411200df332b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171380 Reviewed-by: Alexander Markov <[email protected]> Commit-Queue: Régis Crelier <[email protected]>
1 parent d7b3812 commit 9711b9a

File tree

3 files changed

+26
-13
lines changed

3 files changed

+26
-13
lines changed

runtime/vm/compiler/frontend/kernel_translation_helper.cc

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3338,20 +3338,9 @@ void TypeTranslator::LoadAndSetupTypeParameters(
33383338
TypeParameterHelper helper(helper_);
33393339
helper.ReadUntilExcludingAndSetJustRead(TypeParameterHelper::kBound);
33403340

3341-
// TODO(github.com/dart-lang/kernel/issues/42): This should be handled
3342-
// by the frontend.
33433341
parameter ^= type_parameters.TypeAt(i);
3344-
const Tag tag = helper_->PeekTag(); // peek ith bound type.
3345-
if (tag == kDynamicType) {
3346-
helper_->SkipDartType(); // read ith bound.
3347-
parameter.set_bound(
3348-
Type::Handle(Z, nnbd_mode == NNBDMode::kOptedInLib
3349-
? I->object_store()->nullable_object_type()
3350-
: I->object_store()->legacy_object_type()));
3351-
} else {
3352-
AbstractType& bound = BuildTypeWithoutFinalization(); // read ith bound.
3353-
parameter.set_bound(bound);
3354-
}
3342+
AbstractType& bound = BuildTypeWithoutFinalization(); // read ith bound.
3343+
parameter.set_bound(bound);
33553344
helper.ReadUntilExcludingAndSetJustRead(TypeParameterHelper::kDefaultType);
33563345
const AbstractType* default_arg = &Object::dynamic_type();
33573346
if (helper_->ReadTag() == kSomething) {
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
import "package:expect/expect.dart";
6+
7+
typedef Foo = void Function<X extends dynamic>();
8+
typedef Bar = void Function<X extends Object?>();
9+
10+
void main() {
11+
Expect.notEquals(Foo, Bar);
12+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
import "package:expect/expect.dart";
6+
7+
typedef Foo = void Function<X extends dynamic>();
8+
typedef Bar = void Function<X extends Object>();
9+
10+
void main() {
11+
Expect.notEquals(Foo, Bar);
12+
}

0 commit comments

Comments
 (0)