442fa7f44e
Update in response to issue #44329 and to match the change in https://dart-review.googlesource.com/c/sdk/+/174300 Change-Id: Ia28887f0fad54927b82b7aa29acb88231053cd6a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174800 Reviewed-by: Vyacheslav Egorov <vegorov@google.com> Commit-Queue: Johnni Winther <johnniwinther@google.com>
106 lines
4.8 KiB
Plaintext
106 lines
4.8 KiB
Plaintext
library /*isNonNullableByDefault*/;
|
|
//
|
|
// Problems in library:
|
|
//
|
|
// pkg/front_end/testcases/nnbd/required.dart:29:8: Error: The parameter 'x' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
|
|
// Try adding either an explicit non-'null' default value or the 'required' modifier.
|
|
// foo({x}) {}
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/nnbd/required.dart:51:18: Error: Non-optional parameters can't have a default value.
|
|
// Try removing the default value or making the parameter optional.
|
|
// Function(int a = 42, [int b]) f2;
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/nnbd/required.dart:52:17: Error: Non-optional parameters can't have a default value.
|
|
// Try removing the default value or making the parameter optional.
|
|
// void g2(int a = 42, [int b]) {}
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/nnbd/required.dart:53:15: Error: Non-optional parameters can't have a default value.
|
|
// Try removing the default value or making the parameter optional.
|
|
// f2 = (int a = 42, [int b]) {};
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/nnbd/required.dart:48:15: Error: The parameter 'a' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
|
|
// Try adding either an explicit non-'null' default value or the 'required' modifier.
|
|
// void g({int a, required int b = 42}) {}
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/nnbd/required.dart:48:31: Error: Named parameter 'b' is required and can't have a default value.
|
|
// void g({int a, required int b = 42}) {}
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/nnbd/required.dart:49:13: Error: The parameter 'a' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
|
|
// Try adding either an explicit non-'null' default value or the 'required' modifier.
|
|
// f = ({int a, required int b = 42}) {};
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/nnbd/required.dart:49:29: Error: Named parameter 'b' is required and can't have a default value.
|
|
// f = ({int a, required int b = 42}) {};
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/nnbd/required.dart:52:28: Error: The parameter 'b' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
|
|
// Try adding either an explicit non-'null' default value or the 'required' modifier.
|
|
// void g2(int a = 42, [int b]) {}
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/nnbd/required.dart:53:26: Error: The parameter 'b' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
|
|
// Try adding either an explicit non-'null' default value or the 'required' modifier.
|
|
// f2 = (int a = 42, [int b]) {};
|
|
// ^
|
|
//
|
|
import self as self;
|
|
import "dart:core" as core;
|
|
|
|
typedef Typedef1 = ({a: core::int, required b: core::int}) → dynamic;
|
|
typedef Typedef2 = ({a: core::int, required b: core::int}) → dynamic;
|
|
class Class extends core::Object {
|
|
synthetic constructor •() → self::Class
|
|
: super core::Object::•()
|
|
;
|
|
method method({core::int a = #C1, required core::int b = #C2, required final core::int c = #C2, required covariant final core::int d = #C2}) → dynamic {}
|
|
}
|
|
abstract class A extends core::Object {
|
|
synthetic constructor •() → self::A
|
|
: super core::Object::•()
|
|
;
|
|
abstract method foo({core::int x = #C2}) → dynamic;
|
|
}
|
|
class B extends self::A {
|
|
synthetic constructor •() → self::B
|
|
: super self::A::•()
|
|
;
|
|
method foo({core::int x = #C2}) → dynamic {}
|
|
}
|
|
class C extends self::A {
|
|
synthetic constructor •() → self::C
|
|
: super self::A::•()
|
|
;
|
|
method foo({core::int x = #C1}) → dynamic {}
|
|
}
|
|
static field ({a: core::int, required b: core::int}) → dynamic field = ({core::int a = #C1, required core::int b = #C2}) → Null {};
|
|
static method method({core::int a = #C1, required core::int b = #C2, required final core::int c = #C2}) → dynamic {}
|
|
static method ok() → dynamic {
|
|
({a: core::int, required b: core::int}) → dynamic f;
|
|
function g({core::int a = #C1, required core::int b = #C2}) → void {}
|
|
f = ({core::int a = #C1, required core::int b = #C2}) → Null {};
|
|
(core::int, [core::int]) → dynamic f2;
|
|
function g2(core::int a, [core::int b = #C1]) → void {}
|
|
f2 = (core::int a, [core::int b = #C1]) → Null {};
|
|
}
|
|
static method error() → dynamic {
|
|
({a: core::int, required b: core::int}) → dynamic f;
|
|
function g({core::int a = #C2, required core::int b = #C1}) → void {}
|
|
f = ({core::int a = #C2, required core::int b = #C1}) → Null {};
|
|
(core::int, [core::int]) → dynamic f2;
|
|
function g2(core::int a = #C1, [core::int b = #C2]) → void {}
|
|
f2 = (core::int a = #C1, [core::int b = #C2]) → Null {};
|
|
}
|
|
static method main() → dynamic {}
|
|
|
|
constants {
|
|
#C1 = 42
|
|
#C2 = null
|
|
}
|