diff --git a/TypeSystem/inference/function_literal_inference_A02_t09.dart b/TypeSystem/inference/function_literal_inference_A02_t09.dart new file mode 100644 index 0000000000..5f889326a2 --- /dev/null +++ b/TypeSystem/inference/function_literal_inference_A02_t09.dart @@ -0,0 +1,533 @@ +// Copyright (c) 2026, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// @assertion The actual returned type of a function literal with a block body +/// is computed as follows. Let `T` be `Never` if every control path through the +/// block exits the block without reaching the end of the block, as computed by +/// the definite completion analysis specified elsewhere. Let `T` be `Null` if +/// any control path reaches the end of the block without exiting the block, as +/// computed by the definite completion analysis specified elsewhere. Let `K` be +/// the typing context for the function body as computed above from the imposed +/// return type schema. +/// - For each `return e;` statement in the block, let `S` be the inferred type +/// of `e`, using the local type inference algorithm described below with +/// typing context `K`, and update `T` to be `UP(flatten(S), T)` if the +/// enclosing function is `async`, or `UP(S, T)` otherwise. +/// ... +/// The actual returned type of the function literal is the value of `T` after +/// all `return` and `yield` statements in the block body have been considered. +/// +/// @description Check that the actual returned type of a function literal is +/// the value of `T` after all `return`statements in the block body have been +/// considered. +/// @author sgrekhov22@gmail.com + +import '../../Utils/static_type_helper.dart'; + +var f1 = () { + if (1 > 2) { + return 0; + } + return 3.14; +}; +var f2 = () { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return null; +}; +var f3 = () { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return 'x'; +}; +var f4 = () { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return Future.value(null); +}; +var f5 = () { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return [42]; +}; + +class C { + static var sf1 = () { + if (1 > 2) { + return 0; + } + return 3.14; + }; + static var sf2 = () { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return null; + }; + static var sf3 = () { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return 'x'; + }; + static var sf4 = () { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return Future.value(null); + }; + static var sf5 = () { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return [42]; + }; + + var f1 = () { + if (1 > 2) { + return 0; + } + return 3.14; + }; + var f2 = () { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return null; + }; + var f3 = () { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return 'x'; + }; + var f4 = () { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return Future.value(null); + }; + var f5 = () { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return [42]; + }; +} + +mixin M { + static var sf1 = () { + if (1 > 2) { + return 0; + } + return 3.14; + }; + static var sf2 = () { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return null; + }; + static var sf3 = () { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return 'x'; + }; + static var sf4 = () { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return Future.value(null); + }; + static var sf5 = () { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return [42]; + }; + + var f1 = () { + if (1 > 2) { + return 0; + } + return 3.14; + }; + var f2 = () { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return null; + }; + var f3 = () { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return 'x'; + }; + var f4 = () { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return Future.value(null); + }; + var f5 = () { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return [42]; + }; +} + +mixin class MC { + static var sf1 = () { + if (1 > 2) { + return 0; + } + return 3.14; + }; + static var sf2 = () { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return null; + }; + static var sf3 = () { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return 'x'; + }; + static var sf4 = () { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return Future.value(null); + }; + static var sf5 = () { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return [42]; + }; + + var f1 = () { + if (1 > 2) { + return 0; + } + return 3.14; + }; + var f2 = () { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return null; + }; + var f3 = () { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return 'x'; + }; + var f4 = () { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return Future.value(null); + }; + var f5 = () { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return [42]; + }; +} + +enum E { + e0; + + static var sf1 = () { + if (1 > 2) { + return 0; + } + return 3.14; + }; + static var sf2 = () { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return null; + }; + static var sf3 = () { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return 'x'; + }; + static var sf4 = () { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return Future.value(null); + }; + static var sf5 = () { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return [42]; + }; +} + +class A {} + +extension Ext on A { + static var sf1 = () { + if (1 > 2) { + return 0; + } + return 3.14; + }; + static var sf2 = () { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return null; + }; + static var sf3 = () { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return 'x'; + }; + static var sf4 = () { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return Future.value(null); + }; + static var sf5 = () { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return [42]; + }; +} + +extension type ET(int _) { + static var sf1 = () { + if (1 > 2) { + return 0; + } + return 3.14; + }; + static var sf2 = () { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return null; + }; + static var sf3 = () { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return 'x'; + }; + static var sf4 = () { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return Future.value(null); + }; + static var sf5 = () { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return [42]; + }; +} + +class MA = Object with M; + +main() { + f1.expectStaticType>(); + f2.expectStaticType>(); + f3.expectStaticType>(); + f4.expectStaticType>(); + f5.expectStaticType>(); + + C.sf1.expectStaticType>(); + C.sf2.expectStaticType>(); + C.sf3.expectStaticType>(); + C.sf4.expectStaticType>(); + C.sf5.expectStaticType>(); + C().f1.expectStaticType>(); + C().f2.expectStaticType>(); + C().f3.expectStaticType>(); + C().f4.expectStaticType>(); + C().f5.expectStaticType>(); + + M.sf1.expectStaticType>(); + M.sf2.expectStaticType>(); + M.sf3.expectStaticType>(); + M.sf4.expectStaticType>(); + M.sf5.expectStaticType>(); + MA().f1.expectStaticType>(); + MA().f2.expectStaticType>(); + MA().f3.expectStaticType>(); + MA().f4.expectStaticType>(); + MA().f5.expectStaticType>(); + + MC.sf1.expectStaticType>(); + MC.sf2.expectStaticType>(); + MC.sf3.expectStaticType>(); + MC.sf4.expectStaticType>(); + MC.sf5.expectStaticType>(); + MC().f1.expectStaticType>(); + MC().f2.expectStaticType>(); + MC().f3.expectStaticType>(); + MC().f4.expectStaticType>(); + MC().f5.expectStaticType>(); + + E.sf1.expectStaticType>(); + E.sf2.expectStaticType>(); + E.sf3.expectStaticType>(); + E.sf4.expectStaticType>(); + E.sf5.expectStaticType>(); + + Ext.sf1.expectStaticType>(); + Ext.sf2.expectStaticType>(); + Ext.sf3.expectStaticType>(); + Ext.sf4.expectStaticType>(); + Ext.sf5.expectStaticType>(); + + ET.sf1.expectStaticType>(); + ET.sf2.expectStaticType>(); + ET.sf3.expectStaticType>(); + ET.sf4.expectStaticType>(); + ET.sf5.expectStaticType>(); +} diff --git a/TypeSystem/inference/function_literal_inference_A02_t10.dart b/TypeSystem/inference/function_literal_inference_A02_t10.dart new file mode 100644 index 0000000000..5ce61438a7 --- /dev/null +++ b/TypeSystem/inference/function_literal_inference_A02_t10.dart @@ -0,0 +1,533 @@ +// Copyright (c) 2026, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// @assertion The actual returned type of a function literal with a block body +/// is computed as follows. Let `T` be `Never` if every control path through the +/// block exits the block without reaching the end of the block, as computed by +/// the definite completion analysis specified elsewhere. Let `T` be `Null` if +/// any control path reaches the end of the block without exiting the block, as +/// computed by the definite completion analysis specified elsewhere. Let `K` be +/// the typing context for the function body as computed above from the imposed +/// return type schema. +/// - For each `return e;` statement in the block, let `S` be the inferred type +/// of `e`, using the local type inference algorithm described below with +/// typing context `K`, and update `T` to be `UP(flatten(S), T)` if the +/// enclosing function is `async`, or `UP(S, T)` otherwise. +/// ... +/// The actual returned type of the function literal is the value of `T` after +/// all `return` and `yield` statements in the block body have been considered. +/// +/// @description Check that the actual returned type of a function literal is +/// the value of `T` after all `return` statements in the block body have been +/// considered. Test an async function literal. +/// @author sgrekhov22@gmail.com + +import '../../Utils/static_type_helper.dart'; + +var f1 = () async { + if (1 > 2) { + return 0; + } + return 3.14; +}; +var f2 = () async { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return null; +}; +var f3 = () async { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return 'x'; +}; +var f4 = () async { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return Future.value(null); +}; +var f5 = () async { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return [42]; +}; + +class C { + static var sf1 = () async { + if (1 > 2) { + return 0; + } + return 3.14; + }; + static var sf2 = () async { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return null; + }; + static var sf3 = () async { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return 'x'; + }; + static var sf4 = () async { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return Future.value(null); + }; + static var sf5 = () async { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return [42]; + }; + + var f1 = () async { + if (1 > 2) { + return 0; + } + return 3.14; + }; + var f2 = () async { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return null; + }; + var f3 = () async { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return 'x'; + }; + var f4 = () async { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return Future.value(null); + }; + var f5 = () async { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return [42]; + }; +} + +mixin M { + static var sf1 = () async { + if (1 > 2) { + return 0; + } + return 3.14; + }; + static var sf2 = () async { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return null; + }; + static var sf3 = () async { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return 'x'; + }; + static var sf4 = () async { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return Future.value(null); + }; + static var sf5 = () async { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return [42]; + }; + + var f1 = () async { + if (1 > 2) { + return 0; + } + return 3.14; + }; + var f2 = () async { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return null; + }; + var f3 = () async { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return 'x'; + }; + var f4 = () async { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return Future.value(null); + }; + var f5 = () async { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return [42]; + }; +} + +mixin class MC { + static var sf1 = () async { + if (1 > 2) { + return 0; + } + return 3.14; + }; + static var sf2 = () async { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return null; + }; + static var sf3 = () async { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return 'x'; + }; + static var sf4 = () async { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return Future.value(null); + }; + static var sf5 = () async { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return [42]; + }; + + var f1 = () async { + if (1 > 2) { + return 0; + } + return 3.14; + }; + var f2 = () async { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return null; + }; + var f3 = () async { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return 'x'; + }; + var f4 = () async { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return Future.value(null); + }; + var f5 = () async { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return [42]; + }; +} + +enum E { + e0; + + static var sf1 = () async { + if (1 > 2) { + return 0; + } + return 3.14; + }; + static var sf2 = () async { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return null; + }; + static var sf3 = () async { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return 'x'; + }; + static var sf4 = () async { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return Future.value(null); + }; + static var sf5 = () async { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return [42]; + }; +} + +class A {} + +extension Ext on A { + static var sf1 = () async { + if (1 > 2) { + return 0; + } + return 3.14; + }; + static var sf2 = () async { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return null; + }; + static var sf3 = () async { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return 'x'; + }; + static var sf4 = () async { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return Future.value(null); + }; + static var sf5 = () async { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return [42]; + }; +} + +extension type ET(int _) { + static var sf1 = () async { + if (1 > 2) { + return 0; + } + return 3.14; + }; + static var sf2 = () async { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return null; + }; + static var sf3 = () async { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return 'x'; + }; + static var sf4 = () async { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return Future.value(null); + }; + static var sf5 = () async { + if (1 > 2) { + return 0; + } + if (1 > 2) { + return 3.14; + } + return [42]; + }; +} + +class MA = Object with M; + +main() { + f1.expectStaticType Function()>>(); + f2.expectStaticType Function()>>(); + f3.expectStaticType Function()>>(); + f4.expectStaticType Function()>>(); + f5.expectStaticType Function()>>(); + + C.sf1.expectStaticType Function()>>(); + C.sf2.expectStaticType Function()>>(); + C.sf3.expectStaticType Function()>>(); + C.sf4.expectStaticType Function()>>(); + C.sf5.expectStaticType Function()>>(); + C().f1.expectStaticType Function()>>(); + C().f2.expectStaticType Function()>>(); + C().f3.expectStaticType Function()>>(); + C().f4.expectStaticType Function()>>(); + C().f5.expectStaticType Function()>>(); + + M.sf1.expectStaticType Function()>>(); + M.sf2.expectStaticType Function()>>(); + M.sf3.expectStaticType Function()>>(); + M.sf4.expectStaticType Function()>>(); + M.sf5.expectStaticType Function()>>(); + MA().f1.expectStaticType Function()>>(); + MA().f2.expectStaticType Function()>>(); + MA().f3.expectStaticType Function()>>(); + MA().f4.expectStaticType Function()>>(); + MA().f5.expectStaticType Function()>>(); + + MC.sf1.expectStaticType Function()>>(); + MC.sf2.expectStaticType Function()>>(); + MC.sf3.expectStaticType Function()>>(); + MC.sf4.expectStaticType Function()>>(); + MC.sf5.expectStaticType Function()>>(); + MC().f1.expectStaticType Function()>>(); + MC().f2.expectStaticType Function()>>(); + MC().f3.expectStaticType Function()>>(); + MC().f4.expectStaticType Function()>>(); + MC().f5.expectStaticType Function()>>(); + + E.sf1.expectStaticType Function()>>(); + E.sf2.expectStaticType Function()>>(); + E.sf3.expectStaticType Function()>>(); + E.sf4.expectStaticType Function()>>(); + E.sf5.expectStaticType Function()>>(); + + Ext.sf1.expectStaticType Function()>>(); + Ext.sf2.expectStaticType Function()>>(); + Ext.sf3.expectStaticType Function()>>(); + Ext.sf4.expectStaticType Function()>>(); + Ext.sf5.expectStaticType Function()>>(); + + ET.sf1.expectStaticType Function()>>(); + ET.sf2.expectStaticType Function()>>(); + ET.sf3.expectStaticType Function()>>(); + ET.sf4.expectStaticType Function()>>(); + ET.sf5.expectStaticType Function()>>(); +} diff --git a/TypeSystem/inference/function_literal_inference_A06_lib1.dart b/TypeSystem/inference/function_literal_inference_A06_lib1.dart new file mode 100644 index 0000000000..d59022fb8e --- /dev/null +++ b/TypeSystem/inference/function_literal_inference_A06_lib1.dart @@ -0,0 +1,257 @@ +// Copyright (c) 2026, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// @assertion Let `T` be the actual returned type of a function literal as +/// computed above. Let `R` be the greatest closure of the typing context `K` as +/// computed above. +/// +/// With null safety: if `R` is `void`, or the function literal is marked +/// `async` and `R` is `FutureOr`, let `S` be `void`. +/// +/// Otherwise, if `T <: R` then let `S` be `T`. Otherwise, let `S` be `R`. The +/// inferred return type of the function literal is then defined as follows: +/// - If the function literal is marked `async` then the inferred return type is +/// `Future`. +/// - If the function literal is marked `async*` then the inferred return type +/// is `Stream`. +/// - If the function literal is marked `sync*` then the inferred return type is +/// `Iterable`. +/// - Otherwise, the inferred return type is `S`. +/// +/// @description Check that if actual return type is `void`, then the inferred +/// return type of the function literal is `void`. +/// @author sgrekhov22@gmail.com + +void getVoid() {} + +var f1 = () { + return getVoid(); +}; +var f2 = () { + if (1 > 2) { + return getVoid(); + } +}; +var f3 = () { + if (1 > 2) { + return 42 as dynamic; + } + return getVoid(); +}; +var f4 = () { + if (1 > 2) { + return null; + } + return getVoid(); +}; + +class C { + static var sf1 = () { + return getVoid(); + }; + static var sf2 = () { + if (1 > 2) { + return getVoid(); + } + }; + static var sf3 = () { + if (1 > 2) { + return 42 as dynamic; + } + return getVoid(); + }; + static var sf4 = () { + if (1 > 2) { + return null; + } + return getVoid(); + }; + + + var f1 = () { + return getVoid(); + }; + var f2 = () { + if (1 > 2) { + return getVoid(); + } + }; + var f3 = () { + if (1 > 2) { + return 42 as dynamic; + } + return getVoid(); + }; + var f4 = () { + if (1 > 2) { + return null; + } + return getVoid(); + }; +} + +mixin M { + static var sf1 = () { + return getVoid(); + }; + static var sf2 = () { + if (1 > 2) { + return getVoid(); + } + }; + static var sf3 = () { + if (1 > 2) { + return 42 as dynamic; + } + return getVoid(); + }; + static var sf4 = () { + if (1 > 2) { + return null; + } + return getVoid(); + }; + + + var f1 = () { + return getVoid(); + }; + var f2 = () { + if (1 > 2) { + return getVoid(); + } + }; + var f3 = () { + if (1 > 2) { + return 42 as dynamic; + } + return getVoid(); + }; + var f4 = () { + if (1 > 2) { + return null; + } + return getVoid(); + }; +} + +mixin class MC { + static var sf1 = () { + return getVoid(); + }; + static var sf2 = () { + if (1 > 2) { + return getVoid(); + } + }; + static var sf3 = () { + if (1 > 2) { + return 42 as dynamic; + } + return getVoid(); + }; + static var sf4 = () { + if (1 > 2) { + return null; + } + return getVoid(); + }; + + + var f1 = () { + return getVoid(); + }; + var f2 = () { + if (1 > 2) { + return getVoid(); + } + }; + var f3 = () { + if (1 > 2) { + return 42 as dynamic; + } + return getVoid(); + }; + var f4 = () { + if (1 > 2) { + return null; + } + return getVoid(); + }; +} + +enum E { + e0; + + static var sf1 = () { + return getVoid(); + }; + static var sf2 = () { + if (1 > 2) { + return getVoid(); + } + }; + static var sf3 = () { + if (1 > 2) { + return 42 as dynamic; + } + return getVoid(); + }; + static var sf4 = () { + if (1 > 2) { + return null; + } + return getVoid(); + }; +} + +class A {} + +extension Ext on A { + static var sf1 = () { + return getVoid(); + }; + static var sf2 = () { + if (1 > 2) { + return getVoid(); + } + }; + static var sf3 = () { + if (1 > 2) { + return 42 as dynamic; + } + return getVoid(); + }; + static var sf4 = () { + if (1 > 2) { + return null; + } + return getVoid(); + }; +} + +extension type ET(int _) { + static var sf1 = () { + return getVoid(); + }; + static var sf2 = () { + if (1 > 2) { + return getVoid(); + } + }; + static var sf3 = () { + if (1 > 2) { + return 42 as dynamic; + } + return getVoid(); + }; + static var sf4 = () { + if (1 > 2) { + return null; + } + return getVoid(); + }; +} + +class MA = Object with M; diff --git a/TypeSystem/inference/function_literal_inference_A06_lib2.dart b/TypeSystem/inference/function_literal_inference_A06_lib2.dart new file mode 100644 index 0000000000..eac64fa426 --- /dev/null +++ b/TypeSystem/inference/function_literal_inference_A06_lib2.dart @@ -0,0 +1,436 @@ +// Copyright (c) 2026, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// @assertion Let `T` be the actual returned type of a function literal as +/// computed above. Let `R` be the greatest closure of the typing context `K` as +/// computed above. +/// +/// With null safety: if `R` is `void`, or the function literal is marked +/// `async` and `R` is `FutureOr`, let `S` be `void`. +/// +/// Otherwise, if `T <: R` then let `S` be `T`. Otherwise, let `S` be `R`. The +/// inferred return type of the function literal is then defined as follows: +/// - If the function literal is marked `async` then the inferred return type is +/// `Future`. +/// - If the function literal is marked `async*` then the inferred return type +/// is `Stream`. +/// - If the function literal is marked `sync*` then the inferred return type is +/// `Iterable`. +/// - Otherwise, the inferred return type is `S`. +/// +/// @description Check that if actual return type is `void` and the function +/// literal is marked `async`, then the inferred return type of the function +/// literal is `Future`. +/// @author sgrekhov22@gmail.com + +void getVoid() {} +Future getFutureVoid() async {} + +var f1 = () async { + return getVoid(); +}; +var f2 = () async { + if (1 > 2) { + return getVoid(); + } +}; +var f3 = () async { + if (1 > 2) { + return 42 as dynamic; + } + return getVoid(); +}; +var f4 = () async { + if (1 > 2) { + return null; + } + return getVoid(); +}; +var f5 = () async { + if (1 > 2) { + return getFutureVoid(); + } + return getVoid(); +}; +var f6 = () async { + if (1 > 2) { + return Future.value(null); + } + return getVoid(); +}; +var f7 = () async { + if (1 > 2) { + return Future.value(42); + } + return getVoid(); +}; + +class C { + static var sf1 = () async { + return getVoid(); + }; + static var sf2 = () async { + if (1 > 2) { + return getVoid(); + } + }; + static var sf3 = () async { + if (1 > 2) { + return 42 as dynamic; + } + return getVoid(); + }; + static var sf4 = () async { + if (1 > 2) { + return null; + } + return getVoid(); + }; + static var sf5 = () async { + if (1 > 2) { + return getFutureVoid(); + } + return getVoid(); + }; + static var sf6 = () async { + if (1 > 2) { + return Future.value(null); + } + return getVoid(); + }; + static var sf7 = () async { + if (1 > 2) { + return Future.value(42); + } + return getVoid(); + }; + + var f1 = () async { + return getVoid(); + }; + var f2 = () async { + if (1 > 2) { + return getVoid(); + } + }; + var f3 = () async { + if (1 > 2) { + return 42 as dynamic; + } + return getVoid(); + }; + var f4 = () async { + if (1 > 2) { + return null; + } + return getVoid(); + }; + var f5 = () async { + if (1 > 2) { + return getFutureVoid(); + } + return getVoid(); + }; + var f6 = () async { + if (1 > 2) { + return Future.value(null); + } + return getVoid(); + }; + var f7 = () async { + if (1 > 2) { + return Future.value(42); + } + return getVoid(); + }; +} + +mixin M { + static var sf1 = () async { + return getVoid(); + }; + static var sf2 = () async { + if (1 > 2) { + return getVoid(); + } + }; + static var sf3 = () async { + if (1 > 2) { + return 42 as dynamic; + } + return getVoid(); + }; + static var sf4 = () async { + if (1 > 2) { + return null; + } + return getVoid(); + }; + static var sf5 = () async { + if (1 > 2) { + return getFutureVoid(); + } + return getVoid(); + }; + static var sf6 = () async { + if (1 > 2) { + return Future.value(null); + } + return getVoid(); + }; + static var sf7 = () async { + if (1 > 2) { + return Future.value(42); + } + return getVoid(); + }; + + var f1 = () async { + return getVoid(); + }; + var f2 = () async { + if (1 > 2) { + return getVoid(); + } + }; + var f3 = () async { + if (1 > 2) { + return 42 as dynamic; + } + return getVoid(); + }; + var f4 = () async { + if (1 > 2) { + return null; + } + return getVoid(); + }; + var f5 = () async { + if (1 > 2) { + return getFutureVoid(); + } + return getVoid(); + }; + var f6 = () async { + if (1 > 2) { + return Future.value(null); + } + return getVoid(); + }; + var f7 = () async { + if (1 > 2) { + return Future.value(42); + } + return getVoid(); + }; +} + +mixin class MC { + static var sf1 = () async { + return getVoid(); + }; + static var sf2 = () async { + if (1 > 2) { + return getVoid(); + } + }; + static var sf3 = () async { + if (1 > 2) { + return 42 as dynamic; + } + return getVoid(); + }; + static var sf4 = () async { + if (1 > 2) { + return null; + } + return getVoid(); + }; + static var sf5 = () async { + if (1 > 2) { + return getFutureVoid(); + } + return getVoid(); + }; + static var sf6 = () async { + if (1 > 2) { + return Future.value(null); + } + return getVoid(); + }; + static var sf7 = () async { + if (1 > 2) { + return Future.value(42); + } + return getVoid(); + }; + + var f1 = () async { + return getVoid(); + }; + var f2 = () async { + if (1 > 2) { + return getVoid(); + } + }; + var f3 = () async { + if (1 > 2) { + return 42 as dynamic; + } + return getVoid(); + }; + var f4 = () async { + if (1 > 2) { + return null; + } + return getVoid(); + }; + var f5 = () async { + if (1 > 2) { + return getFutureVoid(); + } + return getVoid(); + }; + var f6 = () async { + if (1 > 2) { + return Future.value(null); + } + return getVoid(); + }; + var f7 = () async { + if (1 > 2) { + return Future.value(42); + } + return getVoid(); + }; +} + +enum E { + e0; + + static var sf1 = () async { + return getVoid(); + }; + static var sf2 = () async { + if (1 > 2) { + return getVoid(); + } + }; + static var sf3 = () async { + if (1 > 2) { + return 42 as dynamic; + } + return getVoid(); + }; + static var sf4 = () async { + if (1 > 2) { + return null; + } + return getVoid(); + }; + static var sf5 = () async { + if (1 > 2) { + return getFutureVoid(); + } + return getVoid(); + }; + static var sf6 = () async { + if (1 > 2) { + return Future.value(null); + } + return getVoid(); + }; + static var sf7 = () async { + if (1 > 2) { + return Future.value(42); + } + return getVoid(); + }; +} + +class A {} + +extension Ext on A { + static var sf1 = () async { + return getVoid(); + }; + static var sf2 = () async { + if (1 > 2) { + return getVoid(); + } + }; + static var sf3 = () async { + if (1 > 2) { + return 42 as dynamic; + } + return getVoid(); + }; + static var sf4 = () async { + if (1 > 2) { + return null; + } + return getVoid(); + }; + static var sf5 = () async { + if (1 > 2) { + return getFutureVoid(); + } + return getVoid(); + }; + static var sf6 = () async { + if (1 > 2) { + return Future.value(null); + } + return getVoid(); + }; + static var sf7 = () async { + if (1 > 2) { + return Future.value(42); + } + return getVoid(); + }; +} + +extension type ET(int _) { + static var sf1 = () async { + return getVoid(); + }; + static var sf2 = () async { + if (1 > 2) { + return getVoid(); + } + }; + static var sf3 = () async { + if (1 > 2) { + return 42 as dynamic; + } + return getVoid(); + }; + static var sf4 = () async { + if (1 > 2) { + return null; + } + return getVoid(); + }; + static var sf5 = () async { + if (1 > 2) { + return getFutureVoid(); + } + return getVoid(); + }; + static var sf6 = () async { + if (1 > 2) { + return Future.value(null); + } + return getVoid(); + }; + static var sf7 = () async { + if (1 > 2) { + return Future.value(42); + } + return getVoid(); + }; +} + +class MA = Object with M; diff --git a/TypeSystem/inference/function_literal_inference_A06_lib3.dart b/TypeSystem/inference/function_literal_inference_A06_lib3.dart new file mode 100644 index 0000000000..df4c8bedce --- /dev/null +++ b/TypeSystem/inference/function_literal_inference_A06_lib3.dart @@ -0,0 +1,436 @@ +// Copyright (c) 2026, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// @assertion Let `T` be the actual returned type of a function literal as +/// computed above. Let `R` be the greatest closure of the typing context `K` as +/// computed above. +/// +/// With null safety: if `R` is `void`, or the function literal is marked +/// `async` and `R` is `FutureOr`, let `S` be `void`. +/// +/// Otherwise, if `T <: R` then let `S` be `T`. Otherwise, let `S` be `R`. The +/// inferred return type of the function literal is then defined as follows: +/// - If the function literal is marked `async` then the inferred return type is +/// `Future`. +/// - If the function literal is marked `async*` then the inferred return type +/// is `Stream`. +/// - If the function literal is marked `sync*` then the inferred return type is +/// `Iterable`. +/// - Otherwise, the inferred return type is `S`. +/// +/// @description Check that if actual return type is `Future` and the +/// function literal is marked `async`, then the inferred return type of the +/// function literal is `Future`. +/// @author sgrekhov22@gmail.com + +void getVoid() {} +Future getFutureVoid() async {} + +var f1 = () async { + return getFutureVoid(); +}; +var f2 = () async { + if (1 > 2) { + return getFutureVoid(); + } +}; +var f3 = () async { + if (1 > 2) { + return 42 as dynamic; + } + return getFutureVoid(); +}; +var f4 = () async { + if (1 > 2) { + return null; + } + return getFutureVoid(); +}; +var f5 = () async { + if (1 > 2) { + return getVoid(); + } + return getFutureVoid(); +}; +var f6 = () async { + if (1 > 2) { + return Future.value(null); + } + return getFutureVoid(); +}; +var f7 = () async { + if (1 > 2) { + return Future.value(42); + } + return getFutureVoid(); +}; + +class C { + static var sf1 = () async { + return getFutureVoid(); + }; + static var sf2 = () async { + if (1 > 2) { + return getFutureVoid(); + } + }; + static var sf3 = () async { + if (1 > 2) { + return 42 as dynamic; + } + return getFutureVoid(); + }; + static var sf4 = () async { + if (1 > 2) { + return null; + } + return getFutureVoid(); + }; + static var sf5 = () async { + if (1 > 2) { + return getVoid(); + } + return getFutureVoid(); + }; + static var sf6 = () async { + if (1 > 2) { + return Future.value(null); + } + return getFutureVoid(); + }; + static var sf7 = () async { + if (1 > 2) { + return Future.value(42); + } + return getFutureVoid(); + }; + + var f1 = () async { + return getFutureVoid(); + }; + var f2 = () async { + if (1 > 2) { + return getFutureVoid(); + } + }; + var f3 = () async { + if (1 > 2) { + return 42 as dynamic; + } + return getFutureVoid(); + }; + var f4 = () async { + if (1 > 2) { + return null; + } + return getFutureVoid(); + }; + var f5 = () async { + if (1 > 2) { + return getVoid(); + } + return getFutureVoid(); + }; + var f6 = () async { + if (1 > 2) { + return Future.value(null); + } + return getFutureVoid(); + }; + var f7 = () async { + if (1 > 2) { + return Future.value(42); + } + return getFutureVoid(); + }; +} + +mixin M { + static var sf1 = () async { + return getFutureVoid(); + }; + static var sf2 = () async { + if (1 > 2) { + return getFutureVoid(); + } + }; + static var sf3 = () async { + if (1 > 2) { + return 42 as dynamic; + } + return getFutureVoid(); + }; + static var sf4 = () async { + if (1 > 2) { + return null; + } + return getFutureVoid(); + }; + static var sf5 = () async { + if (1 > 2) { + return getVoid(); + } + return getFutureVoid(); + }; + static var sf6 = () async { + if (1 > 2) { + return Future.value(null); + } + return getFutureVoid(); + }; + static var sf7 = () async { + if (1 > 2) { + return Future.value(42); + } + return getFutureVoid(); + }; + + var f1 = () async { + return getFutureVoid(); + }; + var f2 = () async { + if (1 > 2) { + return getFutureVoid(); + } + }; + var f3 = () async { + if (1 > 2) { + return 42 as dynamic; + } + return getFutureVoid(); + }; + var f4 = () async { + if (1 > 2) { + return null; + } + return getFutureVoid(); + }; + var f5 = () async { + if (1 > 2) { + return getVoid(); + } + return getFutureVoid(); + }; + var f6 = () async { + if (1 > 2) { + return Future.value(null); + } + return getFutureVoid(); + }; + var f7 = () async { + if (1 > 2) { + return Future.value(42); + } + return getFutureVoid(); + }; +} + +mixin class MC { + static var sf1 = () async { + return getFutureVoid(); + }; + static var sf2 = () async { + if (1 > 2) { + return getFutureVoid(); + } + }; + static var sf3 = () async { + if (1 > 2) { + return 42 as dynamic; + } + return getFutureVoid(); + }; + static var sf4 = () async { + if (1 > 2) { + return null; + } + return getFutureVoid(); + }; + static var sf5 = () async { + if (1 > 2) { + return getVoid(); + } + return getFutureVoid(); + }; + static var sf6 = () async { + if (1 > 2) { + return Future.value(null); + } + return getFutureVoid(); + }; + static var sf7 = () async { + if (1 > 2) { + return Future.value(42); + } + return getFutureVoid(); + }; + + var f1 = () async { + return getFutureVoid(); + }; + var f2 = () async { + if (1 > 2) { + return getFutureVoid(); + } + }; + var f3 = () async { + if (1 > 2) { + return 42 as dynamic; + } + return getFutureVoid(); + }; + var f4 = () async { + if (1 > 2) { + return null; + } + return getFutureVoid(); + }; + var f5 = () async { + if (1 > 2) { + return getVoid(); + } + return getFutureVoid(); + }; + var f6 = () async { + if (1 > 2) { + return Future.value(null); + } + return getFutureVoid(); + }; + var f7 = () async { + if (1 > 2) { + return Future.value(42); + } + return getFutureVoid(); + }; +} + +enum E { + e0; + + static var sf1 = () async { + return getFutureVoid(); + }; + static var sf2 = () async { + if (1 > 2) { + return getFutureVoid(); + } + }; + static var sf3 = () async { + if (1 > 2) { + return 42 as dynamic; + } + return getFutureVoid(); + }; + static var sf4 = () async { + if (1 > 2) { + return null; + } + return getFutureVoid(); + }; + static var sf5 = () async { + if (1 > 2) { + return getVoid(); + } + return getFutureVoid(); + }; + static var sf6 = () async { + if (1 > 2) { + return Future.value(null); + } + return getFutureVoid(); + }; + static var sf7 = () async { + if (1 > 2) { + return Future.value(42); + } + return getFutureVoid(); + }; +} + +class A {} + +extension Ext on A { + static var sf1 = () async { + return getFutureVoid(); + }; + static var sf2 = () async { + if (1 > 2) { + return getFutureVoid(); + } + }; + static var sf3 = () async { + if (1 > 2) { + return 42 as dynamic; + } + return getFutureVoid(); + }; + static var sf4 = () async { + if (1 > 2) { + return null; + } + return getFutureVoid(); + }; + static var sf5 = () async { + if (1 > 2) { + return getVoid(); + } + return getFutureVoid(); + }; + static var sf6 = () async { + if (1 > 2) { + return Future.value(null); + } + return getFutureVoid(); + }; + static var sf7 = () async { + if (1 > 2) { + return Future.value(42); + } + return getFutureVoid(); + }; +} + +extension type ET(int _) { + static var sf1 = () async { + return getFutureVoid(); + }; + static var sf2 = () async { + if (1 > 2) { + return getFutureVoid(); + } + }; + static var sf3 = () async { + if (1 > 2) { + return 42 as dynamic; + } + return getFutureVoid(); + }; + static var sf4 = () async { + if (1 > 2) { + return null; + } + return getFutureVoid(); + }; + static var sf5 = () async { + if (1 > 2) { + return getVoid(); + } + return getFutureVoid(); + }; + static var sf6 = () async { + if (1 > 2) { + return Future.value(null); + } + return getFutureVoid(); + }; + static var sf7 = () async { + if (1 > 2) { + return Future.value(42); + } + return getFutureVoid(); + }; +} + +class MA = Object with M; diff --git a/TypeSystem/inference/function_literal_inference_A06_t01.dart b/TypeSystem/inference/function_literal_inference_A06_t01.dart new file mode 100644 index 0000000000..796c26be26 --- /dev/null +++ b/TypeSystem/inference/function_literal_inference_A06_t01.dart @@ -0,0 +1,76 @@ +// Copyright (c) 2026, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// @assertion Let `T` be the actual returned type of a function literal as +/// computed above. Let `R` be the greatest closure of the typing context `K` as +/// computed above. +/// +/// With null safety: if `R` is `void`, or the function literal is marked +/// `async` and `R` is `FutureOr`, let `S` be `void`. +/// +/// Otherwise, if `T <: R` then let `S` be `T`. Otherwise, let `S` be `R`. The +/// inferred return type of the function literal is then defined as follows: +/// - If the function literal is marked `async` then the inferred return type is +/// `Future`. +/// - If the function literal is marked `async*` then the inferred return type +/// is `Stream`. +/// - If the function literal is marked `sync*` then the inferred return type is +/// `Iterable`. +/// - Otherwise, the inferred return type is `S`. +/// +/// @description Check that if actual return type is `void`, then the inferred +/// return type of the function literal is `void`. +/// @author sgrekhov22@gmail.com + +import '../../Utils/static_type_helper.dart'; +import 'function_literal_inference_A06_lib1.dart'; + +main() { + f1.expectStaticType>(); + f2.expectStaticType>(); + f3.expectStaticType>(); + f4.expectStaticType>(); + + C.sf1.expectStaticType>(); + C.sf2.expectStaticType>(); + C.sf3.expectStaticType>(); + C.sf4.expectStaticType>(); + C().f1.expectStaticType>(); + C().f2.expectStaticType>(); + C().f3.expectStaticType>(); + C().f4.expectStaticType>(); + + M.sf1.expectStaticType>(); + M.sf2.expectStaticType>(); + M.sf3.expectStaticType>(); + M.sf4.expectStaticType>(); + MA().f1.expectStaticType>(); + MA().f2.expectStaticType>(); + MA().f3.expectStaticType>(); + MA().f4.expectStaticType>(); + + MC.sf1.expectStaticType>(); + MC.sf2.expectStaticType>(); + MC.sf3.expectStaticType>(); + MC.sf4.expectStaticType>(); + MC().f1.expectStaticType>(); + MC().f2.expectStaticType>(); + MC().f3.expectStaticType>(); + MC().f4.expectStaticType>(); + + E.sf1.expectStaticType>(); + E.sf2.expectStaticType>(); + E.sf3.expectStaticType>(); + E.sf4.expectStaticType>(); + + Ext.sf1.expectStaticType>(); + Ext.sf2.expectStaticType>(); + Ext.sf3.expectStaticType>(); + Ext.sf4.expectStaticType>(); + + ET.sf1.expectStaticType>(); + ET.sf2.expectStaticType>(); + ET.sf3.expectStaticType>(); + ET.sf4.expectStaticType>(); +} diff --git a/TypeSystem/inference/function_literal_inference_A06_t02.dart b/TypeSystem/inference/function_literal_inference_A06_t02.dart new file mode 100644 index 0000000000..3de255e0dc --- /dev/null +++ b/TypeSystem/inference/function_literal_inference_A06_t02.dart @@ -0,0 +1,196 @@ +// Copyright (c) 2026, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// @assertion Let `T` be the actual returned type of a function literal as +/// computed above. Let `R` be the greatest closure of the typing context `K` as +/// computed above. +/// +/// With null safety: if `R` is `void`, or the function literal is marked +/// `async` and `R` is `FutureOr`, let `S` be `void`. +/// +/// Otherwise, if `T <: R` then let `S` be `T`. Otherwise, let `S` be `R`. The +/// inferred return type of the function literal is then defined as follows: +/// - If the function literal is marked `async` then the inferred return type is +/// `Future`. +/// - If the function literal is marked `async*` then the inferred return type +/// is `Stream`. +/// - If the function literal is marked `sync*` then the inferred return type is +/// `Iterable`. +/// - Otherwise, the inferred return type is `S`. +/// +/// @description Check that if actual return type is `void`, then the inferred +/// return type of the function literal is `void`. It is a compile-time error to +/// use this value. +/// @author sgrekhov22@gmail.com + +import 'function_literal_inference_A06_lib1.dart'; + +main() { + Object? _ = f1(); +// ^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = f2(); +// ^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = f3(); +// ^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = f4(); +// ^^^^ +// [analyzer] unspecified +// [cfe] unspecified + + Object? _ = C.sf1(); +// ^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = C.sf2(); +// ^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = C.sf3(); +// ^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = C.sf4(); +// ^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = C().f1(); +// ^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = C().f2(); +// ^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = C().sf3(); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = C().sf4(); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + + Object? _ = M.sf1(); +// ^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = M.sf2(); +// ^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = M.sf3(); +// ^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = M.sf4(); +// ^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = MA().f1(); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = MA().f2(); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = MA().sf3(); +// ^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = MA().sf4(); +// ^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + + Object? _ = MC.sf1(); +// ^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = MC.sf2(); +// ^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = MC.sf3(); +// ^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = MC.sf4(); +// ^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = MC().f1(); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = MC().f2(); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = MC().sf3(); +// ^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = MC().sf4(); +// ^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + + Object? _ = E.sf1(); +// ^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = E.sf2(); +// ^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = E.sf3(); +// ^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = E.sf4(); +// ^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + + Object? _ = Ext.sf1(); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = Ext.sf2(); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = Ext.sf3(); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = Ext.sf4(); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + + Object? _ = ET.sf1(); +// ^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = ET.sf2(); +// ^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = ET.sf3(); +// ^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = ET.sf4(); +// ^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified +} diff --git a/TypeSystem/inference/function_literal_inference_A06_t03.dart b/TypeSystem/inference/function_literal_inference_A06_t03.dart new file mode 100644 index 0000000000..728b776ae3 --- /dev/null +++ b/TypeSystem/inference/function_literal_inference_A06_t03.dart @@ -0,0 +1,107 @@ +// Copyright (c) 2026, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// @assertion Let `T` be the actual returned type of a function literal as +/// computed above. Let `R` be the greatest closure of the typing context `K` as +/// computed above. +/// +/// With null safety: if `R` is `void`, or the function literal is marked +/// `async` and `R` is `FutureOr`, let `S` be `void`. +/// +/// Otherwise, if `T <: R` then let `S` be `T`. Otherwise, let `S` be `R`. The +/// inferred return type of the function literal is then defined as follows: +/// - If the function literal is marked `async` then the inferred return type is +/// `Future`. +/// - If the function literal is marked `async*` then the inferred return type +/// is `Stream`. +/// - If the function literal is marked `sync*` then the inferred return type is +/// `Iterable`. +/// - Otherwise, the inferred return type is `S`. +/// +/// @description Check that if actual return type is `void` and the function +/// literal is marked `async`, then the inferred return type of the function +/// literal is `Future`. +/// @author sgrekhov22@gmail.com + +import '../../Utils/static_type_helper.dart'; +import 'function_literal_inference_A06_lib2.dart'; + +main() { + f1.expectStaticType Function()>>(); + f2.expectStaticType Function()>>(); + f3.expectStaticType Function()>>(); + f4.expectStaticType Function()>>(); + f5.expectStaticType Function()>>(); + f6.expectStaticType Function()>>(); + f7.expectStaticType Function()>>(); + + C.sf1.expectStaticType Function()>>(); + C.sf2.expectStaticType Function()>>(); + C.sf3.expectStaticType Function()>>(); + C.sf4.expectStaticType Function()>>(); + C.sf5.expectStaticType Function()>>(); + C.sf6.expectStaticType Function()>>(); + C.sf7.expectStaticType Function()>>(); + C().f1.expectStaticType Function()>>(); + C().f2.expectStaticType Function()>>(); + C().f3.expectStaticType Function()>>(); + C().f4.expectStaticType Function()>>(); + C().f5.expectStaticType Function()>>(); + C().f6.expectStaticType Function()>>(); + C().f7.expectStaticType Function()>>(); + + M.sf1.expectStaticType Function()>>(); + M.sf2.expectStaticType Function()>>(); + M.sf3.expectStaticType Function()>>(); + M.sf4.expectStaticType Function()>>(); + M.sf5.expectStaticType Function()>>(); + M.sf6.expectStaticType Function()>>(); + M.sf7.expectStaticType Function()>>(); + MA().f1.expectStaticType Function()>>(); + MA().f2.expectStaticType Function()>>(); + MA().f3.expectStaticType Function()>>(); + MA().f4.expectStaticType Function()>>(); + MA().f5.expectStaticType Function()>>(); + MA().f6.expectStaticType Function()>>(); + MA().f7.expectStaticType Function()>>(); + + MC.sf1.expectStaticType Function()>>(); + MC.sf2.expectStaticType Function()>>(); + MC.sf3.expectStaticType Function()>>(); + MC.sf4.expectStaticType Function()>>(); + MC.sf5.expectStaticType Function()>>(); + MC.sf6.expectStaticType Function()>>(); + MC.sf7.expectStaticType Function()>>(); + MC().f1.expectStaticType Function()>>(); + MC().f2.expectStaticType Function()>>(); + MC().f3.expectStaticType Function()>>(); + MC().f4.expectStaticType Function()>>(); + MC().f5.expectStaticType Function()>>(); + MC().f6.expectStaticType Function()>>(); + MC().f7.expectStaticType Function()>>(); + + E.sf1.expectStaticType Function()>>(); + E.sf2.expectStaticType Function()>>(); + E.sf3.expectStaticType Function()>>(); + E.sf4.expectStaticType Function()>>(); + E.sf5.expectStaticType Function()>>(); + E.sf6.expectStaticType Function()>>(); + E.sf7.expectStaticType Function()>>(); + + Ext.sf1.expectStaticType Function()>>(); + Ext.sf2.expectStaticType Function()>>(); + Ext.sf3.expectStaticType Function()>>(); + Ext.sf4.expectStaticType Function()>>(); + Ext.sf5.expectStaticType Function()>>(); + Ext.sf6.expectStaticType Function()>>(); + Ext.sf7.expectStaticType Function()>>(); + + ET.sf1.expectStaticType Function()>>(); + ET.sf2.expectStaticType Function()>>(); + ET.sf3.expectStaticType Function()>>(); + ET.sf4.expectStaticType Function()>>(); + ET.sf5.expectStaticType Function()>>(); + ET.sf6.expectStaticType Function()>>(); + ET.sf7.expectStaticType Function()>>(); +} diff --git a/TypeSystem/inference/function_literal_inference_A06_t04.dart b/TypeSystem/inference/function_literal_inference_A06_t04.dart new file mode 100644 index 0000000000..db342d86c6 --- /dev/null +++ b/TypeSystem/inference/function_literal_inference_A06_t04.dart @@ -0,0 +1,197 @@ +// Copyright (c) 2026, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// @assertion Let `T` be the actual returned type of a function literal as +/// computed above. Let `R` be the greatest closure of the typing context `K` as +/// computed above. +/// +/// With null safety: if `R` is `void`, or the function literal is marked +/// `async` and `R` is `FutureOr`, let `S` be `void`. +/// +/// Otherwise, if `T <: R` then let `S` be `T`. Otherwise, let `S` be `R`. The +/// inferred return type of the function literal is then defined as follows: +/// - If the function literal is marked `async` then the inferred return type is +/// `Future`. +/// - If the function literal is marked `async*` then the inferred return type +/// is `Stream`. +/// - If the function literal is marked `sync*` then the inferred return type is +/// `Iterable`. +/// - Otherwise, the inferred return type is `S`. +/// +/// @description Check that if actual return type is `void` and the function +/// literal is marked `async`, then the inferred return type of the function +/// literal is `Future`. It is a compile-time error to await and then use +/// this value. +/// @author sgrekhov22@gmail.com + +import 'function_literal_inference_A06_lib2.dart'; + +main() async { + Object? _ = await f1(); +// ^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await f2(); +// ^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await f3(); +// ^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await f4(); +// ^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + + Object? _ = await C.sf1(); +// ^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await C.sf2(); +// ^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await C.sf3(); +// ^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await C.sf4(); +// ^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await C().f1(); +// ^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await C().f2(); +// ^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await C().sf3(); +// ^^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await C().sf4(); +// ^^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + + Object? _ = await M.sf1(); +// ^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await M.sf2(); +// ^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await M.sf3(); +// ^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await M.sf4(); +// ^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await MA().f1(); +// ^^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await MA().f2(); +// ^^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await MA().sf3(); +// ^^^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await MA().sf4(); +// ^^^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + + Object? _ = await MC.sf1(); +// ^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await MC.sf2(); +// ^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await MC.sf3(); +// ^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await MC.sf4(); +// ^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await MC().f1(); +// ^^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await MC().f2(); +// ^^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await MC().sf3(); +// ^^^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await MC().sf4(); +// ^^^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + + Object? _ = await E.sf1(); +// ^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await E.sf2(); +// ^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await E.sf3(); +// ^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await E.sf4(); +// ^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + + Object? _ = await Ext.sf1(); +// ^^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await Ext.sf2(); +// ^^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await Ext.sf3(); +// ^^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await Ext.sf4(); +// ^^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + + Object? _ = await ET.sf1(); +// ^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await ET.sf2(); +// ^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await ET.sf3(); +// ^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await ET.sf4(); +// ^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified +} diff --git a/TypeSystem/inference/function_literal_inference_A06_t05.dart b/TypeSystem/inference/function_literal_inference_A06_t05.dart new file mode 100644 index 0000000000..48d2dd8955 --- /dev/null +++ b/TypeSystem/inference/function_literal_inference_A06_t05.dart @@ -0,0 +1,107 @@ +// Copyright (c) 2026, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// @assertion Let `T` be the actual returned type of a function literal as +/// computed above. Let `R` be the greatest closure of the typing context `K` as +/// computed above. +/// +/// With null safety: if `R` is `void`, or the function literal is marked +/// `async` and `R` is `FutureOr`, let `S` be `void`. +/// +/// Otherwise, if `T <: R` then let `S` be `T`. Otherwise, let `S` be `R`. The +/// inferred return type of the function literal is then defined as follows: +/// - If the function literal is marked `async` then the inferred return type is +/// `Future`. +/// - If the function literal is marked `async*` then the inferred return type +/// is `Stream`. +/// - If the function literal is marked `sync*` then the inferred return type is +/// `Iterable`. +/// - Otherwise, the inferred return type is `S`. +/// +/// @description Check that if actual return type is `Future` and the +/// function literal is marked `async`, then the inferred return type of the +/// function literal is `Future`. +/// @author sgrekhov22@gmail.com + +import '../../Utils/static_type_helper.dart'; +import 'function_literal_inference_A06_lib3.dart'; + +main() { + f1.expectStaticType Function()>>(); + f2.expectStaticType Function()>>(); + f3.expectStaticType Function()>>(); + f4.expectStaticType Function()>>(); + f5.expectStaticType Function()>>(); + f6.expectStaticType Function()>>(); + f7.expectStaticType Function()>>(); + + C.sf1.expectStaticType Function()>>(); + C.sf2.expectStaticType Function()>>(); + C.sf3.expectStaticType Function()>>(); + C.sf4.expectStaticType Function()>>(); + C.sf5.expectStaticType Function()>>(); + C.sf6.expectStaticType Function()>>(); + C.sf7.expectStaticType Function()>>(); + C().f1.expectStaticType Function()>>(); + C().f2.expectStaticType Function()>>(); + C().f3.expectStaticType Function()>>(); + C().f4.expectStaticType Function()>>(); + C().f5.expectStaticType Function()>>(); + C().f6.expectStaticType Function()>>(); + C().f7.expectStaticType Function()>>(); + + M.sf1.expectStaticType Function()>>(); + M.sf2.expectStaticType Function()>>(); + M.sf3.expectStaticType Function()>>(); + M.sf4.expectStaticType Function()>>(); + M.sf5.expectStaticType Function()>>(); + M.sf6.expectStaticType Function()>>(); + M.sf7.expectStaticType Function()>>(); + MA().f1.expectStaticType Function()>>(); + MA().f2.expectStaticType Function()>>(); + MA().f3.expectStaticType Function()>>(); + MA().f4.expectStaticType Function()>>(); + MA().f5.expectStaticType Function()>>(); + MA().f6.expectStaticType Function()>>(); + MA().f7.expectStaticType Function()>>(); + + MC.sf1.expectStaticType Function()>>(); + MC.sf2.expectStaticType Function()>>(); + MC.sf3.expectStaticType Function()>>(); + MC.sf4.expectStaticType Function()>>(); + MC.sf5.expectStaticType Function()>>(); + MC.sf6.expectStaticType Function()>>(); + MC.sf7.expectStaticType Function()>>(); + MC().f1.expectStaticType Function()>>(); + MC().f2.expectStaticType Function()>>(); + MC().f3.expectStaticType Function()>>(); + MC().f4.expectStaticType Function()>>(); + MC().f5.expectStaticType Function()>>(); + MC().f6.expectStaticType Function()>>(); + MC().f7.expectStaticType Function()>>(); + + E.sf1.expectStaticType Function()>>(); + E.sf2.expectStaticType Function()>>(); + E.sf3.expectStaticType Function()>>(); + E.sf4.expectStaticType Function()>>(); + E.sf5.expectStaticType Function()>>(); + E.sf6.expectStaticType Function()>>(); + E.sf7.expectStaticType Function()>>(); + + Ext.sf1.expectStaticType Function()>>(); + Ext.sf2.expectStaticType Function()>>(); + Ext.sf3.expectStaticType Function()>>(); + Ext.sf4.expectStaticType Function()>>(); + Ext.sf5.expectStaticType Function()>>(); + Ext.sf6.expectStaticType Function()>>(); + Ext.sf7.expectStaticType Function()>>(); + + ET.sf1.expectStaticType Function()>>(); + ET.sf2.expectStaticType Function()>>(); + ET.sf3.expectStaticType Function()>>(); + ET.sf4.expectStaticType Function()>>(); + ET.sf5.expectStaticType Function()>>(); + ET.sf6.expectStaticType Function()>>(); + ET.sf7.expectStaticType Function()>>(); +} diff --git a/TypeSystem/inference/function_literal_inference_A06_t06.dart b/TypeSystem/inference/function_literal_inference_A06_t06.dart new file mode 100644 index 0000000000..0cd8d4ba33 --- /dev/null +++ b/TypeSystem/inference/function_literal_inference_A06_t06.dart @@ -0,0 +1,197 @@ +// Copyright (c) 2026, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// @assertion Let `T` be the actual returned type of a function literal as +/// computed above. Let `R` be the greatest closure of the typing context `K` as +/// computed above. +/// +/// With null safety: if `R` is `void`, or the function literal is marked +/// `async` and `R` is `FutureOr`, let `S` be `void`. +/// +/// Otherwise, if `T <: R` then let `S` be `T`. Otherwise, let `S` be `R`. The +/// inferred return type of the function literal is then defined as follows: +/// - If the function literal is marked `async` then the inferred return type is +/// `Future`. +/// - If the function literal is marked `async*` then the inferred return type +/// is `Stream`. +/// - If the function literal is marked `sync*` then the inferred return type is +/// `Iterable`. +/// - Otherwise, the inferred return type is `S`. +/// +/// @description Check that if actual return type is `Future` and the +/// function literal is marked `async`, then the inferred return type of the +/// function literal is `Future`. It is a compile-time error to await and +/// then use this value. +/// @author sgrekhov22@gmail.com + +import 'function_literal_inference_A06_lib3.dart'; + +main() async { + Object? _ = await f1(); +// ^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await f2(); +// ^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await f3(); +// ^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await f4(); +// ^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + + Object? _ = await C.sf1(); +// ^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await C.sf2(); +// ^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await C.sf3(); +// ^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await C.sf4(); +// ^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await C().f1(); +// ^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await C().f2(); +// ^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await C().sf3(); +// ^^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await C().sf4(); +// ^^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + + Object? _ = await M.sf1(); +// ^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await M.sf2(); +// ^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await M.sf3(); +// ^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await M.sf4(); +// ^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await MA().f1(); +// ^^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await MA().f2(); +// ^^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await MA().sf3(); +// ^^^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await MA().sf4(); +// ^^^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + + Object? _ = await MC.sf1(); +// ^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await MC.sf2(); +// ^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await MC.sf3(); +// ^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await MC.sf4(); +// ^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await MC().f1(); +// ^^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await MC().f2(); +// ^^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await MC().sf3(); +// ^^^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await MC().sf4(); +// ^^^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + + Object? _ = await E.sf1(); +// ^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await E.sf2(); +// ^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await E.sf3(); +// ^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await E.sf4(); +// ^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + + Object? _ = await Ext.sf1(); +// ^^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await Ext.sf2(); +// ^^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await Ext.sf3(); +// ^^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await Ext.sf4(); +// ^^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + + Object? _ = await ET.sf1(); +// ^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await ET.sf2(); +// ^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await ET.sf3(); +// ^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + Object? _ = await ET.sf4(); +// ^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified +}