mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 12:48:10 +00:00
[cfe] Refactor TypeBuilders
Various cleanups to the TypeBuilder classes: TypeBuilder: * Remove `origin` parameter from TypeBuilder.build and instead make FunctionType.typedefType mutable and set if after creation. * Remove `charOffset` and `fileUri` parameters from TypeBuilder.buildSupertype/buildMixedInType * Remove `bind`, `resolveIn`, and `check` from TypeBuilder so that these are only present on NamedTypeBuilder * Remove TypeBuilder.buildTypeLiteralType and instead pass an argument to NamedTypeBuilder that determines what type to create on `build`. NamedTypeBuilder: * Make NamedTypeBuilder.instanceTypeVariableAccess private * Add NamedTypeBuilder.forDartType for prebuilt types * Add NamedTypeBuilder.forInvalidType for types created for errors * Make NamedTypeBuilder.declaration private and corresponding getter * Check most type use errors on NamedTypeBuilder.bind * Make NamedTypeBuilder helper methods private * Add `TypeVariableBuilder.isClassParameter` to support checking for valid type variable use through the `NamedTypeBuilder.bind` method. * Remove checking of type variable in static context from BodyBuilder since it is now checking on `NamedTypeBuilder.bind`. FunctionTypeBuilder: * Cache result of FunctionTypeBuilder.build TypeBuilderComputer: * Cache "constant" type declarations in TypeBuilderComputer Change-Id: Ibaedcb255487eecc5efe70b84e5cbd5a118c1e0b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239023 Reviewed-by: Jens Johansen <jensj@google.com> Commit-Queue: Johnni Winther <johnniwinther@google.com>
This commit is contained in:
parent
33ab204aae
commit
2b79d2b747
|
@ -48,21 +48,20 @@ class FixedTypeBuilder extends TypeBuilder {
|
|||
}
|
||||
|
||||
@override
|
||||
DartType build(LibraryBuilder library, {TypedefType? origin}) {
|
||||
DartType build(LibraryBuilder library) {
|
||||
return type;
|
||||
}
|
||||
|
||||
@override
|
||||
Supertype buildSupertype(
|
||||
LibraryBuilder library, int charOffset, Uri fileUri) {
|
||||
return unhandled('buildSupertype', 'FixedTypeBuilder', charOffset, fileUri);
|
||||
Supertype buildSupertype(LibraryBuilder library) {
|
||||
return unhandled(
|
||||
'buildSupertype', 'FixedTypeBuilder', charOffset ?? -1, fileUri);
|
||||
}
|
||||
|
||||
@override
|
||||
Supertype buildMixedInType(
|
||||
LibraryBuilder library, int charOffset, Uri fileUri) {
|
||||
Supertype buildMixedInType(LibraryBuilder library) {
|
||||
return unhandled(
|
||||
'buildMixedInType', 'FixedTypeBuilder', charOffset, fileUri);
|
||||
'buildMixedInType', 'FixedTypeBuilder', charOffset ?? -1, fileUri);
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
@ -11,8 +11,7 @@ import 'package:kernel/ast.dart'
|
|||
FunctionType,
|
||||
NamedType,
|
||||
Supertype,
|
||||
TypeParameter,
|
||||
TypedefType;
|
||||
TypeParameter;
|
||||
|
||||
import '../fasta_codes.dart' show messageSupertypeIsFunction, noLength;
|
||||
|
||||
|
@ -36,6 +35,8 @@ class FunctionTypeBuilder extends TypeBuilder {
|
|||
@override
|
||||
final int charOffset;
|
||||
|
||||
FunctionType? _type;
|
||||
|
||||
FunctionTypeBuilder(this.returnType, this.typeVariables, this.formals,
|
||||
this.nullabilityBuilder, this.fileUri, this.charOffset);
|
||||
|
||||
|
@ -83,7 +84,11 @@ class FunctionTypeBuilder extends TypeBuilder {
|
|||
}
|
||||
|
||||
@override
|
||||
FunctionType build(LibraryBuilder library, {TypedefType? origin}) {
|
||||
FunctionType build(LibraryBuilder library) {
|
||||
return _type ??= _buildInternal(library);
|
||||
}
|
||||
|
||||
FunctionType _buildInternal(LibraryBuilder library) {
|
||||
DartType builtReturnType =
|
||||
returnType?.build(library) ?? const DynamicType();
|
||||
List<DartType> positionalParameters = <DartType>[];
|
||||
|
@ -111,29 +116,26 @@ class FunctionTypeBuilder extends TypeBuilder {
|
|||
for (TypeVariableBuilder t in typeVariables!) {
|
||||
typeParameters.add(t.parameter);
|
||||
// Build the bound to detect cycles in typedefs.
|
||||
t.bound?.build(library, origin: origin);
|
||||
t.bound?.build(library);
|
||||
}
|
||||
}
|
||||
return new FunctionType(positionalParameters, builtReturnType,
|
||||
nullabilityBuilder.build(library),
|
||||
namedParameters: namedParameters ?? const <NamedType>[],
|
||||
typeParameters: typeParameters ?? const <TypeParameter>[],
|
||||
requiredParameterCount: requiredParameterCount,
|
||||
typedefType: origin);
|
||||
requiredParameterCount: requiredParameterCount);
|
||||
}
|
||||
|
||||
@override
|
||||
Supertype? buildSupertype(
|
||||
LibraryBuilder library, int charOffset, Uri fileUri) {
|
||||
Supertype? buildSupertype(LibraryBuilder library) {
|
||||
library.addProblem(
|
||||
messageSupertypeIsFunction, charOffset, noLength, fileUri);
|
||||
return null;
|
||||
}
|
||||
|
||||
@override
|
||||
Supertype? buildMixedInType(
|
||||
LibraryBuilder library, int charOffset, Uri fileUri) {
|
||||
return buildSupertype(library, charOffset, fileUri);
|
||||
Supertype? buildMixedInType(LibraryBuilder library) {
|
||||
return buildSupertype(library);
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -143,8 +145,9 @@ class FunctionTypeBuilder extends TypeBuilder {
|
|||
TypeParameterScopeBuilder contextDeclaration) {
|
||||
List<TypeVariableBuilder>? clonedTypeVariables;
|
||||
if (typeVariables != null) {
|
||||
clonedTypeVariables =
|
||||
contextLibrary.copyTypeVariables(typeVariables!, contextDeclaration);
|
||||
clonedTypeVariables = contextLibrary.copyTypeVariables(
|
||||
typeVariables!, contextDeclaration,
|
||||
kind: TypeVariableKind.function);
|
||||
}
|
||||
List<FormalParameterBuilder>? clonedFormals;
|
||||
if (formals != null) {
|
||||
|
|
|
@ -107,30 +107,77 @@ class NamedTypeBuilder extends TypeBuilder {
|
|||
@override
|
||||
final int? charOffset;
|
||||
|
||||
@override
|
||||
TypeDeclarationBuilder? declaration;
|
||||
TypeDeclarationBuilder? _declaration;
|
||||
|
||||
final InstanceTypeVariableAccessState instanceTypeVariableAccess;
|
||||
final InstanceTypeVariableAccessState _instanceTypeVariableAccess;
|
||||
|
||||
NamedTypeBuilder(this.name, this.nullabilityBuilder, this.arguments,
|
||||
this.fileUri, this.charOffset,
|
||||
{required this.instanceTypeVariableAccess})
|
||||
: assert(name is String || name is QualifiedName);
|
||||
final bool _forTypeLiteral;
|
||||
|
||||
NamedTypeBuilder.fromTypeDeclarationBuilder(
|
||||
TypeDeclarationBuilder this.declaration, this.nullabilityBuilder,
|
||||
DartType? _type;
|
||||
|
||||
NamedTypeBuilder(this.name, this.nullabilityBuilder,
|
||||
{this.arguments,
|
||||
this.fileUri,
|
||||
this.charOffset,
|
||||
required this.instanceTypeVariableAccess})
|
||||
: this.name = declaration.name;
|
||||
required InstanceTypeVariableAccessState instanceTypeVariableAccess,
|
||||
bool forTypeLiteral: false})
|
||||
: assert(name is String || name is QualifiedName),
|
||||
this._instanceTypeVariableAccess = instanceTypeVariableAccess,
|
||||
this._forTypeLiteral = forTypeLiteral;
|
||||
|
||||
NamedTypeBuilder.forDartType(DartType this._type,
|
||||
TypeDeclarationBuilder this._declaration, this.nullabilityBuilder,
|
||||
{this.arguments})
|
||||
: this.name = _declaration.name,
|
||||
this._instanceTypeVariableAccess =
|
||||
InstanceTypeVariableAccessState.Unexpected,
|
||||
this.fileUri = null,
|
||||
this.charOffset = null,
|
||||
this._forTypeLiteral = false;
|
||||
|
||||
NamedTypeBuilder.fromTypeDeclarationBuilder(
|
||||
TypeDeclarationBuilder this._declaration, this.nullabilityBuilder,
|
||||
{this.arguments,
|
||||
this.fileUri,
|
||||
this.charOffset,
|
||||
required InstanceTypeVariableAccessState instanceTypeVariableAccess,
|
||||
DartType? type})
|
||||
: this.name = _declaration.name,
|
||||
this._forTypeLiteral = false,
|
||||
this._instanceTypeVariableAccess = instanceTypeVariableAccess,
|
||||
this._type = type;
|
||||
|
||||
NamedTypeBuilder.forInvalidType(
|
||||
String this.name, this.nullabilityBuilder, LocatedMessage message,
|
||||
{List<LocatedMessage>? context})
|
||||
: _declaration =
|
||||
new InvalidTypeDeclarationBuilder(name, message, context: context),
|
||||
this.fileUri = message.uri,
|
||||
this.charOffset = message.charOffset,
|
||||
this._instanceTypeVariableAccess =
|
||||
InstanceTypeVariableAccessState.Unexpected,
|
||||
this._forTypeLiteral = false,
|
||||
this._type = const InvalidType();
|
||||
|
||||
@override
|
||||
TypeDeclarationBuilder? get declaration => _declaration;
|
||||
|
||||
@override
|
||||
bool get isVoidType => declaration is VoidTypeDeclarationBuilder;
|
||||
|
||||
@override
|
||||
void bind(TypeDeclarationBuilder declaration) {
|
||||
this.declaration = declaration.origin;
|
||||
void bind(LibraryBuilder libraryBuilder, TypeDeclarationBuilder declaration) {
|
||||
_declaration = declaration.origin;
|
||||
_check(libraryBuilder);
|
||||
}
|
||||
|
||||
String get nameText {
|
||||
if (name is Identifier) {
|
||||
Identifier identifier = name as Identifier;
|
||||
return identifier.name;
|
||||
} else {
|
||||
assert(name is String);
|
||||
return name as String;
|
||||
}
|
||||
}
|
||||
|
||||
int get nameOffset {
|
||||
|
@ -138,25 +185,16 @@ class NamedTypeBuilder extends TypeBuilder {
|
|||
Identifier identifier = name as Identifier;
|
||||
return identifier.charOffset;
|
||||
}
|
||||
return -1; // TODO(eernst): make it possible to get offset.
|
||||
return charOffset!;
|
||||
}
|
||||
|
||||
int get nameLength {
|
||||
if (name is Identifier) {
|
||||
Identifier identifier = name as Identifier;
|
||||
return identifier.name.length;
|
||||
} else if (name is String) {
|
||||
String nameString = name as String;
|
||||
return nameString.length;
|
||||
} else {
|
||||
return noLength;
|
||||
}
|
||||
return nameText.length;
|
||||
}
|
||||
|
||||
@override
|
||||
void resolveIn(
|
||||
Scope scope, int charOffset, Uri fileUri, LibraryBuilder library) {
|
||||
if (declaration != null) return;
|
||||
if (_declaration != null) return;
|
||||
final Object name = this.name;
|
||||
Builder? member;
|
||||
if (name is QualifiedName) {
|
||||
|
@ -171,72 +209,106 @@ class NamedTypeBuilder extends TypeBuilder {
|
|||
} else {
|
||||
unhandled("${name.runtimeType}", "resolveIn", charOffset, fileUri);
|
||||
}
|
||||
if (member is TypeVariableBuilder) {
|
||||
declaration = member.origin;
|
||||
if (arguments != null) {
|
||||
String typeName;
|
||||
int typeNameOffset;
|
||||
if (name is Identifier) {
|
||||
typeName = name.name;
|
||||
typeNameOffset = name.charOffset;
|
||||
} else {
|
||||
typeName = name as String;
|
||||
typeNameOffset = charOffset;
|
||||
}
|
||||
if (member is TypeDeclarationBuilder) {
|
||||
bind(library, member);
|
||||
} else {
|
||||
Template<Message Function(String name)> template =
|
||||
member == null ? templateTypeNotFound : templateNotAType;
|
||||
String flatName = flattenName(name, charOffset, fileUri);
|
||||
int length = name is Identifier
|
||||
? name.endCharOffset - charOffset
|
||||
: flatName.length;
|
||||
Message message;
|
||||
List<LocatedMessage>? context;
|
||||
if (member == null) {
|
||||
template = templateTypeNotFound;
|
||||
message = template.withArguments(flatName);
|
||||
} else {
|
||||
template = templateNotAType;
|
||||
context = <LocatedMessage>[
|
||||
messageNotATypeContext.withLocation(
|
||||
member.fileUri!,
|
||||
member.charOffset,
|
||||
name is Identifier ? name.name.length : "$name".length)
|
||||
];
|
||||
message = template.withArguments(flatName);
|
||||
}
|
||||
library.addProblem(message, charOffset, length, fileUri,
|
||||
context: context);
|
||||
TypeDeclarationBuilder declaration = buildInvalidTypeDeclarationBuilder(
|
||||
message.withLocation(fileUri, charOffset, length),
|
||||
context: context);
|
||||
bind(library, declaration);
|
||||
}
|
||||
}
|
||||
|
||||
void _check(LibraryBuilder library) {
|
||||
if (_declaration is InvalidTypeDeclarationBuilder) {
|
||||
return;
|
||||
}
|
||||
if (arguments != null) {
|
||||
if (_declaration!.isTypeVariable) {
|
||||
String typeName = nameText;
|
||||
int typeNameOffset = nameOffset;
|
||||
Message message =
|
||||
templateTypeArgumentsOnTypeVariable.withArguments(typeName);
|
||||
library.addProblem(message, typeNameOffset, typeName.length, fileUri);
|
||||
declaration = buildInvalidTypeDeclarationBuilder(
|
||||
message.withLocation(fileUri, typeNameOffset, typeName.length));
|
||||
}
|
||||
return;
|
||||
} else if (member is TypeDeclarationBuilder) {
|
||||
declaration = member.origin;
|
||||
if (!declaration!.isExtension ||
|
||||
library is SourceLibraryBuilder &&
|
||||
library.enableExtensionTypesInLibrary) {
|
||||
return;
|
||||
// TODO(johnniwinther): Should we retain the declaration to support
|
||||
// additional errors?
|
||||
_declaration = buildInvalidTypeDeclarationBuilder(
|
||||
message.withLocation(fileUri!, typeNameOffset, typeName.length));
|
||||
} else if (arguments!.length != declaration!.typeVariablesCount) {
|
||||
int typeNameLength = nameLength;
|
||||
int typeNameOffset = nameOffset;
|
||||
Message message = templateTypeArgumentMismatch
|
||||
.withArguments(declaration!.typeVariablesCount);
|
||||
library.addProblem(message, typeNameOffset, typeNameLength, fileUri);
|
||||
_declaration = buildInvalidTypeDeclarationBuilder(
|
||||
message.withLocation(fileUri!, typeNameOffset, typeNameLength));
|
||||
}
|
||||
}
|
||||
Template<Message Function(String name)> template =
|
||||
member == null ? templateTypeNotFound : templateNotAType;
|
||||
String flatName = flattenName(name, charOffset, fileUri);
|
||||
int length =
|
||||
name is Identifier ? name.endCharOffset - charOffset : flatName.length;
|
||||
Message message;
|
||||
List<LocatedMessage>? context;
|
||||
if (member == null) {
|
||||
template = templateTypeNotFound;
|
||||
message = template.withArguments(flatName);
|
||||
} else if (declaration != null &&
|
||||
declaration!.isExtension &&
|
||||
if (_declaration!.isExtension &&
|
||||
library is SourceLibraryBuilder &&
|
||||
!library.enableExtensionTypesInLibrary) {
|
||||
message = templateExperimentNotEnabled.withArguments('extension-types',
|
||||
Message message = templateExperimentNotEnabled.withArguments(
|
||||
'extension-types',
|
||||
library.enableExtensionTypesVersionInLibrary.toText());
|
||||
} else {
|
||||
template = templateNotAType;
|
||||
context = <LocatedMessage>[
|
||||
messageNotATypeContext.withLocation(member.fileUri!, member.charOffset,
|
||||
name is Identifier ? name.name.length : "$name".length)
|
||||
];
|
||||
message = template.withArguments(flatName);
|
||||
}
|
||||
library.addProblem(message, charOffset, length, fileUri, context: context);
|
||||
declaration = buildInvalidTypeDeclarationBuilder(
|
||||
message.withLocation(fileUri, charOffset, length),
|
||||
context: context);
|
||||
}
|
||||
|
||||
@override
|
||||
void check(LibraryBuilder library, int charOffset, Uri fileUri) {
|
||||
if (arguments != null &&
|
||||
arguments!.length != declaration!.typeVariablesCount) {
|
||||
Message message = templateTypeArgumentMismatch
|
||||
.withArguments(declaration!.typeVariablesCount);
|
||||
library.addProblem(message, charOffset, noLength, fileUri);
|
||||
declaration = buildInvalidTypeDeclarationBuilder(
|
||||
message.withLocation(fileUri, charOffset, noLength));
|
||||
int typeNameLength = nameLength;
|
||||
int typeNameOffset = nameOffset;
|
||||
library.addProblem(message, typeNameOffset, typeNameLength, fileUri);
|
||||
_declaration = buildInvalidTypeDeclarationBuilder(
|
||||
message.withLocation(fileUri!, typeNameOffset, typeNameLength));
|
||||
} else if (_declaration!.isTypeVariable) {
|
||||
TypeVariableBuilder typeParameterBuilder =
|
||||
_declaration as TypeVariableBuilder;
|
||||
if (typeParameterBuilder.kind == TypeVariableKind.classMixinOrEnum ||
|
||||
typeParameterBuilder.kind == TypeVariableKind.extension ||
|
||||
typeParameterBuilder.kind == TypeVariableKind.extensionSynthesized) {
|
||||
switch (_instanceTypeVariableAccess) {
|
||||
case InstanceTypeVariableAccessState.Disallowed:
|
||||
int typeNameLength = nameLength;
|
||||
int typeNameOffset = nameOffset;
|
||||
Message message = messageTypeVariableInStaticContext;
|
||||
library.addProblem(
|
||||
message, typeNameOffset, typeNameLength, fileUri);
|
||||
_declaration = buildInvalidTypeDeclarationBuilder(
|
||||
message.withLocation(fileUri!, typeNameOffset, typeNameLength));
|
||||
return;
|
||||
case InstanceTypeVariableAccessState.Invalid:
|
||||
int typeNameLength = nameLength;
|
||||
int typeNameOffset = nameOffset;
|
||||
Message message = messageTypeVariableInStaticContext;
|
||||
_declaration = buildInvalidTypeDeclarationBuilder(
|
||||
message.withLocation(fileUri!, typeNameOffset, typeNameLength));
|
||||
return;
|
||||
case InstanceTypeVariableAccessState.Unexpected:
|
||||
assert(false,
|
||||
"Unexpected instance type variable $typeParameterBuilder");
|
||||
break;
|
||||
case InstanceTypeVariableAccessState.Allowed:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -269,23 +341,18 @@ class NamedTypeBuilder extends TypeBuilder {
|
|||
context: context);
|
||||
}
|
||||
|
||||
Supertype? handleInvalidSupertype(
|
||||
LibraryBuilder library, int charOffset, Uri fileUri) {
|
||||
Supertype? _handleInvalidSupertype(LibraryBuilder library) {
|
||||
Template<Message Function(String name)> template =
|
||||
declaration!.isTypeVariable
|
||||
? templateSupertypeIsTypeVariable
|
||||
: templateSupertypeIsIllegal;
|
||||
library.addProblem(template.withArguments(fullNameForErrors), charOffset,
|
||||
library.addProblem(template.withArguments(fullNameForErrors), charOffset!,
|
||||
noLength, fileUri);
|
||||
return null;
|
||||
}
|
||||
|
||||
Supertype? handleInvalidAliasedSupertype(
|
||||
LibraryBuilder library,
|
||||
int charOffset,
|
||||
Uri fileUri,
|
||||
TypeAliasBuilder aliasBuilder,
|
||||
DartType type) {
|
||||
Supertype? _handleInvalidAliasedSupertype(
|
||||
LibraryBuilder library, TypeAliasBuilder aliasBuilder, DartType type) {
|
||||
// Don't report the error in case of InvalidType. An error has already been
|
||||
// reported in this case.
|
||||
if (type is InvalidType) return null;
|
||||
|
@ -303,7 +370,7 @@ class NamedTypeBuilder extends TypeBuilder {
|
|||
message = templateSupertypeIsIllegalAliased.withArguments(
|
||||
fullNameForErrors, type, library.isNonNullableByDefault);
|
||||
}
|
||||
library.addProblem(message, charOffset, noLength, fileUri, context: [
|
||||
library.addProblem(message, charOffset!, noLength, fileUri, context: [
|
||||
messageTypedefCause.withLocation(
|
||||
aliasBuilder.fileUri, aliasBuilder.charOffset, noLength),
|
||||
]);
|
||||
|
@ -311,18 +378,12 @@ class NamedTypeBuilder extends TypeBuilder {
|
|||
}
|
||||
|
||||
@override
|
||||
DartType build(LibraryBuilder library, {TypedefType? origin}) {
|
||||
return buildInternal(library, origin: origin, forTypeLiteral: false);
|
||||
DartType build(LibraryBuilder library) {
|
||||
return _type ??= _buildInternal(library);
|
||||
}
|
||||
|
||||
@override
|
||||
DartType buildTypeLiteralType(LibraryBuilder library, {TypedefType? origin}) {
|
||||
return buildInternal(library, origin: origin, forTypeLiteral: true);
|
||||
}
|
||||
|
||||
DartType declarationBuildType(LibraryBuilder library,
|
||||
{required bool forTypeLiteral}) {
|
||||
if (forTypeLiteral) {
|
||||
DartType _declarationBuildType(LibraryBuilder library) {
|
||||
if (_forTypeLiteral) {
|
||||
return declaration!
|
||||
.buildTypeLiteralType(library, nullabilityBuilder, arguments);
|
||||
} else {
|
||||
|
@ -330,39 +391,11 @@ class NamedTypeBuilder extends TypeBuilder {
|
|||
}
|
||||
}
|
||||
|
||||
// TODO(johnniwinther): Store [origin] on the built type.
|
||||
DartType buildInternal(LibraryBuilder library,
|
||||
{TypedefType? origin, required bool forTypeLiteral}) {
|
||||
DartType _buildInternal(LibraryBuilder library) {
|
||||
assert(declaration != null, "Declaration has not been resolved on $this.");
|
||||
if (declaration!.isTypeVariable) {
|
||||
TypeVariableBuilder typeParameterBuilder =
|
||||
declaration as TypeVariableBuilder;
|
||||
TypeParameter typeParameter = typeParameterBuilder.parameter;
|
||||
if (typeParameter.parent is Class || typeParameter.parent is Extension) {
|
||||
switch (instanceTypeVariableAccess) {
|
||||
case InstanceTypeVariableAccessState.Disallowed:
|
||||
library.addProblem(
|
||||
messageTypeVariableInStaticContext,
|
||||
charOffset ?? TreeNode.noOffset,
|
||||
noLength,
|
||||
fileUri ?? library.fileUri);
|
||||
return const InvalidType();
|
||||
case InstanceTypeVariableAccessState.Invalid:
|
||||
return const InvalidType();
|
||||
case InstanceTypeVariableAccessState.Unexpected:
|
||||
assert(false,
|
||||
"Unexpected instance type variable $typeParameterBuilder");
|
||||
break;
|
||||
case InstanceTypeVariableAccessState.Allowed:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (library is SourceLibraryBuilder) {
|
||||
int uncheckedTypedefTypeCount = library.uncheckedTypedefTypes.length;
|
||||
DartType builtType =
|
||||
declarationBuildType(library, forTypeLiteral: forTypeLiteral);
|
||||
DartType builtType = _declarationBuildType(library);
|
||||
// Set locations for new unchecked TypedefTypes for error reporting.
|
||||
for (int i = uncheckedTypedefTypeCount;
|
||||
i < library.uncheckedTypedefTypes.length;
|
||||
|
@ -375,19 +408,18 @@ class NamedTypeBuilder extends TypeBuilder {
|
|||
}
|
||||
return builtType;
|
||||
} else {
|
||||
return declarationBuildType(library, forTypeLiteral: forTypeLiteral);
|
||||
return _declarationBuildType(library);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Supertype? buildSupertype(
|
||||
LibraryBuilder library, int charOffset, Uri fileUri) {
|
||||
Supertype? buildSupertype(LibraryBuilder library) {
|
||||
TypeDeclarationBuilder declaration = this.declaration!;
|
||||
if (declaration is ClassBuilder) {
|
||||
if (declaration.isNullClass && !library.mayImplementRestrictedTypes) {
|
||||
library.addProblem(
|
||||
templateExtendingRestricted.withArguments(declaration.name),
|
||||
charOffset,
|
||||
charOffset!,
|
||||
noLength,
|
||||
fileUri);
|
||||
}
|
||||
|
@ -438,8 +470,7 @@ class NamedTypeBuilder extends TypeBuilder {
|
|||
return new Supertype((unaliasedDeclaration as ClassBuilder).cls,
|
||||
<DartType>[type.typeArgument]);
|
||||
}
|
||||
return handleInvalidAliasedSupertype(
|
||||
library, charOffset, fileUri, aliasBuilder, type);
|
||||
return _handleInvalidAliasedSupertype(library, aliasBuilder, type);
|
||||
} else if (declaration is InvalidTypeDeclarationBuilder) {
|
||||
library.addProblem(
|
||||
declaration.message.messageObject,
|
||||
|
@ -449,12 +480,11 @@ class NamedTypeBuilder extends TypeBuilder {
|
|||
severity: Severity.error);
|
||||
return null;
|
||||
}
|
||||
return handleInvalidSupertype(library, charOffset, fileUri);
|
||||
return _handleInvalidSupertype(library);
|
||||
}
|
||||
|
||||
@override
|
||||
Supertype? buildMixedInType(
|
||||
LibraryBuilder library, int charOffset, Uri fileUri) {
|
||||
Supertype? buildMixedInType(LibraryBuilder library) {
|
||||
TypeDeclarationBuilder declaration = this.declaration!;
|
||||
if (declaration is ClassBuilder) {
|
||||
return declaration.buildMixedInType(library, arguments);
|
||||
|
@ -464,8 +494,7 @@ class NamedTypeBuilder extends TypeBuilder {
|
|||
if (type is InterfaceType && type.nullability != Nullability.nullable) {
|
||||
return new Supertype(type.classNode, type.typeArguments);
|
||||
}
|
||||
return handleInvalidAliasedSupertype(
|
||||
library, charOffset, fileUri, aliasBuilder, type);
|
||||
return _handleInvalidAliasedSupertype(library, aliasBuilder, type);
|
||||
} else if (declaration is InvalidTypeDeclarationBuilder) {
|
||||
library.addProblem(
|
||||
declaration.message.messageObject,
|
||||
|
@ -475,7 +504,7 @@ class NamedTypeBuilder extends TypeBuilder {
|
|||
severity: Severity.error);
|
||||
return null;
|
||||
}
|
||||
return handleInvalidSupertype(library, charOffset, fileUri);
|
||||
return _handleInvalidSupertype(library);
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -496,15 +525,12 @@ class NamedTypeBuilder extends TypeBuilder {
|
|||
i++;
|
||||
}
|
||||
if (arguments != null) {
|
||||
NamedTypeBuilder result = new NamedTypeBuilder(
|
||||
name, nullabilityBuilder, arguments, fileUri, charOffset,
|
||||
instanceTypeVariableAccess: instanceTypeVariableAccess);
|
||||
if (declaration != null) {
|
||||
result.bind(declaration!);
|
||||
} else {
|
||||
throw new UnsupportedError("Unbound type in substitution: $result.");
|
||||
}
|
||||
return result;
|
||||
return new NamedTypeBuilder.fromTypeDeclarationBuilder(
|
||||
declaration!, nullabilityBuilder,
|
||||
arguments: arguments,
|
||||
fileUri: fileUri,
|
||||
charOffset: charOffset,
|
||||
instanceTypeVariableAccess: _instanceTypeVariableAccess);
|
||||
}
|
||||
}
|
||||
return this;
|
||||
|
@ -523,11 +549,13 @@ class NamedTypeBuilder extends TypeBuilder {
|
|||
.clone(newTypes, contextLibrary, contextDeclaration);
|
||||
}, growable: false);
|
||||
}
|
||||
NamedTypeBuilder newType = new NamedTypeBuilder(
|
||||
name, nullabilityBuilder, clonedArguments, fileUri, charOffset,
|
||||
instanceTypeVariableAccess: instanceTypeVariableAccess);
|
||||
NamedTypeBuilder newType = new NamedTypeBuilder(name, nullabilityBuilder,
|
||||
arguments: clonedArguments,
|
||||
fileUri: fileUri,
|
||||
charOffset: charOffset,
|
||||
instanceTypeVariableAccess: _instanceTypeVariableAccess);
|
||||
if (declaration is BuiltinTypeDeclarationBuilder) {
|
||||
newType.declaration = declaration;
|
||||
newType._declaration = declaration;
|
||||
} else {
|
||||
newTypes.add(newType);
|
||||
}
|
||||
|
@ -537,9 +565,30 @@ class NamedTypeBuilder extends TypeBuilder {
|
|||
@override
|
||||
NamedTypeBuilder withNullabilityBuilder(
|
||||
NullabilityBuilder nullabilityBuilder) {
|
||||
return new NamedTypeBuilder(
|
||||
name, nullabilityBuilder, arguments, fileUri, charOffset,
|
||||
instanceTypeVariableAccess: instanceTypeVariableAccess)
|
||||
..bind(declaration!);
|
||||
return new NamedTypeBuilder.fromTypeDeclarationBuilder(
|
||||
declaration!, nullabilityBuilder,
|
||||
arguments: arguments,
|
||||
fileUri: fileUri,
|
||||
charOffset: charOffset,
|
||||
instanceTypeVariableAccess: _instanceTypeVariableAccess);
|
||||
}
|
||||
|
||||
/// Returns a copy of this named type using the provided type [arguments]
|
||||
/// instead of the original type arguments.
|
||||
NamedTypeBuilder withArguments(List<TypeBuilder> arguments) {
|
||||
if (_declaration != null) {
|
||||
return new NamedTypeBuilder.fromTypeDeclarationBuilder(
|
||||
_declaration!, nullabilityBuilder,
|
||||
arguments: arguments,
|
||||
fileUri: fileUri,
|
||||
charOffset: charOffset,
|
||||
instanceTypeVariableAccess: _instanceTypeVariableAccess);
|
||||
} else {
|
||||
return new NamedTypeBuilder(name, nullabilityBuilder,
|
||||
arguments: arguments,
|
||||
fileUri: fileUri,
|
||||
charOffset: charOffset,
|
||||
instanceTypeVariableAccess: _instanceTypeVariableAccess);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,9 +4,8 @@
|
|||
|
||||
library fasta.type_builder;
|
||||
|
||||
import 'package:kernel/ast.dart' show DartType, Supertype, TypedefType;
|
||||
import 'package:kernel/ast.dart' show DartType, Supertype;
|
||||
|
||||
import '../scope.dart';
|
||||
import '../source/source_library_builder.dart';
|
||||
import 'library_builder.dart';
|
||||
import 'named_type_builder.dart';
|
||||
|
@ -27,14 +26,6 @@ abstract class TypeBuilder {
|
|||
/// occurred, or `null` if the type was synthesized.
|
||||
int? get charOffset;
|
||||
|
||||
void resolveIn(
|
||||
Scope scope, int charOffset, Uri fileUri, LibraryBuilder library) {}
|
||||
|
||||
/// See `UnresolvedType.checkType`.
|
||||
void check(LibraryBuilder library, int charOffset, Uri fileUri) {}
|
||||
|
||||
void bind(TypeDeclarationBuilder builder) {}
|
||||
|
||||
/// May return null, for example, for mixin applications.
|
||||
Object? get name;
|
||||
|
||||
|
@ -69,17 +60,11 @@ abstract class TypeBuilder {
|
|||
|
||||
String get fullNameForErrors => "${printOn(new StringBuffer())}";
|
||||
|
||||
DartType build(LibraryBuilder library, {TypedefType? origin});
|
||||
DartType build(LibraryBuilder library);
|
||||
|
||||
DartType buildTypeLiteralType(LibraryBuilder library, {TypedefType? origin}) {
|
||||
return build(library, origin: origin);
|
||||
}
|
||||
Supertype? buildSupertype(LibraryBuilder library);
|
||||
|
||||
Supertype? buildSupertype(
|
||||
LibraryBuilder library, int charOffset, Uri fileUri);
|
||||
|
||||
Supertype? buildMixedInType(
|
||||
LibraryBuilder library, int charOffset, Uri fileUri);
|
||||
Supertype? buildMixedInType(LibraryBuilder library);
|
||||
|
||||
TypeBuilder withNullabilityBuilder(NullabilityBuilder nullabilityBuilder);
|
||||
|
||||
|
|
|
@ -28,6 +28,25 @@ import 'nullability_builder.dart';
|
|||
import 'type_builder.dart';
|
||||
import 'type_declaration_builder.dart';
|
||||
|
||||
enum TypeVariableKind {
|
||||
/// A type variable declared on a function, method, local function or
|
||||
/// function type.
|
||||
function,
|
||||
|
||||
/// A type variable declared on a class, mixin or enum.
|
||||
classMixinOrEnum,
|
||||
|
||||
/// A type variable declared on an extension.
|
||||
extension,
|
||||
|
||||
/// A type variable on an extension instance member synthesized from an
|
||||
/// extension type variable.
|
||||
extensionSynthesized,
|
||||
|
||||
/// A type variable builder created from a kernel node.
|
||||
fromKernel,
|
||||
}
|
||||
|
||||
class TypeVariableBuilder extends TypeDeclarationBuilderImpl {
|
||||
/// Sentinel value used to indicate that the variable has no name. This is
|
||||
/// used for error recovery.
|
||||
|
@ -41,7 +60,7 @@ class TypeVariableBuilder extends TypeDeclarationBuilderImpl {
|
|||
|
||||
TypeVariableBuilder? actualOrigin;
|
||||
|
||||
final bool isExtensionTypeParameter;
|
||||
final TypeVariableKind kind;
|
||||
|
||||
@override
|
||||
final Uri? fileUri;
|
||||
|
@ -49,7 +68,7 @@ class TypeVariableBuilder extends TypeDeclarationBuilderImpl {
|
|||
TypeVariableBuilder(
|
||||
String name, Builder? compilationUnit, int charOffset, this.fileUri,
|
||||
{this.bound,
|
||||
this.isExtensionTypeParameter: false,
|
||||
required this.kind,
|
||||
int? variableVariance,
|
||||
List<MetadataBuilder>? metadata})
|
||||
: actualParameter =
|
||||
|
@ -63,7 +82,7 @@ class TypeVariableBuilder extends TypeDeclarationBuilderImpl {
|
|||
: actualParameter = parameter,
|
||||
// TODO(johnniwinther): Do we need to support synthesized type
|
||||
// parameters from kernel?
|
||||
this.isExtensionTypeParameter = false,
|
||||
kind = TypeVariableKind.fromKernel,
|
||||
fileUri = compilationUnit.fileUri,
|
||||
super(null, 0, parameter.name ?? '', compilationUnit,
|
||||
parameter.fileOffset);
|
||||
|
@ -194,7 +213,8 @@ class TypeVariableBuilder extends TypeDeclarationBuilderImpl {
|
|||
// is declared on.
|
||||
return new TypeVariableBuilder(name, parent!, charOffset, fileUri,
|
||||
bound: bound?.clone(newTypes, contextLibrary, contextDeclaration),
|
||||
variableVariance: variance);
|
||||
variableVariance: variance,
|
||||
kind: kind);
|
||||
}
|
||||
|
||||
void buildOutlineExpressions(
|
||||
|
|
|
@ -333,9 +333,11 @@ severity: $severity
|
|||
return library!.lookupLocalMember(cls.name, required: true) as ClassBuilder;
|
||||
}
|
||||
|
||||
late TypeBuilderComputer _typeBuilderComputer = new TypeBuilderComputer(this);
|
||||
|
||||
@override
|
||||
TypeBuilder computeTypeBuilder(DartType type) {
|
||||
return type.accept(new TypeBuilderComputer(this));
|
||||
return type.accept(_typeBuilderComputer);
|
||||
}
|
||||
|
||||
bool containsLibraryBuilder(Uri importUri) =>
|
||||
|
|
|
@ -96,6 +96,8 @@ import 'builder/member_builder.dart' show MemberBuilder;
|
|||
|
||||
import 'builder/name_iterator.dart' show NameIterator;
|
||||
|
||||
import 'builder/named_type_builder.dart' show NamedTypeBuilder;
|
||||
|
||||
import 'builder/type_builder.dart' show TypeBuilder;
|
||||
|
||||
import 'builder/type_declaration_builder.dart' show TypeDeclarationBuilder;
|
||||
|
@ -1377,21 +1379,26 @@ class IncrementalCompiler implements IncrementalKernelGenerator {
|
|||
Map<LibraryBuilder, Map<String, Builder>> replacementMap,
|
||||
Map<LibraryBuilder, Map<String, Builder>> replacementSettersMap,
|
||||
TypeBuilder? typeBuilder) {
|
||||
TypeDeclarationBuilder? declaration = typeBuilder?.declaration;
|
||||
Builder? parent = declaration?.parent;
|
||||
if (parent == null) return;
|
||||
Map<String, Builder>? childReplacementMap;
|
||||
if (declaration!.isSetter) {
|
||||
childReplacementMap = replacementSettersMap[parent];
|
||||
} else {
|
||||
childReplacementMap = replacementMap[parent];
|
||||
}
|
||||
if (typeBuilder is NamedTypeBuilder) {
|
||||
TypeDeclarationBuilder? declaration = typeBuilder.declaration;
|
||||
Builder? parent = declaration?.parent;
|
||||
if (parent == null) return;
|
||||
Map<String, Builder>? childReplacementMap;
|
||||
if (declaration!.isSetter) {
|
||||
childReplacementMap = replacementSettersMap[parent];
|
||||
} else {
|
||||
childReplacementMap = replacementMap[parent];
|
||||
}
|
||||
|
||||
if (childReplacementMap == null) return;
|
||||
Builder replacement = childReplacementMap[declaration.name]!;
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(replacement != null, "Didn't find the replacement for $typeBuilder");
|
||||
typeBuilder!.bind(replacement as TypeDeclarationBuilder);
|
||||
if (childReplacementMap == null) return;
|
||||
Builder replacement = childReplacementMap[declaration.name]!;
|
||||
assert(
|
||||
// ignore: unnecessary_null_comparison
|
||||
replacement != null,
|
||||
"Didn't find the replacement for $typeBuilder");
|
||||
typeBuilder.bind(
|
||||
parent as LibraryBuilder, replacement as TypeDeclarationBuilder);
|
||||
}
|
||||
}
|
||||
|
||||
/// Allows for updating the list of needed libraries.
|
||||
|
|
|
@ -4092,16 +4092,11 @@ class BodyBuilder extends StackListenerImpl
|
|||
Message message = fasta.templateNotAType.withArguments(displayName);
|
||||
libraryBuilder.addProblem(
|
||||
message, offset, lengthOfSpan(beginToken, suffix), uri);
|
||||
push(new NamedTypeBuilder.fromTypeDeclarationBuilder(
|
||||
new InvalidTypeDeclarationBuilder(
|
||||
name,
|
||||
message.withLocation(
|
||||
uri, offset, lengthOfSpan(beginToken, suffix))),
|
||||
push(new NamedTypeBuilder.forInvalidType(
|
||||
name,
|
||||
libraryBuilder.nullableBuilderIfTrue(isMarkedAsNullable),
|
||||
fileUri: uri,
|
||||
charOffset: offset,
|
||||
instanceTypeVariableAccess:
|
||||
InstanceTypeVariableAccessState.Unexpected));
|
||||
message.withLocation(
|
||||
uri, offset, lengthOfSpan(beginToken, suffix))));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -4119,7 +4114,8 @@ class BodyBuilder extends StackListenerImpl
|
|||
}
|
||||
result = name.buildTypeWithResolvedArguments(
|
||||
libraryBuilder.nullableBuilderIfTrue(isMarkedAsNullable), arguments,
|
||||
allowPotentiallyConstantType: allowPotentiallyConstantType);
|
||||
allowPotentiallyConstantType: allowPotentiallyConstantType,
|
||||
forTypeLiteral: false);
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (result == null) {
|
||||
unhandled("null", "result", beginToken.charOffset, uri);
|
||||
|
@ -4128,16 +4124,11 @@ class BodyBuilder extends StackListenerImpl
|
|||
// TODO(ahe): Arguments could be passed here.
|
||||
libraryBuilder.addProblem(
|
||||
name.message, name.charOffset, name.name.length, name.fileUri);
|
||||
result = new NamedTypeBuilder.fromTypeDeclarationBuilder(
|
||||
new InvalidTypeDeclarationBuilder(
|
||||
name.name,
|
||||
name.message.withLocation(
|
||||
name.fileUri, name.charOffset, name.name.length)),
|
||||
result = new NamedTypeBuilder.forInvalidType(
|
||||
name.name,
|
||||
libraryBuilder.nullableBuilderIfTrue(isMarkedAsNullable),
|
||||
fileUri: name.fileUri,
|
||||
charOffset: name.charOffset,
|
||||
instanceTypeVariableAccess:
|
||||
InstanceTypeVariableAccessState.Unexpected);
|
||||
name.message
|
||||
.withLocation(name.fileUri, name.charOffset, name.name.length));
|
||||
} else {
|
||||
unhandled(
|
||||
"${name.runtimeType}", "handleType", beginToken.charOffset, uri);
|
||||
|
@ -6802,7 +6793,8 @@ class BodyBuilder extends StackListenerImpl
|
|||
token.charOffset, uri);
|
||||
}
|
||||
TypeVariableBuilder variable = new TypeVariableBuilder(
|
||||
typeVariableName, libraryBuilder, typeVariableCharOffset, uri);
|
||||
typeVariableName, libraryBuilder, typeVariableCharOffset, uri,
|
||||
kind: TypeVariableKind.function);
|
||||
if (annotations != null) {
|
||||
inferAnnotations(variable.parameter, annotations);
|
||||
for (Expression annotation in annotations) {
|
||||
|
@ -6862,11 +6854,6 @@ class BodyBuilder extends StackListenerImpl
|
|||
"Found a type not bound to a declaration in BodyBuilder.");
|
||||
for (int i = 0; i < typeVariables.length; ++i) {
|
||||
typeVariables[i].defaultType = calculatedBounds[i];
|
||||
typeVariables[i].defaultType!.resolveIn(
|
||||
scope,
|
||||
typeVariables[i].charOffset,
|
||||
typeVariables[i].fileUri!,
|
||||
libraryBuilder);
|
||||
typeVariables[i].finish(
|
||||
libraryBuilder,
|
||||
libraryBuilder.loader.target.objectClassBuilder,
|
||||
|
@ -7251,43 +7238,17 @@ class BodyBuilder extends StackListenerImpl
|
|||
TypeParameter typeParameter = typeParameterBuilder.parameter;
|
||||
if (typeParameter.parent is Class ||
|
||||
typeParameter.parent is Extension) {
|
||||
switch (builder.instanceTypeVariableAccess) {
|
||||
case InstanceTypeVariableAccessState.Allowed:
|
||||
if (constantContext != ConstantContext.none &&
|
||||
(!inConstructorInitializer ||
|
||||
!allowPotentiallyConstantType)) {
|
||||
LocatedMessage message =
|
||||
fasta.messageTypeVariableInConstantContext.withLocation(
|
||||
builder.fileUri!,
|
||||
builder.charOffset!,
|
||||
typeParameter.name!.length);
|
||||
builder.bind(new InvalidTypeDeclarationBuilder(
|
||||
if (constantContext != ConstantContext.none &&
|
||||
(!inConstructorInitializer || !allowPotentiallyConstantType)) {
|
||||
LocatedMessage message = fasta.messageTypeVariableInConstantContext
|
||||
.withLocation(builder.fileUri!, builder.charOffset!,
|
||||
typeParameter.name!.length);
|
||||
builder.bind(
|
||||
libraryBuilder,
|
||||
new InvalidTypeDeclarationBuilder(
|
||||
typeParameter.name!, message));
|
||||
addProblem(
|
||||
message.messageObject, message.charOffset, message.length);
|
||||
}
|
||||
break;
|
||||
case InstanceTypeVariableAccessState.Disallowed:
|
||||
// TODO(johnniwinther): Can we unify this check with the similar
|
||||
// check in NamedTypeBuilder.buildTypeInternal. If we skip it
|
||||
// here, the error below (type variable in constant context) will
|
||||
// be emitted _instead_ of this (type variable in static context),
|
||||
// which seems like an odd prioritization.
|
||||
// TODO: Handle this case.
|
||||
LocatedMessage message = fasta.messageTypeVariableInStaticContext
|
||||
.withLocation(builder.fileUri!, builder.charOffset!,
|
||||
typeParameter.name!.length);
|
||||
builder.bind(new InvalidTypeDeclarationBuilder(
|
||||
typeParameter.name!, message));
|
||||
addProblem(
|
||||
message.messageObject, message.charOffset, message.length);
|
||||
break;
|
||||
case InstanceTypeVariableAccessState.Invalid:
|
||||
break;
|
||||
case InstanceTypeVariableAccessState.Unexpected:
|
||||
assert(false,
|
||||
"Unexpected instance type variable $typeParameterBuilder");
|
||||
break;
|
||||
addProblem(
|
||||
message.messageObject, message.charOffset, message.length);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7481,14 +7442,6 @@ class BodyBuilder extends StackListenerImpl
|
|||
.build(libraryBuilder);
|
||||
}
|
||||
|
||||
@override
|
||||
DartType buildTypeLiteralDartType(TypeBuilder typeBuilder,
|
||||
{required bool allowPotentiallyConstantType}) {
|
||||
return validateTypeVariableUse(typeBuilder,
|
||||
allowPotentiallyConstantType: allowPotentiallyConstantType)
|
||||
.buildTypeLiteralType(libraryBuilder);
|
||||
}
|
||||
|
||||
@override
|
||||
List<DartType> buildDartTypeArguments(List<TypeBuilder>? unresolvedTypes,
|
||||
{required bool allowPotentiallyConstantType}) {
|
||||
|
|
|
@ -273,21 +273,13 @@ abstract class Generator {
|
|||
/// create a [TypeBuilder] for a valid type.
|
||||
TypeBuilder buildTypeWithResolvedArguments(
|
||||
NullabilityBuilder nullabilityBuilder, List<TypeBuilder>? arguments,
|
||||
{required bool allowPotentiallyConstantType}) {
|
||||
// TODO(johnniwinther): Could we use a FixedTypeBuilder(InvalidType()) here?
|
||||
NamedTypeBuilder result = new NamedTypeBuilder(
|
||||
token.lexeme,
|
||||
nullabilityBuilder,
|
||||
/* arguments = */ null,
|
||||
/* fileUri = */ null,
|
||||
/* charOffset = */ null,
|
||||
instanceTypeVariableAccess: _helper.instanceTypeVariableAccessState);
|
||||
{required bool allowPotentiallyConstantType,
|
||||
required bool forTypeLiteral}) {
|
||||
Message message = templateNotAType.withArguments(token.lexeme);
|
||||
_helper.libraryBuilder
|
||||
.addProblem(message, fileOffset, lengthForToken(token), _uri);
|
||||
result.bind(result.buildInvalidTypeDeclarationBuilder(
|
||||
message.withLocation(_uri, fileOffset, lengthForToken(token))));
|
||||
return result;
|
||||
return new NamedTypeBuilder.forInvalidType(token.lexeme, nullabilityBuilder,
|
||||
message.withLocation(_uri, fileOffset, lengthForToken(token)));
|
||||
}
|
||||
|
||||
/* Expression | Generator */ Object qualifiedLookup(Token name) {
|
||||
|
@ -2910,12 +2902,14 @@ class DeferredAccessGenerator extends Generator {
|
|||
@override
|
||||
TypeBuilder buildTypeWithResolvedArguments(
|
||||
NullabilityBuilder nullabilityBuilder, List<TypeBuilder>? arguments,
|
||||
{required bool allowPotentiallyConstantType}) {
|
||||
{required bool allowPotentiallyConstantType,
|
||||
required bool forTypeLiteral}) {
|
||||
String name = "${prefixGenerator._plainNameForRead}."
|
||||
"${suffixGenerator._plainNameForRead}";
|
||||
TypeBuilder type = suffixGenerator.buildTypeWithResolvedArguments(
|
||||
nullabilityBuilder, arguments,
|
||||
allowPotentiallyConstantType: allowPotentiallyConstantType);
|
||||
allowPotentiallyConstantType: allowPotentiallyConstantType,
|
||||
forTypeLiteral: forTypeLiteral);
|
||||
LocatedMessage message;
|
||||
if (type is NamedTypeBuilder &&
|
||||
type.declaration is InvalidTypeDeclarationBuilder) {
|
||||
|
@ -2933,14 +2927,10 @@ class DeferredAccessGenerator extends Generator {
|
|||
.withLocation(
|
||||
_uri, charOffset, lengthOfSpan(prefixGenerator.token, token));
|
||||
}
|
||||
// TODO(johnniwinther): Could we use a FixedTypeBuilder(InvalidType()) here?
|
||||
NamedTypeBuilder result = new NamedTypeBuilder(name, nullabilityBuilder,
|
||||
/* arguments = */ null, /* fileUri = */ null, /* charOffset = */ null,
|
||||
instanceTypeVariableAccess: InstanceTypeVariableAccessState.Unexpected);
|
||||
_helper.libraryBuilder.addProblem(
|
||||
message.messageObject, message.charOffset, message.length, message.uri);
|
||||
result.bind(result.buildInvalidTypeDeclarationBuilder(message));
|
||||
return result;
|
||||
return new NamedTypeBuilder.forInvalidType(
|
||||
name, nullabilityBuilder, message);
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -3039,40 +3029,15 @@ class TypeUseGenerator extends AbstractReadOnlyAccessGenerator {
|
|||
@override
|
||||
TypeBuilder buildTypeWithResolvedArguments(
|
||||
NullabilityBuilder nullabilityBuilder, List<TypeBuilder>? arguments,
|
||||
{required bool allowPotentiallyConstantType}) {
|
||||
if (declaration.isExtension && !_helper.enableExtensionTypesInLibrary) {
|
||||
// Extension declarations cannot be used as types.
|
||||
return super.buildTypeWithResolvedArguments(nullabilityBuilder, arguments,
|
||||
allowPotentiallyConstantType: allowPotentiallyConstantType);
|
||||
}
|
||||
if (arguments != null) {
|
||||
int expected = declaration.typeVariablesCount;
|
||||
if (arguments.length != expected) {
|
||||
// Build the type arguments to report any errors they may have.
|
||||
_helper.buildDartTypeArguments(arguments,
|
||||
allowPotentiallyConstantType: allowPotentiallyConstantType);
|
||||
_helper.warnTypeArgumentsMismatch(
|
||||
declaration.name, expected, fileOffset);
|
||||
// We ignore the provided arguments, which will in turn return the
|
||||
// raw type below.
|
||||
// TODO(sigmund): change to use an InvalidType and include the raw type
|
||||
// as a recovery node once the IR can represent it (Issue #29840).
|
||||
arguments = null;
|
||||
}
|
||||
}
|
||||
|
||||
List<TypeBuilder>? argumentBuilders;
|
||||
if (arguments != null) {
|
||||
argumentBuilders =
|
||||
new List<TypeBuilder>.generate(arguments.length, (int i) {
|
||||
return _helper.validateTypeVariableUse(arguments![i],
|
||||
allowPotentiallyConstantType: allowPotentiallyConstantType);
|
||||
}, growable: false);
|
||||
}
|
||||
return new NamedTypeBuilder(
|
||||
targetName, nullabilityBuilder, argumentBuilders, _uri, fileOffset,
|
||||
instanceTypeVariableAccess: _helper.instanceTypeVariableAccessState)
|
||||
..bind(declaration);
|
||||
{required bool allowPotentiallyConstantType,
|
||||
required bool forTypeLiteral}) {
|
||||
return new NamedTypeBuilder(targetName, nullabilityBuilder,
|
||||
arguments: arguments,
|
||||
fileUri: _uri,
|
||||
charOffset: fileOffset,
|
||||
instanceTypeVariableAccess: _helper.instanceTypeVariableAccessState,
|
||||
forTypeLiteral: forTypeLiteral)
|
||||
..bind(_helper.libraryBuilder, declaration);
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -3115,10 +3080,10 @@ class TypeUseGenerator extends AbstractReadOnlyAccessGenerator {
|
|||
} else {
|
||||
_expression = _forest.createTypeLiteral(
|
||||
offsetForToken(token),
|
||||
_helper.buildTypeLiteralDartType(
|
||||
_helper.buildDartType(
|
||||
buildTypeWithResolvedArguments(
|
||||
_helper.libraryBuilder.nonNullableBuilder, typeArguments,
|
||||
allowPotentiallyConstantType: true),
|
||||
allowPotentiallyConstantType: true, forTypeLiteral: true),
|
||||
allowPotentiallyConstantType:
|
||||
_helper.enableConstructorTearOffsInLibrary));
|
||||
}
|
||||
|
@ -3181,11 +3146,13 @@ class TypeUseGenerator extends AbstractReadOnlyAccessGenerator {
|
|||
aliasedTypeArguments = <TypeBuilder>[];
|
||||
for (TypeVariableBuilder typeVariable
|
||||
in aliasBuilder.typeVariables!) {
|
||||
aliasedTypeArguments.add(new NamedTypeBuilder(typeVariable.name,
|
||||
const NullabilityBuilder.omitted(), null, _uri, fileOffset,
|
||||
aliasedTypeArguments.add(new NamedTypeBuilder(
|
||||
typeVariable.name, const NullabilityBuilder.omitted(),
|
||||
fileUri: _uri,
|
||||
charOffset: fileOffset,
|
||||
instanceTypeVariableAccess:
|
||||
_helper.instanceTypeVariableAccessState)
|
||||
..bind(typeVariable));
|
||||
..bind(_helper.libraryBuilder, typeVariable));
|
||||
}
|
||||
}
|
||||
unaliasedTypeArguments =
|
||||
|
@ -4183,18 +4150,12 @@ class UnexpectedQualifiedUseGenerator extends Generator {
|
|||
@override
|
||||
TypeBuilder buildTypeWithResolvedArguments(
|
||||
NullabilityBuilder nullabilityBuilder, List<TypeBuilder>? arguments,
|
||||
{required bool allowPotentiallyConstantType}) {
|
||||
{required bool allowPotentiallyConstantType,
|
||||
required bool forTypeLiteral}) {
|
||||
Template<Message Function(String, String)> template = isUnresolved
|
||||
? templateUnresolvedPrefixInTypeAnnotation
|
||||
: templateNotAPrefixInTypeAnnotation;
|
||||
// TODO(johnniwinther): Could we use a FixedTypeBuilder(InvalidType()) here?
|
||||
NamedTypeBuilder result = new NamedTypeBuilder(
|
||||
_plainNameForRead,
|
||||
nullabilityBuilder,
|
||||
/* arguments = */ null,
|
||||
/* fileUri = */ null,
|
||||
/* charOffset = */ null,
|
||||
instanceTypeVariableAccess: InstanceTypeVariableAccessState.Unexpected);
|
||||
Message message =
|
||||
template.withArguments(prefixGenerator.token.lexeme, token.lexeme);
|
||||
_helper.libraryBuilder.addProblem(
|
||||
|
@ -4202,11 +4163,11 @@ class UnexpectedQualifiedUseGenerator extends Generator {
|
|||
offsetForToken(prefixGenerator.token),
|
||||
lengthOfSpan(prefixGenerator.token, token),
|
||||
_uri);
|
||||
result.bind(result.buildInvalidTypeDeclarationBuilder(message.withLocation(
|
||||
_uri,
|
||||
offsetForToken(prefixGenerator.token),
|
||||
lengthOfSpan(prefixGenerator.token, token))));
|
||||
return result;
|
||||
return new NamedTypeBuilder.forInvalidType(
|
||||
_plainNameForRead,
|
||||
nullabilityBuilder,
|
||||
message.withLocation(_uri, offsetForToken(prefixGenerator.token),
|
||||
lengthOfSpan(prefixGenerator.token, token)));
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -4309,19 +4270,11 @@ class ParserErrorGenerator extends Generator {
|
|||
@override
|
||||
TypeBuilder buildTypeWithResolvedArguments(
|
||||
NullabilityBuilder nullabilityBuilder, List<TypeBuilder>? arguments,
|
||||
{required bool allowPotentiallyConstantType}) {
|
||||
// TODO(johnniwinther): Could we use a FixedTypeBuilder(InvalidType()) here?
|
||||
NamedTypeBuilder result = new NamedTypeBuilder(
|
||||
token.lexeme,
|
||||
nullabilityBuilder,
|
||||
/* arguments = */ null,
|
||||
/* fileUri = */ null,
|
||||
/* charOffset = */ null,
|
||||
instanceTypeVariableAccess: InstanceTypeVariableAccessState.Unexpected);
|
||||
{required bool allowPotentiallyConstantType,
|
||||
required bool forTypeLiteral}) {
|
||||
_helper.libraryBuilder.addProblem(message, fileOffset, noLength, _uri);
|
||||
result.bind(result.buildInvalidTypeDeclarationBuilder(
|
||||
message.withLocation(_uri, fileOffset, noLength)));
|
||||
return result;
|
||||
return new NamedTypeBuilder.forInvalidType(token.lexeme, nullabilityBuilder,
|
||||
message.withLocation(_uri, fileOffset, noLength));
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
@ -160,9 +160,6 @@ abstract class ExpressionGeneratorHelper implements InferenceHelper {
|
|||
DartType buildDartType(TypeBuilder typeBuilder,
|
||||
{required bool allowPotentiallyConstantType});
|
||||
|
||||
DartType buildTypeLiteralDartType(TypeBuilder typeBuilder,
|
||||
{required bool allowPotentiallyConstantType});
|
||||
|
||||
List<DartType> buildDartTypeArguments(List<TypeBuilder>? typeArguments,
|
||||
{required bool allowPotentiallyConstantType});
|
||||
|
||||
|
|
|
@ -68,10 +68,8 @@ class ClassHierarchyNodeBuilder {
|
|||
|
||||
superclasses = new List<Supertype>.filled(
|
||||
supernode.superclasses.length + 1, dummySupertype);
|
||||
Supertype? supertype = classBuilder.supertypeBuilder!.buildSupertype(
|
||||
classBuilder.libraryBuilder,
|
||||
classBuilder.charOffset,
|
||||
classBuilder.fileUri);
|
||||
Supertype? supertype = classBuilder.supertypeBuilder!
|
||||
.buildSupertype(classBuilder.libraryBuilder);
|
||||
if (supertype == null) {
|
||||
// If the superclass is not an interface type we use Object instead.
|
||||
// A similar normalization is performed on [supernode] above.
|
||||
|
@ -117,8 +115,7 @@ class ClassHierarchyNodeBuilder {
|
|||
|
||||
for (int i = 0; i < directInterfaceBuilders.length; i++) {
|
||||
Supertype? directInterface = directInterfaceBuilders[i]
|
||||
.buildSupertype(classBuilder.libraryBuilder,
|
||||
classBuilder.charOffset, classBuilder.fileUri);
|
||||
.buildSupertype(classBuilder.libraryBuilder);
|
||||
if (directInterface != null) {
|
||||
addInterface(interfaces, superclasses, directInterface);
|
||||
ClassHierarchyNode interfaceNode =
|
||||
|
|
|
@ -102,56 +102,32 @@ class KernelTarget extends TargetImplementation {
|
|||
|
||||
// 'dynamic' is always nullable.
|
||||
// TODO(johnniwinther): Why isn't this using a FixedTypeBuilder?
|
||||
final TypeBuilder dynamicType = new NamedTypeBuilder(
|
||||
"dynamic",
|
||||
const NullabilityBuilder.inherent(),
|
||||
/* arguments = */ null,
|
||||
/* fileUri = */ null,
|
||||
/* charOffset = */ null,
|
||||
final NamedTypeBuilder dynamicType = new NamedTypeBuilder(
|
||||
"dynamic", const NullabilityBuilder.inherent(),
|
||||
instanceTypeVariableAccess: InstanceTypeVariableAccessState.Unexpected);
|
||||
|
||||
final NamedTypeBuilder objectType = new NamedTypeBuilder(
|
||||
"Object",
|
||||
const NullabilityBuilder.omitted(),
|
||||
/* arguments = */ null,
|
||||
/* fileUri = */ null,
|
||||
/* charOffset = */ null,
|
||||
"Object", const NullabilityBuilder.omitted(),
|
||||
instanceTypeVariableAccess: InstanceTypeVariableAccessState.Unexpected);
|
||||
|
||||
// Null is always nullable.
|
||||
// TODO(johnniwinther): This could (maybe) use a FixedTypeBuilder when we
|
||||
// have NullType?
|
||||
final TypeBuilder nullType = new NamedTypeBuilder(
|
||||
"Null",
|
||||
const NullabilityBuilder.inherent(),
|
||||
/* arguments = */ null,
|
||||
/* fileUri = */ null,
|
||||
/* charOffset = */ null,
|
||||
final NamedTypeBuilder nullType = new NamedTypeBuilder(
|
||||
"Null", const NullabilityBuilder.inherent(),
|
||||
instanceTypeVariableAccess: InstanceTypeVariableAccessState.Unexpected);
|
||||
|
||||
// TODO(johnniwinther): Why isn't this using a FixedTypeBuilder?
|
||||
final TypeBuilder bottomType = new NamedTypeBuilder(
|
||||
"Never",
|
||||
const NullabilityBuilder.omitted(),
|
||||
/* arguments = */ null,
|
||||
/* fileUri = */ null,
|
||||
/* charOffset = */ null,
|
||||
final NamedTypeBuilder bottomType = new NamedTypeBuilder(
|
||||
"Never", const NullabilityBuilder.omitted(),
|
||||
instanceTypeVariableAccess: InstanceTypeVariableAccessState.Unexpected);
|
||||
|
||||
final NamedTypeBuilder enumType = new NamedTypeBuilder(
|
||||
"Enum",
|
||||
const NullabilityBuilder.omitted(),
|
||||
/* arguments = */ null,
|
||||
/* fileUri = */ null,
|
||||
/* charOffset = */ null,
|
||||
"Enum", const NullabilityBuilder.omitted(),
|
||||
instanceTypeVariableAccess: InstanceTypeVariableAccessState.Unexpected);
|
||||
|
||||
final NamedTypeBuilder underscoreEnumType = new NamedTypeBuilder(
|
||||
"_Enum",
|
||||
const NullabilityBuilder.omitted(),
|
||||
/* arguments = */ null,
|
||||
/* fileUri = */ null,
|
||||
/* charOffset = */ null,
|
||||
"_Enum", const NullabilityBuilder.omitted(),
|
||||
instanceTypeVariableAccess: InstanceTypeVariableAccessState.Unexpected);
|
||||
|
||||
final bool excludeSource = !CompilerContext.current.options.embedSourceText;
|
||||
|
@ -385,14 +361,9 @@ class KernelTarget extends TargetImplementation {
|
|||
cls.implementedTypes.clear();
|
||||
cls.supertype = null;
|
||||
cls.mixedInType = null;
|
||||
builder.supertypeBuilder = new NamedTypeBuilder(
|
||||
"Object",
|
||||
const NullabilityBuilder.omitted(),
|
||||
/* arguments = */ null,
|
||||
/* fileUri = */ null,
|
||||
/* charOffset = */ null,
|
||||
instanceTypeVariableAccess: InstanceTypeVariableAccessState.Unexpected)
|
||||
..bind(objectClassBuilder);
|
||||
builder.supertypeBuilder = new NamedTypeBuilder.fromTypeDeclarationBuilder(
|
||||
objectClassBuilder, const NullabilityBuilder.omitted(),
|
||||
instanceTypeVariableAccess: InstanceTypeVariableAccessState.Unexpected);
|
||||
builder.interfaceBuilders = null;
|
||||
builder.mixedInTypeBuilder = null;
|
||||
}
|
||||
|
@ -1208,20 +1179,29 @@ class KernelTarget extends TargetImplementation {
|
|||
}
|
||||
|
||||
void setupTopAndBottomTypes() {
|
||||
objectType.bind(loader.coreLibrary
|
||||
.lookupLocalMember("Object", required: true) as TypeDeclarationBuilder);
|
||||
objectType.bind(
|
||||
loader.coreLibrary,
|
||||
loader.coreLibrary.lookupLocalMember("Object", required: true)
|
||||
as TypeDeclarationBuilder);
|
||||
dynamicType.bind(
|
||||
loader.coreLibrary,
|
||||
loader.coreLibrary.lookupLocalMember("dynamic", required: true)
|
||||
as TypeDeclarationBuilder);
|
||||
ClassBuilder nullClassBuilder = loader.coreLibrary
|
||||
.lookupLocalMember("Null", required: true) as ClassBuilder;
|
||||
nullType.bind(nullClassBuilder..isNullClass = true);
|
||||
bottomType.bind(loader.coreLibrary
|
||||
.lookupLocalMember("Never", required: true) as TypeDeclarationBuilder);
|
||||
enumType.bind(loader.coreLibrary.lookupLocalMember("Enum", required: true)
|
||||
as TypeDeclarationBuilder);
|
||||
underscoreEnumType.bind(loader.coreLibrary
|
||||
.lookupLocalMember("_Enum", required: true) as TypeDeclarationBuilder);
|
||||
nullType.bind(loader.coreLibrary, nullClassBuilder..isNullClass = true);
|
||||
bottomType.bind(
|
||||
loader.coreLibrary,
|
||||
loader.coreLibrary.lookupLocalMember("Never", required: true)
|
||||
as TypeDeclarationBuilder);
|
||||
enumType.bind(
|
||||
loader.coreLibrary,
|
||||
loader.coreLibrary.lookupLocalMember("Enum", required: true)
|
||||
as TypeDeclarationBuilder);
|
||||
underscoreEnumType.bind(
|
||||
loader.coreLibrary,
|
||||
loader.coreLibrary.lookupLocalMember("_Enum", required: true)
|
||||
as TypeDeclarationBuilder);
|
||||
}
|
||||
|
||||
void computeCoreTypes() {
|
||||
|
|
|
@ -268,12 +268,8 @@ TypeBuilder? substituteRange(
|
|||
assert(false, "Unexpected named type builder declaration: $declaration.");
|
||||
}
|
||||
if (arguments != null) {
|
||||
NamedTypeBuilder newTypeBuilder = new NamedTypeBuilder(type.name,
|
||||
type.nullabilityBuilder, arguments, type.fileUri, type.charOffset,
|
||||
instanceTypeVariableAccess: type.instanceTypeVariableAccess);
|
||||
if (declaration != null) {
|
||||
newTypeBuilder.bind(declaration);
|
||||
} else {
|
||||
NamedTypeBuilder newTypeBuilder = type.withArguments(arguments);
|
||||
if (declaration == null) {
|
||||
unboundTypes.add(newTypeBuilder);
|
||||
}
|
||||
return newTypeBuilder;
|
||||
|
@ -305,7 +301,7 @@ TypeBuilder? substituteRange(
|
|||
TypeVariableBuilder newTypeVariableBuilder = variables[i] =
|
||||
new TypeVariableBuilder(variable.name, variable.parent,
|
||||
variable.charOffset, variable.fileUri,
|
||||
bound: bound);
|
||||
bound: bound, kind: TypeVariableKind.function);
|
||||
unboundTypeVariables.add(newTypeVariableBuilder);
|
||||
if (functionTypeUpperSubstitution == null) {
|
||||
functionTypeUpperSubstitution = {}..addAll(upperSubstitution);
|
||||
|
|
|
@ -31,7 +31,27 @@ import '../loader.dart' show Loader;
|
|||
class TypeBuilderComputer implements DartTypeVisitor<TypeBuilder> {
|
||||
final Loader loader;
|
||||
|
||||
const TypeBuilderComputer(this.loader);
|
||||
late final DynamicTypeDeclarationBuilder dynamicDeclaration =
|
||||
new DynamicTypeDeclarationBuilder(
|
||||
const DynamicType(), loader.coreLibrary, -1);
|
||||
|
||||
late final VoidTypeDeclarationBuilder voidDeclaration =
|
||||
new VoidTypeDeclarationBuilder(const VoidType(), loader.coreLibrary, -1);
|
||||
|
||||
late final NeverTypeDeclarationBuilder neverDeclaration =
|
||||
new NeverTypeDeclarationBuilder(
|
||||
const NeverType.nonNullable(), loader.coreLibrary, -1);
|
||||
|
||||
late final NullTypeDeclarationBuilder nullDeclaration =
|
||||
new NullTypeDeclarationBuilder(const NullType(), loader.coreLibrary, -1);
|
||||
|
||||
late final FutureOrTypeDeclarationBuilder futureOrDeclaration =
|
||||
new FutureOrTypeDeclarationBuilder(
|
||||
new FutureOrType(const DynamicType(), Nullability.nonNullable),
|
||||
loader.coreLibrary,
|
||||
-1);
|
||||
|
||||
TypeBuilderComputer(this.loader);
|
||||
|
||||
@override
|
||||
TypeBuilder defaultDartType(DartType node) {
|
||||
|
@ -47,41 +67,27 @@ class TypeBuilderComputer implements DartTypeVisitor<TypeBuilder> {
|
|||
@override
|
||||
TypeBuilder visitDynamicType(DynamicType node) {
|
||||
// 'dynamic' is always nullable.
|
||||
return new NamedTypeBuilder("dynamic", const NullabilityBuilder.nullable(),
|
||||
/* arguments = */ null, /* fileUri = */ null, /* charOffset = */ null,
|
||||
instanceTypeVariableAccess: InstanceTypeVariableAccessState.Unexpected)
|
||||
..bind(new DynamicTypeDeclarationBuilder(
|
||||
const DynamicType(), loader.coreLibrary, -1));
|
||||
return new NamedTypeBuilder.forDartType(
|
||||
node, dynamicDeclaration, const NullabilityBuilder.inherent());
|
||||
}
|
||||
|
||||
@override
|
||||
TypeBuilder visitVoidType(VoidType node) {
|
||||
// 'void' is always nullable.
|
||||
return new NamedTypeBuilder("void", const NullabilityBuilder.nullable(),
|
||||
/* arguments = */ null, /* fileUri = */ null, /* charOffset = */ null,
|
||||
instanceTypeVariableAccess: InstanceTypeVariableAccessState.Unexpected)
|
||||
..bind(new VoidTypeDeclarationBuilder(
|
||||
const VoidType(), loader.coreLibrary, -1));
|
||||
return new NamedTypeBuilder.forDartType(
|
||||
node, voidDeclaration, const NullabilityBuilder.inherent());
|
||||
}
|
||||
|
||||
@override
|
||||
TypeBuilder visitNeverType(NeverType node) {
|
||||
return new NamedTypeBuilder(
|
||||
"Never",
|
||||
new NullabilityBuilder.fromNullability(node.nullability),
|
||||
/* arguments = */ null,
|
||||
/* fileUri = */ null,
|
||||
/* charOffset = */ null,
|
||||
instanceTypeVariableAccess: InstanceTypeVariableAccessState.Unexpected)
|
||||
..bind(new NeverTypeDeclarationBuilder(node, loader.coreLibrary, -1));
|
||||
return new NamedTypeBuilder.forDartType(node, neverDeclaration,
|
||||
new NullabilityBuilder.fromNullability(node.nullability));
|
||||
}
|
||||
|
||||
@override
|
||||
TypeBuilder visitNullType(NullType node) {
|
||||
return new NamedTypeBuilder("Null", new NullabilityBuilder.nullable(),
|
||||
/* arguments = */ null, /* fileUri = */ null, /* charOffset = */ null,
|
||||
instanceTypeVariableAccess: InstanceTypeVariableAccessState.Unexpected)
|
||||
..bind(new NullTypeDeclarationBuilder(node, loader.coreLibrary, -1));
|
||||
return new NamedTypeBuilder.forDartType(
|
||||
node, nullDeclaration, const NullabilityBuilder.inherent());
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -95,14 +101,9 @@ class TypeBuilderComputer implements DartTypeVisitor<TypeBuilder> {
|
|||
kernelArguments.length, (int i) => kernelArguments[i].accept(this),
|
||||
growable: false);
|
||||
}
|
||||
return new NamedTypeBuilder(
|
||||
cls.name,
|
||||
new NullabilityBuilder.fromNullability(node.nullability),
|
||||
arguments,
|
||||
/* fileUri = */ null,
|
||||
/* charOffset = */ null,
|
||||
instanceTypeVariableAccess: InstanceTypeVariableAccessState.Unexpected)
|
||||
..bind(cls);
|
||||
return new NamedTypeBuilder.forDartType(
|
||||
node, cls, new NullabilityBuilder.fromNullability(node.nullability),
|
||||
arguments: arguments);
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -113,14 +114,9 @@ class TypeBuilderComputer implements DartTypeVisitor<TypeBuilder> {
|
|||
@override
|
||||
TypeBuilder visitFutureOrType(FutureOrType node) {
|
||||
TypeBuilder argument = node.typeArgument.accept(this);
|
||||
return new NamedTypeBuilder(
|
||||
"FutureOr",
|
||||
return new NamedTypeBuilder.forDartType(node, futureOrDeclaration,
|
||||
new NullabilityBuilder.fromNullability(node.nullability),
|
||||
[argument],
|
||||
/* fileUri = */ null,
|
||||
/* charOffset = */ null,
|
||||
instanceTypeVariableAccess: InstanceTypeVariableAccessState.Unexpected)
|
||||
..bind(new FutureOrTypeDeclarationBuilder(node, loader.coreLibrary, -1));
|
||||
arguments: [argument]);
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -183,14 +179,11 @@ class TypeBuilderComputer implements DartTypeVisitor<TypeBuilder> {
|
|||
}
|
||||
LibraryBuilder library =
|
||||
loader.lookupLibraryBuilder(kernelLibrary!.importUri)!;
|
||||
return new NamedTypeBuilder(
|
||||
parameter.name!,
|
||||
return new NamedTypeBuilder.fromTypeDeclarationBuilder(
|
||||
new TypeVariableBuilder.fromKernel(parameter, library),
|
||||
new NullabilityBuilder.fromNullability(node.nullability),
|
||||
/* arguments = */ null,
|
||||
/* fileUri = */ null,
|
||||
/* charOffset = */ null,
|
||||
instanceTypeVariableAccess: InstanceTypeVariableAccessState.Allowed)
|
||||
..bind(new TypeVariableBuilder.fromKernel(parameter, library));
|
||||
instanceTypeVariableAccess: InstanceTypeVariableAccessState.Allowed,
|
||||
type: node);
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
@ -232,8 +232,9 @@ final TypeBuilder dummyTypeBuilder =
|
|||
new FixedTypeBuilder(dummyDartType, dummyUri, -1);
|
||||
final FormalParameterBuilder dummyFormalParameterBuilder =
|
||||
new FormalParameterBuilder(null, 0, null, '', null, -1, fileUri: dummyUri);
|
||||
final TypeVariableBuilder dummyTypeVariableBuilder =
|
||||
new TypeVariableBuilder(TypeVariableBuilder.noNameSentinel, null, -1, null);
|
||||
final TypeVariableBuilder dummyTypeVariableBuilder = new TypeVariableBuilder(
|
||||
TypeVariableBuilder.noNameSentinel, null, -1, null,
|
||||
kind: TypeVariableKind.function);
|
||||
final Label dummyLabel = new Label('', -1);
|
||||
final FieldInfo dummyFieldInfo = new FieldInfo('', -1, null, dummyToken, -1);
|
||||
final Configuration dummyConfiguration = new Configuration(-1, '', '', '');
|
||||
|
|
|
@ -369,6 +369,54 @@ extension on DeclarationContext {
|
|||
return InstanceTypeVariableAccessState.Invalid;
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the kind of type variable created in the current context.
|
||||
TypeVariableKind get typeVariableKind {
|
||||
switch (this) {
|
||||
case DeclarationContext.Class:
|
||||
case DeclarationContext.ClassOrMixinOrNamedMixinApplication:
|
||||
case DeclarationContext.Mixin:
|
||||
case DeclarationContext.NamedMixinApplication:
|
||||
return TypeVariableKind.classMixinOrEnum;
|
||||
case DeclarationContext.Extension:
|
||||
case DeclarationContext.ExtensionBody:
|
||||
return TypeVariableKind.extension;
|
||||
case DeclarationContext.ClassBody:
|
||||
case DeclarationContext.ClassConstructor:
|
||||
case DeclarationContext.ClassFactory:
|
||||
case DeclarationContext.ClassInstanceField:
|
||||
case DeclarationContext.ClassInstanceMethod:
|
||||
case DeclarationContext.ClassStaticField:
|
||||
case DeclarationContext.ClassStaticMethod:
|
||||
case DeclarationContext.Enum:
|
||||
case DeclarationContext.EnumBody:
|
||||
case DeclarationContext.EnumConstructor:
|
||||
case DeclarationContext.EnumFactory:
|
||||
case DeclarationContext.EnumInstanceField:
|
||||
case DeclarationContext.EnumInstanceMethod:
|
||||
case DeclarationContext.EnumStaticField:
|
||||
case DeclarationContext.EnumStaticMethod:
|
||||
case DeclarationContext.ExtensionConstructor:
|
||||
case DeclarationContext.ExtensionExternalInstanceField:
|
||||
case DeclarationContext.ExtensionFactory:
|
||||
case DeclarationContext.ExtensionInstanceField:
|
||||
case DeclarationContext.ExtensionInstanceMethod:
|
||||
case DeclarationContext.ExtensionStaticField:
|
||||
case DeclarationContext.ExtensionStaticMethod:
|
||||
case DeclarationContext.Library:
|
||||
case DeclarationContext.MixinBody:
|
||||
case DeclarationContext.MixinConstructor:
|
||||
case DeclarationContext.MixinFactory:
|
||||
case DeclarationContext.MixinInstanceField:
|
||||
case DeclarationContext.MixinInstanceMethod:
|
||||
case DeclarationContext.MixinStaticField:
|
||||
case DeclarationContext.MixinStaticMethod:
|
||||
case DeclarationContext.TopLevelField:
|
||||
case DeclarationContext.TopLevelMethod:
|
||||
case DeclarationContext.Typedef:
|
||||
return TypeVariableKind.function;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class OutlineBuilder extends StackListenerImpl {
|
||||
|
@ -1842,7 +1890,7 @@ class OutlineBuilder extends StackListenerImpl {
|
|||
// names are used to create the scope.
|
||||
List<TypeVariableBuilder> synthesizedTypeVariables = libraryBuilder
|
||||
.copyTypeVariables(extension.typeVariables!, declarationBuilder,
|
||||
isExtensionTypeParameter: true);
|
||||
kind: TypeVariableKind.extensionSynthesized);
|
||||
substitution = {};
|
||||
for (int i = 0; i < synthesizedTypeVariables.length; i++) {
|
||||
substitution[extension.typeVariables![i]] =
|
||||
|
@ -2904,7 +2952,8 @@ class OutlineBuilder extends StackListenerImpl {
|
|||
push(name);
|
||||
} else {
|
||||
push(libraryBuilder.addTypeVariable(
|
||||
metadata, name as String, null, charOffset, uri));
|
||||
metadata, name as String, null, charOffset, uri,
|
||||
kind: declarationContext.typeVariableKind));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2994,18 +3043,18 @@ class OutlineBuilder extends StackListenerImpl {
|
|||
builder.name, via.join("', '"));
|
||||
addProblem(message, builder.charOffset, builder.name.length);
|
||||
builder.bound = new NamedTypeBuilder(
|
||||
builder.name,
|
||||
const NullabilityBuilder.omitted(),
|
||||
null,
|
||||
uri,
|
||||
builder.charOffset,
|
||||
builder.name, const NullabilityBuilder.omitted(),
|
||||
fileUri: uri,
|
||||
charOffset: builder.charOffset,
|
||||
instanceTypeVariableAccess:
|
||||
//InstanceTypeVariableAccessState.Unexpected
|
||||
declarationContext.instanceTypeVariableAccessState)
|
||||
..bind(new InvalidTypeDeclarationBuilder(
|
||||
builder.name,
|
||||
message.withLocation(
|
||||
uri, builder.charOffset, builder.name.length)));
|
||||
..bind(
|
||||
libraryBuilder,
|
||||
new InvalidTypeDeclarationBuilder(
|
||||
builder.name,
|
||||
message.withLocation(
|
||||
uri, builder.charOffset, builder.name.length)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -213,8 +213,7 @@ class SourceClassBuilder extends ClassBuilderImpl
|
|||
if (supertypeBuilder != null) {
|
||||
supertypeBuilder = _checkSupertype(supertypeBuilder!);
|
||||
}
|
||||
Supertype? supertype =
|
||||
supertypeBuilder?.buildSupertype(libraryBuilder, charOffset, fileUri);
|
||||
Supertype? supertype = supertypeBuilder?.buildSupertype(libraryBuilder);
|
||||
if (supertype != null) {
|
||||
Class superclass = supertype.classNode;
|
||||
if (superclass.name == 'Function' &&
|
||||
|
@ -247,8 +246,8 @@ class SourceClassBuilder extends ClassBuilderImpl
|
|||
if (mixedInTypeBuilder != null) {
|
||||
mixedInTypeBuilder = _checkSupertype(mixedInTypeBuilder!);
|
||||
}
|
||||
Supertype? mixedInType = mixedInTypeBuilder?.buildMixedInType(
|
||||
libraryBuilder, charOffset, fileUri);
|
||||
Supertype? mixedInType =
|
||||
mixedInTypeBuilder?.buildMixedInType(libraryBuilder);
|
||||
if (_isFunction(mixedInType, coreLibrary)) {
|
||||
libraryBuilder.addProblem(
|
||||
messageMixinFunction, charOffset, noLength, fileUri);
|
||||
|
@ -270,8 +269,8 @@ class SourceClassBuilder extends ClassBuilderImpl
|
|||
if (interfaceBuilders != null) {
|
||||
for (int i = 0; i < interfaceBuilders!.length; ++i) {
|
||||
interfaceBuilders![i] = _checkSupertype(interfaceBuilders![i]);
|
||||
Supertype? supertype = interfaceBuilders![i]
|
||||
.buildSupertype(libraryBuilder, charOffset, fileUri);
|
||||
Supertype? supertype =
|
||||
interfaceBuilders![i].buildSupertype(libraryBuilder);
|
||||
if (supertype != null) {
|
||||
if (_isFunction(supertype, coreLibrary)) {
|
||||
libraryBuilder.addProblem(
|
||||
|
@ -823,11 +822,6 @@ class SourceClassBuilder extends ClassBuilderImpl
|
|||
TypeAliasBuilder? aliasBuilder) {
|
||||
int nameOffset = target.nameOffset;
|
||||
int nameLength = target.nameLength;
|
||||
// TODO(eernst): nameOffset not fully implemented; use backup.
|
||||
if (nameOffset == -1) {
|
||||
nameOffset = this.charOffset;
|
||||
nameLength = noLength;
|
||||
}
|
||||
if (aliasBuilder != null) {
|
||||
addProblem(message, nameOffset, nameLength, context: [
|
||||
messageTypedefCause.withLocation(
|
||||
|
@ -1216,15 +1210,15 @@ class SourceClassBuilder extends ClassBuilderImpl
|
|||
}
|
||||
if (message != null) {
|
||||
return new NamedTypeBuilder(
|
||||
supertype.name as String,
|
||||
const NullabilityBuilder.omitted(),
|
||||
/* arguments = */ null,
|
||||
fileUri,
|
||||
charOffset,
|
||||
supertype.name as String, const NullabilityBuilder.omitted(),
|
||||
fileUri: fileUri,
|
||||
charOffset: charOffset,
|
||||
instanceTypeVariableAccess:
|
||||
InstanceTypeVariableAccessState.Unexpected)
|
||||
..bind(new InvalidTypeDeclarationBuilder(supertype.name as String,
|
||||
message.withLocation(fileUri, charOffset, noLength)));
|
||||
..bind(
|
||||
libraryBuilder,
|
||||
new InvalidTypeDeclarationBuilder(supertype.name as String,
|
||||
message.withLocation(fileUri, charOffset, noLength)));
|
||||
}
|
||||
return supertype;
|
||||
}
|
||||
|
|
|
@ -130,7 +130,7 @@ class SourceEnumBuilder extends SourceClassBuilder {
|
|||
TypeBuilder? supertypeBuilder,
|
||||
List<TypeBuilder>? interfaceBuilders,
|
||||
List<EnumConstantInfo?>? enumConstantInfos,
|
||||
SourceLibraryBuilder parent,
|
||||
SourceLibraryBuilder libraryBuilder,
|
||||
List<ConstructorReferenceBuilder> constructorReferences,
|
||||
int startCharOffset,
|
||||
int charOffset,
|
||||
|
@ -140,16 +140,12 @@ class SourceEnumBuilder extends SourceClassBuilder {
|
|||
ConstructorScope constructorScope) {
|
||||
assert(enumConstantInfos == null || enumConstantInfos.isNotEmpty);
|
||||
|
||||
Uri fileUri = parent.fileUri;
|
||||
Uri fileUri = libraryBuilder.fileUri;
|
||||
|
||||
// TODO(ahe): These types shouldn't be looked up in scope, they come
|
||||
// directly from dart:core.
|
||||
NamedTypeBuilder intType = new NamedTypeBuilder(
|
||||
"int",
|
||||
const NullabilityBuilder.omitted(),
|
||||
/* arguments = */ null,
|
||||
/* fileUri = */ null,
|
||||
/* charOffset = */ null,
|
||||
"int", const NullabilityBuilder.omitted(),
|
||||
instanceTypeVariableAccess:
|
||||
// If "int" resolves to an instance type variable then that we would
|
||||
// allowed (the types that we are adding are in instance context
|
||||
|
@ -162,25 +158,13 @@ class SourceEnumBuilder extends SourceClassBuilder {
|
|||
// variables.
|
||||
InstanceTypeVariableAccessState.Unexpected);
|
||||
NamedTypeBuilder stringType = new NamedTypeBuilder(
|
||||
"String",
|
||||
const NullabilityBuilder.omitted(),
|
||||
/* arguments = */ null,
|
||||
/* fileUri = */ null,
|
||||
/* charOffset = */ null,
|
||||
"String", const NullabilityBuilder.omitted(),
|
||||
instanceTypeVariableAccess: InstanceTypeVariableAccessState.Unexpected);
|
||||
NamedTypeBuilder objectType = new NamedTypeBuilder(
|
||||
"Object",
|
||||
const NullabilityBuilder.omitted(),
|
||||
/* arguments = */ null,
|
||||
/* fileUri = */ null,
|
||||
/* charOffset = */ null,
|
||||
"Object", const NullabilityBuilder.omitted(),
|
||||
instanceTypeVariableAccess: InstanceTypeVariableAccessState.Unexpected);
|
||||
supertypeBuilder ??= new NamedTypeBuilder(
|
||||
"_Enum",
|
||||
const NullabilityBuilder.omitted(),
|
||||
/* arguments = */ null,
|
||||
/* fileUri = */ null,
|
||||
/* charOffset = */ null,
|
||||
"_Enum", const NullabilityBuilder.omitted(),
|
||||
instanceTypeVariableAccess: InstanceTypeVariableAccessState.Unexpected);
|
||||
Class cls = new Class(
|
||||
name: name,
|
||||
|
@ -193,18 +177,11 @@ class SourceEnumBuilder extends SourceClassBuilder {
|
|||
Map<String, MemberBuilder> constructors = <String, MemberBuilder>{};
|
||||
List<SourceFieldBuilder> elementBuilders = <SourceFieldBuilder>[];
|
||||
NamedTypeBuilder selfType = new NamedTypeBuilder(
|
||||
name,
|
||||
const NullabilityBuilder.omitted(),
|
||||
/* arguments = */ null,
|
||||
/* fileUri = */ null,
|
||||
/* charOffset = */ null,
|
||||
name, const NullabilityBuilder.omitted(),
|
||||
instanceTypeVariableAccess: InstanceTypeVariableAccessState.Unexpected);
|
||||
NamedTypeBuilder listType = new NamedTypeBuilder(
|
||||
"List",
|
||||
const NullabilityBuilder.omitted(),
|
||||
<TypeBuilder>[selfType],
|
||||
/* fileUri = */ null,
|
||||
/* charOffset = */ null,
|
||||
"List", const NullabilityBuilder.omitted(),
|
||||
arguments: <TypeBuilder>[selfType],
|
||||
instanceTypeVariableAccess: InstanceTypeVariableAccessState.Unexpected);
|
||||
|
||||
// metadata class E extends _Enum {
|
||||
|
@ -225,7 +202,7 @@ class SourceEnumBuilder extends SourceClassBuilder {
|
|||
extensionName: null,
|
||||
libraryReference: referencesFromIndexed != null
|
||||
? referencesFromIndexed.library.reference
|
||||
: parent.library.reference);
|
||||
: libraryBuilder.library.reference);
|
||||
|
||||
NameScheme procedureNameScheme = new NameScheme(
|
||||
isInstanceMember: true,
|
||||
|
@ -234,7 +211,7 @@ class SourceEnumBuilder extends SourceClassBuilder {
|
|||
extensionName: null,
|
||||
libraryReference: referencesFromIndexed != null
|
||||
? referencesFromIndexed.library.reference
|
||||
: parent.library.reference);
|
||||
: libraryBuilder.library.reference);
|
||||
|
||||
Reference? constructorReference;
|
||||
Reference? tearOffReference;
|
||||
|
@ -265,7 +242,7 @@ class SourceEnumBuilder extends SourceClassBuilder {
|
|||
while (customValuesDeclaration?.next != null) {
|
||||
customValuesDeclaration = customValuesDeclaration?.next;
|
||||
}
|
||||
parent.addProblem(
|
||||
libraryBuilder.addProblem(
|
||||
messageEnumContainsValuesDeclaration,
|
||||
customValuesDeclaration!.charOffset,
|
||||
customValuesDeclaration.fullNameForErrors.length,
|
||||
|
@ -285,7 +262,7 @@ class SourceEnumBuilder extends SourceClassBuilder {
|
|||
while (customIndexDeclaration?.next != null) {
|
||||
customIndexDeclaration = customIndexDeclaration?.next;
|
||||
}
|
||||
parent.addProblem(
|
||||
libraryBuilder.addProblem(
|
||||
templateEnumContainsRestrictedInstanceDeclaration
|
||||
.withArguments(restrictedInstanceMemberName),
|
||||
customIndexDeclaration!.charOffset,
|
||||
|
@ -300,7 +277,7 @@ class SourceEnumBuilder extends SourceClassBuilder {
|
|||
"values",
|
||||
constMask | staticMask | hasInitializerMask,
|
||||
/* isTopLevel = */ false,
|
||||
parent,
|
||||
libraryBuilder,
|
||||
charOffset,
|
||||
charOffset,
|
||||
staticFieldNameScheme,
|
||||
|
@ -333,11 +310,11 @@ class SourceEnumBuilder extends SourceClassBuilder {
|
|||
/* typeParameters = */ null,
|
||||
<FormalParameterBuilder>[
|
||||
new FormalParameterBuilder(
|
||||
null, 0, intType, "index", parent, charOffset),
|
||||
null, 0, intType, "index", libraryBuilder, charOffset),
|
||||
new FormalParameterBuilder(
|
||||
null, 0, stringType, "name", parent, charOffset)
|
||||
null, 0, stringType, "name", libraryBuilder, charOffset)
|
||||
],
|
||||
parent,
|
||||
libraryBuilder,
|
||||
charOffset,
|
||||
charOffset,
|
||||
charOffset,
|
||||
|
@ -355,11 +332,11 @@ class SourceEnumBuilder extends SourceClassBuilder {
|
|||
member.formals!.insert(
|
||||
0,
|
||||
new FormalParameterBuilder(
|
||||
null, 0, stringType, "name", parent, charOffset));
|
||||
null, 0, stringType, "name", libraryBuilder, charOffset));
|
||||
member.formals!.insert(
|
||||
0,
|
||||
new FormalParameterBuilder(
|
||||
null, 0, intType, "index", parent, charOffset));
|
||||
null, 0, intType, "index", libraryBuilder, charOffset));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -373,7 +350,7 @@ class SourceEnumBuilder extends SourceClassBuilder {
|
|||
/* typeVariables = */ null,
|
||||
/* formals = */ null,
|
||||
ProcedureKind.Method,
|
||||
parent,
|
||||
libraryBuilder,
|
||||
charOffset,
|
||||
charOffset,
|
||||
charOffset,
|
||||
|
@ -425,23 +402,27 @@ class SourceEnumBuilder extends SourceClassBuilder {
|
|||
templateDuplicatedDeclarationSyntheticCause
|
||||
.withArguments(name)
|
||||
.withLocation(
|
||||
parent.fileUri, charOffset, className.length)
|
||||
libraryBuilder.fileUri, charOffset, className.length)
|
||||
]
|
||||
: <LocatedMessage>[
|
||||
templateDuplicatedDeclarationCause
|
||||
.withArguments(name)
|
||||
.withLocation(parent.fileUri, existingOffset, name.length)
|
||||
.withLocation(
|
||||
libraryBuilder.fileUri, existingOffset, name.length)
|
||||
];
|
||||
parent.addProblem(templateDuplicatedDeclaration.withArguments(name),
|
||||
duplicateOffset, name.length, parent.fileUri,
|
||||
libraryBuilder.addProblem(
|
||||
templateDuplicatedDeclaration.withArguments(name),
|
||||
duplicateOffset,
|
||||
name.length,
|
||||
libraryBuilder.fileUri,
|
||||
context: context);
|
||||
enumConstantInfos[i] = null;
|
||||
} else if (name == className) {
|
||||
parent.addProblem(
|
||||
libraryBuilder.addProblem(
|
||||
templateEnumConstantSameNameAsEnclosing.withArguments(name),
|
||||
enumConstantInfo.charOffset,
|
||||
name.length,
|
||||
parent.fileUri);
|
||||
libraryBuilder.fileUri);
|
||||
}
|
||||
Reference? fieldReference;
|
||||
Reference? getterReference;
|
||||
|
@ -460,7 +441,7 @@ class SourceEnumBuilder extends SourceClassBuilder {
|
|||
name,
|
||||
constMask | staticMask | hasInitializerMask,
|
||||
/* isTopLevel = */ false,
|
||||
parent,
|
||||
libraryBuilder,
|
||||
enumConstantInfo.charOffset,
|
||||
enumConstantInfo.charOffset,
|
||||
staticFieldNameScheme,
|
||||
|
@ -469,7 +450,7 @@ class SourceEnumBuilder extends SourceClassBuilder {
|
|||
fieldSetterReference: setterReference);
|
||||
fieldBuilder.fieldType = new ImplicitFieldType(
|
||||
fieldBuilder, enumConstantInfo.argumentsBeginToken);
|
||||
parent.registerImplicitlyTypedField(fieldBuilder);
|
||||
libraryBuilder.registerImplicitlyTypedField(fieldBuilder);
|
||||
members[name] = fieldBuilder..next = existing;
|
||||
elementBuilders.add(fieldBuilder);
|
||||
}
|
||||
|
@ -496,7 +477,7 @@ class SourceEnumBuilder extends SourceClassBuilder {
|
|||
objectType,
|
||||
stringType,
|
||||
selfType,
|
||||
parent,
|
||||
libraryBuilder,
|
||||
constructorReferences,
|
||||
startCharOffsetComputed,
|
||||
charOffset,
|
||||
|
@ -514,12 +495,12 @@ class SourceEnumBuilder extends SourceClassBuilder {
|
|||
|
||||
members.forEach(setParent);
|
||||
constructorScope.local.forEach(setParent);
|
||||
selfType.bind(enumBuilder);
|
||||
selfType.bind(libraryBuilder, enumBuilder);
|
||||
|
||||
if (constructorScope.local.isNotEmpty) {
|
||||
for (MemberBuilder constructorBuilder in constructorScope.local.values) {
|
||||
if (!constructorBuilder.isFactory && !constructorBuilder.isConst) {
|
||||
parent.addProblem(messageEnumNonConstConstructor,
|
||||
libraryBuilder.addProblem(messageEnumNonConstConstructor,
|
||||
constructorBuilder.charOffset, noLength, fileUri);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -321,14 +321,10 @@ class ExtensionTypeShowHideClauseBuilder {
|
|||
required this.hiddenOperators});
|
||||
|
||||
void buildAndStoreTypes(Extension extension, LibraryBuilder libraryBuilder) {
|
||||
List<Supertype> builtShownSupertypes = shownSupertypes
|
||||
.map(
|
||||
(t) => t.buildSupertype(libraryBuilder, t.charOffset!, t.fileUri!)!)
|
||||
.toList();
|
||||
List<Supertype> builtHiddenSupertypes = hiddenSupertypes
|
||||
.map(
|
||||
(t) => t.buildSupertype(libraryBuilder, t.charOffset!, t.fileUri!)!)
|
||||
.toList();
|
||||
List<Supertype> builtShownSupertypes =
|
||||
shownSupertypes.map((t) => t.buildSupertype(libraryBuilder)!).toList();
|
||||
List<Supertype> builtHiddenSupertypes =
|
||||
hiddenSupertypes.map((t) => t.buildSupertype(libraryBuilder)!).toList();
|
||||
ExtensionTypeShowHideClause showHideClause =
|
||||
extension.showHideClause ?? new ExtensionTypeShowHideClause();
|
||||
showHideClause.shownSupertypes.addAll(builtShownSupertypes);
|
||||
|
|
|
@ -1517,7 +1517,6 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
|
|||
for (NamedTypeBuilder namedType in unresolvedNamedTypes) {
|
||||
namedType.resolveIn(
|
||||
scope, namedType.charOffset!, namedType.fileUri!, this);
|
||||
namedType.check(this, namedType.charOffset!, namedType.fileUri!);
|
||||
}
|
||||
unresolvedNamedTypes.clear();
|
||||
return typeCount;
|
||||
|
@ -1539,19 +1538,15 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
|
|||
Class cls = declaration.cls;
|
||||
if (cls != objectClass) {
|
||||
cls.supertype ??= objectClass.asRawSupertype;
|
||||
declaration.supertypeBuilder ??= new NamedTypeBuilder(
|
||||
"Object",
|
||||
const NullabilityBuilder.omitted(),
|
||||
/* arguments = */ null,
|
||||
/* fileUri = */ null,
|
||||
/* charOffset = */ null,
|
||||
instanceTypeVariableAccess:
|
||||
InstanceTypeVariableAccessState.Unexpected)
|
||||
..bind(objectClassBuilder);
|
||||
declaration.supertypeBuilder ??=
|
||||
new NamedTypeBuilder.fromTypeDeclarationBuilder(
|
||||
objectClassBuilder, const NullabilityBuilder.omitted(),
|
||||
instanceTypeVariableAccess:
|
||||
InstanceTypeVariableAccessState.Unexpected);
|
||||
}
|
||||
if (declaration.isMixinApplication) {
|
||||
cls.mixedInType = declaration.mixedInTypeBuilder!.buildMixedInType(
|
||||
this, declaration.charOffset, declaration.fileUri);
|
||||
cls.mixedInType =
|
||||
declaration.mixedInTypeBuilder!.buildMixedInType(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1661,11 +1656,17 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
|
|||
//addBuilder("Null", new NullTypeBuilder(const NullType(), this, -1), -1);
|
||||
}
|
||||
|
||||
TypeBuilder addNamedType(Object name, NullabilityBuilder nullabilityBuilder,
|
||||
List<TypeBuilder>? arguments, int charOffset,
|
||||
NamedTypeBuilder addNamedType(
|
||||
Object name,
|
||||
NullabilityBuilder nullabilityBuilder,
|
||||
List<TypeBuilder>? arguments,
|
||||
int charOffset,
|
||||
{required InstanceTypeVariableAccessState instanceTypeVariableAccess}) {
|
||||
return registerUnresolvedNamedType(new NamedTypeBuilder(
|
||||
name, nullabilityBuilder, arguments, fileUri, charOffset,
|
||||
name, nullabilityBuilder,
|
||||
arguments: arguments,
|
||||
fileUri: fileUri,
|
||||
charOffset: charOffset,
|
||||
instanceTypeVariableAccess: instanceTypeVariableAccess));
|
||||
}
|
||||
|
||||
|
@ -1679,7 +1680,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
|
|||
return addNamedType(
|
||||
"void", const NullabilityBuilder.inherent(), null, charOffset,
|
||||
instanceTypeVariableAccess: InstanceTypeVariableAccessState.Unexpected)
|
||||
..bind(
|
||||
..bind(this,
|
||||
new VoidTypeDeclarationBuilder(const VoidType(), this, charOffset));
|
||||
}
|
||||
|
||||
|
@ -1957,7 +1958,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
|
|||
for (TypeVariableBuilder tv in typeVariables) {
|
||||
TypeVariableBuilder? existing = typeVariablesByName[tv.name];
|
||||
if (existing != null) {
|
||||
if (existing.isExtensionTypeParameter) {
|
||||
if (existing.kind == TypeVariableKind.extensionSynthesized) {
|
||||
// The type parameter from the extension is shadowed by the type
|
||||
// parameter from the member. Rename the shadowed type parameter.
|
||||
existing.parameter.name = '#${existing.name}';
|
||||
|
@ -2316,7 +2317,8 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
|
|||
"mixin application");
|
||||
|
||||
applicationTypeVariables = copyTypeVariables(
|
||||
typeVariables!, currentTypeParameterScopeBuilder);
|
||||
typeVariables!, currentTypeParameterScopeBuilder,
|
||||
kind: TypeVariableKind.extensionSynthesized);
|
||||
|
||||
List<NamedTypeBuilder> newTypes = <NamedTypeBuilder>[];
|
||||
if (supertype is NamedTypeBuilder && supertype.arguments != null) {
|
||||
|
@ -2344,16 +2346,18 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
|
|||
|
||||
applicationTypeArguments = <TypeBuilder>[];
|
||||
for (TypeVariableBuilder typeVariable in typeVariables) {
|
||||
applicationTypeArguments.add(addNamedType(typeVariable.name,
|
||||
const NullabilityBuilder.omitted(), null, charOffset,
|
||||
instanceTypeVariableAccess:
|
||||
InstanceTypeVariableAccessState.Allowed)
|
||||
..bind(
|
||||
// The type variable types passed as arguments to the
|
||||
// generic class representing the anonymous mixin
|
||||
// application should refer back to the type variables of
|
||||
// the class that extend the anonymous mixin application.
|
||||
typeVariable));
|
||||
applicationTypeArguments.add(
|
||||
new NamedTypeBuilder.fromTypeDeclarationBuilder(
|
||||
// The type variable types passed as arguments to the
|
||||
// generic class representing the anonymous mixin
|
||||
// application should refer back to the type variables of
|
||||
// the class that extend the anonymous mixin application.
|
||||
typeVariable,
|
||||
const NullabilityBuilder.omitted(),
|
||||
fileUri: fileUri,
|
||||
charOffset: charOffset,
|
||||
instanceTypeVariableAccess:
|
||||
InstanceTypeVariableAccessState.Allowed));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2750,7 +2754,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
|
|||
int charEndOffset,
|
||||
String? nativeMethodName,
|
||||
AsyncMarker asyncModifier) {
|
||||
TypeBuilder returnType = addNamedType(
|
||||
NamedTypeBuilder returnType = addNamedType(
|
||||
currentTypeParameterScopeBuilder.parent!.name,
|
||||
const NullabilityBuilder.omitted(),
|
||||
<TypeBuilder>[],
|
||||
|
@ -2760,10 +2764,12 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
|
|||
TypeParameterScopeKind.extensionDeclaration) {
|
||||
// Make the synthesized return type invalid for extensions.
|
||||
String name = currentTypeParameterScopeBuilder.parent!.name;
|
||||
returnType.bind(new InvalidTypeDeclarationBuilder(
|
||||
name,
|
||||
messageExtensionDeclaresConstructor.withLocation(
|
||||
fileUri, charOffset, name.length)));
|
||||
returnType.bind(
|
||||
this,
|
||||
new InvalidTypeDeclarationBuilder(
|
||||
name,
|
||||
messageExtensionDeclaresConstructor.withLocation(
|
||||
fileUri, charOffset, name.length)));
|
||||
}
|
||||
// Nested declaration began in `OutlineBuilder.beginFactoryMethod`.
|
||||
TypeParameterScopeBuilder factoryDeclaration = endNestedDeclaration(
|
||||
|
@ -2811,7 +2817,8 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
|
|||
copyTypeVariables(
|
||||
currentTypeParameterScopeBuilder.typeVariables ??
|
||||
const <TypeVariableBuilder>[],
|
||||
factoryDeclaration),
|
||||
factoryDeclaration,
|
||||
kind: TypeVariableKind.function),
|
||||
formals,
|
||||
this,
|
||||
startCharOffset,
|
||||
|
@ -2832,7 +2839,8 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
|
|||
copyTypeVariables(
|
||||
currentTypeParameterScopeBuilder.typeVariables ??
|
||||
const <TypeVariableBuilder>[],
|
||||
factoryDeclaration),
|
||||
factoryDeclaration,
|
||||
kind: TypeVariableKind.function),
|
||||
formals,
|
||||
this,
|
||||
startCharOffset,
|
||||
|
@ -3030,10 +3038,11 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
|
|||
}
|
||||
|
||||
TypeVariableBuilder addTypeVariable(List<MetadataBuilder>? metadata,
|
||||
String name, TypeBuilder? bound, int charOffset, Uri fileUri) {
|
||||
String name, TypeBuilder? bound, int charOffset, Uri fileUri,
|
||||
{required TypeVariableKind kind}) {
|
||||
TypeVariableBuilder builder = new TypeVariableBuilder(
|
||||
name, this, charOffset, fileUri,
|
||||
bound: bound, metadata: metadata);
|
||||
bound: bound, metadata: metadata, kind: kind);
|
||||
|
||||
unboundTypeVariables.add(builder);
|
||||
return builder;
|
||||
|
@ -3402,14 +3411,14 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
|
|||
/// [TypeParameter] are prefix with '#' to indicate that their synthesized.
|
||||
List<TypeVariableBuilder> copyTypeVariables(
|
||||
List<TypeVariableBuilder> original, TypeParameterScopeBuilder declaration,
|
||||
{bool isExtensionTypeParameter: false}) {
|
||||
{required TypeVariableKind kind}) {
|
||||
List<NamedTypeBuilder> newTypes = <NamedTypeBuilder>[];
|
||||
List<TypeVariableBuilder> copy = <TypeVariableBuilder>[];
|
||||
for (TypeVariableBuilder variable in original) {
|
||||
TypeVariableBuilder newVariable = new TypeVariableBuilder(
|
||||
variable.name, this, variable.charOffset, variable.fileUri,
|
||||
bound: variable.bound?.clone(newTypes, this, declaration),
|
||||
isExtensionTypeParameter: isExtensionTypeParameter,
|
||||
kind: kind,
|
||||
variableVariance:
|
||||
variable.parameter.isLegacyCovariant ? null : variable.variance);
|
||||
copy.add(newVariable);
|
||||
|
@ -5234,11 +5243,14 @@ class TypeParameterScopeBuilder {
|
|||
namedTypeBuilder.charOffset!,
|
||||
nameOrQualified.endCharOffset - namedTypeBuilder.charOffset!,
|
||||
namedTypeBuilder.fileUri!);
|
||||
namedTypeBuilder.bind(namedTypeBuilder
|
||||
.buildInvalidTypeDeclarationBuilder(message.withLocation(
|
||||
namedTypeBuilder.fileUri!,
|
||||
namedTypeBuilder.charOffset!,
|
||||
nameOrQualified.endCharOffset - namedTypeBuilder.charOffset!)));
|
||||
namedTypeBuilder.bind(
|
||||
library,
|
||||
namedTypeBuilder.buildInvalidTypeDeclarationBuilder(
|
||||
message.withLocation(
|
||||
namedTypeBuilder.fileUri!,
|
||||
namedTypeBuilder.charOffset!,
|
||||
nameOrQualified.endCharOffset -
|
||||
namedTypeBuilder.charOffset!)));
|
||||
} else {
|
||||
scope ??= toScope(null).withTypeVariables(typeVariables);
|
||||
namedTypeBuilder.resolveIn(scope, namedTypeBuilder.charOffset!,
|
||||
|
|
|
@ -2521,9 +2521,11 @@ severity: $severity
|
|||
return library.lookupLocalMember(cls.name, required: true) as ClassBuilder;
|
||||
}
|
||||
|
||||
late TypeBuilderComputer _typeBuilderComputer = new TypeBuilderComputer(this);
|
||||
|
||||
@override
|
||||
TypeBuilder computeTypeBuilder(DartType type) {
|
||||
return type.accept(new TypeBuilderComputer(this));
|
||||
return type.accept(_typeBuilderComputer);
|
||||
}
|
||||
|
||||
BodyBuilder createBodyBuilderForField(
|
||||
|
|
|
@ -157,8 +157,17 @@ class SourceTypeAliasBuilder extends TypeAliasBuilderImpl {
|
|||
TypeBuilder? type = this.type;
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (type != null) {
|
||||
DartType builtType = type.build(libraryBuilder,
|
||||
origin: thisTypedefType(typedef, libraryBuilder));
|
||||
DartType builtType = type.build(libraryBuilder);
|
||||
if (builtType is FunctionType) {
|
||||
// Set the `typedefType` if it hasn't already been set. It can already
|
||||
// be set if this type alias is an alias of another typedef, in which
|
||||
// we use the existing value. For instance
|
||||
//
|
||||
// typedef void F(); // typedefType will be set to `F`.
|
||||
// typedef G = F; // The typedefType has already been set to `F`.
|
||||
//
|
||||
builtType.typedefType ??= thisTypedefType(typedef, libraryBuilder);
|
||||
}
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (builtType != null) {
|
||||
if (typeVariables != null) {
|
||||
|
|
|
@ -34,11 +34,11 @@ class B1<T> {}
|
|||
extension B2<T> on B1<T> {}
|
||||
|
||||
main() {
|
||||
/*error: errors=['A2' isn't a type.]*/
|
||||
/*error: errors=[This requires the 'extension-types' language feature to be enabled.]*/
|
||||
A2 var1;
|
||||
/*error: errors=['B2' isn't a type.]*/
|
||||
/*error: errors=[This requires the 'extension-types' language feature to be enabled.]*/
|
||||
B2<A1> var2;
|
||||
B1</*error: errors=['A2' isn't a type.]*/A2> var3;
|
||||
B1</*error: errors=[This requires the 'extension-types' language feature to be enabled.]*/A2> var3;
|
||||
}
|
||||
|
||||
/*error: errors=[This requires the 'extension-types' language feature to be enabled.]*/
|
||||
|
@ -46,7 +46,7 @@ A2 method1() => null;
|
|||
|
||||
// TODO(johnniwinther): We should report an error on the number of type
|
||||
// arguments here.
|
||||
/*error: errors=[Expected 0 type arguments.,This requires the 'extension-types' language feature to be enabled.]*/
|
||||
/*error: errors=[This requires the 'extension-types' language feature to be enabled.]*/
|
||||
B2<A1> method2() => null;
|
||||
|
||||
B1</*error: errors=[This requires the 'extension-types' language feature to be enabled.]*/A2> method3() => null;
|
||||
|
|
|
@ -2,22 +2,22 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:8:26: Error: Type variables can't be used in static members.
|
||||
// static A<T>? method1(A<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:8:12: Error: Type variables can't be used in static members.
|
||||
// static A<T>? method1(A<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:11:31: Error: Type variables can't be used in static members.
|
||||
// static A<A<T>>? method2(A<A<T>> arg) {
|
||||
// ^
|
||||
// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:8:26: Error: Type variables can't be used in static members.
|
||||
// static A<T>? method1(A<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:11:14: Error: Type variables can't be used in static members.
|
||||
// static A<A<T>>? method2(A<A<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:11:31: Error: Type variables can't be used in static members.
|
||||
// static A<A<T>>? method2(A<A<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:9:7: Error: Type variables can't be used in static members.
|
||||
// A<T>? local;
|
||||
// ^
|
||||
|
|
|
@ -2,22 +2,22 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:8:26: Error: Type variables can't be used in static members.
|
||||
// static A<T>? method1(A<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:8:12: Error: Type variables can't be used in static members.
|
||||
// static A<T>? method1(A<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:11:31: Error: Type variables can't be used in static members.
|
||||
// static A<A<T>>? method2(A<A<T>> arg) {
|
||||
// ^
|
||||
// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:8:26: Error: Type variables can't be used in static members.
|
||||
// static A<T>? method1(A<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:11:14: Error: Type variables can't be used in static members.
|
||||
// static A<A<T>>? method2(A<A<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:11:31: Error: Type variables can't be used in static members.
|
||||
// static A<A<T>>? method2(A<A<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:9:7: Error: Type variables can't be used in static members.
|
||||
// A<T>? local;
|
||||
// ^
|
||||
|
|
|
@ -2,22 +2,22 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:8:26: Error: Type variables can't be used in static members.
|
||||
// static A<T>? method1(A<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:8:12: Error: Type variables can't be used in static members.
|
||||
// static A<T>? method1(A<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:11:31: Error: Type variables can't be used in static members.
|
||||
// static A<A<T>>? method2(A<A<T>> arg) {
|
||||
// ^
|
||||
// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:8:26: Error: Type variables can't be used in static members.
|
||||
// static A<T>? method1(A<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:11:14: Error: Type variables can't be used in static members.
|
||||
// static A<A<T>>? method2(A<A<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:11:31: Error: Type variables can't be used in static members.
|
||||
// static A<A<T>>? method2(A<A<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:9:7: Error: Type variables can't be used in static members.
|
||||
// A<T>? local;
|
||||
// ^
|
||||
|
|
|
@ -2,22 +2,22 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:8:26: Error: Type variables can't be used in static members.
|
||||
// static A<T>? method1(A<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:8:12: Error: Type variables can't be used in static members.
|
||||
// static A<T>? method1(A<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:11:31: Error: Type variables can't be used in static members.
|
||||
// static A<A<T>>? method2(A<A<T>> arg) {
|
||||
// ^
|
||||
// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:8:26: Error: Type variables can't be used in static members.
|
||||
// static A<T>? method1(A<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:11:14: Error: Type variables can't be used in static members.
|
||||
// static A<A<T>>? method2(A<A<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/extension_types/type_variable_in_static_context.dart:11:31: Error: Type variables can't be used in static members.
|
||||
// static A<A<T>>? method2(A<A<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
// Copyright (c) 2019, 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 E1<T, T> on int {}
|
||||
|
||||
main() {}
|
|
@ -0,0 +1,3 @@
|
|||
extension E1<T, T> on int {}
|
||||
|
||||
main() {}
|
|
@ -0,0 +1,3 @@
|
|||
extension E1<T, T> on int {}
|
||||
|
||||
main() {}
|
|
@ -0,0 +1,17 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/extensions/duplicate_type_variables.dart:5:17: Error: A type variable can't have the same name as another.
|
||||
// extension E1<T, T> on int {}
|
||||
// ^
|
||||
// pkg/front_end/testcases/extensions/duplicate_type_variables.dart:5:14: Context: The other type variable named 'T'.
|
||||
// extension E1<T, T> on int {}
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
extension E1<T extends core::Object? = dynamic, T extends core::Object? = dynamic> on core::int {
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,17 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/extensions/duplicate_type_variables.dart:5:17: Error: A type variable can't have the same name as another.
|
||||
// extension E1<T, T> on int {}
|
||||
// ^
|
||||
// pkg/front_end/testcases/extensions/duplicate_type_variables.dart:5:14: Context: The other type variable named 'T'.
|
||||
// extension E1<T, T> on int {}
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
extension E1<T extends core::Object? = dynamic, T extends core::Object? = dynamic> on core::int {
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,18 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/extensions/duplicate_type_variables.dart:5:17: Error: A type variable can't have the same name as another.
|
||||
// extension E1<T, T> on int {}
|
||||
// ^
|
||||
// pkg/front_end/testcases/extensions/duplicate_type_variables.dart:5:14: Context: The other type variable named 'T'.
|
||||
// extension E1<T, T> on int {}
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
extension E1<T extends core::Object? = dynamic, T extends core::Object? = dynamic> on core::int {
|
||||
}
|
||||
static method main() → dynamic
|
||||
;
|
|
@ -0,0 +1,17 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/extensions/duplicate_type_variables.dart:5:17: Error: A type variable can't have the same name as another.
|
||||
// extension E1<T, T> on int {}
|
||||
// ^
|
||||
// pkg/front_end/testcases/extensions/duplicate_type_variables.dart:5:14: Context: The other type variable named 'T'.
|
||||
// extension E1<T, T> on int {}
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
extension E1<T extends core::Object? = dynamic, T extends core::Object? = dynamic> on core::int {
|
||||
}
|
||||
static method main() → dynamic {}
|
|
@ -53,15 +53,15 @@ library;
|
|||
// field11 = o as Class<T>,
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:34:26: Error: Type variables can't be used as constants.
|
||||
// field15 = <Class<T>>[];
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:34:29: Error: Constant expression expected.
|
||||
// Try inserting 'const'.
|
||||
// field15 = <Class<T>>[];
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:34:26: Error: Type variables can't be used as constants.
|
||||
// field15 = <Class<T>>[];
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:40:20: Error: Type variables can't be used as constants.
|
||||
// const local1 = T;
|
||||
// ^
|
||||
|
@ -236,15 +236,15 @@ library /*isNonNullableByDefault*/;
|
|||
// field7 = <T, T>{},
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:31:26: Error: Type variables can't be used as constants.
|
||||
// field15 = <Class<T>>[];
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:31:29: Error: Constant expression expected.
|
||||
// Try inserting 'const'.
|
||||
// field15 = <Class<T>>[];
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:31:26: Error: Type variables can't be used as constants.
|
||||
// field15 = <Class<T>>[];
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:37:20: Error: Type variables can't be used as constants.
|
||||
// const local1 = T;
|
||||
// ^
|
||||
|
|
|
@ -53,15 +53,15 @@ library;
|
|||
// field11 = o as Class<T>,
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:34:26: Error: Type variables can't be used as constants.
|
||||
// field15 = <Class<T>>[];
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:34:29: Error: Constant expression expected.
|
||||
// Try inserting 'const'.
|
||||
// field15 = <Class<T>>[];
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:34:26: Error: Type variables can't be used as constants.
|
||||
// field15 = <Class<T>>[];
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:40:20: Error: Type variables can't be used as constants.
|
||||
// const local1 = T;
|
||||
// ^
|
||||
|
@ -236,15 +236,15 @@ library /*isNonNullableByDefault*/;
|
|||
// field7 = <T, T>{},
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:31:26: Error: Type variables can't be used as constants.
|
||||
// field15 = <Class<T>>[];
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:31:29: Error: Constant expression expected.
|
||||
// Try inserting 'const'.
|
||||
// field15 = <Class<T>>[];
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:31:26: Error: Type variables can't be used as constants.
|
||||
// field15 = <Class<T>>[];
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:37:20: Error: Type variables can't be used as constants.
|
||||
// const local1 = T;
|
||||
// ^
|
||||
|
|
|
@ -53,15 +53,15 @@ library;
|
|||
// field11 = o as Class<T>,
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:34:26: Error: Type variables can't be used as constants.
|
||||
// field15 = <Class<T>>[];
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:34:29: Error: Constant expression expected.
|
||||
// Try inserting 'const'.
|
||||
// field15 = <Class<T>>[];
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:34:26: Error: Type variables can't be used as constants.
|
||||
// field15 = <Class<T>>[];
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
import "dart:collection" as col;
|
||||
|
@ -141,15 +141,15 @@ library /*isNonNullableByDefault*/;
|
|||
// field7 = <T, T>{},
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:31:26: Error: Type variables can't be used as constants.
|
||||
// field15 = <Class<T>>[];
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:31:29: Error: Constant expression expected.
|
||||
// Try inserting 'const'.
|
||||
// field15 = <Class<T>>[];
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:31:26: Error: Type variables can't be used as constants.
|
||||
// field15 = <Class<T>>[];
|
||||
// ^
|
||||
//
|
||||
import self as self2;
|
||||
import "dart:core" as core;
|
||||
import "dart:collection" as col;
|
||||
|
|
|
@ -53,15 +53,15 @@ library;
|
|||
// field11 = o as Class<T>,
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:34:26: Error: Type variables can't be used as constants.
|
||||
// field15 = <Class<T>>[];
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:34:29: Error: Constant expression expected.
|
||||
// Try inserting 'const'.
|
||||
// field15 = <Class<T>>[];
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:34:26: Error: Type variables can't be used as constants.
|
||||
// field15 = <Class<T>>[];
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:40:20: Error: Type variables can't be used as constants.
|
||||
// const local1 = T;
|
||||
// ^
|
||||
|
@ -236,15 +236,15 @@ library /*isNonNullableByDefault*/;
|
|||
// field7 = <T, T>{},
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:31:26: Error: Type variables can't be used as constants.
|
||||
// field15 = <Class<T>>[];
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:31:29: Error: Constant expression expected.
|
||||
// Try inserting 'const'.
|
||||
// field15 = <Class<T>>[];
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:31:26: Error: Type variables can't be used as constants.
|
||||
// field15 = <Class<T>>[];
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:37:20: Error: Type variables can't be used as constants.
|
||||
// const local1 = T;
|
||||
// ^
|
||||
|
|
|
@ -4,7 +4,7 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart:27:7: Error: Expected 2 type arguments.
|
||||
// const Map<bool> MapWithUnevaluated = {
|
||||
// ^
|
||||
// ^^^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
|
|
@ -4,7 +4,7 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart:27:7: Error: Expected 2 type arguments.
|
||||
// const Map<bool> MapWithUnevaluated = {
|
||||
// ^
|
||||
// ^^^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
|
|
@ -4,7 +4,7 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart:27:7: Error: Expected 2 type arguments.
|
||||
// const Map<bool> MapWithUnevaluated = {
|
||||
// ^
|
||||
// ^^^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
|
|
@ -4,7 +4,7 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart:27:7: Error: Expected 2 type arguments.
|
||||
// const Map<bool> MapWithUnevaluated = {
|
||||
// ^
|
||||
// ^^^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
|
|
@ -36,8 +36,4 @@ library /*isNonNullableByDefault*/;
|
|||
// n<S e(
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/error_recovery/issue_39024.crash_dart:1:1: Error: Expected 0 type arguments.
|
||||
// n<S e(
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
|
|
|
@ -36,8 +36,4 @@ library /*isNonNullableByDefault*/;
|
|||
// n<S e(
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/error_recovery/issue_39024.crash_dart:1:1: Error: Expected 0 type arguments.
|
||||
// n<S e(
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
|
|
|
@ -36,8 +36,4 @@ library /*isNonNullableByDefault*/;
|
|||
// n<S e(
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/error_recovery/issue_39024.crash_dart:1:1: Error: Expected 0 type arguments.
|
||||
// n<S e(
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
|
|
|
@ -36,8 +36,4 @@ library /*isNonNullableByDefault*/;
|
|||
// n<S e(
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/error_recovery/issue_39024.crash_dart:1:1: Error: Expected 0 type arguments.
|
||||
// n<S e(
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
|
|
|
@ -36,10 +36,6 @@ library /*isNonNullableByDefault*/;
|
|||
// () async => a b < c $? >
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/error_recovery/issue_39202.crash_dart:1:15: Error: Expected 0 type arguments.
|
||||
// () async => a b < c $? >
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/error_recovery/issue_39202.crash_dart:1:13: Error: Expected ';' after this.
|
||||
// () async => a b < c $? >
|
||||
// ^
|
||||
|
|
|
@ -36,10 +36,6 @@ library /*isNonNullableByDefault*/;
|
|||
// () async => a b < c $? >
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/error_recovery/issue_39202.crash_dart:1:15: Error: Expected 0 type arguments.
|
||||
// () async => a b < c $? >
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/error_recovery/issue_39202.crash_dart:1:13: Error: Expected ';' after this.
|
||||
// () async => a b < c $? >
|
||||
// ^
|
||||
|
|
|
@ -36,10 +36,6 @@ library /*isNonNullableByDefault*/;
|
|||
// () async => a b < c $? >
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/error_recovery/issue_39202.crash_dart:1:15: Error: Expected 0 type arguments.
|
||||
// () async => a b < c $? >
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
|
||||
static method async() → dynamic
|
||||
|
|
|
@ -36,10 +36,6 @@ library /*isNonNullableByDefault*/;
|
|||
// () async => a b < c $? >
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/error_recovery/issue_39202.crash_dart:1:15: Error: Expected 0 type arguments.
|
||||
// () async => a b < c $? >
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/error_recovery/issue_39202.crash_dart:1:13: Error: Expected ';' after this.
|
||||
// () async => a b < c $? >
|
||||
// ^
|
||||
|
|
|
@ -4,7 +4,7 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// pkg/front_end/testcases/general/error_recovery/issue_39958_02.dart:1:1: Error: Expected 0 type arguments.
|
||||
// dynamic<int> f() {}
|
||||
// ^
|
||||
// ^^^^^^^
|
||||
//
|
||||
import self as self;
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// pkg/front_end/testcases/general/error_recovery/issue_39958_02.dart:1:1: Error: Expected 0 type arguments.
|
||||
// dynamic<int> f() {}
|
||||
// ^
|
||||
// ^^^^^^^
|
||||
//
|
||||
import self as self;
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// pkg/front_end/testcases/general/error_recovery/issue_39958_02.dart:1:1: Error: Expected 0 type arguments.
|
||||
// dynamic<int> f() {}
|
||||
// ^
|
||||
// ^^^^^^^
|
||||
//
|
||||
import self as self;
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// pkg/front_end/testcases/general/error_recovery/issue_39958_02.dart:1:1: Error: Expected 0 type arguments.
|
||||
// dynamic<int> f() {}
|
||||
// ^
|
||||
// ^^^^^^^
|
||||
//
|
||||
import self as self;
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// pkg/front_end/testcases/general/error_recovery/issue_39958_03.dart:1:1: Error: Expected 0 type arguments.
|
||||
// int<int> f() {}
|
||||
// ^
|
||||
// ^^^
|
||||
//
|
||||
import self as self;
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// pkg/front_end/testcases/general/error_recovery/issue_39958_03.dart:1:1: Error: Expected 0 type arguments.
|
||||
// int<int> f() {}
|
||||
// ^
|
||||
// ^^^
|
||||
//
|
||||
import self as self;
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// pkg/front_end/testcases/general/error_recovery/issue_39958_03.dart:1:1: Error: Expected 0 type arguments.
|
||||
// int<int> f() {}
|
||||
// ^
|
||||
// ^^^
|
||||
//
|
||||
import self as self;
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// pkg/front_end/testcases/general/error_recovery/issue_39958_03.dart:1:1: Error: Expected 0 type arguments.
|
||||
// int<int> f() {}
|
||||
// ^
|
||||
// ^^^
|
||||
//
|
||||
import self as self;
|
||||
|
||||
|
|
|
@ -6,10 +6,6 @@ library /*isNonNullableByDefault*/;
|
|||
// Foo<int> f() {}
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/general/error_recovery/issue_39958_04.dart:1:1: Error: Expected 0 type arguments.
|
||||
// Foo<int> f() {}
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
|
||||
static method f() → invalid-type {}
|
||||
|
|
|
@ -6,10 +6,6 @@ library /*isNonNullableByDefault*/;
|
|||
// Foo<int> f() {}
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/general/error_recovery/issue_39958_04.dart:1:1: Error: Expected 0 type arguments.
|
||||
// Foo<int> f() {}
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
|
||||
static method f() → invalid-type {}
|
||||
|
|
|
@ -6,10 +6,6 @@ library /*isNonNullableByDefault*/;
|
|||
// Foo<int> f() {}
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/general/error_recovery/issue_39958_04.dart:1:1: Error: Expected 0 type arguments.
|
||||
// Foo<int> f() {}
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
|
||||
static method f() → invalid-type
|
||||
|
|
|
@ -6,10 +6,6 @@ library /*isNonNullableByDefault*/;
|
|||
// Foo<int> f() {}
|
||||
// ^^^
|
||||
//
|
||||
// pkg/front_end/testcases/general/error_recovery/issue_39958_04.dart:1:1: Error: Expected 0 type arguments.
|
||||
// Foo<int> f() {}
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
|
||||
static method f() → invalid-type {}
|
||||
|
|
|
@ -6,13 +6,13 @@ library /*isNonNullableByDefault*/;
|
|||
// class Class2<T, M extends Mixin<T>> extends SuperClass with M {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/extend_with_type_variable.dart:11:7: Error: The type variable 'S' can't be used as supertype.
|
||||
// pkg/front_end/testcases/general/extend_with_type_variable.dart:11:47: Error: The type variable 'S' can't be used as supertype.
|
||||
// class Class1<T, S extends SuperClass> extends S with Mixin<T> {}
|
||||
// ^
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/extend_with_type_variable.dart:13:7: Error: The type variable 'M' can't be used as supertype.
|
||||
// pkg/front_end/testcases/general/extend_with_type_variable.dart:13:61: Error: The type variable 'M' can't be used as supertype.
|
||||
// class Class2<T, M extends Mixin<T>> extends SuperClass with M {}
|
||||
// ^
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
|
|
@ -6,13 +6,13 @@ library /*isNonNullableByDefault*/;
|
|||
// class Class2<T, M extends Mixin<T>> extends SuperClass with M {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/extend_with_type_variable.dart:11:7: Error: The type variable 'S' can't be used as supertype.
|
||||
// pkg/front_end/testcases/general/extend_with_type_variable.dart:11:47: Error: The type variable 'S' can't be used as supertype.
|
||||
// class Class1<T, S extends SuperClass> extends S with Mixin<T> {}
|
||||
// ^
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/extend_with_type_variable.dart:13:7: Error: The type variable 'M' can't be used as supertype.
|
||||
// pkg/front_end/testcases/general/extend_with_type_variable.dart:13:61: Error: The type variable 'M' can't be used as supertype.
|
||||
// class Class2<T, M extends Mixin<T>> extends SuperClass with M {}
|
||||
// ^
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
|
|
@ -6,13 +6,13 @@ library /*isNonNullableByDefault*/;
|
|||
// class Class2<T, M extends Mixin<T>> extends SuperClass with M {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/extend_with_type_variable.dart:11:7: Error: The type variable 'S' can't be used as supertype.
|
||||
// pkg/front_end/testcases/general/extend_with_type_variable.dart:11:47: Error: The type variable 'S' can't be used as supertype.
|
||||
// class Class1<T, S extends SuperClass> extends S with Mixin<T> {}
|
||||
// ^
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/extend_with_type_variable.dart:13:7: Error: The type variable 'M' can't be used as supertype.
|
||||
// pkg/front_end/testcases/general/extend_with_type_variable.dart:13:61: Error: The type variable 'M' can't be used as supertype.
|
||||
// class Class2<T, M extends Mixin<T>> extends SuperClass with M {}
|
||||
// ^
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
|
|
@ -6,13 +6,13 @@ library /*isNonNullableByDefault*/;
|
|||
// class Class2<T, M extends Mixin<T>> extends SuperClass with M {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/extend_with_type_variable.dart:11:7: Error: The type variable 'S' can't be used as supertype.
|
||||
// pkg/front_end/testcases/general/extend_with_type_variable.dart:11:47: Error: The type variable 'S' can't be used as supertype.
|
||||
// class Class1<T, S extends SuperClass> extends S with Mixin<T> {}
|
||||
// ^
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/extend_with_type_variable.dart:13:7: Error: The type variable 'M' can't be used as supertype.
|
||||
// pkg/front_end/testcases/general/extend_with_type_variable.dart:13:61: Error: The type variable 'M' can't be used as supertype.
|
||||
// class Class2<T, M extends Mixin<T>> extends SuperClass with M {}
|
||||
// ^
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
|
|
@ -7,10 +7,6 @@ library /*isNonNullableByDefault*/;
|
|||
// test(E e) {} // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/extension_type_when_experiment_not_enabled.dart:11:6: Error: 'E' isn't a type.
|
||||
// test(E e) {} // Error.
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
|
|
|
@ -7,10 +7,6 @@ library /*isNonNullableByDefault*/;
|
|||
// test(E e) {} // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/extension_type_when_experiment_not_enabled.dart:11:6: Error: 'E' isn't a type.
|
||||
// test(E e) {} // Error.
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
|
|
|
@ -7,10 +7,6 @@ library /*isNonNullableByDefault*/;
|
|||
// test(E e) {} // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/extension_type_when_experiment_not_enabled.dart:11:6: Error: 'E' isn't a type.
|
||||
// test(E e) {} // Error.
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/general/issue45700.crash_dart:5:7: Error: Can't use a function type as supertype.
|
||||
// pkg/front_end/testcases/general/issue45700.crash_dart:5:12: Error: Can't use a function type as supertype.
|
||||
// mixin M on Function() {}
|
||||
// ^
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
|
|
@ -2,9 +2,9 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/general/issue45700.crash_dart:5:7: Error: Can't use a function type as supertype.
|
||||
// pkg/front_end/testcases/general/issue45700.crash_dart:5:12: Error: Can't use a function type as supertype.
|
||||
// mixin M on Function() {}
|
||||
// ^
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
|
|
@ -2,9 +2,9 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/general/issue45700.crash_dart:5:7: Error: Can't use a function type as supertype.
|
||||
// pkg/front_end/testcases/general/issue45700.crash_dart:5:12: Error: Can't use a function type as supertype.
|
||||
// mixin M on Function() {}
|
||||
// ^
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
|
|
@ -2,9 +2,9 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/general/issue45700.crash_dart:5:7: Error: Can't use a function type as supertype.
|
||||
// pkg/front_end/testcases/general/issue45700.crash_dart:5:12: Error: Can't use a function type as supertype.
|
||||
// mixin M on Function() {}
|
||||
// ^
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
|
|
@ -2,9 +2,9 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/general/issue47728_4.dart:9:7: Error: The type 'A' which is an alias of 'dynamic Function()?' can't be used as supertype because it is nullable.
|
||||
// pkg/front_end/testcases/general/issue47728_4.dart:9:11: Error: The type 'A' which is an alias of 'dynamic Function()?' can't be used as supertype because it is nullable.
|
||||
// class C = A with B;
|
||||
// ^
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/issue47728_4.dart:5:9: Context: The issue arises via this type alias.
|
||||
// typedef A = Function()?;
|
||||
// ^
|
||||
|
|
|
@ -2,9 +2,9 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/general/issue47728_4.dart:9:7: Error: The type 'A' which is an alias of 'dynamic Function()?' can't be used as supertype because it is nullable.
|
||||
// pkg/front_end/testcases/general/issue47728_4.dart:9:11: Error: The type 'A' which is an alias of 'dynamic Function()?' can't be used as supertype because it is nullable.
|
||||
// class C = A with B;
|
||||
// ^
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/issue47728_4.dart:5:9: Context: The issue arises via this type alias.
|
||||
// typedef A = Function()?;
|
||||
// ^
|
||||
|
|
|
@ -2,9 +2,9 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/general/issue47728_4.dart:9:7: Error: The type 'A' which is an alias of 'dynamic Function()?' can't be used as supertype because it is nullable.
|
||||
// pkg/front_end/testcases/general/issue47728_4.dart:9:11: Error: The type 'A' which is an alias of 'dynamic Function()?' can't be used as supertype because it is nullable.
|
||||
// class C = A with B;
|
||||
// ^
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/issue47728_4.dart:5:9: Context: The issue arises via this type alias.
|
||||
// typedef A = Function()?;
|
||||
// ^
|
||||
|
|
|
@ -2,9 +2,9 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/general/issue47728_4.dart:9:7: Error: The type 'A' which is an alias of 'dynamic Function()?' can't be used as supertype because it is nullable.
|
||||
// pkg/front_end/testcases/general/issue47728_4.dart:9:11: Error: The type 'A' which is an alias of 'dynamic Function()?' can't be used as supertype because it is nullable.
|
||||
// class C = A with B;
|
||||
// ^
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/issue47728_4.dart:5:9: Context: The issue arises via this type alias.
|
||||
// typedef A = Function()?;
|
||||
// ^
|
||||
|
|
|
@ -17,9 +17,9 @@ library test.qualified.main /*isNonNullableByDefault*/;
|
|||
// lib.Missing method() {}
|
||||
// ^^^^^^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/general/qualified.dart:18:7: Error: The type 'lib.VoidFunction' which is an alias of 'void Function()' can't be used as supertype.
|
||||
// pkg/front_end/testcases/general/qualified.dart:18:32: Error: The type 'lib.VoidFunction' which is an alias of 'void Function()' can't be used as supertype.
|
||||
// class IllegalSupertype extends lib.VoidFunction {}
|
||||
// ^
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/qualified_lib.dart:27:9: Context: The issue arises via this type alias.
|
||||
// typedef VoidFunction = void Function();
|
||||
// ^
|
||||
|
|
|
@ -17,9 +17,9 @@ library test.qualified.main /*isNonNullableByDefault*/;
|
|||
// lib.Missing method() {}
|
||||
// ^^^^^^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/general/qualified.dart:18:7: Error: The type 'lib.VoidFunction' which is an alias of 'void Function()' can't be used as supertype.
|
||||
// pkg/front_end/testcases/general/qualified.dart:18:32: Error: The type 'lib.VoidFunction' which is an alias of 'void Function()' can't be used as supertype.
|
||||
// class IllegalSupertype extends lib.VoidFunction {}
|
||||
// ^
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/qualified_lib.dart:27:9: Context: The issue arises via this type alias.
|
||||
// typedef VoidFunction = void Function();
|
||||
// ^
|
||||
|
|
|
@ -17,9 +17,9 @@ library test.qualified.main /*isNonNullableByDefault*/;
|
|||
// lib.Missing method() {}
|
||||
// ^^^^^^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/general/qualified.dart:18:7: Error: The type 'lib.VoidFunction' which is an alias of 'void Function()' can't be used as supertype.
|
||||
// pkg/front_end/testcases/general/qualified.dart:18:32: Error: The type 'lib.VoidFunction' which is an alias of 'void Function()' can't be used as supertype.
|
||||
// class IllegalSupertype extends lib.VoidFunction {}
|
||||
// ^
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/qualified_lib.dart:27:9: Context: The issue arises via this type alias.
|
||||
// typedef VoidFunction = void Function();
|
||||
// ^
|
||||
|
|
|
@ -17,9 +17,9 @@ library test.qualified.main /*isNonNullableByDefault*/;
|
|||
// lib.Missing method() {}
|
||||
// ^^^^^^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/general/qualified.dart:18:7: Error: The type 'lib.VoidFunction' which is an alias of 'void Function()' can't be used as supertype.
|
||||
// pkg/front_end/testcases/general/qualified.dart:18:32: Error: The type 'lib.VoidFunction' which is an alias of 'void Function()' can't be used as supertype.
|
||||
// class IllegalSupertype extends lib.VoidFunction {}
|
||||
// ^
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/qualified_lib.dart:27:9: Context: The issue arises via this type alias.
|
||||
// typedef VoidFunction = void Function();
|
||||
// ^
|
||||
|
|
|
@ -4,7 +4,7 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// pkg/front_end/testcases/general/type_parameters_on_dynamic.dart:1:1: Error: Expected 0 type arguments.
|
||||
// dynamic<int> f() {}
|
||||
// ^
|
||||
// ^^^^^^^
|
||||
//
|
||||
import self as self;
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// pkg/front_end/testcases/general/type_parameters_on_dynamic.dart:1:1: Error: Expected 0 type arguments.
|
||||
// dynamic<int> f() {}
|
||||
// ^
|
||||
// ^^^^^^^
|
||||
//
|
||||
import self as self;
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// pkg/front_end/testcases/general/type_parameters_on_dynamic.dart:1:1: Error: Expected 0 type arguments.
|
||||
// dynamic<int> f() {}
|
||||
// ^
|
||||
// ^^^^^^^
|
||||
//
|
||||
import self as self;
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// pkg/front_end/testcases/general/type_parameters_on_dynamic.dart:1:1: Error: Expected 0 type arguments.
|
||||
// dynamic<int> f() {}
|
||||
// ^
|
||||
// ^^^^^^^
|
||||
//
|
||||
import self as self;
|
||||
|
||||
|
|
|
@ -2,17 +2,17 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_as_super.dart:5:16: Error: The type variable 'T' can't be used as supertype.
|
||||
// pkg/front_end/testcases/general/type_variable_as_super.dart:5:29: Error: The type variable 'T' can't be used as supertype.
|
||||
// abstract class A<T> extends T {}
|
||||
// ^
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_as_super.dart:7:16: Error: The type variable 'T' can't be used as supertype.
|
||||
// pkg/front_end/testcases/general/type_variable_as_super.dart:7:29: Error: The type variable 'T' can't be used as supertype.
|
||||
// abstract class B<T> extends T {
|
||||
// ^
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_as_super.dart:11:7: Error: The type variable 'T' can't be used as supertype.
|
||||
// pkg/front_end/testcases/general/type_variable_as_super.dart:11:20: Error: The type variable 'T' can't be used as supertype.
|
||||
// class C<T> extends T {}
|
||||
// ^
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_as_super.dart:14:7: Error: The class 'A' is abstract and can't be instantiated.
|
||||
// new A();
|
||||
|
|
|
@ -2,17 +2,17 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_as_super.dart:5:16: Error: The type variable 'T' can't be used as supertype.
|
||||
// pkg/front_end/testcases/general/type_variable_as_super.dart:5:29: Error: The type variable 'T' can't be used as supertype.
|
||||
// abstract class A<T> extends T {}
|
||||
// ^
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_as_super.dart:7:16: Error: The type variable 'T' can't be used as supertype.
|
||||
// pkg/front_end/testcases/general/type_variable_as_super.dart:7:29: Error: The type variable 'T' can't be used as supertype.
|
||||
// abstract class B<T> extends T {
|
||||
// ^
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_as_super.dart:11:7: Error: The type variable 'T' can't be used as supertype.
|
||||
// pkg/front_end/testcases/general/type_variable_as_super.dart:11:20: Error: The type variable 'T' can't be used as supertype.
|
||||
// class C<T> extends T {}
|
||||
// ^
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_as_super.dart:14:7: Error: The class 'A' is abstract and can't be instantiated.
|
||||
// new A();
|
||||
|
|
|
@ -2,17 +2,17 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_as_super.dart:5:16: Error: The type variable 'T' can't be used as supertype.
|
||||
// pkg/front_end/testcases/general/type_variable_as_super.dart:5:29: Error: The type variable 'T' can't be used as supertype.
|
||||
// abstract class A<T> extends T {}
|
||||
// ^
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_as_super.dart:7:16: Error: The type variable 'T' can't be used as supertype.
|
||||
// pkg/front_end/testcases/general/type_variable_as_super.dart:7:29: Error: The type variable 'T' can't be used as supertype.
|
||||
// abstract class B<T> extends T {
|
||||
// ^
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_as_super.dart:11:7: Error: The type variable 'T' can't be used as supertype.
|
||||
// pkg/front_end/testcases/general/type_variable_as_super.dart:11:20: Error: The type variable 'T' can't be used as supertype.
|
||||
// class C<T> extends T {}
|
||||
// ^
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
|
|
@ -2,17 +2,17 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_as_super.dart:5:16: Error: The type variable 'T' can't be used as supertype.
|
||||
// pkg/front_end/testcases/general/type_variable_as_super.dart:5:29: Error: The type variable 'T' can't be used as supertype.
|
||||
// abstract class A<T> extends T {}
|
||||
// ^
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_as_super.dart:7:16: Error: The type variable 'T' can't be used as supertype.
|
||||
// pkg/front_end/testcases/general/type_variable_as_super.dart:7:29: Error: The type variable 'T' can't be used as supertype.
|
||||
// abstract class B<T> extends T {
|
||||
// ^
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_as_super.dart:11:7: Error: The type variable 'T' can't be used as supertype.
|
||||
// pkg/front_end/testcases/general/type_variable_as_super.dart:11:20: Error: The type variable 'T' can't be used as supertype.
|
||||
// class C<T> extends T {}
|
||||
// ^
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_as_super.dart:14:7: Error: The class 'A' is abstract and can't be instantiated.
|
||||
// new A();
|
||||
|
|
|
@ -2,61 +2,114 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:105:3: Error: Extensions can't declare constructors.
|
||||
// Try removing the constructor declaration.
|
||||
// Extension(T t);
|
||||
// ^^^^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:107:3: Error: Extensions can't declare constructors.
|
||||
// Try removing the constructor declaration.
|
||||
// factory Extension.fact(T t) => null;
|
||||
// ^^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:113:5: Error: Extensions can't declare instance fields
|
||||
// Try removing the field declaration or making it a static field
|
||||
// T field1;
|
||||
// ^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:130:3: Error: Mixins can't declare constructors.
|
||||
// Mixin(T t);
|
||||
// ^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:132:3: Error: Mixins can't declare constructors.
|
||||
// factory Mixin.fact(T t) => null;
|
||||
// ^^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:107:11: Error: Expected 0 type arguments.
|
||||
// factory Extension.fact(T t) => null;
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:13:10: Error: Type variables can't be used in static members.
|
||||
// static T? method0<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:13:31: Error: Type variables can't be used in static members.
|
||||
// static T? method0<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:13:34: Error: Type variables can't be used in static members.
|
||||
// static T? method0<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:19:10: Error: Type variables can't be used in static members.
|
||||
// @Class<T>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:20:16: Error: Type variables can't be used in static members.
|
||||
// static Class<T>? method1<S extends Class<T>>(Class<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:20:44: Error: Type variables can't be used in static members.
|
||||
// static Class<T>? method1<S extends Class<T>>(Class<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:20:54: Error: Type variables can't be used in static members.
|
||||
// static Class<T>? method1<S extends Class<T>>(Class<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:28:16: Error: Type variables can't be used in static members.
|
||||
// @Class<Class<T>>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:29:22: Error: Type variables can't be used in static members.
|
||||
// static Class<Class<T>>? method2<S extends Class<Class<T>>>(Class<Class<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:29:57: Error: Type variables can't be used in static members.
|
||||
// static Class<Class<T>>? method2<S extends Class<Class<T>>>(Class<Class<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:29:74: Error: Type variables can't be used in static members.
|
||||
// static Class<Class<T>>? method2<S extends Class<Class<T>>>(Class<Class<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:37:6: Error: Type variables can't be used in static members.
|
||||
// @A<T>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:38:12: Error: Type variables can't be used in static members.
|
||||
// static A<T>? method3<S extends A<T>>(A<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:38:36: Error: Type variables can't be used in static members.
|
||||
// static A<T>? method3<S extends A<T>>(A<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:38:42: Error: Type variables can't be used in static members.
|
||||
// static A<T>? method3<S extends A<T>>(A<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:46:8: Error: Type variables can't be used in static members.
|
||||
// @A<A<T>>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:47:14: Error: Type variables can't be used in static members.
|
||||
// static A<A<T>>? method4<S extends A<A<T>>>(A<A<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:47:41: Error: Type variables can't be used in static members.
|
||||
// static A<A<T>>? method4<S extends A<A<T>>>(A<A<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:47:50: Error: Type variables can't be used in static members.
|
||||
// static A<A<T>>? method4<S extends A<A<T>>>(A<A<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:55:6: Error: Type variables can't be used in static members.
|
||||
// @B<T>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:56:12: Error: Type variables can't be used in static members.
|
||||
// static B<T>? method5<S extends B<T>>(B<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:56:36: Error: Type variables can't be used in static members.
|
||||
// static B<T>? method5<S extends B<T>>(B<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:56:42: Error: Type variables can't be used in static members.
|
||||
// static B<T>? method5<S extends B<T>>(B<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:64:8: Error: Type variables can't be used in static members.
|
||||
// @A<B<T>>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:65:14: Error: Type variables can't be used in static members.
|
||||
// static A<B<T>>? method6<S extends A<B<T>>>(A<B<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:65:41: Error: Type variables can't be used in static members.
|
||||
// static A<B<T>>? method6<S extends A<B<T>>>(A<B<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:65:50: Error: Type variables can't be used in static members.
|
||||
// static A<B<T>>? method6<S extends A<B<T>>>(A<B<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:73:34: Error: Type variables can't be used in static members.
|
||||
// @Class<void Function<S extends T>()>()
|
||||
// ^
|
||||
|
@ -73,102 +126,85 @@ library /*isNonNullableByDefault*/;
|
|||
// static void Function<S extends T>()? method7<U extends void Function<S extends T>()>(void Function<S extends T>() arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:116:36: Error: Type variables can't be used in static members.
|
||||
// static T? staticMethod<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:138:36: Error: Type variables can't be used in static members.
|
||||
// static T? staticMethod<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:13:34: Error: Type variables can't be used in static members.
|
||||
// static T? method0<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:13:10: Error: Type variables can't be used in static members.
|
||||
// static T? method0<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:20:54: Error: Type variables can't be used in static members.
|
||||
// static Class<T>? method1<S extends Class<T>>(Class<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:20:16: Error: Type variables can't be used in static members.
|
||||
// static Class<T>? method1<S extends Class<T>>(Class<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:29:74: Error: Type variables can't be used in static members.
|
||||
// static Class<Class<T>>? method2<S extends Class<Class<T>>>(Class<Class<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:29:22: Error: Type variables can't be used in static members.
|
||||
// static Class<Class<T>>? method2<S extends Class<Class<T>>>(Class<Class<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:38:42: Error: Type variables can't be used in static members.
|
||||
// static A<T>? method3<S extends A<T>>(A<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:38:12: Error: Type variables can't be used in static members.
|
||||
// static A<T>? method3<S extends A<T>>(A<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:47:50: Error: Type variables can't be used in static members.
|
||||
// static A<A<T>>? method4<S extends A<A<T>>>(A<A<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:47:14: Error: Type variables can't be used in static members.
|
||||
// static A<A<T>>? method4<S extends A<A<T>>>(A<A<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:56:42: Error: Type variables can't be used in static members.
|
||||
// static B<T>? method5<S extends B<T>>(B<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:56:12: Error: Type variables can't be used in static members.
|
||||
// static B<T>? method5<S extends B<T>>(B<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:65:50: Error: Type variables can't be used in static members.
|
||||
// static A<B<T>>? method6<S extends A<B<T>>>(A<B<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:65:14: Error: Type variables can't be used in static members.
|
||||
// static A<B<T>>? method6<S extends A<B<T>>>(A<B<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:80:10: Error: Type variables can't be used in static members.
|
||||
// static T field0;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:82:10: Error: Type variables can't be used in static members.
|
||||
// @Class<T>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:83:16: Error: Type variables can't be used in static members.
|
||||
// static Class<T>? field1;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:85:16: Error: Type variables can't be used in static members.
|
||||
// @Class<Class<T>>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:88:6: Error: Type variables can't be used in static members.
|
||||
// @A<T>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:91:6: Error: Type variables can't be used in static members.
|
||||
// @B<T>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:105:3: Error: Extensions can't declare constructors.
|
||||
// Try removing the constructor declaration.
|
||||
// Extension(T t);
|
||||
// ^^^^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:107:3: Error: Extensions can't declare constructors.
|
||||
// Try removing the constructor declaration.
|
||||
// factory Extension.fact(T t) => null;
|
||||
// ^^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:113:5: Error: Extensions can't declare instance fields
|
||||
// Try removing the field declaration or making it a static field
|
||||
// T field1;
|
||||
// ^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:110:10: Error: Type variables can't be used in static members.
|
||||
// static T field0;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:116:39: Error: Type variables can't be used in static members.
|
||||
// static T? staticMethod<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:116:10: Error: Type variables can't be used in static members.
|
||||
// static T? staticMethod<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:116:36: Error: Type variables can't be used in static members.
|
||||
// static T? staticMethod<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:116:39: Error: Type variables can't be used in static members.
|
||||
// static T? staticMethod<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:130:3: Error: Mixins can't declare constructors.
|
||||
// Mixin(T t);
|
||||
// ^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:132:3: Error: Mixins can't declare constructors.
|
||||
// factory Mixin.fact(T t) => null;
|
||||
// ^^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:135:10: Error: Type variables can't be used in static members.
|
||||
// static T field0;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:138:39: Error: Type variables can't be used in static members.
|
||||
// static T? staticMethod<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:138:10: Error: Type variables can't be used in static members.
|
||||
// static T? staticMethod<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:138:36: Error: Type variables can't be used in static members.
|
||||
// static T? staticMethod<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:138:39: Error: Type variables can't be used in static members.
|
||||
// static T? staticMethod<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:92:24: Error: Type variables can't be used in static members.
|
||||
// static var field4 = (T t) => T;
|
||||
// ^
|
||||
|
@ -181,50 +217,10 @@ library /*isNonNullableByDefault*/;
|
|||
// @T()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:19:10: Error: Type variables can't be used in static members.
|
||||
// @Class<T>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:28:16: Error: Type variables can't be used in static members.
|
||||
// @Class<Class<T>>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:37:6: Error: Type variables can't be used in static members.
|
||||
// @A<T>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:46:8: Error: Type variables can't be used in static members.
|
||||
// @A<A<T>>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:55:6: Error: Type variables can't be used in static members.
|
||||
// @B<T>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:64:8: Error: Type variables can't be used in static members.
|
||||
// @A<B<T>>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:79:4: Error: Couldn't find constructor 'T'.
|
||||
// @T()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:82:10: Error: Type variables can't be used in static members.
|
||||
// @Class<T>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:85:16: Error: Type variables can't be used in static members.
|
||||
// @Class<Class<T>>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:88:6: Error: Type variables can't be used in static members.
|
||||
// @A<T>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:91:6: Error: Type variables can't be used in static members.
|
||||
// @B<T>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:94:4: Error: Couldn't find constructor 'T'.
|
||||
// @T()
|
||||
// ^
|
||||
|
|
|
@ -2,61 +2,114 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:105:3: Error: Extensions can't declare constructors.
|
||||
// Try removing the constructor declaration.
|
||||
// Extension(T t);
|
||||
// ^^^^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:107:3: Error: Extensions can't declare constructors.
|
||||
// Try removing the constructor declaration.
|
||||
// factory Extension.fact(T t) => null;
|
||||
// ^^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:113:5: Error: Extensions can't declare instance fields
|
||||
// Try removing the field declaration or making it a static field
|
||||
// T field1;
|
||||
// ^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:130:3: Error: Mixins can't declare constructors.
|
||||
// Mixin(T t);
|
||||
// ^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:132:3: Error: Mixins can't declare constructors.
|
||||
// factory Mixin.fact(T t) => null;
|
||||
// ^^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:107:11: Error: Expected 0 type arguments.
|
||||
// factory Extension.fact(T t) => null;
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:13:10: Error: Type variables can't be used in static members.
|
||||
// static T? method0<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:13:31: Error: Type variables can't be used in static members.
|
||||
// static T? method0<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:13:34: Error: Type variables can't be used in static members.
|
||||
// static T? method0<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:19:10: Error: Type variables can't be used in static members.
|
||||
// @Class<T>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:20:16: Error: Type variables can't be used in static members.
|
||||
// static Class<T>? method1<S extends Class<T>>(Class<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:20:44: Error: Type variables can't be used in static members.
|
||||
// static Class<T>? method1<S extends Class<T>>(Class<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:20:54: Error: Type variables can't be used in static members.
|
||||
// static Class<T>? method1<S extends Class<T>>(Class<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:28:16: Error: Type variables can't be used in static members.
|
||||
// @Class<Class<T>>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:29:22: Error: Type variables can't be used in static members.
|
||||
// static Class<Class<T>>? method2<S extends Class<Class<T>>>(Class<Class<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:29:57: Error: Type variables can't be used in static members.
|
||||
// static Class<Class<T>>? method2<S extends Class<Class<T>>>(Class<Class<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:29:74: Error: Type variables can't be used in static members.
|
||||
// static Class<Class<T>>? method2<S extends Class<Class<T>>>(Class<Class<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:37:6: Error: Type variables can't be used in static members.
|
||||
// @A<T>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:38:12: Error: Type variables can't be used in static members.
|
||||
// static A<T>? method3<S extends A<T>>(A<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:38:36: Error: Type variables can't be used in static members.
|
||||
// static A<T>? method3<S extends A<T>>(A<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:38:42: Error: Type variables can't be used in static members.
|
||||
// static A<T>? method3<S extends A<T>>(A<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:46:8: Error: Type variables can't be used in static members.
|
||||
// @A<A<T>>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:47:14: Error: Type variables can't be used in static members.
|
||||
// static A<A<T>>? method4<S extends A<A<T>>>(A<A<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:47:41: Error: Type variables can't be used in static members.
|
||||
// static A<A<T>>? method4<S extends A<A<T>>>(A<A<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:47:50: Error: Type variables can't be used in static members.
|
||||
// static A<A<T>>? method4<S extends A<A<T>>>(A<A<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:55:6: Error: Type variables can't be used in static members.
|
||||
// @B<T>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:56:12: Error: Type variables can't be used in static members.
|
||||
// static B<T>? method5<S extends B<T>>(B<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:56:36: Error: Type variables can't be used in static members.
|
||||
// static B<T>? method5<S extends B<T>>(B<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:56:42: Error: Type variables can't be used in static members.
|
||||
// static B<T>? method5<S extends B<T>>(B<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:64:8: Error: Type variables can't be used in static members.
|
||||
// @A<B<T>>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:65:14: Error: Type variables can't be used in static members.
|
||||
// static A<B<T>>? method6<S extends A<B<T>>>(A<B<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:65:41: Error: Type variables can't be used in static members.
|
||||
// static A<B<T>>? method6<S extends A<B<T>>>(A<B<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:65:50: Error: Type variables can't be used in static members.
|
||||
// static A<B<T>>? method6<S extends A<B<T>>>(A<B<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:73:34: Error: Type variables can't be used in static members.
|
||||
// @Class<void Function<S extends T>()>()
|
||||
// ^
|
||||
|
@ -73,102 +126,85 @@ library /*isNonNullableByDefault*/;
|
|||
// static void Function<S extends T>()? method7<U extends void Function<S extends T>()>(void Function<S extends T>() arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:116:36: Error: Type variables can't be used in static members.
|
||||
// static T? staticMethod<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:138:36: Error: Type variables can't be used in static members.
|
||||
// static T? staticMethod<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:13:34: Error: Type variables can't be used in static members.
|
||||
// static T? method0<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:13:10: Error: Type variables can't be used in static members.
|
||||
// static T? method0<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:20:54: Error: Type variables can't be used in static members.
|
||||
// static Class<T>? method1<S extends Class<T>>(Class<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:20:16: Error: Type variables can't be used in static members.
|
||||
// static Class<T>? method1<S extends Class<T>>(Class<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:29:74: Error: Type variables can't be used in static members.
|
||||
// static Class<Class<T>>? method2<S extends Class<Class<T>>>(Class<Class<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:29:22: Error: Type variables can't be used in static members.
|
||||
// static Class<Class<T>>? method2<S extends Class<Class<T>>>(Class<Class<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:38:42: Error: Type variables can't be used in static members.
|
||||
// static A<T>? method3<S extends A<T>>(A<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:38:12: Error: Type variables can't be used in static members.
|
||||
// static A<T>? method3<S extends A<T>>(A<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:47:50: Error: Type variables can't be used in static members.
|
||||
// static A<A<T>>? method4<S extends A<A<T>>>(A<A<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:47:14: Error: Type variables can't be used in static members.
|
||||
// static A<A<T>>? method4<S extends A<A<T>>>(A<A<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:56:42: Error: Type variables can't be used in static members.
|
||||
// static B<T>? method5<S extends B<T>>(B<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:56:12: Error: Type variables can't be used in static members.
|
||||
// static B<T>? method5<S extends B<T>>(B<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:65:50: Error: Type variables can't be used in static members.
|
||||
// static A<B<T>>? method6<S extends A<B<T>>>(A<B<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:65:14: Error: Type variables can't be used in static members.
|
||||
// static A<B<T>>? method6<S extends A<B<T>>>(A<B<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:80:10: Error: Type variables can't be used in static members.
|
||||
// static T field0;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:82:10: Error: Type variables can't be used in static members.
|
||||
// @Class<T>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:83:16: Error: Type variables can't be used in static members.
|
||||
// static Class<T>? field1;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:85:16: Error: Type variables can't be used in static members.
|
||||
// @Class<Class<T>>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:88:6: Error: Type variables can't be used in static members.
|
||||
// @A<T>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:91:6: Error: Type variables can't be used in static members.
|
||||
// @B<T>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:105:3: Error: Extensions can't declare constructors.
|
||||
// Try removing the constructor declaration.
|
||||
// Extension(T t);
|
||||
// ^^^^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:107:3: Error: Extensions can't declare constructors.
|
||||
// Try removing the constructor declaration.
|
||||
// factory Extension.fact(T t) => null;
|
||||
// ^^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:113:5: Error: Extensions can't declare instance fields
|
||||
// Try removing the field declaration or making it a static field
|
||||
// T field1;
|
||||
// ^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:110:10: Error: Type variables can't be used in static members.
|
||||
// static T field0;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:116:39: Error: Type variables can't be used in static members.
|
||||
// static T? staticMethod<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:116:10: Error: Type variables can't be used in static members.
|
||||
// static T? staticMethod<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:116:36: Error: Type variables can't be used in static members.
|
||||
// static T? staticMethod<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:116:39: Error: Type variables can't be used in static members.
|
||||
// static T? staticMethod<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:130:3: Error: Mixins can't declare constructors.
|
||||
// Mixin(T t);
|
||||
// ^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:132:3: Error: Mixins can't declare constructors.
|
||||
// factory Mixin.fact(T t) => null;
|
||||
// ^^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:135:10: Error: Type variables can't be used in static members.
|
||||
// static T field0;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:138:39: Error: Type variables can't be used in static members.
|
||||
// static T? staticMethod<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:138:10: Error: Type variables can't be used in static members.
|
||||
// static T? staticMethod<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:138:36: Error: Type variables can't be used in static members.
|
||||
// static T? staticMethod<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:138:39: Error: Type variables can't be used in static members.
|
||||
// static T? staticMethod<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:92:24: Error: Type variables can't be used in static members.
|
||||
// static var field4 = (T t) => T;
|
||||
// ^
|
||||
|
@ -181,50 +217,10 @@ library /*isNonNullableByDefault*/;
|
|||
// @T()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:19:10: Error: Type variables can't be used in static members.
|
||||
// @Class<T>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:28:16: Error: Type variables can't be used in static members.
|
||||
// @Class<Class<T>>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:37:6: Error: Type variables can't be used in static members.
|
||||
// @A<T>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:46:8: Error: Type variables can't be used in static members.
|
||||
// @A<A<T>>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:55:6: Error: Type variables can't be used in static members.
|
||||
// @B<T>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:64:8: Error: Type variables can't be used in static members.
|
||||
// @A<B<T>>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:79:4: Error: Couldn't find constructor 'T'.
|
||||
// @T()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:82:10: Error: Type variables can't be used in static members.
|
||||
// @Class<T>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:85:16: Error: Type variables can't be used in static members.
|
||||
// @Class<Class<T>>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:88:6: Error: Type variables can't be used in static members.
|
||||
// @A<T>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:91:6: Error: Type variables can't be used in static members.
|
||||
// @B<T>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:94:4: Error: Couldn't find constructor 'T'.
|
||||
// @T()
|
||||
// ^
|
||||
|
|
|
@ -2,61 +2,114 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:105:3: Error: Extensions can't declare constructors.
|
||||
// Try removing the constructor declaration.
|
||||
// Extension(T t);
|
||||
// ^^^^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:107:3: Error: Extensions can't declare constructors.
|
||||
// Try removing the constructor declaration.
|
||||
// factory Extension.fact(T t) => null;
|
||||
// ^^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:113:5: Error: Extensions can't declare instance fields
|
||||
// Try removing the field declaration or making it a static field
|
||||
// T field1;
|
||||
// ^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:130:3: Error: Mixins can't declare constructors.
|
||||
// Mixin(T t);
|
||||
// ^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:132:3: Error: Mixins can't declare constructors.
|
||||
// factory Mixin.fact(T t) => null;
|
||||
// ^^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:107:11: Error: Expected 0 type arguments.
|
||||
// factory Extension.fact(T t) => null;
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:13:10: Error: Type variables can't be used in static members.
|
||||
// static T? method0<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:13:31: Error: Type variables can't be used in static members.
|
||||
// static T? method0<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:13:34: Error: Type variables can't be used in static members.
|
||||
// static T? method0<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:19:10: Error: Type variables can't be used in static members.
|
||||
// @Class<T>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:20:16: Error: Type variables can't be used in static members.
|
||||
// static Class<T>? method1<S extends Class<T>>(Class<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:20:44: Error: Type variables can't be used in static members.
|
||||
// static Class<T>? method1<S extends Class<T>>(Class<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:20:54: Error: Type variables can't be used in static members.
|
||||
// static Class<T>? method1<S extends Class<T>>(Class<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:28:16: Error: Type variables can't be used in static members.
|
||||
// @Class<Class<T>>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:29:22: Error: Type variables can't be used in static members.
|
||||
// static Class<Class<T>>? method2<S extends Class<Class<T>>>(Class<Class<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:29:57: Error: Type variables can't be used in static members.
|
||||
// static Class<Class<T>>? method2<S extends Class<Class<T>>>(Class<Class<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:29:74: Error: Type variables can't be used in static members.
|
||||
// static Class<Class<T>>? method2<S extends Class<Class<T>>>(Class<Class<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:37:6: Error: Type variables can't be used in static members.
|
||||
// @A<T>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:38:12: Error: Type variables can't be used in static members.
|
||||
// static A<T>? method3<S extends A<T>>(A<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:38:36: Error: Type variables can't be used in static members.
|
||||
// static A<T>? method3<S extends A<T>>(A<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:38:42: Error: Type variables can't be used in static members.
|
||||
// static A<T>? method3<S extends A<T>>(A<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:46:8: Error: Type variables can't be used in static members.
|
||||
// @A<A<T>>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:47:14: Error: Type variables can't be used in static members.
|
||||
// static A<A<T>>? method4<S extends A<A<T>>>(A<A<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:47:41: Error: Type variables can't be used in static members.
|
||||
// static A<A<T>>? method4<S extends A<A<T>>>(A<A<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:47:50: Error: Type variables can't be used in static members.
|
||||
// static A<A<T>>? method4<S extends A<A<T>>>(A<A<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:55:6: Error: Type variables can't be used in static members.
|
||||
// @B<T>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:56:12: Error: Type variables can't be used in static members.
|
||||
// static B<T>? method5<S extends B<T>>(B<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:56:36: Error: Type variables can't be used in static members.
|
||||
// static B<T>? method5<S extends B<T>>(B<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:56:42: Error: Type variables can't be used in static members.
|
||||
// static B<T>? method5<S extends B<T>>(B<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:64:8: Error: Type variables can't be used in static members.
|
||||
// @A<B<T>>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:65:14: Error: Type variables can't be used in static members.
|
||||
// static A<B<T>>? method6<S extends A<B<T>>>(A<B<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:65:41: Error: Type variables can't be used in static members.
|
||||
// static A<B<T>>? method6<S extends A<B<T>>>(A<B<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:65:50: Error: Type variables can't be used in static members.
|
||||
// static A<B<T>>? method6<S extends A<B<T>>>(A<B<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:73:34: Error: Type variables can't be used in static members.
|
||||
// @Class<void Function<S extends T>()>()
|
||||
// ^
|
||||
|
@ -73,102 +126,85 @@ library /*isNonNullableByDefault*/;
|
|||
// static void Function<S extends T>()? method7<U extends void Function<S extends T>()>(void Function<S extends T>() arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:116:36: Error: Type variables can't be used in static members.
|
||||
// static T? staticMethod<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:138:36: Error: Type variables can't be used in static members.
|
||||
// static T? staticMethod<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:13:34: Error: Type variables can't be used in static members.
|
||||
// static T? method0<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:13:10: Error: Type variables can't be used in static members.
|
||||
// static T? method0<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:20:54: Error: Type variables can't be used in static members.
|
||||
// static Class<T>? method1<S extends Class<T>>(Class<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:20:16: Error: Type variables can't be used in static members.
|
||||
// static Class<T>? method1<S extends Class<T>>(Class<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:29:74: Error: Type variables can't be used in static members.
|
||||
// static Class<Class<T>>? method2<S extends Class<Class<T>>>(Class<Class<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:29:22: Error: Type variables can't be used in static members.
|
||||
// static Class<Class<T>>? method2<S extends Class<Class<T>>>(Class<Class<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:38:42: Error: Type variables can't be used in static members.
|
||||
// static A<T>? method3<S extends A<T>>(A<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:38:12: Error: Type variables can't be used in static members.
|
||||
// static A<T>? method3<S extends A<T>>(A<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:47:50: Error: Type variables can't be used in static members.
|
||||
// static A<A<T>>? method4<S extends A<A<T>>>(A<A<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:47:14: Error: Type variables can't be used in static members.
|
||||
// static A<A<T>>? method4<S extends A<A<T>>>(A<A<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:56:42: Error: Type variables can't be used in static members.
|
||||
// static B<T>? method5<S extends B<T>>(B<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:56:12: Error: Type variables can't be used in static members.
|
||||
// static B<T>? method5<S extends B<T>>(B<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:65:50: Error: Type variables can't be used in static members.
|
||||
// static A<B<T>>? method6<S extends A<B<T>>>(A<B<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:65:14: Error: Type variables can't be used in static members.
|
||||
// static A<B<T>>? method6<S extends A<B<T>>>(A<B<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:80:10: Error: Type variables can't be used in static members.
|
||||
// static T field0;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:82:10: Error: Type variables can't be used in static members.
|
||||
// @Class<T>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:83:16: Error: Type variables can't be used in static members.
|
||||
// static Class<T>? field1;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:85:16: Error: Type variables can't be used in static members.
|
||||
// @Class<Class<T>>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:88:6: Error: Type variables can't be used in static members.
|
||||
// @A<T>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:91:6: Error: Type variables can't be used in static members.
|
||||
// @B<T>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:105:3: Error: Extensions can't declare constructors.
|
||||
// Try removing the constructor declaration.
|
||||
// Extension(T t);
|
||||
// ^^^^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:107:3: Error: Extensions can't declare constructors.
|
||||
// Try removing the constructor declaration.
|
||||
// factory Extension.fact(T t) => null;
|
||||
// ^^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:113:5: Error: Extensions can't declare instance fields
|
||||
// Try removing the field declaration or making it a static field
|
||||
// T field1;
|
||||
// ^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:110:10: Error: Type variables can't be used in static members.
|
||||
// static T field0;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:116:39: Error: Type variables can't be used in static members.
|
||||
// static T? staticMethod<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:116:10: Error: Type variables can't be used in static members.
|
||||
// static T? staticMethod<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:116:36: Error: Type variables can't be used in static members.
|
||||
// static T? staticMethod<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:116:39: Error: Type variables can't be used in static members.
|
||||
// static T? staticMethod<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:130:3: Error: Mixins can't declare constructors.
|
||||
// Mixin(T t);
|
||||
// ^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:132:3: Error: Mixins can't declare constructors.
|
||||
// factory Mixin.fact(T t) => null;
|
||||
// ^^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:135:10: Error: Type variables can't be used in static members.
|
||||
// static T field0;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:138:39: Error: Type variables can't be used in static members.
|
||||
// static T? staticMethod<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:138:10: Error: Type variables can't be used in static members.
|
||||
// static T? staticMethod<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:138:36: Error: Type variables can't be used in static members.
|
||||
// static T? staticMethod<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:138:39: Error: Type variables can't be used in static members.
|
||||
// static T? staticMethod<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:92:24: Error: Type variables can't be used in static members.
|
||||
// static var field4 = (T t) => T;
|
||||
// ^
|
||||
|
@ -181,50 +217,10 @@ library /*isNonNullableByDefault*/;
|
|||
// @T()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:19:10: Error: Type variables can't be used in static members.
|
||||
// @Class<T>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:28:16: Error: Type variables can't be used in static members.
|
||||
// @Class<Class<T>>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:37:6: Error: Type variables can't be used in static members.
|
||||
// @A<T>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:46:8: Error: Type variables can't be used in static members.
|
||||
// @A<A<T>>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:55:6: Error: Type variables can't be used in static members.
|
||||
// @B<T>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:64:8: Error: Type variables can't be used in static members.
|
||||
// @A<B<T>>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:79:4: Error: Couldn't find constructor 'T'.
|
||||
// @T()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:82:10: Error: Type variables can't be used in static members.
|
||||
// @Class<T>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:85:16: Error: Type variables can't be used in static members.
|
||||
// @Class<Class<T>>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:88:6: Error: Type variables can't be used in static members.
|
||||
// @A<T>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:91:6: Error: Type variables can't be used in static members.
|
||||
// @B<T>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:94:4: Error: Couldn't find constructor 'T'.
|
||||
// @T()
|
||||
// ^
|
||||
|
|
|
@ -2,61 +2,114 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:105:3: Error: Extensions can't declare constructors.
|
||||
// Try removing the constructor declaration.
|
||||
// Extension(T t);
|
||||
// ^^^^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:107:3: Error: Extensions can't declare constructors.
|
||||
// Try removing the constructor declaration.
|
||||
// factory Extension.fact(T t) => null;
|
||||
// ^^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:113:5: Error: Extensions can't declare instance fields
|
||||
// Try removing the field declaration or making it a static field
|
||||
// T field1;
|
||||
// ^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:130:3: Error: Mixins can't declare constructors.
|
||||
// Mixin(T t);
|
||||
// ^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:132:3: Error: Mixins can't declare constructors.
|
||||
// factory Mixin.fact(T t) => null;
|
||||
// ^^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:107:11: Error: Expected 0 type arguments.
|
||||
// factory Extension.fact(T t) => null;
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:13:10: Error: Type variables can't be used in static members.
|
||||
// static T? method0<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:13:31: Error: Type variables can't be used in static members.
|
||||
// static T? method0<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:13:34: Error: Type variables can't be used in static members.
|
||||
// static T? method0<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:19:10: Error: Type variables can't be used in static members.
|
||||
// @Class<T>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:20:16: Error: Type variables can't be used in static members.
|
||||
// static Class<T>? method1<S extends Class<T>>(Class<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:20:44: Error: Type variables can't be used in static members.
|
||||
// static Class<T>? method1<S extends Class<T>>(Class<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:20:54: Error: Type variables can't be used in static members.
|
||||
// static Class<T>? method1<S extends Class<T>>(Class<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:28:16: Error: Type variables can't be used in static members.
|
||||
// @Class<Class<T>>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:29:22: Error: Type variables can't be used in static members.
|
||||
// static Class<Class<T>>? method2<S extends Class<Class<T>>>(Class<Class<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:29:57: Error: Type variables can't be used in static members.
|
||||
// static Class<Class<T>>? method2<S extends Class<Class<T>>>(Class<Class<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:29:74: Error: Type variables can't be used in static members.
|
||||
// static Class<Class<T>>? method2<S extends Class<Class<T>>>(Class<Class<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:37:6: Error: Type variables can't be used in static members.
|
||||
// @A<T>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:38:12: Error: Type variables can't be used in static members.
|
||||
// static A<T>? method3<S extends A<T>>(A<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:38:36: Error: Type variables can't be used in static members.
|
||||
// static A<T>? method3<S extends A<T>>(A<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:38:42: Error: Type variables can't be used in static members.
|
||||
// static A<T>? method3<S extends A<T>>(A<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:46:8: Error: Type variables can't be used in static members.
|
||||
// @A<A<T>>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:47:14: Error: Type variables can't be used in static members.
|
||||
// static A<A<T>>? method4<S extends A<A<T>>>(A<A<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:47:41: Error: Type variables can't be used in static members.
|
||||
// static A<A<T>>? method4<S extends A<A<T>>>(A<A<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:47:50: Error: Type variables can't be used in static members.
|
||||
// static A<A<T>>? method4<S extends A<A<T>>>(A<A<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:55:6: Error: Type variables can't be used in static members.
|
||||
// @B<T>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:56:12: Error: Type variables can't be used in static members.
|
||||
// static B<T>? method5<S extends B<T>>(B<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:56:36: Error: Type variables can't be used in static members.
|
||||
// static B<T>? method5<S extends B<T>>(B<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:56:42: Error: Type variables can't be used in static members.
|
||||
// static B<T>? method5<S extends B<T>>(B<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:64:8: Error: Type variables can't be used in static members.
|
||||
// @A<B<T>>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:65:14: Error: Type variables can't be used in static members.
|
||||
// static A<B<T>>? method6<S extends A<B<T>>>(A<B<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:65:41: Error: Type variables can't be used in static members.
|
||||
// static A<B<T>>? method6<S extends A<B<T>>>(A<B<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:65:50: Error: Type variables can't be used in static members.
|
||||
// static A<B<T>>? method6<S extends A<B<T>>>(A<B<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:73:34: Error: Type variables can't be used in static members.
|
||||
// @Class<void Function<S extends T>()>()
|
||||
// ^
|
||||
|
@ -73,102 +126,85 @@ library /*isNonNullableByDefault*/;
|
|||
// static void Function<S extends T>()? method7<U extends void Function<S extends T>()>(void Function<S extends T>() arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:116:36: Error: Type variables can't be used in static members.
|
||||
// static T? staticMethod<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:138:36: Error: Type variables can't be used in static members.
|
||||
// static T? staticMethod<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:13:34: Error: Type variables can't be used in static members.
|
||||
// static T? method0<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:13:10: Error: Type variables can't be used in static members.
|
||||
// static T? method0<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:20:54: Error: Type variables can't be used in static members.
|
||||
// static Class<T>? method1<S extends Class<T>>(Class<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:20:16: Error: Type variables can't be used in static members.
|
||||
// static Class<T>? method1<S extends Class<T>>(Class<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:29:74: Error: Type variables can't be used in static members.
|
||||
// static Class<Class<T>>? method2<S extends Class<Class<T>>>(Class<Class<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:29:22: Error: Type variables can't be used in static members.
|
||||
// static Class<Class<T>>? method2<S extends Class<Class<T>>>(Class<Class<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:38:42: Error: Type variables can't be used in static members.
|
||||
// static A<T>? method3<S extends A<T>>(A<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:38:12: Error: Type variables can't be used in static members.
|
||||
// static A<T>? method3<S extends A<T>>(A<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:47:50: Error: Type variables can't be used in static members.
|
||||
// static A<A<T>>? method4<S extends A<A<T>>>(A<A<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:47:14: Error: Type variables can't be used in static members.
|
||||
// static A<A<T>>? method4<S extends A<A<T>>>(A<A<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:56:42: Error: Type variables can't be used in static members.
|
||||
// static B<T>? method5<S extends B<T>>(B<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:56:12: Error: Type variables can't be used in static members.
|
||||
// static B<T>? method5<S extends B<T>>(B<T> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:65:50: Error: Type variables can't be used in static members.
|
||||
// static A<B<T>>? method6<S extends A<B<T>>>(A<B<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:65:14: Error: Type variables can't be used in static members.
|
||||
// static A<B<T>>? method6<S extends A<B<T>>>(A<B<T>> arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:80:10: Error: Type variables can't be used in static members.
|
||||
// static T field0;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:82:10: Error: Type variables can't be used in static members.
|
||||
// @Class<T>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:83:16: Error: Type variables can't be used in static members.
|
||||
// static Class<T>? field1;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:85:16: Error: Type variables can't be used in static members.
|
||||
// @Class<Class<T>>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:88:6: Error: Type variables can't be used in static members.
|
||||
// @A<T>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:91:6: Error: Type variables can't be used in static members.
|
||||
// @B<T>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:105:3: Error: Extensions can't declare constructors.
|
||||
// Try removing the constructor declaration.
|
||||
// Extension(T t);
|
||||
// ^^^^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:107:3: Error: Extensions can't declare constructors.
|
||||
// Try removing the constructor declaration.
|
||||
// factory Extension.fact(T t) => null;
|
||||
// ^^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:113:5: Error: Extensions can't declare instance fields
|
||||
// Try removing the field declaration or making it a static field
|
||||
// T field1;
|
||||
// ^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:110:10: Error: Type variables can't be used in static members.
|
||||
// static T field0;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:116:39: Error: Type variables can't be used in static members.
|
||||
// static T? staticMethod<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:116:10: Error: Type variables can't be used in static members.
|
||||
// static T? staticMethod<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:116:36: Error: Type variables can't be used in static members.
|
||||
// static T? staticMethod<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:116:39: Error: Type variables can't be used in static members.
|
||||
// static T? staticMethod<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:130:3: Error: Mixins can't declare constructors.
|
||||
// Mixin(T t);
|
||||
// ^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:132:3: Error: Mixins can't declare constructors.
|
||||
// factory Mixin.fact(T t) => null;
|
||||
// ^^^^^^^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:135:10: Error: Type variables can't be used in static members.
|
||||
// static T field0;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:138:39: Error: Type variables can't be used in static members.
|
||||
// static T? staticMethod<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:138:10: Error: Type variables can't be used in static members.
|
||||
// static T? staticMethod<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:138:36: Error: Type variables can't be used in static members.
|
||||
// static T? staticMethod<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:138:39: Error: Type variables can't be used in static members.
|
||||
// static T? staticMethod<S extends T>(T arg) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:92:24: Error: Type variables can't be used in static members.
|
||||
// static var field4 = (T t) => T;
|
||||
// ^
|
||||
|
@ -181,50 +217,10 @@ library /*isNonNullableByDefault*/;
|
|||
// @T()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:19:10: Error: Type variables can't be used in static members.
|
||||
// @Class<T>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:28:16: Error: Type variables can't be used in static members.
|
||||
// @Class<Class<T>>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:37:6: Error: Type variables can't be used in static members.
|
||||
// @A<T>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:46:8: Error: Type variables can't be used in static members.
|
||||
// @A<A<T>>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:55:6: Error: Type variables can't be used in static members.
|
||||
// @B<T>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:64:8: Error: Type variables can't be used in static members.
|
||||
// @A<B<T>>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:79:4: Error: Couldn't find constructor 'T'.
|
||||
// @T()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:82:10: Error: Type variables can't be used in static members.
|
||||
// @Class<T>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:85:16: Error: Type variables can't be used in static members.
|
||||
// @Class<Class<T>>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:88:6: Error: Type variables can't be used in static members.
|
||||
// @A<T>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:91:6: Error: Type variables can't be used in static members.
|
||||
// @B<T>()
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_in_static_context.dart:94:4: Error: Couldn't find constructor 'T'.
|
||||
// @T()
|
||||
// ^
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
// Copyright (c) 2022, 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 method<S>(S<int> a) {}
|
||||
|
||||
class Class<T> {
|
||||
void method<S>(T<int> a, S<int> b) {
|
||||
local<U>(U<int> a) {}
|
||||
}
|
||||
}
|
||||
|
||||
main() {}
|
|
@ -0,0 +1,7 @@
|
|||
void method<S>(S<int> a) {}
|
||||
|
||||
class Class<T> {
|
||||
void method<S>(T<int> a, S<int> b) {}
|
||||
}
|
||||
|
||||
main() {}
|
|
@ -0,0 +1,6 @@
|
|||
class Class<T> {
|
||||
void method<S>(T<int> a, S<int> b) {}
|
||||
}
|
||||
|
||||
main() {}
|
||||
void method<S>(S<int> a) {}
|
|
@ -0,0 +1,37 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_type_arguments.dart:5:16: Error: Can't use type arguments with type variable 'S'.
|
||||
// Try removing the type arguments.
|
||||
// void method<S>(S<int> a) {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_type_arguments.dart:8:28: Error: Can't use type arguments with type variable 'S'.
|
||||
// Try removing the type arguments.
|
||||
// void method<S>(T<int> a, S<int> b) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_type_arguments.dart:8:18: Error: Can't use type arguments with type variable 'T'.
|
||||
// Try removing the type arguments.
|
||||
// void method<S>(T<int> a, S<int> b) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_type_arguments.dart:9:14: Error: Can't use type arguments with type variable 'U'.
|
||||
// Try removing the type arguments.
|
||||
// local<U>(U<int> a) {}
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class Class<T extends core::Object? = dynamic> extends core::Object {
|
||||
synthetic constructor •() → self::Class<self::Class::T%>
|
||||
: super core::Object::•()
|
||||
;
|
||||
method method<S extends core::Object? = dynamic>(invalid-type a, invalid-type b) → void {
|
||||
function local<U extends core::Object? = dynamic>(invalid-type a) → Null {}
|
||||
}
|
||||
}
|
||||
static method method<S extends core::Object? = dynamic>(invalid-type a) → void {}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,37 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_type_arguments.dart:5:16: Error: Can't use type arguments with type variable 'S'.
|
||||
// Try removing the type arguments.
|
||||
// void method<S>(S<int> a) {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_type_arguments.dart:8:28: Error: Can't use type arguments with type variable 'S'.
|
||||
// Try removing the type arguments.
|
||||
// void method<S>(T<int> a, S<int> b) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_type_arguments.dart:8:18: Error: Can't use type arguments with type variable 'T'.
|
||||
// Try removing the type arguments.
|
||||
// void method<S>(T<int> a, S<int> b) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_type_arguments.dart:9:14: Error: Can't use type arguments with type variable 'U'.
|
||||
// Try removing the type arguments.
|
||||
// local<U>(U<int> a) {}
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class Class<T extends core::Object? = dynamic> extends core::Object {
|
||||
synthetic constructor •() → self::Class<self::Class::T%>
|
||||
: super core::Object::•()
|
||||
;
|
||||
method method<S extends core::Object? = dynamic>(invalid-type a, invalid-type b) → void {
|
||||
function local<U extends core::Object? = dynamic>(invalid-type a) → Null {}
|
||||
}
|
||||
}
|
||||
static method method<S extends core::Object? = dynamic>(invalid-type a) → void {}
|
||||
static method main() → dynamic {}
|
|
@ -0,0 +1,32 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_type_arguments.dart:5:16: Error: Can't use type arguments with type variable 'S'.
|
||||
// Try removing the type arguments.
|
||||
// void method<S>(S<int> a) {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_type_arguments.dart:8:28: Error: Can't use type arguments with type variable 'S'.
|
||||
// Try removing the type arguments.
|
||||
// void method<S>(T<int> a, S<int> b) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_type_arguments.dart:8:18: Error: Can't use type arguments with type variable 'T'.
|
||||
// Try removing the type arguments.
|
||||
// void method<S>(T<int> a, S<int> b) {
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class Class<T extends core::Object? = dynamic> extends core::Object {
|
||||
synthetic constructor •() → self::Class<self::Class::T%>
|
||||
;
|
||||
method method<S extends core::Object? = dynamic>(invalid-type a, invalid-type b) → void
|
||||
;
|
||||
}
|
||||
static method method<S extends core::Object? = dynamic>(invalid-type a) → void
|
||||
;
|
||||
static method main() → dynamic
|
||||
;
|
|
@ -0,0 +1,37 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_type_arguments.dart:5:16: Error: Can't use type arguments with type variable 'S'.
|
||||
// Try removing the type arguments.
|
||||
// void method<S>(S<int> a) {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_type_arguments.dart:8:28: Error: Can't use type arguments with type variable 'S'.
|
||||
// Try removing the type arguments.
|
||||
// void method<S>(T<int> a, S<int> b) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_type_arguments.dart:8:18: Error: Can't use type arguments with type variable 'T'.
|
||||
// Try removing the type arguments.
|
||||
// void method<S>(T<int> a, S<int> b) {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/type_variable_type_arguments.dart:9:14: Error: Can't use type arguments with type variable 'U'.
|
||||
// Try removing the type arguments.
|
||||
// local<U>(U<int> a) {}
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
class Class<T extends core::Object? = dynamic> extends core::Object {
|
||||
synthetic constructor •() → self::Class<self::Class::T%>
|
||||
: super core::Object::•()
|
||||
;
|
||||
method method<S extends core::Object? = dynamic>(invalid-type a, invalid-type b) → void {
|
||||
function local<U extends core::Object? = dynamic>(invalid-type a) → Null {}
|
||||
}
|
||||
}
|
||||
static method method<S extends core::Object? = dynamic>(invalid-type a) → void {}
|
||||
static method main() → dynamic {}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue