6c4b75237a
+ update ast-to-text, including previous renames of covariant TEST=existing Change-Id: Ia29847cba791096ccd9c6c383a1b633a6150cd94 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214042 Commit-Queue: Johnni Winther <johnniwinther@google.com> Reviewed-by: Chloe Stefantsova <dmitryas@google.com>
298 lines
19 KiB
Plaintext
298 lines
19 KiB
Plaintext
library /*isNonNullableByDefault*/;
|
|
//
|
|
// Problems in library:
|
|
//
|
|
// pkg/front_end/testcases/none/method_invocation.dart:84:24: Error: Not a constant expression.
|
|
// const int call_dyn = dyn.toString(0);
|
|
// ^^^
|
|
//
|
|
// pkg/front_end/testcases/none/method_invocation.dart:84:28: Error: Method invocation is not a constant expression.
|
|
// const int call_dyn = dyn.toString(0);
|
|
// ^^^^^^^^
|
|
//
|
|
// pkg/front_end/testcases/none/method_invocation.dart:147:34: Error: Not a constant expression.
|
|
// const int call_localFunction = localFunction();
|
|
// ^^^^^^^^^^^^^
|
|
//
|
|
// pkg/front_end/testcases/none/method_invocation.dart:152:22: Error: Not a constant expression.
|
|
// const int call_f = f();
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/none/method_invocation.dart:157:23: Error: Not a constant expression.
|
|
// const bool equals = i == j;
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/none/method_invocation.dart:68:42: Error: Can't use an expression of type 'Function?' as a function because it's potentially null.
|
|
// - 'Function' is from 'dart:core'.
|
|
// Try calling using ?.call instead.
|
|
// nonNullableClass2.nullableFunctionField();
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/none/method_invocation.dart:69:43: Error: Can't use an expression of type 'Function?' as a function because it's potentially null.
|
|
// - 'Function' is from 'dart:core'.
|
|
// Try calling using ?.call instead.
|
|
// nonNullableClass2.nullableFunctionGetter();
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/none/method_invocation.dart:70:47: Error: Can't use an expression of type 'void Function()?' as a function because it's potentially null.
|
|
// Try calling using ?.call instead.
|
|
// nonNullableClass2.nullableFunctionTypedField();
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/none/method_invocation.dart:71:48: Error: Can't use an expression of type 'void Function()?' as a function because it's potentially null.
|
|
// Try calling using ?.call instead.
|
|
// nonNullableClass2.nullableFunctionTypedGetter();
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/none/method_invocation.dart:74:50: Error: Too many positional arguments: 0 allowed, but 1 found.
|
|
// Try removing the extra positional arguments.
|
|
// nonNullableClass2.nonNullableFunctionTypedField(0);
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/none/method_invocation.dart:75:51: Error: Too many positional arguments: 0 allowed, but 1 found.
|
|
// Try removing the extra positional arguments.
|
|
// nonNullableClass2.nonNullableFunctionTypedGetter(0);
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/none/method_invocation.dart:78:18: Error: Method 'method' cannot be called on 'Class1?' because it is potentially null.
|
|
// - 'Class1' is from 'pkg/front_end/testcases/none/method_invocation.dart'.
|
|
// Try calling using ?. instead.
|
|
// nullableClass1.method(0);
|
|
// ^^^^^^
|
|
//
|
|
// pkg/front_end/testcases/none/method_invocation.dart:102:21: Error: The method 'unresolved' isn't defined for the class 'Class1'.
|
|
// - 'Class1' is from 'pkg/front_end/testcases/none/method_invocation.dart'.
|
|
// Try correcting the name to the name of an existing method, or defining a method named 'unresolved'.
|
|
// nonNullableClass1.unresolved();
|
|
// ^^^^^^^^^^
|
|
//
|
|
// pkg/front_end/testcases/none/method_invocation.dart:105:27: Error: Too few positional arguments: 1 required, 0 given.
|
|
// nonNullableClass1.method();
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/none/method_invocation.dart:106:26: Error: Too few positional arguments: 1 required, 0 given.
|
|
// nonNullableFunctionType();
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/none/method_invocation.dart:132:19: Error: Can't use an expression of type 'Function?' as a function because it's potentially null.
|
|
// - 'Function' is from 'dart:core'.
|
|
// Try calling using ?.call instead.
|
|
// nullableFunction(0);
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/none/method_invocation.dart:133:20: Error: Method 'call' cannot be called on 'Function?' because it is potentially null.
|
|
// - 'Function' is from 'dart:core'.
|
|
// Try calling using ?. instead.
|
|
// nullableFunction.call(0);
|
|
// ^^^^
|
|
//
|
|
// pkg/front_end/testcases/none/method_invocation.dart:134:23: Error: Can't use an expression of type 'int Function(int)?' as a function because it's potentially null.
|
|
// Try calling using ?.call instead.
|
|
// nullableFunctionType(0);
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/none/method_invocation.dart:135:24: Error: Method 'call' cannot be called on 'int Function(int)?' because it is potentially null.
|
|
// Try calling using ?. instead.
|
|
// nullableFunctionType.call(0);
|
|
// ^^^^
|
|
//
|
|
// pkg/front_end/testcases/none/method_invocation.dart:138:27: Error: Too few positional arguments: 1 required, 0 given.
|
|
// nonNullableClass1.method().method(0);
|
|
// ^
|
|
//
|
|
import self as self;
|
|
import "dart:core" as core;
|
|
import "dart:_internal" as _in;
|
|
|
|
class Class1 extends core::Object {
|
|
synthetic constructor •() → self::Class1
|
|
: super core::Object::•()
|
|
;
|
|
method method(core::int o) → core::double
|
|
return 0.5;
|
|
}
|
|
class Class2<T extends core::Object? = dynamic> extends core::Object {
|
|
covariant-by-class field self::Class2::T% field;
|
|
field core::Function nonNullableFunctionField;
|
|
field core::Function? nullableFunctionField = null;
|
|
field () → void nonNullableFunctionTypedField;
|
|
field () →? void nullableFunctionTypedField = null;
|
|
constructor •(self::Class2::T% field, core::Function nonNullableFunctionField, () → void nonNullableFunctionTypedField) → self::Class2<self::Class2::T%>
|
|
: self::Class2::field = field, self::Class2::nonNullableFunctionField = nonNullableFunctionField, self::Class2::nonNullableFunctionTypedField = nonNullableFunctionTypedField, super core::Object::•()
|
|
;
|
|
method call() → self::Class2::T%
|
|
return this.{self::Class2::field}{self::Class2::T%};
|
|
method method(core::int o) → self::Class2::T%
|
|
return this.{self::Class2::field}{self::Class2::T%};
|
|
get nonNullableFunctionGetter() → core::Function
|
|
return this.{self::Class2::nonNullableFunctionTypedField}{() → void};
|
|
get nullableFunctionGetter() → core::Function?
|
|
return this.{self::Class2::nonNullableFunctionTypedField}{() → void};
|
|
get nonNullableFunctionTypedGetter() → () → void
|
|
return this.{self::Class2::nonNullableFunctionTypedField}{() → void};
|
|
get nullableFunctionTypedGetter() → () →? void
|
|
return this.{self::Class2::nonNullableFunctionTypedField}{() → void};
|
|
}
|
|
static const field core::int i = #C1;
|
|
static const field core::int j = #C2;
|
|
static const field core::int k = #C3;
|
|
static method test<T1 extends core::Function, T2 extends (core::int) → core::int, T3 extends core::Object? = dynamic>(self::Class1 nonNullableClass1, self::Class1? nullableClass1, dynamic dyn, Never never, self::Class2<core::String> nonNullableClass2, self::Class2<core::String>? nullableClass2, core::Function nonNullableFunction, core::Function? nullableFunction, (core::int) → core::int nonNullableFunctionType, (core::int) →? core::int nullableFunctionType, <T extends core::Object? = dynamic>(T%) → T% genericFunctionType, self::test::T1 nonNullableTypeVariable1, self::test::T1? nullableTypeVariable1, self::test::T2 nonNullableTypeVariable2, self::test::T2? nullableTypeVariable2, self::test::T3% undeterminedTypeVariable) → dynamic {
|
|
core::print("InstanceInvocation");
|
|
nonNullableClass1.{self::Class1::method}(0){(core::int) → core::double};
|
|
let final self::Class1? #t1 = nullableClass1 in #t1 == null ?{core::double?} null : #t1{self::Class1}.{self::Class1::method}(0){(core::int) → core::double};
|
|
core::print("InstanceGet calls");
|
|
nonNullableClass2.{self::Class2::nonNullableFunctionField}{core::Function}();
|
|
nonNullableClass2.{self::Class2::nonNullableFunctionGetter}{core::Function}();
|
|
nonNullableClass2.{self::Class2::nonNullableFunctionTypedField}{() → void}(){() → void};
|
|
nonNullableClass2.{self::Class2::nonNullableFunctionTypedGetter}{() → void}(){() → void};
|
|
invalid-expression "pkg/front_end/testcases/none/method_invocation.dart:68:42: Error: Can't use an expression of type 'Function?' as a function because it's potentially null.
|
|
- 'Function' is from 'dart:core'.
|
|
Try calling using ?.call instead.
|
|
nonNullableClass2.nullableFunctionField();
|
|
^" in nonNullableClass2.{self::Class2::nullableFunctionField}{core::Function?}{<nullable>}.();
|
|
invalid-expression "pkg/front_end/testcases/none/method_invocation.dart:69:43: Error: Can't use an expression of type 'Function?' as a function because it's potentially null.
|
|
- 'Function' is from 'dart:core'.
|
|
Try calling using ?.call instead.
|
|
nonNullableClass2.nullableFunctionGetter();
|
|
^" in nonNullableClass2.{self::Class2::nullableFunctionGetter}{core::Function?}{<nullable>}.();
|
|
invalid-expression "pkg/front_end/testcases/none/method_invocation.dart:70:47: Error: Can't use an expression of type 'void Function()?' as a function because it's potentially null.
|
|
Try calling using ?.call instead.
|
|
nonNullableClass2.nullableFunctionTypedField();
|
|
^" in nonNullableClass2.{self::Class2::nullableFunctionTypedField}{() →? void}{<nullable>}.(){() →? void};
|
|
invalid-expression "pkg/front_end/testcases/none/method_invocation.dart:71:48: Error: Can't use an expression of type 'void Function()?' as a function because it's potentially null.
|
|
Try calling using ?.call instead.
|
|
nonNullableClass2.nullableFunctionTypedGetter();
|
|
^" in nonNullableClass2.{self::Class2::nullableFunctionTypedGetter}{() →? void}{<nullable>}.(){() →? void};
|
|
let final self::Class2<core::String> #t2 = nonNullableClass2 in let final core::int #t3 = 0 in #t2.{self::Class2::nonNullableFunctionField}{core::Function}(#t3);
|
|
let final self::Class2<core::String> #t4 = nonNullableClass2 in let final core::int #t5 = 0 in #t4.{self::Class2::nonNullableFunctionGetter}{core::Function}(#t5);
|
|
let final self::Class2<core::String> #t6 = nonNullableClass2 in let final core::int #t7 = 0 in invalid-expression "pkg/front_end/testcases/none/method_invocation.dart:74:50: Error: Too many positional arguments: 0 allowed, but 1 found.
|
|
Try removing the extra positional arguments.
|
|
nonNullableClass2.nonNullableFunctionTypedField(0);
|
|
^" in #t6.{self::Class2::nonNullableFunctionTypedField}{() → void}{<inapplicable>}.(#t7);
|
|
let final self::Class2<core::String> #t8 = nonNullableClass2 in let final core::int #t9 = 0 in invalid-expression "pkg/front_end/testcases/none/method_invocation.dart:75:51: Error: Too many positional arguments: 0 allowed, but 1 found.
|
|
Try removing the extra positional arguments.
|
|
nonNullableClass2.nonNullableFunctionTypedGetter(0);
|
|
^" in #t8.{self::Class2::nonNullableFunctionTypedGetter}{() → void}{<inapplicable>}.(#t9);
|
|
core::print("InstanceInvocation (Nullable)");
|
|
invalid-expression "pkg/front_end/testcases/none/method_invocation.dart:78:18: Error: Method 'method' cannot be called on 'Class1?' because it is potentially null.
|
|
- 'Class1' is from 'pkg/front_end/testcases/none/method_invocation.dart'.
|
|
Try calling using ?. instead.
|
|
nullableClass1.method(0);
|
|
^^^^^^" in nullableClass1.{self::Class1::method}{<nullable>}.(0){(core::int) → core::double};
|
|
core::print("DynamicInvocation");
|
|
dyn{dynamic}.method(0);
|
|
let final dynamic #t10 = dyn in #t10 == null ?{dynamic} null : #t10{dynamic}.method(0);
|
|
dyn{dynamic}.toString(0);
|
|
const core::int call_dyn = invalid-expression "pkg/front_end/testcases/none/method_invocation.dart:84:28: Error: Method invocation is not a constant expression.
|
|
const int call_dyn = dyn.toString(0);
|
|
^^^^^^^^";
|
|
core::print(invalid-expression "pkg/front_end/testcases/none/method_invocation.dart:84:28: Error: Method invocation is not a constant expression.
|
|
const int call_dyn = dyn.toString(0);
|
|
^^^^^^^^");
|
|
core::print("InstanceInvocation (Object)");
|
|
dyn.{core::Object::toString}(){() → core::String};
|
|
nullableClass1.{core::Object::toString}(){() → core::String};
|
|
nullableClass2.{core::Object::toString}(){() → core::String};
|
|
nullableFunction.{core::Object::toString}(){() → core::String};
|
|
nullableFunctionType.{core::Object::toString}(){() → core::String};
|
|
nullableTypeVariable1.{core::Object::toString}(){() → core::String};
|
|
nullableTypeVariable2.{core::Object::toString}(){() → core::String};
|
|
undeterminedTypeVariable.{core::Object::toString}(){() → core::String};
|
|
core::print("DynamicInvocation (Never)");
|
|
let final Never #t11 = (let final Never #t12 = never in throw new _in::ReachabilityError::•("`null` encountered as the result from expression with type `Never`.")){Never}.method(0) in throw new _in::ReachabilityError::•("`null` encountered as the result from expression with type `Never`.");
|
|
let final Never #t13 = (let final Never #t14 = never in throw new _in::ReachabilityError::•("`null` encountered as the result from expression with type `Never`.")){Never}.toString() in throw new _in::ReachabilityError::•("`null` encountered as the result from expression with type `Never`.");
|
|
core::print("DynamicInvocation (Unresolved)");
|
|
invalid-expression "pkg/front_end/testcases/none/method_invocation.dart:102:21: Error: The method 'unresolved' isn't defined for the class 'Class1'.
|
|
- 'Class1' is from 'pkg/front_end/testcases/none/method_invocation.dart'.
|
|
Try correcting the name to the name of an existing method, or defining a method named 'unresolved'.
|
|
nonNullableClass1.unresolved();
|
|
^^^^^^^^^^" in nonNullableClass1{<unresolved>}.unresolved();
|
|
core::print("DynamicInvocation (Inapplicable)");
|
|
invalid-expression "pkg/front_end/testcases/none/method_invocation.dart:105:27: Error: Too few positional arguments: 1 required, 0 given.
|
|
nonNullableClass1.method();
|
|
^" in nonNullableClass1.{self::Class1::method}{<inapplicable>}.(){() → invalid-type};
|
|
invalid-expression "pkg/front_end/testcases/none/method_invocation.dart:106:26: Error: Too few positional arguments: 1 required, 0 given.
|
|
nonNullableFunctionType();
|
|
^" in nonNullableFunctionType{<inapplicable>}.();
|
|
core::print("InstanceInvocation (generic)");
|
|
nonNullableClass2.{self::Class2::method}(0){(core::int) → core::String};
|
|
let final self::Class2<core::String>? #t15 = nullableClass2 in #t15 == null ?{core::String?} null : #t15{self::Class2<core::String>}.{self::Class2::method}(0){(core::int) → core::String};
|
|
nonNullableClass2.{self::Class2::call}(){() → core::String};
|
|
nonNullableClass2.{self::Class2::call}(){() → core::String};
|
|
core::print("FunctionInvocation");
|
|
nonNullableFunction(0);
|
|
nonNullableFunction(0);
|
|
let final core::Function? #t16 = nullableFunction in #t16 == null ?{dynamic} null : #t16{core::Function}(0);
|
|
nonNullableFunctionType(0){(core::int) → core::int};
|
|
nonNullableFunctionType(0){(core::int) → core::int};
|
|
let final (core::int) →? core::int #t17 = nullableFunctionType in #t17 == null ?{core::int?} null : #t17{(core::int) → core::int}(0){(core::int) → core::int};
|
|
genericFunctionType<core::int>(0){(core::int) → core::int};
|
|
genericFunctionType<core::num>(0){(core::num) → core::num};
|
|
core::num i = genericFunctionType<core::num>(0){(core::num) → core::num};
|
|
nonNullableTypeVariable1(0);
|
|
nonNullableTypeVariable1(0);
|
|
let final self::test::T1? #t18 = nullableTypeVariable1 in #t18 == null ?{dynamic} null : #t18{self::test::T1}(0);
|
|
nonNullableTypeVariable2(0){(core::int) → core::int};
|
|
nonNullableTypeVariable2(0){(core::int) → core::int};
|
|
let final self::test::T2? #t19 = nullableTypeVariable2 in #t19 == null ?{core::int?} null : #t19{self::test::T2}(0){(core::int) → core::int};
|
|
core::print("FunctionInvocation (Nullable)");
|
|
invalid-expression "pkg/front_end/testcases/none/method_invocation.dart:132:19: Error: Can't use an expression of type 'Function?' as a function because it's potentially null.
|
|
- 'Function' is from 'dart:core'.
|
|
Try calling using ?.call instead.
|
|
nullableFunction(0);
|
|
^" in nullableFunction{<nullable>}.(0);
|
|
invalid-expression "pkg/front_end/testcases/none/method_invocation.dart:133:20: Error: Method 'call' cannot be called on 'Function?' because it is potentially null.
|
|
- 'Function' is from 'dart:core'.
|
|
Try calling using ?. instead.
|
|
nullableFunction.call(0);
|
|
^^^^" in nullableFunction{<nullable>}.(0);
|
|
invalid-expression "pkg/front_end/testcases/none/method_invocation.dart:134:23: Error: Can't use an expression of type 'int Function(int)?' as a function because it's potentially null.
|
|
Try calling using ?.call instead.
|
|
nullableFunctionType(0);
|
|
^" in nullableFunctionType{<nullable>}.(0){(core::int) →? core::int};
|
|
invalid-expression "pkg/front_end/testcases/none/method_invocation.dart:135:24: Error: Method 'call' cannot be called on 'int Function(int)?' because it is potentially null.
|
|
Try calling using ?. instead.
|
|
nullableFunctionType.call(0);
|
|
^^^^" in nullableFunctionType{<nullable>}.(0){(core::int) →? core::int};
|
|
core::print("DynamicInvocation (Invalid)");
|
|
invalid-expression "pkg/front_end/testcases/none/method_invocation.dart:138:27: Error: Too few positional arguments: 1 required, 0 given.
|
|
nonNullableClass1.method().method(0);
|
|
^" in nonNullableClass1.{self::Class1::method}{<inapplicable>}.(){() → invalid-type}{dynamic}.method(0);
|
|
core::print("LocalFunctionInvocation");
|
|
function localFunction() → core::int
|
|
return 42;
|
|
function genericLocalFunction<T extends core::Object? = dynamic>(T% t) → T%
|
|
return t;
|
|
localFunction(){() → core::int};
|
|
genericLocalFunction<core::int>(0){(core::int) → core::int};
|
|
genericLocalFunction<core::num>(0){(core::num) → core::num};
|
|
const core::int call_localFunction = invalid-expression "pkg/front_end/testcases/none/method_invocation.dart:147:34: Error: Not a constant expression.
|
|
const int call_localFunction = localFunction();
|
|
^^^^^^^^^^^^^";
|
|
core::print(invalid-expression "pkg/front_end/testcases/none/method_invocation.dart:147:34: Error: Not a constant expression.
|
|
const int call_localFunction = localFunction();
|
|
^^^^^^^^^^^^^");
|
|
() → core::int f = () → core::int => 42;
|
|
const core::int call_f = invalid-expression "pkg/front_end/testcases/none/method_invocation.dart:152:22: Error: Not a constant expression.
|
|
const int call_f = f();
|
|
^";
|
|
core::print(invalid-expression "pkg/front_end/testcases/none/method_invocation.dart:152:22: Error: Not a constant expression.
|
|
const int call_f = f();
|
|
^");
|
|
core::print(#C4);
|
|
const core::bool equals = invalid-expression "pkg/front_end/testcases/none/method_invocation.dart:157:23: Error: Not a constant expression.
|
|
const bool equals = i == j;
|
|
^";
|
|
core::print(invalid-expression "pkg/front_end/testcases/none/method_invocation.dart:157:23: Error: Not a constant expression.
|
|
const bool equals = i == j;
|
|
^");
|
|
}
|
|
static method main() → dynamic {}
|
|
|
|
constants {
|
|
#C1 = 4
|
|
#C2 = 24
|
|
#C3 = 96
|
|
#C4 = false
|
|
}
|