mirror of
https://github.com/dart-lang/sdk
synced 2024-09-15 21:30:17 +00:00
[VM/runtime] Fix type test: a closure is T, when T is instantiated to Object.
Fixes https://github.com/dart-lang/sdk/issues/46165 TEST=added regression test Change-Id: I3016f60560b00f077d5ef55a0b23ccfb7dbf0836 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201863 Reviewed-by: Liam Appelbe <liama@google.com> Commit-Queue: Régis Crelier <regis@google.com>
This commit is contained in:
parent
7af28d8274
commit
7014f03aad
|
@ -18151,7 +18151,7 @@ void SubtypeTestCache::WriteCurrentEntryToBuffer(
|
|||
} else {
|
||||
ASSERT(instance_class_id_or_signature.IsFunctionType());
|
||||
buffer->Printf(
|
||||
"%sfunction: %s", separator,
|
||||
"%ssignature: %s", separator,
|
||||
FunctionType::Cast(instance_class_id_or_signature).ToCString());
|
||||
}
|
||||
if (!destination_type.IsNull()) {
|
||||
|
@ -19237,6 +19237,7 @@ bool Instance::RuntimeTypeIsSubtypeOf(
|
|||
instantiated_other = TypeRef::Cast(instantiated_other).type();
|
||||
}
|
||||
if (instantiated_other.IsTopTypeForSubtyping() ||
|
||||
instantiated_other.IsObjectType() ||
|
||||
instantiated_other.IsDartFunctionType()) {
|
||||
return true;
|
||||
}
|
||||
|
|
10
tests/language/regress/regress46165_test.dart
Normal file
10
tests/language/regress/regress46165_test.dart
Normal file
|
@ -0,0 +1,10 @@
|
|||
// Copyright (c) 2021, 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.
|
||||
|
||||
void main() {
|
||||
final l = <Object>[];
|
||||
l.add((String x, StringBuffer y) {
|
||||
print(x);
|
||||
});
|
||||
}
|
10
tests/language_2/regress/regress46165_test.dart
Normal file
10
tests/language_2/regress/regress46165_test.dart
Normal file
|
@ -0,0 +1,10 @@
|
|||
// Copyright (c) 2021, 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.
|
||||
|
||||
void main() {
|
||||
final l = <Object>[];
|
||||
l.add((String x, StringBuffer y) {
|
||||
print(x);
|
||||
});
|
||||
}
|
Loading…
Reference in a new issue