[cfe] Report errors on attempts to call a record type

Closes https://github.com/dart-lang/sdk/issues/54616

Change-Id: Ib0a74ae139a56e0660b3cfb00127c898d693a03c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349000
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
This commit is contained in:
Chloe Stefantsova 2024-01-31 08:46:40 +00:00 committed by Commit Queue
parent 8ea636f9f8
commit 4dff1b3b0a
22 changed files with 1184 additions and 8 deletions

View file

@ -12672,6 +12672,15 @@ const MessageCode messageRecordTypeZeroFieldsButTrailingComma =
r"""A record type without fields can't have a trailing comma.""",
correctionMessage: r"""Try removing the trailing comma.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeRecordUsedAsCallable = messageRecordUsedAsCallable;
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const MessageCode messageRecordUsedAsCallable = const MessageCode(
"RecordUsedAsCallable",
problemMessage:
r"""The 'call' property on the record type isn't directly callable but could be invoked by `.call(...)`""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeRedirectingConstructorWithAnotherInitializer =
messageRedirectingConstructorWithAnotherInitializer;

View file

@ -9,8 +9,6 @@ import 'package:_fe_analyzer_shared/src/flow_analysis/flow_analysis_operations.d
import 'package:_fe_analyzer_shared/src/type_inference/assigned_variables.dart';
import 'package:_fe_analyzer_shared/src/testing/id.dart';
import 'package:_fe_analyzer_shared/src/util/link.dart';
import 'package:front_end/src/fasta/source/source_field_builder.dart';
import 'package:front_end/src/fasta/source/source_procedure_builder.dart';
import 'package:kernel/ast.dart';
import 'package:kernel/class_hierarchy.dart'
show ClassHierarchyBase, ClassHierarchyMembers;
@ -43,8 +41,10 @@ import '../kernel/type_algorithms.dart' show hasAnyTypeVariables;
import '../names.dart';
import '../problems.dart' show internalProblem, unhandled;
import '../source/source_constructor_builder.dart';
import '../source/source_field_builder.dart';
import '../source/source_library_builder.dart'
show FieldNonPromotabilityInfo, SourceLibraryBuilder;
import '../source/source_procedure_builder.dart';
import '../util/helpers.dart';
import 'closure_context.dart';
import 'external_ast_helper.dart';
@ -3380,6 +3380,10 @@ abstract class InferenceVisitorBase implements InferenceVisitor {
hoistedExpressions: hoistedExpressions);
case ObjectAccessTargetKind.recordNamed:
case ObjectAccessTargetKind.nullableRecordNamed:
if (isImplicitCall && !target.isNullable) {
libraryBuilder.addProblem(messageRecordUsedAsCallable,
receiver.fileOffset, noLength, libraryBuilder.fileUri);
}
DartType type = target.getGetterType(this);
Expression read = new RecordNameGet(receiver,
target.receiverType as RecordType, target.recordFieldName!)

View file

@ -631,6 +631,12 @@ JsInteropExternalExtensionMemberWithStaticDisallowed/analyzerCode: Fail # Web co
JsInteropExternalExtensionMemberWithStaticDisallowed/example: Fail # Web compiler specific
JsInteropExternalMemberNotJSAnnotated/analyzerCode: Fail # Web compiler specific
JsInteropExternalMemberNotJSAnnotated/example: Fail # Web compiler specific
JsInteropFunctionToJSRequiresStaticType/analyzerCode: Fail # Web compiler specific
JsInteropFunctionToJSRequiresStaticType/example: Fail # Web compiler specific
JsInteropFunctionToJSTypeParameters/analyzerCode: Fail # Web compiler specific
JsInteropFunctionToJSTypeParameters/example: Fail # Web compiler specific
JsInteropInvalidStaticClassMemberName/analyzerCode: Fail
JsInteropInvalidStaticClassMemberName/example: Fail
JsInteropIsAInvalidType/analyzerCode: Fail # Web compiler specific
JsInteropIsAInvalidType/example: Fail # Web compiler specific
JsInteropIsAObjectLiteralType/analyzerCode: Fail # Web compiler specific
@ -639,12 +645,6 @@ JsInteropIsAPrimitiveExtensionType/analyzerCode: Fail # Web compiler specific
JsInteropIsAPrimitiveExtensionType/example: Fail # Web compiler specific
JsInteropIsATearoff/analyzerCode: Fail # Web compiler specific
JsInteropIsATearoff/example: Fail # Web compiler specific
JsInteropFunctionToJSRequiresStaticType/analyzerCode: Fail # Web compiler specific
JsInteropFunctionToJSRequiresStaticType/example: Fail # Web compiler specific
JsInteropFunctionToJSTypeParameters/analyzerCode: Fail # Web compiler specific
JsInteropFunctionToJSTypeParameters/example: Fail # Web compiler specific
JsInteropInvalidStaticClassMemberName/analyzerCode: Fail
JsInteropInvalidStaticClassMemberName/example: Fail
JsInteropJSClassExtendsDartClass/analyzerCode: Fail # Web compiler specific
JsInteropJSClassExtendsDartClass/example: Fail # Web compiler specific
JsInteropNamedParameters/analyzerCode: Fail # Web compiler specific
@ -930,6 +930,9 @@ PrefixAfterCombinator/example: Fail
PreviousUseOfName/analyzerCode: Fail
PreviousUseOfName/example: Fail
PrivateNamedParameter/example: Fail
RecordUsedAsCallable/analyzerCode: Fail
RecordUsedAsCallable/part_wrapped_script: Fail
RecordUsedAsCallable/script: Fail
RedirectingConstructorWithBody/part_wrapped_script1: Fail
RedirectingConstructorWithBody/script1: Fail
RedirectingFactoryIncompatibleTypeArgumentWarning/example: Fail

View file

