diff --git a/CHANGELOG.md b/CHANGELOG.md index e867036a579..52323af9b24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,15 @@ ### Language +Dart 3.4 makes improvements to the type analysis of conditional expressions +(`e1 ? e2 : e3`), if-null expressions (`e1 ?? e2`), if-null assignments +(`e1 ??= e2`), and switch expressions (`switch (e) { p1 => e1, ... }`). To take +advantage of these improvements, set your package's +[SDK constraint][language version] lower bound to 3.4 or greater +(`sdk: '^3.4.0'`). + +[language version]: https://dart.dev/guides/language/evolution + - **Breaking Change** [#54640][]: The pattern context type schema for cast patterns has been changed from `Object?` to `_` (the unknown type), to align with the specification. This change is not expected diff --git a/pkg/_fe_analyzer_shared/lib/src/experiments/flags.dart b/pkg/_fe_analyzer_shared/lib/src/experiments/flags.dart index 5d0a15b5ec7..b8e4d2786e7 100644 --- a/pkg/_fe_analyzer_shared/lib/src/experiments/flags.dart +++ b/pkg/_fe_analyzer_shared/lib/src/experiments/flags.dart @@ -82,10 +82,10 @@ enum ExperimentalFlag { inferenceUpdate3( name: 'inference-update-3', - isEnabledByDefault: false, + isEnabledByDefault: true, isExpired: false, - experimentEnabledVersion: defaultLanguageVersion, - experimentReleasedVersion: defaultLanguageVersion), + experimentEnabledVersion: const Version(3, 4), + experimentReleasedVersion: const Version(3, 4)), inlineClass( name: 'inline-class', diff --git a/pkg/analyzer/lib/src/dart/analysis/experiments.g.dart b/pkg/analyzer/lib/src/dart/analysis/experiments.g.dart index e278e8438cb..223cf32d896 100644 --- a/pkg/analyzer/lib/src/dart/analysis/experiments.g.dart +++ b/pkg/analyzer/lib/src/dart/analysis/experiments.g.dart @@ -250,7 +250,7 @@ class ExperimentalFeatures { documentation: 'Better handling of conditional expressions, and switch expressions.', experimentalReleaseVersion: null, - releaseVersion: null, + releaseVersion: Version.parse('3.4.0'), ); static final inline_class = ExperimentalFeature( @@ -459,7 +459,7 @@ class IsEnabledByDefault { static const bool inference_update_2 = true; /// Default state of the experiment "inference-update-3" - static const bool inference_update_3 = false; + static const bool inference_update_3 = true; /// Default state of the experiment "inline-class" static const bool inline_class = true; diff --git a/pkg/analyzer/test/src/dart/analysis/analysis_context_collection_test.dart b/pkg/analyzer/test/src/dart/analysis/analysis_context_collection_test.dart index 9ab28dcaa14..520feec6675 100644 --- a/pkg/analyzer/test/src/dart/analysis/analysis_context_collection_test.dart +++ b/pkg/analyzer/test/src/dart/analysis/analysis_context_collection_test.dart @@ -342,6 +342,7 @@ analysisOptions generic-metadata inference-update-1 inference-update-2 + inference-update-3 inline-class named-arguments-anywhere non-nullable @@ -414,6 +415,7 @@ analysisOptions generic-metadata inference-update-1 inference-update-2 + inference-update-3 inline-class named-arguments-anywhere non-nullable diff --git a/pkg/analyzer/test/src/dart/resolution/assignment_test.dart b/pkg/analyzer/test/src/dart/resolution/assignment_test.dart index 94372645bd4..fd920db079c 100644 --- a/pkg/analyzer/test/src/dart/resolution/assignment_test.dart +++ b/pkg/analyzer/test/src/dart/resolution/assignment_test.dart @@ -319,6 +319,7 @@ AssignmentExpression test_ifNull_lubUsedEvenIfItDoesNotSatisfyContext() async { await assertNoErrorsInCode(''' +// @dart=3.3 f(Object? o1, Object? o2, List listNum) { if (o1 is Iterable? && o2 is Iterable) { o2 = (o1 ??= listNum); diff --git a/pkg/analyzer/test/src/dart/resolution/binary_expression_test.dart b/pkg/analyzer/test/src/dart/resolution/binary_expression_test.dart index 7c8434101b0..4bd9e66590a 100644 --- a/pkg/analyzer/test/src/dart/resolution/binary_expression_test.dart +++ b/pkg/analyzer/test/src/dart/resolution/binary_expression_test.dart @@ -266,6 +266,7 @@ BinaryExpression test_ifNull_lubUsedEvenIfItDoesNotSatisfyContext() async { await assertNoErrorsInCode(''' +// @dart=3.3 class A {} class B1 extends A {} class B2 extends A {} diff --git a/pkg/analyzer/test/src/dart/resolution/conditional_expression_test.dart b/pkg/analyzer/test/src/dart/resolution/conditional_expression_test.dart index 2162108397f..724b83d3493 100644 --- a/pkg/analyzer/test/src/dart/resolution/conditional_expression_test.dart +++ b/pkg/analyzer/test/src/dart/resolution/conditional_expression_test.dart @@ -107,6 +107,7 @@ ConditionalExpression test_ifNull_lubUsedEvenIfItDoesNotSatisfyContext() async { await assertNoErrorsInCode(''' +// @dart=3.3 class A {} class B1 extends A {} class B2 extends A {} diff --git a/pkg/analyzer/test/src/task/strong/inferred_type_test.dart b/pkg/analyzer/test/src/task/strong/inferred_type_test.dart index ca5cdbb2577..86fbcb1488f 100644 --- a/pkg/analyzer/test/src/task/strong/inferred_type_test.dart +++ b/pkg/analyzer/test/src/task/strong/inferred_type_test.dart @@ -1999,19 +1999,16 @@ void main() { .NOT_ASSIGNED_POTENTIALLY_NON_NULLABLE_LOCAL_VARIABLE, 387, 1), - error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_CLOSURE, 457, 38), error( CompileTimeErrorCode .NOT_ASSIGNED_POTENTIALLY_NON_NULLABLE_LOCAL_VARIABLE, 519, 1), - error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_CLOSURE, 540, 32), error( CompileTimeErrorCode .NOT_ASSIGNED_POTENTIALLY_NON_NULLABLE_LOCAL_VARIABLE, 594, 1), - error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_CLOSURE, 620, 32), ]); await disposeAnalysisContextCollection(); @@ -2031,19 +2028,16 @@ void main() { .NOT_ASSIGNED_POTENTIALLY_NON_NULLABLE_LOCAL_VARIABLE, 389, 1), - error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_CLOSURE, 459, 40), error( CompileTimeErrorCode .NOT_ASSIGNED_POTENTIALLY_NON_NULLABLE_LOCAL_VARIABLE, 523, 1), - error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_CLOSURE, 544, 34), error( CompileTimeErrorCode .NOT_ASSIGNED_POTENTIALLY_NON_NULLABLE_LOCAL_VARIABLE, 600, 1), - error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_CLOSURE, 626, 34), ]); await disposeAnalysisContextCollection(); @@ -2063,19 +2057,16 @@ void main() { .NOT_ASSIGNED_POTENTIALLY_NON_NULLABLE_LOCAL_VARIABLE, 391, 1), - error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_CLOSURE, 461, 38), error( CompileTimeErrorCode .NOT_ASSIGNED_POTENTIALLY_NON_NULLABLE_LOCAL_VARIABLE, 525, 1), - error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_CLOSURE, 546, 32), error( CompileTimeErrorCode .NOT_ASSIGNED_POTENTIALLY_NON_NULLABLE_LOCAL_VARIABLE, 602, 1), - error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_CLOSURE, 628, 32), ]); await disposeAnalysisContextCollection(); @@ -2098,22 +2089,16 @@ void main() { .NOT_ASSIGNED_POTENTIALLY_NON_NULLABLE_LOCAL_VARIABLE, 393, 1), - error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_CLOSURE, 463, - 40), error( CompileTimeErrorCode .NOT_ASSIGNED_POTENTIALLY_NON_NULLABLE_LOCAL_VARIABLE, 529, 1), - error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_CLOSURE, 550, - 34), error( CompileTimeErrorCode .NOT_ASSIGNED_POTENTIALLY_NON_NULLABLE_LOCAL_VARIABLE, 608, 1), - error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_CLOSURE, 634, - 34), ]); await disposeAnalysisContextCollection(); @@ -2133,19 +2118,16 @@ void main() { .NOT_ASSIGNED_POTENTIALLY_NON_NULLABLE_LOCAL_VARIABLE, 387, 1), - error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_CLOSURE, 457, 40), error( CompileTimeErrorCode .NOT_ASSIGNED_POTENTIALLY_NON_NULLABLE_LOCAL_VARIABLE, 521, 1), - error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_CLOSURE, 542, 34), error( CompileTimeErrorCode .NOT_ASSIGNED_POTENTIALLY_NON_NULLABLE_LOCAL_VARIABLE, 598, 1), - error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_CLOSURE, 624, 34), ]); await disposeAnalysisContextCollection(); @@ -2165,19 +2147,16 @@ void main() { .NOT_ASSIGNED_POTENTIALLY_NON_NULLABLE_LOCAL_VARIABLE, 385, 1), - error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_CLOSURE, 455, 38), error( CompileTimeErrorCode .NOT_ASSIGNED_POTENTIALLY_NON_NULLABLE_LOCAL_VARIABLE, 517, 1), - error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_CLOSURE, 538, 32), error( CompileTimeErrorCode .NOT_ASSIGNED_POTENTIALLY_NON_NULLABLE_LOCAL_VARIABLE, 592, 1), - error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_CLOSURE, 618, 32), ]); await disposeAnalysisContextCollection(); } @@ -2364,8 +2343,6 @@ $downwards g3(bool x) async { contextMessages: [message(dartAsyncFile, 506, 4)]), error(CompileTimeErrorCode.MISSING_DEFAULT_VALUE_FOR_PARAMETER, 223, 7), error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_METHOD, 236, 4), - error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 285, 29), - error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 352, 29), error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 464, 1), ]); await disposeAnalysisContextCollection(); @@ -2375,8 +2352,6 @@ $downwards g3(bool x) async { contextMessages: [message(dartAsyncFile, 506, 4)]), error(CompileTimeErrorCode.MISSING_DEFAULT_VALUE_FOR_PARAMETER, 223, 7), error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_METHOD, 236, 4), - error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 285, 31), - error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 354, 31), error(CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 470, 1), ]); await disposeAnalysisContextCollection(); diff --git a/pkg/front_end/lib/src/api_prototype/experimental_flags_generated.dart b/pkg/front_end/lib/src/api_prototype/experimental_flags_generated.dart index 615fcd33327..02db7c1b7cb 100644 --- a/pkg/front_end/lib/src/api_prototype/experimental_flags_generated.dart +++ b/pkg/front_end/lib/src/api_prototype/experimental_flags_generated.dart @@ -141,11 +141,11 @@ class ExperimentalFlag { static const ExperimentalFlag inferenceUpdate3 = const ExperimentalFlag( name: 'inference-update-3', - isEnabledByDefault: false, + isEnabledByDefault: true, isExpired: false, - enabledVersion: defaultLanguageVersion, - experimentEnabledVersion: defaultLanguageVersion, - experimentReleasedVersion: defaultLanguageVersion); + enabledVersion: const Version(3, 4), + experimentEnabledVersion: const Version(3, 4), + experimentReleasedVersion: const Version(3, 4)); static const ExperimentalFlag inlineClass = const ExperimentalFlag( name: 'inline-class', diff --git a/pkg/front_end/testcases/inference/future_then_conditional2.dart b/pkg/front_end/testcases/inference/future_then_conditional2.dart index 82987f2b132..d1ac21533cf 100644 --- a/pkg/front_end/testcases/inference/future_then_conditional2.dart +++ b/pkg/front_end/testcases/inference/future_then_conditional2.dart @@ -24,7 +24,6 @@ void test(MyFuture f) { }); Future t5 = f. /*@typeArgs=int*/ /*@target=MyFuture.then*/ then( /*@returnType=FutureOr*/ (/*@type=bool*/ x) => - // error:INVALID_CAST_FUNCTION_EXPR x ? 2 : new Future.value(3)); Future t6 = f. /*@typeArgs=int*/ /*@target=MyFuture.then*/ then( /*@returnType=FutureOr*/ (/*@type=bool*/ x) { diff --git a/pkg/front_end/testcases/inference/future_then_conditional2.dart.strong.expect b/pkg/front_end/testcases/inference/future_then_conditional2.dart.strong.expect index 466dd7023f1..568ce3faac1 100644 --- a/pkg/front_end/testcases/inference/future_then_conditional2.dart.strong.expect +++ b/pkg/front_end/testcases/inference/future_then_conditional2.dart.strong.expect @@ -1,23 +1,4 @@ library test; -// -// Problems in library: -// -// pkg/front_end/testcases/inference/future_then_conditional2.dart:23:49: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// return /*info:DOWN_CAST_COMPOSITE*/ await x ? 2 : new Future.value(3); -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2.dart:28:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// x ? 2 : new Future.value(3)); -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2.dart:31:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new Future.value(3); -// ^ -// import self as self; import "dart:core" as core; import "dart:async" as asy; @@ -45,21 +26,11 @@ class MyFuture extends core::Object implement static method test(self::MyFuture f) → void { asy::Future t1 = f.{self::MyFuture::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ => x ?{core::int} 2 : await asy::Future::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; asy::Future t2 = f.{self::MyFuture::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2.dart:23:49: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - return /*info:DOWN_CAST_COMPOSITE*/ await x ? 2 : new Future.value(3); - ^" in (await x /* runtimeCheckType= asy::Future */ ?{core::Object} 2 : asy::Future::value(3)) as{TypeError} core::int; + return await x /* runtimeCheckType= asy::Future */ ?{FutureOr} 2 : asy::Future::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; - asy::Future t5 = f.{self::MyFuture::then}((core::bool x) → FutureOr => invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2.dart:28:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - x ? 2 : new Future.value(3)); - ^" in (x ?{core::Object} 2 : asy::Future::value(3)) as{TypeError} FutureOr){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; + asy::Future t5 = f.{self::MyFuture::then}((core::bool x) → FutureOr => x ?{FutureOr} 2 : asy::Future::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; asy::Future t6 = f.{self::MyFuture::then}((core::bool x) → FutureOr { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2.dart:31:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new Future.value(3); - ^" in (x ?{core::Object} 2 : asy::Future::value(3)) as{TypeError} FutureOr; + return x ?{FutureOr} 2 : asy::Future::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; } static method main() → dynamic {} diff --git a/pkg/front_end/testcases/inference/future_then_conditional2.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/future_then_conditional2.dart.strong.transformed.expect index bffe4c4de73..532f57dbc8b 100644 --- a/pkg/front_end/testcases/inference/future_then_conditional2.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/inference/future_then_conditional2.dart.strong.transformed.expect @@ -1,23 +1,4 @@ library test; -// -// Problems in library: -// -// pkg/front_end/testcases/inference/future_then_conditional2.dart:23:49: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// return /*info:DOWN_CAST_COMPOSITE*/ await x ? 2 : new Future.value(3); -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2.dart:28:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// x ? 2 : new Future.value(3)); -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2.dart:31:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new Future.value(3); -// ^ -// import self as self; import "dart:core" as core; import "dart:async" as asy; @@ -45,21 +26,11 @@ class MyFuture extends core::Object implement static method test(self::MyFuture f) → void { asy::Future t1 = f.{self::MyFuture::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ => x ?{core::int} 2 : await asy::Future::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; asy::Future t2 = f.{self::MyFuture::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2.dart:23:49: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - return /*info:DOWN_CAST_COMPOSITE*/ await x ? 2 : new Future.value(3); - ^" in (await x /* runtimeCheckType= asy::Future */ ?{core::Object} 2 : asy::Future::value(3)) as{TypeError} core::int; + return await x /* runtimeCheckType= asy::Future */ ?{FutureOr} 2 : asy::Future::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; - asy::Future t5 = f.{self::MyFuture::then}((core::bool x) → FutureOr => invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2.dart:28:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - x ? 2 : new Future.value(3)); - ^" in (x ?{core::Object} 2 : asy::Future::value(3)) as{TypeError} FutureOr){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; + asy::Future t5 = f.{self::MyFuture::then}((core::bool x) → FutureOr => x ?{FutureOr} 2 : asy::Future::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; asy::Future t6 = f.{self::MyFuture::then}((core::bool x) → FutureOr { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2.dart:31:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new Future.value(3); - ^" in (x ?{core::Object} 2 : asy::Future::value(3)) as{TypeError} FutureOr; + return x ?{FutureOr} 2 : asy::Future::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; } static method main() → dynamic {} diff --git a/pkg/front_end/testcases/inference/future_then_conditional2.dart.weak.expect b/pkg/front_end/testcases/inference/future_then_conditional2.dart.weak.expect index 466dd7023f1..568ce3faac1 100644 --- a/pkg/front_end/testcases/inference/future_then_conditional2.dart.weak.expect +++ b/pkg/front_end/testcases/inference/future_then_conditional2.dart.weak.expect @@ -1,23 +1,4 @@ library test; -// -// Problems in library: -// -// pkg/front_end/testcases/inference/future_then_conditional2.dart:23:49: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// return /*info:DOWN_CAST_COMPOSITE*/ await x ? 2 : new Future.value(3); -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2.dart:28:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// x ? 2 : new Future.value(3)); -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2.dart:31:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new Future.value(3); -// ^ -// import self as self; import "dart:core" as core; import "dart:async" as asy; @@ -45,21 +26,11 @@ class MyFuture extends core::Object implement static method test(self::MyFuture f) → void { asy::Future t1 = f.{self::MyFuture::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ => x ?{core::int} 2 : await asy::Future::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; asy::Future t2 = f.{self::MyFuture::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2.dart:23:49: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - return /*info:DOWN_CAST_COMPOSITE*/ await x ? 2 : new Future.value(3); - ^" in (await x /* runtimeCheckType= asy::Future */ ?{core::Object} 2 : asy::Future::value(3)) as{TypeError} core::int; + return await x /* runtimeCheckType= asy::Future */ ?{FutureOr} 2 : asy::Future::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; - asy::Future t5 = f.{self::MyFuture::then}((core::bool x) → FutureOr => invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2.dart:28:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - x ? 2 : new Future.value(3)); - ^" in (x ?{core::Object} 2 : asy::Future::value(3)) as{TypeError} FutureOr){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; + asy::Future t5 = f.{self::MyFuture::then}((core::bool x) → FutureOr => x ?{FutureOr} 2 : asy::Future::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; asy::Future t6 = f.{self::MyFuture::then}((core::bool x) → FutureOr { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2.dart:31:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new Future.value(3); - ^" in (x ?{core::Object} 2 : asy::Future::value(3)) as{TypeError} FutureOr; + return x ?{FutureOr} 2 : asy::Future::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; } static method main() → dynamic {} diff --git a/pkg/front_end/testcases/inference/future_then_conditional2.dart.weak.modular.expect b/pkg/front_end/testcases/inference/future_then_conditional2.dart.weak.modular.expect index 466dd7023f1..568ce3faac1 100644 --- a/pkg/front_end/testcases/inference/future_then_conditional2.dart.weak.modular.expect +++ b/pkg/front_end/testcases/inference/future_then_conditional2.dart.weak.modular.expect @@ -1,23 +1,4 @@ library test; -// -// Problems in library: -// -// pkg/front_end/testcases/inference/future_then_conditional2.dart:23:49: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// return /*info:DOWN_CAST_COMPOSITE*/ await x ? 2 : new Future.value(3); -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2.dart:28:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// x ? 2 : new Future.value(3)); -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2.dart:31:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new Future.value(3); -// ^ -// import self as self; import "dart:core" as core; import "dart:async" as asy; @@ -45,21 +26,11 @@ class MyFuture extends core::Object implement static method test(self::MyFuture f) → void { asy::Future t1 = f.{self::MyFuture::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ => x ?{core::int} 2 : await asy::Future::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; asy::Future t2 = f.{self::MyFuture::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2.dart:23:49: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - return /*info:DOWN_CAST_COMPOSITE*/ await x ? 2 : new Future.value(3); - ^" in (await x /* runtimeCheckType= asy::Future */ ?{core::Object} 2 : asy::Future::value(3)) as{TypeError} core::int; + return await x /* runtimeCheckType= asy::Future */ ?{FutureOr} 2 : asy::Future::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; - asy::Future t5 = f.{self::MyFuture::then}((core::bool x) → FutureOr => invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2.dart:28:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - x ? 2 : new Future.value(3)); - ^" in (x ?{core::Object} 2 : asy::Future::value(3)) as{TypeError} FutureOr){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; + asy::Future t5 = f.{self::MyFuture::then}((core::bool x) → FutureOr => x ?{FutureOr} 2 : asy::Future::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; asy::Future t6 = f.{self::MyFuture::then}((core::bool x) → FutureOr { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2.dart:31:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new Future.value(3); - ^" in (x ?{core::Object} 2 : asy::Future::value(3)) as{TypeError} FutureOr; + return x ?{FutureOr} 2 : asy::Future::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; } static method main() → dynamic {} diff --git a/pkg/front_end/testcases/inference/future_then_conditional2.dart.weak.transformed.expect b/pkg/front_end/testcases/inference/future_then_conditional2.dart.weak.transformed.expect index bffe4c4de73..532f57dbc8b 100644 --- a/pkg/front_end/testcases/inference/future_then_conditional2.dart.weak.transformed.expect +++ b/pkg/front_end/testcases/inference/future_then_conditional2.dart.weak.transformed.expect @@ -1,23 +1,4 @@ library test; -// -// Problems in library: -// -// pkg/front_end/testcases/inference/future_then_conditional2.dart:23:49: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// return /*info:DOWN_CAST_COMPOSITE*/ await x ? 2 : new Future.value(3); -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2.dart:28:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// x ? 2 : new Future.value(3)); -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2.dart:31:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new Future.value(3); -// ^ -// import self as self; import "dart:core" as core; import "dart:async" as asy; @@ -45,21 +26,11 @@ class MyFuture extends core::Object implement static method test(self::MyFuture f) → void { asy::Future t1 = f.{self::MyFuture::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ => x ?{core::int} 2 : await asy::Future::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; asy::Future t2 = f.{self::MyFuture::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2.dart:23:49: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - return /*info:DOWN_CAST_COMPOSITE*/ await x ? 2 : new Future.value(3); - ^" in (await x /* runtimeCheckType= asy::Future */ ?{core::Object} 2 : asy::Future::value(3)) as{TypeError} core::int; + return await x /* runtimeCheckType= asy::Future */ ?{FutureOr} 2 : asy::Future::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; - asy::Future t5 = f.{self::MyFuture::then}((core::bool x) → FutureOr => invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2.dart:28:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - x ? 2 : new Future.value(3)); - ^" in (x ?{core::Object} 2 : asy::Future::value(3)) as{TypeError} FutureOr){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; + asy::Future t5 = f.{self::MyFuture::then}((core::bool x) → FutureOr => x ?{FutureOr} 2 : asy::Future::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; asy::Future t6 = f.{self::MyFuture::then}((core::bool x) → FutureOr { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2.dart:31:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new Future.value(3); - ^" in (x ?{core::Object} 2 : asy::Future::value(3)) as{TypeError} FutureOr; + return x ?{FutureOr} 2 : asy::Future::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; } static method main() → dynamic {} diff --git a/pkg/front_end/testcases/inference/future_then_conditional2_2.dart.strong.expect b/pkg/front_end/testcases/inference/future_then_conditional2_2.dart.strong.expect index d5f6018fc50..ead1e744c11 100644 --- a/pkg/front_end/testcases/inference/future_then_conditional2_2.dart.strong.expect +++ b/pkg/front_end/testcases/inference/future_then_conditional2_2.dart.strong.expect @@ -1,23 +1,4 @@ library test; -// -// Problems in library: -// -// pkg/front_end/testcases/inference/future_then_conditional2_2.dart:24:9: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// ? 2 -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2_2.dart:30:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// x ? 2 : new MyFuture.value(3)); -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2_2.dart:33:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new MyFuture.value(3); -// ^ -// import self as self; import "dart:core" as core; import "dart:async" as asy; @@ -45,21 +26,11 @@ class MyFuture extends core::Object implement static method test(self::MyFuture f) → void { asy::Future t1 = f.{self::MyFuture::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ => x ?{core::int} 2 : await new self::MyFuture::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; asy::Future t2 = f.{self::MyFuture::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_2.dart:24:9: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - ? 2 - ^" in (await x /* runtimeCheckType= asy::Future */ ?{core::Object} 2 : new self::MyFuture::value(3)) as{TypeError} core::int; + return await x /* runtimeCheckType= asy::Future */ ?{FutureOr} 2 : new self::MyFuture::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; - asy::Future t5 = f.{self::MyFuture::then}((core::bool x) → FutureOr => invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_2.dart:30:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - x ? 2 : new MyFuture.value(3)); - ^" in (x ?{core::Object} 2 : new self::MyFuture::value(3)) as{TypeError} FutureOr){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; + asy::Future t5 = f.{self::MyFuture::then}((core::bool x) → FutureOr => x ?{FutureOr} 2 : new self::MyFuture::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; asy::Future t6 = f.{self::MyFuture::then}((core::bool x) → FutureOr { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_2.dart:33:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new MyFuture.value(3); - ^" in (x ?{core::Object} 2 : new self::MyFuture::value(3)) as{TypeError} FutureOr; + return x ?{FutureOr} 2 : new self::MyFuture::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; } static method main() → dynamic {} diff --git a/pkg/front_end/testcases/inference/future_then_conditional2_2.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/future_then_conditional2_2.dart.strong.transformed.expect index 0195ceb6779..05adeef3a72 100644 --- a/pkg/front_end/testcases/inference/future_then_conditional2_2.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/inference/future_then_conditional2_2.dart.strong.transformed.expect @@ -1,23 +1,4 @@ library test; -// -// Problems in library: -// -// pkg/front_end/testcases/inference/future_then_conditional2_2.dart:24:9: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// ? 2 -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2_2.dart:30:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// x ? 2 : new MyFuture.value(3)); -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2_2.dart:33:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new MyFuture.value(3); -// ^ -// import self as self; import "dart:core" as core; import "dart:async" as asy; @@ -45,21 +26,11 @@ class MyFuture extends core::Object implement static method test(self::MyFuture f) → void { asy::Future t1 = f.{self::MyFuture::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ => x ?{core::int} 2 : await new self::MyFuture::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; asy::Future t2 = f.{self::MyFuture::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_2.dart:24:9: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - ? 2 - ^" in (await x /* runtimeCheckType= asy::Future */ ?{core::Object} 2 : new self::MyFuture::value(3)) as{TypeError} core::int; + return await x /* runtimeCheckType= asy::Future */ ?{FutureOr} 2 : new self::MyFuture::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; - asy::Future t5 = f.{self::MyFuture::then}((core::bool x) → FutureOr => invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_2.dart:30:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - x ? 2 : new MyFuture.value(3)); - ^" in (x ?{core::Object} 2 : new self::MyFuture::value(3)) as{TypeError} FutureOr){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; + asy::Future t5 = f.{self::MyFuture::then}((core::bool x) → FutureOr => x ?{FutureOr} 2 : new self::MyFuture::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; asy::Future t6 = f.{self::MyFuture::then}((core::bool x) → FutureOr { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_2.dart:33:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new MyFuture.value(3); - ^" in (x ?{core::Object} 2 : new self::MyFuture::value(3)) as{TypeError} FutureOr; + return x ?{FutureOr} 2 : new self::MyFuture::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; } static method main() → dynamic {} diff --git a/pkg/front_end/testcases/inference/future_then_conditional2_2.dart.weak.expect b/pkg/front_end/testcases/inference/future_then_conditional2_2.dart.weak.expect index d5f6018fc50..ead1e744c11 100644 --- a/pkg/front_end/testcases/inference/future_then_conditional2_2.dart.weak.expect +++ b/pkg/front_end/testcases/inference/future_then_conditional2_2.dart.weak.expect @@ -1,23 +1,4 @@ library test; -// -// Problems in library: -// -// pkg/front_end/testcases/inference/future_then_conditional2_2.dart:24:9: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// ? 2 -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2_2.dart:30:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// x ? 2 : new MyFuture.value(3)); -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2_2.dart:33:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new MyFuture.value(3); -// ^ -// import self as self; import "dart:core" as core; import "dart:async" as asy; @@ -45,21 +26,11 @@ class MyFuture extends core::Object implement static method test(self::MyFuture f) → void { asy::Future t1 = f.{self::MyFuture::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ => x ?{core::int} 2 : await new self::MyFuture::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; asy::Future t2 = f.{self::MyFuture::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_2.dart:24:9: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - ? 2 - ^" in (await x /* runtimeCheckType= asy::Future */ ?{core::Object} 2 : new self::MyFuture::value(3)) as{TypeError} core::int; + return await x /* runtimeCheckType= asy::Future */ ?{FutureOr} 2 : new self::MyFuture::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; - asy::Future t5 = f.{self::MyFuture::then}((core::bool x) → FutureOr => invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_2.dart:30:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - x ? 2 : new MyFuture.value(3)); - ^" in (x ?{core::Object} 2 : new self::MyFuture::value(3)) as{TypeError} FutureOr){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; + asy::Future t5 = f.{self::MyFuture::then}((core::bool x) → FutureOr => x ?{FutureOr} 2 : new self::MyFuture::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; asy::Future t6 = f.{self::MyFuture::then}((core::bool x) → FutureOr { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_2.dart:33:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new MyFuture.value(3); - ^" in (x ?{core::Object} 2 : new self::MyFuture::value(3)) as{TypeError} FutureOr; + return x ?{FutureOr} 2 : new self::MyFuture::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; } static method main() → dynamic {} diff --git a/pkg/front_end/testcases/inference/future_then_conditional2_2.dart.weak.modular.expect b/pkg/front_end/testcases/inference/future_then_conditional2_2.dart.weak.modular.expect index d5f6018fc50..ead1e744c11 100644 --- a/pkg/front_end/testcases/inference/future_then_conditional2_2.dart.weak.modular.expect +++ b/pkg/front_end/testcases/inference/future_then_conditional2_2.dart.weak.modular.expect @@ -1,23 +1,4 @@ library test; -// -// Problems in library: -// -// pkg/front_end/testcases/inference/future_then_conditional2_2.dart:24:9: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// ? 2 -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2_2.dart:30:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// x ? 2 : new MyFuture.value(3)); -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2_2.dart:33:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new MyFuture.value(3); -// ^ -// import self as self; import "dart:core" as core; import "dart:async" as asy; @@ -45,21 +26,11 @@ class MyFuture extends core::Object implement static method test(self::MyFuture f) → void { asy::Future t1 = f.{self::MyFuture::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ => x ?{core::int} 2 : await new self::MyFuture::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; asy::Future t2 = f.{self::MyFuture::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_2.dart:24:9: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - ? 2 - ^" in (await x /* runtimeCheckType= asy::Future */ ?{core::Object} 2 : new self::MyFuture::value(3)) as{TypeError} core::int; + return await x /* runtimeCheckType= asy::Future */ ?{FutureOr} 2 : new self::MyFuture::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; - asy::Future t5 = f.{self::MyFuture::then}((core::bool x) → FutureOr => invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_2.dart:30:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - x ? 2 : new MyFuture.value(3)); - ^" in (x ?{core::Object} 2 : new self::MyFuture::value(3)) as{TypeError} FutureOr){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; + asy::Future t5 = f.{self::MyFuture::then}((core::bool x) → FutureOr => x ?{FutureOr} 2 : new self::MyFuture::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; asy::Future t6 = f.{self::MyFuture::then}((core::bool x) → FutureOr { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_2.dart:33:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new MyFuture.value(3); - ^" in (x ?{core::Object} 2 : new self::MyFuture::value(3)) as{TypeError} FutureOr; + return x ?{FutureOr} 2 : new self::MyFuture::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; } static method main() → dynamic {} diff --git a/pkg/front_end/testcases/inference/future_then_conditional2_2.dart.weak.transformed.expect b/pkg/front_end/testcases/inference/future_then_conditional2_2.dart.weak.transformed.expect index 0195ceb6779..05adeef3a72 100644 --- a/pkg/front_end/testcases/inference/future_then_conditional2_2.dart.weak.transformed.expect +++ b/pkg/front_end/testcases/inference/future_then_conditional2_2.dart.weak.transformed.expect @@ -1,23 +1,4 @@ library test; -// -// Problems in library: -// -// pkg/front_end/testcases/inference/future_then_conditional2_2.dart:24:9: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// ? 2 -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2_2.dart:30:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// x ? 2 : new MyFuture.value(3)); -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2_2.dart:33:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new MyFuture.value(3); -// ^ -// import self as self; import "dart:core" as core; import "dart:async" as asy; @@ -45,21 +26,11 @@ class MyFuture extends core::Object implement static method test(self::MyFuture f) → void { asy::Future t1 = f.{self::MyFuture::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ => x ?{core::int} 2 : await new self::MyFuture::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; asy::Future t2 = f.{self::MyFuture::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_2.dart:24:9: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - ? 2 - ^" in (await x /* runtimeCheckType= asy::Future */ ?{core::Object} 2 : new self::MyFuture::value(3)) as{TypeError} core::int; + return await x /* runtimeCheckType= asy::Future */ ?{FutureOr} 2 : new self::MyFuture::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; - asy::Future t5 = f.{self::MyFuture::then}((core::bool x) → FutureOr => invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_2.dart:30:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - x ? 2 : new MyFuture.value(3)); - ^" in (x ?{core::Object} 2 : new self::MyFuture::value(3)) as{TypeError} FutureOr){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; + asy::Future t5 = f.{self::MyFuture::then}((core::bool x) → FutureOr => x ?{FutureOr} 2 : new self::MyFuture::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; asy::Future t6 = f.{self::MyFuture::then}((core::bool x) → FutureOr { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_2.dart:33:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new MyFuture.value(3); - ^" in (x ?{core::Object} 2 : new self::MyFuture::value(3)) as{TypeError} FutureOr; + return x ?{FutureOr} 2 : new self::MyFuture::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; } static method main() → dynamic {} diff --git a/pkg/front_end/testcases/inference/future_then_conditional2_3.dart.strong.expect b/pkg/front_end/testcases/inference/future_then_conditional2_3.dart.strong.expect index 45752c363d0..9faa298b9c4 100644 --- a/pkg/front_end/testcases/inference/future_then_conditional2_3.dart.strong.expect +++ b/pkg/front_end/testcases/inference/future_then_conditional2_3.dart.strong.expect @@ -1,23 +1,4 @@ library test; -// -// Problems in library: -// -// pkg/front_end/testcases/inference/future_then_conditional2_3.dart:23:49: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// return /*info:DOWN_CAST_COMPOSITE*/ await x ? 2 : new Future.value(3); -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2_3.dart:28:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// x ? 2 : new Future.value(3)); -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2_3.dart:31:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new Future.value(3); -// ^ -// import self as self; import "dart:core" as core; import "dart:async" as asy; @@ -45,21 +26,11 @@ class MyFuture extends core::Object implement static method test(self::MyFuture f) → void { self::MyFuture t1 = f.{self::MyFuture::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ => x ?{core::int} 2 : await asy::Future::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; self::MyFuture t2 = f.{self::MyFuture::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_3.dart:23:49: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - return /*info:DOWN_CAST_COMPOSITE*/ await x ? 2 : new Future.value(3); - ^" in (await x /* runtimeCheckType= asy::Future */ ?{core::Object} 2 : asy::Future::value(3)) as{TypeError} core::int; + return await x /* runtimeCheckType= asy::Future */ ?{FutureOr} 2 : asy::Future::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; - self::MyFuture t5 = f.{self::MyFuture::then}((core::bool x) → FutureOr => invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_3.dart:28:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - x ? 2 : new Future.value(3)); - ^" in (x ?{core::Object} 2 : asy::Future::value(3)) as{TypeError} FutureOr){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; + self::MyFuture t5 = f.{self::MyFuture::then}((core::bool x) → FutureOr => x ?{FutureOr} 2 : asy::Future::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; self::MyFuture t6 = f.{self::MyFuture::then}((core::bool x) → FutureOr { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_3.dart:31:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new Future.value(3); - ^" in (x ?{core::Object} 2 : asy::Future::value(3)) as{TypeError} FutureOr; + return x ?{FutureOr} 2 : asy::Future::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; } static method main() → dynamic {} diff --git a/pkg/front_end/testcases/inference/future_then_conditional2_3.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/future_then_conditional2_3.dart.strong.transformed.expect index 136e80af684..0f81d0b2091 100644 --- a/pkg/front_end/testcases/inference/future_then_conditional2_3.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/inference/future_then_conditional2_3.dart.strong.transformed.expect @@ -1,23 +1,4 @@ library test; -// -// Problems in library: -// -// pkg/front_end/testcases/inference/future_then_conditional2_3.dart:23:49: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// return /*info:DOWN_CAST_COMPOSITE*/ await x ? 2 : new Future.value(3); -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2_3.dart:28:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// x ? 2 : new Future.value(3)); -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2_3.dart:31:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new Future.value(3); -// ^ -// import self as self; import "dart:core" as core; import "dart:async" as asy; @@ -45,21 +26,11 @@ class MyFuture extends core::Object implement static method test(self::MyFuture f) → void { self::MyFuture t1 = f.{self::MyFuture::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ => x ?{core::int} 2 : await asy::Future::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; self::MyFuture t2 = f.{self::MyFuture::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_3.dart:23:49: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - return /*info:DOWN_CAST_COMPOSITE*/ await x ? 2 : new Future.value(3); - ^" in (await x /* runtimeCheckType= asy::Future */ ?{core::Object} 2 : asy::Future::value(3)) as{TypeError} core::int; + return await x /* runtimeCheckType= asy::Future */ ?{FutureOr} 2 : asy::Future::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; - self::MyFuture t5 = f.{self::MyFuture::then}((core::bool x) → FutureOr => invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_3.dart:28:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - x ? 2 : new Future.value(3)); - ^" in (x ?{core::Object} 2 : asy::Future::value(3)) as{TypeError} FutureOr){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; + self::MyFuture t5 = f.{self::MyFuture::then}((core::bool x) → FutureOr => x ?{FutureOr} 2 : asy::Future::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; self::MyFuture t6 = f.{self::MyFuture::then}((core::bool x) → FutureOr { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_3.dart:31:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new Future.value(3); - ^" in (x ?{core::Object} 2 : asy::Future::value(3)) as{TypeError} FutureOr; + return x ?{FutureOr} 2 : asy::Future::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; } static method main() → dynamic {} diff --git a/pkg/front_end/testcases/inference/future_then_conditional2_3.dart.weak.expect b/pkg/front_end/testcases/inference/future_then_conditional2_3.dart.weak.expect index 45752c363d0..9faa298b9c4 100644 --- a/pkg/front_end/testcases/inference/future_then_conditional2_3.dart.weak.expect +++ b/pkg/front_end/testcases/inference/future_then_conditional2_3.dart.weak.expect @@ -1,23 +1,4 @@ library test; -// -// Problems in library: -// -// pkg/front_end/testcases/inference/future_then_conditional2_3.dart:23:49: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// return /*info:DOWN_CAST_COMPOSITE*/ await x ? 2 : new Future.value(3); -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2_3.dart:28:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// x ? 2 : new Future.value(3)); -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2_3.dart:31:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new Future.value(3); -// ^ -// import self as self; import "dart:core" as core; import "dart:async" as asy; @@ -45,21 +26,11 @@ class MyFuture extends core::Object implement static method test(self::MyFuture f) → void { self::MyFuture t1 = f.{self::MyFuture::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ => x ?{core::int} 2 : await asy::Future::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; self::MyFuture t2 = f.{self::MyFuture::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_3.dart:23:49: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - return /*info:DOWN_CAST_COMPOSITE*/ await x ? 2 : new Future.value(3); - ^" in (await x /* runtimeCheckType= asy::Future */ ?{core::Object} 2 : asy::Future::value(3)) as{TypeError} core::int; + return await x /* runtimeCheckType= asy::Future */ ?{FutureOr} 2 : asy::Future::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; - self::MyFuture t5 = f.{self::MyFuture::then}((core::bool x) → FutureOr => invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_3.dart:28:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - x ? 2 : new Future.value(3)); - ^" in (x ?{core::Object} 2 : asy::Future::value(3)) as{TypeError} FutureOr){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; + self::MyFuture t5 = f.{self::MyFuture::then}((core::bool x) → FutureOr => x ?{FutureOr} 2 : asy::Future::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; self::MyFuture t6 = f.{self::MyFuture::then}((core::bool x) → FutureOr { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_3.dart:31:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new Future.value(3); - ^" in (x ?{core::Object} 2 : asy::Future::value(3)) as{TypeError} FutureOr; + return x ?{FutureOr} 2 : asy::Future::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; } static method main() → dynamic {} diff --git a/pkg/front_end/testcases/inference/future_then_conditional2_3.dart.weak.modular.expect b/pkg/front_end/testcases/inference/future_then_conditional2_3.dart.weak.modular.expect index 45752c363d0..9faa298b9c4 100644 --- a/pkg/front_end/testcases/inference/future_then_conditional2_3.dart.weak.modular.expect +++ b/pkg/front_end/testcases/inference/future_then_conditional2_3.dart.weak.modular.expect @@ -1,23 +1,4 @@ library test; -// -// Problems in library: -// -// pkg/front_end/testcases/inference/future_then_conditional2_3.dart:23:49: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// return /*info:DOWN_CAST_COMPOSITE*/ await x ? 2 : new Future.value(3); -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2_3.dart:28:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// x ? 2 : new Future.value(3)); -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2_3.dart:31:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new Future.value(3); -// ^ -// import self as self; import "dart:core" as core; import "dart:async" as asy; @@ -45,21 +26,11 @@ class MyFuture extends core::Object implement static method test(self::MyFuture f) → void { self::MyFuture t1 = f.{self::MyFuture::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ => x ?{core::int} 2 : await asy::Future::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; self::MyFuture t2 = f.{self::MyFuture::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_3.dart:23:49: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - return /*info:DOWN_CAST_COMPOSITE*/ await x ? 2 : new Future.value(3); - ^" in (await x /* runtimeCheckType= asy::Future */ ?{core::Object} 2 : asy::Future::value(3)) as{TypeError} core::int; + return await x /* runtimeCheckType= asy::Future */ ?{FutureOr} 2 : asy::Future::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; - self::MyFuture t5 = f.{self::MyFuture::then}((core::bool x) → FutureOr => invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_3.dart:28:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - x ? 2 : new Future.value(3)); - ^" in (x ?{core::Object} 2 : asy::Future::value(3)) as{TypeError} FutureOr){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; + self::MyFuture t5 = f.{self::MyFuture::then}((core::bool x) → FutureOr => x ?{FutureOr} 2 : asy::Future::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; self::MyFuture t6 = f.{self::MyFuture::then}((core::bool x) → FutureOr { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_3.dart:31:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new Future.value(3); - ^" in (x ?{core::Object} 2 : asy::Future::value(3)) as{TypeError} FutureOr; + return x ?{FutureOr} 2 : asy::Future::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; } static method main() → dynamic {} diff --git a/pkg/front_end/testcases/inference/future_then_conditional2_3.dart.weak.transformed.expect b/pkg/front_end/testcases/inference/future_then_conditional2_3.dart.weak.transformed.expect index 136e80af684..0f81d0b2091 100644 --- a/pkg/front_end/testcases/inference/future_then_conditional2_3.dart.weak.transformed.expect +++ b/pkg/front_end/testcases/inference/future_then_conditional2_3.dart.weak.transformed.expect @@ -1,23 +1,4 @@ library test; -// -// Problems in library: -// -// pkg/front_end/testcases/inference/future_then_conditional2_3.dart:23:49: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// return /*info:DOWN_CAST_COMPOSITE*/ await x ? 2 : new Future.value(3); -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2_3.dart:28:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// x ? 2 : new Future.value(3)); -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2_3.dart:31:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new Future.value(3); -// ^ -// import self as self; import "dart:core" as core; import "dart:async" as asy; @@ -45,21 +26,11 @@ class MyFuture extends core::Object implement static method test(self::MyFuture f) → void { self::MyFuture t1 = f.{self::MyFuture::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ => x ?{core::int} 2 : await asy::Future::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; self::MyFuture t2 = f.{self::MyFuture::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_3.dart:23:49: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - return /*info:DOWN_CAST_COMPOSITE*/ await x ? 2 : new Future.value(3); - ^" in (await x /* runtimeCheckType= asy::Future */ ?{core::Object} 2 : asy::Future::value(3)) as{TypeError} core::int; + return await x /* runtimeCheckType= asy::Future */ ?{FutureOr} 2 : asy::Future::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; - self::MyFuture t5 = f.{self::MyFuture::then}((core::bool x) → FutureOr => invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_3.dart:28:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - x ? 2 : new Future.value(3)); - ^" in (x ?{core::Object} 2 : asy::Future::value(3)) as{TypeError} FutureOr){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; + self::MyFuture t5 = f.{self::MyFuture::then}((core::bool x) → FutureOr => x ?{FutureOr} 2 : asy::Future::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; self::MyFuture t6 = f.{self::MyFuture::then}((core::bool x) → FutureOr { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_3.dart:31:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new Future.value(3); - ^" in (x ?{core::Object} 2 : asy::Future::value(3)) as{TypeError} FutureOr; + return x ?{FutureOr} 2 : asy::Future::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; } static method main() → dynamic {} diff --git a/pkg/front_end/testcases/inference/future_then_conditional2_4.dart.strong.expect b/pkg/front_end/testcases/inference/future_then_conditional2_4.dart.strong.expect index 30ea48f7af3..f891d54914b 100644 --- a/pkg/front_end/testcases/inference/future_then_conditional2_4.dart.strong.expect +++ b/pkg/front_end/testcases/inference/future_then_conditional2_4.dart.strong.expect @@ -1,23 +1,4 @@ library test; -// -// Problems in library: -// -// pkg/front_end/testcases/inference/future_then_conditional2_4.dart:24:9: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// ? 2 -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2_4.dart:30:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// x ? 2 : new MyFuture.value(3)); -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2_4.dart:33:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new MyFuture.value(3); -// ^ -// import self as self; import "dart:core" as core; import "dart:async" as asy; @@ -45,21 +26,11 @@ class MyFuture extends core::Object implement static method test(self::MyFuture f) → void { self::MyFuture t1 = f.{self::MyFuture::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ => x ?{core::int} 2 : await new self::MyFuture::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; self::MyFuture t2 = f.{self::MyFuture::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_4.dart:24:9: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - ? 2 - ^" in (await x /* runtimeCheckType= asy::Future */ ?{core::Object} 2 : new self::MyFuture::value(3)) as{TypeError} core::int; + return await x /* runtimeCheckType= asy::Future */ ?{FutureOr} 2 : new self::MyFuture::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; - self::MyFuture t5 = f.{self::MyFuture::then}((core::bool x) → FutureOr => invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_4.dart:30:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - x ? 2 : new MyFuture.value(3)); - ^" in (x ?{core::Object} 2 : new self::MyFuture::value(3)) as{TypeError} FutureOr){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; + self::MyFuture t5 = f.{self::MyFuture::then}((core::bool x) → FutureOr => x ?{FutureOr} 2 : new self::MyFuture::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; self::MyFuture t6 = f.{self::MyFuture::then}((core::bool x) → FutureOr { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_4.dart:33:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new MyFuture.value(3); - ^" in (x ?{core::Object} 2 : new self::MyFuture::value(3)) as{TypeError} FutureOr; + return x ?{FutureOr} 2 : new self::MyFuture::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; } static method main() → dynamic {} diff --git a/pkg/front_end/testcases/inference/future_then_conditional2_4.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/future_then_conditional2_4.dart.strong.transformed.expect index e10a8544031..499b6538736 100644 --- a/pkg/front_end/testcases/inference/future_then_conditional2_4.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/inference/future_then_conditional2_4.dart.strong.transformed.expect @@ -1,23 +1,4 @@ library test; -// -// Problems in library: -// -// pkg/front_end/testcases/inference/future_then_conditional2_4.dart:24:9: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// ? 2 -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2_4.dart:30:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// x ? 2 : new MyFuture.value(3)); -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2_4.dart:33:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new MyFuture.value(3); -// ^ -// import self as self; import "dart:core" as core; import "dart:async" as asy; @@ -45,21 +26,11 @@ class MyFuture extends core::Object implement static method test(self::MyFuture f) → void { self::MyFuture t1 = f.{self::MyFuture::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ => x ?{core::int} 2 : await new self::MyFuture::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; self::MyFuture t2 = f.{self::MyFuture::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_4.dart:24:9: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - ? 2 - ^" in (await x /* runtimeCheckType= asy::Future */ ?{core::Object} 2 : new self::MyFuture::value(3)) as{TypeError} core::int; + return await x /* runtimeCheckType= asy::Future */ ?{FutureOr} 2 : new self::MyFuture::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; - self::MyFuture t5 = f.{self::MyFuture::then}((core::bool x) → FutureOr => invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_4.dart:30:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - x ? 2 : new MyFuture.value(3)); - ^" in (x ?{core::Object} 2 : new self::MyFuture::value(3)) as{TypeError} FutureOr){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; + self::MyFuture t5 = f.{self::MyFuture::then}((core::bool x) → FutureOr => x ?{FutureOr} 2 : new self::MyFuture::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; self::MyFuture t6 = f.{self::MyFuture::then}((core::bool x) → FutureOr { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_4.dart:33:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new MyFuture.value(3); - ^" in (x ?{core::Object} 2 : new self::MyFuture::value(3)) as{TypeError} FutureOr; + return x ?{FutureOr} 2 : new self::MyFuture::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; } static method main() → dynamic {} diff --git a/pkg/front_end/testcases/inference/future_then_conditional2_4.dart.weak.expect b/pkg/front_end/testcases/inference/future_then_conditional2_4.dart.weak.expect index 30ea48f7af3..f891d54914b 100644 --- a/pkg/front_end/testcases/inference/future_then_conditional2_4.dart.weak.expect +++ b/pkg/front_end/testcases/inference/future_then_conditional2_4.dart.weak.expect @@ -1,23 +1,4 @@ library test; -// -// Problems in library: -// -// pkg/front_end/testcases/inference/future_then_conditional2_4.dart:24:9: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// ? 2 -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2_4.dart:30:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// x ? 2 : new MyFuture.value(3)); -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2_4.dart:33:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new MyFuture.value(3); -// ^ -// import self as self; import "dart:core" as core; import "dart:async" as asy; @@ -45,21 +26,11 @@ class MyFuture extends core::Object implement static method test(self::MyFuture f) → void { self::MyFuture t1 = f.{self::MyFuture::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ => x ?{core::int} 2 : await new self::MyFuture::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; self::MyFuture t2 = f.{self::MyFuture::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_4.dart:24:9: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - ? 2 - ^" in (await x /* runtimeCheckType= asy::Future */ ?{core::Object} 2 : new self::MyFuture::value(3)) as{TypeError} core::int; + return await x /* runtimeCheckType= asy::Future */ ?{FutureOr} 2 : new self::MyFuture::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; - self::MyFuture t5 = f.{self::MyFuture::then}((core::bool x) → FutureOr => invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_4.dart:30:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - x ? 2 : new MyFuture.value(3)); - ^" in (x ?{core::Object} 2 : new self::MyFuture::value(3)) as{TypeError} FutureOr){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; + self::MyFuture t5 = f.{self::MyFuture::then}((core::bool x) → FutureOr => x ?{FutureOr} 2 : new self::MyFuture::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; self::MyFuture t6 = f.{self::MyFuture::then}((core::bool x) → FutureOr { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_4.dart:33:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new MyFuture.value(3); - ^" in (x ?{core::Object} 2 : new self::MyFuture::value(3)) as{TypeError} FutureOr; + return x ?{FutureOr} 2 : new self::MyFuture::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; } static method main() → dynamic {} diff --git a/pkg/front_end/testcases/inference/future_then_conditional2_4.dart.weak.modular.expect b/pkg/front_end/testcases/inference/future_then_conditional2_4.dart.weak.modular.expect index 30ea48f7af3..f891d54914b 100644 --- a/pkg/front_end/testcases/inference/future_then_conditional2_4.dart.weak.modular.expect +++ b/pkg/front_end/testcases/inference/future_then_conditional2_4.dart.weak.modular.expect @@ -1,23 +1,4 @@ library test; -// -// Problems in library: -// -// pkg/front_end/testcases/inference/future_then_conditional2_4.dart:24:9: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// ? 2 -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2_4.dart:30:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// x ? 2 : new MyFuture.value(3)); -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2_4.dart:33:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new MyFuture.value(3); -// ^ -// import self as self; import "dart:core" as core; import "dart:async" as asy; @@ -45,21 +26,11 @@ class MyFuture extends core::Object implement static method test(self::MyFuture f) → void { self::MyFuture t1 = f.{self::MyFuture::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ => x ?{core::int} 2 : await new self::MyFuture::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; self::MyFuture t2 = f.{self::MyFuture::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_4.dart:24:9: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - ? 2 - ^" in (await x /* runtimeCheckType= asy::Future */ ?{core::Object} 2 : new self::MyFuture::value(3)) as{TypeError} core::int; + return await x /* runtimeCheckType= asy::Future */ ?{FutureOr} 2 : new self::MyFuture::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; - self::MyFuture t5 = f.{self::MyFuture::then}((core::bool x) → FutureOr => invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_4.dart:30:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - x ? 2 : new MyFuture.value(3)); - ^" in (x ?{core::Object} 2 : new self::MyFuture::value(3)) as{TypeError} FutureOr){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; + self::MyFuture t5 = f.{self::MyFuture::then}((core::bool x) → FutureOr => x ?{FutureOr} 2 : new self::MyFuture::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; self::MyFuture t6 = f.{self::MyFuture::then}((core::bool x) → FutureOr { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_4.dart:33:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new MyFuture.value(3); - ^" in (x ?{core::Object} 2 : new self::MyFuture::value(3)) as{TypeError} FutureOr; + return x ?{FutureOr} 2 : new self::MyFuture::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; } static method main() → dynamic {} diff --git a/pkg/front_end/testcases/inference/future_then_conditional2_4.dart.weak.transformed.expect b/pkg/front_end/testcases/inference/future_then_conditional2_4.dart.weak.transformed.expect index e10a8544031..499b6538736 100644 --- a/pkg/front_end/testcases/inference/future_then_conditional2_4.dart.weak.transformed.expect +++ b/pkg/front_end/testcases/inference/future_then_conditional2_4.dart.weak.transformed.expect @@ -1,23 +1,4 @@ library test; -// -// Problems in library: -// -// pkg/front_end/testcases/inference/future_then_conditional2_4.dart:24:9: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// ? 2 -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2_4.dart:30:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// x ? 2 : new MyFuture.value(3)); -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2_4.dart:33:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new MyFuture.value(3); -// ^ -// import self as self; import "dart:core" as core; import "dart:async" as asy; @@ -45,21 +26,11 @@ class MyFuture extends core::Object implement static method test(self::MyFuture f) → void { self::MyFuture t1 = f.{self::MyFuture::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ => x ?{core::int} 2 : await new self::MyFuture::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; self::MyFuture t2 = f.{self::MyFuture::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_4.dart:24:9: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - ? 2 - ^" in (await x /* runtimeCheckType= asy::Future */ ?{core::Object} 2 : new self::MyFuture::value(3)) as{TypeError} core::int; + return await x /* runtimeCheckType= asy::Future */ ?{FutureOr} 2 : new self::MyFuture::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; - self::MyFuture t5 = f.{self::MyFuture::then}((core::bool x) → FutureOr => invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_4.dart:30:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - x ? 2 : new MyFuture.value(3)); - ^" in (x ?{core::Object} 2 : new self::MyFuture::value(3)) as{TypeError} FutureOr){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; + self::MyFuture t5 = f.{self::MyFuture::then}((core::bool x) → FutureOr => x ?{FutureOr} 2 : new self::MyFuture::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; self::MyFuture t6 = f.{self::MyFuture::then}((core::bool x) → FutureOr { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_4.dart:33:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new MyFuture.value(3); - ^" in (x ?{core::Object} 2 : new self::MyFuture::value(3)) as{TypeError} FutureOr; + return x ?{FutureOr} 2 : new self::MyFuture::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → self::MyFuture}; } static method main() → dynamic {} diff --git a/pkg/front_end/testcases/inference/future_then_conditional2_5.dart.strong.expect b/pkg/front_end/testcases/inference/future_then_conditional2_5.dart.strong.expect index 04e8e1d0de0..df14585a0ed 100644 --- a/pkg/front_end/testcases/inference/future_then_conditional2_5.dart.strong.expect +++ b/pkg/front_end/testcases/inference/future_then_conditional2_5.dart.strong.expect @@ -1,23 +1,4 @@ library test; -// -// Problems in library: -// -// pkg/front_end/testcases/inference/future_then_conditional2_5.dart:24:9: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// ? 2 -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2_5.dart:30:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// x ? 2 : new MyFuture.value(3)); -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2_5.dart:33:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new MyFuture.value(3); -// ^ -// import self as self; import "dart:core" as core; import "dart:async" as asy; @@ -45,21 +26,11 @@ class MyFuture extends core::Object implement static method test(asy::Future f) → void { asy::Future t1 = f.{asy::Future::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ => x ?{core::int} 2 : await new self::MyFuture::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → asy::Future}; asy::Future t2 = f.{asy::Future::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_5.dart:24:9: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - ? 2 - ^" in (await x /* runtimeCheckType= asy::Future */ ?{core::Object} 2 : new self::MyFuture::value(3)) as{TypeError} core::int; + return await x /* runtimeCheckType= asy::Future */ ?{FutureOr} 2 : new self::MyFuture::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → asy::Future}; - asy::Future t5 = f.{asy::Future::then}((core::bool x) → FutureOr => invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_5.dart:30:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - x ? 2 : new MyFuture.value(3)); - ^" in (x ?{core::Object} 2 : new self::MyFuture::value(3)) as{TypeError} FutureOr){((core::bool) → FutureOr, {onError: core::Function?}) → asy::Future}; + asy::Future t5 = f.{asy::Future::then}((core::bool x) → FutureOr => x ?{FutureOr} 2 : new self::MyFuture::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → asy::Future}; asy::Future t6 = f.{asy::Future::then}((core::bool x) → FutureOr { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_5.dart:33:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new MyFuture.value(3); - ^" in (x ?{core::Object} 2 : new self::MyFuture::value(3)) as{TypeError} FutureOr; + return x ?{FutureOr} 2 : new self::MyFuture::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → asy::Future}; } static method main() → dynamic {} diff --git a/pkg/front_end/testcases/inference/future_then_conditional2_5.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/future_then_conditional2_5.dart.strong.transformed.expect index 4a7568d52a1..165033e3953 100644 --- a/pkg/front_end/testcases/inference/future_then_conditional2_5.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/inference/future_then_conditional2_5.dart.strong.transformed.expect @@ -1,23 +1,4 @@ library test; -// -// Problems in library: -// -// pkg/front_end/testcases/inference/future_then_conditional2_5.dart:24:9: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// ? 2 -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2_5.dart:30:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// x ? 2 : new MyFuture.value(3)); -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2_5.dart:33:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new MyFuture.value(3); -// ^ -// import self as self; import "dart:core" as core; import "dart:async" as asy; @@ -45,21 +26,11 @@ class MyFuture extends core::Object implement static method test(asy::Future f) → void { asy::Future t1 = f.{asy::Future::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ => x ?{core::int} 2 : await new self::MyFuture::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → asy::Future}; asy::Future t2 = f.{asy::Future::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_5.dart:24:9: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - ? 2 - ^" in (await x /* runtimeCheckType= asy::Future */ ?{core::Object} 2 : new self::MyFuture::value(3)) as{TypeError} core::int; + return await x /* runtimeCheckType= asy::Future */ ?{FutureOr} 2 : new self::MyFuture::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → asy::Future}; - asy::Future t5 = f.{asy::Future::then}((core::bool x) → FutureOr => invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_5.dart:30:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - x ? 2 : new MyFuture.value(3)); - ^" in (x ?{core::Object} 2 : new self::MyFuture::value(3)) as{TypeError} FutureOr){((core::bool) → FutureOr, {onError: core::Function?}) → asy::Future}; + asy::Future t5 = f.{asy::Future::then}((core::bool x) → FutureOr => x ?{FutureOr} 2 : new self::MyFuture::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → asy::Future}; asy::Future t6 = f.{asy::Future::then}((core::bool x) → FutureOr { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_5.dart:33:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new MyFuture.value(3); - ^" in (x ?{core::Object} 2 : new self::MyFuture::value(3)) as{TypeError} FutureOr; + return x ?{FutureOr} 2 : new self::MyFuture::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → asy::Future}; } static method main() → dynamic {} diff --git a/pkg/front_end/testcases/inference/future_then_conditional2_5.dart.weak.expect b/pkg/front_end/testcases/inference/future_then_conditional2_5.dart.weak.expect index 04e8e1d0de0..df14585a0ed 100644 --- a/pkg/front_end/testcases/inference/future_then_conditional2_5.dart.weak.expect +++ b/pkg/front_end/testcases/inference/future_then_conditional2_5.dart.weak.expect @@ -1,23 +1,4 @@ library test; -// -// Problems in library: -// -// pkg/front_end/testcases/inference/future_then_conditional2_5.dart:24:9: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// ? 2 -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2_5.dart:30:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// x ? 2 : new MyFuture.value(3)); -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2_5.dart:33:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new MyFuture.value(3); -// ^ -// import self as self; import "dart:core" as core; import "dart:async" as asy; @@ -45,21 +26,11 @@ class MyFuture extends core::Object implement static method test(asy::Future f) → void { asy::Future t1 = f.{asy::Future::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ => x ?{core::int} 2 : await new self::MyFuture::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → asy::Future}; asy::Future t2 = f.{asy::Future::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_5.dart:24:9: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - ? 2 - ^" in (await x /* runtimeCheckType= asy::Future */ ?{core::Object} 2 : new self::MyFuture::value(3)) as{TypeError} core::int; + return await x /* runtimeCheckType= asy::Future */ ?{FutureOr} 2 : new self::MyFuture::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → asy::Future}; - asy::Future t5 = f.{asy::Future::then}((core::bool x) → FutureOr => invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_5.dart:30:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - x ? 2 : new MyFuture.value(3)); - ^" in (x ?{core::Object} 2 : new self::MyFuture::value(3)) as{TypeError} FutureOr){((core::bool) → FutureOr, {onError: core::Function?}) → asy::Future}; + asy::Future t5 = f.{asy::Future::then}((core::bool x) → FutureOr => x ?{FutureOr} 2 : new self::MyFuture::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → asy::Future}; asy::Future t6 = f.{asy::Future::then}((core::bool x) → FutureOr { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_5.dart:33:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new MyFuture.value(3); - ^" in (x ?{core::Object} 2 : new self::MyFuture::value(3)) as{TypeError} FutureOr; + return x ?{FutureOr} 2 : new self::MyFuture::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → asy::Future}; } static method main() → dynamic {} diff --git a/pkg/front_end/testcases/inference/future_then_conditional2_5.dart.weak.modular.expect b/pkg/front_end/testcases/inference/future_then_conditional2_5.dart.weak.modular.expect index 04e8e1d0de0..df14585a0ed 100644 --- a/pkg/front_end/testcases/inference/future_then_conditional2_5.dart.weak.modular.expect +++ b/pkg/front_end/testcases/inference/future_then_conditional2_5.dart.weak.modular.expect @@ -1,23 +1,4 @@ library test; -// -// Problems in library: -// -// pkg/front_end/testcases/inference/future_then_conditional2_5.dart:24:9: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// ? 2 -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2_5.dart:30:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// x ? 2 : new MyFuture.value(3)); -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2_5.dart:33:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new MyFuture.value(3); -// ^ -// import self as self; import "dart:core" as core; import "dart:async" as asy; @@ -45,21 +26,11 @@ class MyFuture extends core::Object implement static method test(asy::Future f) → void { asy::Future t1 = f.{asy::Future::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ => x ?{core::int} 2 : await new self::MyFuture::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → asy::Future}; asy::Future t2 = f.{asy::Future::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_5.dart:24:9: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - ? 2 - ^" in (await x /* runtimeCheckType= asy::Future */ ?{core::Object} 2 : new self::MyFuture::value(3)) as{TypeError} core::int; + return await x /* runtimeCheckType= asy::Future */ ?{FutureOr} 2 : new self::MyFuture::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → asy::Future}; - asy::Future t5 = f.{asy::Future::then}((core::bool x) → FutureOr => invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_5.dart:30:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - x ? 2 : new MyFuture.value(3)); - ^" in (x ?{core::Object} 2 : new self::MyFuture::value(3)) as{TypeError} FutureOr){((core::bool) → FutureOr, {onError: core::Function?}) → asy::Future}; + asy::Future t5 = f.{asy::Future::then}((core::bool x) → FutureOr => x ?{FutureOr} 2 : new self::MyFuture::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → asy::Future}; asy::Future t6 = f.{asy::Future::then}((core::bool x) → FutureOr { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_5.dart:33:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new MyFuture.value(3); - ^" in (x ?{core::Object} 2 : new self::MyFuture::value(3)) as{TypeError} FutureOr; + return x ?{FutureOr} 2 : new self::MyFuture::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → asy::Future}; } static method main() → dynamic {} diff --git a/pkg/front_end/testcases/inference/future_then_conditional2_5.dart.weak.transformed.expect b/pkg/front_end/testcases/inference/future_then_conditional2_5.dart.weak.transformed.expect index 4a7568d52a1..165033e3953 100644 --- a/pkg/front_end/testcases/inference/future_then_conditional2_5.dart.weak.transformed.expect +++ b/pkg/front_end/testcases/inference/future_then_conditional2_5.dart.weak.transformed.expect @@ -1,23 +1,4 @@ library test; -// -// Problems in library: -// -// pkg/front_end/testcases/inference/future_then_conditional2_5.dart:24:9: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// ? 2 -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2_5.dart:30:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// x ? 2 : new MyFuture.value(3)); -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2_5.dart:33:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new MyFuture.value(3); -// ^ -// import self as self; import "dart:core" as core; import "dart:async" as asy; @@ -45,21 +26,11 @@ class MyFuture extends core::Object implement static method test(asy::Future f) → void { asy::Future t1 = f.{asy::Future::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ => x ?{core::int} 2 : await new self::MyFuture::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → asy::Future}; asy::Future t2 = f.{asy::Future::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_5.dart:24:9: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - ? 2 - ^" in (await x /* runtimeCheckType= asy::Future */ ?{core::Object} 2 : new self::MyFuture::value(3)) as{TypeError} core::int; + return await x /* runtimeCheckType= asy::Future */ ?{FutureOr} 2 : new self::MyFuture::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → asy::Future}; - asy::Future t5 = f.{asy::Future::then}((core::bool x) → FutureOr => invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_5.dart:30:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - x ? 2 : new MyFuture.value(3)); - ^" in (x ?{core::Object} 2 : new self::MyFuture::value(3)) as{TypeError} FutureOr){((core::bool) → FutureOr, {onError: core::Function?}) → asy::Future}; + asy::Future t5 = f.{asy::Future::then}((core::bool x) → FutureOr => x ?{FutureOr} 2 : new self::MyFuture::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → asy::Future}; asy::Future t6 = f.{asy::Future::then}((core::bool x) → FutureOr { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_5.dart:33:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new MyFuture.value(3); - ^" in (x ?{core::Object} 2 : new self::MyFuture::value(3)) as{TypeError} FutureOr; + return x ?{FutureOr} 2 : new self::MyFuture::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → asy::Future}; } static method main() → dynamic {} diff --git a/pkg/front_end/testcases/inference/future_then_conditional2_6.dart.strong.expect b/pkg/front_end/testcases/inference/future_then_conditional2_6.dart.strong.expect index 36390d877fa..7e3245b27df 100644 --- a/pkg/front_end/testcases/inference/future_then_conditional2_6.dart.strong.expect +++ b/pkg/front_end/testcases/inference/future_then_conditional2_6.dart.strong.expect @@ -1,23 +1,4 @@ library test; -// -// Problems in library: -// -// pkg/front_end/testcases/inference/future_then_conditional2_6.dart:23:49: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// return /*info:DOWN_CAST_COMPOSITE*/ await x ? 2 : new Future.value(3); -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2_6.dart:28:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// x ? 2 : new Future.value(3)); -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2_6.dart:31:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new Future.value(3); -// ^ -// import self as self; import "dart:core" as core; import "dart:async" as asy; @@ -45,21 +26,11 @@ class MyFuture extends core::Object implement static method test(asy::Future f) → void { asy::Future t1 = f.{asy::Future::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ => x ?{core::int} 2 : await asy::Future::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → asy::Future}; asy::Future t2 = f.{asy::Future::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_6.dart:23:49: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - return /*info:DOWN_CAST_COMPOSITE*/ await x ? 2 : new Future.value(3); - ^" in (await x /* runtimeCheckType= asy::Future */ ?{core::Object} 2 : asy::Future::value(3)) as{TypeError} core::int; + return await x /* runtimeCheckType= asy::Future */ ?{FutureOr} 2 : asy::Future::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → asy::Future}; - asy::Future t5 = f.{asy::Future::then}((core::bool x) → FutureOr => invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_6.dart:28:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - x ? 2 : new Future.value(3)); - ^" in (x ?{core::Object} 2 : asy::Future::value(3)) as{TypeError} FutureOr){((core::bool) → FutureOr, {onError: core::Function?}) → asy::Future}; + asy::Future t5 = f.{asy::Future::then}((core::bool x) → FutureOr => x ?{FutureOr} 2 : asy::Future::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → asy::Future}; asy::Future t6 = f.{asy::Future::then}((core::bool x) → FutureOr { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_6.dart:31:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new Future.value(3); - ^" in (x ?{core::Object} 2 : asy::Future::value(3)) as{TypeError} FutureOr; + return x ?{FutureOr} 2 : asy::Future::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → asy::Future}; } static method main() → dynamic {} diff --git a/pkg/front_end/testcases/inference/future_then_conditional2_6.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/future_then_conditional2_6.dart.strong.transformed.expect index 4b5c87721ec..564b8245b47 100644 --- a/pkg/front_end/testcases/inference/future_then_conditional2_6.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/inference/future_then_conditional2_6.dart.strong.transformed.expect @@ -1,23 +1,4 @@ library test; -// -// Problems in library: -// -// pkg/front_end/testcases/inference/future_then_conditional2_6.dart:23:49: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// return /*info:DOWN_CAST_COMPOSITE*/ await x ? 2 : new Future.value(3); -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2_6.dart:28:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// x ? 2 : new Future.value(3)); -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2_6.dart:31:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new Future.value(3); -// ^ -// import self as self; import "dart:core" as core; import "dart:async" as asy; @@ -45,21 +26,11 @@ class MyFuture extends core::Object implement static method test(asy::Future f) → void { asy::Future t1 = f.{asy::Future::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ => x ?{core::int} 2 : await asy::Future::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → asy::Future}; asy::Future t2 = f.{asy::Future::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_6.dart:23:49: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - return /*info:DOWN_CAST_COMPOSITE*/ await x ? 2 : new Future.value(3); - ^" in (await x /* runtimeCheckType= asy::Future */ ?{core::Object} 2 : asy::Future::value(3)) as{TypeError} core::int; + return await x /* runtimeCheckType= asy::Future */ ?{FutureOr} 2 : asy::Future::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → asy::Future}; - asy::Future t5 = f.{asy::Future::then}((core::bool x) → FutureOr => invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_6.dart:28:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - x ? 2 : new Future.value(3)); - ^" in (x ?{core::Object} 2 : asy::Future::value(3)) as{TypeError} FutureOr){((core::bool) → FutureOr, {onError: core::Function?}) → asy::Future}; + asy::Future t5 = f.{asy::Future::then}((core::bool x) → FutureOr => x ?{FutureOr} 2 : asy::Future::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → asy::Future}; asy::Future t6 = f.{asy::Future::then}((core::bool x) → FutureOr { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_6.dart:31:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new Future.value(3); - ^" in (x ?{core::Object} 2 : asy::Future::value(3)) as{TypeError} FutureOr; + return x ?{FutureOr} 2 : asy::Future::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → asy::Future}; } static method main() → dynamic {} diff --git a/pkg/front_end/testcases/inference/future_then_conditional2_6.dart.weak.expect b/pkg/front_end/testcases/inference/future_then_conditional2_6.dart.weak.expect index 36390d877fa..7e3245b27df 100644 --- a/pkg/front_end/testcases/inference/future_then_conditional2_6.dart.weak.expect +++ b/pkg/front_end/testcases/inference/future_then_conditional2_6.dart.weak.expect @@ -1,23 +1,4 @@ library test; -// -// Problems in library: -// -// pkg/front_end/testcases/inference/future_then_conditional2_6.dart:23:49: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// return /*info:DOWN_CAST_COMPOSITE*/ await x ? 2 : new Future.value(3); -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2_6.dart:28:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// x ? 2 : new Future.value(3)); -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2_6.dart:31:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new Future.value(3); -// ^ -// import self as self; import "dart:core" as core; import "dart:async" as asy; @@ -45,21 +26,11 @@ class MyFuture extends core::Object implement static method test(asy::Future f) → void { asy::Future t1 = f.{asy::Future::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ => x ?{core::int} 2 : await asy::Future::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → asy::Future}; asy::Future t2 = f.{asy::Future::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_6.dart:23:49: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - return /*info:DOWN_CAST_COMPOSITE*/ await x ? 2 : new Future.value(3); - ^" in (await x /* runtimeCheckType= asy::Future */ ?{core::Object} 2 : asy::Future::value(3)) as{TypeError} core::int; + return await x /* runtimeCheckType= asy::Future */ ?{FutureOr} 2 : asy::Future::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → asy::Future}; - asy::Future t5 = f.{asy::Future::then}((core::bool x) → FutureOr => invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_6.dart:28:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - x ? 2 : new Future.value(3)); - ^" in (x ?{core::Object} 2 : asy::Future::value(3)) as{TypeError} FutureOr){((core::bool) → FutureOr, {onError: core::Function?}) → asy::Future}; + asy::Future t5 = f.{asy::Future::then}((core::bool x) → FutureOr => x ?{FutureOr} 2 : asy::Future::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → asy::Future}; asy::Future t6 = f.{asy::Future::then}((core::bool x) → FutureOr { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_6.dart:31:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new Future.value(3); - ^" in (x ?{core::Object} 2 : asy::Future::value(3)) as{TypeError} FutureOr; + return x ?{FutureOr} 2 : asy::Future::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → asy::Future}; } static method main() → dynamic {} diff --git a/pkg/front_end/testcases/inference/future_then_conditional2_6.dart.weak.modular.expect b/pkg/front_end/testcases/inference/future_then_conditional2_6.dart.weak.modular.expect index 36390d877fa..7e3245b27df 100644 --- a/pkg/front_end/testcases/inference/future_then_conditional2_6.dart.weak.modular.expect +++ b/pkg/front_end/testcases/inference/future_then_conditional2_6.dart.weak.modular.expect @@ -1,23 +1,4 @@ library test; -// -// Problems in library: -// -// pkg/front_end/testcases/inference/future_then_conditional2_6.dart:23:49: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// return /*info:DOWN_CAST_COMPOSITE*/ await x ? 2 : new Future.value(3); -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2_6.dart:28:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// x ? 2 : new Future.value(3)); -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2_6.dart:31:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new Future.value(3); -// ^ -// import self as self; import "dart:core" as core; import "dart:async" as asy; @@ -45,21 +26,11 @@ class MyFuture extends core::Object implement static method test(asy::Future f) → void { asy::Future t1 = f.{asy::Future::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ => x ?{core::int} 2 : await asy::Future::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → asy::Future}; asy::Future t2 = f.{asy::Future::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_6.dart:23:49: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - return /*info:DOWN_CAST_COMPOSITE*/ await x ? 2 : new Future.value(3); - ^" in (await x /* runtimeCheckType= asy::Future */ ?{core::Object} 2 : asy::Future::value(3)) as{TypeError} core::int; + return await x /* runtimeCheckType= asy::Future */ ?{FutureOr} 2 : asy::Future::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → asy::Future}; - asy::Future t5 = f.{asy::Future::then}((core::bool x) → FutureOr => invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_6.dart:28:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - x ? 2 : new Future.value(3)); - ^" in (x ?{core::Object} 2 : asy::Future::value(3)) as{TypeError} FutureOr){((core::bool) → FutureOr, {onError: core::Function?}) → asy::Future}; + asy::Future t5 = f.{asy::Future::then}((core::bool x) → FutureOr => x ?{FutureOr} 2 : asy::Future::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → asy::Future}; asy::Future t6 = f.{asy::Future::then}((core::bool x) → FutureOr { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_6.dart:31:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new Future.value(3); - ^" in (x ?{core::Object} 2 : asy::Future::value(3)) as{TypeError} FutureOr; + return x ?{FutureOr} 2 : asy::Future::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → asy::Future}; } static method main() → dynamic {} diff --git a/pkg/front_end/testcases/inference/future_then_conditional2_6.dart.weak.transformed.expect b/pkg/front_end/testcases/inference/future_then_conditional2_6.dart.weak.transformed.expect index 4b5c87721ec..564b8245b47 100644 --- a/pkg/front_end/testcases/inference/future_then_conditional2_6.dart.weak.transformed.expect +++ b/pkg/front_end/testcases/inference/future_then_conditional2_6.dart.weak.transformed.expect @@ -1,23 +1,4 @@ library test; -// -// Problems in library: -// -// pkg/front_end/testcases/inference/future_then_conditional2_6.dart:23:49: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// return /*info:DOWN_CAST_COMPOSITE*/ await x ? 2 : new Future.value(3); -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2_6.dart:28:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// x ? 2 : new Future.value(3)); -// ^ -// -// pkg/front_end/testcases/inference/future_then_conditional2_6.dart:31:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new Future.value(3); -// ^ -// import self as self; import "dart:core" as core; import "dart:async" as asy; @@ -45,21 +26,11 @@ class MyFuture extends core::Object implement static method test(asy::Future f) → void { asy::Future t1 = f.{asy::Future::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ => x ?{core::int} 2 : await asy::Future::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → asy::Future}; asy::Future t2 = f.{asy::Future::then}((core::bool x) → asy::Future async /* emittedValueType= core::int */ { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_6.dart:23:49: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - return /*info:DOWN_CAST_COMPOSITE*/ await x ? 2 : new Future.value(3); - ^" in (await x /* runtimeCheckType= asy::Future */ ?{core::Object} 2 : asy::Future::value(3)) as{TypeError} core::int; + return await x /* runtimeCheckType= asy::Future */ ?{FutureOr} 2 : asy::Future::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → asy::Future}; - asy::Future t5 = f.{asy::Future::then}((core::bool x) → FutureOr => invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_6.dart:28:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - x ? 2 : new Future.value(3)); - ^" in (x ?{core::Object} 2 : asy::Future::value(3)) as{TypeError} FutureOr){((core::bool) → FutureOr, {onError: core::Function?}) → asy::Future}; + asy::Future t5 = f.{asy::Future::then}((core::bool x) → FutureOr => x ?{FutureOr} 2 : asy::Future::value(3)){((core::bool) → FutureOr, {onError: core::Function?}) → asy::Future}; asy::Future t6 = f.{asy::Future::then}((core::bool x) → FutureOr { - return invalid-expression "pkg/front_end/testcases/inference/future_then_conditional2_6.dart:31:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - return /*info:DOWN_CAST_COMPOSITE*/ x ? 2 : new Future.value(3); - ^" in (x ?{core::Object} 2 : asy::Future::value(3)) as{TypeError} FutureOr; + return x ?{FutureOr} 2 : asy::Future::value(3); }){((core::bool) → FutureOr, {onError: core::Function?}) → asy::Future}; } static method main() → dynamic {} diff --git a/pkg/front_end/testcases/inference/future_then_ifNull2.dart.strong.expect b/pkg/front_end/testcases/inference/future_then_ifNull2.dart.strong.expect index df464d51ad8..6d104648342 100644 --- a/pkg/front_end/testcases/inference/future_then_ifNull2.dart.strong.expect +++ b/pkg/front_end/testcases/inference/future_then_ifNull2.dart.strong.expect @@ -10,30 +10,14 @@ library test; // return /*info:DOWN_CAST_COMPOSITE*/ await x ?? new Future.value(3); // ^ // -// pkg/front_end/testcases/inference/future_then_ifNull2.dart:23:49: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// return /*info:DOWN_CAST_COMPOSITE*/ await x ?? new Future.value(3); -// ^ -// // pkg/front_end/testcases/inference/future_then_ifNull2.dart:28:11: Warning: Operand of null-aware operation '??' has type 'int' which excludes null. // x ?? new Future.value(3)); // ^ // -// pkg/front_end/testcases/inference/future_then_ifNull2.dart:28:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// x ?? new Future.value(3)); -// ^ -// // pkg/front_end/testcases/inference/future_then_ifNull2.dart:31:41: Warning: Operand of null-aware operation '??' has type 'int' which excludes null. // return /*info:DOWN_CAST_COMPOSITE*/ x ?? new Future.value(3); // ^ // -// pkg/front_end/testcases/inference/future_then_ifNull2.dart:31:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// return /*info:DOWN_CAST_COMPOSITE*/ x ?? new Future.value(3); -// ^ -// import self as self; import "dart:core" as core; import "dart:async" as asy; @@ -61,21 +45,11 @@ class MyFuture extends core::Object implement static method test(self::MyFuture f) → void { asy::Future t1 = f.{self::MyFuture::then}((core::int x) → asy::Future async /* emittedValueType= core::int */ => let final core::int #t1 = x in #t1 == null ?{core::int} await asy::Future::value(3) : #t1){((core::int) → FutureOr, {onError: core::Function?}) → self::MyFuture}; asy::Future t2 = f.{self::MyFuture::then}((core::int x) → asy::Future async /* emittedValueType= core::int */ { - return invalid-expression "pkg/front_end/testcases/inference/future_then_ifNull2.dart:23:49: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - return /*info:DOWN_CAST_COMPOSITE*/ await x ?? new Future.value(3); - ^" in (let final core::int #t2 = await x /* runtimeCheckType= asy::Future */ in #t2 == null ?{core::Object} asy::Future::value(3) : #t2) as{TypeError} core::int; + return let final core::int #t2 = await x /* runtimeCheckType= asy::Future */ in #t2 == null ?{FutureOr} asy::Future::value(3) : #t2; }){((core::int) → FutureOr, {onError: core::Function?}) → self::MyFuture}; - asy::Future t5 = f.{self::MyFuture::then}((core::int x) → FutureOr => invalid-expression "pkg/front_end/testcases/inference/future_then_ifNull2.dart:28:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - x ?? new Future.value(3)); - ^" in (let final core::int #t3 = x in #t3 == null ?{core::Object} asy::Future::value(3) : #t3) as{TypeError} FutureOr){((core::int) → FutureOr, {onError: core::Function?}) → self::MyFuture}; + asy::Future t5 = f.{self::MyFuture::then}((core::int x) → FutureOr => let final core::int #t3 = x in #t3 == null ?{FutureOr} asy::Future::value(3) : #t3){((core::int) → FutureOr, {onError: core::Function?}) → self::MyFuture}; asy::Future t6 = f.{self::MyFuture::then}((core::int x) → FutureOr { - return invalid-expression "pkg/front_end/testcases/inference/future_then_ifNull2.dart:31:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - return /*info:DOWN_CAST_COMPOSITE*/ x ?? new Future.value(3); - ^" in (let final core::int #t4 = x in #t4 == null ?{core::Object} asy::Future::value(3) : #t4) as{TypeError} FutureOr; + return let final core::int #t4 = x in #t4 == null ?{FutureOr} asy::Future::value(3) : #t4; }){((core::int) → FutureOr, {onError: core::Function?}) → self::MyFuture}; } static method main() → dynamic {} diff --git a/pkg/front_end/testcases/inference/future_then_ifNull2.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/future_then_ifNull2.dart.strong.transformed.expect index e5a2ea55431..5c369a7163f 100644 --- a/pkg/front_end/testcases/inference/future_then_ifNull2.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/inference/future_then_ifNull2.dart.strong.transformed.expect @@ -10,30 +10,14 @@ library test; // return /*info:DOWN_CAST_COMPOSITE*/ await x ?? new Future.value(3); // ^ // -// pkg/front_end/testcases/inference/future_then_ifNull2.dart:23:49: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// return /*info:DOWN_CAST_COMPOSITE*/ await x ?? new Future.value(3); -// ^ -// // pkg/front_end/testcases/inference/future_then_ifNull2.dart:28:11: Warning: Operand of null-aware operation '??' has type 'int' which excludes null. // x ?? new Future.value(3)); // ^ // -// pkg/front_end/testcases/inference/future_then_ifNull2.dart:28:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// x ?? new Future.value(3)); -// ^ -// // pkg/front_end/testcases/inference/future_then_ifNull2.dart:31:41: Warning: Operand of null-aware operation '??' has type 'int' which excludes null. // return /*info:DOWN_CAST_COMPOSITE*/ x ?? new Future.value(3); // ^ // -// pkg/front_end/testcases/inference/future_then_ifNull2.dart:31:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// return /*info:DOWN_CAST_COMPOSITE*/ x ?? new Future.value(3); -// ^ -// import self as self; import "dart:core" as core; import "dart:async" as asy; @@ -61,21 +45,11 @@ class MyFuture extends core::Object implement static method test(self::MyFuture f) → void { asy::Future t1 = f.{self::MyFuture::then}((core::int x) → asy::Future async /* emittedValueType= core::int */ => let final core::int #t1 = x in #t1 == null ?{core::int} await asy::Future::value(3) : #t1){((core::int) → FutureOr, {onError: core::Function?}) → self::MyFuture}; asy::Future t2 = f.{self::MyFuture::then}((core::int x) → asy::Future async /* emittedValueType= core::int */ { - return invalid-expression "pkg/front_end/testcases/inference/future_then_ifNull2.dart:23:49: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - return /*info:DOWN_CAST_COMPOSITE*/ await x ?? new Future.value(3); - ^" in (let final core::int #t2 = await x /* runtimeCheckType= asy::Future */ in #t2 == null ?{core::Object} asy::Future::value(3) : #t2) as{TypeError} core::int; + return let final core::int #t2 = await x /* runtimeCheckType= asy::Future */ in #t2 == null ?{FutureOr} asy::Future::value(3) : #t2; }){((core::int) → FutureOr, {onError: core::Function?}) → self::MyFuture}; - asy::Future t5 = f.{self::MyFuture::then}((core::int x) → FutureOr => invalid-expression "pkg/front_end/testcases/inference/future_then_ifNull2.dart:28:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - x ?? new Future.value(3)); - ^" in (let final core::int #t3 = x in #t3 == null ?{core::Object} asy::Future::value(3) : #t3) as{TypeError} FutureOr){((core::int) → FutureOr, {onError: core::Function?}) → self::MyFuture}; + asy::Future t5 = f.{self::MyFuture::then}((core::int x) → FutureOr => let final core::int #t3 = x in #t3 == null ?{FutureOr} asy::Future::value(3) : #t3){((core::int) → FutureOr, {onError: core::Function?}) → self::MyFuture}; asy::Future t6 = f.{self::MyFuture::then}((core::int x) → FutureOr { - return invalid-expression "pkg/front_end/testcases/inference/future_then_ifNull2.dart:31:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - return /*info:DOWN_CAST_COMPOSITE*/ x ?? new Future.value(3); - ^" in (let final core::int #t4 = x in #t4 == null ?{core::Object} asy::Future::value(3) : #t4) as{TypeError} FutureOr; + return let final core::int #t4 = x in #t4 == null ?{FutureOr} asy::Future::value(3) : #t4; }){((core::int) → FutureOr, {onError: core::Function?}) → self::MyFuture}; } static method main() → dynamic {} diff --git a/pkg/front_end/testcases/inference/future_then_ifNull2.dart.weak.expect b/pkg/front_end/testcases/inference/future_then_ifNull2.dart.weak.expect index df464d51ad8..6d104648342 100644 --- a/pkg/front_end/testcases/inference/future_then_ifNull2.dart.weak.expect +++ b/pkg/front_end/testcases/inference/future_then_ifNull2.dart.weak.expect @@ -10,30 +10,14 @@ library test; // return /*info:DOWN_CAST_COMPOSITE*/ await x ?? new Future.value(3); // ^ // -// pkg/front_end/testcases/inference/future_then_ifNull2.dart:23:49: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// return /*info:DOWN_CAST_COMPOSITE*/ await x ?? new Future.value(3); -// ^ -// // pkg/front_end/testcases/inference/future_then_ifNull2.dart:28:11: Warning: Operand of null-aware operation '??' has type 'int' which excludes null. // x ?? new Future.value(3)); // ^ // -// pkg/front_end/testcases/inference/future_then_ifNull2.dart:28:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// x ?? new Future.value(3)); -// ^ -// // pkg/front_end/testcases/inference/future_then_ifNull2.dart:31:41: Warning: Operand of null-aware operation '??' has type 'int' which excludes null. // return /*info:DOWN_CAST_COMPOSITE*/ x ?? new Future.value(3); // ^ // -// pkg/front_end/testcases/inference/future_then_ifNull2.dart:31:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// return /*info:DOWN_CAST_COMPOSITE*/ x ?? new Future.value(3); -// ^ -// import self as self; import "dart:core" as core; import "dart:async" as asy; @@ -61,21 +45,11 @@ class MyFuture extends core::Object implement static method test(self::MyFuture f) → void { asy::Future t1 = f.{self::MyFuture::then}((core::int x) → asy::Future async /* emittedValueType= core::int */ => let final core::int #t1 = x in #t1 == null ?{core::int} await asy::Future::value(3) : #t1){((core::int) → FutureOr, {onError: core::Function?}) → self::MyFuture}; asy::Future t2 = f.{self::MyFuture::then}((core::int x) → asy::Future async /* emittedValueType= core::int */ { - return invalid-expression "pkg/front_end/testcases/inference/future_then_ifNull2.dart:23:49: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - return /*info:DOWN_CAST_COMPOSITE*/ await x ?? new Future.value(3); - ^" in (let final core::int #t2 = await x /* runtimeCheckType= asy::Future */ in #t2 == null ?{core::Object} asy::Future::value(3) : #t2) as{TypeError} core::int; + return let final core::int #t2 = await x /* runtimeCheckType= asy::Future */ in #t2 == null ?{FutureOr} asy::Future::value(3) : #t2; }){((core::int) → FutureOr, {onError: core::Function?}) → self::MyFuture}; - asy::Future t5 = f.{self::MyFuture::then}((core::int x) → FutureOr => invalid-expression "pkg/front_end/testcases/inference/future_then_ifNull2.dart:28:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - x ?? new Future.value(3)); - ^" in (let final core::int #t3 = x in #t3 == null ?{core::Object} asy::Future::value(3) : #t3) as{TypeError} FutureOr){((core::int) → FutureOr, {onError: core::Function?}) → self::MyFuture}; + asy::Future t5 = f.{self::MyFuture::then}((core::int x) → FutureOr => let final core::int #t3 = x in #t3 == null ?{FutureOr} asy::Future::value(3) : #t3){((core::int) → FutureOr, {onError: core::Function?}) → self::MyFuture}; asy::Future t6 = f.{self::MyFuture::then}((core::int x) → FutureOr { - return invalid-expression "pkg/front_end/testcases/inference/future_then_ifNull2.dart:31:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - return /*info:DOWN_CAST_COMPOSITE*/ x ?? new Future.value(3); - ^" in (let final core::int #t4 = x in #t4 == null ?{core::Object} asy::Future::value(3) : #t4) as{TypeError} FutureOr; + return let final core::int #t4 = x in #t4 == null ?{FutureOr} asy::Future::value(3) : #t4; }){((core::int) → FutureOr, {onError: core::Function?}) → self::MyFuture}; } static method main() → dynamic {} diff --git a/pkg/front_end/testcases/inference/future_then_ifNull2.dart.weak.modular.expect b/pkg/front_end/testcases/inference/future_then_ifNull2.dart.weak.modular.expect index df464d51ad8..6d104648342 100644 --- a/pkg/front_end/testcases/inference/future_then_ifNull2.dart.weak.modular.expect +++ b/pkg/front_end/testcases/inference/future_then_ifNull2.dart.weak.modular.expect @@ -10,30 +10,14 @@ library test; // return /*info:DOWN_CAST_COMPOSITE*/ await x ?? new Future.value(3); // ^ // -// pkg/front_end/testcases/inference/future_then_ifNull2.dart:23:49: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// return /*info:DOWN_CAST_COMPOSITE*/ await x ?? new Future.value(3); -// ^ -// // pkg/front_end/testcases/inference/future_then_ifNull2.dart:28:11: Warning: Operand of null-aware operation '??' has type 'int' which excludes null. // x ?? new Future.value(3)); // ^ // -// pkg/front_end/testcases/inference/future_then_ifNull2.dart:28:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// x ?? new Future.value(3)); -// ^ -// // pkg/front_end/testcases/inference/future_then_ifNull2.dart:31:41: Warning: Operand of null-aware operation '??' has type 'int' which excludes null. // return /*info:DOWN_CAST_COMPOSITE*/ x ?? new Future.value(3); // ^ // -// pkg/front_end/testcases/inference/future_then_ifNull2.dart:31:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// return /*info:DOWN_CAST_COMPOSITE*/ x ?? new Future.value(3); -// ^ -// import self as self; import "dart:core" as core; import "dart:async" as asy; @@ -61,21 +45,11 @@ class MyFuture extends core::Object implement static method test(self::MyFuture f) → void { asy::Future t1 = f.{self::MyFuture::then}((core::int x) → asy::Future async /* emittedValueType= core::int */ => let final core::int #t1 = x in #t1 == null ?{core::int} await asy::Future::value(3) : #t1){((core::int) → FutureOr, {onError: core::Function?}) → self::MyFuture}; asy::Future t2 = f.{self::MyFuture::then}((core::int x) → asy::Future async /* emittedValueType= core::int */ { - return invalid-expression "pkg/front_end/testcases/inference/future_then_ifNull2.dart:23:49: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - return /*info:DOWN_CAST_COMPOSITE*/ await x ?? new Future.value(3); - ^" in (let final core::int #t2 = await x /* runtimeCheckType= asy::Future */ in #t2 == null ?{core::Object} asy::Future::value(3) : #t2) as{TypeError} core::int; + return let final core::int #t2 = await x /* runtimeCheckType= asy::Future */ in #t2 == null ?{FutureOr} asy::Future::value(3) : #t2; }){((core::int) → FutureOr, {onError: core::Function?}) → self::MyFuture}; - asy::Future t5 = f.{self::MyFuture::then}((core::int x) → FutureOr => invalid-expression "pkg/front_end/testcases/inference/future_then_ifNull2.dart:28:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - x ?? new Future.value(3)); - ^" in (let final core::int #t3 = x in #t3 == null ?{core::Object} asy::Future::value(3) : #t3) as{TypeError} FutureOr){((core::int) → FutureOr, {onError: core::Function?}) → self::MyFuture}; + asy::Future t5 = f.{self::MyFuture::then}((core::int x) → FutureOr => let final core::int #t3 = x in #t3 == null ?{FutureOr} asy::Future::value(3) : #t3){((core::int) → FutureOr, {onError: core::Function?}) → self::MyFuture}; asy::Future t6 = f.{self::MyFuture::then}((core::int x) → FutureOr { - return invalid-expression "pkg/front_end/testcases/inference/future_then_ifNull2.dart:31:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - return /*info:DOWN_CAST_COMPOSITE*/ x ?? new Future.value(3); - ^" in (let final core::int #t4 = x in #t4 == null ?{core::Object} asy::Future::value(3) : #t4) as{TypeError} FutureOr; + return let final core::int #t4 = x in #t4 == null ?{FutureOr} asy::Future::value(3) : #t4; }){((core::int) → FutureOr, {onError: core::Function?}) → self::MyFuture}; } static method main() → dynamic {} diff --git a/pkg/front_end/testcases/inference/future_then_ifNull2.dart.weak.transformed.expect b/pkg/front_end/testcases/inference/future_then_ifNull2.dart.weak.transformed.expect index e5a2ea55431..5c369a7163f 100644 --- a/pkg/front_end/testcases/inference/future_then_ifNull2.dart.weak.transformed.expect +++ b/pkg/front_end/testcases/inference/future_then_ifNull2.dart.weak.transformed.expect @@ -10,30 +10,14 @@ library test; // return /*info:DOWN_CAST_COMPOSITE*/ await x ?? new Future.value(3); // ^ // -// pkg/front_end/testcases/inference/future_then_ifNull2.dart:23:49: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// return /*info:DOWN_CAST_COMPOSITE*/ await x ?? new Future.value(3); -// ^ -// // pkg/front_end/testcases/inference/future_then_ifNull2.dart:28:11: Warning: Operand of null-aware operation '??' has type 'int' which excludes null. // x ?? new Future.value(3)); // ^ // -// pkg/front_end/testcases/inference/future_then_ifNull2.dart:28:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// x ?? new Future.value(3)); -// ^ -// // pkg/front_end/testcases/inference/future_then_ifNull2.dart:31:41: Warning: Operand of null-aware operation '??' has type 'int' which excludes null. // return /*info:DOWN_CAST_COMPOSITE*/ x ?? new Future.value(3); // ^ // -// pkg/front_end/testcases/inference/future_then_ifNull2.dart:31:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. -// - 'Object' is from 'dart:core'. -// return /*info:DOWN_CAST_COMPOSITE*/ x ?? new Future.value(3); -// ^ -// import self as self; import "dart:core" as core; import "dart:async" as asy; @@ -61,21 +45,11 @@ class MyFuture extends core::Object implement static method test(self::MyFuture f) → void { asy::Future t1 = f.{self::MyFuture::then}((core::int x) → asy::Future async /* emittedValueType= core::int */ => let final core::int #t1 = x in #t1 == null ?{core::int} await asy::Future::value(3) : #t1){((core::int) → FutureOr, {onError: core::Function?}) → self::MyFuture}; asy::Future t2 = f.{self::MyFuture::then}((core::int x) → asy::Future async /* emittedValueType= core::int */ { - return invalid-expression "pkg/front_end/testcases/inference/future_then_ifNull2.dart:23:49: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - return /*info:DOWN_CAST_COMPOSITE*/ await x ?? new Future.value(3); - ^" in (let final core::int #t2 = await x /* runtimeCheckType= asy::Future */ in #t2 == null ?{core::Object} asy::Future::value(3) : #t2) as{TypeError} core::int; + return let final core::int #t2 = await x /* runtimeCheckType= asy::Future */ in #t2 == null ?{FutureOr} asy::Future::value(3) : #t2; }){((core::int) → FutureOr, {onError: core::Function?}) → self::MyFuture}; - asy::Future t5 = f.{self::MyFuture::then}((core::int x) → FutureOr => invalid-expression "pkg/front_end/testcases/inference/future_then_ifNull2.dart:28:13: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - x ?? new Future.value(3)); - ^" in (let final core::int #t3 = x in #t3 == null ?{core::Object} asy::Future::value(3) : #t3) as{TypeError} FutureOr){((core::int) → FutureOr, {onError: core::Function?}) → self::MyFuture}; + asy::Future t5 = f.{self::MyFuture::then}((core::int x) → FutureOr => let final core::int #t3 = x in #t3 == null ?{FutureOr} asy::Future::value(3) : #t3){((core::int) → FutureOr, {onError: core::Function?}) → self::MyFuture}; asy::Future t6 = f.{self::MyFuture::then}((core::int x) → FutureOr { - return invalid-expression "pkg/front_end/testcases/inference/future_then_ifNull2.dart:31:43: Error: A value of type 'Object' can't be returned from a function with return type 'FutureOr'. - - 'Object' is from 'dart:core'. - return /*info:DOWN_CAST_COMPOSITE*/ x ?? new Future.value(3); - ^" in (let final core::int #t4 = x in #t4 == null ?{core::Object} asy::Future::value(3) : #t4) as{TypeError} FutureOr; + return let final core::int #t4 = x in #t4 == null ?{FutureOr} asy::Future::value(3) : #t4; }){((core::int) → FutureOr, {onError: core::Function?}) → self::MyFuture}; } static method main() → dynamic {} diff --git a/pkg/front_end/testcases/inference/future_union_async_conditional2.dart.strong.expect b/pkg/front_end/testcases/inference/future_union_async_conditional2.dart.strong.expect index aac1575f739..e884bd75934 100644 --- a/pkg/front_end/testcases/inference/future_union_async_conditional2.dart.strong.expect +++ b/pkg/front_end/testcases/inference/future_union_async_conditional2.dart.strong.expect @@ -2,18 +2,6 @@ library test; // // Problems in library: // -// pkg/front_end/testcases/inference/future_union_async_conditional2.dart:19:7: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// ? 42 -// ^ -// -// pkg/front_end/testcases/inference/future_union_async_conditional2.dart:24:5: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// ? 42 -// ^ -// // pkg/front_end/testcases/inference/future_union_async_conditional2.dart:28:39: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. // - 'Object' is from 'dart:core'. // - 'Future' is from 'dart:async'. @@ -45,18 +33,10 @@ class MyFuture extends core::Object implement return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#C9, 0, #C3, core::List::unmodifiable([timeLimit]), core::Map::unmodifiable({#C10: onTimeout}))){(core::Invocation) → dynamic} as{TypeError,ForDynamic} asy::Future; } static method g1(core::bool x) → asy::Future async /* emittedValueType= core::int */ { - return invalid-expression "pkg/front_end/testcases/inference/future_union_async_conditional2.dart:19:7: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - ? 42 - ^" in (x ?{core::Object} 42 : asy::Future::value(42)) as{TypeError} core::int; + return x ?{FutureOr} 42 : asy::Future::value(42); } static method g2(core::bool x) → asy::Future async /* emittedValueType= core::int */ - return invalid-expression "pkg/front_end/testcases/inference/future_union_async_conditional2.dart:24:5: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - ? 42 - ^" in (x ?{core::Object} 42 : asy::Future::value(42)) as{TypeError} core::int; + return x ?{FutureOr} 42 : asy::Future::value(42); static method g3(core::bool x) → asy::Future async /* emittedValueType= core::int */ { core::Object y = x ?{core::Object} 42 : asy::Future::value(42); return invalid-expression "pkg/front_end/testcases/inference/future_union_async_conditional2.dart:28:39: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. diff --git a/pkg/front_end/testcases/inference/future_union_async_conditional2.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/future_union_async_conditional2.dart.strong.transformed.expect index f373bdf145b..23e57f67a3c 100644 --- a/pkg/front_end/testcases/inference/future_union_async_conditional2.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/inference/future_union_async_conditional2.dart.strong.transformed.expect @@ -2,18 +2,6 @@ library test; // // Problems in library: // -// pkg/front_end/testcases/inference/future_union_async_conditional2.dart:19:7: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// ? 42 -// ^ -// -// pkg/front_end/testcases/inference/future_union_async_conditional2.dart:24:5: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// ? 42 -// ^ -// // pkg/front_end/testcases/inference/future_union_async_conditional2.dart:28:39: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. // - 'Object' is from 'dart:core'. // - 'Future' is from 'dart:async'. @@ -45,18 +33,10 @@ class MyFuture extends core::Object implement return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#C9, 0, #C3, core::List::unmodifiable(core::_GrowableList::_literal1(timeLimit)), core::Map::unmodifiable({#C10: onTimeout}))){(core::Invocation) → dynamic} as{TypeError,ForDynamic} asy::Future; } static method g1(core::bool x) → asy::Future async /* emittedValueType= core::int */ { - return invalid-expression "pkg/front_end/testcases/inference/future_union_async_conditional2.dart:19:7: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - ? 42 - ^" in (x ?{core::Object} 42 : asy::Future::value(42)) as{TypeError} core::int; + return x ?{FutureOr} 42 : asy::Future::value(42); } static method g2(core::bool x) → asy::Future async /* emittedValueType= core::int */ - return invalid-expression "pkg/front_end/testcases/inference/future_union_async_conditional2.dart:24:5: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - ? 42 - ^" in (x ?{core::Object} 42 : asy::Future::value(42)) as{TypeError} core::int; + return x ?{FutureOr} 42 : asy::Future::value(42); static method g3(core::bool x) → asy::Future async /* emittedValueType= core::int */ { core::Object y = x ?{core::Object} 42 : asy::Future::value(42); return invalid-expression "pkg/front_end/testcases/inference/future_union_async_conditional2.dart:28:39: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. diff --git a/pkg/front_end/testcases/inference/future_union_async_conditional2.dart.weak.expect b/pkg/front_end/testcases/inference/future_union_async_conditional2.dart.weak.expect index aac1575f739..e884bd75934 100644 --- a/pkg/front_end/testcases/inference/future_union_async_conditional2.dart.weak.expect +++ b/pkg/front_end/testcases/inference/future_union_async_conditional2.dart.weak.expect @@ -2,18 +2,6 @@ library test; // // Problems in library: // -// pkg/front_end/testcases/inference/future_union_async_conditional2.dart:19:7: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// ? 42 -// ^ -// -// pkg/front_end/testcases/inference/future_union_async_conditional2.dart:24:5: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// ? 42 -// ^ -// // pkg/front_end/testcases/inference/future_union_async_conditional2.dart:28:39: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. // - 'Object' is from 'dart:core'. // - 'Future' is from 'dart:async'. @@ -45,18 +33,10 @@ class MyFuture extends core::Object implement return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#C9, 0, #C3, core::List::unmodifiable([timeLimit]), core::Map::unmodifiable({#C10: onTimeout}))){(core::Invocation) → dynamic} as{TypeError,ForDynamic} asy::Future; } static method g1(core::bool x) → asy::Future async /* emittedValueType= core::int */ { - return invalid-expression "pkg/front_end/testcases/inference/future_union_async_conditional2.dart:19:7: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - ? 42 - ^" in (x ?{core::Object} 42 : asy::Future::value(42)) as{TypeError} core::int; + return x ?{FutureOr} 42 : asy::Future::value(42); } static method g2(core::bool x) → asy::Future async /* emittedValueType= core::int */ - return invalid-expression "pkg/front_end/testcases/inference/future_union_async_conditional2.dart:24:5: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - ? 42 - ^" in (x ?{core::Object} 42 : asy::Future::value(42)) as{TypeError} core::int; + return x ?{FutureOr} 42 : asy::Future::value(42); static method g3(core::bool x) → asy::Future async /* emittedValueType= core::int */ { core::Object y = x ?{core::Object} 42 : asy::Future::value(42); return invalid-expression "pkg/front_end/testcases/inference/future_union_async_conditional2.dart:28:39: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. diff --git a/pkg/front_end/testcases/inference/future_union_async_conditional2.dart.weak.modular.expect b/pkg/front_end/testcases/inference/future_union_async_conditional2.dart.weak.modular.expect index aac1575f739..e884bd75934 100644 --- a/pkg/front_end/testcases/inference/future_union_async_conditional2.dart.weak.modular.expect +++ b/pkg/front_end/testcases/inference/future_union_async_conditional2.dart.weak.modular.expect @@ -2,18 +2,6 @@ library test; // // Problems in library: // -// pkg/front_end/testcases/inference/future_union_async_conditional2.dart:19:7: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// ? 42 -// ^ -// -// pkg/front_end/testcases/inference/future_union_async_conditional2.dart:24:5: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// ? 42 -// ^ -// // pkg/front_end/testcases/inference/future_union_async_conditional2.dart:28:39: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. // - 'Object' is from 'dart:core'. // - 'Future' is from 'dart:async'. @@ -45,18 +33,10 @@ class MyFuture extends core::Object implement return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#C9, 0, #C3, core::List::unmodifiable([timeLimit]), core::Map::unmodifiable({#C10: onTimeout}))){(core::Invocation) → dynamic} as{TypeError,ForDynamic} asy::Future; } static method g1(core::bool x) → asy::Future async /* emittedValueType= core::int */ { - return invalid-expression "pkg/front_end/testcases/inference/future_union_async_conditional2.dart:19:7: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - ? 42 - ^" in (x ?{core::Object} 42 : asy::Future::value(42)) as{TypeError} core::int; + return x ?{FutureOr} 42 : asy::Future::value(42); } static method g2(core::bool x) → asy::Future async /* emittedValueType= core::int */ - return invalid-expression "pkg/front_end/testcases/inference/future_union_async_conditional2.dart:24:5: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - ? 42 - ^" in (x ?{core::Object} 42 : asy::Future::value(42)) as{TypeError} core::int; + return x ?{FutureOr} 42 : asy::Future::value(42); static method g3(core::bool x) → asy::Future async /* emittedValueType= core::int */ { core::Object y = x ?{core::Object} 42 : asy::Future::value(42); return invalid-expression "pkg/front_end/testcases/inference/future_union_async_conditional2.dart:28:39: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. diff --git a/pkg/front_end/testcases/inference/future_union_async_conditional2.dart.weak.transformed.expect b/pkg/front_end/testcases/inference/future_union_async_conditional2.dart.weak.transformed.expect index f373bdf145b..23e57f67a3c 100644 --- a/pkg/front_end/testcases/inference/future_union_async_conditional2.dart.weak.transformed.expect +++ b/pkg/front_end/testcases/inference/future_union_async_conditional2.dart.weak.transformed.expect @@ -2,18 +2,6 @@ library test; // // Problems in library: // -// pkg/front_end/testcases/inference/future_union_async_conditional2.dart:19:7: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// ? 42 -// ^ -// -// pkg/front_end/testcases/inference/future_union_async_conditional2.dart:24:5: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// ? 42 -// ^ -// // pkg/front_end/testcases/inference/future_union_async_conditional2.dart:28:39: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. // - 'Object' is from 'dart:core'. // - 'Future' is from 'dart:async'. @@ -45,18 +33,10 @@ class MyFuture extends core::Object implement return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#C9, 0, #C3, core::List::unmodifiable(core::_GrowableList::_literal1(timeLimit)), core::Map::unmodifiable({#C10: onTimeout}))){(core::Invocation) → dynamic} as{TypeError,ForDynamic} asy::Future; } static method g1(core::bool x) → asy::Future async /* emittedValueType= core::int */ { - return invalid-expression "pkg/front_end/testcases/inference/future_union_async_conditional2.dart:19:7: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - ? 42 - ^" in (x ?{core::Object} 42 : asy::Future::value(42)) as{TypeError} core::int; + return x ?{FutureOr} 42 : asy::Future::value(42); } static method g2(core::bool x) → asy::Future async /* emittedValueType= core::int */ - return invalid-expression "pkg/front_end/testcases/inference/future_union_async_conditional2.dart:24:5: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - ? 42 - ^" in (x ?{core::Object} 42 : asy::Future::value(42)) as{TypeError} core::int; + return x ?{FutureOr} 42 : asy::Future::value(42); static method g3(core::bool x) → asy::Future async /* emittedValueType= core::int */ { core::Object y = x ?{core::Object} 42 : asy::Future::value(42); return invalid-expression "pkg/front_end/testcases/inference/future_union_async_conditional2.dart:28:39: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. diff --git a/pkg/front_end/testcases/inference/future_union_async_conditional_2_2.dart.strong.expect b/pkg/front_end/testcases/inference/future_union_async_conditional_2_2.dart.strong.expect index 88b59c8de77..79cf45b1e58 100644 --- a/pkg/front_end/testcases/inference/future_union_async_conditional_2_2.dart.strong.expect +++ b/pkg/front_end/testcases/inference/future_union_async_conditional_2_2.dart.strong.expect @@ -2,18 +2,6 @@ library test; // // Problems in library: // -// pkg/front_end/testcases/inference/future_union_async_conditional_2_2.dart:19:7: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// ? 42 -// ^ -// -// pkg/front_end/testcases/inference/future_union_async_conditional_2_2.dart:24:5: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// ? 42 -// ^ -// // pkg/front_end/testcases/inference/future_union_async_conditional_2_2.dart:29:39: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. // - 'Object' is from 'dart:core'. // - 'Future' is from 'dart:async'. @@ -45,18 +33,10 @@ class MyFuture extends core::Object implement return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#C9, 0, #C3, core::List::unmodifiable([timeLimit]), core::Map::unmodifiable({#C10: onTimeout}))){(core::Invocation) → dynamic} as{TypeError,ForDynamic} asy::Future; } static method g1(core::bool x) → asy::Future async /* emittedValueType= core::int */ { - return invalid-expression "pkg/front_end/testcases/inference/future_union_async_conditional_2_2.dart:19:7: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - ? 42 - ^" in (x ?{core::Object} 42 : new self::MyFuture::value(42)) as{TypeError} core::int; + return x ?{FutureOr} 42 : new self::MyFuture::value(42); } static method g2(core::bool x) → asy::Future async /* emittedValueType= core::int */ - return invalid-expression "pkg/front_end/testcases/inference/future_union_async_conditional_2_2.dart:24:5: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - ? 42 - ^" in (x ?{core::Object} 42 : new self::MyFuture::value(42)) as{TypeError} core::int; + return x ?{FutureOr} 42 : new self::MyFuture::value(42); static method g3(core::bool x) → asy::Future async /* emittedValueType= core::int */ { core::Object y = x ?{core::Object} 42 : new self::MyFuture::value(42); return invalid-expression "pkg/front_end/testcases/inference/future_union_async_conditional_2_2.dart:29:39: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. diff --git a/pkg/front_end/testcases/inference/future_union_async_conditional_2_2.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/future_union_async_conditional_2_2.dart.strong.transformed.expect index f665fb968b6..ab03ea28bc3 100644 --- a/pkg/front_end/testcases/inference/future_union_async_conditional_2_2.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/inference/future_union_async_conditional_2_2.dart.strong.transformed.expect @@ -2,18 +2,6 @@ library test; // // Problems in library: // -// pkg/front_end/testcases/inference/future_union_async_conditional_2_2.dart:19:7: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// ? 42 -// ^ -// -// pkg/front_end/testcases/inference/future_union_async_conditional_2_2.dart:24:5: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// ? 42 -// ^ -// // pkg/front_end/testcases/inference/future_union_async_conditional_2_2.dart:29:39: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. // - 'Object' is from 'dart:core'. // - 'Future' is from 'dart:async'. @@ -45,18 +33,10 @@ class MyFuture extends core::Object implement return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#C9, 0, #C3, core::List::unmodifiable(core::_GrowableList::_literal1(timeLimit)), core::Map::unmodifiable({#C10: onTimeout}))){(core::Invocation) → dynamic} as{TypeError,ForDynamic} asy::Future; } static method g1(core::bool x) → asy::Future async /* emittedValueType= core::int */ { - return invalid-expression "pkg/front_end/testcases/inference/future_union_async_conditional_2_2.dart:19:7: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - ? 42 - ^" in (x ?{core::Object} 42 : new self::MyFuture::value(42)) as{TypeError} core::int; + return x ?{FutureOr} 42 : new self::MyFuture::value(42); } static method g2(core::bool x) → asy::Future async /* emittedValueType= core::int */ - return invalid-expression "pkg/front_end/testcases/inference/future_union_async_conditional_2_2.dart:24:5: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - ? 42 - ^" in (x ?{core::Object} 42 : new self::MyFuture::value(42)) as{TypeError} core::int; + return x ?{FutureOr} 42 : new self::MyFuture::value(42); static method g3(core::bool x) → asy::Future async /* emittedValueType= core::int */ { core::Object y = x ?{core::Object} 42 : new self::MyFuture::value(42); return invalid-expression "pkg/front_end/testcases/inference/future_union_async_conditional_2_2.dart:29:39: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. diff --git a/pkg/front_end/testcases/inference/future_union_async_conditional_2_2.dart.weak.expect b/pkg/front_end/testcases/inference/future_union_async_conditional_2_2.dart.weak.expect index 88b59c8de77..79cf45b1e58 100644 --- a/pkg/front_end/testcases/inference/future_union_async_conditional_2_2.dart.weak.expect +++ b/pkg/front_end/testcases/inference/future_union_async_conditional_2_2.dart.weak.expect @@ -2,18 +2,6 @@ library test; // // Problems in library: // -// pkg/front_end/testcases/inference/future_union_async_conditional_2_2.dart:19:7: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// ? 42 -// ^ -// -// pkg/front_end/testcases/inference/future_union_async_conditional_2_2.dart:24:5: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// ? 42 -// ^ -// // pkg/front_end/testcases/inference/future_union_async_conditional_2_2.dart:29:39: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. // - 'Object' is from 'dart:core'. // - 'Future' is from 'dart:async'. @@ -45,18 +33,10 @@ class MyFuture extends core::Object implement return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#C9, 0, #C3, core::List::unmodifiable([timeLimit]), core::Map::unmodifiable({#C10: onTimeout}))){(core::Invocation) → dynamic} as{TypeError,ForDynamic} asy::Future; } static method g1(core::bool x) → asy::Future async /* emittedValueType= core::int */ { - return invalid-expression "pkg/front_end/testcases/inference/future_union_async_conditional_2_2.dart:19:7: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - ? 42 - ^" in (x ?{core::Object} 42 : new self::MyFuture::value(42)) as{TypeError} core::int; + return x ?{FutureOr} 42 : new self::MyFuture::value(42); } static method g2(core::bool x) → asy::Future async /* emittedValueType= core::int */ - return invalid-expression "pkg/front_end/testcases/inference/future_union_async_conditional_2_2.dart:24:5: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - ? 42 - ^" in (x ?{core::Object} 42 : new self::MyFuture::value(42)) as{TypeError} core::int; + return x ?{FutureOr} 42 : new self::MyFuture::value(42); static method g3(core::bool x) → asy::Future async /* emittedValueType= core::int */ { core::Object y = x ?{core::Object} 42 : new self::MyFuture::value(42); return invalid-expression "pkg/front_end/testcases/inference/future_union_async_conditional_2_2.dart:29:39: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. diff --git a/pkg/front_end/testcases/inference/future_union_async_conditional_2_2.dart.weak.modular.expect b/pkg/front_end/testcases/inference/future_union_async_conditional_2_2.dart.weak.modular.expect index 88b59c8de77..79cf45b1e58 100644 --- a/pkg/front_end/testcases/inference/future_union_async_conditional_2_2.dart.weak.modular.expect +++ b/pkg/front_end/testcases/inference/future_union_async_conditional_2_2.dart.weak.modular.expect @@ -2,18 +2,6 @@ library test; // // Problems in library: // -// pkg/front_end/testcases/inference/future_union_async_conditional_2_2.dart:19:7: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// ? 42 -// ^ -// -// pkg/front_end/testcases/inference/future_union_async_conditional_2_2.dart:24:5: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// ? 42 -// ^ -// // pkg/front_end/testcases/inference/future_union_async_conditional_2_2.dart:29:39: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. // - 'Object' is from 'dart:core'. // - 'Future' is from 'dart:async'. @@ -45,18 +33,10 @@ class MyFuture extends core::Object implement return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#C9, 0, #C3, core::List::unmodifiable([timeLimit]), core::Map::unmodifiable({#C10: onTimeout}))){(core::Invocation) → dynamic} as{TypeError,ForDynamic} asy::Future; } static method g1(core::bool x) → asy::Future async /* emittedValueType= core::int */ { - return invalid-expression "pkg/front_end/testcases/inference/future_union_async_conditional_2_2.dart:19:7: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - ? 42 - ^" in (x ?{core::Object} 42 : new self::MyFuture::value(42)) as{TypeError} core::int; + return x ?{FutureOr} 42 : new self::MyFuture::value(42); } static method g2(core::bool x) → asy::Future async /* emittedValueType= core::int */ - return invalid-expression "pkg/front_end/testcases/inference/future_union_async_conditional_2_2.dart:24:5: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - ? 42 - ^" in (x ?{core::Object} 42 : new self::MyFuture::value(42)) as{TypeError} core::int; + return x ?{FutureOr} 42 : new self::MyFuture::value(42); static method g3(core::bool x) → asy::Future async /* emittedValueType= core::int */ { core::Object y = x ?{core::Object} 42 : new self::MyFuture::value(42); return invalid-expression "pkg/front_end/testcases/inference/future_union_async_conditional_2_2.dart:29:39: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. diff --git a/pkg/front_end/testcases/inference/future_union_async_conditional_2_2.dart.weak.transformed.expect b/pkg/front_end/testcases/inference/future_union_async_conditional_2_2.dart.weak.transformed.expect index f665fb968b6..ab03ea28bc3 100644 --- a/pkg/front_end/testcases/inference/future_union_async_conditional_2_2.dart.weak.transformed.expect +++ b/pkg/front_end/testcases/inference/future_union_async_conditional_2_2.dart.weak.transformed.expect @@ -2,18 +2,6 @@ library test; // // Problems in library: // -// pkg/front_end/testcases/inference/future_union_async_conditional_2_2.dart:19:7: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// ? 42 -// ^ -// -// pkg/front_end/testcases/inference/future_union_async_conditional_2_2.dart:24:5: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. -// - 'Object' is from 'dart:core'. -// - 'Future' is from 'dart:async'. -// ? 42 -// ^ -// // pkg/front_end/testcases/inference/future_union_async_conditional_2_2.dart:29:39: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. // - 'Object' is from 'dart:core'. // - 'Future' is from 'dart:async'. @@ -45,18 +33,10 @@ class MyFuture extends core::Object implement return this.{self::MyFuture::noSuchMethod}(new core::_InvocationMirror::_withType(#C9, 0, #C3, core::List::unmodifiable(core::_GrowableList::_literal1(timeLimit)), core::Map::unmodifiable({#C10: onTimeout}))){(core::Invocation) → dynamic} as{TypeError,ForDynamic} asy::Future; } static method g1(core::bool x) → asy::Future async /* emittedValueType= core::int */ { - return invalid-expression "pkg/front_end/testcases/inference/future_union_async_conditional_2_2.dart:19:7: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - ? 42 - ^" in (x ?{core::Object} 42 : new self::MyFuture::value(42)) as{TypeError} core::int; + return x ?{FutureOr} 42 : new self::MyFuture::value(42); } static method g2(core::bool x) → asy::Future async /* emittedValueType= core::int */ - return invalid-expression "pkg/front_end/testcases/inference/future_union_async_conditional_2_2.dart:24:5: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. - - 'Object' is from 'dart:core'. - - 'Future' is from 'dart:async'. - ? 42 - ^" in (x ?{core::Object} 42 : new self::MyFuture::value(42)) as{TypeError} core::int; + return x ?{FutureOr} 42 : new self::MyFuture::value(42); static method g3(core::bool x) → asy::Future async /* emittedValueType= core::int */ { core::Object y = x ?{core::Object} 42 : new self::MyFuture::value(42); return invalid-expression "pkg/front_end/testcases/inference/future_union_async_conditional_2_2.dart:29:39: Error: A value of type 'Object' can't be returned from an async function with return type 'Future'. diff --git a/runtime/vm/experimental_features.cc b/runtime/vm/experimental_features.cc index ff67a54103b..0bd06934e2b 100644 --- a/runtime/vm/experimental_features.cc +++ b/runtime/vm/experimental_features.cc @@ -17,7 +17,7 @@ namespace dart { bool GetExperimentalFeatureDefault(ExperimentalFeature feature) { constexpr bool kFeatureValues[] = { true, true, true, true, true, true, true, true, true, true, true, - true, true, true, true, true, true, true, true, true, true, + true, true, true, true, true, true, true, true, true, true, true, }; ASSERT(static_cast(feature) < ARRAY_SIZE(kFeatureValues)); return kFeatureValues[static_cast(feature)]; @@ -25,6 +25,7 @@ bool GetExperimentalFeatureDefault(ExperimentalFeature feature) { const char* GetExperimentalFeatureName(ExperimentalFeature feature) { constexpr const char* kFeatureNames[] = { + "inference-update-3", "inline-class", "inference-update-2", "sealed-class", diff --git a/runtime/vm/experimental_features.h b/runtime/vm/experimental_features.h index 7e85347428f..64338256648 100644 --- a/runtime/vm/experimental_features.h +++ b/runtime/vm/experimental_features.h @@ -12,6 +12,7 @@ namespace dart { enum class ExperimentalFeature { + inference_update_3, inline_class, inference_update_2, sealed_class, diff --git a/tools/experimental_features.yaml b/tools/experimental_features.yaml index 123029bfb1c..b55ef9a8e60 100644 --- a/tools/experimental_features.yaml +++ b/tools/experimental_features.yaml @@ -128,9 +128,6 @@ features: resource-identifiers: help: "Output arguments used by static functions." - inference-update-3: # See https://github.com/dart-lang/language/issues/1618 - help: "Better handling of conditional expressions, and switch expressions." - # Experiment flag only used for testing. test-experiment: help: >- @@ -144,6 +141,20 @@ features: # Shipped flags should be marked retired the following stable release. # + inference-update-3: # See https://github.com/dart-lang/language/issues/1618 + enabledIn: '3.4.0' + validation: | + class A {} + class B1 implements A {} + class B2 implements A {} + class C1 implements B1, B2 {} + class C2 implements B1, B2 {} + B1 test(bool b, C1 c1, C2 c2) => b ? c1 : c2; + main() { + print('feature enabled'); + } + help: "Better handling of conditional expressions, and switch expressions." + inline-class: enabledIn: '3.3.0' validation: |