Skip to content

Commit 3f4ccc1

Browse files
alexmarkovcommit-bot@chromium.org
authored andcommitted
[vm/bytecode] Replace dynamic with Object in bounds of type parameters
This is needed for function subtype checks and mimics the behavior of kernel AST reader (TypeTranslator::LoadAndSetupTypeParameters). Fixes the following tests in bytecode mode: co19_2/Language/Generics/typedef_A04_t06 co19_2/Language/Generics/typedef_A04_t07 Change-Id: I70fc86e811e77b2adc31d7bfce9ba55c5838666f Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112144 Reviewed-by: Régis Crelier <[email protected]> Commit-Queue: Alexander Markov <[email protected]>
1 parent 7d54324 commit 3f4ccc1

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

runtime/vm/compiler/frontend/bytecode_reader.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,13 @@ void BytecodeReaderHelper::ReadTypeParametersDeclaration(
674674
for (intptr_t i = 0; i < num_type_params; ++i) {
675675
parameter ^= type_parameters.TypeAt(i);
676676
bound ^= ReadObject();
677+
// Convert dynamic to Object in bounds of type parameters so
678+
// they are equivalent when doing subtype checks for function types.
679+
// TODO(https://github.com/dart-lang/language/issues/495): revise this
680+
// when function subtyping is fixed.
681+
if (bound.IsDynamicType()) {
682+
bound = I->object_store()->object_type();
683+
}
677684
parameter.set_bound(bound);
678685
}
679686
}

0 commit comments

Comments
 (0)