@ -7619,3 +7619,8 @@ ExtensionTypeImplementsDeferred:
extension type ET(d.A id) implements d.A {}
lib.dart: |
class A {}
RecordUsedAsCallable:
problemMessage: "The 'call' property on the record type isn't directly callable but could be invoked by `.call(...)`"
script: |
test(({dynamic call} r) => r(0);

View file

@ -0,0 +1,17 @@
// Copyright (c) 2024, 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.
void main() {
var c = (call: (int x) => x);
var v = c(1); // Error.
var c2 = (call: intId);
var v2 = c2(1); // Error.
var c3 = (call: <T>(T x) => x);
var v3a = c3(1); // Error.
var v3b = c3("a"); // Error.
}
int intId(int x) => x;

View file

@ -0,0 +1,39 @@
library;
//
// Problems in library:
//
// pkg/front_end/testcases/records/issue54616.dart:7:11: Error: The 'call' property on the record type isn't directly callable but could be invoked by `.call(...)`
// var v = c(1); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616.dart:10:12: Error: The 'call' property on the record type isn't directly callable but could be invoked by `.call(...)`
// var v2 = c2(1); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616.dart:13:13: Error: The 'call' property on the record type isn't directly callable but could be invoked by `.call(...)`
// var v3a = c3(1); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616.dart:14:13: Error: The 'call' property on the record type isn't directly callable but could be invoked by `.call(...)`
// var v3b = c3("a"); // Error.
// ^
//
import self as self;
import "dart:core" as core;
static method main() → void {
({call: (core::int) → core::int}) c = ({call: (core::int x) → core::int => x});
core::int v = c.call{(core::int) → core::int}(1){(core::int) → core::int};
({call: (core::int) → core::int}) c2 = #C2;
core::int v2 = c2.call{(core::int) → core::int}(1){(core::int) → core::int};
({call: <T extends core::Object? = dynamic>(T%) → T%}) c3 = ({call: <T extends core::Object? = dynamic>(T% x) → T% => x});
core::int v3a = c3.call{<T extends core::Object? = dynamic>(T%) → T%}<core::int>(1){(core::int) → core::int};
core::String v3b = c3.call{<T extends core::Object? = dynamic>(T%) → T%}<core::String>("a"){(core::String) → core::String};
}
static method intId(core::int x) → core::int
return x;
constants {
#C1 = static-tearoff self::intId
#C2 = ({call:#C1})
}

View file

@ -0,0 +1,39 @@
library;
//
// Problems in library:
//
// pkg/front_end/testcases/records/issue54616.dart:7:11: Error: The 'call' property on the record type isn't directly callable but could be invoked by `.call(...)`
// var v = c(1); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616.dart:10:12: Error: The 'call' property on the record type isn't directly callable but could be invoked by `.call(...)`
// var v2 = c2(1); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616.dart:13:13: Error: The 'call' property on the record type isn't directly callable but could be invoked by `.call(...)`
// var v3a = c3(1); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616.dart:14:13: Error: The 'call' property on the record type isn't directly callable but could be invoked by `.call(...)`
// var v3b = c3("a"); // Error.
// ^
//
import self as self;
import "dart:core" as core;
static method main() → void {
({call: (core::int) → core::int}) c = ({call: (core::int x) → core::int => x});
core::int v = c.call{(core::int) → core::int}(1){(core::int) → core::int};
({call: (core::int) → core::int}) c2 = #C2;
core::int v2 = c2.call{(core::int) → core::int}(1){(core::int) → core::int};
({call: <T extends core::Object? = dynamic>(T%) → T%}) c3 = ({call: <T extends core::Object? = dynamic>(T% x) → T% => x});
core::int v3a = c3.call{<T extends core::Object? = dynamic>(T%) → T%}<core::int>(1){(core::int) → core::int};
core::String v3b = c3.call{<T extends core::Object? = dynamic>(T%) → T%}<core::String>("a"){(core::String) → core::String};
}
static method intId(core::int x) → core::int
return x;
constants {
#C1 = static-tearoff self::intId
#C2 = ({call:#C1})
}

View file

@ -0,0 +1,3 @@
void main() {}
int intId(int x) => x;

View file

@ -0,0 +1,3 @@
int intId(int x) => x;
void main() {}

View file

@ -0,0 +1,39 @@
library;
//
// Problems in library:
//
// pkg/front_end/testcases/records/issue54616.dart:7:11: Error: The 'call' property on the record type isn't directly callable but could be invoked by `.call(...)`
// var v = c(1); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616.dart:10:12: Error: The 'call' property on the record type isn't directly callable but could be invoked by `.call(...)`
// var v2 = c2(1); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616.dart:13:13: Error: The 'call' property on the record type isn't directly callable but could be invoked by `.call(...)`
// var v3a = c3(1); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616.dart:14:13: Error: The 'call' property on the record type isn't directly callable but could be invoked by `.call(...)`
// var v3b = c3("a"); // Error.
// ^
//
import self as self;
import "dart:core" as core;
static method main() → void {
({call: (core::int) → core::int}) c = ({call: (core::int x) → core::int => x});
core::int v = c.call{(core::int) → core::int}(1){(core::int) → core::int};
({call: (core::int) → core::int}) c2 = #C2;
core::int v2 = c2.call{(core::int) → core::int}(1){(core::int) → core::int};
({call: <T extends core::Object? = dynamic>(T%) → T%}) c3 = ({call: <T extends core::Object? = dynamic>(T% x) → T% => x});
core::int v3a = c3.call{<T extends core::Object? = dynamic>(T%) → T%}<core::int>(1){(core::int) → core::int};
core::String v3b = c3.call{<T extends core::Object? = dynamic>(T%) → T%}<core::String>("a"){(core::String) → core::String};
}
static method intId(core::int x) → core::int
return x;
constants {
#C1 = static-tearoff self::intId
#C2 = ({call:#C1})
}

View file

@ -0,0 +1,39 @@
library;
//
// Problems in library:
//
// pkg/front_end/testcases/records/issue54616.dart:7:11: Error: The 'call' property on the record type isn't directly callable but could be invoked by `.call(...)`
// var v = c(1); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616.dart:10:12: Error: The 'call' property on the record type isn't directly callable but could be invoked by `.call(...)`
// var v2 = c2(1); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616.dart:13:13: Error: The 'call' property on the record type isn't directly callable but could be invoked by `.call(...)`
// var v3a = c3(1); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616.dart:14:13: Error: The 'call' property on the record type isn't directly callable but could be invoked by `.call(...)`
// var v3b = c3("a"); // Error.
// ^
//
import self as self;
import "dart:core" as core;
static method main() → void {
({call: (core::int) → core::int}) c = ({call: (core::int x) → core::int => x});
core::int v = c.call{(core::int) → core::int}(1){(core::int) → core::int};
({call: (core::int) → core::int}) c2 = #C2;
core::int v2 = c2.call{(core::int) → core::int}(1){(core::int) → core::int};
({call: <T extends core::Object? = dynamic>(T%) → T%}) c3 = ({call: <T extends core::Object? = dynamic>(T% x) → T% => x});
core::int v3a = c3.call{<T extends core::Object? = dynamic>(T%) → T%}<core::int>(1){(core::int) → core::int};
core::String v3b = c3.call{<T extends core::Object? = dynamic>(T%) → T%}<core::String>("a"){(core::String) → core::String};
}
static method intId(core::int x) → core::int
return x;
constants {
#C1 = static-tearoff self::intId
#C2 = ({call:#C1})
}

View file

@ -0,0 +1,8 @@
library;
import self as self;
import "dart:core" as core;
static method main() → void
;
static method intId(core::int x) → core::int
;

View file

@ -0,0 +1,39 @@
library;
//
// Problems in library:
//
// pkg/front_end/testcases/records/issue54616.dart:7:11: Error: The 'call' property on the record type isn't directly callable but could be invoked by `.call(...)`
// var v = c(1); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616.dart:10:12: Error: The 'call' property on the record type isn't directly callable but could be invoked by `.call(...)`
// var v2 = c2(1); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616.dart:13:13: Error: The 'call' property on the record type isn't directly callable but could be invoked by `.call(...)`
// var v3a = c3(1); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616.dart:14:13: Error: The 'call' property on the record type isn't directly callable but could be invoked by `.call(...)`
// var v3b = c3("a"); // Error.
// ^
//
import self as self;
import "dart:core" as core;
static method main() → void {
({call: (core::int) → core::int}) c = ({call: (core::int x) → core::int => x});
core::int v = c.call{(core::int) → core::int}(1){(core::int) → core::int};
({call: (core::int) → core::int}) c2 = #C2;
core::int v2 = c2.call{(core::int) → core::int}(1){(core::int) → core::int};
({call: <T extends core::Object? = dynamic>(T%) → T%}) c3 = ({call: <T extends core::Object? = dynamic>(T% x) → T% => x});
core::int v3a = c3.call{<T extends core::Object? = dynamic>(T%) → T%}<core::int>(1){(core::int) → core::int};
core::String v3b = c3.call{<T extends core::Object? = dynamic>(T%) → T%}<core::String>("a"){(core::String) → core::String};
}
static method intId(core::int x) → core::int
return x;
constants {
#C1 = static-tearoff self::intId
#C2 = ({call:#C1})
}

View file

@ -0,0 +1,52 @@
// Copyright (c) 2024, 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.
extension EInt on (int,) {
dynamic call(dynamic x) => x;
}
extension EIntIntCallInt on (int, int, {dynamic Function(dynamic) call}) {
dynamic call(dynamic x) => x;
}
test<X1 extends (int,), X2 extends (int, {dynamic Function(dynamic) call}), X3 extends (int, int, {dynamic Function(dynamic) call}), X4 extends (String,)>(
(int,) r1,
(int, {dynamic Function(dynamic) call}) r2,
(int, int, {dynamic Function(dynamic) call}) r3,
(String,) r4,
X1 x1,
X2 x2,
X3 x3,
X4 x4,
X1? x1n,
X2? x2n,
X3? x3n,
X4? x4n) {
r1(0); // Ok.
r2(0); // Error.
r3(0); // Error.
r4(0); // Error.
r1.call(0); // Ok.
r2.call(0); // Ok.
r3.call(0); // Ok.
r4.call(0); // Error.
x1(0); // Ok.
x2(0); // Error.
x3(0); // Error.
x4(0); // Error.
x1n(0); // Error.
x2n(0); // Error.
x3n(0); // Error.
x4n(0); // Error.
x1.call(0); // Ok.
x2.call(0); // Ok.
x3.call(0); // Ok.
x4.call(0); // Error.
x1n.call(0); // Error.
x2n.call(0); // Error.
x3n.call(0); // Error.
x4n.call(0); // Error.
}

View file

@ -0,0 +1,161 @@
library;
//
// Problems in library:
//
// pkg/front_end/testcases/records/issue54616_2.dart:27:3: Error: The 'call' property on the record type isn't directly callable but could be invoked by `.call(...)`
// r2(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:28:3: Error: The 'call' property on the record type isn't directly callable but could be invoked by `.call(...)`
// r3(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:29:5: Error: The method 'call' isn't defined for the class '(String)'.
// Try correcting the name to the name of an existing method, or defining a method named 'call'.
// r4(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:33:6: Error: The method 'call' isn't defined for the class '(String)'.
// Try correcting the name to the name of an existing method, or defining a method named 'call'.
// r4.call(0); // Error.
// ^^^^
//
// pkg/front_end/testcases/records/issue54616_2.dart:36:3: Error: The 'call' property on the record type isn't directly callable but could be invoked by `.call(...)`
// x2(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:37:3: Error: The 'call' property on the record type isn't directly callable but could be invoked by `.call(...)`
// x3(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:38:5: Error: The method 'call' isn't defined for the class '(String)'.
// Try correcting the name to the name of an existing method, or defining a method named 'call'.
// x4(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:39:6: Error: Can't use an expression of type 'X1?' as a function because it's potentially null.
// Try calling using ?.call instead.
// x1n(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:40:6: Error: Can't use an expression of type 'X2?' as a function because it's potentially null.
// Try calling using ?.call instead.
// x2n(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:41:6: Error: Can't use an expression of type 'X3?' as a function because it's potentially null.
// Try calling using ?.call instead.
// x3n(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:42:6: Error: The method 'call' isn't defined for the class '(String)?'.
// Try correcting the name to the name of an existing method, or defining a method named 'call'.
// x4n(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:47:6: Error: The method 'call' isn't defined for the class '(String)'.
// Try correcting the name to the name of an existing method, or defining a method named 'call'.
// x4.call(0); // Error.
// ^^^^
//
// pkg/front_end/testcases/records/issue54616_2.dart:48:7: Error: Method 'call' cannot be called on 'X1?' because it is potentially null.
// Try calling using ?. instead.
// x1n.call(0); // Error.
// ^^^^
//
// pkg/front_end/testcases/records/issue54616_2.dart:49:7: Error: Can't use an expression of type 'X2?' as a function because it's potentially null.
// Try calling using ?.call instead.
// x2n.call(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:50:7: Error: Can't use an expression of type 'X3?' as a function because it's potentially null.
// Try calling using ?.call instead.
// x3n.call(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:51:7: Error: The method 'call' isn't defined for the class '(String)?'.
// Try correcting the name to the name of an existing method, or defining a method named 'call'.
// x4n.call(0); // Error.
// ^^^^
//
import self as self;
import "dart:core" as core;
extension EInt on (core::int) {
method call = self::EInt|call;
method tearoff call = self::EInt|get#call;
}
extension EIntIntCallInt on (core::int, core::int, {required call: (dynamic) → dynamic}) {
method call = self::EIntIntCallInt|call;
method tearoff call = self::EIntIntCallInt|get#call;
}
static extension-member method EInt|call(lowered final(core::int) #this, dynamic x) → dynamic
return x;
static extension-member method EInt|get#call(lowered final(core::int) #this) → (dynamic) → dynamic
return (dynamic x) → dynamic => self::EInt|call(#this, x);
static extension-member method EIntIntCallInt|call(lowered final(core::int, core::int, {required call: (dynamic) → dynamic}) #this, dynamic x) → dynamic
return x;
static extension-member method EIntIntCallInt|get#call(lowered final(core::int, core::int, {required call: (dynamic) → dynamic}) #this) → (dynamic) → dynamic
return (dynamic x) → dynamic => self::EIntIntCallInt|call(#this, x);
static method test<X1 extends (core::int), X2 extends (core::int, {required call: (dynamic) → dynamic}), X3 extends (core::int, core::int, {required call: (dynamic) → dynamic}), X4 extends (core::String)>((core::int) r1, (core::int, {required call: (dynamic) → dynamic}) r2, (core::int, core::int, {required call: (dynamic) → dynamic}) r3, (core::String) r4, self::test::X1 x1, self::test::X2 x2, self::test::X3 x3, self::test::X4 x4, self::test::X1? x1n, self::test::X2? x2n, self::test::X3? x3n, self::test::X4? x4n) → dynamic {
self::EInt|call(r1, 0);
r2.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
r3.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:29:5: Error: The method 'call' isn't defined for the class '(String)'.
Try correcting the name to the name of an existing method, or defining a method named 'call'.
r4(0); // Error.
^" in r4{<unresolved>}.call(0);
self::EInt|call(r1, 0);
r2.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
r3.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:33:6: Error: The method 'call' isn't defined for the class '(String)'.
Try correcting the name to the name of an existing method, or defining a method named 'call'.
r4.call(0); // Error.
^^^^" in r4{<unresolved>}.call(0);
self::EInt|call(x1, 0);
x2.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
x3.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:38:5: Error: The method 'call' isn't defined for the class '(String)'.
Try correcting the name to the name of an existing method, or defining a method named 'call'.
x4(0); // Error.
^" in x4{<unresolved>}.call(0);
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:39:6: Error: Can't use an expression of type 'X1?' as a function because it's potentially null.
Try calling using ?.call instead.
x1n(0); // Error.
^" in self::EInt|call(x1n, 0);
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:40:6: Error: Can't use an expression of type 'X2?' as a function because it's potentially null.
Try calling using ?.call instead.
x2n(0); // Error.
^" in x2n.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:41:6: Error: Can't use an expression of type 'X3?' as a function because it's potentially null.
Try calling using ?.call instead.
x3n(0); // Error.
^" in x3n.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:42:6: Error: The method 'call' isn't defined for the class '(String)?'.
Try correcting the name to the name of an existing method, or defining a method named 'call'.
x4n(0); // Error.
^" in x4n{<unresolved>}.call(0);
self::EInt|call(x1, 0);
x2.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
x3.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:47:6: Error: The method 'call' isn't defined for the class '(String)'.
Try correcting the name to the name of an existing method, or defining a method named 'call'.
x4.call(0); // Error.
^^^^" in x4{<unresolved>}.call(0);
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:48:7: Error: Method 'call' cannot be called on 'X1?' because it is potentially null.
Try calling using ?. instead.
x1n.call(0); // Error.
^^^^" in self::EInt|call(x1n, 0);
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:49:7: Error: Can't use an expression of type 'X2?' as a function because it's potentially null.
Try calling using ?.call instead.
x2n.call(0); // Error.
^" in x2n.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:50:7: Error: Can't use an expression of type 'X3?' as a function because it's potentially null.
Try calling using ?.call instead.
x3n.call(0); // Error.
^" in x3n.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:51:7: Error: The method 'call' isn't defined for the class '(String)?'.
Try correcting the name to the name of an existing method, or defining a method named 'call'.
x4n.call(0); // Error.
^^^^" in x4n{<unresolved>}.call(0);
}

View file

@ -0,0 +1,161 @@
library;
//
// Problems in library:
//
// pkg/front_end/testcases/records/issue54616_2.dart:27:3: Error: The 'call' property on the record type isn't directly callable but could be invoked by `.call(...)`
// r2(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:28:3: Error: The 'call' property on the record type isn't directly callable but could be invoked by `.call(...)`
// r3(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:29:5: Error: The method 'call' isn't defined for the class '(String)'.
// Try correcting the name to the name of an existing method, or defining a method named 'call'.
// r4(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:33:6: Error: The method 'call' isn't defined for the class '(String)'.
// Try correcting the name to the name of an existing method, or defining a method named 'call'.
// r4.call(0); // Error.
// ^^^^
//
// pkg/front_end/testcases/records/issue54616_2.dart:36:3: Error: The 'call' property on the record type isn't directly callable but could be invoked by `.call(...)`
// x2(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:37:3: Error: The 'call' property on the record type isn't directly callable but could be invoked by `.call(...)`
// x3(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:38:5: Error: The method 'call' isn't defined for the class '(String)'.
// Try correcting the name to the name of an existing method, or defining a method named 'call'.
// x4(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:39:6: Error: Can't use an expression of type 'X1?' as a function because it's potentially null.
// Try calling using ?.call instead.
// x1n(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:40:6: Error: Can't use an expression of type 'X2?' as a function because it's potentially null.
// Try calling using ?.call instead.
// x2n(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:41:6: Error: Can't use an expression of type 'X3?' as a function because it's potentially null.
// Try calling using ?.call instead.
// x3n(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:42:6: Error: The method 'call' isn't defined for the class '(String)?'.
// Try correcting the name to the name of an existing method, or defining a method named 'call'.
// x4n(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:47:6: Error: The method 'call' isn't defined for the class '(String)'.
// Try correcting the name to the name of an existing method, or defining a method named 'call'.
// x4.call(0); // Error.
// ^^^^
//
// pkg/front_end/testcases/records/issue54616_2.dart:48:7: Error: Method 'call' cannot be called on 'X1?' because it is potentially null.
// Try calling using ?. instead.
// x1n.call(0); // Error.
// ^^^^
//
// pkg/front_end/testcases/records/issue54616_2.dart:49:7: Error: Can't use an expression of type 'X2?' as a function because it's potentially null.
// Try calling using ?.call instead.
// x2n.call(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:50:7: Error: Can't use an expression of type 'X3?' as a function because it's potentially null.
// Try calling using ?.call instead.
// x3n.call(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:51:7: Error: The method 'call' isn't defined for the class '(String)?'.
// Try correcting the name to the name of an existing method, or defining a method named 'call'.
// x4n.call(0); // Error.
// ^^^^
//
import self as self;
import "dart:core" as core;
extension EInt on (core::int) {
method call = self::EInt|call;
method tearoff call = self::EInt|get#call;
}
extension EIntIntCallInt on (core::int, core::int, {required call: (dynamic) → dynamic}) {
method call = self::EIntIntCallInt|call;
method tearoff call = self::EIntIntCallInt|get#call;
}
static extension-member method EInt|call(lowered final(core::int) #this, dynamic x) → dynamic
return x;
static extension-member method EInt|get#call(lowered final(core::int) #this) → (dynamic) → dynamic
return (dynamic x) → dynamic => self::EInt|call(#this, x);
static extension-member method EIntIntCallInt|call(lowered final(core::int, core::int, {required call: (dynamic) → dynamic}) #this, dynamic x) → dynamic
return x;
static extension-member method EIntIntCallInt|get#call(lowered final(core::int, core::int, {required call: (dynamic) → dynamic}) #this) → (dynamic) → dynamic
return (dynamic x) → dynamic => self::EIntIntCallInt|call(#this, x);
static method test<X1 extends (core::int), X2 extends (core::int, {required call: (dynamic) → dynamic}), X3 extends (core::int, core::int, {required call: (dynamic) → dynamic}), X4 extends (core::String)>((core::int) r1, (core::int, {required call: (dynamic) → dynamic}) r2, (core::int, core::int, {required call: (dynamic) → dynamic}) r3, (core::String) r4, self::test::X1 x1, self::test::X2 x2, self::test::X3 x3, self::test::X4 x4, self::test::X1? x1n, self::test::X2? x2n, self::test::X3? x3n, self::test::X4? x4n) → dynamic {
self::EInt|call(r1, 0);
r2.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
r3.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:29:5: Error: The method 'call' isn't defined for the class '(String)'.
Try correcting the name to the name of an existing method, or defining a method named 'call'.
r4(0); // Error.
^" in r4{<unresolved>}.call(0);
self::EInt|call(r1, 0);
r2.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
r3.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:33:6: Error: The method 'call' isn't defined for the class '(String)'.
Try correcting the name to the name of an existing method, or defining a method named 'call'.
r4.call(0); // Error.
^^^^" in r4{<unresolved>}.call(0);
self::EInt|call(x1, 0);
x2.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
x3.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:38:5: Error: The method 'call' isn't defined for the class '(String)'.
Try correcting the name to the name of an existing method, or defining a method named 'call'.
x4(0); // Error.
^" in x4{<unresolved>}.call(0);
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:39:6: Error: Can't use an expression of type 'X1?' as a function because it's potentially null.
Try calling using ?.call instead.
x1n(0); // Error.
^" in self::EInt|call(x1n, 0);
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:40:6: Error: Can't use an expression of type 'X2?' as a function because it's potentially null.
Try calling using ?.call instead.
x2n(0); // Error.
^" in x2n.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:41:6: Error: Can't use an expression of type 'X3?' as a function because it's potentially null.
Try calling using ?.call instead.
x3n(0); // Error.
^" in x3n.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:42:6: Error: The method 'call' isn't defined for the class '(String)?'.
Try correcting the name to the name of an existing method, or defining a method named 'call'.
x4n(0); // Error.
^" in x4n{<unresolved>}.call(0);
self::EInt|call(x1, 0);
x2.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
x3.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:47:6: Error: The method 'call' isn't defined for the class '(String)'.
Try correcting the name to the name of an existing method, or defining a method named 'call'.
x4.call(0); // Error.
^^^^" in x4{<unresolved>}.call(0);
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:48:7: Error: Method 'call' cannot be called on 'X1?' because it is potentially null.
Try calling using ?. instead.
x1n.call(0); // Error.
^^^^" in self::EInt|call(x1n, 0);
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:49:7: Error: Can't use an expression of type 'X2?' as a function because it's potentially null.
Try calling using ?.call instead.
x2n.call(0); // Error.
^" in x2n.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:50:7: Error: Can't use an expression of type 'X3?' as a function because it's potentially null.
Try calling using ?.call instead.
x3n.call(0); // Error.
^" in x3n.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:51:7: Error: The method 'call' isn't defined for the class '(String)?'.
Try correcting the name to the name of an existing method, or defining a method named 'call'.
x4n.call(0); // Error.
^^^^" in x4n{<unresolved>}.call(0);
}

View file

@ -0,0 +1,25 @@
extension EInt on (int,) {
dynamic call(dynamic x) => x;
}
extension EIntIntCallInt on (int, int, {dynamic Function(dynamic) call}) {
dynamic call(dynamic x) => x;
}
test<
X1 extends (int,),
X2 extends (int, {dynamic Function(dynamic) call}),
X3 extends (int, int, {dynamic Function(dynamic) call}),
X4 extends (String,)>(
(int,) r1,
(int, {dynamic Function(dynamic) call}) r2,
(int, int, {dynamic Function(dynamic) call}) r3,
(String,) r4,
X1 x1,
X2 x2,
X3 x3,
X4 x4,
X1? x1n,
X2? x2n,
X3? x3n,
X4? x4n) {}

View file

@ -0,0 +1,25 @@
extension EInt on (int,) {
dynamic call(dynamic x) => x;
}
extension EIntIntCallInt on (int, int, {dynamic Function(dynamic) call}) {
dynamic call(dynamic x) => x;
}
test<
X1 extends (int,),
X2 extends (int, {dynamic Function(dynamic) call}),
X3 extends (int, int, {dynamic Function(dynamic) call}),
X4 extends (String,)>(
(int,) r1,
(int, {dynamic Function(dynamic) call}) r2,
(int, int, {dynamic Function(dynamic) call}) r3,
(String,) r4,
X1 x1,
X2 x2,
X3 x3,
X4 x4,
X1? x1n,
X2? x2n,
X3? x3n,
X4? x4n) {}

View file

@ -0,0 +1,161 @@
library;
//
// Problems in library:
//
// pkg/front_end/testcases/records/issue54616_2.dart:27:3: Error: The 'call' property on the record type isn't directly callable but could be invoked by `.call(...)`
// r2(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:28:3: Error: The 'call' property on the record type isn't directly callable but could be invoked by `.call(...)`
// r3(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:29:5: Error: The method 'call' isn't defined for the class '(String)'.
// Try correcting the name to the name of an existing method, or defining a method named 'call'.
// r4(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:33:6: Error: The method 'call' isn't defined for the class '(String)'.
// Try correcting the name to the name of an existing method, or defining a method named 'call'.
// r4.call(0); // Error.
// ^^^^
//
// pkg/front_end/testcases/records/issue54616_2.dart:36:3: Error: The 'call' property on the record type isn't directly callable but could be invoked by `.call(...)`
// x2(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:37:3: Error: The 'call' property on the record type isn't directly callable but could be invoked by `.call(...)`
// x3(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:38:5: Error: The method 'call' isn't defined for the class '(String)'.
// Try correcting the name to the name of an existing method, or defining a method named 'call'.
// x4(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:39:6: Error: Can't use an expression of type 'X1?' as a function because it's potentially null.
// Try calling using ?.call instead.
// x1n(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:40:6: Error: Can't use an expression of type 'X2?' as a function because it's potentially null.
// Try calling using ?.call instead.
// x2n(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:41:6: Error: Can't use an expression of type 'X3?' as a function because it's potentially null.
// Try calling using ?.call instead.
// x3n(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:42:6: Error: The method 'call' isn't defined for the class '(String)?'.
// Try correcting the name to the name of an existing method, or defining a method named 'call'.
// x4n(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:47:6: Error: The method 'call' isn't defined for the class '(String)'.
// Try correcting the name to the name of an existing method, or defining a method named 'call'.
// x4.call(0); // Error.
// ^^^^
//
// pkg/front_end/testcases/records/issue54616_2.dart:48:7: Error: Method 'call' cannot be called on 'X1?' because it is potentially null.
// Try calling using ?. instead.
// x1n.call(0); // Error.
// ^^^^
//
// pkg/front_end/testcases/records/issue54616_2.dart:49:7: Error: Can't use an expression of type 'X2?' as a function because it's potentially null.
// Try calling using ?.call instead.
// x2n.call(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:50:7: Error: Can't use an expression of type 'X3?' as a function because it's potentially null.
// Try calling using ?.call instead.
// x3n.call(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:51:7: Error: The method 'call' isn't defined for the class '(String)?'.
// Try correcting the name to the name of an existing method, or defining a method named 'call'.
// x4n.call(0); // Error.
// ^^^^
//
import self as self;
import "dart:core" as core;
extension EInt on (core::int) {
method call = self::EInt|call;
method tearoff call = self::EInt|get#call;
}
extension EIntIntCallInt on (core::int, core::int, {required call: (dynamic) → dynamic}) {
method call = self::EIntIntCallInt|call;
method tearoff call = self::EIntIntCallInt|get#call;
}
static extension-member method EInt|call(lowered final(core::int) #this, dynamic x) → dynamic
return x;
static extension-member method EInt|get#call(lowered final(core::int) #this) → (dynamic) → dynamic
return (dynamic x) → dynamic => self::EInt|call(#this, x);
static extension-member method EIntIntCallInt|call(lowered final(core::int, core::int, {required call: (dynamic) → dynamic}) #this, dynamic x) → dynamic
return x;
static extension-member method EIntIntCallInt|get#call(lowered final(core::int, core::int, {required call: (dynamic) → dynamic}) #this) → (dynamic) → dynamic
return (dynamic x) → dynamic => self::EIntIntCallInt|call(#this, x);
static method test<X1 extends (core::int), X2 extends (core::int, {required call: (dynamic) → dynamic}), X3 extends (core::int, core::int, {required call: (dynamic) → dynamic}), X4 extends (core::String)>((core::int) r1, (core::int, {required call: (dynamic) → dynamic}) r2, (core::int, core::int, {required call: (dynamic) → dynamic}) r3, (core::String) r4, self::test::X1 x1, self::test::X2 x2, self::test::X3 x3, self::test::X4 x4, self::test::X1? x1n, self::test::X2? x2n, self::test::X3? x3n, self::test::X4? x4n) → dynamic {
self::EInt|call(r1, 0);
r2.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
r3.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:29:5: Error: The method 'call' isn't defined for the class '(String)'.
Try correcting the name to the name of an existing method, or defining a method named 'call'.
r4(0); // Error.
^" in r4{<unresolved>}.call(0);
self::EInt|call(r1, 0);
r2.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
r3.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:33:6: Error: The method 'call' isn't defined for the class '(String)'.
Try correcting the name to the name of an existing method, or defining a method named 'call'.
r4.call(0); // Error.
^^^^" in r4{<unresolved>}.call(0);
self::EInt|call(x1, 0);
x2.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
x3.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:38:5: Error: The method 'call' isn't defined for the class '(String)'.
Try correcting the name to the name of an existing method, or defining a method named 'call'.
x4(0); // Error.
^" in x4{<unresolved>}.call(0);
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:39:6: Error: Can't use an expression of type 'X1?' as a function because it's potentially null.
Try calling using ?.call instead.
x1n(0); // Error.
^" in self::EInt|call(x1n, 0);
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:40:6: Error: Can't use an expression of type 'X2?' as a function because it's potentially null.
Try calling using ?.call instead.
x2n(0); // Error.
^" in x2n.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:41:6: Error: Can't use an expression of type 'X3?' as a function because it's potentially null.
Try calling using ?.call instead.
x3n(0); // Error.
^" in x3n.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:42:6: Error: The method 'call' isn't defined for the class '(String)?'.
Try correcting the name to the name of an existing method, or defining a method named 'call'.
x4n(0); // Error.
^" in x4n{<unresolved>}.call(0);
self::EInt|call(x1, 0);
x2.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
x3.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:47:6: Error: The method 'call' isn't defined for the class '(String)'.
Try correcting the name to the name of an existing method, or defining a method named 'call'.
x4.call(0); // Error.
^^^^" in x4{<unresolved>}.call(0);
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:48:7: Error: Method 'call' cannot be called on 'X1?' because it is potentially null.
Try calling using ?. instead.
x1n.call(0); // Error.
^^^^" in self::EInt|call(x1n, 0);
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:49:7: Error: Can't use an expression of type 'X2?' as a function because it's potentially null.
Try calling using ?.call instead.
x2n.call(0); // Error.
^" in x2n.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:50:7: Error: Can't use an expression of type 'X3?' as a function because it's potentially null.
Try calling using ?.call instead.
x3n.call(0); // Error.
^" in x3n.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:51:7: Error: The method 'call' isn't defined for the class '(String)?'.
Try correcting the name to the name of an existing method, or defining a method named 'call'.
x4n.call(0); // Error.
^^^^" in x4n{<unresolved>}.call(0);
}

View file

@ -0,0 +1,161 @@
library;
//
// Problems in library:
//
// pkg/front_end/testcases/records/issue54616_2.dart:27:3: Error: The 'call' property on the record type isn't directly callable but could be invoked by `.call(...)`
// r2(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:28:3: Error: The 'call' property on the record type isn't directly callable but could be invoked by `.call(...)`
// r3(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:29:5: Error: The method 'call' isn't defined for the class '(String)'.
// Try correcting the name to the name of an existing method, or defining a method named 'call'.
// r4(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:33:6: Error: The method 'call' isn't defined for the class '(String)'.
// Try correcting the name to the name of an existing method, or defining a method named 'call'.
// r4.call(0); // Error.
// ^^^^
//
// pkg/front_end/testcases/records/issue54616_2.dart:36:3: Error: The 'call' property on the record type isn't directly callable but could be invoked by `.call(...)`
// x2(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:37:3: Error: The 'call' property on the record type isn't directly callable but could be invoked by `.call(...)`
// x3(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:38:5: Error: The method 'call' isn't defined for the class '(String)'.
// Try correcting the name to the name of an existing method, or defining a method named 'call'.
// x4(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:39:6: Error: Can't use an expression of type 'X1?' as a function because it's potentially null.
// Try calling using ?.call instead.
// x1n(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:40:6: Error: Can't use an expression of type 'X2?' as a function because it's potentially null.
// Try calling using ?.call instead.
// x2n(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:41:6: Error: Can't use an expression of type 'X3?' as a function because it's potentially null.
// Try calling using ?.call instead.
// x3n(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:42:6: Error: The method 'call' isn't defined for the class '(String)?'.
// Try correcting the name to the name of an existing method, or defining a method named 'call'.
// x4n(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:47:6: Error: The method 'call' isn't defined for the class '(String)'.
// Try correcting the name to the name of an existing method, or defining a method named 'call'.
// x4.call(0); // Error.
// ^^^^
//
// pkg/front_end/testcases/records/issue54616_2.dart:48:7: Error: Method 'call' cannot be called on 'X1?' because it is potentially null.
// Try calling using ?. instead.
// x1n.call(0); // Error.
// ^^^^
//
// pkg/front_end/testcases/records/issue54616_2.dart:49:7: Error: Can't use an expression of type 'X2?' as a function because it's potentially null.
// Try calling using ?.call instead.
// x2n.call(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:50:7: Error: Can't use an expression of type 'X3?' as a function because it's potentially null.
// Try calling using ?.call instead.
// x3n.call(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:51:7: Error: The method 'call' isn't defined for the class '(String)?'.
// Try correcting the name to the name of an existing method, or defining a method named 'call'.
// x4n.call(0); // Error.
// ^^^^
//
import self as self;
import "dart:core" as core;
extension EInt on (core::int) {
method call = self::EInt|call;
method tearoff call = self::EInt|get#call;
}
extension EIntIntCallInt on (core::int, core::int, {required call: (dynamic) → dynamic}) {
method call = self::EIntIntCallInt|call;
method tearoff call = self::EIntIntCallInt|get#call;
}
static extension-member method EInt|call(lowered final(core::int) #this, dynamic x) → dynamic
return x;
static extension-member method EInt|get#call(lowered final(core::int) #this) → (dynamic) → dynamic
return (dynamic x) → dynamic => self::EInt|call(#this, x);
static extension-member method EIntIntCallInt|call(lowered final(core::int, core::int, {required call: (dynamic) → dynamic}) #this, dynamic x) → dynamic
return x;
static extension-member method EIntIntCallInt|get#call(lowered final(core::int, core::int, {required call: (dynamic) → dynamic}) #this) → (dynamic) → dynamic
return (dynamic x) → dynamic => self::EIntIntCallInt|call(#this, x);
static method test<X1 extends (core::int), X2 extends (core::int, {required call: (dynamic) → dynamic}), X3 extends (core::int, core::int, {required call: (dynamic) → dynamic}), X4 extends (core::String)>((core::int) r1, (core::int, {required call: (dynamic) → dynamic}) r2, (core::int, core::int, {required call: (dynamic) → dynamic}) r3, (core::String) r4, self::test::X1 x1, self::test::X2 x2, self::test::X3 x3, self::test::X4 x4, self::test::X1? x1n, self::test::X2? x2n, self::test::X3? x3n, self::test::X4? x4n) → dynamic {
self::EInt|call(r1, 0);
r2.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
r3.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:29:5: Error: The method 'call' isn't defined for the class '(String)'.
Try correcting the name to the name of an existing method, or defining a method named 'call'.
r4(0); // Error.
^" in r4{<unresolved>}.call(0);
self::EInt|call(r1, 0);
r2.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
r3.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:33:6: Error: The method 'call' isn't defined for the class '(String)'.
Try correcting the name to the name of an existing method, or defining a method named 'call'.
r4.call(0); // Error.
^^^^" in r4{<unresolved>}.call(0);
self::EInt|call(x1, 0);
x2.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
x3.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:38:5: Error: The method 'call' isn't defined for the class '(String)'.
Try correcting the name to the name of an existing method, or defining a method named 'call'.
x4(0); // Error.
^" in x4{<unresolved>}.call(0);
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:39:6: Error: Can't use an expression of type 'X1?' as a function because it's potentially null.
Try calling using ?.call instead.
x1n(0); // Error.
^" in self::EInt|call(x1n, 0);
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:40:6: Error: Can't use an expression of type 'X2?' as a function because it's potentially null.
Try calling using ?.call instead.
x2n(0); // Error.
^" in x2n.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:41:6: Error: Can't use an expression of type 'X3?' as a function because it's potentially null.
Try calling using ?.call instead.
x3n(0); // Error.
^" in x3n.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:42:6: Error: The method 'call' isn't defined for the class '(String)?'.
Try correcting the name to the name of an existing method, or defining a method named 'call'.
x4n(0); // Error.
^" in x4n{<unresolved>}.call(0);
self::EInt|call(x1, 0);
x2.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
x3.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:47:6: Error: The method 'call' isn't defined for the class '(String)'.
Try correcting the name to the name of an existing method, or defining a method named 'call'.
x4.call(0); // Error.
^^^^" in x4{<unresolved>}.call(0);
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:48:7: Error: Method 'call' cannot be called on 'X1?' because it is potentially null.
Try calling using ?. instead.
x1n.call(0); // Error.
^^^^" in self::EInt|call(x1n, 0);
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:49:7: Error: Can't use an expression of type 'X2?' as a function because it's potentially null.
Try calling using ?.call instead.
x2n.call(0); // Error.
^" in x2n.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:50:7: Error: Can't use an expression of type 'X3?' as a function because it's potentially null.
Try calling using ?.call instead.
x3n.call(0); // Error.
^" in x3n.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:51:7: Error: The method 'call' isn't defined for the class '(String)?'.
Try correcting the name to the name of an existing method, or defining a method named 'call'.
x4n.call(0); // Error.
^^^^" in x4n{<unresolved>}.call(0);
}

View file

@ -0,0 +1,22 @@
library;
import self as self;
import "dart:core" as core;
extension EInt on (core::int) {
method call = self::EInt|call;
method tearoff call = self::EInt|get#call;
}
extension EIntIntCallInt on (core::int, core::int, {required call: (dynamic) → dynamic}) {
method call = self::EIntIntCallInt|call;
method tearoff call = self::EIntIntCallInt|get#call;
}
static extension-member method EInt|call(lowered final(core::int) #this, dynamic x) → dynamic
;
static extension-member method EInt|get#call(lowered final(core::int) #this) → (dynamic) → dynamic
return (dynamic x) → dynamic => self::EInt|call(#this, x);
static extension-member method EIntIntCallInt|call(lowered final(core::int, core::int, {required call: (dynamic) → dynamic}) #this, dynamic x) → dynamic
;
static extension-member method EIntIntCallInt|get#call(lowered final(core::int, core::int, {required call: (dynamic) → dynamic}) #this) → (dynamic) → dynamic
return (dynamic x) → dynamic => self::EIntIntCallInt|call(#this, x);
static method test<X1 extends (core::int), X2 extends (core::int, {required call: (dynamic) → dynamic}), X3 extends (core::int, core::int, {required call: (dynamic) → dynamic}), X4 extends (core::String)>((core::int) r1, (core::int, {required call: (dynamic) → dynamic}) r2, (core::int, core::int, {required call: (dynamic) → dynamic}) r3, (core::String) r4, self::test::X1 x1, self::test::X2 x2, self::test::X3 x3, self::test::X4 x4, self::test::X1? x1n, self::test::X2? x2n, self::test::X3? x3n, self::test::X4? x4n) → dynamic
;

View file

@ -0,0 +1,161 @@
library;
//
// Problems in library:
//
// pkg/front_end/testcases/records/issue54616_2.dart:27:3: Error: The 'call' property on the record type isn't directly callable but could be invoked by `.call(...)`
// r2(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:28:3: Error: The 'call' property on the record type isn't directly callable but could be invoked by `.call(...)`
// r3(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:29:5: Error: The method 'call' isn't defined for the class '(String)'.
// Try correcting the name to the name of an existing method, or defining a method named 'call'.
// r4(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:33:6: Error: The method 'call' isn't defined for the class '(String)'.
// Try correcting the name to the name of an existing method, or defining a method named 'call'.
// r4.call(0); // Error.
// ^^^^
//
// pkg/front_end/testcases/records/issue54616_2.dart:36:3: Error: The 'call' property on the record type isn't directly callable but could be invoked by `.call(...)`
// x2(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:37:3: Error: The 'call' property on the record type isn't directly callable but could be invoked by `.call(...)`
// x3(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:38:5: Error: The method 'call' isn't defined for the class '(String)'.
// Try correcting the name to the name of an existing method, or defining a method named 'call'.
// x4(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:39:6: Error: Can't use an expression of type 'X1?' as a function because it's potentially null.
// Try calling using ?.call instead.
// x1n(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:40:6: Error: Can't use an expression of type 'X2?' as a function because it's potentially null.
// Try calling using ?.call instead.
// x2n(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:41:6: Error: Can't use an expression of type 'X3?' as a function because it's potentially null.
// Try calling using ?.call instead.
// x3n(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:42:6: Error: The method 'call' isn't defined for the class '(String)?'.
// Try correcting the name to the name of an existing method, or defining a method named 'call'.
// x4n(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:47:6: Error: The method 'call' isn't defined for the class '(String)'.
// Try correcting the name to the name of an existing method, or defining a method named 'call'.
// x4.call(0); // Error.
// ^^^^
//
// pkg/front_end/testcases/records/issue54616_2.dart:48:7: Error: Method 'call' cannot be called on 'X1?' because it is potentially null.
// Try calling using ?. instead.
// x1n.call(0); // Error.
// ^^^^
//
// pkg/front_end/testcases/records/issue54616_2.dart:49:7: Error: Can't use an expression of type 'X2?' as a function because it's potentially null.
// Try calling using ?.call instead.
// x2n.call(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:50:7: Error: Can't use an expression of type 'X3?' as a function because it's potentially null.
// Try calling using ?.call instead.
// x3n.call(0); // Error.
// ^
//
// pkg/front_end/testcases/records/issue54616_2.dart:51:7: Error: The method 'call' isn't defined for the class '(String)?'.
// Try correcting the name to the name of an existing method, or defining a method named 'call'.
// x4n.call(0); // Error.
// ^^^^
//
import self as self;
import "dart:core" as core;
extension EInt on (core::int) {
method call = self::EInt|call;
method tearoff call = self::EInt|get#call;
}
extension EIntIntCallInt on (core::int, core::int, {required call: (dynamic) → dynamic}) {
method call = self::EIntIntCallInt|call;
method tearoff call = self::EIntIntCallInt|get#call;
}
static extension-member method EInt|call(lowered final(core::int) #this, dynamic x) → dynamic
return x;
static extension-member method EInt|get#call(lowered final(core::int) #this) → (dynamic) → dynamic
return (dynamic x) → dynamic => self::EInt|call(#this, x);
static extension-member method EIntIntCallInt|call(lowered final(core::int, core::int, {required call: (dynamic) → dynamic}) #this, dynamic x) → dynamic
return x;
static extension-member method EIntIntCallInt|get#call(lowered final(core::int, core::int, {required call: (dynamic) → dynamic}) #this) → (dynamic) → dynamic
return (dynamic x) → dynamic => self::EIntIntCallInt|call(#this, x);
static method test<X1 extends (core::int), X2 extends (core::int, {required call: (dynamic) → dynamic}), X3 extends (core::int, core::int, {required call: (dynamic) → dynamic}), X4 extends (core::String)>((core::int) r1, (core::int, {required call: (dynamic) → dynamic}) r2, (core::int, core::int, {required call: (dynamic) → dynamic}) r3, (core::String) r4, self::test::X1 x1, self::test::X2 x2, self::test::X3 x3, self::test::X4 x4, self::test::X1? x1n, self::test::X2? x2n, self::test::X3? x3n, self::test::X4? x4n) → dynamic {
self::EInt|call(r1, 0);
r2.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
r3.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:29:5: Error: The method 'call' isn't defined for the class '(String)'.
Try correcting the name to the name of an existing method, or defining a method named 'call'.
r4(0); // Error.
^" in r4{<unresolved>}.call(0);
self::EInt|call(r1, 0);
r2.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
r3.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:33:6: Error: The method 'call' isn't defined for the class '(String)'.
Try correcting the name to the name of an existing method, or defining a method named 'call'.
r4.call(0); // Error.
^^^^" in r4{<unresolved>}.call(0);
self::EInt|call(x1, 0);
x2.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
x3.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:38:5: Error: The method 'call' isn't defined for the class '(String)'.
Try correcting the name to the name of an existing method, or defining a method named 'call'.
x4(0); // Error.
^" in x4{<unresolved>}.call(0);
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:39:6: Error: Can't use an expression of type 'X1?' as a function because it's potentially null.
Try calling using ?.call instead.
x1n(0); // Error.
^" in self::EInt|call(x1n, 0);
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:40:6: Error: Can't use an expression of type 'X2?' as a function because it's potentially null.
Try calling using ?.call instead.
x2n(0); // Error.
^" in x2n.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:41:6: Error: Can't use an expression of type 'X3?' as a function because it's potentially null.
Try calling using ?.call instead.
x3n(0); // Error.
^" in x3n.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:42:6: Error: The method 'call' isn't defined for the class '(String)?'.
Try correcting the name to the name of an existing method, or defining a method named 'call'.
x4n(0); // Error.
^" in x4n{<unresolved>}.call(0);
self::EInt|call(x1, 0);
x2.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
x3.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:47:6: Error: The method 'call' isn't defined for the class '(String)'.
Try correcting the name to the name of an existing method, or defining a method named 'call'.
x4.call(0); // Error.
^^^^" in x4{<unresolved>}.call(0);
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:48:7: Error: Method 'call' cannot be called on 'X1?' because it is potentially null.
Try calling using ?. instead.
x1n.call(0); // Error.
^^^^" in self::EInt|call(x1n, 0);
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:49:7: Error: Can't use an expression of type 'X2?' as a function because it's potentially null.
Try calling using ?.call instead.
x2n.call(0); // Error.
^" in x2n.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:50:7: Error: Can't use an expression of type 'X3?' as a function because it's potentially null.
Try calling using ?.call instead.
x3n.call(0); // Error.
^" in x3n.call{(dynamic) → dynamic}(0){(dynamic) → dynamic};
invalid-expression "pkg/front_end/testcases/records/issue54616_2.dart:51:7: Error: The method 'call' isn't defined for the class '(String)?'.
Try correcting the name to the name of an existing method, or defining a method named 'call'.
x4n.call(0); // Error.
^^^^" in x4n{<unresolved>}.call(0);
}