|
| 1 | +library; |
| 2 | +// |
| 3 | +// Problems in library: |
| 4 | +// |
| 5 | +// pkg/front_end/testcases/nnbd/nullable_param.dart:5:6: Error: This requires the 'non-nullable' experiment to be enabled. |
| 6 | +// Try enabling this experiment by adding it to the command line when compiling and running. |
| 7 | +// int? field; |
| 8 | +// ^ |
| 9 | +// |
| 10 | +// pkg/front_end/testcases/nnbd/nullable_param.dart:6:6: Error: This requires the 'non-nullable' experiment to be enabled. |
| 11 | +// Try enabling this experiment by adding it to the command line when compiling and running. |
| 12 | +// int? bar(int? x); |
| 13 | +// ^ |
| 14 | +// |
| 15 | +// pkg/front_end/testcases/nnbd/nullable_param.dart:6:15: Error: This requires the 'non-nullable' experiment to be enabled. |
| 16 | +// Try enabling this experiment by adding it to the command line when compiling and running. |
| 17 | +// int? bar(int? x); |
| 18 | +// ^ |
| 19 | +// |
| 20 | +// pkg/front_end/testcases/nnbd/nullable_param.dart:17:54: Error: This requires the 'non-nullable' experiment to be enabled. |
| 21 | +// Try enabling this experiment by adding it to the command line when compiling and running. |
| 22 | +// int test_nullable_function_type_formal_param({int f()? : null}) { |
| 23 | +// ^ |
| 24 | +// |
| 25 | +// pkg/front_end/testcases/nnbd/nullable_param.dart:4:7: Error: The non-abstract class 'Foo' is missing implementations for these members: |
| 26 | +// - Foo.bar |
| 27 | +// Try to either |
| 28 | +// - provide an implementation, |
| 29 | +// - inherit an implementation from a superclass or mixin, |
| 30 | +// - mark the class as abstract, or |
| 31 | +// - provide a 'noSuchMethod' implementation. |
| 32 | +// |
| 33 | +// class Foo { |
| 34 | +// ^^^ |
| 35 | +// pkg/front_end/testcases/nnbd/nullable_param.dart:6:8: Context: 'Foo.bar' is defined here. |
| 36 | +// int? bar(int? x); |
| 37 | +// ^^^ |
| 38 | +// |
| 39 | +import self as self; |
| 40 | +import "dart:core" as core; |
| 41 | + |
| 42 | +class Foo extends core::Object { |
| 43 | + field core::int field = null; |
| 44 | + synthetic constructor •() → self::Foo |
| 45 | + : super core::Object::•() |
| 46 | + ; |
| 47 | + abstract method bar(core::int x) → core::int; |
| 48 | +} |
| 49 | +static method main() → dynamic { |
| 50 | + self::Foo foo = new self::Foo::•(); |
| 51 | + foo.{self::Foo::field} = 5; |
| 52 | + foo.{self::Foo::bar}(6); |
| 53 | + self::test_nullable_function_type_formal_param(f: () → core::int => 2); |
| 54 | +} |
| 55 | +static method test_nullable_function_type_formal_param({() → core::int f = null}) → core::int { |
| 56 | + return let final core::int #t1 = f.call() in #t1.==(null) ?{core::int} 1.{core::int::unary-}() : #t1; |
| 57 | +} |
0 commit comments