From ff008ca37ade57b28edee37183f4eaa5604e7c9c Mon Sep 17 00:00:00 2001 From: Vyacheslav Egorov Date: Mon, 15 Jan 2018 22:06:30 +0000 Subject: [PATCH] [vm/kernel/async] Use proper type argument when createing async* controller. Change-Id: I40e5d2d933b83a24c9d8177437fb6df1f21b5cc1 Reviewed-on: https://dart-review.googlesource.com/34741 Reviewed-by: Martin Kustermann --- .../lib/transformations/continuation.dart | 15 ++++++---- tests/language_2/language_2_kernel.status | 30 +------------------ 2 files changed, 10 insertions(+), 35 deletions(-) diff --git a/pkg/kernel/lib/transformations/continuation.dart b/pkg/kernel/lib/transformations/continuation.dart index d9ebd0e92c8..2b77554415e 100644 --- a/pkg/kernel/lib/transformations/continuation.dart +++ b/pkg/kernel/lib/transformations/continuation.dart @@ -760,17 +760,20 @@ class AsyncStarFunctionRewriter extends AsyncRewriterBase { FunctionNode rewrite() { var statements = []; - // _AsyncStarStreamController :controller; + final elementType = elementTypeFromReturnType(helper.streamClass); + + // _AsyncStarStreamController :controller; controllerVariable = new VariableDeclaration(":controller", - type: new InterfaceType(helper.asyncStarStreamControllerClass, - [elementTypeFromReturnType(helper.streamClass)])); + type: new InterfaceType( + helper.asyncStarStreamControllerClass, [elementType])); statements.add(controllerVariable); setupAsyncContinuations(statements); - // :controller = new _AsyncStarStreamController(:async_op); - var arguments = - new Arguments([new VariableGet(nestedClosureVariable)]); + // :controller = new _AsyncStarStreamController(:async_op); + var arguments = new Arguments( + [new VariableGet(nestedClosureVariable)], + types: [elementType]); var buildController = new ConstructorInvocation( helper.asyncStarStreamControllerConstructor, arguments) ..fileOffset = enclosingFunction.fileOffset; diff --git a/tests/language_2/language_2_kernel.status b/tests/language_2/language_2_kernel.status index a90ed486a76..97dab4a9704 100644 --- a/tests/language_2/language_2_kernel.status +++ b/tests/language_2/language_2_kernel.status @@ -85,11 +85,6 @@ async_return_types_test/nestedFuture: Fail async_return_types_test/none: RuntimeError async_star_regression_2238_test: RuntimeError async_star_take_reyield_test: RuntimeError -async_star_test/01: RuntimeError -async_star_test/03: RuntimeError -async_star_test/04: RuntimeError -async_star_test/05: RuntimeError -async_star_test/none: RuntimeError asyncstar_yield_test: RuntimeError asyncstar_yieldstar_test: RuntimeError bug31436_test: RuntimeError @@ -234,18 +229,7 @@ async_return_types_test/tooManyTypeParameters: MissingCompileTimeError async_return_types_test/wrongReturnType: MissingCompileTimeError async_star_cancel_while_paused_test: RuntimeError async_star_pause_test: Fail, OK -async_star_regression_2238_test: RuntimeError -async_star_regression_23116_test: RuntimeError -async_star_regression_fisk_test: RuntimeError -async_star_test/01: CompileTimeError # Issue 2238. -async_star_test/01: Pass -async_star_test/01: RuntimeError async_star_test/02: RuntimeError # Issue 31402 (Invocation arguments) -async_star_test/03: RuntimeError # Issue 31402 (Invocation arguments) -async_star_test/04: RuntimeError # Issue 31402 (Invocation arguments) -async_star_test/05: RuntimeError # Issue 31402 (Invocation arguments) -async_star_test/none: RuntimeError # Issue 31402 (Invocation arguments) -await_test: RuntimeError # Issue 31541 bad_named_parameters2_test/01: MissingCompileTimeError bad_named_parameters_test/01: MissingCompileTimeError bad_named_parameters_test/02: MissingCompileTimeError @@ -455,7 +439,6 @@ function_type_alias4_test: RuntimeError function_type_alias6_test/none: RuntimeError function_type_alias_test: RuntimeError generalized_void_syntax_test: CompileTimeError # Issue #30176. -generic_async_star_test: RuntimeError generic_closure_test: RuntimeError generic_function_bounds_test: RuntimeError generic_function_bounds_test: CompileTimeError @@ -987,10 +970,6 @@ type_variable_bounds4_test/01: RuntimeError [ $compiler == dartkp && $runtime == dart_precompiled && !$checked && $strong ] assertion_initializer_const_error_test/01: MissingCompileTimeError assertion_initializer_const_function_error_test/01: MissingCompileTimeError -async_star_test/01: RuntimeError -async_star_test/03: RuntimeError -async_star_test/05: RuntimeError -async_star_test/none: RuntimeError bool_check_test: RuntimeError bool_condition_check_test: RuntimeError callable_test/none: RuntimeError @@ -1055,13 +1034,7 @@ async_return_types_test/tooManyTypeParameters: MissingCompileTimeError async_return_types_test/wrongReturnType: MissingCompileTimeError async_star_cancel_while_paused_test: RuntimeError async_star_pause_test: Fail, OK -async_star_regression_2238_test: RuntimeError -async_star_regression_23116_test: RuntimeError -async_star_regression_fisk_test: RuntimeError -async_star_test/02: CompileTimeError # Issue 31402 (Invocation arguments) -async_star_test/02: RuntimeError -async_star_test/04: RuntimeError -await_test: RuntimeError # Issue 31541 +async_star_test/02: RuntimeError, CompileTimeError # Issue 31402 (Invocation arguments) bad_named_parameters2_test/01: MissingCompileTimeError bad_named_parameters_test/01: MissingCompileTimeError bad_named_parameters_test/02: MissingCompileTimeError @@ -1277,7 +1250,6 @@ function_type_alias4_test: RuntimeError function_type_alias6_test/none: RuntimeError function_type_alias_test: RuntimeError generalized_void_syntax_test: CompileTimeError # Issue #30176 -generic_async_star_test: RuntimeError generic_closure_test: RuntimeError generic_function_bounds_test: CompileTimeError generic_function_dcall_test: RuntimeError