Fix how we pass the type-parameter to StreamIterator in for-in

Change-Id: If2b33bc9bbee93e67f6da621db0287730b61b223
Reviewed-on: https://dart-review.googlesource.com/54311
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
This commit is contained in:
Sigmund Cherem 2018-05-08 23:01:58 +00:00 committed by commit-bot@chromium.org
parent cc034472bb
commit 3beb7fe860
4 changed files with 24 additions and 13 deletions

View file

@ -576,8 +576,10 @@ class CommonElements {
ClassEntity get controllerStream =>
_findAsyncHelperClass("_ControllerStream");
ClassEntity get streamIterator => _findAsyncHelperClass("StreamIterator");
ConstructorEntity get streamIteratorConstructor =>
_env.lookupConstructor(_findAsyncHelperClass("StreamIterator"), "");
_env.lookupConstructor(streamIterator, "");
FunctionEntity _syncStarIterableFactory;
FunctionEntity get syncStarIterableFactory => _syncStarIterableFactory ??=

View file

@ -1575,12 +1575,25 @@ class KernelSsaGraphBuilder extends ir.Visitor
HInstruction streamIterator;
node.iterable.accept(this);
_pushStaticInvocation(
_commonElements.streamIteratorConstructor,
[pop(), graph.addConstantNull(closedWorld)],
_typeInferenceMap
.getReturnTypeOf(_commonElements.streamIteratorConstructor),
const <DartType>[]);
List<HInstruction> arguments = [pop()];
ClassEntity cls = _commonElements.streamIterator;
DartType typeArg = _elementMap.getDartType(node.variable.type);
InterfaceType instanceType =
localsHandler.substInContext(new InterfaceType(cls, [typeArg]));
addImplicitInstantiation(instanceType);
SourceInformation sourceInformation =
_sourceInformationBuilder.buildForInIterator(node);
// TODO(johnniwinther): Pass type arguments to constructors like calling
// a generic method.
if (rtiNeed.classNeedsTypeArguments(cls)) {
_addTypeArguments(arguments, [typeArg], sourceInformation);
}
ConstructorEntity constructor = _commonElements.streamIteratorConstructor;
_pushStaticInvocation(constructor, arguments,
_typeInferenceMap.getReturnTypeOf(constructor), const <DartType>[],
instanceType: instanceType, sourceInformation: sourceInformation);
streamIterator = pop();
void buildInitializer() {}

View file

@ -225,9 +225,7 @@ int_parse_radix_test/none: Pass # Issue 31762
map_entry_test: RuntimeError
[ $compiler == dart2js && $fasta && $host_checked && $strong ]
apply3_test: RuntimeError
cast_test: RuntimeError
dynamic_nosuchmethod_test: RuntimeError
error_stack_trace1_test: RuntimeError # Issue 12399
growable_list_test: RuntimeError # Concurrent modifications test always runs
int_parse_radix_test/01: RuntimeError

View file

@ -1057,6 +1057,7 @@ function_subtype_not1_test: RuntimeError
function_subtype_setter0_test: RuntimeError
function_type_alias2_test: RuntimeError
function_type_alias4_test: RuntimeError
generic_async_star_test: RuntimeError
generic_closure_test/01: RuntimeError
generic_closure_test/none: RuntimeError
generic_function_bounds_test: RuntimeError
@ -1108,7 +1109,6 @@ int64_literal_test/40: RuntimeError
int64_literal_test/none: RuntimeError
integer_division_by_zero_test: RuntimeError # Issue 8301
internal_library_test/02: Crash # type 'DillLibraryBuilder' is not a subtype of type 'SourceLibraryBuilder<KernelTypeBuilder, Library>' of 'value' where
invocation_mirror2_test: RuntimeError # mirrors not supported
invocation_mirror_invoke_on2_test: RuntimeError
invocation_mirror_invoke_on_test: RuntimeError
issue18628_2_test/01: MissingCompileTimeError
@ -1142,7 +1142,6 @@ malbounded_type_test2_test/00: MissingCompileTimeError
malbounded_type_test_test/00: MissingCompileTimeError
malbounded_type_test_test/01: MissingCompileTimeError
malbounded_type_test_test/02: MissingCompileTimeError
many_overridden_no_such_method_test: RuntimeError
map_literal3_test/01: MissingCompileTimeError
map_literal3_test/02: MissingCompileTimeError
map_literal3_test/03: MissingCompileTimeError
@ -1262,7 +1261,6 @@ nan_identical_test: RuntimeError # Issue 11551
nested_generic_closure_test: RuntimeError
no_main_test/01: CompileTimeError
no_such_method_mock_test: RuntimeError
no_such_method_test: RuntimeError
nosuchmethod_forwarding/nosuchmethod_forwarding_arguments_test: RuntimeError
nosuchmethod_forwarding/nosuchmethod_forwarding_test/05: RuntimeError
nosuchmethod_forwarding/nosuchmethod_forwarding_test/06: RuntimeError
@ -1270,7 +1268,6 @@ null_no_such_method_test: CompileTimeError
number_identity2_test: RuntimeError
numbers_test: RuntimeError, OK # non JS number semantics
operator2_negative_test: Crash # 'file:*/pkg/compiler/lib/src/kernel/env.dart': Failed assertion: line 322 pos 16: '!name.contains('#')': is not true.
overridden_no_such_method_test: RuntimeError
override_field_test/01: MissingCompileTimeError
override_field_test/02: MissingCompileTimeError
override_field_test/03: MissingCompileTimeError
@ -1613,6 +1610,7 @@ function_subtype_not1_test: RuntimeError
function_subtype_setter0_test: RuntimeError
function_type_alias2_test: RuntimeError
function_type_alias4_test: RuntimeError
generic_async_star_test: RuntimeError
generic_function_bounds_test: RuntimeError
generic_function_dcall_test: RuntimeError
generic_function_type_as_type_argument_test/01: MissingCompileTimeError