[cfe] Dot Shorthands: Handle constructor tearoffs.

This CL adds support for constructor tearoffs in dot shorthands. If there's any type parameters on the tearoff and it's a constructor, we produce an error.

I also updated the expectations of existing tests due to an early return of `InvalidExpression`s and added language + cfe tests for the new behavior.

This CL fixes the following co19 tests and is a follow up to https://github.com/dart-lang/co19/issues/3122
co19/LanguageFeatures/Static-access-shorthand/constant_expression_A03_t01
co19/LanguageFeatures/Static-access-shorthand/constant_expression_A04_t01
co19/LanguageFeatures/Static-access-shorthand/semantics_A05_t01
co19/LanguageFeatures/Static-access-shorthand/constant_expression_A03_t02

Bug: https://github.com/dart-lang/sdk/issues/59758, https://github.com/dart-lang/co19/issues/3122
Change-Id: I1ea837342ad818cd3b1de9e422065f42e8a61d6b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/419782
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
This commit is contained in:
Kallen Tu
2025-04-04 15:29:09 -07:00
committed by Commit Queue
parent 33ed2d83ab
commit d3a0c152e4
28 changed files with 458 additions and 116 deletions
@@ -9323,6 +9323,9 @@ class BodyBuilder extends StackListenerImpl
pop() as List<TypeBuilder>?; // typeArguments
if (libraryFeatures.constructorTearoffs.isEnabled) {
Object? operand = pop();
if (operand is DotShorthandPropertyGet && typeArguments != null) {
operand.hasTypeParameters = true;
}
if (operand is Generator) {
push(operand.applyTypeArguments(
openAngleBracket.charOffset, typeArguments));
@@ -3293,7 +3293,14 @@ class DotShorthandPropertyGet extends InternalExpression {
final Name name;
final int nameOffset;
DotShorthandPropertyGet(this.name, {required this.nameOffset});
/// Whether this dot shorthand has type parameters.
///
/// Used for error checking for constructors with type parameters in the
/// [InferenceVisitor].
bool hasTypeParameters;
DotShorthandPropertyGet(this.name,
{required this.nameOffset, this.hasTypeParameters = false});
@override
ExpressionInferenceResult acceptInference(
@@ -697,6 +697,7 @@ class InferenceVisitorImpl extends InferenceVisitorBase
ExpressionInferenceResult operandResult = inferExpression(
node.expression, const UnknownType(),
isVoidAllowed: true);
if (operandResult.expression is InvalidExpression) return operandResult;
Expression operand = operandResult.expression;
DartType operandType = operandResult.inferredType;
if (operandType is! FunctionType) {
@@ -12289,12 +12290,42 @@ class InferenceVisitorImpl extends InferenceVisitorBase
expressionInferenceResult =
inferExpression(new StaticGet(member), cachedContext);
} else {
// Tearoff like `Object.new`;
expressionInferenceResult =
inferExpression(new StaticTearOff(member), cachedContext);
// Method tearoffs.
DartType type =
member.function.computeFunctionType(Nullability.nonNullable);
return instantiateTearOff(
type, typeContext, new StaticTearOff(member));
}
case Constructor():
case null:
// Handle constructor tearoffs.
if (cachedContext is TypeDeclarationType) {
Member? constructor = findConstructor(
cachedContext, node.name, node.fileOffset,
isTearoff: true);
// Dot shorthand constructor invocations with type parameters
// `.id<type>()` are not allowed.
if (constructor != null && node.hasTypeParameters) {
return new ExpressionInferenceResult(
const DynamicType(),
helper.buildProblem(
messageDotShorthandsConstructorInvocationWithTypeArguments,
node.nameOffset,
node.name.text.length));
}
if (constructor is Constructor) {
DartType type = constructor.function
.computeFunctionType(Nullability.nonNullable);
return instantiateTearOff(
type, typeContext, new ConstructorTearOff(constructor));
} else if (constructor is Procedure) {
DartType type = constructor.function
.computeFunctionType(Nullability.nonNullable);
return instantiateTearOff(
type, typeContext, new StaticTearOff(constructor));
}
}
if (isKnown(cachedContext)) {
// Error when we can't find the static getter or field [node.name] in
// the declaration of [cachedContext].
@@ -1148,7 +1148,8 @@ abstract class InferenceVisitorBase implements InferenceVisitor {
}
/// Finds a constructor of [type] called [name].
Member? findConstructor(TypeDeclarationType type, Name name, int fileOffset) {
Member? findConstructor(TypeDeclarationType type, Name name, int fileOffset,
{bool isTearoff = false}) {
// TODO(Dart Model team): Seems like an abstraction level issue to require
// going from `Class` objects back to builders to find a `Member`.
DeclarationBuilder builder;
@@ -1164,7 +1165,9 @@ abstract class InferenceVisitorBase implements InferenceVisitor {
MemberBuilder? constructorBuilder = builder.findConstructorOrFactory(
name.text, fileOffset, helper.uri, libraryBuilder);
return constructorBuilder?.invokeTarget;
return isTearoff
? constructorBuilder?.readTarget
: constructorBuilder?.invokeTarget;
}
/// Finds a member of [receiverType] called [name], and if it is found,
@@ -179,11 +179,6 @@ library;
// Class<int><int>.named<int>;
// ^^^^^
//
// pkg/front_end/testcases/constructor_tearoffs/duplicate_instantiation.dart:21:24: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'.
// Try changing the operand or remove the type arguments.
// Class<int><int>.named<int>;
// ^
//
// pkg/front_end/testcases/constructor_tearoffs/duplicate_instantiation.dart:22:8: Error: The operator '<' isn't defined for the class 'Type'.
// - 'Type' is from 'dart:core'.
// Try correcting the operator to an existing operator, or defining a '<' operator.
@@ -276,10 +271,11 @@ Try correcting the name to the name of an existing method, or defining a method
- 'Type' is from 'dart:core'.
Try correcting the operator to an existing operator, or defining a '<' operator.
Class<int><int>.named<int>;
^" in #C2{<unresolved>}.<(#C3){dynamic}.>(invalid-expression "pkg/front_end/testcases/constructor_tearoffs/duplicate_instantiation.dart:21:24: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'.
Try changing the operand or remove the type arguments.
^" in #C2{<unresolved>}.<(#C3){dynamic}.>(invalid-expression "pkg/front_end/testcases/constructor_tearoffs/duplicate_instantiation.dart:21:19: Error: The getter 'named' isn't defined for the class 'List<int>'.
- 'List' is from 'dart:core'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'named'.
Class<int><int>.named<int>;
^");
^^^^^" in <core::int>[]{<unresolved>}.named);
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/duplicate_instantiation.dart:22:8: Error: The operator '<' isn't defined for the class 'Type'.
- 'Type' is from 'dart:core'.
Try correcting the operator to an existing operator, or defining a '<' operator.
@@ -179,11 +179,6 @@ library;
// Class<int><int>.named<int>;
// ^^^^^
//
// pkg/front_end/testcases/constructor_tearoffs/duplicate_instantiation.dart:21:24: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'.
// Try changing the operand or remove the type arguments.
// Class<int><int>.named<int>;
// ^
//
// pkg/front_end/testcases/constructor_tearoffs/duplicate_instantiation.dart:22:8: Error: The operator '<' isn't defined for the class 'Type'.
// - 'Type' is from 'dart:core'.
// Try correcting the operator to an existing operator, or defining a '<' operator.
@@ -276,10 +271,11 @@ Try correcting the name to the name of an existing method, or defining a method
- 'Type' is from 'dart:core'.
Try correcting the operator to an existing operator, or defining a '<' operator.
Class<int><int>.named<int>;
^" in #C2{<unresolved>}.<(#C3){dynamic}.>(invalid-expression "pkg/front_end/testcases/constructor_tearoffs/duplicate_instantiation.dart:21:24: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'.
Try changing the operand or remove the type arguments.
^" in #C2{<unresolved>}.<(#C3){dynamic}.>(invalid-expression "pkg/front_end/testcases/constructor_tearoffs/duplicate_instantiation.dart:21:19: Error: The getter 'named' isn't defined for the class 'List<int>'.
- 'List' is from 'dart:core'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'named'.
Class<int><int>.named<int>;
^");
^^^^^" in <core::int>[]{<unresolved>}.named);
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/duplicate_instantiation.dart:22:8: Error: The operator '<' isn't defined for the class 'Type'.
- 'Type' is from 'dart:core'.
Try correcting the operator to an existing operator, or defining a '<' operator.
@@ -179,11 +179,6 @@ library;
// Class<int><int>.named<int>;
// ^^^^^
//
// pkg/front_end/testcases/constructor_tearoffs/duplicate_instantiation.dart:21:24: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'.
// Try changing the operand or remove the type arguments.
// Class<int><int>.named<int>;
// ^
//
// pkg/front_end/testcases/constructor_tearoffs/duplicate_instantiation.dart:22:8: Error: The operator '<' isn't defined for the class 'Type'.
// - 'Type' is from 'dart:core'.
// Try correcting the operator to an existing operator, or defining a '<' operator.
@@ -276,10 +271,11 @@ Try correcting the name to the name of an existing method, or defining a method
- 'Type' is from 'dart:core'.
Try correcting the operator to an existing operator, or defining a '<' operator.
Class<int><int>.named<int>;
^" in #C2{<unresolved>}.<(#C3){dynamic}.>(invalid-expression "pkg/front_end/testcases/constructor_tearoffs/duplicate_instantiation.dart:21:24: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'.
Try changing the operand or remove the type arguments.
^" in #C2{<unresolved>}.<(#C3){dynamic}.>(invalid-expression "pkg/front_end/testcases/constructor_tearoffs/duplicate_instantiation.dart:21:19: Error: The getter 'named' isn't defined for the class 'List<int>'.
- 'List' is from 'dart:core'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'named'.
Class<int><int>.named<int>;
^");
^^^^^" in core::_GrowableList::•<core::int>(0){<unresolved>}.named);
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/duplicate_instantiation.dart:22:8: Error: The operator '<' isn't defined for the class 'Type'.
- 'Type' is from 'dart:core'.
Try correcting the operator to an existing operator, or defining a '<' operator.
@@ -7,8 +7,12 @@ class C {
C.named();
}
extension type ET<T>(T v) {}
void test() {
C newConstructor = .new<int>();
C namedConstructor = .named<int>();
C newTearoff = .new<int>;
C namedTearoff = .new<int>;
ET e = .new<int>;
}
@@ -2,26 +2,30 @@ library;
//
// Problems in library:
//
// pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart:11:23: Error: A dot shorthand constructor invocation can't have type arguments.
// pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart:13:23: Error: A dot shorthand constructor invocation can't have type arguments.
// Try adding the class name and type arguments explicitly before the constructor name.
// C newConstructor = .new<int>();
// ^^^
//
// pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart:12:25: Error: A dot shorthand constructor invocation can't have type arguments.
// pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart:14:25: Error: A dot shorthand constructor invocation can't have type arguments.
// Try adding the class name and type arguments explicitly before the constructor name.
// C namedConstructor = .named<int>();
// ^^^^^
//
// pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart:13:19: Error: The static getter or field 'new' isn't defined for the type 'C'.
// - 'C' is from 'pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart'.
// Try correcting the name to the name of an existing static getter or field, or defining a getter or field named 'new'.
// pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart:15:19: Error: A dot shorthand constructor invocation can't have type arguments.
// Try adding the class name and type arguments explicitly before the constructor name.
// C newTearoff = .new<int>;
// ^^^
//
// pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart:13:22: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'.
// Try changing the operand or remove the type arguments.
// C newTearoff = .new<int>;
// ^
// pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart:16:21: Error: A dot shorthand constructor invocation can't have type arguments.
// Try adding the class name and type arguments explicitly before the constructor name.
// C namedTearoff = .new<int>;
// ^^^
//
// pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart:17:11: Error: A dot shorthand constructor invocation can't have type arguments.
// Try adding the class name and type arguments explicitly before the constructor name.
// ET e = .new<int>;
// ^^^
//
import self as self;
import "dart:core" as core;
@@ -34,17 +38,36 @@ class C extends core::Object {
: super core::Object::•()
;
}
extension type ET<T extends core::Object? = dynamic>(T% v) {
abstract extension-type-member representation-field get v() → T%;
constructor • = self::ET|constructor#;
constructor tearoff • = self::ET|constructor#_#new#tearOff;
}
static extension-type-member method ET|constructor#<T extends core::Object? = dynamic>(self::ET|constructor#::T% v) → self::ET<self::ET|constructor#::T%>% /* erasure=self::ET|constructor#::T%, declared=! */ {
lowered final self::ET<self::ET|constructor#::T%>% /* erasure=self::ET|constructor#::T%, declared=! */ #this = v;
return #this;
}
static extension-type-member method ET|constructor#_#new#tearOff<T extends core::Object? = dynamic>(self::ET|constructor#_#new#tearOff::T% v) → self::ET<self::ET|constructor#_#new#tearOff::T%>% /* erasure=self::ET|constructor#_#new#tearOff::T%, declared=! */
return self::ET|constructor#<self::ET|constructor#_#new#tearOff::T%>(v);
static method test() → void {
self::C newConstructor = invalid-expression "pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart:11:23: Error: A dot shorthand constructor invocation can't have type arguments.
self::C newConstructor = invalid-expression "pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart:13:23: Error: A dot shorthand constructor invocation can't have type arguments.
Try adding the class name and type arguments explicitly before the constructor name.
C newConstructor = .new<int>();
^^^" as{TypeError,ForDynamic} self::C;
self::C namedConstructor = invalid-expression "pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart:12:25: Error: A dot shorthand constructor invocation can't have type arguments.
self::C namedConstructor = invalid-expression "pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart:14:25: Error: A dot shorthand constructor invocation can't have type arguments.
Try adding the class name and type arguments explicitly before the constructor name.
C namedConstructor = .named<int>();
^^^^^" as{TypeError,ForDynamic} self::C;
self::C newTearoff = invalid-expression "pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart:13:22: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'.
Try changing the operand or remove the type arguments.
self::C newTearoff = invalid-expression "pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart:15:19: Error: A dot shorthand constructor invocation can't have type arguments.
Try adding the class name and type arguments explicitly before the constructor name.
C newTearoff = .new<int>;
^";
^^^" as{TypeError,ForDynamic} self::C;
self::C namedTearoff = invalid-expression "pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart:16:21: Error: A dot shorthand constructor invocation can't have type arguments.
Try adding the class name and type arguments explicitly before the constructor name.
C namedTearoff = .new<int>;
^^^" as{TypeError,ForDynamic} self::C;
self::ET<dynamic>% /* erasure=dynamic, declared=! */ e = invalid-expression "pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart:17:11: Error: A dot shorthand constructor invocation can't have type arguments.
Try adding the class name and type arguments explicitly before the constructor name.
ET e = .new<int>;
^^^" as{TypeError,ForDynamic} self::ET<dynamic>% /* erasure=dynamic, declared=! */;
}
@@ -2,26 +2,30 @@ library;
//
// Problems in library:
//
// pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart:11:23: Error: A dot shorthand constructor invocation can't have type arguments.
// pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart:13:23: Error: A dot shorthand constructor invocation can't have type arguments.
// Try adding the class name and type arguments explicitly before the constructor name.
// C newConstructor = .new<int>();
// ^^^
//
// pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart:12:25: Error: A dot shorthand constructor invocation can't have type arguments.
// pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart:14:25: Error: A dot shorthand constructor invocation can't have type arguments.
// Try adding the class name and type arguments explicitly before the constructor name.
// C namedConstructor = .named<int>();
// ^^^^^
//
// pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart:13:19: Error: The static getter or field 'new' isn't defined for the type 'C'.
// - 'C' is from 'pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart'.
// Try correcting the name to the name of an existing static getter or field, or defining a getter or field named 'new'.
// pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart:15:19: Error: A dot shorthand constructor invocation can't have type arguments.
// Try adding the class name and type arguments explicitly before the constructor name.
// C newTearoff = .new<int>;
// ^^^
//
// pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart:13:22: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'.
// Try changing the operand or remove the type arguments.
// C newTearoff = .new<int>;
// ^
// pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart:16:21: Error: A dot shorthand constructor invocation can't have type arguments.
// Try adding the class name and type arguments explicitly before the constructor name.
// C namedTearoff = .new<int>;
// ^^^
//
// pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart:17:11: Error: A dot shorthand constructor invocation can't have type arguments.
// Try adding the class name and type arguments explicitly before the constructor name.
// ET e = .new<int>;
// ^^^
//
import self as self;
import "dart:core" as core;
@@ -34,17 +38,36 @@ class C extends core::Object {
: super core::Object::•()
;
}
extension type ET<T extends core::Object? = dynamic>(T% v) {
abstract extension-type-member representation-field get v() → T%;
constructor • = self::ET|constructor#;
constructor tearoff • = self::ET|constructor#_#new#tearOff;
}
static extension-type-member method ET|constructor#<T extends core::Object? = dynamic>(self::ET|constructor#::T% v) → self::ET<self::ET|constructor#::T%>% /* erasure=self::ET|constructor#::T%, declared=! */ {
lowered final self::ET<self::ET|constructor#::T%>% /* erasure=self::ET|constructor#::T%, declared=! */ #this = v;
return #this;
}
static extension-type-member method ET|constructor#_#new#tearOff<T extends core::Object? = dynamic>(self::ET|constructor#_#new#tearOff::T% v) → self::ET<self::ET|constructor#_#new#tearOff::T%>% /* erasure=self::ET|constructor#_#new#tearOff::T%, declared=! */
return self::ET|constructor#<self::ET|constructor#_#new#tearOff::T%>(v);
static method test() → void {
self::C newConstructor = invalid-expression "pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart:11:23: Error: A dot shorthand constructor invocation can't have type arguments.
self::C newConstructor = invalid-expression "pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart:13:23: Error: A dot shorthand constructor invocation can't have type arguments.
Try adding the class name and type arguments explicitly before the constructor name.
C newConstructor = .new<int>();
^^^" as{TypeError,ForDynamic} self::C;
self::C namedConstructor = invalid-expression "pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart:12:25: Error: A dot shorthand constructor invocation can't have type arguments.
self::C namedConstructor = invalid-expression "pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart:14:25: Error: A dot shorthand constructor invocation can't have type arguments.
Try adding the class name and type arguments explicitly before the constructor name.
C namedConstructor = .named<int>();
^^^^^" as{TypeError,ForDynamic} self::C;
self::C newTearoff = invalid-expression "pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart:13:22: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'.
Try changing the operand or remove the type arguments.
self::C newTearoff = invalid-expression "pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart:15:19: Error: A dot shorthand constructor invocation can't have type arguments.
Try adding the class name and type arguments explicitly before the constructor name.
C newTearoff = .new<int>;
^";
^^^" as{TypeError,ForDynamic} self::C;
self::C namedTearoff = invalid-expression "pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart:16:21: Error: A dot shorthand constructor invocation can't have type arguments.
Try adding the class name and type arguments explicitly before the constructor name.
C namedTearoff = .new<int>;
^^^" as{TypeError,ForDynamic} self::C;
self::ET<dynamic>% /* erasure=dynamic, declared=! */ e = invalid-expression "pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart:17:11: Error: A dot shorthand constructor invocation can't have type arguments.
Try adding the class name and type arguments explicitly before the constructor name.
ET e = .new<int>;
^^^" as{TypeError,ForDynamic} self::ET<dynamic>% /* erasure=dynamic, declared=! */;
}
@@ -8,5 +8,14 @@ class C extends core::Object {
constructor named() → self::C
;
}
extension type ET<T extends core::Object? = dynamic>(T% v) {
abstract extension-type-member representation-field get v() → T%;
constructor • = self::ET|constructor#;
constructor tearoff • = self::ET|constructor#_#new#tearOff;
}
static extension-type-member method ET|constructor#<T extends core::Object? = dynamic>(self::ET|constructor#::T% v) → self::ET<self::ET|constructor#::T%>% /* erasure=self::ET|constructor#::T%, declared=! */
;
static extension-type-member method ET|constructor#_#new#tearOff<T extends core::Object? = dynamic>(self::ET|constructor#_#new#tearOff::T% v) → self::ET<self::ET|constructor#_#new#tearOff::T%>% /* erasure=self::ET|constructor#_#new#tearOff::T%, declared=! */
return self::ET|constructor#<self::ET|constructor#_#new#tearOff::T%>(v);
static method test() → void
;
@@ -2,26 +2,30 @@ library;
//
// Problems in library:
//
// pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart:11:23: Error: A dot shorthand constructor invocation can't have type arguments.
// pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart:13:23: Error: A dot shorthand constructor invocation can't have type arguments.
// Try adding the class name and type arguments explicitly before the constructor name.
// C newConstructor = .new<int>();
// ^^^
//
// pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart:12:25: Error: A dot shorthand constructor invocation can't have type arguments.
// pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart:14:25: Error: A dot shorthand constructor invocation can't have type arguments.
// Try adding the class name and type arguments explicitly before the constructor name.
// C namedConstructor = .named<int>();
// ^^^^^
//
// pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart:13:19: Error: The static getter or field 'new' isn't defined for the type 'C'.
// - 'C' is from 'pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart'.
// Try correcting the name to the name of an existing static getter or field, or defining a getter or field named 'new'.
// pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart:15:19: Error: A dot shorthand constructor invocation can't have type arguments.
// Try adding the class name and type arguments explicitly before the constructor name.
// C newTearoff = .new<int>;
// ^^^
//
// pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart:13:22: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'.
// Try changing the operand or remove the type arguments.
// C newTearoff = .new<int>;
// ^
// pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart:16:21: Error: A dot shorthand constructor invocation can't have type arguments.
// Try adding the class name and type arguments explicitly before the constructor name.
// C namedTearoff = .new<int>;
// ^^^
//
// pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart:17:11: Error: A dot shorthand constructor invocation can't have type arguments.
// Try adding the class name and type arguments explicitly before the constructor name.
// ET e = .new<int>;
// ^^^
//
import self as self;
import "dart:core" as core;
@@ -34,17 +38,36 @@ class C extends core::Object {
: super core::Object::•()
;
}
extension type ET<T extends core::Object? = dynamic>(T% v) {
abstract extension-type-member representation-field get v() → T%;
constructor • = self::ET|constructor#;
constructor tearoff • = self::ET|constructor#_#new#tearOff;
}
static extension-type-member method ET|constructor#<T extends core::Object? = dynamic>(self::ET|constructor#::T% v) → self::ET<self::ET|constructor#::T%>% /* erasure=self::ET|constructor#::T%, declared=! */ {
lowered final self::ET<self::ET|constructor#::T%>% /* erasure=self::ET|constructor#::T%, declared=! */ #this = v;
return #this;
}
static extension-type-member method ET|constructor#_#new#tearOff<T extends core::Object? = dynamic>(self::ET|constructor#_#new#tearOff::T% v) → self::ET<self::ET|constructor#_#new#tearOff::T%>% /* erasure=self::ET|constructor#_#new#tearOff::T%, declared=! */
return self::ET|constructor#<self::ET|constructor#_#new#tearOff::T%>(v);
static method test() → void {
self::C newConstructor = invalid-expression "pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart:11:23: Error: A dot shorthand constructor invocation can't have type arguments.
self::C newConstructor = invalid-expression "pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart:13:23: Error: A dot shorthand constructor invocation can't have type arguments.
Try adding the class name and type arguments explicitly before the constructor name.
C newConstructor = .new<int>();
^^^" as{TypeError,ForDynamic,Unchecked} self::C;
self::C namedConstructor = invalid-expression "pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart:12:25: Error: A dot shorthand constructor invocation can't have type arguments.
self::C namedConstructor = invalid-expression "pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart:14:25: Error: A dot shorthand constructor invocation can't have type arguments.
Try adding the class name and type arguments explicitly before the constructor name.
C namedConstructor = .named<int>();
^^^^^" as{TypeError,ForDynamic,Unchecked} self::C;
self::C newTearoff = invalid-expression "pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart:13:22: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'.
Try changing the operand or remove the type arguments.
self::C newTearoff = invalid-expression "pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart:15:19: Error: A dot shorthand constructor invocation can't have type arguments.
Try adding the class name and type arguments explicitly before the constructor name.
C newTearoff = .new<int>;
^";
^^^" as{TypeError,ForDynamic,Unchecked} self::C;
self::C namedTearoff = invalid-expression "pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart:16:21: Error: A dot shorthand constructor invocation can't have type arguments.
Try adding the class name and type arguments explicitly before the constructor name.
C namedTearoff = .new<int>;
^^^" as{TypeError,ForDynamic,Unchecked} self::C;
self::ET<dynamic>% /* erasure=dynamic, declared=! */ e = invalid-expression "pkg/front_end/testcases/dot_shorthands/constructor_type_parameter_error.dart:17:11: Error: A dot shorthand constructor invocation can't have type arguments.
Try adding the class name and type arguments explicitly before the constructor name.
ET e = .new<int>;
^^^" as{TypeError,ForDynamic,Unchecked} self::ET<dynamic>% /* erasure=dynamic, declared=! */;
}
@@ -3,4 +3,6 @@ class C {
C.named();
}
extension type ET<T>(T v) {}
void test() {}
@@ -3,4 +3,6 @@ class C {
C.named();
}
extension type ET<T>(T v) {}
void test() {}
@@ -2,6 +2,29 @@
// 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.
class C<T> {
static C d<T>() => C<T>();
C();
}
class C1 {
@override
bool operator ==(Object other) => identical(C1.new, other);
}
class A1 {
bool operator ==(Object other) => identical(ET1.new, other);
}
extension type ET1(A1 _) implements A1 {}
void main() {
Object o = .hash;
print(C1() == .new);
print(ET1(A1()) == .new);
Object? c = C();
if (c is C) {
c = .d<int>;
}
}
@@ -2,10 +2,54 @@ library;
import self as self;
import "dart:core" as core;
class C<T extends core::Object? = dynamic> extends core::Object {
constructor •() → self::C<self::C::T%>
: super core::Object::•()
;
static method d<T extends core::Object? = dynamic>() → self::C<dynamic>
return new self::C::•<self::C::d::T%>();
}
class C1 extends core::Object {
synthetic constructor •() → self::C1
: super core::Object::•()
;
@#C1
operator ==(core::Object other) → core::bool
return core::identical(#C2, other);
}
class A1 extends core::Object {
synthetic constructor •() → self::A1
: super core::Object::•()
;
operator ==(core::Object other) → core::bool
return core::identical(#C3, other);
}
extension type ET1(self::A1 _) implements self::A1 {
abstract extension-type-member representation-field get _() → self::A1;
constructor • = self::ET1|constructor#;
constructor tearoff • = self::ET1|constructor#_#new#tearOff;
}
static extension-type-member method ET1|constructor#(self::A1 _) → self::ET1 /* erasure=self::A1 */ {
lowered final self::ET1 /* erasure=self::A1 */ #this = _;
return #this;
}
static extension-type-member method ET1|constructor#_#new#tearOff(self::A1 _) → self::ET1 /* erasure=self::A1 */
return self::ET1|constructor#(_);
static method main() → void {
core::Object o = #C1;
core::Object o = #C4;
core::print(new self::C1::•() =={self::C1::==}{(core::Object) → core::bool} #C2);
core::print(self::ET1|constructor#(new self::A1::•()) =={self::A1::==}{(core::Object) → core::bool} #C3);
core::Object? c = new self::C::•<dynamic>();
if(c{core::Object} is self::C<dynamic>) {
c = #C6;
}
}
constants {
#C1 = static-tearoff core::Object::hash
#C1 = core::_Override {}
#C2 = constructor-tearoff self::C1::•
#C3 = static-tearoff self::ET1|constructor#_#new#tearOff
#C4 = static-tearoff core::Object::hash
#C5 = static-tearoff self::C::d
#C6 = instantiation #C5 <core::int>
}
@@ -2,10 +2,54 @@ library;
import self as self;
import "dart:core" as core;
class C<T extends core::Object? = dynamic> extends core::Object {
constructor •() → self::C<self::C::T%>
: super core::Object::•()
;
static method d<T extends core::Object? = dynamic>() → self::C<dynamic>
return new self::C::•<self::C::d::T%>();
}
class C1 extends core::Object {
synthetic constructor •() → self::C1
: super core::Object::•()
;
@#C1
operator ==(core::Object other) → core::bool
return core::identical(#C2, other);
}
class A1 extends core::Object {
synthetic constructor •() → self::A1
: super core::Object::•()
;
operator ==(core::Object other) → core::bool
return core::identical(#C3, other);
}
extension type ET1(self::A1 _) implements self::A1 {
abstract extension-type-member representation-field get _() → self::A1;
constructor • = self::ET1|constructor#;
constructor tearoff • = self::ET1|constructor#_#new#tearOff;
}
static extension-type-member method ET1|constructor#(self::A1 _) → self::ET1 /* erasure=self::A1 */ {
lowered final self::ET1 /* erasure=self::A1 */ #this = _;
return #this;
}
static extension-type-member method ET1|constructor#_#new#tearOff(self::A1 _) → self::ET1 /* erasure=self::A1 */
return self::ET1|constructor#(_);
static method main() → void {
core::Object o = #C1;
core::Object o = #C4;
core::print(new self::C1::•() =={self::C1::==}{(core::Object) → core::bool} #C2);
core::print(self::ET1|constructor#(new self::A1::•()) =={self::A1::==}{(core::Object) → core::bool} #C3);
core::Object? c = new self::C::•<dynamic>();
if(c{core::Object} is self::C<dynamic>) {
c = #C6;
}
}
constants {
#C1 = static-tearoff core::Object::hash
#C1 = core::_Override {}
#C2 = constructor-tearoff self::C1::•
#C3 = static-tearoff self::ET1|constructor#_#new#tearOff
#C4 = static-tearoff core::Object::hash
#C5 = static-tearoff self::C::d
#C6 = instantiation #C5 <core::int>
}
@@ -1,5 +1,39 @@
library;
import self as self;
import "dart:core" as core;
class C<T extends core::Object? = dynamic> extends core::Object {
constructor •() → self::C<self::C::T%>
;
static method d<T extends core::Object? = dynamic>() → self::C<dynamic>
;
}
class C1 extends core::Object {
synthetic constructor •() → self::C1
;
@core::override
operator ==(core::Object other) → core::bool
;
}
class A1 extends core::Object {
synthetic constructor •() → self::A1
;
operator ==(core::Object other) → core::bool
;
}
extension type ET1(self::A1 _) implements self::A1 {
abstract extension-type-member representation-field get _() → self::A1;
constructor • = self::ET1|constructor#;
constructor tearoff • = self::ET1|constructor#_#new#tearOff;
}
static extension-type-member method ET1|constructor#(self::A1 _) → self::ET1 /* erasure=self::A1 */
;
static extension-type-member method ET1|constructor#_#new#tearOff(self::A1 _) → self::ET1 /* erasure=self::A1 */
return self::ET1|constructor#(_);
static method main() → void
;
Extra constant evaluation status:
Evaluated: StaticGet @ org-dartlang-testcase:///tearoff.dart:11:4 -> InstanceConstant(const _Override{})
Extra constant evaluation: evaluated: 3, effectively constant: 1
@@ -2,10 +2,54 @@ library;
import self as self;
import "dart:core" as core;
class C<T extends core::Object? = dynamic> extends core::Object {
constructor •() → self::C<self::C::T%>
: super core::Object::•()
;
static method d<T extends core::Object? = dynamic>() → self::C<dynamic>
return new self::C::•<self::C::d::T%>();
}
class C1 extends core::Object {
synthetic constructor •() → self::C1
: super core::Object::•()
;
@#C1
operator ==(core::Object other) → core::bool
return core::identical(#C2, other);
}
class A1 extends core::Object {
synthetic constructor •() → self::A1
: super core::Object::•()
;
operator ==(core::Object other) → core::bool
return core::identical(#C3, other);
}
extension type ET1(self::A1 _) implements self::A1 {
abstract extension-type-member representation-field get _() → self::A1;
constructor • = self::ET1|constructor#;
constructor tearoff • = self::ET1|constructor#_#new#tearOff;
}
static extension-type-member method ET1|constructor#(self::A1 _) → self::ET1 /* erasure=self::A1 */ {
lowered final self::ET1 /* erasure=self::A1 */ #this = _;
return #this;
}
static extension-type-member method ET1|constructor#_#new#tearOff(self::A1 _) → self::ET1 /* erasure=self::A1 */
return self::ET1|constructor#(_);
static method main() → void {
core::Object o = #C1;
core::Object o = #C4;
core::print(new self::C1::•() =={self::C1::==}{(core::Object) → core::bool} #C2);
core::print(self::ET1|constructor#(new self::A1::•()) =={self::A1::==}{(core::Object) → core::bool} #C3);
core::Object? c = new self::C::•<dynamic>();
if(c{core::Object} is self::C<dynamic>) {
c = #C6;
}
}
constants {
#C1 = static-tearoff core::Object::hash
#C1 = core::_Override {}
#C2 = constructor-tearoff self::C1::•
#C3 = static-tearoff self::ET1|constructor#_#new#tearOff
#C4 = static-tearoff core::Object::hash
#C5 = static-tearoff self::C::d
#C6 = instantiation #C5 <core::int>
}
@@ -1 +1,17 @@
class C<T> {
static C d<T>() => C<T>();
C();
}
class C1 {
@override
bool operator ==(Object other) => identical(C1.new, other);
}
class A1 {
bool operator ==(Object other) => identical(ET1.new, other);
}
extension type ET1(A1 _) implements A1 {}
void main() {}
@@ -1 +1,17 @@
class A1 {
bool operator ==(Object other) => identical(ET1.new, other);
}
class C<T> {
C();
static C d<T>() => C<T>();
}
class C1 {
@override
bool operator ==(Object other) => identical(C1.new, other);
}
extension type ET1(A1 _) implements A1 {}
void main() {}
@@ -261,11 +261,6 @@ library;
// var h2 = privateInlineClass._it<int>; // Error
// ^^^
//
// pkg/front_end/testcases/extension_types/field_access.dart:158:34: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'.
// Try changing the operand or remove the type arguments.
// var h2 = privateInlineClass._it<int>; // Error
// ^
//
// pkg/front_end/testcases/extension_types/field_access.dart:159:31: Error: The setter '_it' isn't defined for the class 'PrivateInlineClass'.
// Try correcting the name to the name of an existing setter, or defining a setter or field named '_it'.
// var h3 = privateInlineClass._it = 42; // Error
@@ -628,10 +623,10 @@ Try correcting the name to the name of an existing setter, or defining a setter
Try correcting the name to the name of an existing getter, or defining a getter or field named '_it'.
var h1 = privateInlineClass._it; // Error
^^^" in privateInlineClass{<unresolved>}._it;
invalid-type h2 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:158:34: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'.
Try changing the operand or remove the type arguments.
dynamic h2 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:158:31: Error: The getter '_it' isn't defined for the class 'PrivateInlineClass'.
Try correcting the name to the name of an existing getter, or defining a getter or field named '_it'.
var h2 = privateInlineClass._it<int>; // Error
^";
^^^" in privateInlineClass{<unresolved>}._it;
core::int h3 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:159:31: Error: The setter '_it' isn't defined for the class 'PrivateInlineClass'.
Try correcting the name to the name of an existing setter, or defining a setter or field named '_it'.
var h3 = privateInlineClass._it = 42; // Error
@@ -261,11 +261,6 @@ library;
// var h2 = privateInlineClass._it<int>; // Error
// ^^^
//
// pkg/front_end/testcases/extension_types/field_access.dart:158:34: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'.
// Try changing the operand or remove the type arguments.
// var h2 = privateInlineClass._it<int>; // Error
// ^
//
// pkg/front_end/testcases/extension_types/field_access.dart:159:31: Error: The setter '_it' isn't defined for the class 'PrivateInlineClass'.
// Try correcting the name to the name of an existing setter, or defining a setter or field named '_it'.
// var h3 = privateInlineClass._it = 42; // Error
@@ -628,10 +623,10 @@ Try correcting the name to the name of an existing setter, or defining a setter
Try correcting the name to the name of an existing getter, or defining a getter or field named '_it'.
var h1 = privateInlineClass._it; // Error
^^^" in privateInlineClass{<unresolved>}._it;
invalid-type h2 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:158:34: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'.
Try changing the operand or remove the type arguments.
dynamic h2 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:158:31: Error: The getter '_it' isn't defined for the class 'PrivateInlineClass'.
Try correcting the name to the name of an existing getter, or defining a getter or field named '_it'.
var h2 = privateInlineClass._it<int>; // Error
^";
^^^" in privateInlineClass{<unresolved>}._it;
core::int h3 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:159:31: Error: The setter '_it' isn't defined for the class 'PrivateInlineClass'.
Try correcting the name to the name of an existing setter, or defining a setter or field named '_it'.
var h3 = privateInlineClass._it = 42; // Error
@@ -261,11 +261,6 @@ library;
// var h2 = privateInlineClass._it<int>; // Error
// ^^^
//
// pkg/front_end/testcases/extension_types/field_access.dart:158:34: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'.
// Try changing the operand or remove the type arguments.
// var h2 = privateInlineClass._it<int>; // Error
// ^
//
// pkg/front_end/testcases/extension_types/field_access.dart:159:31: Error: The setter '_it' isn't defined for the class 'PrivateInlineClass'.
// Try correcting the name to the name of an existing setter, or defining a setter or field named '_it'.
// var h3 = privateInlineClass._it = 42; // Error
@@ -628,10 +623,10 @@ Try correcting the name to the name of an existing setter, or defining a setter
Try correcting the name to the name of an existing getter, or defining a getter or field named '_it'.
var h1 = privateInlineClass._it; // Error
^^^" in privateInlineClass{<unresolved>}._it;
invalid-type h2 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:158:34: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'.
Try changing the operand or remove the type arguments.
dynamic h2 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:158:31: Error: The getter '_it' isn't defined for the class 'PrivateInlineClass'.
Try correcting the name to the name of an existing getter, or defining a getter or field named '_it'.
var h2 = privateInlineClass._it<int>; // Error
^";
^^^" in privateInlineClass{<unresolved>}._it;
core::int h3 = invalid-expression "pkg/front_end/testcases/extension_types/field_access.dart:159:31: Error: The setter '_it' isn't defined for the class 'PrivateInlineClass'.
Try correcting the name to the name of an existing setter, or defining a setter or field named '_it'.
var h3 = privateInlineClass._it = 42; // Error
@@ -203,7 +203,7 @@ class Class extends self::Super {
^^^^^^^^^^^^^^^^^^";
invalid-expression "pkg/front_end/testcases/general/missing_static_super.dart:15:11: Error: Superclass has no getter named 'missingSuperMethod'.
super.missingSuperMethod<int>;
^^^^^^^^^^^^^^^^^^"<core::int>;
^^^^^^^^^^^^^^^^^^";
invalid-expression "pkg/front_end/testcases/general/missing_static_super.dart:16:11: Error: Superclass has no getter named 'missingSuperIndex'.
super.missingSuperIndex[42];
^^^^^^^^^^^^^^^^^"{<invalid>}.[](42);
@@ -232,7 +232,7 @@ class Class extends self::Super {
^^^^^^^^^^^^^^^^^^^";
invalid-expression "pkg/front_end/testcases/general/missing_static_super.dart:27:11: Error: Member not found: 'missingStaticMethod'.
Super.missingStaticMethod<int>;
^^^^^^^^^^^^^^^^^^^"<core::int>;
^^^^^^^^^^^^^^^^^^^";
invalid-expression "pkg/front_end/testcases/general/missing_static_super.dart:28:11: Error: Member not found: 'missingStaticIndex'.
Super.missingStaticIndex[42];
^^^^^^^^^^^^^^^^^^"{<invalid>}.[](42);
@@ -263,7 +263,7 @@ abstract class Mixin extends self::Super /*isMixinDeclaration*/ {
^^^^^^^^^^^^^^^^^^";
invalid-expression "pkg/front_end/testcases/general/missing_static_super.dart:41:11: Error: Superclass has no getter named 'missingSuperMethod'.
super.missingSuperMethod<int>;
^^^^^^^^^^^^^^^^^^"<core::int>;
^^^^^^^^^^^^^^^^^^";
invalid-expression "pkg/front_end/testcases/general/missing_static_super.dart:42:11: Error: Superclass has no getter named 'missingSuperIndex'.
super.missingSuperIndex[42];
^^^^^^^^^^^^^^^^^"{<invalid>}.[](42);
@@ -292,7 +292,7 @@ abstract class Mixin extends self::Super /*isMixinDeclaration*/ {
^^^^^^^^^^^^^^^^^^^";
invalid-expression "pkg/front_end/testcases/general/missing_static_super.dart:53:11: Error: Member not found: 'missingStaticMethod'.
Super.missingStaticMethod<int>;
^^^^^^^^^^^^^^^^^^^"<core::int>;
^^^^^^^^^^^^^^^^^^^";
invalid-expression "pkg/front_end/testcases/general/missing_static_super.dart:54:11: Error: Member not found: 'missingStaticIndex'.
Super.missingStaticIndex[42];
^^^^^^^^^^^^^^^^^^"{<invalid>}.[](42);
@@ -203,7 +203,7 @@ class Class extends self::Super {
^^^^^^^^^^^^^^^^^^";
invalid-expression "pkg/front_end/testcases/general/missing_static_super.dart:15:11: Error: Superclass has no getter named 'missingSuperMethod'.
super.missingSuperMethod<int>;
^^^^^^^^^^^^^^^^^^"<core::int>;
^^^^^^^^^^^^^^^^^^";
invalid-expression "pkg/front_end/testcases/general/missing_static_super.dart:16:11: Error: Superclass has no getter named 'missingSuperIndex'.
super.missingSuperIndex[42];
^^^^^^^^^^^^^^^^^"{<invalid>}.[](42);
@@ -232,7 +232,7 @@ class Class extends self::Super {
^^^^^^^^^^^^^^^^^^^";
invalid-expression "pkg/front_end/testcases/general/missing_static_super.dart:27:11: Error: Member not found: 'missingStaticMethod'.
Super.missingStaticMethod<int>;
^^^^^^^^^^^^^^^^^^^"<core::int>;
^^^^^^^^^^^^^^^^^^^";
invalid-expression "pkg/front_end/testcases/general/missing_static_super.dart:28:11: Error: Member not found: 'missingStaticIndex'.
Super.missingStaticIndex[42];
^^^^^^^^^^^^^^^^^^"{<invalid>}.[](42);
@@ -263,7 +263,7 @@ abstract class Mixin extends self::Super /*isMixinDeclaration*/ {
^^^^^^^^^^^^^^^^^^";
invalid-expression "pkg/front_end/testcases/general/missing_static_super.dart:41:11: Error: Superclass has no getter named 'missingSuperMethod'.
super.missingSuperMethod<int>;
^^^^^^^^^^^^^^^^^^"<core::int>;
^^^^^^^^^^^^^^^^^^";
invalid-expression "pkg/front_end/testcases/general/missing_static_super.dart:42:11: Error: Superclass has no getter named 'missingSuperIndex'.
super.missingSuperIndex[42];
^^^^^^^^^^^^^^^^^"{<invalid>}.[](42);
@@ -292,7 +292,7 @@ abstract class Mixin extends self::Super /*isMixinDeclaration*/ {
^^^^^^^^^^^^^^^^^^^";
invalid-expression "pkg/front_end/testcases/general/missing_static_super.dart:53:11: Error: Member not found: 'missingStaticMethod'.
Super.missingStaticMethod<int>;
^^^^^^^^^^^^^^^^^^^"<core::int>;
^^^^^^^^^^^^^^^^^^^";
invalid-expression "pkg/front_end/testcases/general/missing_static_super.dart:54:11: Error: Member not found: 'missingStaticIndex'.
Super.missingStaticIndex[42];
^^^^^^^^^^^^^^^^^^"{<invalid>}.[](42);
@@ -203,7 +203,7 @@ class Class extends self::Super {
^^^^^^^^^^^^^^^^^^";
invalid-expression "pkg/front_end/testcases/general/missing_static_super.dart:15:11: Error: Superclass has no getter named 'missingSuperMethod'.
super.missingSuperMethod<int>;
^^^^^^^^^^^^^^^^^^"<core::int>;
^^^^^^^^^^^^^^^^^^";
invalid-expression "pkg/front_end/testcases/general/missing_static_super.dart:16:11: Error: Superclass has no getter named 'missingSuperIndex'.
super.missingSuperIndex[42];
^^^^^^^^^^^^^^^^^"{<invalid>}.[](42);
@@ -232,7 +232,7 @@ class Class extends self::Super {
^^^^^^^^^^^^^^^^^^^";
invalid-expression "pkg/front_end/testcases/general/missing_static_super.dart:27:11: Error: Member not found: 'missingStaticMethod'.
Super.missingStaticMethod<int>;
^^^^^^^^^^^^^^^^^^^"<core::int>;
^^^^^^^^^^^^^^^^^^^";
invalid-expression "pkg/front_end/testcases/general/missing_static_super.dart:28:11: Error: Member not found: 'missingStaticIndex'.
Super.missingStaticIndex[42];
^^^^^^^^^^^^^^^^^^"{<invalid>}.[](42);
@@ -263,7 +263,7 @@ abstract class Mixin extends self::Super /*isMixinDeclaration*/ {
^^^^^^^^^^^^^^^^^^";
invalid-expression "pkg/front_end/testcases/general/missing_static_super.dart:41:11: Error: Superclass has no getter named 'missingSuperMethod'.
super.missingSuperMethod<int>;
^^^^^^^^^^^^^^^^^^"<core::int>;
^^^^^^^^^^^^^^^^^^";
invalid-expression "pkg/front_end/testcases/general/missing_static_super.dart:42:11: Error: Superclass has no getter named 'missingSuperIndex'.
super.missingSuperIndex[42];
^^^^^^^^^^^^^^^^^"{<invalid>}.[](42);
@@ -292,7 +292,7 @@ abstract class Mixin extends self::Super /*isMixinDeclaration*/ {
^^^^^^^^^^^^^^^^^^^";
invalid-expression "pkg/front_end/testcases/general/missing_static_super.dart:53:11: Error: Member not found: 'missingStaticMethod'.
Super.missingStaticMethod<int>;
^^^^^^^^^^^^^^^^^^^"<core::int>;
^^^^^^^^^^^^^^^^^^^";
invalid-expression "pkg/front_end/testcases/general/missing_static_super.dart:54:11: Error: Member not found: 'missingStaticIndex'.
Super.missingStaticIndex[42];
^^^^^^^^^^^^^^^^^^"{<invalid>}.[](42);
@@ -9,6 +9,13 @@
import '../dot_shorthand_helper.dart';
class C {
C();
C.named();
}
extension type ET<T>(T v) {}
void main() {
StaticMember<int> s = .memberType<String, String>('s');
// ^
@@ -31,6 +38,17 @@ void main() {
// ^^^
// [analyzer] unspecified
// [cfe] The static getter or field 'new' isn't defined for the type 'UnnamedConstructorTypeParameters<dynamic> Function()'.
// ^
// [cfe] The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'.
C newTearoff = .new<int>;
// ^^^
// [analyzer] unspecified
// [cfe] A dot shorthand constructor invocation can't have type arguments.
C namedTearoff = .new<int>;
// ^^^
// [analyzer] unspecified
// [cfe] A dot shorthand constructor invocation can't have type arguments.
ET e = .new<int>;
// ^^^
// [analyzer] unspecified
// [cfe] A dot shorthand constructor invocation can't have type arguments.
}