[cfe] Refactor bounds checking
This CL moves the bounds checking into the TypeBuilder instead of
performing it from the outside on the computed DartType node.
This solves several problems:
1) Errors are now reported on the type in the code instead of the
declaration which holds the type.
2) Checking of type aliases (both function and nonfunction type
aliases) is now handled correctly in all cases. This achieved by
computed the aliased type (containing TypedefType nodes)
internally and performing the checking on this type, and only
convert the type into the unaliased version (without TypedefType
nodes) after checks have been performed. Previously this handled
through the FunctionType.typedefType property for function type
aliases and through and incomplete work-around for nonfunction
type aliases.
3) With 2) FunctionType.typedefType is no longer needed and is
removed.
TEST=general/bounds_*
Change-Id: I7653bca5ccb0ebf4b3553828a298d1ad918ef235
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243722
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
This commit is contained in:
committed by
Commit Bot
parent
2037563b94
commit
5222bfd90c
@@ -120,8 +120,7 @@ class StaticInteropClassEraser extends Transformer {
|
||||
signatureType.declaredNullability,
|
||||
namedParameters: signatureType.namedParameters,
|
||||
typeParameters: signatureType.typeParameters,
|
||||
requiredParameterCount: signatureType.requiredParameterCount,
|
||||
typedefType: signatureType.typedefType);
|
||||
requiredParameterCount: signatureType.requiredParameterCount);
|
||||
}
|
||||
return newProcedure;
|
||||
}
|
||||
|
||||
@@ -133,8 +133,6 @@ class DartTypeNodeWriter
|
||||
_sink.writeBool(parameter.isRequired);
|
||||
_sink._writeDartTypeNode(parameter.type, functionTypeVariables);
|
||||
}
|
||||
_sink._writeDartTypeNode(node.typedefType, functionTypeVariables,
|
||||
allowNull: true);
|
||||
_sink.end(functionTypeNodeTag);
|
||||
}
|
||||
|
||||
|
||||
@@ -767,13 +767,11 @@ class DataSourceReader implements migrated.DataSourceReader {
|
||||
namedParameters[index] =
|
||||
ir.NamedType(name, type, isRequired: isRequired);
|
||||
}
|
||||
ir.TypedefType typedefType = _readDartTypeNode(functionTypeVariables);
|
||||
end(functionTypeNodeTag);
|
||||
return ir.FunctionType(positionalParameters, returnType, nullability,
|
||||
namedParameters: namedParameters,
|
||||
typeParameters: typeParameters,
|
||||
requiredParameterCount: requiredParameterCount,
|
||||
typedefType: typedefType);
|
||||
requiredParameterCount: requiredParameterCount);
|
||||
|
||||
case DartTypeNodeKind.interfaceType:
|
||||
ir.Class cls = readClassNode();
|
||||
|
||||
@@ -25,14 +25,26 @@ abstract class BuiltinTypeDeclarationBuilder
|
||||
super(null, 0, name, compilationUnit, charOffset);
|
||||
|
||||
@override
|
||||
DartType buildType(LibraryBuilder library,
|
||||
NullabilityBuilder nullabilityBuilder, List<TypeBuilder>? arguments) {
|
||||
DartType buildAliasedType(
|
||||
LibraryBuilder library,
|
||||
NullabilityBuilder nullabilityBuilder,
|
||||
List<TypeBuilder>? arguments,
|
||||
TypeUse typeUse,
|
||||
Uri fileUri,
|
||||
int charOffset,
|
||||
{required bool hasExplicitTypeArguments}) {
|
||||
return type.withDeclaredNullability(nullabilityBuilder.build(library));
|
||||
}
|
||||
|
||||
@override
|
||||
DartType buildTypeWithBuiltArguments(LibraryBuilder library,
|
||||
Nullability nullability, List<DartType> arguments) {
|
||||
DartType buildAliasedTypeWithBuiltArguments(
|
||||
LibraryBuilder library,
|
||||
Nullability nullability,
|
||||
List<DartType> arguments,
|
||||
TypeUse typeUse,
|
||||
Uri fileUri,
|
||||
int charOffset,
|
||||
{required bool hasExplicitTypeArguments}) {
|
||||
return type.withDeclaredNullability(nullability);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,13 +18,14 @@ import 'package:kernel/ast.dart'
|
||||
Supertype,
|
||||
getAsTypeArguments;
|
||||
import 'package:kernel/class_hierarchy.dart' show ClassHierarchy;
|
||||
import 'package:kernel/src/legacy_erasure.dart';
|
||||
import 'package:kernel/src/unaliasing.dart';
|
||||
import 'package:kernel/text/text_serialization_verifier.dart';
|
||||
|
||||
import '../fasta_codes.dart';
|
||||
import '../modifier.dart';
|
||||
import '../problems.dart' show internalProblem, unhandled;
|
||||
import '../scope.dart';
|
||||
import '../source/source_library_builder.dart';
|
||||
import '../type_inference/type_schema.dart' show UnknownType;
|
||||
import 'builder.dart';
|
||||
import 'declaration_builder.dart';
|
||||
@@ -98,10 +99,7 @@ abstract class ClassBuilder implements DeclarationBuilder {
|
||||
|
||||
InterfaceType rawType(Nullability nullability);
|
||||
|
||||
List<DartType> buildTypeArguments(
|
||||
LibraryBuilder library, List<TypeBuilder>? arguments);
|
||||
|
||||
Supertype buildSupertype(
|
||||
List<DartType> buildAliasedTypeArguments(
|
||||
LibraryBuilder library, List<TypeBuilder>? arguments);
|
||||
|
||||
Supertype buildMixedInType(
|
||||
@@ -310,8 +308,14 @@ abstract class ClassBuilderImpl extends DeclarationBuilderImpl
|
||||
}
|
||||
|
||||
@override
|
||||
DartType buildTypeWithBuiltArguments(LibraryBuilder library,
|
||||
Nullability nullability, List<DartType>? arguments) {
|
||||
DartType buildAliasedTypeWithBuiltArguments(
|
||||
LibraryBuilder library,
|
||||
Nullability nullability,
|
||||
List<DartType>? arguments,
|
||||
TypeUse typeUse,
|
||||
Uri fileUri,
|
||||
int charOffset,
|
||||
{required bool hasExplicitTypeArguments}) {
|
||||
assert(arguments == null || cls.typeParameters.length == arguments.length);
|
||||
if (isNullClass) {
|
||||
return const NullType();
|
||||
@@ -324,31 +328,33 @@ abstract class ClassBuilderImpl extends DeclarationBuilderImpl
|
||||
return new FutureOrType(arguments!.single, nullability);
|
||||
}
|
||||
}
|
||||
return arguments == null
|
||||
DartType type = arguments == null
|
||||
? rawType(nullability)
|
||||
: new InterfaceType(cls, nullability, arguments);
|
||||
if (typeVariablesCount != 0 && library is SourceLibraryBuilder) {
|
||||
library.registerBoundsCheck(type, fileUri, charOffset, typeUse,
|
||||
inferred: !hasExplicitTypeArguments);
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
@override
|
||||
DartType buildType(LibraryBuilder library,
|
||||
NullabilityBuilder nullabilityBuilder, List<TypeBuilder>? arguments) {
|
||||
return buildTypeWithBuiltArguments(
|
||||
DartType buildAliasedType(
|
||||
LibraryBuilder library,
|
||||
NullabilityBuilder nullabilityBuilder,
|
||||
List<TypeBuilder>? arguments,
|
||||
TypeUse typeUse,
|
||||
Uri fileUri,
|
||||
int charOffset,
|
||||
{required bool hasExplicitTypeArguments}) {
|
||||
return buildAliasedTypeWithBuiltArguments(
|
||||
library,
|
||||
nullabilityBuilder.build(library),
|
||||
buildTypeArguments(library, arguments));
|
||||
}
|
||||
|
||||
@override
|
||||
Supertype buildSupertype(
|
||||
LibraryBuilder library, List<TypeBuilder>? arguments) {
|
||||
Class cls = isPatch ? origin.cls : this.cls;
|
||||
List<DartType> typeArguments = buildTypeArguments(library, arguments);
|
||||
if (!library.isNonNullableByDefault) {
|
||||
for (int i = 0; i < typeArguments.length; ++i) {
|
||||
typeArguments[i] = legacyErasure(typeArguments[i]);
|
||||
}
|
||||
}
|
||||
return new Supertype(cls, typeArguments);
|
||||
buildAliasedTypeArguments(library, arguments),
|
||||
typeUse,
|
||||
fileUri,
|
||||
charOffset,
|
||||
hasExplicitTypeArguments: hasExplicitTypeArguments);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -356,7 +362,11 @@ abstract class ClassBuilderImpl extends DeclarationBuilderImpl
|
||||
LibraryBuilder library, List<TypeBuilder>? arguments) {
|
||||
Class cls = isPatch ? origin.cls : this.cls;
|
||||
if (arguments != null) {
|
||||
return new Supertype(cls, buildTypeArguments(library, arguments));
|
||||
List<DartType> typeArguments =
|
||||
buildAliasedTypeArguments(library, arguments);
|
||||
typeArguments = unaliasTypes(typeArguments,
|
||||
legacyEraseAliases: !library.isNonNullableByDefault)!;
|
||||
return new Supertype(cls, typeArguments);
|
||||
} else {
|
||||
return new Supertype(
|
||||
cls,
|
||||
|
||||
@@ -72,14 +72,24 @@ abstract class ExtensionBuilderImpl extends DeclarationBuilderImpl
|
||||
}
|
||||
|
||||
@override
|
||||
DartType buildType(LibraryBuilder library,
|
||||
NullabilityBuilder nullabilityBuilder, List<TypeBuilder>? arguments) {
|
||||
DartType buildAliasedType(
|
||||
LibraryBuilder library,
|
||||
NullabilityBuilder nullabilityBuilder,
|
||||
List<TypeBuilder>? arguments,
|
||||
TypeUse typeUse,
|
||||
Uri fileUri,
|
||||
int charOffset,
|
||||
{required bool hasExplicitTypeArguments}) {
|
||||
if (library is SourceLibraryBuilder &&
|
||||
library.libraryFeatures.extensionTypes.isEnabled) {
|
||||
return buildTypeWithBuiltArguments(
|
||||
return buildAliasedTypeWithBuiltArguments(
|
||||
library,
|
||||
nullabilityBuilder.build(library),
|
||||
_buildTypeArguments(library, arguments));
|
||||
_buildAliasedTypeArguments(library, arguments),
|
||||
typeUse,
|
||||
fileUri,
|
||||
charOffset,
|
||||
hasExplicitTypeArguments: hasExplicitTypeArguments);
|
||||
} else {
|
||||
throw new UnsupportedError("ExtensionBuilder.buildType is not supported"
|
||||
"in library '${library.importUri}'.");
|
||||
@@ -87,8 +97,14 @@ abstract class ExtensionBuilderImpl extends DeclarationBuilderImpl
|
||||
}
|
||||
|
||||
@override
|
||||
DartType buildTypeWithBuiltArguments(LibraryBuilder library,
|
||||
Nullability nullability, List<DartType> arguments) {
|
||||
DartType buildAliasedTypeWithBuiltArguments(
|
||||
LibraryBuilder library,
|
||||
Nullability nullability,
|
||||
List<DartType> arguments,
|
||||
TypeUse typeUse,
|
||||
Uri fileUri,
|
||||
int charOffset,
|
||||
{required bool hasExplicitTypeArguments}) {
|
||||
if (library is SourceLibraryBuilder &&
|
||||
library.libraryFeatures.extensionTypes.isEnabled) {
|
||||
return new ExtensionType(extension, nullability, arguments);
|
||||
@@ -102,7 +118,7 @@ abstract class ExtensionBuilderImpl extends DeclarationBuilderImpl
|
||||
@override
|
||||
int get typeVariablesCount => typeParameters?.length ?? 0;
|
||||
|
||||
List<DartType> _buildTypeArguments(
|
||||
List<DartType> _buildAliasedTypeArguments(
|
||||
LibraryBuilder library, List<TypeBuilder>? arguments) {
|
||||
if (arguments == null && typeParameters == null) {
|
||||
return <DartType>[];
|
||||
@@ -111,7 +127,9 @@ abstract class ExtensionBuilderImpl extends DeclarationBuilderImpl
|
||||
if (arguments == null && typeParameters != null) {
|
||||
List<DartType> result =
|
||||
new List<DartType>.generate(typeParameters!.length, (int i) {
|
||||
return typeParameters![i].defaultType!.build(library);
|
||||
return typeParameters![i]
|
||||
.defaultType!
|
||||
.buildAliased(library, TypeUse.defaultTypeAsTypeArgument);
|
||||
}, growable: true);
|
||||
if (library is SourceLibraryBuilder) {
|
||||
library.inferredTypes.addAll(result);
|
||||
@@ -133,7 +151,7 @@ abstract class ExtensionBuilderImpl extends DeclarationBuilderImpl
|
||||
assert(arguments!.length == typeVariablesCount);
|
||||
List<DartType> result =
|
||||
new List<DartType>.generate(arguments!.length, (int i) {
|
||||
return arguments[i].build(library);
|
||||
return arguments[i].buildAliased(library, TypeUse.typeArgument);
|
||||
}, growable: true);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,12 @@ class FixedTypeBuilder extends TypeBuilder {
|
||||
}
|
||||
|
||||
@override
|
||||
DartType build(LibraryBuilder library) {
|
||||
DartType build(LibraryBuilder library, TypeUse typeUse) {
|
||||
return type;
|
||||
}
|
||||
|
||||
@override
|
||||
DartType buildAliased(LibraryBuilder library, TypeUse typeUse) {
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
@@ -145,7 +145,7 @@ class FormalParameterBuilder extends ModifierBuilderImpl
|
||||
VariableDeclaration build(
|
||||
SourceLibraryBuilder library, int functionNestingLevel) {
|
||||
if (variable == null) {
|
||||
DartType? builtType = type?.build(library);
|
||||
DartType? builtType = type?.build(library, TypeUse.parameterType);
|
||||
variable = new VariableDeclarationImpl(
|
||||
name == noNameSentinel ? null : name, functionNestingLevel,
|
||||
type: builtType,
|
||||
|
||||
@@ -12,6 +12,7 @@ import 'package:kernel/ast.dart'
|
||||
NamedType,
|
||||
Supertype,
|
||||
TypeParameter;
|
||||
import 'package:kernel/src/unaliasing.dart';
|
||||
|
||||
import '../fasta_codes.dart' show messageSupertypeIsFunction, noLength;
|
||||
|
||||
@@ -84,19 +85,29 @@ class FunctionTypeBuilder extends TypeBuilder {
|
||||
}
|
||||
|
||||
@override
|
||||
FunctionType build(LibraryBuilder library) {
|
||||
return _type ??= _buildInternal(library);
|
||||
FunctionType build(LibraryBuilder library, TypeUse typeUse) {
|
||||
return _type ??= _buildInternal(library, typeUse) as FunctionType;
|
||||
}
|
||||
|
||||
FunctionType _buildInternal(LibraryBuilder library) {
|
||||
DartType _buildInternal(LibraryBuilder library, TypeUse typeUse) {
|
||||
DartType aliasedType = buildAliased(library, typeUse);
|
||||
return unalias(aliasedType,
|
||||
legacyEraseAliases: !library.isNonNullableByDefault);
|
||||
}
|
||||
|
||||
@override
|
||||
DartType buildAliased(LibraryBuilder library, TypeUse typeUse) {
|
||||
DartType builtReturnType =
|
||||
returnType?.build(library) ?? const DynamicType();
|
||||
returnType?.buildAliased(library, TypeUse.returnType) ??
|
||||
const DynamicType();
|
||||
List<DartType> positionalParameters = <DartType>[];
|
||||
List<NamedType>? namedParameters;
|
||||
int requiredParameterCount = 0;
|
||||
if (formals != null) {
|
||||
for (ParameterBuilder formal in formals!) {
|
||||
DartType type = formal.type?.build(library) ?? const DynamicType();
|
||||
DartType type =
|
||||
formal.type?.buildAliased(library, TypeUse.parameterType) ??
|
||||
const DynamicType();
|
||||
if (formal.isPositional) {
|
||||
positionalParameters.add(type);
|
||||
if (formal.isRequiredPositional) requiredParameterCount++;
|
||||
@@ -116,7 +127,7 @@ 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);
|
||||
t.bound?.build(library, TypeUse.typeParameterBound);
|
||||
}
|
||||
}
|
||||
return new FunctionType(positionalParameters, builtReturnType,
|
||||
|
||||
@@ -20,15 +20,28 @@ class FutureOrTypeDeclarationBuilder extends BuiltinTypeDeclarationBuilder {
|
||||
String get debugName => "FutureOrTypeDeclarationBuilder";
|
||||
|
||||
@override
|
||||
DartType buildType(LibraryBuilder library,
|
||||
NullabilityBuilder nullabilityBuilder, List<TypeBuilder>? arguments) {
|
||||
DartType buildAliasedType(
|
||||
LibraryBuilder library,
|
||||
NullabilityBuilder nullabilityBuilder,
|
||||
List<TypeBuilder>? arguments,
|
||||
TypeUse typeUse,
|
||||
Uri fileUri,
|
||||
int charOffset,
|
||||
{required bool hasExplicitTypeArguments}) {
|
||||
return new FutureOrType(
|
||||
arguments!.single.build(library), nullabilityBuilder.build(library));
|
||||
arguments!.single.buildAliased(library, TypeUse.typeArgument),
|
||||
nullabilityBuilder.build(library));
|
||||
}
|
||||
|
||||
@override
|
||||
DartType buildTypeWithBuiltArguments(LibraryBuilder library,
|
||||
Nullability nullability, List<DartType> arguments) {
|
||||
DartType buildAliasedTypeWithBuiltArguments(
|
||||
LibraryBuilder library,
|
||||
Nullability nullability,
|
||||
List<DartType> arguments,
|
||||
TypeUse typeUse,
|
||||
Uri fileUri,
|
||||
int charOffset,
|
||||
{required bool hasExplicitTypeArguments}) {
|
||||
return new FutureOrType(arguments.single, nullability);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,15 +33,29 @@ class InvalidTypeDeclarationBuilder extends TypeDeclarationBuilderImpl
|
||||
Uri? get fileUri => message.uri;
|
||||
|
||||
@override
|
||||
DartType buildType(LibraryBuilder library,
|
||||
NullabilityBuilder nullabilityBuilder, List<TypeBuilder>? arguments) {
|
||||
return buildTypeWithBuiltArguments(library, null, null);
|
||||
DartType buildAliasedType(
|
||||
LibraryBuilder library,
|
||||
NullabilityBuilder nullabilityBuilder,
|
||||
List<TypeBuilder>? arguments,
|
||||
TypeUse typeUse,
|
||||
Uri fileUri,
|
||||
int charOffset,
|
||||
{required bool hasExplicitTypeArguments}) {
|
||||
return buildAliasedTypeWithBuiltArguments(
|
||||
library, null, null, typeUse, fileUri, charOffset,
|
||||
hasExplicitTypeArguments: hasExplicitTypeArguments);
|
||||
}
|
||||
|
||||
/// [Arguments] have already been built.
|
||||
@override
|
||||
DartType buildTypeWithBuiltArguments(LibraryBuilder library,
|
||||
Nullability? nullability, List<DartType>? arguments) {
|
||||
DartType buildAliasedTypeWithBuiltArguments(
|
||||
LibraryBuilder library,
|
||||
Nullability? nullability,
|
||||
List<DartType>? arguments,
|
||||
TypeUse typeUse,
|
||||
Uri fileUri,
|
||||
int charOffset,
|
||||
{required bool hasExplicitTypeArguments}) {
|
||||
if (!suppressMessage) {
|
||||
library.addProblem(message.messageObject, message.charOffset,
|
||||
message.length, message.uri,
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
library fasta.named_type_builder;
|
||||
|
||||
import 'package:kernel/ast.dart';
|
||||
import 'package:kernel/src/legacy_erasure.dart';
|
||||
import 'package:kernel/src/unaliasing.dart';
|
||||
|
||||
import '../fasta_codes.dart'
|
||||
show
|
||||
@@ -25,15 +27,11 @@ import '../fasta_codes.dart'
|
||||
templateTypeArgumentMismatch,
|
||||
templateTypeArgumentsOnTypeVariable,
|
||||
templateTypeNotFound;
|
||||
|
||||
import '../identifiers.dart' show Identifier, QualifiedName, flattenName;
|
||||
|
||||
import '../problems.dart' show unhandled;
|
||||
|
||||
import '../scope.dart';
|
||||
|
||||
import '../source/source_library_builder.dart';
|
||||
|
||||
import '../uris.dart';
|
||||
import 'builder.dart';
|
||||
import 'builtin_type_declaration_builder.dart';
|
||||
import 'class_builder.dart';
|
||||
@@ -114,6 +112,8 @@ class NamedTypeBuilder extends TypeBuilder {
|
||||
|
||||
DartType? _type;
|
||||
|
||||
final bool hasExplicitTypeArguments;
|
||||
|
||||
NamedTypeBuilder(this.name, this.nullabilityBuilder,
|
||||
{this.arguments,
|
||||
this.fileUri,
|
||||
@@ -122,7 +122,8 @@ class NamedTypeBuilder extends TypeBuilder {
|
||||
bool forTypeLiteral: false})
|
||||
: assert(name is String || name is QualifiedName),
|
||||
this._instanceTypeVariableAccess = instanceTypeVariableAccess,
|
||||
this._forTypeLiteral = forTypeLiteral;
|
||||
this._forTypeLiteral = forTypeLiteral,
|
||||
this.hasExplicitTypeArguments = arguments != null;
|
||||
|
||||
NamedTypeBuilder.forDartType(DartType this._type,
|
||||
TypeDeclarationBuilder this._declaration, this.nullabilityBuilder,
|
||||
@@ -132,7 +133,8 @@ class NamedTypeBuilder extends TypeBuilder {
|
||||
InstanceTypeVariableAccessState.Unexpected,
|
||||
this.fileUri = null,
|
||||
this.charOffset = null,
|
||||
this._forTypeLiteral = false;
|
||||
this._forTypeLiteral = false,
|
||||
this.hasExplicitTypeArguments = arguments != null;
|
||||
|
||||
NamedTypeBuilder.fromTypeDeclarationBuilder(
|
||||
TypeDeclarationBuilder this._declaration, this.nullabilityBuilder,
|
||||
@@ -144,7 +146,8 @@ class NamedTypeBuilder extends TypeBuilder {
|
||||
: this.name = _declaration.name,
|
||||
this._forTypeLiteral = false,
|
||||
this._instanceTypeVariableAccess = instanceTypeVariableAccess,
|
||||
this._type = type;
|
||||
this._type = type,
|
||||
this.hasExplicitTypeArguments = arguments != null;
|
||||
|
||||
NamedTypeBuilder.forInvalidType(
|
||||
String this.name, this.nullabilityBuilder, LocatedMessage message,
|
||||
@@ -156,7 +159,8 @@ class NamedTypeBuilder extends TypeBuilder {
|
||||
this._instanceTypeVariableAccess =
|
||||
InstanceTypeVariableAccessState.Unexpected,
|
||||
this._forTypeLiteral = false,
|
||||
this._type = const InvalidType();
|
||||
this._type = const InvalidType(),
|
||||
this.hasExplicitTypeArguments = false;
|
||||
|
||||
@override
|
||||
TypeDeclarationBuilder? get declaration => _declaration;
|
||||
@@ -378,55 +382,57 @@ class NamedTypeBuilder extends TypeBuilder {
|
||||
}
|
||||
|
||||
@override
|
||||
DartType build(LibraryBuilder library) {
|
||||
return _type ??= _buildInternal(library);
|
||||
DartType build(LibraryBuilder library, TypeUse typeUse) {
|
||||
return _type ??= _buildInternal(library, typeUse);
|
||||
}
|
||||
|
||||
DartType _declarationBuildType(LibraryBuilder library) {
|
||||
if (_forTypeLiteral) {
|
||||
return declaration!
|
||||
.buildTypeLiteralType(library, nullabilityBuilder, arguments);
|
||||
} else {
|
||||
return declaration!.buildType(library, nullabilityBuilder, arguments);
|
||||
}
|
||||
DartType _buildInternal(LibraryBuilder library, TypeUse typeUse) {
|
||||
DartType aliasedType = _buildAliasedInternal(library, typeUse);
|
||||
return unalias(aliasedType,
|
||||
legacyEraseAliases:
|
||||
!_forTypeLiteral && !library.isNonNullableByDefault);
|
||||
}
|
||||
|
||||
DartType _buildInternal(LibraryBuilder library) {
|
||||
@override
|
||||
DartType buildAliased(LibraryBuilder library, TypeUse typeUse) {
|
||||
return _buildAliasedInternal(library, typeUse);
|
||||
}
|
||||
|
||||
DartType _buildAliasedInternal(LibraryBuilder library, TypeUse typeUse) {
|
||||
assert(declaration != null, "Declaration has not been resolved on $this.");
|
||||
if (library is SourceLibraryBuilder) {
|
||||
int uncheckedTypedefTypeCount = library.uncheckedTypedefTypes.length;
|
||||
DartType builtType = _declarationBuildType(library);
|
||||
// Set locations for new unchecked TypedefTypes for error reporting.
|
||||
for (int i = uncheckedTypedefTypeCount;
|
||||
i < library.uncheckedTypedefTypes.length;
|
||||
++i) {
|
||||
// TODO(johnniwinther): Pass the uri/offset through the build methods
|
||||
// to avoid this.
|
||||
library.uncheckedTypedefTypes[i]
|
||||
..fileUri ??= fileUri
|
||||
..offset ??= charOffset;
|
||||
}
|
||||
return builtType;
|
||||
} else {
|
||||
return _declarationBuildType(library);
|
||||
}
|
||||
return declaration!.buildAliasedType(library, nullabilityBuilder, arguments,
|
||||
typeUse, fileUri ?? missingUri, charOffset ?? TreeNode.noOffset,
|
||||
hasExplicitTypeArguments: hasExplicitTypeArguments);
|
||||
}
|
||||
|
||||
@override
|
||||
Supertype? buildSupertype(LibraryBuilder library) {
|
||||
TypeDeclarationBuilder declaration = this.declaration!;
|
||||
if (declaration is ClassBuilder) {
|
||||
if (declaration.isNullClass && !library.mayImplementRestrictedTypes) {
|
||||
library.addProblem(
|
||||
templateExtendingRestricted.withArguments(declaration.name),
|
||||
charOffset!,
|
||||
noLength,
|
||||
fileUri);
|
||||
if (declaration.isNullClass) {
|
||||
if (!library.mayImplementRestrictedTypes) {
|
||||
library.addProblem(
|
||||
templateExtendingRestricted.withArguments(declaration.name),
|
||||
charOffset!,
|
||||
noLength,
|
||||
fileUri);
|
||||
}
|
||||
}
|
||||
DartType type = build(library, TypeUse.superType);
|
||||
if (type is InterfaceType) {
|
||||
if (!library.isNonNullableByDefault) {
|
||||
// This "normalizes" type argument `Never*` to `Null`.
|
||||
type = legacyErasure(type) as InterfaceType;
|
||||
}
|
||||
return new Supertype(type.classNode, type.typeArguments);
|
||||
} else if (type is FutureOrType) {
|
||||
return new Supertype(declaration.cls, [type.typeArgument]);
|
||||
} else if (type is NullType) {
|
||||
return new Supertype(declaration.cls, []);
|
||||
}
|
||||
return declaration.buildSupertype(library, arguments);
|
||||
} else if (declaration is TypeAliasBuilder) {
|
||||
TypeAliasBuilder aliasBuilder = declaration;
|
||||
DartType type = build(library);
|
||||
DartType type = build(library, TypeUse.superType);
|
||||
if (type is InterfaceType && type.nullability != Nullability.nullable) {
|
||||
return new Supertype(type.classNode, type.typeArguments);
|
||||
} else if (type is NullType) {
|
||||
@@ -490,7 +496,7 @@ class NamedTypeBuilder extends TypeBuilder {
|
||||
return declaration.buildMixedInType(library, arguments);
|
||||
} else if (declaration is TypeAliasBuilder) {
|
||||
TypeAliasBuilder aliasBuilder = declaration;
|
||||
DartType type = build(library);
|
||||
DartType type = build(library, TypeUse.mixedInType);
|
||||
if (type is InterfaceType && type.nullability != Nullability.nullable) {
|
||||
return new Supertype(type.classNode, type.typeArguments);
|
||||
}
|
||||
|
||||
@@ -10,27 +10,40 @@ import 'builtin_type_declaration_builder.dart';
|
||||
import 'library_builder.dart';
|
||||
import 'nullability_builder.dart';
|
||||
import 'type_builder.dart';
|
||||
import '../uris.dart';
|
||||
|
||||
class NeverTypeDeclarationBuilder extends BuiltinTypeDeclarationBuilder {
|
||||
final LibraryBuilder coreLibrary;
|
||||
|
||||
NeverTypeDeclarationBuilder(DartType type, this.coreLibrary, int charOffset)
|
||||
: super("Never", type, coreLibrary, charOffset) {
|
||||
assert(coreLibrary.importUri == Uri.parse('dart:core'));
|
||||
assert(coreLibrary.importUri == dartCore);
|
||||
}
|
||||
|
||||
@override
|
||||
String get debugName => "NeverTypeDeclarationBuilder";
|
||||
|
||||
@override
|
||||
DartType buildType(LibraryBuilder library,
|
||||
NullabilityBuilder nullabilityBuilder, List<TypeBuilder>? arguments) {
|
||||
DartType buildAliasedType(
|
||||
LibraryBuilder library,
|
||||
NullabilityBuilder nullabilityBuilder,
|
||||
List<TypeBuilder>? arguments,
|
||||
TypeUse typeUse,
|
||||
Uri fileUri,
|
||||
int charOffset,
|
||||
{required bool hasExplicitTypeArguments}) {
|
||||
return type.withDeclaredNullability(nullabilityBuilder.build(library));
|
||||
}
|
||||
|
||||
@override
|
||||
DartType buildTypeWithBuiltArguments(LibraryBuilder library,
|
||||
Nullability nullability, List<DartType> arguments) {
|
||||
DartType buildAliasedTypeWithBuiltArguments(
|
||||
LibraryBuilder library,
|
||||
Nullability nullability,
|
||||
List<DartType> arguments,
|
||||
TypeUse typeUse,
|
||||
Uri fileUri,
|
||||
int charOffset,
|
||||
{required bool hasExplicitTypeArguments}) {
|
||||
return type.withDeclaredNullability(nullability);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,14 +20,26 @@ class NullTypeDeclarationBuilder extends BuiltinTypeDeclarationBuilder {
|
||||
String get debugName => "NullTypeBuilder";
|
||||
|
||||
@override
|
||||
DartType buildType(LibraryBuilder library,
|
||||
NullabilityBuilder nullabilityBuilder, List<TypeBuilder>? arguments) {
|
||||
DartType buildAliasedType(
|
||||
LibraryBuilder library,
|
||||
NullabilityBuilder nullabilityBuilder,
|
||||
List<TypeBuilder>? arguments,
|
||||
TypeUse typeUse,
|
||||
Uri fileUri,
|
||||
int charOffset,
|
||||
{required bool hasExplicitTypeArguments}) {
|
||||
return type;
|
||||
}
|
||||
|
||||
@override
|
||||
DartType buildTypeWithBuiltArguments(LibraryBuilder library,
|
||||
Nullability nullability, List<DartType> arguments) {
|
||||
DartType buildAliasedTypeWithBuiltArguments(
|
||||
LibraryBuilder library,
|
||||
Nullability nullability,
|
||||
List<DartType> arguments,
|
||||
TypeUse typeUse,
|
||||
Uri fileUri,
|
||||
int charOffset,
|
||||
{required bool hasExplicitTypeArguments}) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,9 +5,6 @@
|
||||
library fasta.function_type_alias_builder;
|
||||
|
||||
import 'package:kernel/ast.dart';
|
||||
import 'package:kernel/src/legacy_erasure.dart';
|
||||
|
||||
import 'package:kernel/type_algebra.dart' show substitute, uniteNullabilities;
|
||||
|
||||
import '../fasta_codes.dart'
|
||||
show
|
||||
@@ -55,12 +52,7 @@ abstract class TypeAliasBuilder implements TypeDeclarationBuilder {
|
||||
|
||||
DartType buildThisType();
|
||||
|
||||
/// [arguments] have already been built.
|
||||
@override
|
||||
DartType buildTypeWithBuiltArguments(LibraryBuilder library,
|
||||
Nullability nullability, List<DartType>? arguments);
|
||||
|
||||
List<DartType> buildTypeArguments(
|
||||
List<DartType> buildAliasedTypeArguments(
|
||||
LibraryBuilder library, List<TypeBuilder>? arguments);
|
||||
|
||||
/// Returns `true` if this typedef is an alias of the `Null` type.
|
||||
@@ -153,81 +145,50 @@ abstract class TypeAliasBuilderImpl extends TypeDeclarationBuilderImpl
|
||||
|
||||
/// [arguments] have already been built.
|
||||
@override
|
||||
DartType buildTypeWithBuiltArguments(LibraryBuilder library,
|
||||
Nullability nullability, List<DartType>? arguments) {
|
||||
DartType thisType = buildThisType();
|
||||
if (const DynamicType() == thisType) return thisType;
|
||||
Nullability adjustedNullability =
|
||||
isNullAlias ? Nullability.nullable : nullability;
|
||||
DartType result = thisType.withDeclaredNullability(adjustedNullability);
|
||||
// TODO(johnniwinther): Couldn't [arguments] be null and
|
||||
// `typedef.typeParameters` be non-empty?
|
||||
if (typedef.typeParameters.isEmpty && arguments == null) return result;
|
||||
Map<TypeParameter, DartType> substitution = <TypeParameter, DartType>{};
|
||||
for (int i = 0; i < typedef.typeParameters.length; i++) {
|
||||
substitution[typedef.typeParameters[i]] = arguments![i];
|
||||
DartType buildAliasedTypeWithBuiltArguments(
|
||||
LibraryBuilder library,
|
||||
Nullability nullability,
|
||||
List<DartType>? arguments,
|
||||
TypeUse typeUse,
|
||||
Uri fileUri,
|
||||
int charOffset,
|
||||
{required bool hasExplicitTypeArguments}) {
|
||||
buildThisType();
|
||||
TypedefType type = new TypedefType(typedef, nullability, arguments);
|
||||
if (library is SourceLibraryBuilder) {
|
||||
if (typeVariablesCount != 0) {
|
||||
library.registerBoundsCheck(type, fileUri, charOffset, typeUse,
|
||||
inferred: !hasExplicitTypeArguments);
|
||||
}
|
||||
if (!library.libraryFeatures.genericMetadata.isEnabled) {
|
||||
library.registerGenericFunctionTypeCheck(type, fileUri, charOffset);
|
||||
}
|
||||
}
|
||||
// The following adds the built type to the list of unchecked typedef types
|
||||
// of the client library. It is needed because the type is built unaliased,
|
||||
// and at the time of the check it wouldn't be possible to see if the type
|
||||
// arguments to the generic typedef conform to the bounds without preserving
|
||||
// the TypedefType for the delayed check.
|
||||
if (library is SourceLibraryBuilder &&
|
||||
arguments!.isNotEmpty &&
|
||||
thisType is! FunctionType) {
|
||||
library.uncheckedTypedefTypes.add(new UncheckedTypedefType(
|
||||
new TypedefType(typedef, nullability, arguments)));
|
||||
}
|
||||
return substitute(result, substitution);
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
@override
|
||||
DartType buildType(LibraryBuilder library,
|
||||
NullabilityBuilder nullabilityBuilder, List<TypeBuilder>? arguments) {
|
||||
return buildTypeInternal(library, nullabilityBuilder, arguments,
|
||||
performLegacyErasure: true);
|
||||
}
|
||||
|
||||
@override
|
||||
DartType buildTypeLiteralType(LibraryBuilder library,
|
||||
NullabilityBuilder nullabilityBuilder, List<TypeBuilder>? arguments) {
|
||||
return buildTypeInternal(library, nullabilityBuilder, arguments,
|
||||
performLegacyErasure: false);
|
||||
}
|
||||
|
||||
DartType buildTypeInternal(LibraryBuilder library,
|
||||
NullabilityBuilder nullabilityBuilder, List<TypeBuilder>? arguments,
|
||||
{required bool performLegacyErasure}) {
|
||||
DartType buildAliasedType(
|
||||
LibraryBuilder library,
|
||||
NullabilityBuilder nullabilityBuilder,
|
||||
List<TypeBuilder>? arguments,
|
||||
TypeUse typeUse,
|
||||
Uri fileUri,
|
||||
int charOffset,
|
||||
{required bool hasExplicitTypeArguments}) {
|
||||
DartType thisType = buildThisType();
|
||||
if (thisType is InvalidType) return thisType;
|
||||
|
||||
// The following won't work if the right-hand side of the typedef is a
|
||||
// FutureOr.
|
||||
Nullability nullability;
|
||||
if (isNullAlias) {
|
||||
// Null is always nullable.
|
||||
nullability = Nullability.nullable;
|
||||
} else if (!parent.isNonNullableByDefault ||
|
||||
!library.isNonNullableByDefault) {
|
||||
// The typedef is defined or used in an opt-out library so the nullability
|
||||
// is based on the use site alone.
|
||||
nullability = nullabilityBuilder.build(library);
|
||||
} else {
|
||||
nullability = uniteNullabilities(
|
||||
thisType.declaredNullability, nullabilityBuilder.build(library));
|
||||
}
|
||||
DartType result;
|
||||
if (typedef.typeParameters.isEmpty && arguments == null) {
|
||||
result = thisType.withDeclaredNullability(nullability);
|
||||
} else {
|
||||
// Otherwise, substitute.
|
||||
result = buildTypeWithBuiltArguments(
|
||||
library, nullability, buildTypeArguments(library, arguments));
|
||||
}
|
||||
if (performLegacyErasure && !library.isNonNullableByDefault) {
|
||||
result = legacyErasure(result);
|
||||
}
|
||||
return result;
|
||||
Nullability nullability = nullabilityBuilder.build(library);
|
||||
return buildAliasedTypeWithBuiltArguments(
|
||||
library,
|
||||
nullability,
|
||||
buildAliasedTypeArguments(library, arguments),
|
||||
typeUse,
|
||||
fileUri,
|
||||
charOffset,
|
||||
hasExplicitTypeArguments: hasExplicitTypeArguments);
|
||||
}
|
||||
|
||||
TypeDeclarationBuilder? _cachedUnaliasedDeclaration;
|
||||
|
||||
@@ -13,6 +13,249 @@ import 'nullability_builder.dart';
|
||||
import 'type_declaration_builder.dart';
|
||||
import 'type_variable_builder.dart';
|
||||
|
||||
enum TypeUse {
|
||||
/// A type used as the type of a parameter.
|
||||
///
|
||||
/// For instance `X` and `Y` in
|
||||
///
|
||||
/// method(X p, {Y q}) {}
|
||||
///
|
||||
parameterType,
|
||||
|
||||
/// A type used as the type of a field.
|
||||
///
|
||||
/// For instance `X` and `Y` in
|
||||
///
|
||||
/// X topLevelField;
|
||||
/// class Class {
|
||||
/// Y instanceField;
|
||||
/// }
|
||||
///
|
||||
fieldType,
|
||||
|
||||
/// A type used as the return type of a function.
|
||||
///
|
||||
/// For instance `X` in
|
||||
///
|
||||
/// X method() { ... }
|
||||
///
|
||||
returnType,
|
||||
|
||||
/// A type used as a type argument to a constructor invocation.
|
||||
///
|
||||
/// For instance `X` in
|
||||
///
|
||||
/// class Class<T> {}
|
||||
/// method() => new Class<X>();
|
||||
///
|
||||
constructorTypeArgument,
|
||||
|
||||
/// A type used as a type argument to a redirecting factory constructor
|
||||
/// declaration.
|
||||
///
|
||||
/// For instance `X` in
|
||||
///
|
||||
/// class Class<T> {
|
||||
/// Class();
|
||||
/// factory Class.redirect() = Class<X>;
|
||||
/// }
|
||||
///
|
||||
redirectionTypeArgument,
|
||||
|
||||
/// A type used as the bound of a type parameter.
|
||||
///
|
||||
/// For instance `X` and `Y` in
|
||||
///
|
||||
/// method<T extends X>() {}
|
||||
/// class Class<S extends Y> {}
|
||||
///
|
||||
typeParameterBound,
|
||||
|
||||
/// A type computed as the default type for a type parameter.
|
||||
///
|
||||
/// For instance the type `X` computed for `T` and the type `dynamic` computed
|
||||
/// for `S`.
|
||||
///
|
||||
/// method<T extends X>() {}
|
||||
/// class Class<S> {}
|
||||
///
|
||||
typeParameterDefaultType,
|
||||
|
||||
/// A type used as a type argument in the instantiation of a tear off.
|
||||
///
|
||||
/// For instance `X` and `Y` in
|
||||
///
|
||||
/// class Class<S> {}
|
||||
/// method<T>() {
|
||||
/// Class<X>.new;
|
||||
/// method<Y>;
|
||||
/// }
|
||||
///
|
||||
tearOffTypeArgument,
|
||||
|
||||
/// A type used in an extends, with or implements clause.
|
||||
///
|
||||
/// For instance `X`, `Y`, `Z` in
|
||||
///
|
||||
/// class Class extends X with Y implements Z {}
|
||||
///
|
||||
// TODO(johnniwinther): The probably enclosed the mixin on clause. Is this
|
||||
// a correct handling wrt well-boundedness?
|
||||
superType,
|
||||
|
||||
/// A type used in a with clause.
|
||||
///
|
||||
/// For instance `X` in
|
||||
///
|
||||
/// class Class extends X {}
|
||||
///
|
||||
/// This type use creates an intermediate type used for mixin inference. The
|
||||
/// type is not check for well-boundedness and contains [UnknownType] where
|
||||
/// type arguments are omitted.
|
||||
mixedInType,
|
||||
|
||||
/// A type used in the on clause of an extension declaration.
|
||||
///
|
||||
/// For instance `X` in
|
||||
///
|
||||
/// extension Extension on X {}
|
||||
///
|
||||
extensionOnType,
|
||||
|
||||
/// A type used as the definition of a typedef.
|
||||
///
|
||||
/// For instance `X`, `void Function()` in
|
||||
///
|
||||
/// typedef Typedef1 = X;
|
||||
/// typedef void Typedef2(); // The unaliased type is `void Function()`.
|
||||
///
|
||||
typedefAlias,
|
||||
|
||||
/// An internally created function type used when build local functions.
|
||||
functionSignature,
|
||||
|
||||
/// The this type of an enum.
|
||||
// TODO(johnniwinther): This is doesn't currently have the correct value
|
||||
// and/or well-boundedness checking.
|
||||
enumSelfType,
|
||||
|
||||
/// A type used as a type literal.
|
||||
///
|
||||
/// For instance `X` in
|
||||
///
|
||||
/// method() => X;
|
||||
///
|
||||
/// where `X` is the name of a class.
|
||||
typeLiteral,
|
||||
|
||||
/// A type used as a type argument to a literal.
|
||||
///
|
||||
/// For instance `X`, `Y`, `Z`, and `W` in
|
||||
///
|
||||
/// method() {
|
||||
/// <X>[];
|
||||
/// <Y>{};
|
||||
/// <Z, W>{};
|
||||
/// }
|
||||
///
|
||||
literalTypeArgument,
|
||||
|
||||
/// A type used as a type argument in an invocation.
|
||||
///
|
||||
/// For instance `X`, `Y`, and `Z` in
|
||||
///
|
||||
/// staticMethod<T>(Class c, void Function<S>() f) {
|
||||
/// staticMethod<X>(c, f);
|
||||
/// c.instanceMethod<Y>();
|
||||
/// f<Z>();
|
||||
/// }
|
||||
/// class Class {
|
||||
/// instanceMethod<U>() {}
|
||||
/// }
|
||||
invocationTypeArgument,
|
||||
|
||||
/// A type used as the type in an is-test.
|
||||
///
|
||||
/// For instance `X` in
|
||||
///
|
||||
/// method(o) => o is X;
|
||||
///
|
||||
isType,
|
||||
|
||||
/// A type used as the type in an as-cast.
|
||||
///
|
||||
/// For instance `X` in
|
||||
///
|
||||
/// method(o) => o as X;
|
||||
///
|
||||
asType,
|
||||
|
||||
/// A type used as the type of local variable.
|
||||
///
|
||||
/// For instance `X` in
|
||||
///
|
||||
/// method() {
|
||||
/// X local;
|
||||
/// }
|
||||
///
|
||||
variableType,
|
||||
|
||||
/// A type used as the catch type in a catch clause.
|
||||
///
|
||||
/// For instance `X` in
|
||||
///
|
||||
/// method() {
|
||||
/// try {
|
||||
/// } on X catch (e) {
|
||||
/// }
|
||||
/// }
|
||||
///
|
||||
catchType,
|
||||
|
||||
/// A type used as an instantiation argument.
|
||||
///
|
||||
/// For instance `X` in
|
||||
///
|
||||
/// method(void Function<T>() f) {
|
||||
/// f<X>;
|
||||
/// }
|
||||
///
|
||||
instantiation,
|
||||
|
||||
/// A type used as a type argument within another type.
|
||||
///
|
||||
/// For instance `X`, `Y`, `Z` and `W` in
|
||||
///
|
||||
/// method(List<X> a, Y Function(Z) f) {}
|
||||
/// class Class implements List<W> {}
|
||||
///
|
||||
typeArgument,
|
||||
|
||||
/// The default type of a type parameter used as the type argument in a raw
|
||||
/// type.
|
||||
///
|
||||
/// For instance `X` implicitly inside `Class<X>` in the type of `cls` in
|
||||
///
|
||||
/// class Class<T extends X> {}
|
||||
/// Class cls;
|
||||
///
|
||||
defaultTypeAsTypeArgument,
|
||||
|
||||
/// A type from a deferred library. This is an error case.
|
||||
///
|
||||
/// For instance `X` in
|
||||
///
|
||||
/// import 'foo.dart' deferred as prefix;
|
||||
///
|
||||
/// prefix.X field;
|
||||
///
|
||||
deferredTypeError,
|
||||
|
||||
/// A type used as a type argument in the construction of a type through the
|
||||
/// macro API.
|
||||
macroTypeArgument,
|
||||
}
|
||||
|
||||
abstract class TypeBuilder {
|
||||
const TypeBuilder();
|
||||
|
||||
@@ -60,7 +303,23 @@ abstract class TypeBuilder {
|
||||
|
||||
String get fullNameForErrors => "${printOn(new StringBuffer())}";
|
||||
|
||||
DartType build(LibraryBuilder library);
|
||||
/// Creates the [DartType] from this [TypeBuilder] that doesn't contain
|
||||
/// [TypedefType].
|
||||
///
|
||||
/// [library] is used to determine nullabilities and for registering well-
|
||||
/// boundedness checks on the created type. [typeUse] describes how the
|
||||
/// type is used which determine which well-boundedness checks are applied.
|
||||
DartType build(LibraryBuilder library, TypeUse typeUse);
|
||||
|
||||
/// Creates the [DartType] from this [TypeBuilder] that contains
|
||||
/// [TypedefType]. This is used to create types internal on which well-
|
||||
/// boundedness checks can be permit. Calls from outside the [TypeBuilder]
|
||||
/// subclasses should generally use [build] instead.
|
||||
///
|
||||
/// [library] is used to determine nullabilities and for registering well-
|
||||
/// boundedness checks on the created type. [typeUse] describes how the
|
||||
/// type is used which determine which well-boundedness checks are applied.
|
||||
DartType buildAliased(LibraryBuilder library, TypeUse typeUse);
|
||||
|
||||
Supertype? buildSupertype(LibraryBuilder library);
|
||||
|
||||
|
||||
@@ -33,22 +33,32 @@ abstract class TypeDeclarationBuilder implements ModifierBuilder {
|
||||
|
||||
/// Creates the [DartType] corresponding to this declaration applied with
|
||||
/// [arguments] in [library] with the syntactical nullability defined by
|
||||
/// [nullabilityBuilder].
|
||||
/// [nullabilityBuilder]. The created type will contain [TypedefType] instead
|
||||
/// of their unaliased type.
|
||||
///
|
||||
/// For instance, if this declaration is a class declaration `C`, then
|
||||
/// an occurrence of `C<int>?` in a null safe library `lib1` would call
|
||||
/// `buildType(<lib1>, <?>, [<int>])` to create `C<int>?`, or `C<int>` in a
|
||||
/// legacy library `lib2` call `buildType(<lib2>, <> [<int>]` to create
|
||||
/// `C<int*>*`.
|
||||
DartType buildType(LibraryBuilder library,
|
||||
NullabilityBuilder nullabilityBuilder, List<TypeBuilder>? arguments);
|
||||
|
||||
DartType buildTypeLiteralType(LibraryBuilder library,
|
||||
NullabilityBuilder nullabilityBuilder, List<TypeBuilder>? arguments);
|
||||
DartType buildAliasedType(
|
||||
LibraryBuilder library,
|
||||
NullabilityBuilder nullabilityBuilder,
|
||||
List<TypeBuilder>? arguments,
|
||||
TypeUse typeUse,
|
||||
Uri fileUri,
|
||||
int charOffset,
|
||||
{required bool hasExplicitTypeArguments});
|
||||
|
||||
/// [arguments] have already been built.
|
||||
DartType buildTypeWithBuiltArguments(LibraryBuilder library,
|
||||
Nullability nullability, List<DartType> arguments);
|
||||
DartType buildAliasedTypeWithBuiltArguments(
|
||||
LibraryBuilder library,
|
||||
Nullability nullability,
|
||||
List<DartType> arguments,
|
||||
TypeUse typeUse,
|
||||
Uri fileUri,
|
||||
int charOffset,
|
||||
{required bool hasExplicitTypeArguments});
|
||||
}
|
||||
|
||||
abstract class TypeDeclarationBuilderImpl extends ModifierBuilderImpl
|
||||
@@ -85,10 +95,4 @@ abstract class TypeDeclarationBuilderImpl extends ModifierBuilderImpl
|
||||
|
||||
@override
|
||||
int get typeVariablesCount => 0;
|
||||
|
||||
@override
|
||||
DartType buildTypeLiteralType(LibraryBuilder library,
|
||||
NullabilityBuilder nullabilityBuilder, List<TypeBuilder>? arguments) {
|
||||
return buildType(library, nullabilityBuilder, arguments);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import '../fasta_codes.dart'
|
||||
|
||||
import '../scope.dart';
|
||||
import '../source/source_library_builder.dart';
|
||||
import '../uris.dart';
|
||||
import '../util/helpers.dart';
|
||||
|
||||
import 'builder.dart';
|
||||
@@ -119,11 +120,15 @@ class TypeVariableBuilder extends TypeDeclarationBuilderImpl {
|
||||
}
|
||||
|
||||
@override
|
||||
DartType buildType(LibraryBuilder library,
|
||||
NullabilityBuilder nullabilityBuilder, List<TypeBuilder>? arguments) {
|
||||
DartType buildAliasedType(
|
||||
LibraryBuilder library,
|
||||
NullabilityBuilder nullabilityBuilder,
|
||||
List<TypeBuilder>? arguments,
|
||||
TypeUse typeUse,
|
||||
Uri fileUri,
|
||||
int charOffset,
|
||||
{required bool hasExplicitTypeArguments}) {
|
||||
if (arguments != null) {
|
||||
int charOffset = -1; // TODO(ahe): Provide these.
|
||||
Uri? fileUri = null; // TODO(ahe): Provide these.
|
||||
library.addProblem(
|
||||
templateTypeArgumentsOnTypeVariable.withArguments(name),
|
||||
charOffset,
|
||||
@@ -148,26 +153,34 @@ class TypeVariableBuilder extends TypeDeclarationBuilderImpl {
|
||||
} else {
|
||||
nullability = nullabilityBuilder.build(library);
|
||||
}
|
||||
TypeParameterType type =
|
||||
buildTypeWithBuiltArguments(library, nullability, null);
|
||||
TypeParameterType type = buildAliasedTypeWithBuiltArguments(
|
||||
library, nullability, null, typeUse, fileUri, charOffset,
|
||||
hasExplicitTypeArguments: hasExplicitTypeArguments);
|
||||
if (needsPostUpdate) {
|
||||
if (library is SourceLibraryBuilder) {
|
||||
library.registerPendingNullability(fileUri!, charOffset, type);
|
||||
library.registerPendingNullability(
|
||||
this.fileUri!, this.charOffset, type);
|
||||
} else {
|
||||
library.addProblem(
|
||||
templateInternalProblemUnfinishedTypeVariable.withArguments(
|
||||
name, library.importUri),
|
||||
charOffset,
|
||||
this.charOffset,
|
||||
name.length,
|
||||
fileUri);
|
||||
this.fileUri);
|
||||
}
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
@override
|
||||
TypeParameterType buildTypeWithBuiltArguments(LibraryBuilder library,
|
||||
Nullability nullability, List<DartType>? arguments) {
|
||||
TypeParameterType buildAliasedTypeWithBuiltArguments(
|
||||
LibraryBuilder library,
|
||||
Nullability nullability,
|
||||
List<DartType>? arguments,
|
||||
TypeUse typeUse,
|
||||
Uri fileUri,
|
||||
int charOffset,
|
||||
{required bool hasExplicitTypeArguments}) {
|
||||
if (arguments != null) {
|
||||
int charOffset = -1; // TODO(ahe): Provide these.
|
||||
Uri? fileUri = null; // TODO(ahe): Provide these.
|
||||
@@ -183,10 +196,17 @@ class TypeVariableBuilder extends TypeDeclarationBuilderImpl {
|
||||
void finish(
|
||||
LibraryBuilder library, ClassBuilder object, TypeBuilder dynamicType) {
|
||||
if (isPatch) return;
|
||||
DartType objectType =
|
||||
object.buildType(library, library.nullableBuilder, null);
|
||||
DartType objectType = object.buildAliasedType(
|
||||
library,
|
||||
library.nullableBuilder,
|
||||
null,
|
||||
TypeUse.typeParameterBound,
|
||||
fileUri ?? missingUri,
|
||||
charOffset,
|
||||
hasExplicitTypeArguments: false);
|
||||
if (identical(parameter.bound, TypeParameter.unsetBoundSentinel)) {
|
||||
parameter.bound = bound?.build(library) ?? objectType;
|
||||
parameter.bound =
|
||||
bound?.build(library, TypeUse.typeParameterBound) ?? objectType;
|
||||
}
|
||||
// If defaultType is not set, initialize it to dynamic, unless the bound is
|
||||
// explicitly specified as Object, in which case defaultType should also be
|
||||
@@ -194,10 +214,11 @@ class TypeVariableBuilder extends TypeDeclarationBuilderImpl {
|
||||
// explicit Object bound results in Object as the instantiated type.
|
||||
if (identical(
|
||||
parameter.defaultType, TypeParameter.unsetDefaultTypeSentinel)) {
|
||||
parameter.defaultType = defaultType?.build(library) ??
|
||||
parameter.defaultType = defaultType?.build(
|
||||
library, TypeUse.typeParameterDefaultType) ??
|
||||
(bound != null && parameter.bound == objectType
|
||||
? objectType
|
||||
: dynamicType.build(library));
|
||||
: dynamicType.build(library, TypeUse.typeParameterDefaultType));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -134,20 +134,21 @@ class DillClassBuilder extends ClassBuilderImpl {
|
||||
int get typeVariablesCount => cls.typeParameters.length;
|
||||
|
||||
@override
|
||||
List<DartType> buildTypeArguments(
|
||||
List<DartType> buildAliasedTypeArguments(
|
||||
LibraryBuilder library, List<TypeBuilder>? arguments) {
|
||||
// For performance reasons, [typeVariables] aren't restored from [target].
|
||||
// So, if [arguments] is null, the default types should be retrieved from
|
||||
// [cls.typeParameters].
|
||||
if (arguments == null) {
|
||||
// TODO(johnniwinther): Use i2b here when needed.
|
||||
return new List<DartType>.generate(cls.typeParameters.length,
|
||||
(int i) => cls.typeParameters[i].defaultType,
|
||||
growable: true);
|
||||
}
|
||||
|
||||
// [arguments] != null
|
||||
return new List<DartType>.generate(
|
||||
arguments.length, (int i) => arguments[i].build(library),
|
||||
return new List<DartType>.generate(arguments.length,
|
||||
(int i) => arguments[i].buildAliased(library, TypeUse.typeArgument),
|
||||
growable: true);
|
||||
}
|
||||
|
||||
|
||||
@@ -282,10 +282,6 @@ class DillLibraryBuilder extends LibraryBuilderImpl {
|
||||
}
|
||||
|
||||
void addTypedef(Typedef typedef, Map<Name, Procedure>? tearOffs) {
|
||||
DartType? type = typedef.type;
|
||||
if (type is FunctionType && type.typedefType == null) {
|
||||
unhandled("null", "addTypedef", typedef.fileOffset, typedef.fileUri);
|
||||
}
|
||||
_addBuilder(
|
||||
typedef.name, new DillTypeAliasBuilder(typedef, tearOffs, this));
|
||||
}
|
||||
|
||||
@@ -38,6 +38,8 @@ import '../source/source_loader.dart' show SourceLoader;
|
||||
|
||||
import '../ticker.dart' show Ticker;
|
||||
|
||||
import '../uris.dart';
|
||||
|
||||
import 'dill_library_builder.dart' show DillLibraryBuilder;
|
||||
|
||||
import 'dill_target.dart' show DillTarget;
|
||||
@@ -226,6 +228,8 @@ class DillLoader extends Loader {
|
||||
List<LocatedMessage>? context,
|
||||
bool problemOnLibrary: false,
|
||||
List<Uri>? involvedFiles}) {
|
||||
assert(
|
||||
fileUri != missingUri, "Message unexpectedly reported on missing uri.");
|
||||
severity ??= message.code.severity;
|
||||
if (severity == Severity.ignored) return null;
|
||||
String trace = """
|
||||
|
||||
@@ -73,12 +73,13 @@ class DillTypeAliasBuilder extends TypeAliasBuilderImpl {
|
||||
}
|
||||
|
||||
@override
|
||||
List<DartType> buildTypeArguments(
|
||||
List<DartType> buildAliasedTypeArguments(
|
||||
LibraryBuilder library, List<TypeBuilder>? arguments) {
|
||||
// For performance reasons, [typeVariables] aren't restored from [target].
|
||||
// So, if [arguments] is null, the default types should be retrieved from
|
||||
// [cls.typeParameters].
|
||||
if (arguments == null) {
|
||||
// TODO(johnniwinther): Use i2b here when needed.
|
||||
List<DartType> result =
|
||||
new List<DartType>.generate(typedef.typeParameters.length, (int i) {
|
||||
return typedef.typeParameters[i].defaultType;
|
||||
@@ -89,7 +90,7 @@ class DillTypeAliasBuilder extends TypeAliasBuilderImpl {
|
||||
// [arguments] != null
|
||||
List<DartType> result =
|
||||
new List<DartType>.generate(arguments.length, (int i) {
|
||||
return arguments[i].build(library);
|
||||
return arguments[i].buildAliased(library, TypeUse.typeArgument);
|
||||
}, growable: true);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1345,6 +1345,46 @@ Message _withArgumentsForInLoopTypeNotIterablePartNullability(
|
||||
});
|
||||
}
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Template<
|
||||
Message Function(
|
||||
DartType _type, DartType _type2, bool isNonNullableByDefault)>
|
||||
templateGenericFunctionTypeAsTypeArgumentThroughTypedef = const Template<
|
||||
Message Function(
|
||||
DartType _type, DartType _type2, bool isNonNullableByDefault)>(
|
||||
problemMessageTemplate:
|
||||
r"""Generic function type '#type' used as a type argument through typedef '#type2'.""",
|
||||
correctionMessageTemplate:
|
||||
r"""Try providing a non-generic function type explicitly.""",
|
||||
withArguments:
|
||||
_withArgumentsGenericFunctionTypeAsTypeArgumentThroughTypedef);
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Code<
|
||||
Message Function(
|
||||
DartType _type, DartType _type2, bool isNonNullableByDefault)>
|
||||
codeGenericFunctionTypeAsTypeArgumentThroughTypedef = const Code<
|
||||
Message Function(
|
||||
DartType _type, DartType _type2, bool isNonNullableByDefault)>(
|
||||
"GenericFunctionTypeAsTypeArgumentThroughTypedef",
|
||||
analyzerCodes: <String>["GENERIC_FUNCTION_CANNOT_BE_TYPE_ARGUMENT"]);
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
Message _withArgumentsGenericFunctionTypeAsTypeArgumentThroughTypedef(
|
||||
DartType _type, DartType _type2, bool isNonNullableByDefault) {
|
||||
TypeLabeler labeler = new TypeLabeler(isNonNullableByDefault);
|
||||
List<Object> typeParts = labeler.labelType(_type);
|
||||
List<Object> type2Parts = labeler.labelType(_type2);
|
||||
String type = typeParts.join();
|
||||
String type2 = type2Parts.join();
|
||||
return new Message(codeGenericFunctionTypeAsTypeArgumentThroughTypedef,
|
||||
problemMessage:
|
||||
"""Generic function type '${type}' used as a type argument through typedef '${type2}'.""" +
|
||||
labeler.originMessages,
|
||||
correctionMessage: """Try providing a non-generic function type explicitly.""",
|
||||
arguments: {'type': _type, 'type2': _type2});
|
||||
}
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Template<Message Function(DartType _type, bool isNonNullableByDefault)>
|
||||
templateGenericFunctionTypeInferredAsActualTypeArgument = const Template<
|
||||
@@ -1531,224 +1571,6 @@ Message _withArgumentsIncorrectTypeArgument(DartType _type, DartType _type2,
|
||||
});
|
||||
}
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Template<
|
||||
Message Function(DartType _type, DartType _type2, String name,
|
||||
String name2, bool isNonNullableByDefault)>
|
||||
templateIncorrectTypeArgumentInReturnType = const Template<
|
||||
Message Function(DartType _type, DartType _type2, String name,
|
||||
String name2, bool isNonNullableByDefault)>(
|
||||
problemMessageTemplate:
|
||||
r"""Type argument '#type' doesn't conform to the bound '#type2' of the type variable '#name' on '#name2' in the return type.""",
|
||||
correctionMessageTemplate:
|
||||
r"""Try changing type arguments so that they conform to the bounds.""",
|
||||
withArguments: _withArgumentsIncorrectTypeArgumentInReturnType);
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Code<
|
||||
Message Function(DartType _type, DartType _type2, String name,
|
||||
String name2, bool isNonNullableByDefault)>
|
||||
codeIncorrectTypeArgumentInReturnType = const Code<
|
||||
Message Function(DartType _type, DartType _type2, String name,
|
||||
String name2, bool isNonNullableByDefault)>(
|
||||
"IncorrectTypeArgumentInReturnType",
|
||||
analyzerCodes: <String>["TYPE_ARGUMENT_NOT_MATCHING_BOUNDS"]);
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
Message _withArgumentsIncorrectTypeArgumentInReturnType(DartType _type,
|
||||
DartType _type2, String name, String name2, bool isNonNullableByDefault) {
|
||||
TypeLabeler labeler = new TypeLabeler(isNonNullableByDefault);
|
||||
List<Object> typeParts = labeler.labelType(_type);
|
||||
List<Object> type2Parts = labeler.labelType(_type2);
|
||||
if (name.isEmpty) throw 'No name provided';
|
||||
name = demangleMixinApplicationName(name);
|
||||
if (name2.isEmpty) throw 'No name provided';
|
||||
name2 = demangleMixinApplicationName(name2);
|
||||
String type = typeParts.join();
|
||||
String type2 = type2Parts.join();
|
||||
return new Message(codeIncorrectTypeArgumentInReturnType,
|
||||
problemMessage:
|
||||
"""Type argument '${type}' doesn't conform to the bound '${type2}' of the type variable '${name}' on '${name2}' in the return type.""" +
|
||||
labeler.originMessages,
|
||||
correctionMessage: """Try changing type arguments so that they conform to the bounds.""",
|
||||
arguments: {
|
||||
'type': _type,
|
||||
'type2': _type2,
|
||||
'name': name,
|
||||
'name2': name2
|
||||
});
|
||||
}
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Template<
|
||||
Message Function(
|
||||
DartType _type,
|
||||
DartType _type2,
|
||||
String name,
|
||||
String name2,
|
||||
String name3,
|
||||
String name4,
|
||||
bool isNonNullableByDefault)>
|
||||
templateIncorrectTypeArgumentInSupertype = const Template<
|
||||
Message Function(
|
||||
DartType _type,
|
||||
DartType _type2,
|
||||
String name,
|
||||
String name2,
|
||||
String name3,
|
||||
String name4,
|
||||
bool isNonNullableByDefault)>(
|
||||
problemMessageTemplate:
|
||||
r"""Type argument '#type' doesn't conform to the bound '#type2' of the type variable '#name' on '#name2' in the supertype '#name3' of class '#name4'.""",
|
||||
correctionMessageTemplate:
|
||||
r"""Try changing type arguments so that they conform to the bounds.""",
|
||||
withArguments: _withArgumentsIncorrectTypeArgumentInSupertype);
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Code<
|
||||
Message Function(
|
||||
DartType _type,
|
||||
DartType _type2,
|
||||
String name,
|
||||
String name2,
|
||||
String name3,
|
||||
String name4,
|
||||
bool isNonNullableByDefault)> codeIncorrectTypeArgumentInSupertype =
|
||||
const Code<
|
||||
Message Function(
|
||||
DartType _type,
|
||||
DartType _type2,
|
||||
String name,
|
||||
String name2,
|
||||
String name3,
|
||||
String name4,
|
||||
bool isNonNullableByDefault)>(
|
||||
"IncorrectTypeArgumentInSupertype",
|
||||
analyzerCodes: <String>["TYPE_ARGUMENT_NOT_MATCHING_BOUNDS"]);
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
Message _withArgumentsIncorrectTypeArgumentInSupertype(
|
||||
DartType _type,
|
||||
DartType _type2,
|
||||
String name,
|
||||
String name2,
|
||||
String name3,
|
||||
String name4,
|
||||
bool isNonNullableByDefault) {
|
||||
TypeLabeler labeler = new TypeLabeler(isNonNullableByDefault);
|
||||
List<Object> typeParts = labeler.labelType(_type);
|
||||
List<Object> type2Parts = labeler.labelType(_type2);
|
||||
if (name.isEmpty) throw 'No name provided';
|
||||
name = demangleMixinApplicationName(name);
|
||||
if (name2.isEmpty) throw 'No name provided';
|
||||
name2 = demangleMixinApplicationName(name2);
|
||||
if (name3.isEmpty) throw 'No name provided';
|
||||
name3 = demangleMixinApplicationName(name3);
|
||||
if (name4.isEmpty) throw 'No name provided';
|
||||
name4 = demangleMixinApplicationName(name4);
|
||||
String type = typeParts.join();
|
||||
String type2 = type2Parts.join();
|
||||
return new Message(codeIncorrectTypeArgumentInSupertype,
|
||||
problemMessage:
|
||||
"""Type argument '${type}' doesn't conform to the bound '${type2}' of the type variable '${name}' on '${name2}' in the supertype '${name3}' of class '${name4}'.""" +
|
||||
labeler.originMessages,
|
||||
correctionMessage:
|
||||
"""Try changing type arguments so that they conform to the bounds.""",
|
||||
arguments: {
|
||||
'type': _type,
|
||||
'type2': _type2,
|
||||
'name': name,
|
||||
'name2': name2,
|
||||
'name3': name3,
|
||||
'name4': name4
|
||||
});
|
||||
}
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Template<
|
||||
Message Function(
|
||||
DartType _type,
|
||||
DartType _type2,
|
||||
String name,
|
||||
String name2,
|
||||
String name3,
|
||||
String name4,
|
||||
bool isNonNullableByDefault)>
|
||||
templateIncorrectTypeArgumentInSupertypeInferred = const Template<
|
||||
Message Function(
|
||||
DartType _type,
|
||||
DartType _type2,
|
||||
String name,
|
||||
String name2,
|
||||
String name3,
|
||||
String name4,
|
||||
bool isNonNullableByDefault)>(
|
||||
problemMessageTemplate:
|
||||
r"""Inferred type argument '#type' doesn't conform to the bound '#type2' of the type variable '#name' on '#name2' in the supertype '#name3' of class '#name4'.""",
|
||||
correctionMessageTemplate:
|
||||
r"""Try specifying type arguments explicitly so that they conform to the bounds.""",
|
||||
withArguments: _withArgumentsIncorrectTypeArgumentInSupertypeInferred);
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Code<
|
||||
Message Function(
|
||||
DartType _type,
|
||||
DartType _type2,
|
||||
String name,
|
||||
String name2,
|
||||
String name3,
|
||||
String name4,
|
||||
bool isNonNullableByDefault)>
|
||||
codeIncorrectTypeArgumentInSupertypeInferred = const Code<
|
||||
Message Function(
|
||||
DartType _type,
|
||||
DartType _type2,
|
||||
String name,
|
||||
String name2,
|
||||
String name3,
|
||||
String name4,
|
||||
bool isNonNullableByDefault)>(
|
||||
"IncorrectTypeArgumentInSupertypeInferred",
|
||||
analyzerCodes: <String>["TYPE_ARGUMENT_NOT_MATCHING_BOUNDS"]);
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
Message _withArgumentsIncorrectTypeArgumentInSupertypeInferred(
|
||||
DartType _type,
|
||||
DartType _type2,
|
||||
String name,
|
||||
String name2,
|
||||
String name3,
|
||||
String name4,
|
||||
bool isNonNullableByDefault) {
|
||||
TypeLabeler labeler = new TypeLabeler(isNonNullableByDefault);
|
||||
List<Object> typeParts = labeler.labelType(_type);
|
||||
List<Object> type2Parts = labeler.labelType(_type2);
|
||||
if (name.isEmpty) throw 'No name provided';
|
||||
name = demangleMixinApplicationName(name);
|
||||
if (name2.isEmpty) throw 'No name provided';
|
||||
name2 = demangleMixinApplicationName(name2);
|
||||
if (name3.isEmpty) throw 'No name provided';
|
||||
name3 = demangleMixinApplicationName(name3);
|
||||
if (name4.isEmpty) throw 'No name provided';
|
||||
name4 = demangleMixinApplicationName(name4);
|
||||
String type = typeParts.join();
|
||||
String type2 = type2Parts.join();
|
||||
return new Message(codeIncorrectTypeArgumentInSupertypeInferred,
|
||||
problemMessage:
|
||||
"""Inferred type argument '${type}' doesn't conform to the bound '${type2}' of the type variable '${name}' on '${name2}' in the supertype '${name3}' of class '${name4}'.""" +
|
||||
labeler.originMessages,
|
||||
correctionMessage:
|
||||
"""Try specifying type arguments explicitly so that they conform to the bounds.""",
|
||||
arguments: {
|
||||
'type': _type,
|
||||
'type2': _type2,
|
||||
'name': name,
|
||||
'name2': name2,
|
||||
'name3': name3,
|
||||
'name4': name4
|
||||
});
|
||||
}
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Template<
|
||||
Message Function(DartType _type, DartType _type2, String name,
|
||||
|
||||
@@ -135,6 +135,8 @@ import 'util/experiment_environment_getter.dart'
|
||||
|
||||
import 'util/textual_outline.dart' show textualOutline;
|
||||
|
||||
import 'uris.dart' show dartCore;
|
||||
|
||||
import 'hybrid_file_system.dart' show HybridFileSystem;
|
||||
|
||||
import 'kernel/hierarchy/hierarchy_builder.dart' show ClassHierarchyBuilder;
|
||||
@@ -655,7 +657,7 @@ class IncrementalCompiler implements IncrementalKernelGenerator {
|
||||
dillLibraryBuilder.exportScope.lookupLocalMember(name, setter: false);
|
||||
if (dillBuilder == null) {
|
||||
if ((name == 'dynamic' || name == 'Never') &&
|
||||
sourceLibraryBuilder.importUri == Uri.parse('dart:core')) {
|
||||
sourceLibraryBuilder.importUri == dartCore) {
|
||||
// The source library builder for dart:core has synthetically
|
||||
// injected builders for `dynamic` and `Never` which do not have
|
||||
// corresponding classes in the AST.
|
||||
|
||||
@@ -85,7 +85,7 @@ import '../source/source_enum_builder.dart';
|
||||
import '../source/source_factory_builder.dart';
|
||||
import '../source/source_field_builder.dart';
|
||||
import '../source/source_function_builder.dart';
|
||||
import '../source/source_library_builder.dart' show SourceLibraryBuilder;
|
||||
import '../source/source_library_builder.dart';
|
||||
import '../source/source_procedure_builder.dart';
|
||||
import '../source/stack_listener_impl.dart'
|
||||
show StackListenerImpl, offsetForToken;
|
||||
@@ -1010,7 +1010,8 @@ class BodyBuilder extends StackListenerImpl
|
||||
// `invalid-type`.
|
||||
TypeBuilder? type = pop() as TypeBuilder?;
|
||||
if (type != null) {
|
||||
buildDartType(type, allowPotentiallyConstantType: false);
|
||||
buildDartType(type, TypeUse.fieldType,
|
||||
allowPotentiallyConstantType: false);
|
||||
}
|
||||
}
|
||||
pop(); // Annotations.
|
||||
@@ -1030,7 +1031,7 @@ class BodyBuilder extends StackListenerImpl
|
||||
_unaliasTypeAliasedConstructorInvocations();
|
||||
_unaliasTypeAliasedFactoryInvocations(typeAliasedFactoryInvocations);
|
||||
_resolveRedirectingFactoryTargets(redirectingFactoryInvocations);
|
||||
libraryBuilder.checkUncheckedTypedefTypes(typeEnvironment);
|
||||
libraryBuilder.checkPendingBoundsChecks(typeEnvironment);
|
||||
if (hasDelayedActions) {
|
||||
assert(
|
||||
delayedActionPerformers != null,
|
||||
@@ -2193,7 +2194,7 @@ class BodyBuilder extends StackListenerImpl
|
||||
assert(forest.argumentsTypeArguments(arguments).isEmpty);
|
||||
forest.argumentsSetTypeArguments(
|
||||
arguments,
|
||||
buildDartTypeArguments(typeArguments,
|
||||
buildDartTypeArguments(typeArguments, TypeUse.invocationTypeArgument,
|
||||
allowPotentiallyConstantType: false));
|
||||
} else {
|
||||
assert(typeArguments == null ||
|
||||
@@ -3280,8 +3281,6 @@ class BodyBuilder extends StackListenerImpl
|
||||
..fileOffset = identifier.charOffset
|
||||
..fileEqualsOffset = offsetForToken(equalsToken);
|
||||
typeInferrer.assignedVariables.declare(variable);
|
||||
libraryBuilder.checkBoundsInVariableDeclaration(
|
||||
variable, typeEnvironment, uri);
|
||||
push(variable);
|
||||
}
|
||||
|
||||
@@ -3363,7 +3362,8 @@ class BodyBuilder extends StackListenerImpl
|
||||
}
|
||||
TypeBuilder? unresolvedType = pop(NullValue.TypeBuilder) as TypeBuilder?;
|
||||
DartType? type = unresolvedType != null
|
||||
? buildDartType(unresolvedType, allowPotentiallyConstantType: false)
|
||||
? buildDartType(unresolvedType, TypeUse.variableType,
|
||||
allowPotentiallyConstantType: false)
|
||||
: null;
|
||||
int modifiers = (lateToken != null ? lateMask : 0) |
|
||||
Modifier.validateVarFinalOrConst(varFinalOrConst?.lexeme);
|
||||
@@ -3805,7 +3805,8 @@ class BodyBuilder extends StackListenerImpl
|
||||
lengthOfSpan(leftBracket, leftBracket.endGroup));
|
||||
typeArgument = const InvalidType();
|
||||
} else {
|
||||
typeArgument = buildDartType(typeArguments.single,
|
||||
typeArgument = buildDartType(
|
||||
typeArguments.single, TypeUse.literalTypeArgument,
|
||||
allowPotentiallyConstantType: false);
|
||||
typeArgument = instantiateToBounds(
|
||||
typeArgument, coreTypes.objectClass, libraryBuilder.library);
|
||||
@@ -3822,7 +3823,6 @@ class BodyBuilder extends StackListenerImpl
|
||||
expressions,
|
||||
isConst: constKeyword != null ||
|
||||
constantContext == ConstantContext.inferred);
|
||||
libraryBuilder.checkBoundsInListLiteral(node, typeEnvironment, uri);
|
||||
push(node);
|
||||
}
|
||||
|
||||
@@ -3830,7 +3830,8 @@ class BodyBuilder extends StackListenerImpl
|
||||
Token leftBrace, List<dynamic>? setOrMapEntries) {
|
||||
DartType typeArgument;
|
||||
if (typeArguments != null) {
|
||||
typeArgument = buildDartType(typeArguments.single,
|
||||
typeArgument = buildDartType(
|
||||
typeArguments.single, TypeUse.literalTypeArgument,
|
||||
allowPotentiallyConstantType: false);
|
||||
typeArgument = instantiateToBounds(
|
||||
typeArgument, coreTypes.objectClass, libraryBuilder.library);
|
||||
@@ -3861,7 +3862,6 @@ class BodyBuilder extends StackListenerImpl
|
||||
expressions,
|
||||
isConst: constKeyword != null ||
|
||||
constantContext == ConstantContext.inferred);
|
||||
libraryBuilder.checkBoundsInSetLiteral(node, typeEnvironment, uri);
|
||||
push(node);
|
||||
}
|
||||
|
||||
@@ -3971,9 +3971,9 @@ class BodyBuilder extends StackListenerImpl
|
||||
keyType = const InvalidType();
|
||||
valueType = const InvalidType();
|
||||
} else {
|
||||
keyType = buildDartType(typeArguments[0],
|
||||
keyType = buildDartType(typeArguments[0], TypeUse.literalTypeArgument,
|
||||
allowPotentiallyConstantType: false);
|
||||
valueType = buildDartType(typeArguments[1],
|
||||
valueType = buildDartType(typeArguments[1], TypeUse.literalTypeArgument,
|
||||
allowPotentiallyConstantType: false);
|
||||
keyType = instantiateToBounds(
|
||||
keyType, coreTypes.objectClass, libraryBuilder.library);
|
||||
@@ -3995,7 +3995,6 @@ class BodyBuilder extends StackListenerImpl
|
||||
entries,
|
||||
isConst: constKeyword != null ||
|
||||
constantContext == ConstantContext.inferred);
|
||||
libraryBuilder.checkBoundsInMapLiteral(node, typeEnvironment, uri);
|
||||
push(node);
|
||||
}
|
||||
|
||||
@@ -4222,10 +4221,8 @@ class BodyBuilder extends StackListenerImpl
|
||||
@override
|
||||
void handleAsOperator(Token operator) {
|
||||
debugEvent("AsOperator");
|
||||
DartType type = buildDartType(pop() as TypeBuilder,
|
||||
DartType type = buildDartType(pop() as TypeBuilder, TypeUse.asType,
|
||||
allowPotentiallyConstantType: libraryBuilder.isNonNullableByDefault);
|
||||
libraryBuilder.checkBoundsInType(
|
||||
type, typeEnvironment, uri, operator.charOffset);
|
||||
Expression expression = popForValue();
|
||||
Expression asExpression = forest.createAsExpression(
|
||||
offsetForToken(operator), expression, type,
|
||||
@@ -4246,15 +4243,13 @@ class BodyBuilder extends StackListenerImpl
|
||||
@override
|
||||
void handleIsOperator(Token isOperator, Token? not) {
|
||||
debugEvent("IsOperator");
|
||||
DartType type = buildDartType(pop() as TypeBuilder,
|
||||
DartType type = buildDartType(pop() as TypeBuilder, TypeUse.isType,
|
||||
allowPotentiallyConstantType: libraryBuilder.isNonNullableByDefault);
|
||||
Expression operand = popForValue();
|
||||
Expression isExpression = forest.createIsExpression(
|
||||
offsetForToken(isOperator), operand, type,
|
||||
forNonNullableByDefault: libraryBuilder.isNonNullableByDefault,
|
||||
notFileOffset: not != null ? offsetForToken(not) : null);
|
||||
libraryBuilder.checkBoundsInType(
|
||||
type, typeEnvironment, uri, isOperator.charOffset);
|
||||
push(isExpression);
|
||||
}
|
||||
|
||||
@@ -4351,16 +4346,6 @@ class BodyBuilder extends StackListenerImpl
|
||||
}
|
||||
Object? nameNode = pop();
|
||||
TypeBuilder? type = pop() as TypeBuilder?;
|
||||
if (functionNestingLevel == 0 && type != null) {
|
||||
// TODO(ahe): The type we compute here may be different from what is
|
||||
// computed in the outline phase. We should make sure that the outline
|
||||
// phase computes the same type. See
|
||||
// pkg/front_end/testcases/deferred_type_annotation.dart for an example
|
||||
// where not calling [buildDartType] leads to a missing compile-time
|
||||
// error. Also, notice that the type of the problematic parameter isn't
|
||||
// `invalid-type`.
|
||||
buildDartType(type, allowPotentiallyConstantType: false);
|
||||
}
|
||||
Token? varOrFinalOrConst = pop(NullValue.Token) as Token?;
|
||||
if (superKeyword != null &&
|
||||
varOrFinalOrConst != null &&
|
||||
@@ -4569,7 +4554,7 @@ class BodyBuilder extends StackListenerImpl
|
||||
popIfNotNull(onKeyword) as TypeBuilder?;
|
||||
DartType exceptionType;
|
||||
if (unresolvedExceptionType != null) {
|
||||
exceptionType = buildDartType(unresolvedExceptionType,
|
||||
exceptionType = buildDartType(unresolvedExceptionType, TypeUse.catchType,
|
||||
allowPotentiallyConstantType: false);
|
||||
} else {
|
||||
exceptionType = (libraryBuilder.isNonNullableByDefault
|
||||
@@ -5285,7 +5270,7 @@ class BodyBuilder extends StackListenerImpl
|
||||
receiver = forest.createInstantiation(
|
||||
instantiationOffset,
|
||||
receiver,
|
||||
buildDartTypeArguments(typeArguments,
|
||||
buildDartTypeArguments(typeArguments, TypeUse.tearOffTypeArgument,
|
||||
allowPotentiallyConstantType: true));
|
||||
}
|
||||
return forest.createMethodInvocation(invocationOffset, receiver,
|
||||
@@ -5295,7 +5280,8 @@ class BodyBuilder extends StackListenerImpl
|
||||
assert(forest.argumentsTypeArguments(arguments).isEmpty);
|
||||
forest.argumentsSetTypeArguments(
|
||||
arguments,
|
||||
buildDartTypeArguments(typeArguments,
|
||||
buildDartTypeArguments(
|
||||
typeArguments, TypeUse.constructorTypeArgument,
|
||||
allowPotentiallyConstantType: false));
|
||||
}
|
||||
return buildUnresolvedError(
|
||||
@@ -5437,7 +5423,8 @@ class BodyBuilder extends StackListenerImpl
|
||||
}
|
||||
List<DartType> dartTypeArguments = [];
|
||||
for (TypeBuilder typeBuilder in unaliasedTypeArgumentBuilders) {
|
||||
dartTypeArguments.add(typeBuilder.build(libraryBuilder));
|
||||
dartTypeArguments.add(typeBuilder.build(
|
||||
libraryBuilder, TypeUse.constructorTypeArgument));
|
||||
}
|
||||
assert(forest.argumentsTypeArguments(arguments).isEmpty);
|
||||
forest.argumentsSetTypeArguments(arguments, dartTypeArguments);
|
||||
@@ -5452,8 +5439,8 @@ class BodyBuilder extends StackListenerImpl
|
||||
typeArgumentBuilders.length, const DynamicType(),
|
||||
growable: false);
|
||||
for (int i = 0; i < typeArgumentsToCheck.length; ++i) {
|
||||
typeArgumentsToCheck[i] =
|
||||
typeArgumentBuilders[i].build(libraryBuilder);
|
||||
typeArgumentsToCheck[i] = typeArgumentBuilders[i]
|
||||
.build(libraryBuilder, TypeUse.constructorTypeArgument);
|
||||
}
|
||||
}
|
||||
DartType typeToCheck = new TypedefType(
|
||||
@@ -5491,7 +5478,8 @@ class BodyBuilder extends StackListenerImpl
|
||||
}
|
||||
List<DartType> dartTypeArguments = [];
|
||||
for (TypeBuilder typeBuilder in unaliasedTypeArgumentBuilders) {
|
||||
dartTypeArguments.add(typeBuilder.build(libraryBuilder));
|
||||
dartTypeArguments.add(typeBuilder.build(
|
||||
libraryBuilder, TypeUse.constructorTypeArgument));
|
||||
}
|
||||
assert(forest.argumentsTypeArguments(arguments).isEmpty);
|
||||
forest.argumentsSetTypeArguments(arguments, dartTypeArguments);
|
||||
@@ -5505,8 +5493,8 @@ class BodyBuilder extends StackListenerImpl
|
||||
// No type arguments provided to unaliased class, use defaults.
|
||||
List<DartType> result = new List<DartType>.generate(
|
||||
cls.typeVariables!.length,
|
||||
(int i) => cls.typeVariables![i].defaultType!
|
||||
.build(cls.libraryBuilder),
|
||||
(int i) => cls.typeVariables![i].defaultType!.build(
|
||||
cls.libraryBuilder, TypeUse.constructorTypeArgument),
|
||||
growable: true);
|
||||
forest.argumentsSetTypeArguments(arguments, result);
|
||||
}
|
||||
@@ -5518,7 +5506,8 @@ class BodyBuilder extends StackListenerImpl
|
||||
assert(forest.argumentsTypeArguments(arguments).isEmpty);
|
||||
forest.argumentsSetTypeArguments(
|
||||
arguments,
|
||||
buildDartTypeArguments(typeArguments,
|
||||
buildDartTypeArguments(
|
||||
typeArguments, TypeUse.constructorTypeArgument,
|
||||
allowPotentiallyConstantType: false));
|
||||
}
|
||||
}
|
||||
@@ -7195,7 +7184,7 @@ class BodyBuilder extends StackListenerImpl
|
||||
} else {
|
||||
push(new Instantiation(
|
||||
toValue(operand),
|
||||
buildDartTypeArguments(typeArguments,
|
||||
buildDartTypeArguments(typeArguments, TypeUse.tearOffTypeArgument,
|
||||
allowPotentiallyConstantType: true))
|
||||
..fileOffset = openAngleBracket.charOffset);
|
||||
}
|
||||
@@ -7425,20 +7414,28 @@ class BodyBuilder extends StackListenerImpl
|
||||
}
|
||||
|
||||
@override
|
||||
DartType buildDartType(TypeBuilder typeBuilder,
|
||||
DartType buildDartType(TypeBuilder typeBuilder, TypeUse typeUse,
|
||||
{required bool allowPotentiallyConstantType}) {
|
||||
return validateTypeVariableUse(typeBuilder,
|
||||
allowPotentiallyConstantType: allowPotentiallyConstantType)
|
||||
.build(libraryBuilder);
|
||||
.build(libraryBuilder, typeUse);
|
||||
}
|
||||
|
||||
DartType buildAliasedDartType(TypeBuilder typeBuilder, TypeUse typeUse,
|
||||
{required bool allowPotentiallyConstantType}) {
|
||||
return validateTypeVariableUse(typeBuilder,
|
||||
allowPotentiallyConstantType: allowPotentiallyConstantType)
|
||||
.buildAliased(libraryBuilder, typeUse);
|
||||
}
|
||||
|
||||
@override
|
||||
List<DartType> buildDartTypeArguments(List<TypeBuilder>? unresolvedTypes,
|
||||
List<DartType> buildDartTypeArguments(
|
||||
List<TypeBuilder>? unresolvedTypes, TypeUse typeUse,
|
||||
{required bool allowPotentiallyConstantType}) {
|
||||
if (unresolvedTypes == null) return <DartType>[];
|
||||
return new List<DartType>.generate(
|
||||
unresolvedTypes.length,
|
||||
(int i) => buildDartType(unresolvedTypes[i],
|
||||
(int i) => buildDartType(unresolvedTypes[i], typeUse,
|
||||
allowPotentiallyConstantType: allowPotentiallyConstantType),
|
||||
growable: true);
|
||||
}
|
||||
@@ -7652,9 +7649,12 @@ class FormalParameters {
|
||||
AsyncMarker asyncModifier,
|
||||
Statement body,
|
||||
int fileEndOffset) {
|
||||
// TODO(johnniwinther): Avoid creating a FunctionTypeBuilder to create
|
||||
// the function. The function type is not written as a type by the user
|
||||
// and shouldn't be checked as such.
|
||||
FunctionType type = toFunctionType(
|
||||
returnType, const NullabilityBuilder.omitted(), typeParameters)
|
||||
.build(library) as FunctionType;
|
||||
.build(library, TypeUse.functionSignature) as FunctionType;
|
||||
List<VariableDeclaration> positionalParameters = <VariableDeclaration>[];
|
||||
List<VariableDeclaration> namedParameters = <VariableDeclaration>[];
|
||||
if (parameters != null) {
|
||||
|
||||
@@ -11,6 +11,7 @@ import 'package:_fe_analyzer_shared/src/parser/parser.dart'
|
||||
import 'package:_fe_analyzer_shared/src/scanner/token.dart' show Token;
|
||||
|
||||
import 'package:kernel/ast.dart';
|
||||
import 'package:kernel/src/unaliasing.dart';
|
||||
import 'package:kernel/text/ast_to_text.dart';
|
||||
import 'package:kernel/type_algebra.dart';
|
||||
|
||||
@@ -56,7 +57,6 @@ import '../problems.dart';
|
||||
|
||||
import '../scope.dart';
|
||||
|
||||
import '../source/source_library_builder.dart';
|
||||
import '../source/stack_listener_impl.dart' show offsetForToken;
|
||||
|
||||
import 'body_builder.dart' show noLocation;
|
||||
@@ -261,7 +261,8 @@ abstract class Generator {
|
||||
int fileOffset, List<TypeBuilder>? typeArguments) {
|
||||
return new Instantiation(
|
||||
buildSimpleRead(),
|
||||
_helper.buildDartTypeArguments(typeArguments,
|
||||
_helper.buildDartTypeArguments(
|
||||
typeArguments, TypeUse.tearOffTypeArgument,
|
||||
allowPotentiallyConstantType: true))
|
||||
..fileOffset = fileOffset;
|
||||
}
|
||||
@@ -2920,7 +2921,7 @@ class DeferredAccessGenerator extends Generator {
|
||||
int charOffset = offsetForToken(prefixGenerator.token);
|
||||
message = templateDeferredTypeAnnotation
|
||||
.withArguments(
|
||||
_helper.buildDartType(type,
|
||||
_helper.buildDartType(type, TypeUse.deferredTypeError,
|
||||
allowPotentiallyConstantType: allowPotentiallyConstantType),
|
||||
prefixGenerator._plainNameForRead,
|
||||
_helper.libraryBuilder.isNonNullableByDefault)
|
||||
@@ -3084,6 +3085,7 @@ class TypeUseGenerator extends AbstractReadOnlyAccessGenerator {
|
||||
buildTypeWithResolvedArguments(
|
||||
_helper.libraryBuilder.nonNullableBuilder, typeArguments,
|
||||
allowPotentiallyConstantType: true, forTypeLiteral: true),
|
||||
TypeUse.typeLiteral,
|
||||
allowPotentiallyConstantType:
|
||||
_helper.libraryFeatures.constructorTearoffs.isEnabled));
|
||||
}
|
||||
@@ -3127,14 +3129,15 @@ class TypeUseGenerator extends AbstractReadOnlyAccessGenerator {
|
||||
} else {
|
||||
if (declarationBuilder is DeclarationBuilder) {
|
||||
if (aliasedTypeArguments != null) {
|
||||
_helper.libraryBuilder.uncheckedTypedefTypes.add(
|
||||
new UncheckedTypedefType(new TypedefType(
|
||||
aliasBuilder.typedef,
|
||||
_helper.libraryBuilder.nonNullable,
|
||||
aliasBuilder.buildTypeArguments(
|
||||
_helper.libraryBuilder, aliasedTypeArguments)))
|
||||
..fileUri = _uri
|
||||
..offset = fileOffset);
|
||||
new NamedTypeBuilder(
|
||||
aliasBuilder.name, const NullabilityBuilder.omitted(),
|
||||
arguments: aliasedTypeArguments,
|
||||
fileUri: _uri,
|
||||
charOffset: fileOffset,
|
||||
instanceTypeVariableAccess:
|
||||
_helper.instanceTypeVariableAccessState)
|
||||
..bind(_helper.libraryBuilder, aliasBuilder)
|
||||
..build(_helper.libraryBuilder, TypeUse.instantiation);
|
||||
}
|
||||
|
||||
// If the arguments weren't supplied, the tear off is treated as
|
||||
@@ -3225,12 +3228,15 @@ class TypeUseGenerator extends AbstractReadOnlyAccessGenerator {
|
||||
builtTypeArguments.add(typeParameter.defaultType);
|
||||
}
|
||||
} else {
|
||||
builtTypeArguments = declarationBuilder.buildTypeArguments(
|
||||
_helper.libraryBuilder, unaliasedTypeArguments);
|
||||
builtTypeArguments = unaliasTypes(
|
||||
declarationBuilder.buildAliasedTypeArguments(
|
||||
_helper.libraryBuilder, unaliasedTypeArguments),
|
||||
legacyEraseAliases:
|
||||
!_helper.libraryBuilder.isNonNullableByDefault)!;
|
||||
}
|
||||
} else if (typeArguments != null) {
|
||||
builtTypeArguments = _helper.buildDartTypeArguments(
|
||||
typeArguments,
|
||||
typeArguments, TypeUse.tearOffTypeArgument,
|
||||
allowPotentiallyConstantType: true);
|
||||
}
|
||||
if (isGenericTypedefTearOff) {
|
||||
@@ -3262,6 +3268,10 @@ class TypeUseGenerator extends AbstractReadOnlyAccessGenerator {
|
||||
.add(freshTypeParameters.substitute(builtTypeArgument));
|
||||
}
|
||||
}
|
||||
substitutedTypeArguments = unaliasTypes(
|
||||
substitutedTypeArguments,
|
||||
legacyEraseAliases:
|
||||
!_helper.libraryBuilder.isNonNullableByDefault);
|
||||
|
||||
tearOffExpression = _helper.forest.createTypedefTearOff(
|
||||
token.charOffset,
|
||||
@@ -3271,6 +3281,10 @@ class TypeUseGenerator extends AbstractReadOnlyAccessGenerator {
|
||||
} else {
|
||||
if (builtTypeArguments != null &&
|
||||
builtTypeArguments.isNotEmpty) {
|
||||
builtTypeArguments = unaliasTypes(builtTypeArguments,
|
||||
legacyEraseAliases:
|
||||
!_helper.libraryBuilder.isNonNullableByDefault)!;
|
||||
|
||||
tearOffExpression = _helper.forest.createInstantiation(
|
||||
token.charOffset, tearOffExpression, builtTypeArguments);
|
||||
}
|
||||
@@ -3672,7 +3686,8 @@ abstract class ErroneousExpressionGenerator extends Generator {
|
||||
assert(_forest.argumentsTypeArguments(arguments).isEmpty);
|
||||
_forest.argumentsSetTypeArguments(
|
||||
arguments,
|
||||
_helper.buildDartTypeArguments(typeArguments,
|
||||
_helper.buildDartTypeArguments(
|
||||
typeArguments, TypeUse.constructorTypeArgument,
|
||||
allowPotentiallyConstantType: false));
|
||||
}
|
||||
return buildError(arguments, kind: UnresolvedKind.Constructor);
|
||||
|
||||
@@ -150,10 +150,11 @@ abstract class ExpressionGeneratorHelper implements InferenceHelper {
|
||||
Expression evaluateArgumentsBefore(
|
||||
Arguments arguments, Expression expression);
|
||||
|
||||
DartType buildDartType(TypeBuilder typeBuilder,
|
||||
DartType buildDartType(TypeBuilder typeBuilder, TypeUse typeUse,
|
||||
{required bool allowPotentiallyConstantType});
|
||||
|
||||
List<DartType> buildDartTypeArguments(List<TypeBuilder>? typeArguments,
|
||||
List<DartType> buildDartTypeArguments(
|
||||
List<TypeBuilder>? typeArguments, TypeUse typeUse,
|
||||
{required bool allowPotentiallyConstantType});
|
||||
|
||||
void reportDuplicatedDeclaration(
|
||||
|
||||
@@ -18,7 +18,7 @@ import '../../base/instrumentation.dart'
|
||||
import '../fasta_codes.dart';
|
||||
import '../names.dart';
|
||||
import '../problems.dart' show unhandled;
|
||||
import '../source/source_library_builder.dart' show SourceLibraryBuilder;
|
||||
import '../source/source_library_builder.dart';
|
||||
import '../type_inference/type_constraint_gatherer.dart';
|
||||
import '../type_inference/type_inference_engine.dart';
|
||||
import '../type_inference/type_inferrer.dart';
|
||||
@@ -274,8 +274,7 @@ class InferenceVisitor
|
||||
resultType.returnType, resultType.declaredNullability,
|
||||
namedParameters: resultType.namedParameters,
|
||||
typeParameters: freshTypeParameters.freshTypeParameters,
|
||||
requiredParameterCount: resultType.requiredParameterCount,
|
||||
typedefType: null);
|
||||
requiredParameterCount: resultType.requiredParameterCount);
|
||||
ExpressionInferenceResult inferredResult =
|
||||
inferrer.instantiateTearOff(resultType, typeContext, node);
|
||||
return inferrer.ensureAssignableResult(typeContext, inferredResult);
|
||||
@@ -1397,8 +1396,6 @@ class InferenceVisitor
|
||||
inferrer.dataForTesting!.typeInferenceResult.inferredVariableTypes[node] =
|
||||
inferredType.returnType;
|
||||
}
|
||||
inferrer.libraryBuilder.checkBoundsInFunctionNode(node.function,
|
||||
inferrer.typeSchemaEnvironment, inferrer.libraryBuilder.fileUri);
|
||||
node.variable.type = inferredType;
|
||||
inferrer.flowAnalysis.functionExpression_end();
|
||||
return const StatementInferenceResult();
|
||||
@@ -1414,11 +1411,6 @@ class InferenceVisitor
|
||||
inferrer.dataForTesting!.typeInferenceResult.inferredVariableTypes[node] =
|
||||
inferredType.returnType;
|
||||
}
|
||||
// In anonymous functions the return type isn't declared, so
|
||||
// it shouldn't be checked.
|
||||
inferrer.libraryBuilder.checkBoundsInFunctionNode(node.function,
|
||||
inferrer.typeSchemaEnvironment, inferrer.libraryBuilder.fileUri,
|
||||
skipReturnType: true);
|
||||
inferrer.flowAnalysis.functionExpression_end();
|
||||
return new ExpressionInferenceResult(inferredType, node);
|
||||
}
|
||||
@@ -2088,9 +2080,10 @@ class InferenceVisitor
|
||||
if (!inferrer.isTopLevel) {
|
||||
SourceLibraryBuilder library = inferrer.libraryBuilder;
|
||||
if (inferenceNeeded) {
|
||||
library.checkBoundsInListLiteral(
|
||||
node, inferrer.typeSchemaEnvironment, inferrer.helper!.uri,
|
||||
inferred: true);
|
||||
if (!library.libraryFeatures.genericMetadata.isEnabled) {
|
||||
inferrer.checkGenericFunctionTypeArgument(
|
||||
node.typeArgument, node.fileOffset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2885,9 +2878,12 @@ class InferenceVisitor
|
||||
// Either both [_declaredKeyType] and [_declaredValueType] are omitted or
|
||||
// none of them, so we may just check one.
|
||||
if (inferenceNeeded) {
|
||||
library.checkBoundsInMapLiteral(
|
||||
node, inferrer.typeSchemaEnvironment, inferrer.helper!.uri,
|
||||
inferred: true);
|
||||
if (!library.libraryFeatures.genericMetadata.isEnabled) {
|
||||
inferrer.checkGenericFunctionTypeArgument(
|
||||
node.keyType, node.fileOffset);
|
||||
inferrer.checkGenericFunctionTypeArgument(
|
||||
node.valueType, node.fileOffset);
|
||||
}
|
||||
}
|
||||
}
|
||||
return new ExpressionInferenceResult(inferredType, node);
|
||||
@@ -6032,9 +6028,10 @@ class InferenceVisitor
|
||||
if (!inferrer.isTopLevel) {
|
||||
SourceLibraryBuilder library = inferrer.libraryBuilder;
|
||||
if (inferenceNeeded) {
|
||||
library.checkBoundsInSetLiteral(
|
||||
node, inferrer.typeSchemaEnvironment, inferrer.helper!.uri,
|
||||
inferred: true);
|
||||
if (!library.libraryFeatures.genericMetadata.isEnabled) {
|
||||
inferrer.checkGenericFunctionTypeArgument(
|
||||
node.typeArgument, node.fileOffset);
|
||||
}
|
||||
}
|
||||
|
||||
if (!library.loader.target.backendTarget.supportsSetLiterals) {
|
||||
@@ -6453,13 +6450,6 @@ class InferenceVisitor
|
||||
TypeLiteral node, DartType typeContext) {
|
||||
DartType inferredType =
|
||||
inferrer.coreTypes.typeRawType(inferrer.libraryBuilder.nonNullable);
|
||||
if (inferrer.libraryFeatures.constructorTearoffs.isEnabled) {
|
||||
inferrer.libraryBuilder.checkBoundsInType(
|
||||
node.type,
|
||||
inferrer.typeSchemaEnvironment,
|
||||
inferrer.libraryBuilder.fileUri,
|
||||
node.fileOffset);
|
||||
}
|
||||
return new ExpressionInferenceResult(inferredType, node);
|
||||
}
|
||||
|
||||
@@ -6592,14 +6582,6 @@ class InferenceVisitor
|
||||
Expression initializer = initializerResult.expression;
|
||||
node.initializer = initializer..parent = node;
|
||||
}
|
||||
if (!inferrer.isTopLevel) {
|
||||
SourceLibraryBuilder library = inferrer.libraryBuilder;
|
||||
if (node.isImplicitlyTyped) {
|
||||
library.checkBoundsInVariableDeclaration(
|
||||
node, inferrer.typeSchemaEnvironment, inferrer.helper!.uri,
|
||||
inferred: true);
|
||||
}
|
||||
}
|
||||
if (node.isLate &&
|
||||
inferrer.libraryBuilder.loader.target.backendTarget
|
||||
.isLateLocalLoweringEnabled(
|
||||
|
||||
@@ -89,9 +89,6 @@ class _InvalidTypeFinder implements DartTypeVisitor1<bool, Set<TypedefType>> {
|
||||
for (NamedType parameter in node.namedParameters) {
|
||||
if (parameter.type.accept1(this, visitedTypedefs)) return true;
|
||||
}
|
||||
if (node.typedefType != null && visitedTypedefs.add(node.typedefType!)) {
|
||||
if (node.typedefType!.accept1(this, visitedTypedefs)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ import '../../builder/nullability_builder.dart';
|
||||
import '../../builder/type_alias_builder.dart';
|
||||
import '../../builder/type_builder.dart';
|
||||
import '../../builder/type_declaration_builder.dart';
|
||||
import '../../uris.dart';
|
||||
import 'macro.dart';
|
||||
|
||||
abstract class IdentifierImpl extends macro.IdentifierImpl {
|
||||
@@ -41,7 +42,7 @@ abstract class IdentifierImpl extends macro.IdentifierImpl {
|
||||
} else if (typeDeclarationBuilder is TypeAliasBuilder) {
|
||||
uri = typeDeclarationBuilder.libraryBuilder.importUri;
|
||||
} else if (name == 'dynamic') {
|
||||
uri = Uri.parse('dart:core');
|
||||
uri = dartCore;
|
||||
}
|
||||
return new macro.ResolvedIdentifier(
|
||||
kind: macro.IdentifierKind.topLevelMember,
|
||||
@@ -88,8 +89,16 @@ class TypeBuilderIdentifier extends IdentifierImpl {
|
||||
@override
|
||||
DartType buildType(
|
||||
NullabilityBuilder nullabilityBuilder, List<DartType> typeArguments) {
|
||||
return typeBuilder.declaration!.buildTypeWithBuiltArguments(libraryBuilder,
|
||||
nullabilityBuilder.build(libraryBuilder), typeArguments);
|
||||
return typeBuilder.declaration!.buildAliasedTypeWithBuiltArguments(
|
||||
libraryBuilder,
|
||||
nullabilityBuilder.build(libraryBuilder),
|
||||
typeArguments,
|
||||
TypeUse.macroTypeArgument,
|
||||
// TODO(johnniwinther): How should handle malbounded types here? Should
|
||||
// we report an error on the annotation?
|
||||
missingUri,
|
||||
TreeNode.noOffset,
|
||||
hasExplicitTypeArguments: true);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -124,8 +133,16 @@ class TypeDeclarationBuilderIdentifier extends IdentifierImpl {
|
||||
@override
|
||||
DartType buildType(
|
||||
NullabilityBuilder nullabilityBuilder, List<DartType> typeArguments) {
|
||||
return typeDeclarationBuilder.buildTypeWithBuiltArguments(libraryBuilder,
|
||||
nullabilityBuilder.build(libraryBuilder), typeArguments);
|
||||
return typeDeclarationBuilder.buildAliasedTypeWithBuiltArguments(
|
||||
libraryBuilder,
|
||||
nullabilityBuilder.build(libraryBuilder),
|
||||
typeArguments,
|
||||
TypeUse.macroTypeArgument,
|
||||
// TODO(johnniwinther): How should handle malbounded types here? Should
|
||||
// we report an error on the annotation?
|
||||
missingUri,
|
||||
TreeNode.noOffset,
|
||||
hasExplicitTypeArguments: true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,7 +236,7 @@ class OmittedTypeIdentifier extends IdentifierImpl {
|
||||
kind: macro.IdentifierKind.topLevelMember,
|
||||
name: name,
|
||||
staticScope: null,
|
||||
uri: Uri.parse('dart:core'));
|
||||
uri: dartCore);
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -56,7 +56,7 @@ import '../util/helpers.dart';
|
||||
import 'source_constructor_builder.dart';
|
||||
import 'source_factory_builder.dart';
|
||||
import 'source_field_builder.dart';
|
||||
import 'source_library_builder.dart' show SourceLibraryBuilder;
|
||||
import 'source_library_builder.dart';
|
||||
import 'source_member_builder.dart';
|
||||
|
||||
Class initializeClass(
|
||||
@@ -523,15 +523,22 @@ class SourceClassBuilder extends ClassBuilderImpl
|
||||
int get typeVariablesCount => typeVariables?.length ?? 0;
|
||||
|
||||
@override
|
||||
List<DartType> buildTypeArguments(
|
||||
List<DartType> buildAliasedTypeArguments(
|
||||
LibraryBuilder library, List<TypeBuilder>? arguments) {
|
||||
if (arguments == null && typeVariables == null) {
|
||||
return <DartType>[];
|
||||
}
|
||||
|
||||
if (arguments == null && typeVariables != null) {
|
||||
List<DartType> result = new List<DartType>.generate(typeVariables!.length,
|
||||
(int i) => typeVariables![i].defaultType!.build(library),
|
||||
// TODO(johnniwinther): Use i2b here when needed.
|
||||
List<DartType> result = new List<DartType>.generate(
|
||||
typeVariables!.length,
|
||||
(int i) => typeVariables![i]
|
||||
.defaultType!
|
||||
// TODO(johnniwinther): Using [libraryBuilder] here instead of
|
||||
// [library] preserves the nullability of the original
|
||||
// declaration. Should we legacy erase this?
|
||||
.buildAliased(libraryBuilder, TypeUse.defaultTypeAsTypeArgument),
|
||||
growable: true);
|
||||
if (library is SourceLibraryBuilder) {
|
||||
library.inferredTypes.addAll(result);
|
||||
@@ -551,8 +558,8 @@ class SourceClassBuilder extends ClassBuilderImpl
|
||||
}
|
||||
|
||||
assert(arguments!.length == typeVariablesCount);
|
||||
List<DartType> result = new List<DartType>.generate(
|
||||
arguments!.length, (int i) => arguments[i].build(library),
|
||||
List<DartType> result = new List<DartType>.generate(arguments!.length,
|
||||
(int i) => arguments[i].buildAliased(library, TypeUse.typeArgument),
|
||||
growable: true);
|
||||
return result;
|
||||
}
|
||||
@@ -1321,99 +1328,7 @@ class SourceClassBuilder extends ClassBuilderImpl
|
||||
}
|
||||
}
|
||||
|
||||
void checkBoundsInSupertype(
|
||||
Supertype supertype, TypeEnvironment typeEnvironment) {
|
||||
Library library = libraryBuilder.library;
|
||||
|
||||
List<TypeArgumentIssue> issues = findTypeArgumentIssues(
|
||||
new InterfaceType(
|
||||
supertype.classNode, library.nonNullable, supertype.typeArguments),
|
||||
typeEnvironment,
|
||||
libraryBuilder.isNonNullableByDefault
|
||||
? SubtypeCheckMode.withNullabilities
|
||||
: SubtypeCheckMode.ignoringNullabilities,
|
||||
allowSuperBounded: false,
|
||||
isNonNullableByDefault: library.isNonNullableByDefault,
|
||||
areGenericArgumentsAllowed:
|
||||
libraryBuilder.libraryFeatures.genericMetadata.isEnabled);
|
||||
for (TypeArgumentIssue issue in issues) {
|
||||
DartType argument = issue.argument;
|
||||
TypeParameter typeParameter = issue.typeParameter;
|
||||
bool inferred = libraryBuilder.inferredTypes.contains(argument);
|
||||
if (issue.isGenericTypeAsArgumentIssue) {
|
||||
if (inferred) {
|
||||
// Supertype can't be or contain super-bounded types, so null is
|
||||
// passed for super-bounded hint here.
|
||||
libraryBuilder.reportTypeArgumentIssue(
|
||||
templateGenericFunctionTypeInferredAsActualTypeArgument
|
||||
.withArguments(argument, library.isNonNullableByDefault),
|
||||
fileUri,
|
||||
charOffset,
|
||||
typeParameter: null,
|
||||
superBoundedAttempt: null,
|
||||
superBoundedAttemptInverted: null);
|
||||
} else {
|
||||
// Supertype can't be or contain super-bounded types, so null is
|
||||
// passed for super-bounded hint here.
|
||||
libraryBuilder.reportTypeArgumentIssue(
|
||||
messageGenericFunctionTypeUsedAsActualTypeArgument,
|
||||
fileUri,
|
||||
charOffset,
|
||||
typeParameter: null,
|
||||
superBoundedAttempt: null,
|
||||
superBoundedAttemptInverted: null);
|
||||
}
|
||||
} else {
|
||||
void reportProblem(
|
||||
Template<
|
||||
Message Function(DartType, DartType, String, String, String,
|
||||
String, bool)>
|
||||
template) {
|
||||
// Supertype can't be or contain super-bounded types, so null is
|
||||
// passed for super-bounded hint here.
|
||||
libraryBuilder.reportTypeArgumentIssue(
|
||||
template.withArguments(
|
||||
argument,
|
||||
typeParameter.bound,
|
||||
typeParameter.name!,
|
||||
getGenericTypeName(issue.enclosingType!),
|
||||
supertype.classNode.name,
|
||||
name,
|
||||
library.isNonNullableByDefault),
|
||||
fileUri,
|
||||
charOffset,
|
||||
typeParameter: typeParameter,
|
||||
superBoundedAttempt: null,
|
||||
superBoundedAttemptInverted: null);
|
||||
}
|
||||
|
||||
if (inferred) {
|
||||
reportProblem(templateIncorrectTypeArgumentInSupertypeInferred);
|
||||
} else {
|
||||
reportProblem(templateIncorrectTypeArgumentInSupertype);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void checkTypesInOutline(TypeEnvironment typeEnvironment) {
|
||||
libraryBuilder.checkBoundsInTypeParameters(
|
||||
typeEnvironment, cls.typeParameters, fileUri);
|
||||
|
||||
// Check in supers.
|
||||
if (cls.supertype != null) {
|
||||
checkBoundsInSupertype(cls.supertype!, typeEnvironment);
|
||||
}
|
||||
if (cls.mixedInType != null) {
|
||||
checkBoundsInSupertype(cls.mixedInType!, typeEnvironment);
|
||||
}
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (cls.implementedTypes != null) {
|
||||
for (Supertype supertype in cls.implementedTypes) {
|
||||
checkBoundsInSupertype(supertype, typeEnvironment);
|
||||
}
|
||||
}
|
||||
|
||||
forEach((String name, Builder builder) {
|
||||
if (builder is SourceMemberBuilder) {
|
||||
builder.checkVariance(this, typeEnvironment);
|
||||
|
||||
@@ -179,7 +179,9 @@ class SourceEnumBuilder extends SourceClassBuilder {
|
||||
List<SourceFieldBuilder> elementBuilders = <SourceFieldBuilder>[];
|
||||
NamedTypeBuilder selfType = new NamedTypeBuilder(
|
||||
name, const NullabilityBuilder.omitted(),
|
||||
instanceTypeVariableAccess: InstanceTypeVariableAccessState.Unexpected);
|
||||
instanceTypeVariableAccess: InstanceTypeVariableAccessState.Unexpected,
|
||||
fileUri: fileUri,
|
||||
charOffset: charOffset);
|
||||
NamedTypeBuilder listType = new NamedTypeBuilder(
|
||||
"List", const NullabilityBuilder.omitted(),
|
||||
arguments: <TypeBuilder>[selfType],
|
||||
@@ -628,7 +630,8 @@ class SourceEnumBuilder extends SourceClassBuilder {
|
||||
}
|
||||
|
||||
DartType buildElement(SourceFieldBuilder fieldBuilder, CoreTypes coreTypes) {
|
||||
DartType selfType = this.selfType.build(libraryBuilder);
|
||||
DartType selfType =
|
||||
this.selfType.build(libraryBuilder, TypeUse.enumSelfType);
|
||||
Builder? builder = firstMemberNamed(fieldBuilder.name);
|
||||
if (builder == null || !builder.isField) return selfType;
|
||||
fieldBuilder = builder as SourceFieldBuilder;
|
||||
@@ -674,7 +677,8 @@ class SourceEnumBuilder extends SourceClassBuilder {
|
||||
if (typeArgumentBuilders != null) {
|
||||
typeArguments = <DartType>[];
|
||||
for (TypeBuilder typeBuilder in typeArgumentBuilders) {
|
||||
typeArguments.add(typeBuilder.build(libraryBuilder));
|
||||
typeArguments.add(
|
||||
typeBuilder.build(libraryBuilder, TypeUse.constructorTypeArgument));
|
||||
}
|
||||
}
|
||||
if (libraryBuilder.libraryFeatures.enhancedEnums.isEnabled) {
|
||||
|
||||
@@ -91,7 +91,7 @@ class SourceExtensionBuilder extends ExtensionBuilderImpl {
|
||||
/// library.
|
||||
Extension build(LibraryBuilder coreLibrary,
|
||||
{required bool addMembersToLibrary}) {
|
||||
_extension.onType = onType.build(libraryBuilder);
|
||||
_extension.onType = onType.build(libraryBuilder, TypeUse.extensionOnType);
|
||||
extensionTypeShowHideClauseBuilder.buildAndStoreTypes(
|
||||
_extension, libraryBuilder);
|
||||
|
||||
@@ -242,16 +242,6 @@ class SourceExtensionBuilder extends ExtensionBuilderImpl {
|
||||
}
|
||||
|
||||
void checkTypesInOutline(TypeEnvironment typeEnvironment) {
|
||||
libraryBuilder.checkBoundsInTypeParameters(
|
||||
typeEnvironment, extension.typeParameters, fileUri);
|
||||
|
||||
// Check on clause.
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (_extension.onType != null) {
|
||||
libraryBuilder.checkBoundsInType(_extension.onType, typeEnvironment,
|
||||
onType.fileUri!, onType.charOffset!);
|
||||
}
|
||||
|
||||
forEach((String name, Builder builder) {
|
||||
if (builder is SourceFieldBuilder) {
|
||||
// Check fields.
|
||||
|
||||
@@ -360,7 +360,8 @@ class RedirectingFactoryBuilder extends SourceFactoryBuilder {
|
||||
if (redirectionTarget.typeArguments != null) {
|
||||
typeArguments = new List<DartType>.generate(
|
||||
redirectionTarget.typeArguments!.length,
|
||||
(int i) => redirectionTarget.typeArguments![i].build(libraryBuilder),
|
||||
(int i) => redirectionTarget.typeArguments![i]
|
||||
.build(libraryBuilder, TypeUse.redirectionTypeArgument),
|
||||
growable: false);
|
||||
}
|
||||
updatePrivateMemberName(_procedureInternal, libraryBuilder);
|
||||
|
||||
@@ -367,7 +367,7 @@ class SourceFieldBuilder extends SourceMemberBuilderImpl
|
||||
/// Builds the core AST structures for this field as needed for the outline.
|
||||
void build() {
|
||||
if (type != null) {
|
||||
fieldType = type!.build(libraryBuilder);
|
||||
fieldType = type!.build(libraryBuilder, TypeUse.fieldType);
|
||||
}
|
||||
_fieldEncoding.build(libraryBuilder, this);
|
||||
}
|
||||
|
||||
@@ -387,7 +387,8 @@ abstract class SourceFunctionBuilderImpl extends SourceMemberBuilderImpl
|
||||
function.requiredParameterCount = 1;
|
||||
}
|
||||
if (returnType != null) {
|
||||
function.returnType = returnType!.build(libraryBuilder);
|
||||
function.returnType =
|
||||
returnType!.build(libraryBuilder, TypeUse.returnType);
|
||||
}
|
||||
if (isExtensionInstanceMember) {
|
||||
ExtensionBuilder extensionBuilder = parent as ExtensionBuilder;
|
||||
|
||||
@@ -21,7 +21,8 @@ import 'package:kernel/src/bounds_checks.dart'
|
||||
TypeArgumentIssue,
|
||||
findTypeArgumentIssues,
|
||||
findTypeArgumentIssuesForInvocation,
|
||||
getGenericTypeName;
|
||||
getGenericTypeName,
|
||||
hasGenericFunctionTypeAsTypeArgument;
|
||||
import 'package:kernel/type_algebra.dart' show Substitution, substitute;
|
||||
import 'package:kernel/type_environment.dart'
|
||||
show SubtypeCheckMode, TypeEnvironment;
|
||||
@@ -175,8 +176,8 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
|
||||
final List<TypeVariableBuilder> unboundTypeVariables =
|
||||
<TypeVariableBuilder>[];
|
||||
|
||||
final List<UncheckedTypedefType> uncheckedTypedefTypes =
|
||||
<UncheckedTypedefType>[];
|
||||
final List<PendingBoundsCheck> _pendingBoundsChecks = [];
|
||||
final List<GenericFunctionTypeCheck> _pendingGenericFunctionTypeChecks = [];
|
||||
|
||||
// A list of alternating forwarders and the procedures they were generated
|
||||
// for. Note that it may not include a forwarder-origin pair in cases when
|
||||
@@ -3953,7 +3954,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
|
||||
addToExportScope(name, member);
|
||||
}
|
||||
|
||||
void reportTypeArgumentIssues(
|
||||
void _reportTypeArgumentIssues(
|
||||
Iterable<TypeArgumentIssue> issues, Uri fileUri, int offset,
|
||||
{bool? inferred,
|
||||
TypeArgumentsInfo? typeArgumentsInfo,
|
||||
@@ -4081,11 +4082,6 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
|
||||
|
||||
void checkTypesInField(
|
||||
SourceFieldBuilder fieldBuilder, TypeEnvironment typeEnvironment) {
|
||||
// Check the bounds in the field's type.
|
||||
checkBoundsInType(fieldBuilder.fieldType, typeEnvironment,
|
||||
fieldBuilder.fileUri, fieldBuilder.charOffset,
|
||||
allowSuperBounded: true);
|
||||
|
||||
// Check that the field has an initializer if its type is potentially
|
||||
// non-nullable.
|
||||
if (isNonNullableByDefault) {
|
||||
@@ -4132,133 +4128,8 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
|
||||
}
|
||||
}
|
||||
|
||||
void checkBoundsInTypeParameters(TypeEnvironment typeEnvironment,
|
||||
List<TypeParameter> typeParameters, Uri fileUri) {
|
||||
// Check in bounds of own type variables.
|
||||
for (TypeParameter parameter in typeParameters) {
|
||||
List<TypeArgumentIssue> issues = findTypeArgumentIssues(
|
||||
parameter.bound,
|
||||
typeEnvironment,
|
||||
isNonNullableByDefault
|
||||
? SubtypeCheckMode.withNullabilities
|
||||
: SubtypeCheckMode.ignoringNullabilities,
|
||||
allowSuperBounded: true,
|
||||
isNonNullableByDefault: library.isNonNullableByDefault,
|
||||
areGenericArgumentsAllowed:
|
||||
libraryFeatures.genericMetadata.isEnabled);
|
||||
for (TypeArgumentIssue issue in issues) {
|
||||
DartType argument = issue.argument;
|
||||
TypeParameter typeParameter = issue.typeParameter;
|
||||
if (inferredTypes.contains(argument)) {
|
||||
// Inference in type expressions in the supertypes boils down to
|
||||
// instantiate-to-bound which shouldn't produce anything that breaks
|
||||
// the bounds after the non-simplicity checks are done. So, any
|
||||
// violation here is the result of non-simple bounds, and the error
|
||||
// is reported elsewhere.
|
||||
continue;
|
||||
}
|
||||
|
||||
if (issue.isGenericTypeAsArgumentIssue) {
|
||||
reportTypeArgumentIssue(
|
||||
messageGenericFunctionTypeUsedAsActualTypeArgument,
|
||||
fileUri,
|
||||
parameter.fileOffset,
|
||||
typeParameter: null);
|
||||
} else {
|
||||
reportTypeArgumentIssue(
|
||||
templateIncorrectTypeArgument.withArguments(
|
||||
argument,
|
||||
typeParameter.bound,
|
||||
typeParameter.name!,
|
||||
getGenericTypeName(issue.enclosingType!),
|
||||
library.isNonNullableByDefault),
|
||||
fileUri,
|
||||
parameter.fileOffset,
|
||||
typeParameter: typeParameter,
|
||||
superBoundedAttempt: issue.enclosingType,
|
||||
superBoundedAttemptInverted: issue.invertedType);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void checkBoundsInFunctionNodeParts(
|
||||
TypeEnvironment typeEnvironment, Uri fileUri, int fileOffset,
|
||||
{List<TypeParameter>? typeParameters,
|
||||
List<VariableDeclaration>? positionalParameters,
|
||||
List<VariableDeclaration>? namedParameters,
|
||||
DartType? returnType,
|
||||
int? requiredParameterCount,
|
||||
bool skipReturnType = false}) {
|
||||
if (typeParameters != null) {
|
||||
for (TypeParameter parameter in typeParameters) {
|
||||
checkBoundsInType(
|
||||
parameter.bound, typeEnvironment, fileUri, parameter.fileOffset,
|
||||
allowSuperBounded: true);
|
||||
}
|
||||
}
|
||||
if (positionalParameters != null) {
|
||||
for (int i = 0; i < positionalParameters.length; ++i) {
|
||||
VariableDeclaration parameter = positionalParameters[i];
|
||||
checkBoundsInType(
|
||||
parameter.type, typeEnvironment, fileUri, parameter.fileOffset,
|
||||
allowSuperBounded: true);
|
||||
}
|
||||
}
|
||||
if (namedParameters != null) {
|
||||
for (int i = 0; i < namedParameters.length; ++i) {
|
||||
VariableDeclaration named = namedParameters[i];
|
||||
checkBoundsInType(
|
||||
named.type, typeEnvironment, fileUri, named.fileOffset,
|
||||
allowSuperBounded: true);
|
||||
}
|
||||
}
|
||||
if (!skipReturnType && returnType != null) {
|
||||
List<TypeArgumentIssue> issues = findTypeArgumentIssues(
|
||||
returnType,
|
||||
typeEnvironment,
|
||||
isNonNullableByDefault
|
||||
? SubtypeCheckMode.withNullabilities
|
||||
: SubtypeCheckMode.ignoringNullabilities,
|
||||
allowSuperBounded: true,
|
||||
isNonNullableByDefault: library.isNonNullableByDefault,
|
||||
areGenericArgumentsAllowed:
|
||||
libraryFeatures.genericMetadata.isEnabled);
|
||||
for (TypeArgumentIssue issue in issues) {
|
||||
DartType argument = issue.argument;
|
||||
TypeParameter typeParameter = issue.typeParameter;
|
||||
|
||||
// We don't need to check if [argument] was inferred or specified
|
||||
// here, because inference in return types boils down to instantiate-
|
||||
// -to-bound, and it can't provide a type that violates the bound.
|
||||
if (issue.isGenericTypeAsArgumentIssue) {
|
||||
reportTypeArgumentIssue(
|
||||
messageGenericFunctionTypeUsedAsActualTypeArgument,
|
||||
fileUri,
|
||||
fileOffset,
|
||||
typeParameter: null);
|
||||
} else {
|
||||
reportTypeArgumentIssue(
|
||||
templateIncorrectTypeArgumentInReturnType.withArguments(
|
||||
argument,
|
||||
typeParameter.bound,
|
||||
typeParameter.name!,
|
||||
getGenericTypeName(issue.enclosingType!),
|
||||
isNonNullableByDefault),
|
||||
fileUri,
|
||||
fileOffset,
|
||||
typeParameter: typeParameter,
|
||||
superBoundedAttempt: issue.enclosingType,
|
||||
superBoundedAttemptInverted: issue.invertedType);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void checkTypesInFunctionBuilder(
|
||||
SourceFunctionBuilder procedureBuilder, TypeEnvironment typeEnvironment) {
|
||||
checkBoundsInFunctionNode(
|
||||
procedureBuilder.function, typeEnvironment, procedureBuilder.fileUri!);
|
||||
if (procedureBuilder.formals != null &&
|
||||
!(procedureBuilder.isAbstract || procedureBuilder.isExternal)) {
|
||||
checkInitializersInFormals(procedureBuilder.formals!, typeEnvironment);
|
||||
@@ -4268,8 +4139,6 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
|
||||
void checkTypesInConstructorBuilder(
|
||||
DeclaredSourceConstructorBuilder constructorBuilder,
|
||||
TypeEnvironment typeEnvironment) {
|
||||
checkBoundsInFunctionNode(
|
||||
constructorBuilder.constructor.function, typeEnvironment, fileUri);
|
||||
if (!constructorBuilder.isExternal && constructorBuilder.formals != null) {
|
||||
checkInitializersInFormals(constructorBuilder.formals!, typeEnvironment);
|
||||
}
|
||||
@@ -4278,50 +4147,10 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
|
||||
void checkTypesInRedirectingFactoryBuilder(
|
||||
RedirectingFactoryBuilder redirectingFactoryBuilder,
|
||||
TypeEnvironment typeEnvironment) {
|
||||
checkBoundsInFunctionNode(redirectingFactoryBuilder.function,
|
||||
typeEnvironment, redirectingFactoryBuilder.fileUri);
|
||||
// Default values are not required on redirecting factory constructors so
|
||||
// we don't call [checkInitializersInFormals].
|
||||
}
|
||||
|
||||
void checkBoundsInFunctionNode(
|
||||
FunctionNode function, TypeEnvironment typeEnvironment, Uri fileUri,
|
||||
{bool skipReturnType = false}) {
|
||||
checkBoundsInFunctionNodeParts(
|
||||
typeEnvironment, fileUri, function.fileOffset,
|
||||
typeParameters: function.typeParameters,
|
||||
positionalParameters: function.positionalParameters,
|
||||
namedParameters: function.namedParameters,
|
||||
returnType: function.returnType,
|
||||
requiredParameterCount: function.requiredParameterCount,
|
||||
skipReturnType: skipReturnType);
|
||||
}
|
||||
|
||||
void checkBoundsInListLiteral(
|
||||
ListLiteral node, TypeEnvironment typeEnvironment, Uri fileUri,
|
||||
{bool inferred = false}) {
|
||||
checkBoundsInType(
|
||||
node.typeArgument, typeEnvironment, fileUri, node.fileOffset,
|
||||
inferred: inferred, allowSuperBounded: true);
|
||||
}
|
||||
|
||||
void checkBoundsInSetLiteral(
|
||||
SetLiteral node, TypeEnvironment typeEnvironment, Uri fileUri,
|
||||
{bool inferred = false}) {
|
||||
checkBoundsInType(
|
||||
node.typeArgument, typeEnvironment, fileUri, node.fileOffset,
|
||||
inferred: inferred, allowSuperBounded: true);
|
||||
}
|
||||
|
||||
void checkBoundsInMapLiteral(
|
||||
MapLiteral node, TypeEnvironment typeEnvironment, Uri fileUri,
|
||||
{bool inferred = false}) {
|
||||
checkBoundsInType(node.keyType, typeEnvironment, fileUri, node.fileOffset,
|
||||
inferred: inferred, allowSuperBounded: true);
|
||||
checkBoundsInType(node.valueType, typeEnvironment, fileUri, node.fileOffset,
|
||||
inferred: inferred, allowSuperBounded: true);
|
||||
}
|
||||
|
||||
void checkBoundsInType(
|
||||
DartType type, TypeEnvironment typeEnvironment, Uri fileUri, int offset,
|
||||
{bool? inferred, bool allowSuperBounded = true}) {
|
||||
@@ -4334,16 +4163,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
|
||||
allowSuperBounded: allowSuperBounded,
|
||||
isNonNullableByDefault: library.isNonNullableByDefault,
|
||||
areGenericArgumentsAllowed: libraryFeatures.genericMetadata.isEnabled);
|
||||
reportTypeArgumentIssues(issues, fileUri, offset, inferred: inferred);
|
||||
}
|
||||
|
||||
void checkBoundsInVariableDeclaration(
|
||||
VariableDeclaration node, TypeEnvironment typeEnvironment, Uri fileUri,
|
||||
{bool inferred = false}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (node.type == null) return;
|
||||
checkBoundsInType(node.type, typeEnvironment, fileUri, node.fileOffset,
|
||||
inferred: inferred, allowSuperBounded: true);
|
||||
_reportTypeArgumentIssues(issues, fileUri, offset, inferred: inferred);
|
||||
}
|
||||
|
||||
void checkBoundsInConstructorInvocation(
|
||||
@@ -4408,7 +4228,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
|
||||
new InterfaceType(klass, klass.enclosingLibrary.nonNullable);
|
||||
}
|
||||
String targetName = node.target.name.text;
|
||||
reportTypeArgumentIssues(issues, fileUri, node.fileOffset,
|
||||
_reportTypeArgumentIssues(issues, fileUri, node.fileOffset,
|
||||
typeArgumentsInfo: typeArgumentsInfo,
|
||||
targetReceiver: targetReceiver,
|
||||
targetName: targetName);
|
||||
@@ -4487,7 +4307,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
|
||||
bottomType,
|
||||
isNonNullableByDefault: library.isNonNullableByDefault,
|
||||
areGenericArgumentsAllowed: libraryFeatures.genericMetadata.isEnabled);
|
||||
reportTypeArgumentIssues(issues, fileUri, offset,
|
||||
_reportTypeArgumentIssues(issues, fileUri, offset,
|
||||
typeArgumentsInfo: getTypeArgumentsInfo(arguments),
|
||||
targetReceiver: receiverType,
|
||||
targetName: name.text);
|
||||
@@ -4520,7 +4340,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
|
||||
bottomType,
|
||||
isNonNullableByDefault: library.isNonNullableByDefault,
|
||||
areGenericArgumentsAllowed: libraryFeatures.genericMetadata.isEnabled);
|
||||
reportTypeArgumentIssues(issues, fileUri, offset,
|
||||
_reportTypeArgumentIssues(issues, fileUri, offset,
|
||||
typeArgumentsInfo: getTypeArgumentsInfo(arguments),
|
||||
// TODO(johnniwinther): Special-case messaging on function type
|
||||
// invocation to avoid reference to 'call' and use the function type
|
||||
@@ -4557,7 +4377,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
|
||||
bottomType,
|
||||
isNonNullableByDefault: library.isNonNullableByDefault,
|
||||
areGenericArgumentsAllowed: libraryFeatures.genericMetadata.isEnabled);
|
||||
reportTypeArgumentIssues(issues, fileUri, offset,
|
||||
_reportTypeArgumentIssues(issues, fileUri, offset,
|
||||
targetReceiver: functionType,
|
||||
typeArgumentsInfo: inferred
|
||||
? const AllInferredTypeArgumentsInfo()
|
||||
@@ -4592,7 +4412,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
|
||||
} else if (declaration is SourceExtensionBuilder) {
|
||||
declaration.checkTypesInOutline(typeEnvironment);
|
||||
} else if (declaration is SourceTypeAliasBuilder) {
|
||||
declaration.checkTypesInOutline(typeEnvironment);
|
||||
// Do nothing.
|
||||
} else {
|
||||
assert(
|
||||
declaration is! TypeDeclarationBuilder ||
|
||||
@@ -4601,7 +4421,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
|
||||
}
|
||||
}
|
||||
inferredTypes.clear();
|
||||
checkUncheckedTypedefTypes(typeEnvironment);
|
||||
checkPendingBoundsChecks(typeEnvironment);
|
||||
}
|
||||
|
||||
void computeShowHideElements(ClassMembersBuilder membersBuilder) {
|
||||
@@ -4906,19 +4726,113 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
|
||||
return type;
|
||||
}
|
||||
|
||||
/// Performs delayed bounds checks on [TypedefType]s for the library
|
||||
///
|
||||
/// As [TypedefType]s are built, they are eagerly unaliased, making it
|
||||
/// impossible to perform the bounds checks on them at the time when the
|
||||
/// checks can be done. To perform the checks, [TypedefType]s are added to
|
||||
/// [uncheckedTypedefTypes] as they are built. This method performs the
|
||||
/// checks and clears the list of the types for the delayed check.
|
||||
void checkUncheckedTypedefTypes(TypeEnvironment typeEnvironment) {
|
||||
for (UncheckedTypedefType uncheckedTypedefType in uncheckedTypedefTypes) {
|
||||
checkBoundsInType(uncheckedTypedefType.typeToCheck, typeEnvironment,
|
||||
uncheckedTypedefType.fileUri!, uncheckedTypedefType.offset!);
|
||||
void registerBoundsCheck(
|
||||
DartType type, Uri fileUri, int charOffset, TypeUse typeUse,
|
||||
{required bool inferred}) {
|
||||
_pendingBoundsChecks.add(new PendingBoundsCheck(
|
||||
type, fileUri, charOffset, typeUse,
|
||||
inferred: inferred));
|
||||
}
|
||||
|
||||
void registerGenericFunctionTypeCheck(
|
||||
TypedefType type, Uri fileUri, int charOffset) {
|
||||
_pendingGenericFunctionTypeChecks
|
||||
.add(new GenericFunctionTypeCheck(type, fileUri, charOffset));
|
||||
}
|
||||
|
||||
/// Performs delayed bounds checks.
|
||||
void checkPendingBoundsChecks(TypeEnvironment typeEnvironment) {
|
||||
for (PendingBoundsCheck pendingBoundsCheck in _pendingBoundsChecks) {
|
||||
switch (pendingBoundsCheck.typeUse) {
|
||||
case TypeUse.literalTypeArgument:
|
||||
case TypeUse.variableType:
|
||||
case TypeUse.typeParameterBound:
|
||||
case TypeUse.parameterType:
|
||||
case TypeUse.fieldType:
|
||||
case TypeUse.returnType:
|
||||
case TypeUse.isType:
|
||||
case TypeUse.asType:
|
||||
case TypeUse.catchType:
|
||||
case TypeUse.constructorTypeArgument:
|
||||
case TypeUse.redirectionTypeArgument:
|
||||
case TypeUse.tearOffTypeArgument:
|
||||
case TypeUse.invocationTypeArgument:
|
||||
case TypeUse.typeLiteral:
|
||||
case TypeUse.extensionOnType:
|
||||
case TypeUse.typeArgument:
|
||||
checkBoundsInType(pendingBoundsCheck.type, typeEnvironment,
|
||||
pendingBoundsCheck.fileUri, pendingBoundsCheck.charOffset,
|
||||
inferred: pendingBoundsCheck.inferred, allowSuperBounded: true);
|
||||
break;
|
||||
case TypeUse.typedefAlias:
|
||||
case TypeUse.superType:
|
||||
case TypeUse.mixedInType:
|
||||
checkBoundsInType(pendingBoundsCheck.type, typeEnvironment,
|
||||
pendingBoundsCheck.fileUri, pendingBoundsCheck.charOffset,
|
||||
inferred: pendingBoundsCheck.inferred, allowSuperBounded: false);
|
||||
break;
|
||||
case TypeUse.instantiation:
|
||||
// TODO(johnniwinther): Should we allow super bounded tear offs of
|
||||
// non-proper renames?
|
||||
checkBoundsInType(pendingBoundsCheck.type, typeEnvironment,
|
||||
pendingBoundsCheck.fileUri, pendingBoundsCheck.charOffset,
|
||||
inferred: pendingBoundsCheck.inferred, allowSuperBounded: true);
|
||||
break;
|
||||
case TypeUse.enumSelfType:
|
||||
// TODO(johnniwinther): Check/create this type as regular bounded i2b.
|
||||
/*
|
||||
checkBoundsInType(pendingBoundsCheck.type, typeEnvironment,
|
||||
pendingBoundsCheck.fileUri, pendingBoundsCheck.charOffset,
|
||||
inferred: pendingBoundsCheck.inferred,
|
||||
allowSuperBounded: false);
|
||||
*/
|
||||
break;
|
||||
case TypeUse.macroTypeArgument:
|
||||
case TypeUse.typeParameterDefaultType:
|
||||
case TypeUse.defaultTypeAsTypeArgument:
|
||||
case TypeUse.deferredTypeError:
|
||||
case TypeUse.functionSignature:
|
||||
break;
|
||||
}
|
||||
}
|
||||
_pendingBoundsChecks.clear();
|
||||
|
||||
for (GenericFunctionTypeCheck genericFunctionTypeCheck
|
||||
in _pendingGenericFunctionTypeChecks) {
|
||||
checkGenericFunctionTypeAsTypeArgumentThroughTypedef(
|
||||
genericFunctionTypeCheck.type,
|
||||
genericFunctionTypeCheck.fileUri,
|
||||
genericFunctionTypeCheck.charOffset);
|
||||
}
|
||||
_pendingGenericFunctionTypeChecks.clear();
|
||||
}
|
||||
|
||||
/// Reports an error if [type] contains is a generic function type used as
|
||||
/// a type argument through its alias.
|
||||
///
|
||||
/// For instance
|
||||
///
|
||||
/// typedef A = B<void Function<T>(T)>;
|
||||
///
|
||||
/// here `A` doesn't use a generic function as type argument directly, but
|
||||
/// its unaliased value `B<void Function<T>(T)>` does.
|
||||
///
|
||||
/// This is used for reporting generic function types used as a type argument,
|
||||
/// which was disallowed before the 'generic-metadata' feature was enabled.
|
||||
void checkGenericFunctionTypeAsTypeArgumentThroughTypedef(
|
||||
TypedefType type, Uri fileUri, int fileOffset) {
|
||||
assert(!libraryFeatures.genericMetadata.isEnabled);
|
||||
if (!hasGenericFunctionTypeAsTypeArgument(type)) {
|
||||
DartType unaliased = type.unalias;
|
||||
if (hasGenericFunctionTypeAsTypeArgument(unaliased)) {
|
||||
addProblem(
|
||||
templateGenericFunctionTypeAsTypeArgumentThroughTypedef
|
||||
.withArguments(unaliased, type, isNonNullableByDefault),
|
||||
fileOffset,
|
||||
noLength,
|
||||
fileUri);
|
||||
}
|
||||
}
|
||||
uncheckedTypedefTypes.clear();
|
||||
}
|
||||
|
||||
void installTypedefTearOffs() {
|
||||
@@ -5459,11 +5373,21 @@ class PendingNullability {
|
||||
}
|
||||
}
|
||||
|
||||
class UncheckedTypedefType {
|
||||
final TypedefType typeToCheck;
|
||||
class PendingBoundsCheck {
|
||||
final DartType type;
|
||||
final Uri fileUri;
|
||||
final int charOffset;
|
||||
final TypeUse typeUse;
|
||||
final bool inferred;
|
||||
|
||||
int? offset;
|
||||
Uri? fileUri;
|
||||
|
||||
UncheckedTypedefType(this.typeToCheck);
|
||||
PendingBoundsCheck(this.type, this.fileUri, this.charOffset, this.typeUse,
|
||||
{required this.inferred});
|
||||
}
|
||||
|
||||
class GenericFunctionTypeCheck {
|
||||
final TypedefType type;
|
||||
final Uri fileUri;
|
||||
final int charOffset;
|
||||
|
||||
GenericFunctionTypeCheck(this.type, this.fileUri, this.charOffset);
|
||||
}
|
||||
|
||||
@@ -84,6 +84,7 @@ import '../ticker.dart' show Ticker;
|
||||
import '../type_inference/type_inference_engine.dart';
|
||||
import '../type_inference/type_inferrer.dart';
|
||||
import '../util/helpers.dart';
|
||||
import '../uris.dart';
|
||||
import 'diet_listener.dart' show DietListener;
|
||||
import 'diet_parser.dart' show DietParser, useImplicitCreationExpressionInCfe;
|
||||
import 'name_scheme.dart';
|
||||
@@ -717,6 +718,8 @@ class SourceLoader extends Loader {
|
||||
List<LocatedMessage>? context,
|
||||
bool problemOnLibrary: false,
|
||||
List<Uri>? involvedFiles}) {
|
||||
assert(
|
||||
fileUri != missingUri, "Message unexpectedly reported on missing uri.");
|
||||
severity ??= message.code.severity;
|
||||
if (severity == Severity.ignored) return null;
|
||||
String trace = """
|
||||
|
||||
@@ -6,7 +6,6 @@ library fasta.source_type_alias_builder;
|
||||
|
||||
import 'package:kernel/ast.dart';
|
||||
import 'package:kernel/class_hierarchy.dart';
|
||||
import 'package:kernel/type_environment.dart';
|
||||
|
||||
import '../builder/builder.dart';
|
||||
import '../builder/class_builder.dart';
|
||||
@@ -88,7 +87,7 @@ class SourceTypeAliasBuilder extends TypeAliasBuilderImpl {
|
||||
}
|
||||
|
||||
Typedef build() {
|
||||
typedef.type ??= buildThisType();
|
||||
buildThisType();
|
||||
|
||||
TypeBuilder? type = this.type;
|
||||
if (type is FunctionTypeBuilder ||
|
||||
@@ -120,38 +119,29 @@ class SourceTypeAliasBuilder extends TypeAliasBuilderImpl {
|
||||
// detect cycles by detecting recursive calls to this method using an
|
||||
// instance of InvalidType that isn't identical to `const InvalidType()`.
|
||||
thisType = pendingTypeAliasMarker;
|
||||
DartType builtType = const InvalidType();
|
||||
TypeBuilder? type = this.type;
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (type != null) {
|
||||
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);
|
||||
}
|
||||
builtType = type.build(libraryBuilder, TypeUse.typedefAlias);
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (builtType != null) {
|
||||
if (typeVariables != null) {
|
||||
for (TypeVariableBuilder tv in typeVariables!) {
|
||||
// Follow bound in order to find all cycles
|
||||
tv.bound?.build(libraryBuilder);
|
||||
tv.bound?.build(libraryBuilder, TypeUse.typeParameterBound);
|
||||
}
|
||||
}
|
||||
if (identical(thisType, cyclicTypeAliasMarker)) {
|
||||
return thisType = const InvalidType();
|
||||
builtType = const InvalidType();
|
||||
} else {
|
||||
return thisType = builtType;
|
||||
builtType = builtType;
|
||||
}
|
||||
} else {
|
||||
return thisType = const InvalidType();
|
||||
builtType = const InvalidType();
|
||||
}
|
||||
}
|
||||
return thisType = const InvalidType();
|
||||
return thisType = typedef.type ??= builtType;
|
||||
}
|
||||
|
||||
TypedefType thisTypedefType(Typedef typedef, LibraryBuilder clientLibrary) {
|
||||
@@ -190,15 +180,23 @@ class SourceTypeAliasBuilder extends TypeAliasBuilderImpl {
|
||||
}
|
||||
|
||||
@override
|
||||
List<DartType> buildTypeArguments(
|
||||
List<DartType> buildAliasedTypeArguments(
|
||||
LibraryBuilder library, List<TypeBuilder>? arguments) {
|
||||
if (arguments == null && typeVariables == null) {
|
||||
return <DartType>[];
|
||||
}
|
||||
|
||||
if (arguments == null && typeVariables != null) {
|
||||
List<DartType> result = new List<DartType>.generate(typeVariables!.length,
|
||||
(int i) => typeVariables![i].defaultType!.build(library),
|
||||
// TODO(johnniwinther): Use i2b here when needed.
|
||||
List<DartType> result = new List<DartType>.generate(
|
||||
typeVariables!.length,
|
||||
(int i) => typeVariables![i]
|
||||
.defaultType!
|
||||
// TODO(johnniwinther): Using [libraryBuilder] here instead of
|
||||
// [library] preserves the nullability of the original
|
||||
// declaration. We legacy erase it later, but should we legacy
|
||||
// erase it now also?
|
||||
.buildAliased(libraryBuilder, TypeUse.defaultTypeAsTypeArgument),
|
||||
growable: true);
|
||||
if (library is SourceLibraryBuilder) {
|
||||
library.inferredTypes.addAll(result);
|
||||
@@ -218,19 +216,11 @@ class SourceTypeAliasBuilder extends TypeAliasBuilderImpl {
|
||||
}
|
||||
|
||||
// arguments.length == typeVariables.length
|
||||
return new List<DartType>.generate(
|
||||
arguments!.length, (int i) => arguments[i].build(library),
|
||||
return new List<DartType>.generate(arguments!.length,
|
||||
(int i) => arguments[i].buildAliased(library, TypeUse.typeArgument),
|
||||
growable: true);
|
||||
}
|
||||
|
||||
void checkTypesInOutline(TypeEnvironment typeEnvironment) {
|
||||
libraryBuilder.checkBoundsInTypeParameters(
|
||||
typeEnvironment, typedef.typeParameters, fileUri);
|
||||
libraryBuilder.checkBoundsInType(
|
||||
typedef.type!, typeEnvironment, fileUri, type?.charOffset ?? charOffset,
|
||||
allowSuperBounded: false);
|
||||
}
|
||||
|
||||
void buildOutlineExpressions(
|
||||
ClassHierarchy classHierarchy,
|
||||
List<DelayedActionPerformer> delayedActionPerformers,
|
||||
|
||||
@@ -26,10 +26,6 @@ class _HasPromotedTypeVariableVisitor extends DartTypeVisitor<bool> {
|
||||
for (NamedType namedParameterType in node.namedParameters) {
|
||||
if (namedParameterType.type.accept(this)) return true;
|
||||
}
|
||||
TypedefType? typedefType = node.typedefType;
|
||||
if (typedefType != null && typedefType.accept(this)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,8 @@ import 'package:kernel/ast.dart';
|
||||
import 'package:kernel/canonical_name.dart' as kernel;
|
||||
import 'package:kernel/class_hierarchy.dart' show ClassHierarchy;
|
||||
import 'package:kernel/core_types.dart' show CoreTypes;
|
||||
import 'package:kernel/src/bounds_checks.dart' show calculateBounds;
|
||||
import 'package:kernel/src/bounds_checks.dart'
|
||||
show calculateBounds, isGenericFunctionTypeOrAlias;
|
||||
import 'package:kernel/src/future_value_type.dart';
|
||||
import 'package:kernel/src/legacy_erasure.dart';
|
||||
import 'package:kernel/type_algebra.dart';
|
||||
@@ -4875,6 +4876,22 @@ class TypeInferrerImpl implements TypeInferrer {
|
||||
return new EqualsNull(left)..fileOffset = fileOffset;
|
||||
}
|
||||
|
||||
/// Reports an error if [typeArgument] is a generic function type.
|
||||
///
|
||||
/// This is use for reporting generic function types used as a type argument,
|
||||
/// which was disallowed before the 'generic-metadata' feature was enabled.
|
||||
void checkGenericFunctionTypeArgument(DartType typeArgument, int fileOffset) {
|
||||
assert(!libraryBuilder.libraryFeatures.genericMetadata.isEnabled);
|
||||
if (isGenericFunctionTypeOrAlias(typeArgument)) {
|
||||
libraryBuilder.addProblem(
|
||||
templateGenericFunctionTypeInferredAsActualTypeArgument.withArguments(
|
||||
typeArgument, isNonNullableByDefault),
|
||||
fileOffset,
|
||||
noLength,
|
||||
helper!.uri);
|
||||
}
|
||||
}
|
||||
|
||||
DartType _computeInferredType(ExpressionInferenceResult result) =>
|
||||
identical(result.inferredType, noInferredType) || isNonNullableByDefault
|
||||
? result.inferredType
|
||||
|
||||
@@ -13,6 +13,7 @@ import 'package:kernel/ast.dart'
|
||||
NamedType,
|
||||
Nullability,
|
||||
TypedefType,
|
||||
TypeParameter,
|
||||
Visitor;
|
||||
import 'package:kernel/src/assumptions.dart';
|
||||
import 'package:kernel/src/printer.dart';
|
||||
@@ -122,8 +123,9 @@ class _IsKnownVisitor extends DartTypeVisitor<bool> {
|
||||
for (NamedType namedParameterType in node.namedParameters) {
|
||||
if (!namedParameterType.type.accept(this)) return false;
|
||||
}
|
||||
if (node.typedefType != null && !node.typedefType!.accept(this)) {
|
||||
return false;
|
||||
for (TypeParameter typeParameter in node.typeParameters) {
|
||||
if (!typeParameter.bound.accept(this)) return false;
|
||||
if (!typeParameter.defaultType.accept(this)) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -49,10 +49,7 @@ FunctionType substituteTypeParams(
|
||||
isRequired: named.isRequired))
|
||||
.toList(),
|
||||
typeParameters: newTypeParameters,
|
||||
requiredParameterCount: type.requiredParameterCount,
|
||||
typedefType: type.typedefType == null
|
||||
? null
|
||||
: substitution.substituteType(type.typedefType!) as TypedefType);
|
||||
requiredParameterCount: type.requiredParameterCount);
|
||||
}
|
||||
|
||||
/// Given a [FunctionType], gets the type of the named parameter with the given
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
// 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.
|
||||
|
||||
final Uri dartCore = Uri.parse('dart:core');
|
||||
final Uri missingUri = Uri.parse('org-dartlang-internal:missing');
|
||||
@@ -429,6 +429,7 @@ FunctionTypedParameterVar/part_wrapped_script1: Fail
|
||||
FunctionTypedParameterVar/script1: Fail
|
||||
FunctionUsedAsDec/analyzerCode: Fail
|
||||
GeneratorReturnsValue/example: Fail
|
||||
GenericFunctionTypeAsTypeArgumentThroughTypedef/example: Fail
|
||||
GetterNotFound/example: Fail
|
||||
GetterWithFormals/example: Fail
|
||||
IllegalAssignmentToNonAssignable/part_wrapped_script1: Fail
|
||||
@@ -467,9 +468,6 @@ ImportAfterPart/script1: Fail
|
||||
IncompatibleRedirecteeFunctionType/part_wrapped_script6: Fail
|
||||
IncompatibleRedirecteeFunctionType/script6: Fail # Triggers multiple errors.
|
||||
IncompatibleRedirecteeFunctionTypeWarning/example: Fail
|
||||
IncorrectTypeArgumentInReturnTypeWarning/example: Fail
|
||||
IncorrectTypeArgumentInSupertypeInferredWarning/example: Fail
|
||||
IncorrectTypeArgumentInSupertypeWarning/example: Fail
|
||||
IncorrectTypeArgumentInferredWarning/example: Fail
|
||||
IncorrectTypeArgumentQualifiedInferredWarning/example: Fail
|
||||
IncorrectTypeArgumentQualifiedWarning/example: Fail
|
||||
|
||||
@@ -4453,22 +4453,6 @@ IncorrectTypeArgumentQualified:
|
||||
class C<T> { foo<U extends num>() {} }
|
||||
main() { new C<String>().foo<String>(); }
|
||||
|
||||
IncorrectTypeArgumentInSupertype:
|
||||
problemMessage: "Type argument '#type' doesn't conform to the bound '#type2' of the type variable '#name' on '#name2' in the supertype '#name3' of class '#name4'."
|
||||
correctionMessage: "Try changing type arguments so that they conform to the bounds."
|
||||
analyzerCode: TYPE_ARGUMENT_NOT_MATCHING_BOUNDS
|
||||
script: >
|
||||
class A<T extends num> {}
|
||||
class B extends A<String> {}
|
||||
|
||||
IncorrectTypeArgumentInReturnType:
|
||||
problemMessage: "Type argument '#type' doesn't conform to the bound '#type2' of the type variable '#name' on '#name2' in the return type."
|
||||
correctionMessage: "Try changing type arguments so that they conform to the bounds."
|
||||
analyzerCode: TYPE_ARGUMENT_NOT_MATCHING_BOUNDS
|
||||
script: >
|
||||
class A<T extends num> {}
|
||||
A<String> foo() => throw '';
|
||||
|
||||
IncorrectTypeArgumentInferred:
|
||||
problemMessage: "Inferred type argument '#type' doesn't conform to the bound '#type2' of the type variable '#name' on '#name2'."
|
||||
correctionMessage: "Try specifying type arguments explicitly so that they conform to the bounds."
|
||||
@@ -4485,14 +4469,6 @@ IncorrectTypeArgumentQualifiedInferred:
|
||||
class C<T> { foo<U extends num>(U u) {} }
|
||||
main() { new C<String>().foo(""); }
|
||||
|
||||
IncorrectTypeArgumentInSupertypeInferred:
|
||||
problemMessage: "Inferred type argument '#type' doesn't conform to the bound '#type2' of the type variable '#name' on '#name2' in the supertype '#name3' of class '#name4'."
|
||||
correctionMessage: "Try specifying type arguments explicitly so that they conform to the bounds."
|
||||
analyzerCode: TYPE_ARGUMENT_NOT_MATCHING_BOUNDS
|
||||
script: >
|
||||
class A<T extends A<T>> {}
|
||||
class B extends A {}
|
||||
|
||||
IncorrectTypeArgumentInstantiation:
|
||||
problemMessage: "Type argument '#type' doesn't conform to the bound '#type2' of the type variable '#name' on '#type3'."
|
||||
correctionMessage: "Try changing type arguments so that they conform to the bounds."
|
||||
@@ -4560,6 +4536,11 @@ GenericFunctionTypeInferredAsActualTypeArgument:
|
||||
bar<Y>(Y y) => null;
|
||||
main() { foo(bar); }
|
||||
|
||||
GenericFunctionTypeAsTypeArgumentThroughTypedef:
|
||||
problemMessage: "Generic function type '#type' used as a type argument through typedef '#type2'."
|
||||
correctionMessage: "Try providing a non-generic function type explicitly."
|
||||
analyzerCode: GENERIC_FUNCTION_CANNOT_BE_TYPE_ARGUMENT
|
||||
|
||||
# These two message templates are used for constructing supplemental text
|
||||
# about the origins of raw interface types in error messages containing types.
|
||||
TypeOrigin:
|
||||
|
||||
@@ -426,6 +426,7 @@ eof
|
||||
eq
|
||||
equation
|
||||
equivalences
|
||||
erase
|
||||
erased
|
||||
es
|
||||
establish
|
||||
@@ -765,6 +766,7 @@ macos
|
||||
macro
|
||||
macros
|
||||
maintaining
|
||||
malbounded
|
||||
mangled
|
||||
manipulation
|
||||
manner
|
||||
|
||||
@@ -155,51 +155,46 @@ genericFunctionType4(
|
||||
// TODO(johnniwinther): Support interdependent function type variables.
|
||||
//genericFunctionType5(T Function<T, S extends T>([T, S]) o) {}
|
||||
//genericFunctionType6(T Function<T extends S, S>([T, S]) o) {}
|
||||
typedefType1(
|
||||
Typedef1 /*normal|limited.Typedef1*/ /*verbose.test::Typedef1*/ o) {}
|
||||
typedefType1(Typedef1 /*void Function()*/ o) {}
|
||||
typedefType2(
|
||||
Typedef2
|
||||
/*normal|limited.Typedef2<dynamic>*/
|
||||
/*verbose.test::Typedef2<dynamic>*/
|
||||
/*void Function(dynamic)*/
|
||||
o) {}
|
||||
typedefType3(
|
||||
Typedef2<int>
|
||||
/*normal|limited.Typedef2<int>*/
|
||||
/*verbose.test::Typedef2<dart.core::int>*/
|
||||
/*normal|limited.void Function(int)*/
|
||||
/*verbose.void Function(dart.core::int)*/
|
||||
o1,
|
||||
Typedef2<int?>
|
||||
/*normal|limited.Typedef2<int?>*/
|
||||
/*verbose.test::Typedef2<dart.core::int?>*/
|
||||
/*normal|limited.void Function(int?)*/
|
||||
/*verbose.void Function(dart.core::int?)*/
|
||||
o2) {}
|
||||
typedefType4(
|
||||
Typedef3 /*normal|limited.Typedef3*/ /*verbose.test::Typedef3*/ o) {}
|
||||
typedefType4(Typedef3 /*void Function()*/ o) {}
|
||||
typedefType5(
|
||||
Typedef4
|
||||
/*normal|limited.Typedef4<dynamic>*/
|
||||
/*verbose.test::Typedef4<dynamic>*/
|
||||
/*void Function(dynamic)*/
|
||||
o) {}
|
||||
typedefType7(
|
||||
Typedef4<int>
|
||||
/*normal|limited.Typedef4<int>*/
|
||||
/*verbose.test::Typedef4<dart.core::int>*/
|
||||
/*normal|limited.void Function(int)*/
|
||||
/*verbose.void Function(dart.core::int)*/
|
||||
o1,
|
||||
Typedef4<int>?
|
||||
/*normal|limited.Typedef4<int>?*/
|
||||
/*verbose.test::Typedef4<dart.core::int>?*/
|
||||
/*normal|limited.void Function(int)?*/
|
||||
/*verbose.void Function(dart.core::int)?*/
|
||||
o2) {}
|
||||
typedefType8(
|
||||
Typedef5
|
||||
/*normal|limited.Typedef5<dynamic>*/
|
||||
/*verbose.test::Typedef5<dynamic>*/
|
||||
/*void Function<S>(dynamic, S%)*/
|
||||
o) {}
|
||||
typedefType9(
|
||||
Typedef5<int>
|
||||
/*normal|limited.Typedef5<int>*/
|
||||
/*verbose.test::Typedef5<dart.core::int>*/
|
||||
/*normal|limited.void Function<S>(int, S%)*/
|
||||
/*verbose.void Function<S>(dart.core::int, S%)*/
|
||||
o1,
|
||||
Typedef5<int?>?
|
||||
/*normal|limited.Typedef5<int?>?*/
|
||||
/*verbose.test::Typedef5<dart.core::int?>?*/
|
||||
/*normal|limited.void Function<S>(int?, S%)?*/
|
||||
/*verbose.void Function<S>(dart.core::int?, S%)?*/
|
||||
o2) {}
|
||||
|
||||
method() {
|
||||
|
||||
@@ -99,42 +99,37 @@ genericFunctionType4(
|
||||
// TODO(johnniwinther): Support interdependent function type variables.
|
||||
//genericFunctionType5(T Function<T, S extends T>([T, S]) o) {}
|
||||
//genericFunctionType6(T Function<T extends S, S>([T, S]) o) {}
|
||||
typedefType1(
|
||||
Typedef1 /*normal|limited.Typedef1**/ /*verbose.test::Typedef1**/ o) {}
|
||||
typedefType1(Typedef1 /*void Function()**/ o) {}
|
||||
typedefType2(
|
||||
Typedef2
|
||||
/*normal|limited.Typedef2<dynamic>**/
|
||||
/*verbose.test::Typedef2<dynamic>**/
|
||||
/*void Function(dynamic)**/
|
||||
o) {}
|
||||
typedefType3(
|
||||
Typedef2<int>
|
||||
/*normal|limited.Typedef2<int*>**/
|
||||
/*verbose.test::Typedef2<dart.core::int*>**/
|
||||
/*normal|limited.void Function(int*)**/
|
||||
/*verbose.void Function(dart.core::int*)**/
|
||||
o) {}
|
||||
typedefType4(
|
||||
Typedef3
|
||||
/*normal|limited.Typedef3**/
|
||||
/*verbose.test::Typedef3**/
|
||||
/*void Function()**/
|
||||
o) {}
|
||||
typedefType5(
|
||||
Typedef4
|
||||
/*normal|limited.Typedef4<dynamic>**/
|
||||
/*verbose.test::Typedef4<dynamic>**/
|
||||
/*void Function(dynamic)**/
|
||||
o) {}
|
||||
typedefType7(
|
||||
Typedef4<int>
|
||||
/*normal|limited.Typedef4<int*>**/
|
||||
/*verbose.test::Typedef4<dart.core::int*>**/
|
||||
/*normal|limited.void Function(int*)**/
|
||||
/*verbose.void Function(dart.core::int*)**/
|
||||
o) {}
|
||||
typedefType8(
|
||||
Typedef5
|
||||
/*normal|limited.Typedef5<dynamic>**/
|
||||
/*verbose.test::Typedef5<dynamic>**/
|
||||
/*void Function<S>(dynamic, S*)**/
|
||||
o) {}
|
||||
typedefType9(
|
||||
Typedef5<int>
|
||||
/*normal|limited.Typedef5<int*>**/
|
||||
/*verbose.test::Typedef5<dart.core::int*>**/
|
||||
/*normal|limited.void Function<S>(int*, S*)**/
|
||||
/*verbose.void Function<S>(dart.core::int*, S*)**/
|
||||
o) {}
|
||||
|
||||
method() {
|
||||
|
||||
@@ -181,11 +181,7 @@ class TextRepresentationDataExtractor extends CfeDataExtractor<String> {
|
||||
return node.constant.toText(strategy);
|
||||
} else if (node is VariableDeclaration) {
|
||||
DartType type = node.type;
|
||||
if (type is FunctionType && type.typedefType != null) {
|
||||
return type.typedefType!.toText(strategy);
|
||||
} else {
|
||||
return type.toText(strategy);
|
||||
}
|
||||
return type.toText(strategy);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
// Copyright (c) 2021, 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.
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
// Introduce an aliased type.
|
||||
typedef T<X> = X;
|
||||
|
||||
// Use the aliased type.
|
||||
|
||||
T<int>? v1;
|
||||
List<T<void>> v2 = [];
|
||||
final T<String> v3 = throw "Anything";
|
||||
const List<T<C>> v4 = [];
|
||||
const v5 = <Type, Type>{T: T};
|
||||
|
||||
abstract class C {
|
||||
static T<C>? v1;
|
||||
static List<T<T>> v2 = [];
|
||||
static final T<Null> v3 = throw "Anything";
|
||||
static const List<T<List>> v4 = [];
|
||||
|
||||
T<D>? v5;
|
||||
List<T<T>> v6 = [];
|
||||
final T<Null> v7;
|
||||
|
||||
C() : v7 = null;
|
||||
C.name1(this.v5, this.v7);
|
||||
factory C.name2(T<D> arg1, T<Null> arg2) = C1.name1;
|
||||
|
||||
T<double> operator +(T<double> other);
|
||||
T<FutureOr<FutureOr<void>>> get g;
|
||||
set g(T<FutureOr<FutureOr<void>>> value);
|
||||
Map<T<C>, T<C>> m1(covariant T<C> arg1, [Set<Set<T<C>>> arg2]);
|
||||
void m2({T arg1, Map<T, T> arg2(T Function(T) arg21, T arg22)});
|
||||
}
|
||||
|
||||
class C1 implements C {
|
||||
C1.name1(T<D> arg1, T<Null> arg2);
|
||||
noSuchMethod(Invocation invocation) => throw 0;
|
||||
}
|
||||
|
||||
class D {}
|
||||
|
||||
extension E on T<dynamic> {
|
||||
T<dynamic> foo(T<dynamic> t) => t;
|
||||
}
|
||||
|
||||
main() {
|
||||
var v8 = <T<C>>[];
|
||||
var v9 = <Set<T<T>>, Set<T<T>>>{{}: {}};
|
||||
var v10 = {v8};
|
||||
v9[{}] = {42};
|
||||
Set<List<T<C>>> v11 = v10;
|
||||
v10 = v11;
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
import "dart:async";
|
||||
|
||||
typedef T<X extends core::Object? = dynamic> = X%;
|
||||
abstract class C extends core::Object {
|
||||
static field self::C? v1 = null;
|
||||
static field core::List<dynamic> v2 = <dynamic>[];
|
||||
static final field Null v3 = throw "Anything";
|
||||
static const field core::List<core::List<dynamic>> v4 = #C1;
|
||||
field self::D? v5;
|
||||
field core::List<dynamic> v6 = <dynamic>[];
|
||||
final field Null v7;
|
||||
static final field dynamic _redirecting# = <dynamic>[#C2]/*isLegacy*/;
|
||||
constructor •() → self::C
|
||||
: self::C::v5 = null, self::C::v7 = null, super core::Object::•()
|
||||
;
|
||||
constructor name1(self::D? v5, Null v7) → self::C
|
||||
: self::C::v5 = v5, self::C::v7 = v7, super core::Object::•()
|
||||
;
|
||||
static factory name2(self::D arg1, Null arg2) → self::C
|
||||
return new self::C1::name1(arg1, arg2);
|
||||
static method _#name2#tearOff(self::D arg1, Null arg2) → self::C
|
||||
return new self::C1::name1(arg1, arg2);
|
||||
abstract operator +(core::double other) → core::double;
|
||||
abstract get g() → FutureOr<FutureOr<void>>?;
|
||||
abstract set g(FutureOr<FutureOr<void>>? value) → void;
|
||||
abstract method m1(covariant-by-declaration self::C arg1, [core::Set<core::Set<self::C>> arg2 = #C3]) → core::Map<self::C, self::C>;
|
||||
abstract method m2({dynamic arg1 = #C3, ((dynamic) → dynamic, dynamic) → core::Map<dynamic, dynamic> arg2 = #C3}) → void;
|
||||
}
|
||||
class C1 extends core::Object implements self::C {
|
||||
constructor name1(self::D arg1, Null arg2) → self::C1
|
||||
: super core::Object::•()
|
||||
;
|
||||
static method _#name1#tearOff(self::D arg1, Null arg2) → self::C1
|
||||
return new self::C1::name1(arg1, arg2);
|
||||
method noSuchMethod(core::Invocation invocation) → dynamic
|
||||
return throw 0;
|
||||
no-such-method-forwarder get v7() → Null
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("v7", <dynamic>[], <dynamic>[], #C4, 1)){(core::Invocation) → dynamic} as{TypeError,ForDynamic,ForNonNullableByDefault} Null;
|
||||
no-such-method-forwarder operator +(core::double other) → core::double
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("+", <dynamic>[], <dynamic>[other], #C4, 0)){(core::Invocation) → dynamic} as{TypeError,ForDynamic,ForNonNullableByDefault} core::double;
|
||||
no-such-method-forwarder get v6() → core::List<dynamic>
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("v6", <dynamic>[], <dynamic>[], #C4, 1)){(core::Invocation) → dynamic} as{TypeError,ForDynamic,ForNonNullableByDefault} core::List<dynamic>;
|
||||
no-such-method-forwarder get v5() → self::D?
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("v5", <dynamic>[], <dynamic>[], #C4, 1)){(core::Invocation) → dynamic} as{TypeError,ForDynamic,ForNonNullableByDefault} self::D?;
|
||||
no-such-method-forwarder method m1(covariant-by-declaration self::C arg1, [core::Set<core::Set<self::C>> arg2 = #C3]) → core::Map<self::C, self::C>
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("m1", <dynamic>[], <dynamic>[arg1, arg2], #C4, 0)){(core::Invocation) → dynamic} as{TypeError,ForDynamic,ForNonNullableByDefault} core::Map<self::C, self::C>;
|
||||
no-such-method-forwarder method m2({dynamic arg1 = #C3, ((dynamic) → dynamic, dynamic) → core::Map<dynamic, dynamic> arg2 = #C3}) → void
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("m2", <dynamic>[], <dynamic>[], <core::String, dynamic>{"arg1": arg1, "arg2": arg2}, 0)){(core::Invocation) → dynamic};
|
||||
no-such-method-forwarder get g() → FutureOr<FutureOr<void>>?
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("g", <dynamic>[], <dynamic>[], #C4, 1)){(core::Invocation) → dynamic} as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<FutureOr<void>>?;
|
||||
no-such-method-forwarder set v6(core::List<dynamic> value) → void
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("v6=", <dynamic>[], <dynamic>[value], #C4, 2)){(core::Invocation) → dynamic};
|
||||
no-such-method-forwarder set v5(self::D? value) → void
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("v5=", <dynamic>[], <dynamic>[value], #C4, 2)){(core::Invocation) → dynamic};
|
||||
no-such-method-forwarder set g(FutureOr<FutureOr<void>>? value) → void
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("g=", <dynamic>[], <dynamic>[value], #C4, 2)){(core::Invocation) → dynamic};
|
||||
}
|
||||
class D extends core::Object {
|
||||
synthetic constructor •() → self::D
|
||||
: super core::Object::•()
|
||||
;
|
||||
static method _#new#tearOff() → self::D
|
||||
return new self::D::•();
|
||||
}
|
||||
extension E on dynamic {
|
||||
method foo = self::E|foo;
|
||||
tearoff foo = self::E|get#foo;
|
||||
}
|
||||
static field core::int? v1;
|
||||
static field core::List<void> v2 = <void>[];
|
||||
static final field core::String v3 = throw "Anything";
|
||||
static const field core::List<self::C> v4 = #C5;
|
||||
static const field core::Map<core::Type, core::Type> v5 = #C7;
|
||||
static method E|foo(lowered final dynamic #this, dynamic t) → dynamic
|
||||
return t;
|
||||
static method E|get#foo(lowered final dynamic #this) → (dynamic) → dynamic
|
||||
return (dynamic t) → dynamic => self::E|foo(#this, t);
|
||||
static method main() → dynamic {
|
||||
core::List<self::C> v8 = <self::C>[];
|
||||
core::Map<core::Set<dynamic>, core::Set<dynamic>> v9 = <core::Set<dynamic>, core::Set<dynamic>>{<dynamic>{}: <dynamic>{}};
|
||||
core::Set<core::List<self::C>> v10 = <core::List<self::C>>{v8};
|
||||
v9.{core::Map::[]=}(<dynamic>{}, <dynamic>{42}){(core::Set<dynamic>, core::Set<dynamic>) → void};
|
||||
core::Set<core::List<self::C>> v11 = v10;
|
||||
v10 = v11;
|
||||
}
|
||||
|
||||
constants {
|
||||
#C1 = <core::List<dynamic>>[]
|
||||
#C2 = constructor-tearoff self::C::name2
|
||||
#C3 = null
|
||||
#C4 = <core::String, dynamic>{)
|
||||
#C5 = <self::C>[]
|
||||
#C6 = TypeLiteralConstant(dynamic)
|
||||
#C7 = <core::Type, core::Type>{#C6:#C6)
|
||||
}
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
import "dart:async";
|
||||
|
||||
typedef T<X extends core::Object? = dynamic> = X%;
|
||||
abstract class C extends core::Object {
|
||||
static field self::C? v1 = null;
|
||||
static field core::List<dynamic> v2 = <dynamic>[];
|
||||
static final field Null v3 = throw "Anything";
|
||||
static const field core::List<core::List<dynamic>> v4 = #C1;
|
||||
field self::D? v5;
|
||||
field core::List<dynamic> v6 = <dynamic>[];
|
||||
final field Null v7;
|
||||
static final field dynamic _redirecting# = <dynamic>[#C2]/*isLegacy*/;
|
||||
constructor •() → self::C
|
||||
: self::C::v5 = null, self::C::v7 = null, super core::Object::•()
|
||||
;
|
||||
constructor name1(self::D? v5, Null v7) → self::C
|
||||
: self::C::v5 = v5, self::C::v7 = v7, super core::Object::•()
|
||||
;
|
||||
static factory name2(self::D arg1, Null arg2) → self::C
|
||||
return new self::C1::name1(arg1, arg2);
|
||||
static method _#name2#tearOff(self::D arg1, Null arg2) → self::C
|
||||
return new self::C1::name1(arg1, arg2);
|
||||
abstract operator +(core::double other) → core::double;
|
||||
abstract get g() → FutureOr<FutureOr<void>>?;
|
||||
abstract set g(FutureOr<FutureOr<void>>? value) → void;
|
||||
abstract method m1(covariant-by-declaration self::C arg1, [core::Set<core::Set<self::C>> arg2 = #C3]) → core::Map<self::C, self::C>;
|
||||
abstract method m2({dynamic arg1 = #C3, ((dynamic) → dynamic, dynamic) → core::Map<dynamic, dynamic> arg2 = #C3}) → void;
|
||||
}
|
||||
class C1 extends core::Object implements self::C {
|
||||
constructor name1(self::D arg1, Null arg2) → self::C1
|
||||
: super core::Object::•()
|
||||
;
|
||||
static method _#name1#tearOff(self::D arg1, Null arg2) → self::C1
|
||||
return new self::C1::name1(arg1, arg2);
|
||||
method noSuchMethod(core::Invocation invocation) → dynamic
|
||||
return throw 0;
|
||||
no-such-method-forwarder get v7() → Null
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("v7", <dynamic>[], <dynamic>[], #C4, 1)){(core::Invocation) → dynamic} as{TypeError,ForDynamic,ForNonNullableByDefault} Null;
|
||||
no-such-method-forwarder operator +(core::double other) → core::double
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("+", <dynamic>[], <dynamic>[other], #C4, 0)){(core::Invocation) → dynamic} as{TypeError,ForDynamic,ForNonNullableByDefault} core::double;
|
||||
no-such-method-forwarder get v6() → core::List<dynamic>
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("v6", <dynamic>[], <dynamic>[], #C4, 1)){(core::Invocation) → dynamic} as{TypeError,ForDynamic,ForNonNullableByDefault} core::List<dynamic>;
|
||||
no-such-method-forwarder get v5() → self::D?
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("v5", <dynamic>[], <dynamic>[], #C4, 1)){(core::Invocation) → dynamic} as{TypeError,ForDynamic,ForNonNullableByDefault} self::D?;
|
||||
no-such-method-forwarder method m1(covariant-by-declaration self::C arg1, [core::Set<core::Set<self::C>> arg2 = #C3]) → core::Map<self::C, self::C>
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("m1", <dynamic>[], <dynamic>[arg1, arg2], #C4, 0)){(core::Invocation) → dynamic} as{TypeError,ForDynamic,ForNonNullableByDefault} core::Map<self::C, self::C>;
|
||||
no-such-method-forwarder method m2({dynamic arg1 = #C3, ((dynamic) → dynamic, dynamic) → core::Map<dynamic, dynamic> arg2 = #C3}) → void
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("m2", <dynamic>[], <dynamic>[], <core::String, dynamic>{"arg1": arg1, "arg2": arg2}, 0)){(core::Invocation) → dynamic};
|
||||
no-such-method-forwarder get g() → FutureOr<FutureOr<void>>?
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("g", <dynamic>[], <dynamic>[], #C4, 1)){(core::Invocation) → dynamic} as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<FutureOr<void>>?;
|
||||
no-such-method-forwarder set v6(core::List<dynamic> value) → void
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("v6=", <dynamic>[], <dynamic>[value], #C4, 2)){(core::Invocation) → dynamic};
|
||||
no-such-method-forwarder set v5(self::D? value) → void
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("v5=", <dynamic>[], <dynamic>[value], #C4, 2)){(core::Invocation) → dynamic};
|
||||
no-such-method-forwarder set g(FutureOr<FutureOr<void>>? value) → void
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("g=", <dynamic>[], <dynamic>[value], #C4, 2)){(core::Invocation) → dynamic};
|
||||
}
|
||||
class D extends core::Object {
|
||||
synthetic constructor •() → self::D
|
||||
: super core::Object::•()
|
||||
;
|
||||
static method _#new#tearOff() → self::D
|
||||
return new self::D::•();
|
||||
}
|
||||
extension E on dynamic {
|
||||
method foo = self::E|foo;
|
||||
tearoff foo = self::E|get#foo;
|
||||
}
|
||||
static field core::int? v1;
|
||||
static field core::List<void> v2 = <void>[];
|
||||
static final field core::String v3 = throw "Anything";
|
||||
static const field core::List<self::C> v4 = #C5;
|
||||
static const field core::Map<core::Type, core::Type> v5 = #C7;
|
||||
static method E|foo(lowered final dynamic #this, dynamic t) → dynamic
|
||||
return t;
|
||||
static method E|get#foo(lowered final dynamic #this) → (dynamic) → dynamic
|
||||
return (dynamic t) → dynamic => self::E|foo(#this, t);
|
||||
static method main() → dynamic {
|
||||
core::List<self::C> v8 = <self::C>[];
|
||||
core::Map<core::Set<dynamic>, core::Set<dynamic>> v9 = <core::Set<dynamic>, core::Set<dynamic>>{<dynamic>{}: <dynamic>{}};
|
||||
core::Set<core::List<self::C>> v10 = <core::List<self::C>>{v8};
|
||||
v9.{core::Map::[]=}(<dynamic>{}, <dynamic>{42}){(core::Set<dynamic>, core::Set<dynamic>) → void};
|
||||
core::Set<core::List<self::C>> v11 = v10;
|
||||
v10 = v11;
|
||||
}
|
||||
|
||||
constants {
|
||||
#C1 = <core::List<dynamic>>[]
|
||||
#C2 = constructor-tearoff self::C::name2
|
||||
#C3 = null
|
||||
#C4 = <core::String, dynamic>{)
|
||||
#C5 = <self::C>[]
|
||||
#C6 = TypeLiteralConstant(dynamic)
|
||||
#C7 = <core::Type, core::Type>{#C6:#C6)
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
import 'dart:async';
|
||||
|
||||
typedef T<X> = X;
|
||||
T<int>? v1;
|
||||
List<T<void>> v2 = [];
|
||||
final T<String> v3 = throw "Anything";
|
||||
const List<T<C>> v4 = [];
|
||||
const v5 = <Type, Type>{T: T};
|
||||
|
||||
abstract class C {
|
||||
static T<C>? v1;
|
||||
static List<T<T>> v2 = [];
|
||||
static final T<Null> v3 = throw "Anything";
|
||||
static const List<T<List>> v4 = [];
|
||||
T<D>? v5;
|
||||
List<T<T>> v6 = [];
|
||||
final T<Null> v7;
|
||||
C() : v7 = null;
|
||||
C.name1(this.v5, this.v7);
|
||||
factory C.name2(T<D> arg1, T<Null> arg2) = C1.name1;
|
||||
T<double> operator +(T<double> other);
|
||||
T<FutureOr<FutureOr<void>>> get g;
|
||||
set g(T<FutureOr<FutureOr<void>>> value);
|
||||
Map<T<C>, T<C>> m1(covariant T<C> arg1, [Set<Set<T<C>>> arg2]);
|
||||
void m2({T arg1, Map<T, T> arg2(T Function(T) arg21, T arg22)});
|
||||
}
|
||||
|
||||
class C1 implements C {
|
||||
C1.name1(T<D> arg1, T<Null> arg2);
|
||||
noSuchMethod(Invocation invocation) => throw 0;
|
||||
}
|
||||
|
||||
class D {}
|
||||
|
||||
extension E on T<dynamic> {
|
||||
T<dynamic> foo(T<dynamic> t) => t;
|
||||
}
|
||||
|
||||
main() {}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
import 'dart:async';
|
||||
|
||||
List<T<void>> v2 = [];
|
||||
T<int>? v1;
|
||||
|
||||
abstract class C {
|
||||
C() : v7 = null;
|
||||
C.name1(this.v5, this.v7);
|
||||
List<T<T>> v6 = [];
|
||||
Map<T<C>, T<C>> m1(covariant T<C> arg1, [Set<Set<T<C>>> arg2]);
|
||||
T<D>? v5;
|
||||
T<FutureOr<FutureOr<void>>> get g;
|
||||
T<double> operator +(T<double> other);
|
||||
factory C.name2(T<D> arg1, T<Null> arg2) = C1.name1;
|
||||
final T<Null> v7;
|
||||
set g(T<FutureOr<FutureOr<void>>> value);
|
||||
static List<T<T>> v2 = [];
|
||||
static T<C>? v1;
|
||||
static const List<T<List>> v4 = [];
|
||||
static final T<Null> v3 = throw "Anything";
|
||||
void m2({T arg1, Map<T, T> arg2(T Function(T) arg21, T arg22)});
|
||||
}
|
||||
|
||||
class C1 implements C {
|
||||
C1.name1(T<D> arg1, T<Null> arg2);
|
||||
noSuchMethod(Invocation invocation) => throw 0;
|
||||
}
|
||||
|
||||
class D {}
|
||||
|
||||
const List<T<C>> v4 = [];
|
||||
const v5 = <Type, Type>{T: T};
|
||||
|
||||
extension E on T<dynamic> {
|
||||
T<dynamic> foo(T<dynamic> t) => t;
|
||||
}
|
||||
|
||||
final T<String> v3 = throw "Anything";
|
||||
main() {}
|
||||
typedef T<X> = X;
|
||||
@@ -0,0 +1,99 @@
|
||||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
import "dart:async";
|
||||
|
||||
typedef T<X extends core::Object? = dynamic> = X%;
|
||||
abstract class C extends core::Object {
|
||||
static field self::C? v1 = null;
|
||||
static field core::List<dynamic> v2 = <dynamic>[];
|
||||
static final field Null v3 = throw "Anything";
|
||||
static const field core::List<core::List<dynamic>> v4 = #C1;
|
||||
field self::D? v5;
|
||||
field core::List<dynamic> v6 = <dynamic>[];
|
||||
final field Null v7;
|
||||
static final field dynamic _redirecting# = <dynamic>[#C2]/*isLegacy*/;
|
||||
constructor •() → self::C
|
||||
: self::C::v5 = null, self::C::v7 = null, super core::Object::•()
|
||||
;
|
||||
constructor name1(self::D? v5, Null v7) → self::C
|
||||
: self::C::v5 = v5, self::C::v7 = v7, super core::Object::•()
|
||||
;
|
||||
static factory name2(self::D arg1, Null arg2) → self::C
|
||||
return new self::C1::name1(arg1, arg2);
|
||||
static method _#name2#tearOff(self::D arg1, Null arg2) → self::C
|
||||
return new self::C1::name1(arg1, arg2);
|
||||
abstract operator +(core::double other) → core::double;
|
||||
abstract get g() → FutureOr<FutureOr<void>>?;
|
||||
abstract set g(FutureOr<FutureOr<void>>? value) → void;
|
||||
abstract method m1(covariant-by-declaration self::C arg1, [core::Set<core::Set<self::C>> arg2 = #C3]) → core::Map<self::C, self::C>;
|
||||
abstract method m2({dynamic arg1 = #C3, ((dynamic) → dynamic, dynamic) → core::Map<dynamic, dynamic> arg2 = #C3}) → void;
|
||||
}
|
||||
class C1 extends core::Object implements self::C {
|
||||
constructor name1(self::D arg1, Null arg2) → self::C1
|
||||
: super core::Object::•()
|
||||
;
|
||||
static method _#name1#tearOff(self::D arg1, Null arg2) → self::C1
|
||||
return new self::C1::name1(arg1, arg2);
|
||||
method noSuchMethod(core::Invocation invocation) → dynamic
|
||||
return throw 0;
|
||||
no-such-method-forwarder get v7() → Null
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("v7", <dynamic>[], <dynamic>[], #C4, 1)){(core::Invocation) → dynamic} as{TypeError,ForDynamic,ForNonNullableByDefault} Null;
|
||||
no-such-method-forwarder operator +(core::double other) → core::double
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("+", <dynamic>[], <dynamic>[other], #C4, 0)){(core::Invocation) → dynamic} as{TypeError,ForDynamic,ForNonNullableByDefault} core::double;
|
||||
no-such-method-forwarder get v6() → core::List<dynamic>
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("v6", <dynamic>[], <dynamic>[], #C4, 1)){(core::Invocation) → dynamic} as{TypeError,ForDynamic,ForNonNullableByDefault} core::List<dynamic>;
|
||||
no-such-method-forwarder get v5() → self::D?
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("v5", <dynamic>[], <dynamic>[], #C4, 1)){(core::Invocation) → dynamic} as{TypeError,ForDynamic,ForNonNullableByDefault} self::D?;
|
||||
no-such-method-forwarder method m1(covariant-by-declaration self::C arg1, [core::Set<core::Set<self::C>> arg2 = #C3]) → core::Map<self::C, self::C>
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("m1", <dynamic>[], <dynamic>[arg1, arg2], #C4, 0)){(core::Invocation) → dynamic} as{TypeError,ForDynamic,ForNonNullableByDefault} core::Map<self::C, self::C>;
|
||||
no-such-method-forwarder method m2({dynamic arg1 = #C3, ((dynamic) → dynamic, dynamic) → core::Map<dynamic, dynamic> arg2 = #C3}) → void
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("m2", <dynamic>[], <dynamic>[], <core::String, dynamic>{"arg1": arg1, "arg2": arg2}, 0)){(core::Invocation) → dynamic};
|
||||
no-such-method-forwarder get g() → FutureOr<FutureOr<void>>?
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("g", <dynamic>[], <dynamic>[], #C4, 1)){(core::Invocation) → dynamic} as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<FutureOr<void>>?;
|
||||
no-such-method-forwarder set v6(core::List<dynamic> value) → void
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("v6=", <dynamic>[], <dynamic>[value], #C4, 2)){(core::Invocation) → dynamic};
|
||||
no-such-method-forwarder set v5(self::D? value) → void
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("v5=", <dynamic>[], <dynamic>[value], #C4, 2)){(core::Invocation) → dynamic};
|
||||
no-such-method-forwarder set g(FutureOr<FutureOr<void>>? value) → void
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("g=", <dynamic>[], <dynamic>[value], #C4, 2)){(core::Invocation) → dynamic};
|
||||
}
|
||||
class D extends core::Object {
|
||||
synthetic constructor •() → self::D
|
||||
: super core::Object::•()
|
||||
;
|
||||
static method _#new#tearOff() → self::D
|
||||
return new self::D::•();
|
||||
}
|
||||
extension E on dynamic {
|
||||
method foo = self::E|foo;
|
||||
tearoff foo = self::E|get#foo;
|
||||
}
|
||||
static field core::int? v1;
|
||||
static field core::List<void> v2 = <void>[];
|
||||
static final field core::String v3 = throw "Anything";
|
||||
static const field core::List<self::C> v4 = #C5;
|
||||
static const field core::Map<core::Type, core::Type> v5 = #C7;
|
||||
static method E|foo(lowered final dynamic #this, dynamic t) → dynamic
|
||||
return t;
|
||||
static method E|get#foo(lowered final dynamic #this) → (dynamic) → dynamic
|
||||
return (dynamic t) → dynamic => self::E|foo(#this, t);
|
||||
static method main() → dynamic {
|
||||
core::List<self::C> v8 = <self::C>[];
|
||||
core::Map<core::Set<dynamic>, core::Set<dynamic>> v9 = <core::Set<dynamic>, core::Set<dynamic>>{<dynamic>{}: <dynamic>{}};
|
||||
core::Set<core::List<self::C>> v10 = <core::List<self::C>>{v8};
|
||||
v9.{core::Map::[]=}(<dynamic>{}, <dynamic>{42}){(core::Set<dynamic>, core::Set<dynamic>) → void};
|
||||
core::Set<core::List<self::C>> v11 = v10;
|
||||
v10 = v11;
|
||||
}
|
||||
|
||||
constants {
|
||||
#C1 = <core::List<dynamic>*>[]
|
||||
#C2 = constructor-tearoff self::C::name2
|
||||
#C3 = null
|
||||
#C4 = <core::String*, dynamic>{)
|
||||
#C5 = <self::C*>[]
|
||||
#C6 = TypeLiteralConstant(dynamic)
|
||||
#C7 = <core::Type*, core::Type*>{#C6:#C6)
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
import "dart:async";
|
||||
|
||||
typedef T<X extends core::Object? = dynamic> = X%;
|
||||
abstract class C extends core::Object {
|
||||
static field self::C? v1 = null;
|
||||
static field core::List<dynamic> v2 = <dynamic>[];
|
||||
static final field Null v3 = throw "Anything";
|
||||
static const field core::List<core::List<dynamic>> v4 = #C1;
|
||||
field self::D? v5;
|
||||
field core::List<dynamic> v6 = <dynamic>[];
|
||||
final field Null v7;
|
||||
static final field dynamic _redirecting# = <dynamic>[#C2]/*isLegacy*/;
|
||||
constructor •() → self::C
|
||||
: self::C::v5 = null, self::C::v7 = null, super core::Object::•()
|
||||
;
|
||||
constructor name1(self::D? v5, Null v7) → self::C
|
||||
: self::C::v5 = v5, self::C::v7 = v7, super core::Object::•()
|
||||
;
|
||||
static factory name2(self::D arg1, Null arg2) → self::C
|
||||
return new self::C1::name1(arg1, arg2);
|
||||
static method _#name2#tearOff(self::D arg1, Null arg2) → self::C
|
||||
return new self::C1::name1(arg1, arg2);
|
||||
abstract operator +(core::double other) → core::double;
|
||||
abstract get g() → FutureOr<FutureOr<void>>?;
|
||||
abstract set g(FutureOr<FutureOr<void>>? value) → void;
|
||||
abstract method m1(covariant-by-declaration self::C arg1, [core::Set<core::Set<self::C>> arg2 = #C3]) → core::Map<self::C, self::C>;
|
||||
abstract method m2({dynamic arg1 = #C3, ((dynamic) → dynamic, dynamic) → core::Map<dynamic, dynamic> arg2 = #C3}) → void;
|
||||
}
|
||||
class C1 extends core::Object implements self::C {
|
||||
constructor name1(self::D arg1, Null arg2) → self::C1
|
||||
: super core::Object::•()
|
||||
;
|
||||
static method _#name1#tearOff(self::D arg1, Null arg2) → self::C1
|
||||
return new self::C1::name1(arg1, arg2);
|
||||
method noSuchMethod(core::Invocation invocation) → dynamic
|
||||
return throw 0;
|
||||
no-such-method-forwarder get v7() → Null
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("v7", <dynamic>[], <dynamic>[], #C4, 1)){(core::Invocation) → dynamic} as{TypeError,ForDynamic,ForNonNullableByDefault} Null;
|
||||
no-such-method-forwarder operator +(core::double other) → core::double
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("+", <dynamic>[], <dynamic>[other], #C4, 0)){(core::Invocation) → dynamic} as{TypeError,ForDynamic,ForNonNullableByDefault} core::double;
|
||||
no-such-method-forwarder get v6() → core::List<dynamic>
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("v6", <dynamic>[], <dynamic>[], #C4, 1)){(core::Invocation) → dynamic} as{TypeError,ForDynamic,ForNonNullableByDefault} core::List<dynamic>;
|
||||
no-such-method-forwarder get v5() → self::D?
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("v5", <dynamic>[], <dynamic>[], #C4, 1)){(core::Invocation) → dynamic} as{TypeError,ForDynamic,ForNonNullableByDefault} self::D?;
|
||||
no-such-method-forwarder method m1(covariant-by-declaration self::C arg1, [core::Set<core::Set<self::C>> arg2 = #C3]) → core::Map<self::C, self::C>
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("m1", <dynamic>[], <dynamic>[arg1, arg2], #C4, 0)){(core::Invocation) → dynamic} as{TypeError,ForDynamic,ForNonNullableByDefault} core::Map<self::C, self::C>;
|
||||
no-such-method-forwarder method m2({dynamic arg1 = #C3, ((dynamic) → dynamic, dynamic) → core::Map<dynamic, dynamic> arg2 = #C3}) → void
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("m2", <dynamic>[], <dynamic>[], <core::String, dynamic>{"arg1": arg1, "arg2": arg2}, 0)){(core::Invocation) → dynamic};
|
||||
no-such-method-forwarder get g() → FutureOr<FutureOr<void>>?
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("g", <dynamic>[], <dynamic>[], #C4, 1)){(core::Invocation) → dynamic} as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<FutureOr<void>>?;
|
||||
no-such-method-forwarder set v6(core::List<dynamic> value) → void
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("v6=", <dynamic>[], <dynamic>[value], #C4, 2)){(core::Invocation) → dynamic};
|
||||
no-such-method-forwarder set v5(self::D? value) → void
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("v5=", <dynamic>[], <dynamic>[value], #C4, 2)){(core::Invocation) → dynamic};
|
||||
no-such-method-forwarder set g(FutureOr<FutureOr<void>>? value) → void
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("g=", <dynamic>[], <dynamic>[value], #C4, 2)){(core::Invocation) → dynamic};
|
||||
}
|
||||
class D extends core::Object {
|
||||
synthetic constructor •() → self::D
|
||||
: super core::Object::•()
|
||||
;
|
||||
static method _#new#tearOff() → self::D
|
||||
return new self::D::•();
|
||||
}
|
||||
extension E on dynamic {
|
||||
method foo = self::E|foo;
|
||||
tearoff foo = self::E|get#foo;
|
||||
}
|
||||
static field core::int? v1;
|
||||
static field core::List<void> v2 = <void>[];
|
||||
static final field core::String v3 = throw "Anything";
|
||||
static const field core::List<self::C> v4 = #C5;
|
||||
static const field core::Map<core::Type, core::Type> v5 = #C7;
|
||||
static method E|foo(lowered final dynamic #this, dynamic t) → dynamic
|
||||
return t;
|
||||
static method E|get#foo(lowered final dynamic #this) → (dynamic) → dynamic
|
||||
return (dynamic t) → dynamic => self::E|foo(#this, t);
|
||||
static method main() → dynamic {
|
||||
core::List<self::C> v8 = <self::C>[];
|
||||
core::Map<core::Set<dynamic>, core::Set<dynamic>> v9 = <core::Set<dynamic>, core::Set<dynamic>>{<dynamic>{}: <dynamic>{}};
|
||||
core::Set<core::List<self::C>> v10 = <core::List<self::C>>{v8};
|
||||
v9.{core::Map::[]=}(<dynamic>{}, <dynamic>{42}){(core::Set<dynamic>, core::Set<dynamic>) → void};
|
||||
core::Set<core::List<self::C>> v11 = v10;
|
||||
v10 = v11;
|
||||
}
|
||||
|
||||
constants {
|
||||
#C1 = <core::List<dynamic>*>[]
|
||||
#C2 = constructor-tearoff self::C::name2
|
||||
#C3 = null
|
||||
#C4 = <core::String*, dynamic>{)
|
||||
#C5 = <self::C*>[]
|
||||
#C6 = TypeLiteralConstant(dynamic)
|
||||
#C7 = <core::Type*, core::Type*>{#C6:#C6)
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
import "dart:async";
|
||||
|
||||
typedef T<X extends core::Object? = dynamic> = X%;
|
||||
abstract class C extends core::Object {
|
||||
static field self::C? v1;
|
||||
static field core::List<dynamic> v2;
|
||||
static final field Null v3;
|
||||
static const field core::List<core::List<dynamic>> v4 = const <core::List<dynamic>>[];
|
||||
field self::D? v5;
|
||||
field core::List<dynamic> v6;
|
||||
final field Null v7;
|
||||
static final field dynamic _redirecting# = <dynamic>[self::C::name2]/*isLegacy*/;
|
||||
constructor •() → self::C
|
||||
;
|
||||
constructor name1(self::D? v5, Null v7) → self::C
|
||||
;
|
||||
static factory name2(self::D arg1, Null arg2) → self::C
|
||||
return new self::C1::name1(arg1, arg2);
|
||||
static method _#name2#tearOff(self::D arg1, Null arg2) → self::C
|
||||
return new self::C1::name1(arg1, arg2);
|
||||
abstract operator +(core::double other) → core::double;
|
||||
abstract get g() → FutureOr<FutureOr<void>>?;
|
||||
abstract set g(FutureOr<FutureOr<void>>? value) → void;
|
||||
abstract method m1(covariant-by-declaration self::C arg1, [core::Set<core::Set<self::C>> arg2 = null]) → core::Map<self::C, self::C>;
|
||||
abstract method m2({dynamic arg1 = null, ((dynamic) → dynamic, dynamic) → core::Map<dynamic, dynamic> arg2 = null}) → void;
|
||||
}
|
||||
class C1 extends core::Object implements self::C {
|
||||
constructor name1(self::D arg1, Null arg2) → self::C1
|
||||
;
|
||||
static method _#name1#tearOff(self::D arg1, Null arg2) → self::C1
|
||||
return new self::C1::name1(arg1, arg2);
|
||||
method noSuchMethod(core::Invocation invocation) → dynamic
|
||||
;
|
||||
no-such-method-forwarder get v7() → Null
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("v7", <dynamic>[], <dynamic>[], const <core::String, dynamic>{}, 1)){(core::Invocation) → dynamic} as{TypeError,ForDynamic,ForNonNullableByDefault} Null;
|
||||
no-such-method-forwarder operator +(core::double other) → core::double
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("+", <dynamic>[], <dynamic>[other], const <core::String, dynamic>{}, 0)){(core::Invocation) → dynamic} as{TypeError,ForDynamic,ForNonNullableByDefault} core::double;
|
||||
no-such-method-forwarder get v6() → core::List<dynamic>
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("v6", <dynamic>[], <dynamic>[], const <core::String, dynamic>{}, 1)){(core::Invocation) → dynamic} as{TypeError,ForDynamic,ForNonNullableByDefault} core::List<dynamic>;
|
||||
no-such-method-forwarder get v5() → self::D?
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("v5", <dynamic>[], <dynamic>[], const <core::String, dynamic>{}, 1)){(core::Invocation) → dynamic} as{TypeError,ForDynamic,ForNonNullableByDefault} self::D?;
|
||||
no-such-method-forwarder method m1(covariant-by-declaration self::C arg1, [core::Set<core::Set<self::C>> arg2]) → core::Map<self::C, self::C>
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("m1", <dynamic>[], <dynamic>[arg1, arg2], const <core::String, dynamic>{}, 0)){(core::Invocation) → dynamic} as{TypeError,ForDynamic,ForNonNullableByDefault} core::Map<self::C, self::C>;
|
||||
no-such-method-forwarder method m2({dynamic arg1, ((dynamic) → dynamic, dynamic) → core::Map<dynamic, dynamic> arg2}) → void
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("m2", <dynamic>[], <dynamic>[], <core::String, dynamic>{"arg1": arg1, "arg2": arg2}, 0)){(core::Invocation) → dynamic};
|
||||
no-such-method-forwarder get g() → FutureOr<FutureOr<void>>?
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("g", <dynamic>[], <dynamic>[], const <core::String, dynamic>{}, 1)){(core::Invocation) → dynamic} as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<FutureOr<void>>?;
|
||||
no-such-method-forwarder set v6(core::List<dynamic> value) → void
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("v6=", <dynamic>[], <dynamic>[value], const <core::String, dynamic>{}, 2)){(core::Invocation) → dynamic};
|
||||
no-such-method-forwarder set v5(self::D? value) → void
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("v5=", <dynamic>[], <dynamic>[value], const <core::String, dynamic>{}, 2)){(core::Invocation) → dynamic};
|
||||
no-such-method-forwarder set g(FutureOr<FutureOr<void>>? value) → void
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("g=", <dynamic>[], <dynamic>[value], const <core::String, dynamic>{}, 2)){(core::Invocation) → dynamic};
|
||||
}
|
||||
class D extends core::Object {
|
||||
synthetic constructor •() → self::D
|
||||
;
|
||||
static method _#new#tearOff() → self::D
|
||||
return new self::D::•();
|
||||
}
|
||||
extension E on dynamic {
|
||||
method foo = self::E|foo;
|
||||
tearoff foo = self::E|get#foo;
|
||||
}
|
||||
static field core::int? v1;
|
||||
static field core::List<void> v2;
|
||||
static final field core::String v3;
|
||||
static const field core::List<self::C> v4 = const <self::C>[];
|
||||
static const field core::Map<core::Type, core::Type> v5 = const <core::Type, core::Type>{dynamic: dynamic};
|
||||
static method E|foo(lowered final dynamic #this, dynamic t) → dynamic
|
||||
;
|
||||
static method E|get#foo(lowered final dynamic #this) → (dynamic) → dynamic
|
||||
return (dynamic t) → dynamic => self::E|foo(#this, t);
|
||||
static method main() → dynamic
|
||||
;
|
||||
|
||||
|
||||
Extra constant evaluation status:
|
||||
Evaluated: ListLiteral @ org-dartlang-testcase:///generic_usage_type_variable.dart:22:35 -> ListConstant(const <List<dynamic>*>[])
|
||||
Evaluated: ConstructorTearOff @ org-dartlang-testcase:///generic_usage_type_variable.dart:18:16 -> ConstructorTearOffConstant(C.name2)
|
||||
Evaluated: MapLiteral @ org-dartlang-testcase:///generic_usage_type_variable.dart:26:17 -> MapConstant(const <String*, dynamic>{})
|
||||
Evaluated: MapLiteral @ org-dartlang-testcase:///generic_usage_type_variable.dart:32:22 -> MapConstant(const <String*, dynamic>{})
|
||||
Evaluated: MapLiteral @ org-dartlang-testcase:///generic_usage_type_variable.dart:25:14 -> MapConstant(const <String*, dynamic>{})
|
||||
Evaluated: MapLiteral @ org-dartlang-testcase:///generic_usage_type_variable.dart:24:9 -> MapConstant(const <String*, dynamic>{})
|
||||
Evaluated: MapLiteral @ org-dartlang-testcase:///generic_usage_type_variable.dart:35:19 -> MapConstant(const <String*, dynamic>{})
|
||||
Evaluated: MapLiteral @ org-dartlang-testcase:///generic_usage_type_variable.dart:33:35 -> MapConstant(const <String*, dynamic>{})
|
||||
Evaluated: MapLiteral @ org-dartlang-testcase:///generic_usage_type_variable.dart:25:14 -> MapConstant(const <String*, dynamic>{})
|
||||
Evaluated: MapLiteral @ org-dartlang-testcase:///generic_usage_type_variable.dart:24:9 -> MapConstant(const <String*, dynamic>{})
|
||||
Evaluated: MapLiteral @ org-dartlang-testcase:///generic_usage_type_variable.dart:34:7 -> MapConstant(const <String*, dynamic>{})
|
||||
Evaluated: ListLiteral @ org-dartlang-testcase:///generic_usage_type_variable.dart:15:23 -> ListConstant(const <C*>[])
|
||||
Evaluated: MapLiteral @ org-dartlang-testcase:///generic_usage_type_variable.dart:16:24 -> MapConstant(const <Type*, Type*>{dynamic: dynamic})
|
||||
Extra constant evaluation: evaluated: 93, effectively constant: 13
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
import "dart:async";
|
||||
|
||||
typedef T<X extends core::Object? = dynamic> = X%;
|
||||
abstract class C extends core::Object {
|
||||
static field self::C? v1 = null;
|
||||
static field core::List<dynamic> v2 = <dynamic>[];
|
||||
static final field Null v3 = throw "Anything";
|
||||
static const field core::List<core::List<dynamic>> v4 = #C1;
|
||||
field self::D? v5;
|
||||
field core::List<dynamic> v6 = <dynamic>[];
|
||||
final field Null v7;
|
||||
static final field dynamic _redirecting# = <dynamic>[#C2]/*isLegacy*/;
|
||||
constructor •() → self::C
|
||||
: self::C::v5 = null, self::C::v7 = null, super core::Object::•()
|
||||
;
|
||||
constructor name1(self::D? v5, Null v7) → self::C
|
||||
: self::C::v5 = v5, self::C::v7 = v7, super core::Object::•()
|
||||
;
|
||||
static factory name2(self::D arg1, Null arg2) → self::C
|
||||
return new self::C1::name1(arg1, arg2);
|
||||
static method _#name2#tearOff(self::D arg1, Null arg2) → self::C
|
||||
return new self::C1::name1(arg1, arg2);
|
||||
abstract operator +(core::double other) → core::double;
|
||||
abstract get g() → FutureOr<FutureOr<void>>?;
|
||||
abstract set g(FutureOr<FutureOr<void>>? value) → void;
|
||||
abstract method m1(covariant-by-declaration self::C arg1, [core::Set<core::Set<self::C>> arg2 = #C3]) → core::Map<self::C, self::C>;
|
||||
abstract method m2({dynamic arg1 = #C3, ((dynamic) → dynamic, dynamic) → core::Map<dynamic, dynamic> arg2 = #C3}) → void;
|
||||
}
|
||||
class C1 extends core::Object implements self::C {
|
||||
constructor name1(self::D arg1, Null arg2) → self::C1
|
||||
: super core::Object::•()
|
||||
;
|
||||
static method _#name1#tearOff(self::D arg1, Null arg2) → self::C1
|
||||
return new self::C1::name1(arg1, arg2);
|
||||
method noSuchMethod(core::Invocation invocation) → dynamic
|
||||
return throw 0;
|
||||
no-such-method-forwarder get v7() → Null
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("v7", <dynamic>[], <dynamic>[], #C4, 1)){(core::Invocation) → dynamic} as{TypeError,ForDynamic,ForNonNullableByDefault} Null;
|
||||
no-such-method-forwarder operator +(core::double other) → core::double
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("+", <dynamic>[], <dynamic>[other], #C4, 0)){(core::Invocation) → dynamic} as{TypeError,ForDynamic,ForNonNullableByDefault} core::double;
|
||||
no-such-method-forwarder get v6() → core::List<dynamic>
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("v6", <dynamic>[], <dynamic>[], #C4, 1)){(core::Invocation) → dynamic} as{TypeError,ForDynamic,ForNonNullableByDefault} core::List<dynamic>;
|
||||
no-such-method-forwarder get v5() → self::D?
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("v5", <dynamic>[], <dynamic>[], #C4, 1)){(core::Invocation) → dynamic} as{TypeError,ForDynamic,ForNonNullableByDefault} self::D?;
|
||||
no-such-method-forwarder method m1(covariant-by-declaration self::C arg1, [core::Set<core::Set<self::C>> arg2 = #C3]) → core::Map<self::C, self::C>
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("m1", <dynamic>[], <dynamic>[arg1, arg2], #C4, 0)){(core::Invocation) → dynamic} as{TypeError,ForDynamic,ForNonNullableByDefault} core::Map<self::C, self::C>;
|
||||
no-such-method-forwarder method m2({dynamic arg1 = #C3, ((dynamic) → dynamic, dynamic) → core::Map<dynamic, dynamic> arg2 = #C3}) → void
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("m2", <dynamic>[], <dynamic>[], <core::String, dynamic>{"arg1": arg1, "arg2": arg2}, 0)){(core::Invocation) → dynamic};
|
||||
no-such-method-forwarder get g() → FutureOr<FutureOr<void>>?
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("g", <dynamic>[], <dynamic>[], #C4, 1)){(core::Invocation) → dynamic} as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<FutureOr<void>>?;
|
||||
no-such-method-forwarder set v6(core::List<dynamic> value) → void
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("v6=", <dynamic>[], <dynamic>[value], #C4, 2)){(core::Invocation) → dynamic};
|
||||
no-such-method-forwarder set v5(self::D? value) → void
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("v5=", <dynamic>[], <dynamic>[value], #C4, 2)){(core::Invocation) → dynamic};
|
||||
no-such-method-forwarder set g(FutureOr<FutureOr<void>>? value) → void
|
||||
return this.{self::C1::noSuchMethod}(core::_createInvocationMirror("g=", <dynamic>[], <dynamic>[value], #C4, 2)){(core::Invocation) → dynamic};
|
||||
}
|
||||
class D extends core::Object {
|
||||
synthetic constructor •() → self::D
|
||||
: super core::Object::•()
|
||||
;
|
||||
static method _#new#tearOff() → self::D
|
||||
return new self::D::•();
|
||||
}
|
||||
extension E on dynamic {
|
||||
method foo = self::E|foo;
|
||||
tearoff foo = self::E|get#foo;
|
||||
}
|
||||
static field core::int? v1;
|
||||
static field core::List<void> v2 = <void>[];
|
||||
static final field core::String v3 = throw "Anything";
|
||||
static const field core::List<self::C> v4 = #C5;
|
||||
static const field core::Map<core::Type, core::Type> v5 = #C7;
|
||||
static method E|foo(lowered final dynamic #this, dynamic t) → dynamic
|
||||
return t;
|
||||
static method E|get#foo(lowered final dynamic #this) → (dynamic) → dynamic
|
||||
return (dynamic t) → dynamic => self::E|foo(#this, t);
|
||||
static method main() → dynamic {
|
||||
core::List<self::C> v8 = <self::C>[];
|
||||
core::Map<core::Set<dynamic>, core::Set<dynamic>> v9 = <core::Set<dynamic>, core::Set<dynamic>>{<dynamic>{}: <dynamic>{}};
|
||||
core::Set<core::List<self::C>> v10 = <core::List<self::C>>{v8};
|
||||
v9.{core::Map::[]=}(<dynamic>{}, <dynamic>{42}){(core::Set<dynamic>, core::Set<dynamic>) → void};
|
||||
core::Set<core::List<self::C>> v11 = v10;
|
||||
v10 = v11;
|
||||
}
|
||||
|
||||
constants {
|
||||
#C1 = <core::List<dynamic>*>[]
|
||||
#C2 = constructor-tearoff self::C::name2
|
||||
#C3 = null
|
||||
#C4 = <core::String*, dynamic>{)
|
||||
#C5 = <self::C*>[]
|
||||
#C6 = TypeLiteralConstant(dynamic)
|
||||
#C7 = <core::Type*, core::Type*>{#C6:#C6)
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
// 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.
|
||||
|
||||
class Class<T> {}
|
||||
|
||||
class ConcreteClass implements Class<ConcreteClass> {}
|
||||
|
||||
typedef F<X extends Class<X>> = X;
|
||||
|
||||
class G<X extends Class<X>> {}
|
||||
|
||||
t1a(o) => o as F; // Ok
|
||||
t2a(o) => o as F<dynamic>; // Ok
|
||||
t3a(o) => o as F<Class>; // Ok
|
||||
t4a(o) => o as F<Class<dynamic>>; // Ok
|
||||
t5a(o) => o as F<ConcreteClass>; // Ok
|
||||
t6a(o) => o as F<Class<ConcreteClass>>; // Ok
|
||||
t7a(o) => o as F<Object>; // Error
|
||||
t8a(o) => o as F<int>; // Error
|
||||
s1a(o) => o as G; // Ok
|
||||
s2a(o) => o as G<dynamic>; // Ok
|
||||
s3a(o) => o as G<Class>; // Ok
|
||||
s4a(o) => o as G<Class<dynamic>>; // Ok
|
||||
s5a(o) => o as G<ConcreteClass>; // Ok
|
||||
s6a(o) => o as G<Class<ConcreteClass>>; // Ok
|
||||
s7a(o) => o as G<Object>; // Error
|
||||
s8a(o) => o as G<int>; // Error
|
||||
|
||||
t1b(o) => o is F; // Ok
|
||||
t2b(o) => o is F<dynamic>; // Ok
|
||||
t3b(o) => o is F<Class>; // Ok
|
||||
t4b(o) => o is F<Class<dynamic>>; // Ok
|
||||
t5b(o) => o is F<ConcreteClass>; // Ok
|
||||
t6b(o) => o is F<Class<ConcreteClass>>; // Ok
|
||||
t7b(o) => o is F<Object>; // Error
|
||||
t8b(o) => o is F<int>; // Error
|
||||
s1b(o) => o is G; // Ok
|
||||
s2b(o) => o is G<dynamic>; // Ok
|
||||
s3b(o) => o is G<Class>; // Ok
|
||||
s4b(o) => o is G<Class<dynamic>>; // Ok
|
||||
s5b(o) => o is G<ConcreteClass>; // Ok
|
||||
s6b(o) => o is G<Class<ConcreteClass>>; // Ok
|
||||
s7b(o) => o is G<Object>; // Error
|
||||
s8b(o) => o is G<int>; // Error
|
||||
|
||||
main() {}
|
||||
@@ -0,0 +1,41 @@
|
||||
class Class<T> {}
|
||||
|
||||
class ConcreteClass implements Class<ConcreteClass> {}
|
||||
|
||||
typedef F<X extends Class<X>> = X;
|
||||
|
||||
class G<X extends Class<X>> {}
|
||||
|
||||
t1a(o) => o as F;
|
||||
t2a(o) => o as F<dynamic>;
|
||||
t3a(o) => o as F<Class>;
|
||||
t4a(o) => o as F<Class<dynamic>>;
|
||||
t5a(o) => o as F<ConcreteClass>;
|
||||
t6a(o) => o as F<Class<ConcreteClass>>;
|
||||
t7a(o) => o as F<Object>;
|
||||
t8a(o) => o as F<int>;
|
||||
s1a(o) => o as G;
|
||||
s2a(o) => o as G<dynamic>;
|
||||
s3a(o) => o as G<Class>;
|
||||
s4a(o) => o as G<Class<dynamic>>;
|
||||
s5a(o) => o as G<ConcreteClass>;
|
||||
s6a(o) => o as G<Class<ConcreteClass>>;
|
||||
s7a(o) => o as G<Object>;
|
||||
s8a(o) => o as G<int>;
|
||||
t1b(o) => o is F;
|
||||
t2b(o) => o is F<dynamic>;
|
||||
t3b(o) => o is F<Class>;
|
||||
t4b(o) => o is F<Class<dynamic>>;
|
||||
t5b(o) => o is F<ConcreteClass>;
|
||||
t6b(o) => o is F<Class<ConcreteClass>>;
|
||||
t7b(o) => o is F<Object>;
|
||||
t8b(o) => o is F<int>;
|
||||
s1b(o) => o is G;
|
||||
s2b(o) => o is G<dynamic>;
|
||||
s3b(o) => o is G<Class>;
|
||||
s4b(o) => o is G<Class<dynamic>>;
|
||||
s5b(o) => o is G<ConcreteClass>;
|
||||
s6b(o) => o is G<Class<ConcreteClass>>;
|
||||
s7b(o) => o is G<Object>;
|
||||
s8b(o) => o is G<int>;
|
||||
main() {}
|
||||
@@ -0,0 +1,40 @@
|
||||
class Class<T> {}
|
||||
|
||||
class ConcreteClass implements Class<ConcreteClass> {}
|
||||
|
||||
class G<X extends Class<X>> {}
|
||||
|
||||
main() {}
|
||||
s1a(o) => o as G;
|
||||
s1b(o) => o is G;
|
||||
s2a(o) => o as G<dynamic>;
|
||||
s2b(o) => o is G<dynamic>;
|
||||
s3a(o) => o as G<Class>;
|
||||
s3b(o) => o is G<Class>;
|
||||
s4a(o) => o as G<Class<dynamic>>;
|
||||
s4b(o) => o is G<Class<dynamic>>;
|
||||
s5a(o) => o as G<ConcreteClass>;
|
||||
s5b(o) => o is G<ConcreteClass>;
|
||||
s6a(o) => o as G<Class<ConcreteClass>>;
|
||||
s6b(o) => o is G<Class<ConcreteClass>>;
|
||||
s7a(o) => o as G<Object>;
|
||||
s7b(o) => o is G<Object>;
|
||||
s8a(o) => o as G<int>;
|
||||
s8b(o) => o is G<int>;
|
||||
t1a(o) => o as F;
|
||||
t1b(o) => o is F;
|
||||
t2a(o) => o as F<dynamic>;
|
||||
t2b(o) => o is F<dynamic>;
|
||||
t3a(o) => o as F<Class>;
|
||||
t3b(o) => o is F<Class>;
|
||||
t4a(o) => o as F<Class<dynamic>>;
|
||||
t4b(o) => o is F<Class<dynamic>>;
|
||||
t5a(o) => o as F<ConcreteClass>;
|
||||
t5b(o) => o is F<ConcreteClass>;
|
||||
t6a(o) => o as F<Class<ConcreteClass>>;
|
||||
t6b(o) => o is F<Class<ConcreteClass>>;
|
||||
t7a(o) => o as F<Object>;
|
||||
t7b(o) => o is F<Object>;
|
||||
t8a(o) => o as F<int>;
|
||||
t8b(o) => o is F<int>;
|
||||
typedef F<X extends Class<X>> = X;
|
||||
@@ -0,0 +1,164 @@
|
||||
library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_as_is.dart:19:16: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_as_is.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// t7a(o) => o as F<Object>; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_as_is.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = X;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_as_is.dart:20:16: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_as_is.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// t8a(o) => o as F<int>; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_as_is.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = X;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_as_is.dart:27:16: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_as_is.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// s7a(o) => o as G<Object>; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_as_is.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_as_is.dart:28:16: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_as_is.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// s8a(o) => o as G<int>; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_as_is.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_as_is.dart:36:16: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_as_is.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// t7b(o) => o is F<Object>; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_as_is.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = X;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_as_is.dart:37:16: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_as_is.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// t8b(o) => o is F<int>; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_as_is.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = X;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_as_is.dart:44:16: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_as_is.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// s7b(o) => o is G<Object>; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_as_is.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_as_is.dart:45:16: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_as_is.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// s8b(o) => o is G<int>; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_as_is.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
typedef F<X extends self::Class<X> = self::Class<dynamic>> = X;
|
||||
class Class<T extends core::Object? = dynamic> extends core::Object {
|
||||
synthetic constructor •() → self::Class<self::Class::T%>
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
class ConcreteClass extends core::Object implements self::Class<self::ConcreteClass> {
|
||||
synthetic constructor •() → self::ConcreteClass
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
class G<X extends self::Class<self::G::X> = self::Class<dynamic>> extends core::Object {
|
||||
synthetic constructor •() → self::G<self::G::X>
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
static method t1a(dynamic o) → dynamic
|
||||
return o as{ForNonNullableByDefault} self::Class<dynamic>;
|
||||
static method t2a(dynamic o) → dynamic
|
||||
return o as{ForNonNullableByDefault} dynamic;
|
||||
static method t3a(dynamic o) → dynamic
|
||||
return o as{ForNonNullableByDefault} self::Class<dynamic>;
|
||||
static method t4a(dynamic o) → dynamic
|
||||
return o as{ForNonNullableByDefault} self::Class<dynamic>;
|
||||
static method t5a(dynamic o) → dynamic
|
||||
return o as{ForNonNullableByDefault} self::ConcreteClass;
|
||||
static method t6a(dynamic o) → dynamic
|
||||
return o as{ForNonNullableByDefault} self::Class<self::ConcreteClass>;
|
||||
static method t7a(dynamic o) → dynamic
|
||||
return o as{ForNonNullableByDefault} core::Object;
|
||||
static method t8a(dynamic o) → dynamic
|
||||
return o as{ForNonNullableByDefault} core::int;
|
||||
static method s1a(dynamic o) → dynamic
|
||||
return o as{ForNonNullableByDefault} self::G<self::Class<dynamic>>;
|
||||
static method s2a(dynamic o) → dynamic
|
||||
return o as{ForNonNullableByDefault} self::G<dynamic>;
|
||||
static method s3a(dynamic o) → dynamic
|
||||
return o as{ForNonNullableByDefault} self::G<self::Class<dynamic>>;
|
||||
static method s4a(dynamic o) → dynamic
|
||||
return o as{ForNonNullableByDefault} self::G<self::Class<dynamic>>;
|
||||
static method s5a(dynamic o) → dynamic
|
||||
return o as{ForNonNullableByDefault} self::G<self::ConcreteClass>;
|
||||
static method s6a(dynamic o) → dynamic
|
||||
return o as{ForNonNullableByDefault} self::G<self::Class<self::ConcreteClass>>;
|
||||
static method s7a(dynamic o) → dynamic
|
||||
return o as{ForNonNullableByDefault} self::G<core::Object>;
|
||||
static method s8a(dynamic o) → dynamic
|
||||
return o as{ForNonNullableByDefault} self::G<core::int>;
|
||||
static method t1b(dynamic o) → dynamic
|
||||
return o is{ForNonNullableByDefault} self::Class<dynamic>;
|
||||
static method t2b(dynamic o) → dynamic
|
||||
return o is{ForNonNullableByDefault} dynamic;
|
||||
static method t3b(dynamic o) → dynamic
|
||||
return o is{ForNonNullableByDefault} self::Class<dynamic>;
|
||||
static method t4b(dynamic o) → dynamic
|
||||
return o is{ForNonNullableByDefault} self::Class<dynamic>;
|
||||
static method t5b(dynamic o) → dynamic
|
||||
return o is{ForNonNullableByDefault} self::ConcreteClass;
|
||||
static method t6b(dynamic o) → dynamic
|
||||
return o is{ForNonNullableByDefault} self::Class<self::ConcreteClass>;
|
||||
static method t7b(dynamic o) → dynamic
|
||||
return o is{ForNonNullableByDefault} core::Object;
|
||||
static method t8b(dynamic o) → dynamic
|
||||
return o is{ForNonNullableByDefault} core::int;
|
||||
static method s1b(dynamic o) → dynamic
|
||||
return o is{ForNonNullableByDefault} self::G<self::Class<dynamic>>;
|
||||
static method s2b(dynamic o) → dynamic
|
||||
return o is{ForNonNullableByDefault} self::G<dynamic>;
|
||||
static method s3b(dynamic o) → dynamic
|
||||
return o is{ForNonNullableByDefault} self::G<self::Class<dynamic>>;
|
||||
static method s4b(dynamic o) → dynamic
|
||||
return o is{ForNonNullableByDefault} self::G<self::Class<dynamic>>;
|
||||
static method s5b(dynamic o) → dynamic
|
||||
return o is{ForNonNullableByDefault} self::G<self::ConcreteClass>;
|
||||
static method s6b(dynamic o) → dynamic
|
||||
return o is{ForNonNullableByDefault} self::G<self::Class<self::ConcreteClass>>;
|
||||
static method s7b(dynamic o) → dynamic
|
||||
return o is{ForNonNullableByDefault} self::G<core::Object>;
|
||||
static method s8b(dynamic o) → dynamic
|
||||
return o is{ForNonNullableByDefault} self::G<core::int>;
|
||||
static method main() → dynamic {}
|
||||
@@ -0,0 +1,164 @@
|
||||
library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_as_is.dart:19:16: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_as_is.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// t7a(o) => o as F<Object>; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_as_is.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = X;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_as_is.dart:20:16: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_as_is.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// t8a(o) => o as F<int>; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_as_is.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = X;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_as_is.dart:27:16: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_as_is.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// s7a(o) => o as G<Object>; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_as_is.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_as_is.dart:28:16: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_as_is.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// s8a(o) => o as G<int>; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_as_is.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_as_is.dart:36:16: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_as_is.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// t7b(o) => o is F<Object>; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_as_is.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = X;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_as_is.dart:37:16: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_as_is.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// t8b(o) => o is F<int>; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_as_is.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = X;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_as_is.dart:44:16: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_as_is.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// s7b(o) => o is G<Object>; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_as_is.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_as_is.dart:45:16: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_as_is.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// s8b(o) => o is G<int>; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_as_is.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
typedef F<X extends self::Class<X> = self::Class<dynamic>> = X;
|
||||
class Class<T extends core::Object? = dynamic> extends core::Object {
|
||||
synthetic constructor •() → self::Class<self::Class::T%>
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
class ConcreteClass extends core::Object implements self::Class<self::ConcreteClass> {
|
||||
synthetic constructor •() → self::ConcreteClass
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
class G<X extends self::Class<self::G::X> = self::Class<dynamic>> extends core::Object {
|
||||
synthetic constructor •() → self::G<self::G::X>
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
static method t1a(dynamic o) → dynamic
|
||||
return o as{ForNonNullableByDefault} self::Class<dynamic>;
|
||||
static method t2a(dynamic o) → dynamic
|
||||
return o as{ForNonNullableByDefault} dynamic;
|
||||
static method t3a(dynamic o) → dynamic
|
||||
return o as{ForNonNullableByDefault} self::Class<dynamic>;
|
||||
static method t4a(dynamic o) → dynamic
|
||||
return o as{ForNonNullableByDefault} self::Class<dynamic>;
|
||||
static method t5a(dynamic o) → dynamic
|
||||
return o as{ForNonNullableByDefault} self::ConcreteClass;
|
||||
static method t6a(dynamic o) → dynamic
|
||||
return o as{ForNonNullableByDefault} self::Class<self::ConcreteClass>;
|
||||
static method t7a(dynamic o) → dynamic
|
||||
return o as{ForNonNullableByDefault} core::Object;
|
||||
static method t8a(dynamic o) → dynamic
|
||||
return o as{ForNonNullableByDefault} core::int;
|
||||
static method s1a(dynamic o) → dynamic
|
||||
return o as{ForNonNullableByDefault} self::G<self::Class<dynamic>>;
|
||||
static method s2a(dynamic o) → dynamic
|
||||
return o as{ForNonNullableByDefault} self::G<dynamic>;
|
||||
static method s3a(dynamic o) → dynamic
|
||||
return o as{ForNonNullableByDefault} self::G<self::Class<dynamic>>;
|
||||
static method s4a(dynamic o) → dynamic
|
||||
return o as{ForNonNullableByDefault} self::G<self::Class<dynamic>>;
|
||||
static method s5a(dynamic o) → dynamic
|
||||
return o as{ForNonNullableByDefault} self::G<self::ConcreteClass>;
|
||||
static method s6a(dynamic o) → dynamic
|
||||
return o as{ForNonNullableByDefault} self::G<self::Class<self::ConcreteClass>>;
|
||||
static method s7a(dynamic o) → dynamic
|
||||
return o as{ForNonNullableByDefault} self::G<core::Object>;
|
||||
static method s8a(dynamic o) → dynamic
|
||||
return o as{ForNonNullableByDefault} self::G<core::int>;
|
||||
static method t1b(dynamic o) → dynamic
|
||||
return o is{ForNonNullableByDefault} self::Class<dynamic>;
|
||||
static method t2b(dynamic o) → dynamic
|
||||
return o is{ForNonNullableByDefault} dynamic;
|
||||
static method t3b(dynamic o) → dynamic
|
||||
return o is{ForNonNullableByDefault} self::Class<dynamic>;
|
||||
static method t4b(dynamic o) → dynamic
|
||||
return o is{ForNonNullableByDefault} self::Class<dynamic>;
|
||||
static method t5b(dynamic o) → dynamic
|
||||
return o is{ForNonNullableByDefault} self::ConcreteClass;
|
||||
static method t6b(dynamic o) → dynamic
|
||||
return o is{ForNonNullableByDefault} self::Class<self::ConcreteClass>;
|
||||
static method t7b(dynamic o) → dynamic
|
||||
return o is{ForNonNullableByDefault} core::Object;
|
||||
static method t8b(dynamic o) → dynamic
|
||||
return o is{ForNonNullableByDefault} core::int;
|
||||
static method s1b(dynamic o) → dynamic
|
||||
return o is{ForNonNullableByDefault} self::G<self::Class<dynamic>>;
|
||||
static method s2b(dynamic o) → dynamic
|
||||
return o is{ForNonNullableByDefault} self::G<dynamic>;
|
||||
static method s3b(dynamic o) → dynamic
|
||||
return o is{ForNonNullableByDefault} self::G<self::Class<dynamic>>;
|
||||
static method s4b(dynamic o) → dynamic
|
||||
return o is{ForNonNullableByDefault} self::G<self::Class<dynamic>>;
|
||||
static method s5b(dynamic o) → dynamic
|
||||
return o is{ForNonNullableByDefault} self::G<self::ConcreteClass>;
|
||||
static method s6b(dynamic o) → dynamic
|
||||
return o is{ForNonNullableByDefault} self::G<self::Class<self::ConcreteClass>>;
|
||||
static method s7b(dynamic o) → dynamic
|
||||
return o is{ForNonNullableByDefault} self::G<core::Object>;
|
||||
static method s8b(dynamic o) → dynamic
|
||||
return o is{ForNonNullableByDefault} self::G<core::int>;
|
||||
static method main() → dynamic {}
|
||||
@@ -0,0 +1,83 @@
|
||||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
typedef F<X extends self::Class<X> = self::Class<dynamic>> = X;
|
||||
class Class<T extends core::Object? = dynamic> extends core::Object {
|
||||
synthetic constructor •() → self::Class<self::Class::T%>
|
||||
;
|
||||
}
|
||||
class ConcreteClass extends core::Object implements self::Class<self::ConcreteClass> {
|
||||
synthetic constructor •() → self::ConcreteClass
|
||||
;
|
||||
}
|
||||
class G<X extends self::Class<self::G::X> = self::Class<dynamic>> extends core::Object {
|
||||
synthetic constructor •() → self::G<self::G::X>
|
||||
;
|
||||
}
|
||||
static method t1a(dynamic o) → dynamic
|
||||
;
|
||||
static method t2a(dynamic o) → dynamic
|
||||
;
|
||||
static method t3a(dynamic o) → dynamic
|
||||
;
|
||||
static method t4a(dynamic o) → dynamic
|
||||
;
|
||||
static method t5a(dynamic o) → dynamic
|
||||
;
|
||||
static method t6a(dynamic o) → dynamic
|
||||
;
|
||||
static method t7a(dynamic o) → dynamic
|
||||
;
|
||||
static method t8a(dynamic o) → dynamic
|
||||
;
|
||||
static method s1a(dynamic o) → dynamic
|
||||
;
|
||||
static method s2a(dynamic o) → dynamic
|
||||
;
|
||||
static method s3a(dynamic o) → dynamic
|
||||
;
|
||||
static method s4a(dynamic o) → dynamic
|
||||
;
|
||||
static method s5a(dynamic o) → dynamic
|
||||
;
|
||||
static method s6a(dynamic o) → dynamic
|
||||
;
|
||||
static method s7a(dynamic o) → dynamic
|
||||
;
|
||||
static method s8a(dynamic o) → dynamic
|
||||
;
|
||||
static method t1b(dynamic o) → dynamic
|
||||
;
|
||||
static method t2b(dynamic o) → dynamic
|
||||
;
|
||||
static method t3b(dynamic o) → dynamic
|
||||
;
|
||||
static method t4b(dynamic o) → dynamic
|
||||
;
|
||||
static method t5b(dynamic o) → dynamic
|
||||
;
|
||||
static method t6b(dynamic o) → dynamic
|
||||
;
|
||||
static method t7b(dynamic o) → dynamic
|
||||
;
|
||||
static method t8b(dynamic o) → dynamic
|
||||
;
|
||||
static method s1b(dynamic o) → dynamic
|
||||
;
|
||||
static method s2b(dynamic o) → dynamic
|
||||
;
|
||||
static method s3b(dynamic o) → dynamic
|
||||
;
|
||||
static method s4b(dynamic o) → dynamic
|
||||
;
|
||||
static method s5b(dynamic o) → dynamic
|
||||
;
|
||||
static method s6b(dynamic o) → dynamic
|
||||
;
|
||||
static method s7b(dynamic o) → dynamic
|
||||
;
|
||||
static method s8b(dynamic o) → dynamic
|
||||
;
|
||||
static method main() → dynamic
|
||||
;
|
||||
@@ -0,0 +1,164 @@
|
||||
library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_as_is.dart:19:16: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_as_is.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// t7a(o) => o as F<Object>; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_as_is.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = X;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_as_is.dart:20:16: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_as_is.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// t8a(o) => o as F<int>; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_as_is.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = X;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_as_is.dart:27:16: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_as_is.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// s7a(o) => o as G<Object>; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_as_is.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_as_is.dart:28:16: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_as_is.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// s8a(o) => o as G<int>; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_as_is.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_as_is.dart:36:16: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_as_is.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// t7b(o) => o is F<Object>; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_as_is.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = X;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_as_is.dart:37:16: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_as_is.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// t8b(o) => o is F<int>; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_as_is.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = X;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_as_is.dart:44:16: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_as_is.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// s7b(o) => o is G<Object>; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_as_is.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_as_is.dart:45:16: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_as_is.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// s8b(o) => o is G<int>; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_as_is.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
typedef F<X extends self::Class<X> = self::Class<dynamic>> = X;
|
||||
class Class<T extends core::Object? = dynamic> extends core::Object {
|
||||
synthetic constructor •() → self::Class<self::Class::T%>
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
class ConcreteClass extends core::Object implements self::Class<self::ConcreteClass> {
|
||||
synthetic constructor •() → self::ConcreteClass
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
class G<X extends self::Class<self::G::X> = self::Class<dynamic>> extends core::Object {
|
||||
synthetic constructor •() → self::G<self::G::X>
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
static method t1a(dynamic o) → dynamic
|
||||
return o as{ForNonNullableByDefault} self::Class<dynamic>;
|
||||
static method t2a(dynamic o) → dynamic
|
||||
return o as{ForNonNullableByDefault} dynamic;
|
||||
static method t3a(dynamic o) → dynamic
|
||||
return o as{ForNonNullableByDefault} self::Class<dynamic>;
|
||||
static method t4a(dynamic o) → dynamic
|
||||
return o as{ForNonNullableByDefault} self::Class<dynamic>;
|
||||
static method t5a(dynamic o) → dynamic
|
||||
return o as{ForNonNullableByDefault} self::ConcreteClass;
|
||||
static method t6a(dynamic o) → dynamic
|
||||
return o as{ForNonNullableByDefault} self::Class<self::ConcreteClass>;
|
||||
static method t7a(dynamic o) → dynamic
|
||||
return o;
|
||||
static method t8a(dynamic o) → dynamic
|
||||
return o as{ForNonNullableByDefault} core::int;
|
||||
static method s1a(dynamic o) → dynamic
|
||||
return o as{ForNonNullableByDefault} self::G<self::Class<dynamic>>;
|
||||
static method s2a(dynamic o) → dynamic
|
||||
return o as{ForNonNullableByDefault} self::G<dynamic>;
|
||||
static method s3a(dynamic o) → dynamic
|
||||
return o as{ForNonNullableByDefault} self::G<self::Class<dynamic>>;
|
||||
static method s4a(dynamic o) → dynamic
|
||||
return o as{ForNonNullableByDefault} self::G<self::Class<dynamic>>;
|
||||
static method s5a(dynamic o) → dynamic
|
||||
return o as{ForNonNullableByDefault} self::G<self::ConcreteClass>;
|
||||
static method s6a(dynamic o) → dynamic
|
||||
return o as{ForNonNullableByDefault} self::G<self::Class<self::ConcreteClass>>;
|
||||
static method s7a(dynamic o) → dynamic
|
||||
return o as{ForNonNullableByDefault} self::G<core::Object>;
|
||||
static method s8a(dynamic o) → dynamic
|
||||
return o as{ForNonNullableByDefault} self::G<core::int>;
|
||||
static method t1b(dynamic o) → dynamic
|
||||
return o is{ForNonNullableByDefault} self::Class<dynamic>;
|
||||
static method t2b(dynamic o) → dynamic
|
||||
return o is{ForNonNullableByDefault} dynamic;
|
||||
static method t3b(dynamic o) → dynamic
|
||||
return o is{ForNonNullableByDefault} self::Class<dynamic>;
|
||||
static method t4b(dynamic o) → dynamic
|
||||
return o is{ForNonNullableByDefault} self::Class<dynamic>;
|
||||
static method t5b(dynamic o) → dynamic
|
||||
return o is{ForNonNullableByDefault} self::ConcreteClass;
|
||||
static method t6b(dynamic o) → dynamic
|
||||
return o is{ForNonNullableByDefault} self::Class<self::ConcreteClass>;
|
||||
static method t7b(dynamic o) → dynamic
|
||||
return o is{ForNonNullableByDefault} core::Object;
|
||||
static method t8b(dynamic o) → dynamic
|
||||
return o is{ForNonNullableByDefault} core::int;
|
||||
static method s1b(dynamic o) → dynamic
|
||||
return o is{ForNonNullableByDefault} self::G<self::Class<dynamic>>;
|
||||
static method s2b(dynamic o) → dynamic
|
||||
return o is{ForNonNullableByDefault} self::G<dynamic>;
|
||||
static method s3b(dynamic o) → dynamic
|
||||
return o is{ForNonNullableByDefault} self::G<self::Class<dynamic>>;
|
||||
static method s4b(dynamic o) → dynamic
|
||||
return o is{ForNonNullableByDefault} self::G<self::Class<dynamic>>;
|
||||
static method s5b(dynamic o) → dynamic
|
||||
return o is{ForNonNullableByDefault} self::G<self::ConcreteClass>;
|
||||
static method s6b(dynamic o) → dynamic
|
||||
return o is{ForNonNullableByDefault} self::G<self::Class<self::ConcreteClass>>;
|
||||
static method s7b(dynamic o) → dynamic
|
||||
return o is{ForNonNullableByDefault} self::G<core::Object>;
|
||||
static method s8b(dynamic o) → dynamic
|
||||
return o is{ForNonNullableByDefault} self::G<core::int>;
|
||||
static method main() → dynamic {}
|
||||
@@ -0,0 +1,205 @@
|
||||
// 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.
|
||||
|
||||
class Class<T> {}
|
||||
|
||||
class ConcreteClass implements Class<ConcreteClass> {}
|
||||
|
||||
typedef F<X extends Class<X>> = X;
|
||||
|
||||
class G<X extends Class<X>> {}
|
||||
|
||||
t1a() {
|
||||
try {} on F catch (e) {
|
||||
// Ok
|
||||
}
|
||||
}
|
||||
|
||||
t2a() {
|
||||
try {} on F<dynamic> catch (e) {
|
||||
// Ok
|
||||
}
|
||||
}
|
||||
|
||||
t3a() {
|
||||
try {} on F<Class> catch (e) {
|
||||
// Ok
|
||||
}
|
||||
}
|
||||
|
||||
t4a() {
|
||||
try {} on F<Class<dynamic>> catch (e) {
|
||||
// Ok
|
||||
}
|
||||
}
|
||||
|
||||
t5a() {
|
||||
try {} on F<ConcreteClass> catch (e) {
|
||||
// Ok
|
||||
}
|
||||
}
|
||||
|
||||
t6a() {
|
||||
try {} on F<Class<ConcreteClass>> catch (e) {
|
||||
// Ok
|
||||
}
|
||||
}
|
||||
|
||||
t7a() {
|
||||
try {} on F<Object> catch (e) {
|
||||
// Error
|
||||
}
|
||||
}
|
||||
|
||||
t8a() {
|
||||
try {} on F<int> catch (e) {
|
||||
// Error
|
||||
}
|
||||
}
|
||||
|
||||
s1a() {
|
||||
try {} on G catch (e) {
|
||||
// Ok
|
||||
}
|
||||
}
|
||||
|
||||
s2a() {
|
||||
try {} on G<dynamic> catch (e) {
|
||||
// Ok
|
||||
}
|
||||
}
|
||||
|
||||
s3a() {
|
||||
try {} on G<Class> catch (e) {
|
||||
// Ok
|
||||
}
|
||||
}
|
||||
|
||||
s4a() {
|
||||
try {} on G<Class<dynamic>> catch (e) {
|
||||
// Ok
|
||||
}
|
||||
}
|
||||
|
||||
s5a() {
|
||||
try {} on G<ConcreteClass> catch (e) {
|
||||
// Ok
|
||||
}
|
||||
}
|
||||
|
||||
s6a() {
|
||||
try {} on G<Class<ConcreteClass>> catch (e) {
|
||||
// Ok
|
||||
}
|
||||
}
|
||||
|
||||
s7a() {
|
||||
try {} on G<Object> catch (e) {
|
||||
// Error
|
||||
}
|
||||
}
|
||||
|
||||
s8a() {
|
||||
try {} on G<int> catch (e) {
|
||||
// Error
|
||||
}
|
||||
}
|
||||
|
||||
t1b() {
|
||||
try {} on F catch (e) {
|
||||
// Ok
|
||||
}
|
||||
}
|
||||
|
||||
t2b() {
|
||||
try {} on F<dynamic> catch (e) {
|
||||
// Ok
|
||||
}
|
||||
}
|
||||
|
||||
t3b() {
|
||||
try {} on F<Class> catch (e) {
|
||||
// Ok
|
||||
}
|
||||
}
|
||||
|
||||
t4b() {
|
||||
try {} on F<Class<dynamic>> catch (e) {
|
||||
// Ok
|
||||
}
|
||||
}
|
||||
|
||||
t5b() {
|
||||
try {} on F<ConcreteClass> catch (e) {
|
||||
// Ok
|
||||
}
|
||||
}
|
||||
|
||||
t6b() {
|
||||
try {} on F<Class<ConcreteClass>> catch (e) {
|
||||
// Ok
|
||||
}
|
||||
}
|
||||
|
||||
t7b() {
|
||||
try {} on F<Object> catch (e) {
|
||||
// Error
|
||||
}
|
||||
}
|
||||
|
||||
t8b() {
|
||||
try {} on F<int> catch (e) {
|
||||
// Error
|
||||
}
|
||||
}
|
||||
|
||||
s1b() {
|
||||
try {} on G catch (e) {
|
||||
// Ok
|
||||
}
|
||||
}
|
||||
|
||||
s2b() {
|
||||
try {} on G<dynamic> catch (e) {
|
||||
// Ok
|
||||
}
|
||||
}
|
||||
|
||||
s3b() {
|
||||
try {} on G<Class> catch (e) {
|
||||
// Ok
|
||||
}
|
||||
}
|
||||
|
||||
s4b() {
|
||||
try {} on G<Class<dynamic>> catch (e) {
|
||||
// Ok
|
||||
}
|
||||
}
|
||||
|
||||
s5b() {
|
||||
try {} on G<ConcreteClass> catch (e) {
|
||||
// Ok
|
||||
}
|
||||
}
|
||||
|
||||
s6b() {
|
||||
try {} on G<Class<ConcreteClass>> catch (e) {
|
||||
// Ok
|
||||
}
|
||||
}
|
||||
|
||||
s7b() {
|
||||
try {} on G<Object> catch (e) {
|
||||
// Error
|
||||
}
|
||||
}
|
||||
|
||||
s8b() {
|
||||
try {} on G<int> catch (e) {
|
||||
// Error
|
||||
}
|
||||
}
|
||||
|
||||
main() {}
|
||||
@@ -0,0 +1,41 @@
|
||||
class Class<T> {}
|
||||
|
||||
class ConcreteClass implements Class<ConcreteClass> {}
|
||||
|
||||
typedef F<X extends Class<X>> = X;
|
||||
|
||||
class G<X extends Class<X>> {}
|
||||
|
||||
t1a() {}
|
||||
t2a() {}
|
||||
t3a() {}
|
||||
t4a() {}
|
||||
t5a() {}
|
||||
t6a() {}
|
||||
t7a() {}
|
||||
t8a() {}
|
||||
s1a() {}
|
||||
s2a() {}
|
||||
s3a() {}
|
||||
s4a() {}
|
||||
s5a() {}
|
||||
s6a() {}
|
||||
s7a() {}
|
||||
s8a() {}
|
||||
t1b() {}
|
||||
t2b() {}
|
||||
t3b() {}
|
||||
t4b() {}
|
||||
t5b() {}
|
||||
t6b() {}
|
||||
t7b() {}
|
||||
t8b() {}
|
||||
s1b() {}
|
||||
s2b() {}
|
||||
s3b() {}
|
||||
s4b() {}
|
||||
s5b() {}
|
||||
s6b() {}
|
||||
s7b() {}
|
||||
s8b() {}
|
||||
main() {}
|
||||
@@ -0,0 +1,40 @@
|
||||
class Class<T> {}
|
||||
|
||||
class ConcreteClass implements Class<ConcreteClass> {}
|
||||
|
||||
class G<X extends Class<X>> {}
|
||||
|
||||
main() {}
|
||||
s1a() {}
|
||||
s1b() {}
|
||||
s2a() {}
|
||||
s2b() {}
|
||||
s3a() {}
|
||||
s3b() {}
|
||||
s4a() {}
|
||||
s4b() {}
|
||||
s5a() {}
|
||||
s5b() {}
|
||||
s6a() {}
|
||||
s6b() {}
|
||||
s7a() {}
|
||||
s7b() {}
|
||||
s8a() {}
|
||||
s8b() {}
|
||||
t1a() {}
|
||||
t1b() {}
|
||||
t2a() {}
|
||||
t2b() {}
|
||||
t3a() {}
|
||||
t3b() {}
|
||||
t4a() {}
|
||||
t4b() {}
|
||||
t5a() {}
|
||||
t5b() {}
|
||||
t6a() {}
|
||||
t6b() {}
|
||||
t7a() {}
|
||||
t7b() {}
|
||||
t8a() {}
|
||||
t8b() {}
|
||||
typedef F<X extends Class<X>> = X;
|
||||
@@ -0,0 +1,292 @@
|
||||
library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_catch.dart:50:13: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_catch.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// try {} on F<Object> catch (e) {
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_catch.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = X;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_catch.dart:56:13: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_catch.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// try {} on F<int> catch (e) {
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_catch.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = X;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_catch.dart:98:13: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_catch.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// try {} on G<Object> catch (e) {
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_catch.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_catch.dart:104:13: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_catch.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// try {} on G<int> catch (e) {
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_catch.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_catch.dart:146:13: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_catch.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// try {} on F<Object> catch (e) {
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_catch.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = X;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_catch.dart:152:13: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_catch.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// try {} on F<int> catch (e) {
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_catch.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = X;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_catch.dart:194:13: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_catch.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// try {} on G<Object> catch (e) {
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_catch.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_catch.dart:200:13: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_catch.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// try {} on G<int> catch (e) {
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_catch.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
typedef F<X extends self::Class<X> = self::Class<dynamic>> = X;
|
||||
class Class<T extends core::Object? = dynamic> extends core::Object {
|
||||
synthetic constructor •() → self::Class<self::Class::T%>
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
class ConcreteClass extends core::Object implements self::Class<self::ConcreteClass> {
|
||||
synthetic constructor •() → self::ConcreteClass
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
class G<X extends self::Class<self::G::X> = self::Class<dynamic>> extends core::Object {
|
||||
synthetic constructor •() → self::G<self::G::X>
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
static method t1a() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::Class<dynamic> catch(final self::Class<dynamic> e) {
|
||||
}
|
||||
}
|
||||
static method t2a() → dynamic {
|
||||
try {
|
||||
}
|
||||
on dynamic catch(final dynamic e) {
|
||||
}
|
||||
}
|
||||
static method t3a() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::Class<dynamic> catch(final self::Class<dynamic> e) {
|
||||
}
|
||||
}
|
||||
static method t4a() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::Class<dynamic> catch(final self::Class<dynamic> e) {
|
||||
}
|
||||
}
|
||||
static method t5a() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::ConcreteClass catch(final self::ConcreteClass e) {
|
||||
}
|
||||
}
|
||||
static method t6a() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::Class<self::ConcreteClass> catch(final self::Class<self::ConcreteClass> e) {
|
||||
}
|
||||
}
|
||||
static method t7a() → dynamic {
|
||||
try {
|
||||
}
|
||||
on core::Object catch(final core::Object e) {
|
||||
}
|
||||
}
|
||||
static method t8a() → dynamic {
|
||||
try {
|
||||
}
|
||||
on core::int catch(final core::int e) {
|
||||
}
|
||||
}
|
||||
static method s1a() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::G<self::Class<dynamic>> catch(final self::G<self::Class<dynamic>> e) {
|
||||
}
|
||||
}
|
||||
static method s2a() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::G<dynamic> catch(final self::G<dynamic> e) {
|
||||
}
|
||||
}
|
||||
static method s3a() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::G<self::Class<dynamic>> catch(final self::G<self::Class<dynamic>> e) {
|
||||
}
|
||||
}
|
||||
static method s4a() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::G<self::Class<dynamic>> catch(final self::G<self::Class<dynamic>> e) {
|
||||
}
|
||||
}
|
||||
static method s5a() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::G<self::ConcreteClass> catch(final self::G<self::ConcreteClass> e) {
|
||||
}
|
||||
}
|
||||
static method s6a() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::G<self::Class<self::ConcreteClass>> catch(final self::G<self::Class<self::ConcreteClass>> e) {
|
||||
}
|
||||
}
|
||||
static method s7a() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::G<core::Object> catch(final self::G<core::Object> e) {
|
||||
}
|
||||
}
|
||||
static method s8a() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::G<core::int> catch(final self::G<core::int> e) {
|
||||
}
|
||||
}
|
||||
static method t1b() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::Class<dynamic> catch(final self::Class<dynamic> e) {
|
||||
}
|
||||
}
|
||||
static method t2b() → dynamic {
|
||||
try {
|
||||
}
|
||||
on dynamic catch(final dynamic e) {
|
||||
}
|
||||
}
|
||||
static method t3b() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::Class<dynamic> catch(final self::Class<dynamic> e) {
|
||||
}
|
||||
}
|
||||
static method t4b() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::Class<dynamic> catch(final self::Class<dynamic> e) {
|
||||
}
|
||||
}
|
||||
static method t5b() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::ConcreteClass catch(final self::ConcreteClass e) {
|
||||
}
|
||||
}
|
||||
static method t6b() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::Class<self::ConcreteClass> catch(final self::Class<self::ConcreteClass> e) {
|
||||
}
|
||||
}
|
||||
static method t7b() → dynamic {
|
||||
try {
|
||||
}
|
||||
on core::Object catch(final core::Object e) {
|
||||
}
|
||||
}
|
||||
static method t8b() → dynamic {
|
||||
try {
|
||||
}
|
||||
on core::int catch(final core::int e) {
|
||||
}
|
||||
}
|
||||
static method s1b() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::G<self::Class<dynamic>> catch(final self::G<self::Class<dynamic>> e) {
|
||||
}
|
||||
}
|
||||
static method s2b() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::G<dynamic> catch(final self::G<dynamic> e) {
|
||||
}
|
||||
}
|
||||
static method s3b() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::G<self::Class<dynamic>> catch(final self::G<self::Class<dynamic>> e) {
|
||||
}
|
||||
}
|
||||
static method s4b() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::G<self::Class<dynamic>> catch(final self::G<self::Class<dynamic>> e) {
|
||||
}
|
||||
}
|
||||
static method s5b() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::G<self::ConcreteClass> catch(final self::G<self::ConcreteClass> e) {
|
||||
}
|
||||
}
|
||||
static method s6b() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::G<self::Class<self::ConcreteClass>> catch(final self::G<self::Class<self::ConcreteClass>> e) {
|
||||
}
|
||||
}
|
||||
static method s7b() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::G<core::Object> catch(final self::G<core::Object> e) {
|
||||
}
|
||||
}
|
||||
static method s8b() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::G<core::int> catch(final self::G<core::int> e) {
|
||||
}
|
||||
}
|
||||
static method main() → dynamic {}
|
||||
@@ -0,0 +1,292 @@
|
||||
library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_catch.dart:50:13: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_catch.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// try {} on F<Object> catch (e) {
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_catch.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = X;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_catch.dart:56:13: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_catch.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// try {} on F<int> catch (e) {
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_catch.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = X;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_catch.dart:98:13: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_catch.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// try {} on G<Object> catch (e) {
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_catch.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_catch.dart:104:13: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_catch.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// try {} on G<int> catch (e) {
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_catch.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_catch.dart:146:13: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_catch.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// try {} on F<Object> catch (e) {
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_catch.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = X;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_catch.dart:152:13: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_catch.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// try {} on F<int> catch (e) {
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_catch.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = X;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_catch.dart:194:13: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_catch.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// try {} on G<Object> catch (e) {
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_catch.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_catch.dart:200:13: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_catch.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// try {} on G<int> catch (e) {
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_catch.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
typedef F<X extends self::Class<X> = self::Class<dynamic>> = X;
|
||||
class Class<T extends core::Object? = dynamic> extends core::Object {
|
||||
synthetic constructor •() → self::Class<self::Class::T%>
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
class ConcreteClass extends core::Object implements self::Class<self::ConcreteClass> {
|
||||
synthetic constructor •() → self::ConcreteClass
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
class G<X extends self::Class<self::G::X> = self::Class<dynamic>> extends core::Object {
|
||||
synthetic constructor •() → self::G<self::G::X>
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
static method t1a() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::Class<dynamic> catch(final self::Class<dynamic> e) {
|
||||
}
|
||||
}
|
||||
static method t2a() → dynamic {
|
||||
try {
|
||||
}
|
||||
on dynamic catch(final dynamic e) {
|
||||
}
|
||||
}
|
||||
static method t3a() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::Class<dynamic> catch(final self::Class<dynamic> e) {
|
||||
}
|
||||
}
|
||||
static method t4a() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::Class<dynamic> catch(final self::Class<dynamic> e) {
|
||||
}
|
||||
}
|
||||
static method t5a() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::ConcreteClass catch(final self::ConcreteClass e) {
|
||||
}
|
||||
}
|
||||
static method t6a() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::Class<self::ConcreteClass> catch(final self::Class<self::ConcreteClass> e) {
|
||||
}
|
||||
}
|
||||
static method t7a() → dynamic {
|
||||
try {
|
||||
}
|
||||
on core::Object catch(final core::Object e) {
|
||||
}
|
||||
}
|
||||
static method t8a() → dynamic {
|
||||
try {
|
||||
}
|
||||
on core::int catch(final core::int e) {
|
||||
}
|
||||
}
|
||||
static method s1a() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::G<self::Class<dynamic>> catch(final self::G<self::Class<dynamic>> e) {
|
||||
}
|
||||
}
|
||||
static method s2a() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::G<dynamic> catch(final self::G<dynamic> e) {
|
||||
}
|
||||
}
|
||||
static method s3a() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::G<self::Class<dynamic>> catch(final self::G<self::Class<dynamic>> e) {
|
||||
}
|
||||
}
|
||||
static method s4a() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::G<self::Class<dynamic>> catch(final self::G<self::Class<dynamic>> e) {
|
||||
}
|
||||
}
|
||||
static method s5a() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::G<self::ConcreteClass> catch(final self::G<self::ConcreteClass> e) {
|
||||
}
|
||||
}
|
||||
static method s6a() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::G<self::Class<self::ConcreteClass>> catch(final self::G<self::Class<self::ConcreteClass>> e) {
|
||||
}
|
||||
}
|
||||
static method s7a() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::G<core::Object> catch(final self::G<core::Object> e) {
|
||||
}
|
||||
}
|
||||
static method s8a() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::G<core::int> catch(final self::G<core::int> e) {
|
||||
}
|
||||
}
|
||||
static method t1b() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::Class<dynamic> catch(final self::Class<dynamic> e) {
|
||||
}
|
||||
}
|
||||
static method t2b() → dynamic {
|
||||
try {
|
||||
}
|
||||
on dynamic catch(final dynamic e) {
|
||||
}
|
||||
}
|
||||
static method t3b() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::Class<dynamic> catch(final self::Class<dynamic> e) {
|
||||
}
|
||||
}
|
||||
static method t4b() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::Class<dynamic> catch(final self::Class<dynamic> e) {
|
||||
}
|
||||
}
|
||||
static method t5b() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::ConcreteClass catch(final self::ConcreteClass e) {
|
||||
}
|
||||
}
|
||||
static method t6b() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::Class<self::ConcreteClass> catch(final self::Class<self::ConcreteClass> e) {
|
||||
}
|
||||
}
|
||||
static method t7b() → dynamic {
|
||||
try {
|
||||
}
|
||||
on core::Object catch(final core::Object e) {
|
||||
}
|
||||
}
|
||||
static method t8b() → dynamic {
|
||||
try {
|
||||
}
|
||||
on core::int catch(final core::int e) {
|
||||
}
|
||||
}
|
||||
static method s1b() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::G<self::Class<dynamic>> catch(final self::G<self::Class<dynamic>> e) {
|
||||
}
|
||||
}
|
||||
static method s2b() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::G<dynamic> catch(final self::G<dynamic> e) {
|
||||
}
|
||||
}
|
||||
static method s3b() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::G<self::Class<dynamic>> catch(final self::G<self::Class<dynamic>> e) {
|
||||
}
|
||||
}
|
||||
static method s4b() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::G<self::Class<dynamic>> catch(final self::G<self::Class<dynamic>> e) {
|
||||
}
|
||||
}
|
||||
static method s5b() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::G<self::ConcreteClass> catch(final self::G<self::ConcreteClass> e) {
|
||||
}
|
||||
}
|
||||
static method s6b() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::G<self::Class<self::ConcreteClass>> catch(final self::G<self::Class<self::ConcreteClass>> e) {
|
||||
}
|
||||
}
|
||||
static method s7b() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::G<core::Object> catch(final self::G<core::Object> e) {
|
||||
}
|
||||
}
|
||||
static method s8b() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::G<core::int> catch(final self::G<core::int> e) {
|
||||
}
|
||||
}
|
||||
static method main() → dynamic {}
|
||||
@@ -0,0 +1,83 @@
|
||||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
typedef F<X extends self::Class<X> = self::Class<dynamic>> = X;
|
||||
class Class<T extends core::Object? = dynamic> extends core::Object {
|
||||
synthetic constructor •() → self::Class<self::Class::T%>
|
||||
;
|
||||
}
|
||||
class ConcreteClass extends core::Object implements self::Class<self::ConcreteClass> {
|
||||
synthetic constructor •() → self::ConcreteClass
|
||||
;
|
||||
}
|
||||
class G<X extends self::Class<self::G::X> = self::Class<dynamic>> extends core::Object {
|
||||
synthetic constructor •() → self::G<self::G::X>
|
||||
;
|
||||
}
|
||||
static method t1a() → dynamic
|
||||
;
|
||||
static method t2a() → dynamic
|
||||
;
|
||||
static method t3a() → dynamic
|
||||
;
|
||||
static method t4a() → dynamic
|
||||
;
|
||||
static method t5a() → dynamic
|
||||
;
|
||||
static method t6a() → dynamic
|
||||
;
|
||||
static method t7a() → dynamic
|
||||
;
|
||||
static method t8a() → dynamic
|
||||
;
|
||||
static method s1a() → dynamic
|
||||
;
|
||||
static method s2a() → dynamic
|
||||
;
|
||||
static method s3a() → dynamic
|
||||
;
|
||||
static method s4a() → dynamic
|
||||
;
|
||||
static method s5a() → dynamic
|
||||
;
|
||||
static method s6a() → dynamic
|
||||
;
|
||||
static method s7a() → dynamic
|
||||
;
|
||||
static method s8a() → dynamic
|
||||
;
|
||||
static method t1b() → dynamic
|
||||
;
|
||||
static method t2b() → dynamic
|
||||
;
|
||||
static method t3b() → dynamic
|
||||
;
|
||||
static method t4b() → dynamic
|
||||
;
|
||||
static method t5b() → dynamic
|
||||
;
|
||||
static method t6b() → dynamic
|
||||
;
|
||||
static method t7b() → dynamic
|
||||
;
|
||||
static method t8b() → dynamic
|
||||
;
|
||||
static method s1b() → dynamic
|
||||
;
|
||||
static method s2b() → dynamic
|
||||
;
|
||||
static method s3b() → dynamic
|
||||
;
|
||||
static method s4b() → dynamic
|
||||
;
|
||||
static method s5b() → dynamic
|
||||
;
|
||||
static method s6b() → dynamic
|
||||
;
|
||||
static method s7b() → dynamic
|
||||
;
|
||||
static method s8b() → dynamic
|
||||
;
|
||||
static method main() → dynamic
|
||||
;
|
||||
@@ -0,0 +1,292 @@
|
||||
library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_catch.dart:50:13: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_catch.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// try {} on F<Object> catch (e) {
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_catch.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = X;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_catch.dart:56:13: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_catch.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// try {} on F<int> catch (e) {
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_catch.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = X;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_catch.dart:98:13: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_catch.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// try {} on G<Object> catch (e) {
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_catch.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_catch.dart:104:13: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_catch.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// try {} on G<int> catch (e) {
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_catch.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_catch.dart:146:13: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_catch.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// try {} on F<Object> catch (e) {
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_catch.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = X;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_catch.dart:152:13: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_catch.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// try {} on F<int> catch (e) {
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_catch.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = X;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_catch.dart:194:13: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_catch.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// try {} on G<Object> catch (e) {
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_catch.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_catch.dart:200:13: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_catch.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// try {} on G<int> catch (e) {
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_catch.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
typedef F<X extends self::Class<X> = self::Class<dynamic>> = X;
|
||||
class Class<T extends core::Object? = dynamic> extends core::Object {
|
||||
synthetic constructor •() → self::Class<self::Class::T%>
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
class ConcreteClass extends core::Object implements self::Class<self::ConcreteClass> {
|
||||
synthetic constructor •() → self::ConcreteClass
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
class G<X extends self::Class<self::G::X> = self::Class<dynamic>> extends core::Object {
|
||||
synthetic constructor •() → self::G<self::G::X>
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
static method t1a() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::Class<dynamic> catch(final self::Class<dynamic> e) {
|
||||
}
|
||||
}
|
||||
static method t2a() → dynamic {
|
||||
try {
|
||||
}
|
||||
on dynamic catch(final dynamic e) {
|
||||
}
|
||||
}
|
||||
static method t3a() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::Class<dynamic> catch(final self::Class<dynamic> e) {
|
||||
}
|
||||
}
|
||||
static method t4a() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::Class<dynamic> catch(final self::Class<dynamic> e) {
|
||||
}
|
||||
}
|
||||
static method t5a() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::ConcreteClass catch(final self::ConcreteClass e) {
|
||||
}
|
||||
}
|
||||
static method t6a() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::Class<self::ConcreteClass> catch(final self::Class<self::ConcreteClass> e) {
|
||||
}
|
||||
}
|
||||
static method t7a() → dynamic {
|
||||
try {
|
||||
}
|
||||
on core::Object catch(final core::Object e) {
|
||||
}
|
||||
}
|
||||
static method t8a() → dynamic {
|
||||
try {
|
||||
}
|
||||
on core::int catch(final core::int e) {
|
||||
}
|
||||
}
|
||||
static method s1a() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::G<self::Class<dynamic>> catch(final self::G<self::Class<dynamic>> e) {
|
||||
}
|
||||
}
|
||||
static method s2a() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::G<dynamic> catch(final self::G<dynamic> e) {
|
||||
}
|
||||
}
|
||||
static method s3a() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::G<self::Class<dynamic>> catch(final self::G<self::Class<dynamic>> e) {
|
||||
}
|
||||
}
|
||||
static method s4a() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::G<self::Class<dynamic>> catch(final self::G<self::Class<dynamic>> e) {
|
||||
}
|
||||
}
|
||||
static method s5a() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::G<self::ConcreteClass> catch(final self::G<self::ConcreteClass> e) {
|
||||
}
|
||||
}
|
||||
static method s6a() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::G<self::Class<self::ConcreteClass>> catch(final self::G<self::Class<self::ConcreteClass>> e) {
|
||||
}
|
||||
}
|
||||
static method s7a() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::G<core::Object> catch(final self::G<core::Object> e) {
|
||||
}
|
||||
}
|
||||
static method s8a() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::G<core::int> catch(final self::G<core::int> e) {
|
||||
}
|
||||
}
|
||||
static method t1b() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::Class<dynamic> catch(final self::Class<dynamic> e) {
|
||||
}
|
||||
}
|
||||
static method t2b() → dynamic {
|
||||
try {
|
||||
}
|
||||
on dynamic catch(final dynamic e) {
|
||||
}
|
||||
}
|
||||
static method t3b() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::Class<dynamic> catch(final self::Class<dynamic> e) {
|
||||
}
|
||||
}
|
||||
static method t4b() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::Class<dynamic> catch(final self::Class<dynamic> e) {
|
||||
}
|
||||
}
|
||||
static method t5b() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::ConcreteClass catch(final self::ConcreteClass e) {
|
||||
}
|
||||
}
|
||||
static method t6b() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::Class<self::ConcreteClass> catch(final self::Class<self::ConcreteClass> e) {
|
||||
}
|
||||
}
|
||||
static method t7b() → dynamic {
|
||||
try {
|
||||
}
|
||||
on core::Object catch(final core::Object e) {
|
||||
}
|
||||
}
|
||||
static method t8b() → dynamic {
|
||||
try {
|
||||
}
|
||||
on core::int catch(final core::int e) {
|
||||
}
|
||||
}
|
||||
static method s1b() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::G<self::Class<dynamic>> catch(final self::G<self::Class<dynamic>> e) {
|
||||
}
|
||||
}
|
||||
static method s2b() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::G<dynamic> catch(final self::G<dynamic> e) {
|
||||
}
|
||||
}
|
||||
static method s3b() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::G<self::Class<dynamic>> catch(final self::G<self::Class<dynamic>> e) {
|
||||
}
|
||||
}
|
||||
static method s4b() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::G<self::Class<dynamic>> catch(final self::G<self::Class<dynamic>> e) {
|
||||
}
|
||||
}
|
||||
static method s5b() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::G<self::ConcreteClass> catch(final self::G<self::ConcreteClass> e) {
|
||||
}
|
||||
}
|
||||
static method s6b() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::G<self::Class<self::ConcreteClass>> catch(final self::G<self::Class<self::ConcreteClass>> e) {
|
||||
}
|
||||
}
|
||||
static method s7b() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::G<core::Object> catch(final self::G<core::Object> e) {
|
||||
}
|
||||
}
|
||||
static method s8b() → dynamic {
|
||||
try {
|
||||
}
|
||||
on self::G<core::int> catch(final self::G<core::int> e) {
|
||||
}
|
||||
}
|
||||
static method main() → dynamic {}
|
||||
@@ -2,18 +2,18 @@ library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_check_in_typedef.dart:7:40: Error: Type argument 'Y' doesn't conform to the bound 'String' of the type variable 'X' on 'A'.
|
||||
// pkg/front_end/testcases/general/bounds_check_in_typedef.dart:7:32: Error: Type argument 'Y' doesn't conform to the bound 'String' of the type variable 'X' on 'A'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// typedef F = Function<Z extends A<Y>>() Function<Y extends num>();
|
||||
// ^
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_check_in_typedef.dart:5:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class A<X extends String> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_check_in_typedef.dart:8:18: Error: Type argument 'Y' doesn't conform to the bound 'String' of the type variable 'X' on 'A'.
|
||||
// pkg/front_end/testcases/general/bounds_check_in_typedef.dart:8:61: Error: Type argument 'Y' doesn't conform to the bound 'String' of the type variable 'X' on 'A'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// typedef G = void Function<Y extends num>(Function<Z extends A<Y>>());
|
||||
// ^
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_check_in_typedef.dart:5:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class A<X extends String> {}
|
||||
// ^
|
||||
|
||||
@@ -2,18 +2,18 @@ library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_check_in_typedef.dart:7:40: Error: Type argument 'Y' doesn't conform to the bound 'String' of the type variable 'X' on 'A'.
|
||||
// pkg/front_end/testcases/general/bounds_check_in_typedef.dart:7:32: Error: Type argument 'Y' doesn't conform to the bound 'String' of the type variable 'X' on 'A'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// typedef F = Function<Z extends A<Y>>() Function<Y extends num>();
|
||||
// ^
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_check_in_typedef.dart:5:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class A<X extends String> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_check_in_typedef.dart:8:18: Error: Type argument 'Y' doesn't conform to the bound 'String' of the type variable 'X' on 'A'.
|
||||
// pkg/front_end/testcases/general/bounds_check_in_typedef.dart:8:61: Error: Type argument 'Y' doesn't conform to the bound 'String' of the type variable 'X' on 'A'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// typedef G = void Function<Y extends num>(Function<Z extends A<Y>>());
|
||||
// ^
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_check_in_typedef.dart:5:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class A<X extends String> {}
|
||||
// ^
|
||||
|
||||
@@ -2,18 +2,18 @@ library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_check_in_typedef.dart:7:40: Error: Type argument 'Y' doesn't conform to the bound 'String' of the type variable 'X' on 'A'.
|
||||
// pkg/front_end/testcases/general/bounds_check_in_typedef.dart:7:32: Error: Type argument 'Y' doesn't conform to the bound 'String' of the type variable 'X' on 'A'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// typedef F = Function<Z extends A<Y>>() Function<Y extends num>();
|
||||
// ^
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_check_in_typedef.dart:5:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class A<X extends String> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_check_in_typedef.dart:8:18: Error: Type argument 'Y' doesn't conform to the bound 'String' of the type variable 'X' on 'A'.
|
||||
// pkg/front_end/testcases/general/bounds_check_in_typedef.dart:8:61: Error: Type argument 'Y' doesn't conform to the bound 'String' of the type variable 'X' on 'A'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// typedef G = void Function<Y extends num>(Function<Z extends A<Y>>());
|
||||
// ^
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_check_in_typedef.dart:5:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class A<X extends String> {}
|
||||
// ^
|
||||
|
||||
+4
-4
@@ -2,18 +2,18 @@ library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_check_in_typedef.dart:7:40: Error: Type argument 'Y' doesn't conform to the bound 'String' of the type variable 'X' on 'A'.
|
||||
// pkg/front_end/testcases/general/bounds_check_in_typedef.dart:7:32: Error: Type argument 'Y' doesn't conform to the bound 'String' of the type variable 'X' on 'A'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// typedef F = Function<Z extends A<Y>>() Function<Y extends num>();
|
||||
// ^
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_check_in_typedef.dart:5:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class A<X extends String> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_check_in_typedef.dart:8:18: Error: Type argument 'Y' doesn't conform to the bound 'String' of the type variable 'X' on 'A'.
|
||||
// pkg/front_end/testcases/general/bounds_check_in_typedef.dart:8:61: Error: Type argument 'Y' doesn't conform to the bound 'String' of the type variable 'X' on 'A'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// typedef G = void Function<Y extends num>(Function<Z extends A<Y>>());
|
||||
// ^
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_check_in_typedef.dart:5:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class A<X extends String> {}
|
||||
// ^
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
// 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.
|
||||
|
||||
// TODO(johnniwinther): Check/create this type as regular bounded i2b.
|
||||
|
||||
typedef A<X> = X Function(X);
|
||||
|
||||
class B<X> {}
|
||||
|
||||
enum E1<Y extends A<Y>> /* Error */ {
|
||||
e1<Never>() // Ok
|
||||
}
|
||||
|
||||
enum E2<Y extends B<Y>> /* Error */ {
|
||||
e2<Never>() // Ok
|
||||
}
|
||||
|
||||
enum E3<Y extends E3<Y>> /* Error */ {
|
||||
e3<Never>() // Ok
|
||||
}
|
||||
|
||||
main() {}
|
||||
@@ -0,0 +1,11 @@
|
||||
typedef A<X> = X Function(X);
|
||||
|
||||
class B<X> {}
|
||||
|
||||
enum E1<Y extends A<Y>> { e1<Never>() }
|
||||
|
||||
enum E2<Y extends B<Y>> { e2<Never>() }
|
||||
|
||||
enum E3<Y extends E3<Y>> { e3<Never>() }
|
||||
|
||||
main() {}
|
||||
@@ -0,0 +1,10 @@
|
||||
class B<X> {}
|
||||
|
||||
enum E1<Y extends A<Y>> { e1<Never>() }
|
||||
|
||||
enum E2<Y extends B<Y>> { e2<Never>() }
|
||||
|
||||
enum E3<Y extends E3<Y>> { e3<Never>() }
|
||||
|
||||
main() {}
|
||||
typedef A<X> = X Function(X);
|
||||
@@ -0,0 +1,75 @@
|
||||
library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_enums.dart:11:6: Error: Inferred type argument 'A<dynamic>' doesn't conform to the bound 'Y Function(Y)' of the type variable 'Y' on 'E1'.
|
||||
// Try specifying type arguments explicitly so that they conform to the bounds.
|
||||
// enum E1<Y extends A<Y>> /* Error */ {
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_enums.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// enum E1<Y extends A<Y>> /* Error */ {
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_enums.dart:11:6: Context: If you want 'E1<A<dynamic>>' to be a super-bounded type, note that the inverted type 'E1<A<Never>>' must then satisfy its bounds, which it does not.
|
||||
// - 'E1' is from 'pkg/front_end/testcases/general/bounds_enums.dart'.
|
||||
// enum E1<Y extends A<Y>> /* Error */ {
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
typedef A<invariant X extends core::Object? = dynamic> = (X%) → X%;
|
||||
class B<X extends core::Object? = dynamic> extends core::Object {
|
||||
synthetic constructor •() → self::B<self::B::X%>
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
class E1<Y extends (self::E1::Y) → self::E1::Y = (dynamic) → dynamic> extends core::_Enum /*isEnum*/ {
|
||||
static const field core::List<self::E1<(dynamic) → dynamic>> values = #C4;
|
||||
static const field self::E1<Never> e1 = #C3;
|
||||
const constructor •(core::int index, core::String name) → self::E1<self::E1::Y>
|
||||
: super core::_Enum::•(index, name)
|
||||
;
|
||||
method toString() → core::String
|
||||
return "E1.${this.{core::_Enum::_name}{core::String}}";
|
||||
}
|
||||
class E2<Y extends self::B<self::E2::Y> = self::B<dynamic>> extends core::_Enum /*isEnum*/ {
|
||||
static const field core::List<self::E2<self::B<dynamic>>> values = #C7;
|
||||
static const field self::E2<Never> e2 = #C6;
|
||||
const constructor •(core::int index, core::String name) → self::E2<self::E2::Y>
|
||||
: super core::_Enum::•(index, name)
|
||||
;
|
||||
method toString() → core::String
|
||||
return "E2.${this.{core::_Enum::_name}{core::String}}";
|
||||
}
|
||||
class E3<Y extends self::E3<self::E3::Y> = self::E3<dynamic>> extends core::_Enum /*isEnum*/ {
|
||||
static const field core::List<self::E3<self::E3<dynamic>>> values = #C10;
|
||||
static const field self::E3<Never> e3 = #C9;
|
||||
const constructor •(core::int index, core::String name) → self::E3<self::E3::Y>
|
||||
: super core::_Enum::•(index, name)
|
||||
;
|
||||
method toString() → core::String
|
||||
return "E3.${this.{core::_Enum::_name}{core::String}}";
|
||||
}
|
||||
static method main() → dynamic {}
|
||||
|
||||
constants {
|
||||
#C1 = 0
|
||||
#C2 = "e1"
|
||||
#C3 = self::E1<Never*> {index:#C1, _name:#C2}
|
||||
#C4 = <self::E1<dynamic>*>[#C3]
|
||||
#C5 = "e2"
|
||||
#C6 = self::E2<Never*> {index:#C1, _name:#C5}
|
||||
#C7 = <self::E2<dynamic>*>[#C6]
|
||||
#C8 = "e3"
|
||||
#C9 = self::E3<Never*> {index:#C1, _name:#C8}
|
||||
#C10 = <self::E3<dynamic>*>[#C9]
|
||||
}
|
||||
|
||||
|
||||
Constructor coverage from constants:
|
||||
org-dartlang-testcase:///bounds_enums.dart:
|
||||
- E1. (from org-dartlang-testcase:///bounds_enums.dart:11:6)
|
||||
- _Enum. (from org-dartlang-sdk:///sdk/lib/core/enum.dart:103:9)
|
||||
- Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart:25:9)
|
||||
- E2. (from org-dartlang-testcase:///bounds_enums.dart:15:6)
|
||||
- E3. (from org-dartlang-testcase:///bounds_enums.dart:19:6)
|
||||
@@ -0,0 +1,75 @@
|
||||
library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_enums.dart:11:6: Error: Inferred type argument 'A<dynamic>' doesn't conform to the bound 'Y Function(Y)' of the type variable 'Y' on 'E1'.
|
||||
// Try specifying type arguments explicitly so that they conform to the bounds.
|
||||
// enum E1<Y extends A<Y>> /* Error */ {
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_enums.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// enum E1<Y extends A<Y>> /* Error */ {
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_enums.dart:11:6: Context: If you want 'E1<A<dynamic>>' to be a super-bounded type, note that the inverted type 'E1<A<Never>>' must then satisfy its bounds, which it does not.
|
||||
// - 'E1' is from 'pkg/front_end/testcases/general/bounds_enums.dart'.
|
||||
// enum E1<Y extends A<Y>> /* Error */ {
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
typedef A<invariant X extends core::Object? = dynamic> = (X%) → X%;
|
||||
class B<X extends core::Object? = dynamic> extends core::Object {
|
||||
synthetic constructor •() → self::B<self::B::X%>
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
class E1<Y extends (self::E1::Y) → self::E1::Y = (dynamic) → dynamic> extends core::_Enum /*isEnum*/ {
|
||||
static const field core::List<self::E1<(dynamic) → dynamic>> values = #C4;
|
||||
static const field self::E1<Never> e1 = #C3;
|
||||
const constructor •(core::int index, core::String name) → self::E1<self::E1::Y>
|
||||
: super core::_Enum::•(index, name)
|
||||
;
|
||||
method toString() → core::String
|
||||
return "E1.${this.{core::_Enum::_name}{core::String}}";
|
||||
}
|
||||
class E2<Y extends self::B<self::E2::Y> = self::B<dynamic>> extends core::_Enum /*isEnum*/ {
|
||||
static const field core::List<self::E2<self::B<dynamic>>> values = #C7;
|
||||
static const field self::E2<Never> e2 = #C6;
|
||||
const constructor •(core::int index, core::String name) → self::E2<self::E2::Y>
|
||||
: super core::_Enum::•(index, name)
|
||||
;
|
||||
method toString() → core::String
|
||||
return "E2.${this.{core::_Enum::_name}{core::String}}";
|
||||
}
|
||||
class E3<Y extends self::E3<self::E3::Y> = self::E3<dynamic>> extends core::_Enum /*isEnum*/ {
|
||||
static const field core::List<self::E3<self::E3<dynamic>>> values = #C10;
|
||||
static const field self::E3<Never> e3 = #C9;
|
||||
const constructor •(core::int index, core::String name) → self::E3<self::E3::Y>
|
||||
: super core::_Enum::•(index, name)
|
||||
;
|
||||
method toString() → core::String
|
||||
return "E3.${this.{core::_Enum::_name}{core::String}}";
|
||||
}
|
||||
static method main() → dynamic {}
|
||||
|
||||
constants {
|
||||
#C1 = 0
|
||||
#C2 = "e1"
|
||||
#C3 = self::E1<Never*> {index:#C1, _name:#C2}
|
||||
#C4 = <self::E1<dynamic>*>[#C3]
|
||||
#C5 = "e2"
|
||||
#C6 = self::E2<Never*> {index:#C1, _name:#C5}
|
||||
#C7 = <self::E2<dynamic>*>[#C6]
|
||||
#C8 = "e3"
|
||||
#C9 = self::E3<Never*> {index:#C1, _name:#C8}
|
||||
#C10 = <self::E3<dynamic>*>[#C9]
|
||||
}
|
||||
|
||||
|
||||
Constructor coverage from constants:
|
||||
org-dartlang-testcase:///bounds_enums.dart:
|
||||
- E1. (from org-dartlang-testcase:///bounds_enums.dart:11:6)
|
||||
- _Enum. (from org-dartlang-sdk:///sdk/lib/core/enum.dart:103:9)
|
||||
- Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart:25:9)
|
||||
- E2. (from org-dartlang-testcase:///bounds_enums.dart:15:6)
|
||||
- E3. (from org-dartlang-testcase:///bounds_enums.dart:19:6)
|
||||
@@ -0,0 +1,63 @@
|
||||
library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_enums.dart:11:6: Error: Inferred type argument 'A<dynamic>' doesn't conform to the bound 'Y Function(Y)' of the type variable 'Y' on 'E1'.
|
||||
// Try specifying type arguments explicitly so that they conform to the bounds.
|
||||
// enum E1<Y extends A<Y>> /* Error */ {
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_enums.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// enum E1<Y extends A<Y>> /* Error */ {
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_enums.dart:11:6: Context: If you want 'E1<A<dynamic>>' to be a super-bounded type, note that the inverted type 'E1<A<Never>>' must then satisfy its bounds, which it does not.
|
||||
// - 'E1' is from 'pkg/front_end/testcases/general/bounds_enums.dart'.
|
||||
// enum E1<Y extends A<Y>> /* Error */ {
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
typedef A<invariant X extends core::Object? = dynamic> = (X%) → X%;
|
||||
class B<X extends core::Object? = dynamic> extends core::Object {
|
||||
synthetic constructor •() → self::B<self::B::X%>
|
||||
;
|
||||
}
|
||||
class E1<Y extends (self::E1::Y) → self::E1::Y = (dynamic) → dynamic> extends core::_Enum /*isEnum*/ {
|
||||
static const field core::List<self::E1<(dynamic) → dynamic>> values = const <self::E1<dynamic>>[self::E1::e1];
|
||||
static const field self::E1<Never> e1 = const self::E1::•<Never>(0, "e1");
|
||||
const constructor •(core::int index, core::String name) → self::E1<self::E1::Y>
|
||||
: super core::_Enum::•(index, name)
|
||||
;
|
||||
method toString() → core::String
|
||||
return "E1.${this.{core::_Enum::_name}{core::String}}";
|
||||
}
|
||||
class E2<Y extends self::B<self::E2::Y> = self::B<dynamic>> extends core::_Enum /*isEnum*/ {
|
||||
static const field core::List<self::E2<self::B<dynamic>>> values = const <self::E2<dynamic>>[self::E2::e2];
|
||||
static const field self::E2<Never> e2 = const self::E2::•<Never>(0, "e2");
|
||||
const constructor •(core::int index, core::String name) → self::E2<self::E2::Y>
|
||||
: super core::_Enum::•(index, name)
|
||||
;
|
||||
method toString() → core::String
|
||||
return "E2.${this.{core::_Enum::_name}{core::String}}";
|
||||
}
|
||||
class E3<Y extends self::E3<self::E3::Y> = self::E3<dynamic>> extends core::_Enum /*isEnum*/ {
|
||||
static const field core::List<self::E3<self::E3<dynamic>>> values = const <self::E3<dynamic>>[self::E3::e3];
|
||||
static const field self::E3<Never> e3 = const self::E3::•<Never>(0, "e3");
|
||||
const constructor •(core::int index, core::String name) → self::E3<self::E3::Y>
|
||||
: super core::_Enum::•(index, name)
|
||||
;
|
||||
method toString() → core::String
|
||||
return "E3.${this.{core::_Enum::_name}{core::String}}";
|
||||
}
|
||||
static method main() → dynamic
|
||||
;
|
||||
|
||||
|
||||
Extra constant evaluation status:
|
||||
Evaluated: ListLiteral @ org-dartlang-testcase:///bounds_enums.dart:11:6 -> ListConstant(const <E1<dynamic>*>[const E1<Never*>{_Enum.index: 0, _Enum._name: "e1"}])
|
||||
Evaluated: ConstructorInvocation @ org-dartlang-testcase:///bounds_enums.dart:12:3 -> InstanceConstant(const E1<Never*>{_Enum.index: 0, _Enum._name: "e1"})
|
||||
Evaluated: ListLiteral @ org-dartlang-testcase:///bounds_enums.dart:15:6 -> ListConstant(const <E2<dynamic>*>[const E2<Never*>{_Enum.index: 0, _Enum._name: "e2"}])
|
||||
Evaluated: ConstructorInvocation @ org-dartlang-testcase:///bounds_enums.dart:16:3 -> InstanceConstant(const E2<Never*>{_Enum.index: 0, _Enum._name: "e2"})
|
||||
Evaluated: ListLiteral @ org-dartlang-testcase:///bounds_enums.dart:19:6 -> ListConstant(const <E3<dynamic>*>[const E3<Never*>{_Enum.index: 0, _Enum._name: "e3"}])
|
||||
Evaluated: ConstructorInvocation @ org-dartlang-testcase:///bounds_enums.dart:20:3 -> InstanceConstant(const E3<Never*>{_Enum.index: 0, _Enum._name: "e3"})
|
||||
Extra constant evaluation: evaluated: 21, effectively constant: 6
|
||||
@@ -0,0 +1,75 @@
|
||||
library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_enums.dart:11:6: Error: Inferred type argument 'A<dynamic>' doesn't conform to the bound 'Y Function(Y)' of the type variable 'Y' on 'E1'.
|
||||
// Try specifying type arguments explicitly so that they conform to the bounds.
|
||||
// enum E1<Y extends A<Y>> /* Error */ {
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_enums.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// enum E1<Y extends A<Y>> /* Error */ {
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_enums.dart:11:6: Context: If you want 'E1<A<dynamic>>' to be a super-bounded type, note that the inverted type 'E1<A<Never>>' must then satisfy its bounds, which it does not.
|
||||
// - 'E1' is from 'pkg/front_end/testcases/general/bounds_enums.dart'.
|
||||
// enum E1<Y extends A<Y>> /* Error */ {
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
typedef A<invariant X extends core::Object? = dynamic> = (X%) → X%;
|
||||
class B<X extends core::Object? = dynamic> extends core::Object {
|
||||
synthetic constructor •() → self::B<self::B::X%>
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
class E1<Y extends (self::E1::Y) → self::E1::Y = (dynamic) → dynamic> extends core::_Enum /*isEnum*/ {
|
||||
static const field core::List<self::E1<(dynamic) → dynamic>> values = #C4;
|
||||
static const field self::E1<Never> e1 = #C3;
|
||||
const constructor •(core::int index, core::String name) → self::E1<self::E1::Y>
|
||||
: super core::_Enum::•(index, name)
|
||||
;
|
||||
method toString() → core::String
|
||||
return "E1.${this.{core::_Enum::_name}{core::String}}";
|
||||
}
|
||||
class E2<Y extends self::B<self::E2::Y> = self::B<dynamic>> extends core::_Enum /*isEnum*/ {
|
||||
static const field core::List<self::E2<self::B<dynamic>>> values = #C7;
|
||||
static const field self::E2<Never> e2 = #C6;
|
||||
const constructor •(core::int index, core::String name) → self::E2<self::E2::Y>
|
||||
: super core::_Enum::•(index, name)
|
||||
;
|
||||
method toString() → core::String
|
||||
return "E2.${this.{core::_Enum::_name}{core::String}}";
|
||||
}
|
||||
class E3<Y extends self::E3<self::E3::Y> = self::E3<dynamic>> extends core::_Enum /*isEnum*/ {
|
||||
static const field core::List<self::E3<self::E3<dynamic>>> values = #C10;
|
||||
static const field self::E3<Never> e3 = #C9;
|
||||
const constructor •(core::int index, core::String name) → self::E3<self::E3::Y>
|
||||
: super core::_Enum::•(index, name)
|
||||
;
|
||||
method toString() → core::String
|
||||
return "E3.${this.{core::_Enum::_name}{core::String}}";
|
||||
}
|
||||
static method main() → dynamic {}
|
||||
|
||||
constants {
|
||||
#C1 = 0
|
||||
#C2 = "e1"
|
||||
#C3 = self::E1<Never*> {index:#C1, _name:#C2}
|
||||
#C4 = <self::E1<dynamic>*>[#C3]
|
||||
#C5 = "e2"
|
||||
#C6 = self::E2<Never*> {index:#C1, _name:#C5}
|
||||
#C7 = <self::E2<dynamic>*>[#C6]
|
||||
#C8 = "e3"
|
||||
#C9 = self::E3<Never*> {index:#C1, _name:#C8}
|
||||
#C10 = <self::E3<dynamic>*>[#C9]
|
||||
}
|
||||
|
||||
|
||||
Constructor coverage from constants:
|
||||
org-dartlang-testcase:///bounds_enums.dart:
|
||||
- E1. (from org-dartlang-testcase:///bounds_enums.dart:11:6)
|
||||
- _Enum. (from org-dartlang-sdk:///sdk/lib/core/enum.dart:103:9)
|
||||
- Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart:25:9)
|
||||
- E2. (from org-dartlang-testcase:///bounds_enums.dart:15:6)
|
||||
- E3. (from org-dartlang-testcase:///bounds_enums.dart:19:6)
|
||||
@@ -0,0 +1,68 @@
|
||||
// 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.
|
||||
|
||||
class Class<T> {}
|
||||
|
||||
class ConcreteClass implements Class<ConcreteClass> {}
|
||||
|
||||
typedef F<X extends Class<X>> = X;
|
||||
|
||||
class G<X extends Class<X>> {}
|
||||
|
||||
F? field1a, field1b; // Ok
|
||||
F<dynamic>? field2a, field2b; // Ok
|
||||
F<Class>? field3a, field3b; // Ok
|
||||
F<Class<dynamic>>? field4a, field4b; // Ok
|
||||
F<ConcreteClass>? field5a, field5b; // Ok
|
||||
F<Class<ConcreteClass>>? field6a, field6b; // Ok
|
||||
F<Object>? field7a, field7b; // Error
|
||||
F<int>? field8a, field8b; // Error
|
||||
G? field1c, field1d; // Ok
|
||||
G<dynamic>? field2c, field2d; // Ok
|
||||
G<Class>? field3c, field3d; // Ok
|
||||
G<Class<dynamic>>? field4c, field4d; // Ok
|
||||
G<ConcreteClass>? field5c, field5d; // Ok
|
||||
G<Class<ConcreteClass>>? field6c, field6d; // Ok
|
||||
G<Object>? field7c, field8d; // Error
|
||||
G<int>? field8c, field7d; // Error
|
||||
|
||||
class Class1 {
|
||||
F? field1a, field1b; // Ok
|
||||
F<dynamic>? field2a, field2b; // Ok
|
||||
F<Class>? field3a, field3b; // Ok
|
||||
F<Class<dynamic>>? field4a, field4b; // Ok
|
||||
F<ConcreteClass>? field5a, field5b; // Ok
|
||||
F<Class<ConcreteClass>>? field6a, field6b; // Ok
|
||||
F<Object>? field7a, field7b; // Error
|
||||
F<int>? field8a, field8b; // Error
|
||||
G? field1c, field1d; // Ok
|
||||
G<dynamic>? field2c, field2d; // Ok
|
||||
G<Class>? field3c, field3d; // Ok
|
||||
G<Class<dynamic>>? field4c, field4d; // Ok
|
||||
G<ConcreteClass>? field5c, field5d; // Ok
|
||||
G<Class<ConcreteClass>>? field6c, field6d; // Ok
|
||||
G<Object>? field7c, field8d; // Error
|
||||
G<int>? field8c, field7d; // Error
|
||||
}
|
||||
|
||||
extension Extension1 on int {
|
||||
static F? field1a, field1b; // Ok
|
||||
static F<dynamic>? field2a, field2b; // Ok
|
||||
static F<Class>? field3a, field3b; // Ok
|
||||
static F<Class<dynamic>>? field4a, field4b; // Ok
|
||||
static F<ConcreteClass>? field5a, field5b; // Ok
|
||||
static F<Class<ConcreteClass>>? field6a, field6b; // Ok
|
||||
static F<Object>? field7a, field7b; // Error
|
||||
static F<int>? field8a, field8b; // Error
|
||||
static G? field1c, field1d; // Ok
|
||||
static G<dynamic>? field2c, field2d; // Ok
|
||||
static G<Class>? field3c, field3d; // Ok
|
||||
static G<Class<dynamic>>? field4c, field4d; // Ok
|
||||
static G<ConcreteClass>? field5c, field5d; // Ok
|
||||
static G<Class<ConcreteClass>>? field6c, field6d; // Ok
|
||||
static G<Object>? field7c, field8d; // Error
|
||||
static G<int>? field8c, field7d; // Error
|
||||
}
|
||||
|
||||
main() {}
|
||||
@@ -0,0 +1,64 @@
|
||||
class Class<T> {}
|
||||
|
||||
class ConcreteClass implements Class<ConcreteClass> {}
|
||||
|
||||
typedef F<X extends Class<X>> = X;
|
||||
|
||||
class G<X extends Class<X>> {}
|
||||
|
||||
F? field1a, field1b;
|
||||
F<dynamic>? field2a, field2b;
|
||||
F<Class>? field3a, field3b;
|
||||
F<Class<dynamic>>? field4a, field4b;
|
||||
F<ConcreteClass>? field5a, field5b;
|
||||
F<Class<ConcreteClass>>? field6a, field6b;
|
||||
F<Object>? field7a, field7b;
|
||||
F<int>? field8a, field8b;
|
||||
G? field1c, field1d;
|
||||
G<dynamic>? field2c, field2d;
|
||||
G<Class>? field3c, field3d;
|
||||
G<Class<dynamic>>? field4c, field4d;
|
||||
G<ConcreteClass>? field5c, field5d;
|
||||
G<Class<ConcreteClass>>? field6c, field6d;
|
||||
G<Object>? field7c, field8d;
|
||||
G<int>? field8c, field7d;
|
||||
|
||||
class Class1 {
|
||||
F? field1a, field1b;
|
||||
F<dynamic>? field2a, field2b;
|
||||
F<Class>? field3a, field3b;
|
||||
F<Class<dynamic>>? field4a, field4b;
|
||||
F<ConcreteClass>? field5a, field5b;
|
||||
F<Class<ConcreteClass>>? field6a, field6b;
|
||||
F<Object>? field7a, field7b;
|
||||
F<int>? field8a, field8b;
|
||||
G? field1c, field1d;
|
||||
G<dynamic>? field2c, field2d;
|
||||
G<Class>? field3c, field3d;
|
||||
G<Class<dynamic>>? field4c, field4d;
|
||||
G<ConcreteClass>? field5c, field5d;
|
||||
G<Class<ConcreteClass>>? field6c, field6d;
|
||||
G<Object>? field7c, field8d;
|
||||
G<int>? field8c, field7d;
|
||||
}
|
||||
|
||||
extension Extension1 on int {
|
||||
static F? field1a, field1b;
|
||||
static F<dynamic>? field2a, field2b;
|
||||
static F<Class>? field3a, field3b;
|
||||
static F<Class<dynamic>>? field4a, field4b;
|
||||
static F<ConcreteClass>? field5a, field5b;
|
||||
static F<Class<ConcreteClass>>? field6a, field6b;
|
||||
static F<Object>? field7a, field7b;
|
||||
static F<int>? field8a, field8b;
|
||||
static G? field1c, field1d;
|
||||
static G<dynamic>? field2c, field2d;
|
||||
static G<Class>? field3c, field3d;
|
||||
static G<Class<dynamic>>? field4c, field4d;
|
||||
static G<ConcreteClass>? field5c, field5d;
|
||||
static G<Class<ConcreteClass>>? field6c, field6d;
|
||||
static G<Object>? field7c, field8d;
|
||||
static G<int>? field8c, field7d;
|
||||
}
|
||||
|
||||
main() {}
|
||||
@@ -0,0 +1,63 @@
|
||||
F<Class<ConcreteClass>>? field6a, field6b;
|
||||
F<Class<dynamic>>? field4a, field4b;
|
||||
F<Class>? field3a, field3b;
|
||||
F<ConcreteClass>? field5a, field5b;
|
||||
F<Object>? field7a, field7b;
|
||||
F<dynamic>? field2a, field2b;
|
||||
F<int>? field8a, field8b;
|
||||
F? field1a, field1b;
|
||||
G<Class<ConcreteClass>>? field6c, field6d;
|
||||
G<Class<dynamic>>? field4c, field4d;
|
||||
G<Class>? field3c, field3d;
|
||||
G<ConcreteClass>? field5c, field5d;
|
||||
G<Object>? field7c, field8d;
|
||||
G<dynamic>? field2c, field2d;
|
||||
G<int>? field8c, field7d;
|
||||
G? field1c, field1d;
|
||||
|
||||
class Class<T> {}
|
||||
|
||||
class Class1 {
|
||||
F<Class<ConcreteClass>>? field6a, field6b;
|
||||
F<Class<dynamic>>? field4a, field4b;
|
||||
F<Class>? field3a, field3b;
|
||||
F<ConcreteClass>? field5a, field5b;
|
||||
F<Object>? field7a, field7b;
|
||||
F<dynamic>? field2a, field2b;
|
||||
F<int>? field8a, field8b;
|
||||
F? field1a, field1b;
|
||||
G<Class<ConcreteClass>>? field6c, field6d;
|
||||
G<Class<dynamic>>? field4c, field4d;
|
||||
G<Class>? field3c, field3d;
|
||||
G<ConcreteClass>? field5c, field5d;
|
||||
G<Object>? field7c, field8d;
|
||||
G<dynamic>? field2c, field2d;
|
||||
G<int>? field8c, field7d;
|
||||
G? field1c, field1d;
|
||||
}
|
||||
|
||||
class ConcreteClass implements Class<ConcreteClass> {}
|
||||
|
||||
class G<X extends Class<X>> {}
|
||||
|
||||
extension Extension1 on int {
|
||||
static F<Class<ConcreteClass>>? field6a, field6b;
|
||||
static F<Class<dynamic>>? field4a, field4b;
|
||||
static F<Class>? field3a, field3b;
|
||||
static F<ConcreteClass>? field5a, field5b;
|
||||
static F<Object>? field7a, field7b;
|
||||
static F<dynamic>? field2a, field2b;
|
||||
static F<int>? field8a, field8b;
|
||||
static F? field1a, field1b;
|
||||
static G<Class<ConcreteClass>>? field6c, field6d;
|
||||
static G<Class<dynamic>>? field4c, field4d;
|
||||
static G<Class>? field3c, field3d;
|
||||
static G<ConcreteClass>? field5c, field5d;
|
||||
static G<Object>? field7c, field8d;
|
||||
static G<dynamic>? field2c, field2d;
|
||||
static G<int>? field8c, field7d;
|
||||
static G? field1c, field1d;
|
||||
}
|
||||
|
||||
main() {}
|
||||
typedef F<X extends Class<X>> = X;
|
||||
@@ -0,0 +1,273 @@
|
||||
library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:19:1: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_fields.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// F<Object>? field7a, field7b; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = X;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:20:1: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_fields.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// F<int>? field8a, field8b; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = X;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:27:1: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_fields.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// G<Object>? field7c, field8d; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:28:1: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_fields.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// G<int>? field8c, field7d; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:37:3: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_fields.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// F<Object>? field7a, field7b; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = X;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:38:3: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_fields.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// F<int>? field8a, field8b; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = X;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:45:3: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_fields.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// G<Object>? field7c, field8d; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:46:3: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_fields.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// G<int>? field8c, field7d; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:56:10: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_fields.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// static F<Object>? field7a, field7b; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = X;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:57:10: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_fields.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// static F<int>? field8a, field8b; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = X;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:64:10: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_fields.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// static G<Object>? field7c, field8d; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:65:10: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_fields.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// static G<int>? field8c, field7d; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
typedef F<X extends self::Class<X> = self::Class<dynamic>> = X;
|
||||
class Class<T extends core::Object? = dynamic> extends core::Object {
|
||||
synthetic constructor •() → self::Class<self::Class::T%>
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
class ConcreteClass extends core::Object implements self::Class<self::ConcreteClass> {
|
||||
synthetic constructor •() → self::ConcreteClass
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
class G<X extends self::Class<self::G::X> = self::Class<dynamic>> extends core::Object {
|
||||
synthetic constructor •() → self::G<self::G::X>
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
class Class1 extends core::Object {
|
||||
field self::Class<dynamic>? field1a = null;
|
||||
field self::Class<dynamic>? field1b = null;
|
||||
field dynamic field2a = null;
|
||||
field dynamic field2b = null;
|
||||
field self::Class<dynamic>? field3a = null;
|
||||
field self::Class<dynamic>? field3b = null;
|
||||
field self::Class<dynamic>? field4a = null;
|
||||
field self::Class<dynamic>? field4b = null;
|
||||
field self::ConcreteClass? field5a = null;
|
||||
field self::ConcreteClass? field5b = null;
|
||||
field self::Class<self::ConcreteClass>? field6a = null;
|
||||
field self::Class<self::ConcreteClass>? field6b = null;
|
||||
field core::Object? field7a = null;
|
||||
field core::Object? field7b = null;
|
||||
field core::int? field8a = null;
|
||||
field core::int? field8b = null;
|
||||
field self::G<self::Class<dynamic>>? field1c = null;
|
||||
field self::G<self::Class<dynamic>>? field1d = null;
|
||||
field self::G<dynamic>? field2c = null;
|
||||
field self::G<dynamic>? field2d = null;
|
||||
field self::G<self::Class<dynamic>>? field3c = null;
|
||||
field self::G<self::Class<dynamic>>? field3d = null;
|
||||
field self::G<self::Class<dynamic>>? field4c = null;
|
||||
field self::G<self::Class<dynamic>>? field4d = null;
|
||||
field self::G<self::ConcreteClass>? field5c = null;
|
||||
field self::G<self::ConcreteClass>? field5d = null;
|
||||
field self::G<self::Class<self::ConcreteClass>>? field6c = null;
|
||||
field self::G<self::Class<self::ConcreteClass>>? field6d = null;
|
||||
field self::G<core::Object>? field7c = null;
|
||||
field self::G<core::Object>? field8d = null;
|
||||
field self::G<core::int>? field8c = null;
|
||||
field self::G<core::int>? field7d = null;
|
||||
synthetic constructor •() → self::Class1
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
extension Extension1 on core::int {
|
||||
static field field1a = self::Extension1|field1a;
|
||||
static field field1b = self::Extension1|field1b;
|
||||
static field field2a = self::Extension1|field2a;
|
||||
static field field2b = self::Extension1|field2b;
|
||||
static field field3a = self::Extension1|field3a;
|
||||
static field field3b = self::Extension1|field3b;
|
||||
static field field4a = self::Extension1|field4a;
|
||||
static field field4b = self::Extension1|field4b;
|
||||
static field field5a = self::Extension1|field5a;
|
||||
static field field5b = self::Extension1|field5b;
|
||||
static field field6a = self::Extension1|field6a;
|
||||
static field field6b = self::Extension1|field6b;
|
||||
static field field7a = self::Extension1|field7a;
|
||||
static field field7b = self::Extension1|field7b;
|
||||
static field field8a = self::Extension1|field8a;
|
||||
static field field8b = self::Extension1|field8b;
|
||||
static field field1c = self::Extension1|field1c;
|
||||
static field field1d = self::Extension1|field1d;
|
||||
static field field2c = self::Extension1|field2c;
|
||||
static field field2d = self::Extension1|field2d;
|
||||
static field field3c = self::Extension1|field3c;
|
||||
static field field3d = self::Extension1|field3d;
|
||||
static field field4c = self::Extension1|field4c;
|
||||
static field field4d = self::Extension1|field4d;
|
||||
static field field5c = self::Extension1|field5c;
|
||||
static field field5d = self::Extension1|field5d;
|
||||
static field field6c = self::Extension1|field6c;
|
||||
static field field6d = self::Extension1|field6d;
|
||||
static field field7c = self::Extension1|field7c;
|
||||
static field field8d = self::Extension1|field8d;
|
||||
static field field8c = self::Extension1|field8c;
|
||||
static field field7d = self::Extension1|field7d;
|
||||
}
|
||||
static field self::Class<dynamic>? field1a;
|
||||
static field self::Class<dynamic>? field1b;
|
||||
static field dynamic field2a;
|
||||
static field dynamic field2b;
|
||||
static field self::Class<dynamic>? field3a;
|
||||
static field self::Class<dynamic>? field3b;
|
||||
static field self::Class<dynamic>? field4a;
|
||||
static field self::Class<dynamic>? field4b;
|
||||
static field self::ConcreteClass? field5a;
|
||||
static field self::ConcreteClass? field5b;
|
||||
static field self::Class<self::ConcreteClass>? field6a;
|
||||
static field self::Class<self::ConcreteClass>? field6b;
|
||||
static field core::Object? field7a;
|
||||
static field core::Object? field7b;
|
||||
static field core::int? field8a;
|
||||
static field core::int? field8b;
|
||||
static field self::G<self::Class<dynamic>>? field1c;
|
||||
static field self::G<self::Class<dynamic>>? field1d;
|
||||
static field self::G<dynamic>? field2c;
|
||||
static field self::G<dynamic>? field2d;
|
||||
static field self::G<self::Class<dynamic>>? field3c;
|
||||
static field self::G<self::Class<dynamic>>? field3d;
|
||||
static field self::G<self::Class<dynamic>>? field4c;
|
||||
static field self::G<self::Class<dynamic>>? field4d;
|
||||
static field self::G<self::ConcreteClass>? field5c;
|
||||
static field self::G<self::ConcreteClass>? field5d;
|
||||
static field self::G<self::Class<self::ConcreteClass>>? field6c;
|
||||
static field self::G<self::Class<self::ConcreteClass>>? field6d;
|
||||
static field self::G<core::Object>? field7c;
|
||||
static field self::G<core::Object>? field8d;
|
||||
static field self::G<core::int>? field8c;
|
||||
static field self::G<core::int>? field7d;
|
||||
static field self::Class<dynamic>? Extension1|field1a;
|
||||
static field self::Class<dynamic>? Extension1|field1b;
|
||||
static field dynamic Extension1|field2a;
|
||||
static field dynamic Extension1|field2b;
|
||||
static field self::Class<dynamic>? Extension1|field3a;
|
||||
static field self::Class<dynamic>? Extension1|field3b;
|
||||
static field self::Class<dynamic>? Extension1|field4a;
|
||||
static field self::Class<dynamic>? Extension1|field4b;
|
||||
static field self::ConcreteClass? Extension1|field5a;
|
||||
static field self::ConcreteClass? Extension1|field5b;
|
||||
static field self::Class<self::ConcreteClass>? Extension1|field6a;
|
||||
static field self::Class<self::ConcreteClass>? Extension1|field6b;
|
||||
static field core::Object? Extension1|field7a;
|
||||
static field core::Object? Extension1|field7b;
|
||||
static field core::int? Extension1|field8a;
|
||||
static field core::int? Extension1|field8b;
|
||||
static field self::G<self::Class<dynamic>>? Extension1|field1c;
|
||||
static field self::G<self::Class<dynamic>>? Extension1|field1d;
|
||||
static field self::G<dynamic>? Extension1|field2c;
|
||||
static field self::G<dynamic>? Extension1|field2d;
|
||||
static field self::G<self::Class<dynamic>>? Extension1|field3c;
|
||||
static field self::G<self::Class<dynamic>>? Extension1|field3d;
|
||||
static field self::G<self::Class<dynamic>>? Extension1|field4c;
|
||||
static field self::G<self::Class<dynamic>>? Extension1|field4d;
|
||||
static field self::G<self::ConcreteClass>? Extension1|field5c;
|
||||
static field self::G<self::ConcreteClass>? Extension1|field5d;
|
||||
static field self::G<self::Class<self::ConcreteClass>>? Extension1|field6c;
|
||||
static field self::G<self::Class<self::ConcreteClass>>? Extension1|field6d;
|
||||
static field self::G<core::Object>? Extension1|field7c;
|
||||
static field self::G<core::Object>? Extension1|field8d;
|
||||
static field self::G<core::int>? Extension1|field8c;
|
||||
static field self::G<core::int>? Extension1|field7d;
|
||||
static method main() → dynamic {}
|
||||
@@ -0,0 +1,273 @@
|
||||
library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:19:1: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_fields.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// F<Object>? field7a, field7b; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = X;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:20:1: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_fields.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// F<int>? field8a, field8b; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = X;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:27:1: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_fields.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// G<Object>? field7c, field8d; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:28:1: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_fields.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// G<int>? field8c, field7d; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:37:3: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_fields.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// F<Object>? field7a, field7b; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = X;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:38:3: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_fields.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// F<int>? field8a, field8b; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = X;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:45:3: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_fields.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// G<Object>? field7c, field8d; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:46:3: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_fields.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// G<int>? field8c, field7d; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:56:10: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_fields.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// static F<Object>? field7a, field7b; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = X;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:57:10: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_fields.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// static F<int>? field8a, field8b; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = X;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:64:10: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_fields.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// static G<Object>? field7c, field8d; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:65:10: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_fields.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// static G<int>? field8c, field7d; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
typedef F<X extends self::Class<X> = self::Class<dynamic>> = X;
|
||||
class Class<T extends core::Object? = dynamic> extends core::Object {
|
||||
synthetic constructor •() → self::Class<self::Class::T%>
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
class ConcreteClass extends core::Object implements self::Class<self::ConcreteClass> {
|
||||
synthetic constructor •() → self::ConcreteClass
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
class G<X extends self::Class<self::G::X> = self::Class<dynamic>> extends core::Object {
|
||||
synthetic constructor •() → self::G<self::G::X>
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
class Class1 extends core::Object {
|
||||
field self::Class<dynamic>? field1a = null;
|
||||
field self::Class<dynamic>? field1b = null;
|
||||
field dynamic field2a = null;
|
||||
field dynamic field2b = null;
|
||||
field self::Class<dynamic>? field3a = null;
|
||||
field self::Class<dynamic>? field3b = null;
|
||||
field self::Class<dynamic>? field4a = null;
|
||||
field self::Class<dynamic>? field4b = null;
|
||||
field self::ConcreteClass? field5a = null;
|
||||
field self::ConcreteClass? field5b = null;
|
||||
field self::Class<self::ConcreteClass>? field6a = null;
|
||||
field self::Class<self::ConcreteClass>? field6b = null;
|
||||
field core::Object? field7a = null;
|
||||
field core::Object? field7b = null;
|
||||
field core::int? field8a = null;
|
||||
field core::int? field8b = null;
|
||||
field self::G<self::Class<dynamic>>? field1c = null;
|
||||
field self::G<self::Class<dynamic>>? field1d = null;
|
||||
field self::G<dynamic>? field2c = null;
|
||||
field self::G<dynamic>? field2d = null;
|
||||
field self::G<self::Class<dynamic>>? field3c = null;
|
||||
field self::G<self::Class<dynamic>>? field3d = null;
|
||||
field self::G<self::Class<dynamic>>? field4c = null;
|
||||
field self::G<self::Class<dynamic>>? field4d = null;
|
||||
field self::G<self::ConcreteClass>? field5c = null;
|
||||
field self::G<self::ConcreteClass>? field5d = null;
|
||||
field self::G<self::Class<self::ConcreteClass>>? field6c = null;
|
||||
field self::G<self::Class<self::ConcreteClass>>? field6d = null;
|
||||
field self::G<core::Object>? field7c = null;
|
||||
field self::G<core::Object>? field8d = null;
|
||||
field self::G<core::int>? field8c = null;
|
||||
field self::G<core::int>? field7d = null;
|
||||
synthetic constructor •() → self::Class1
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
extension Extension1 on core::int {
|
||||
static field field1a = self::Extension1|field1a;
|
||||
static field field1b = self::Extension1|field1b;
|
||||
static field field2a = self::Extension1|field2a;
|
||||
static field field2b = self::Extension1|field2b;
|
||||
static field field3a = self::Extension1|field3a;
|
||||
static field field3b = self::Extension1|field3b;
|
||||
static field field4a = self::Extension1|field4a;
|
||||
static field field4b = self::Extension1|field4b;
|
||||
static field field5a = self::Extension1|field5a;
|
||||
static field field5b = self::Extension1|field5b;
|
||||
static field field6a = self::Extension1|field6a;
|
||||
static field field6b = self::Extension1|field6b;
|
||||
static field field7a = self::Extension1|field7a;
|
||||
static field field7b = self::Extension1|field7b;
|
||||
static field field8a = self::Extension1|field8a;
|
||||
static field field8b = self::Extension1|field8b;
|
||||
static field field1c = self::Extension1|field1c;
|
||||
static field field1d = self::Extension1|field1d;
|
||||
static field field2c = self::Extension1|field2c;
|
||||
static field field2d = self::Extension1|field2d;
|
||||
static field field3c = self::Extension1|field3c;
|
||||
static field field3d = self::Extension1|field3d;
|
||||
static field field4c = self::Extension1|field4c;
|
||||
static field field4d = self::Extension1|field4d;
|
||||
static field field5c = self::Extension1|field5c;
|
||||
static field field5d = self::Extension1|field5d;
|
||||
static field field6c = self::Extension1|field6c;
|
||||
static field field6d = self::Extension1|field6d;
|
||||
static field field7c = self::Extension1|field7c;
|
||||
static field field8d = self::Extension1|field8d;
|
||||
static field field8c = self::Extension1|field8c;
|
||||
static field field7d = self::Extension1|field7d;
|
||||
}
|
||||
static field self::Class<dynamic>? field1a;
|
||||
static field self::Class<dynamic>? field1b;
|
||||
static field dynamic field2a;
|
||||
static field dynamic field2b;
|
||||
static field self::Class<dynamic>? field3a;
|
||||
static field self::Class<dynamic>? field3b;
|
||||
static field self::Class<dynamic>? field4a;
|
||||
static field self::Class<dynamic>? field4b;
|
||||
static field self::ConcreteClass? field5a;
|
||||
static field self::ConcreteClass? field5b;
|
||||
static field self::Class<self::ConcreteClass>? field6a;
|
||||
static field self::Class<self::ConcreteClass>? field6b;
|
||||
static field core::Object? field7a;
|
||||
static field core::Object? field7b;
|
||||
static field core::int? field8a;
|
||||
static field core::int? field8b;
|
||||
static field self::G<self::Class<dynamic>>? field1c;
|
||||
static field self::G<self::Class<dynamic>>? field1d;
|
||||
static field self::G<dynamic>? field2c;
|
||||
static field self::G<dynamic>? field2d;
|
||||
static field self::G<self::Class<dynamic>>? field3c;
|
||||
static field self::G<self::Class<dynamic>>? field3d;
|
||||
static field self::G<self::Class<dynamic>>? field4c;
|
||||
static field self::G<self::Class<dynamic>>? field4d;
|
||||
static field self::G<self::ConcreteClass>? field5c;
|
||||
static field self::G<self::ConcreteClass>? field5d;
|
||||
static field self::G<self::Class<self::ConcreteClass>>? field6c;
|
||||
static field self::G<self::Class<self::ConcreteClass>>? field6d;
|
||||
static field self::G<core::Object>? field7c;
|
||||
static field self::G<core::Object>? field8d;
|
||||
static field self::G<core::int>? field8c;
|
||||
static field self::G<core::int>? field7d;
|
||||
static field self::Class<dynamic>? Extension1|field1a;
|
||||
static field self::Class<dynamic>? Extension1|field1b;
|
||||
static field dynamic Extension1|field2a;
|
||||
static field dynamic Extension1|field2b;
|
||||
static field self::Class<dynamic>? Extension1|field3a;
|
||||
static field self::Class<dynamic>? Extension1|field3b;
|
||||
static field self::Class<dynamic>? Extension1|field4a;
|
||||
static field self::Class<dynamic>? Extension1|field4b;
|
||||
static field self::ConcreteClass? Extension1|field5a;
|
||||
static field self::ConcreteClass? Extension1|field5b;
|
||||
static field self::Class<self::ConcreteClass>? Extension1|field6a;
|
||||
static field self::Class<self::ConcreteClass>? Extension1|field6b;
|
||||
static field core::Object? Extension1|field7a;
|
||||
static field core::Object? Extension1|field7b;
|
||||
static field core::int? Extension1|field8a;
|
||||
static field core::int? Extension1|field8b;
|
||||
static field self::G<self::Class<dynamic>>? Extension1|field1c;
|
||||
static field self::G<self::Class<dynamic>>? Extension1|field1d;
|
||||
static field self::G<dynamic>? Extension1|field2c;
|
||||
static field self::G<dynamic>? Extension1|field2d;
|
||||
static field self::G<self::Class<dynamic>>? Extension1|field3c;
|
||||
static field self::G<self::Class<dynamic>>? Extension1|field3d;
|
||||
static field self::G<self::Class<dynamic>>? Extension1|field4c;
|
||||
static field self::G<self::Class<dynamic>>? Extension1|field4d;
|
||||
static field self::G<self::ConcreteClass>? Extension1|field5c;
|
||||
static field self::G<self::ConcreteClass>? Extension1|field5d;
|
||||
static field self::G<self::Class<self::ConcreteClass>>? Extension1|field6c;
|
||||
static field self::G<self::Class<self::ConcreteClass>>? Extension1|field6d;
|
||||
static field self::G<core::Object>? Extension1|field7c;
|
||||
static field self::G<core::Object>? Extension1|field8d;
|
||||
static field self::G<core::int>? Extension1|field8c;
|
||||
static field self::G<core::int>? Extension1|field7d;
|
||||
static method main() → dynamic {}
|
||||
@@ -0,0 +1,270 @@
|
||||
library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:19:1: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_fields.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// F<Object>? field7a, field7b; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = X;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:20:1: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_fields.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// F<int>? field8a, field8b; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = X;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:27:1: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_fields.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// G<Object>? field7c, field8d; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:28:1: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_fields.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// G<int>? field8c, field7d; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:37:3: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_fields.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// F<Object>? field7a, field7b; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = X;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:38:3: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_fields.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// F<int>? field8a, field8b; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = X;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:45:3: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_fields.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// G<Object>? field7c, field8d; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:46:3: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_fields.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// G<int>? field8c, field7d; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:56:10: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_fields.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// static F<Object>? field7a, field7b; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = X;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:57:10: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_fields.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// static F<int>? field8a, field8b; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = X;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:64:10: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_fields.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// static G<Object>? field7c, field8d; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:65:10: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_fields.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// static G<int>? field8c, field7d; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
typedef F<X extends self::Class<X> = self::Class<dynamic>> = X;
|
||||
class Class<T extends core::Object? = dynamic> extends core::Object {
|
||||
synthetic constructor •() → self::Class<self::Class::T%>
|
||||
;
|
||||
}
|
||||
class ConcreteClass extends core::Object implements self::Class<self::ConcreteClass> {
|
||||
synthetic constructor •() → self::ConcreteClass
|
||||
;
|
||||
}
|
||||
class G<X extends self::Class<self::G::X> = self::Class<dynamic>> extends core::Object {
|
||||
synthetic constructor •() → self::G<self::G::X>
|
||||
;
|
||||
}
|
||||
class Class1 extends core::Object {
|
||||
field self::Class<dynamic>? field1a;
|
||||
field self::Class<dynamic>? field1b;
|
||||
field dynamic field2a;
|
||||
field dynamic field2b;
|
||||
field self::Class<dynamic>? field3a;
|
||||
field self::Class<dynamic>? field3b;
|
||||
field self::Class<dynamic>? field4a;
|
||||
field self::Class<dynamic>? field4b;
|
||||
field self::ConcreteClass? field5a;
|
||||
field self::ConcreteClass? field5b;
|
||||
field self::Class<self::ConcreteClass>? field6a;
|
||||
field self::Class<self::ConcreteClass>? field6b;
|
||||
field core::Object? field7a;
|
||||
field core::Object? field7b;
|
||||
field core::int? field8a;
|
||||
field core::int? field8b;
|
||||
field self::G<self::Class<dynamic>>? field1c;
|
||||
field self::G<self::Class<dynamic>>? field1d;
|
||||
field self::G<dynamic>? field2c;
|
||||
field self::G<dynamic>? field2d;
|
||||
field self::G<self::Class<dynamic>>? field3c;
|
||||
field self::G<self::Class<dynamic>>? field3d;
|
||||
field self::G<self::Class<dynamic>>? field4c;
|
||||
field self::G<self::Class<dynamic>>? field4d;
|
||||
field self::G<self::ConcreteClass>? field5c;
|
||||
field self::G<self::ConcreteClass>? field5d;
|
||||
field self::G<self::Class<self::ConcreteClass>>? field6c;
|
||||
field self::G<self::Class<self::ConcreteClass>>? field6d;
|
||||
field self::G<core::Object>? field7c;
|
||||
field self::G<core::Object>? field8d;
|
||||
field self::G<core::int>? field8c;
|
||||
field self::G<core::int>? field7d;
|
||||
synthetic constructor •() → self::Class1
|
||||
;
|
||||
}
|
||||
extension Extension1 on core::int {
|
||||
static field field1a = self::Extension1|field1a;
|
||||
static field field1b = self::Extension1|field1b;
|
||||
static field field2a = self::Extension1|field2a;
|
||||
static field field2b = self::Extension1|field2b;
|
||||
static field field3a = self::Extension1|field3a;
|
||||
static field field3b = self::Extension1|field3b;
|
||||
static field field4a = self::Extension1|field4a;
|
||||
static field field4b = self::Extension1|field4b;
|
||||
static field field5a = self::Extension1|field5a;
|
||||
static field field5b = self::Extension1|field5b;
|
||||
static field field6a = self::Extension1|field6a;
|
||||
static field field6b = self::Extension1|field6b;
|
||||
static field field7a = self::Extension1|field7a;
|
||||
static field field7b = self::Extension1|field7b;
|
||||
static field field8a = self::Extension1|field8a;
|
||||
static field field8b = self::Extension1|field8b;
|
||||
static field field1c = self::Extension1|field1c;
|
||||
static field field1d = self::Extension1|field1d;
|
||||
static field field2c = self::Extension1|field2c;
|
||||
static field field2d = self::Extension1|field2d;
|
||||
static field field3c = self::Extension1|field3c;
|
||||
static field field3d = self::Extension1|field3d;
|
||||
static field field4c = self::Extension1|field4c;
|
||||
static field field4d = self::Extension1|field4d;
|
||||
static field field5c = self::Extension1|field5c;
|
||||
static field field5d = self::Extension1|field5d;
|
||||
static field field6c = self::Extension1|field6c;
|
||||
static field field6d = self::Extension1|field6d;
|
||||
static field field7c = self::Extension1|field7c;
|
||||
static field field8d = self::Extension1|field8d;
|
||||
static field field8c = self::Extension1|field8c;
|
||||
static field field7d = self::Extension1|field7d;
|
||||
}
|
||||
static field self::Class<dynamic>? field1a;
|
||||
static field self::Class<dynamic>? field1b;
|
||||
static field dynamic field2a;
|
||||
static field dynamic field2b;
|
||||
static field self::Class<dynamic>? field3a;
|
||||
static field self::Class<dynamic>? field3b;
|
||||
static field self::Class<dynamic>? field4a;
|
||||
static field self::Class<dynamic>? field4b;
|
||||
static field self::ConcreteClass? field5a;
|
||||
static field self::ConcreteClass? field5b;
|
||||
static field self::Class<self::ConcreteClass>? field6a;
|
||||
static field self::Class<self::ConcreteClass>? field6b;
|
||||
static field core::Object? field7a;
|
||||
static field core::Object? field7b;
|
||||
static field core::int? field8a;
|
||||
static field core::int? field8b;
|
||||
static field self::G<self::Class<dynamic>>? field1c;
|
||||
static field self::G<self::Class<dynamic>>? field1d;
|
||||
static field self::G<dynamic>? field2c;
|
||||
static field self::G<dynamic>? field2d;
|
||||
static field self::G<self::Class<dynamic>>? field3c;
|
||||
static field self::G<self::Class<dynamic>>? field3d;
|
||||
static field self::G<self::Class<dynamic>>? field4c;
|
||||
static field self::G<self::Class<dynamic>>? field4d;
|
||||
static field self::G<self::ConcreteClass>? field5c;
|
||||
static field self::G<self::ConcreteClass>? field5d;
|
||||
static field self::G<self::Class<self::ConcreteClass>>? field6c;
|
||||
static field self::G<self::Class<self::ConcreteClass>>? field6d;
|
||||
static field self::G<core::Object>? field7c;
|
||||
static field self::G<core::Object>? field8d;
|
||||
static field self::G<core::int>? field8c;
|
||||
static field self::G<core::int>? field7d;
|
||||
static field self::Class<dynamic>? Extension1|field1a;
|
||||
static field self::Class<dynamic>? Extension1|field1b;
|
||||
static field dynamic Extension1|field2a;
|
||||
static field dynamic Extension1|field2b;
|
||||
static field self::Class<dynamic>? Extension1|field3a;
|
||||
static field self::Class<dynamic>? Extension1|field3b;
|
||||
static field self::Class<dynamic>? Extension1|field4a;
|
||||
static field self::Class<dynamic>? Extension1|field4b;
|
||||
static field self::ConcreteClass? Extension1|field5a;
|
||||
static field self::ConcreteClass? Extension1|field5b;
|
||||
static field self::Class<self::ConcreteClass>? Extension1|field6a;
|
||||
static field self::Class<self::ConcreteClass>? Extension1|field6b;
|
||||
static field core::Object? Extension1|field7a;
|
||||
static field core::Object? Extension1|field7b;
|
||||
static field core::int? Extension1|field8a;
|
||||
static field core::int? Extension1|field8b;
|
||||
static field self::G<self::Class<dynamic>>? Extension1|field1c;
|
||||
static field self::G<self::Class<dynamic>>? Extension1|field1d;
|
||||
static field self::G<dynamic>? Extension1|field2c;
|
||||
static field self::G<dynamic>? Extension1|field2d;
|
||||
static field self::G<self::Class<dynamic>>? Extension1|field3c;
|
||||
static field self::G<self::Class<dynamic>>? Extension1|field3d;
|
||||
static field self::G<self::Class<dynamic>>? Extension1|field4c;
|
||||
static field self::G<self::Class<dynamic>>? Extension1|field4d;
|
||||
static field self::G<self::ConcreteClass>? Extension1|field5c;
|
||||
static field self::G<self::ConcreteClass>? Extension1|field5d;
|
||||
static field self::G<self::Class<self::ConcreteClass>>? Extension1|field6c;
|
||||
static field self::G<self::Class<self::ConcreteClass>>? Extension1|field6d;
|
||||
static field self::G<core::Object>? Extension1|field7c;
|
||||
static field self::G<core::Object>? Extension1|field8d;
|
||||
static field self::G<core::int>? Extension1|field8c;
|
||||
static field self::G<core::int>? Extension1|field7d;
|
||||
static method main() → dynamic
|
||||
;
|
||||
@@ -0,0 +1,273 @@
|
||||
library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:19:1: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_fields.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// F<Object>? field7a, field7b; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = X;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:20:1: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_fields.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// F<int>? field8a, field8b; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = X;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:27:1: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_fields.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// G<Object>? field7c, field8d; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:28:1: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_fields.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// G<int>? field8c, field7d; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:37:3: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_fields.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// F<Object>? field7a, field7b; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = X;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:38:3: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_fields.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// F<int>? field8a, field8b; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = X;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:45:3: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_fields.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// G<Object>? field7c, field8d; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:46:3: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_fields.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// G<int>? field8c, field7d; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:56:10: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_fields.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// static F<Object>? field7a, field7b; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = X;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:57:10: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_fields.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// static F<int>? field8a, field8b; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = X;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:64:10: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_fields.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// static G<Object>? field7c, field8d; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:65:10: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_fields.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// static G<int>? field8c, field7d; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_fields.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
typedef F<X extends self::Class<X> = self::Class<dynamic>> = X;
|
||||
class Class<T extends core::Object? = dynamic> extends core::Object {
|
||||
synthetic constructor •() → self::Class<self::Class::T%>
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
class ConcreteClass extends core::Object implements self::Class<self::ConcreteClass> {
|
||||
synthetic constructor •() → self::ConcreteClass
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
class G<X extends self::Class<self::G::X> = self::Class<dynamic>> extends core::Object {
|
||||
synthetic constructor •() → self::G<self::G::X>
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
class Class1 extends core::Object {
|
||||
field self::Class<dynamic>? field1a = null;
|
||||
field self::Class<dynamic>? field1b = null;
|
||||
field dynamic field2a = null;
|
||||
field dynamic field2b = null;
|
||||
field self::Class<dynamic>? field3a = null;
|
||||
field self::Class<dynamic>? field3b = null;
|
||||
field self::Class<dynamic>? field4a = null;
|
||||
field self::Class<dynamic>? field4b = null;
|
||||
field self::ConcreteClass? field5a = null;
|
||||
field self::ConcreteClass? field5b = null;
|
||||
field self::Class<self::ConcreteClass>? field6a = null;
|
||||
field self::Class<self::ConcreteClass>? field6b = null;
|
||||
field core::Object? field7a = null;
|
||||
field core::Object? field7b = null;
|
||||
field core::int? field8a = null;
|
||||
field core::int? field8b = null;
|
||||
field self::G<self::Class<dynamic>>? field1c = null;
|
||||
field self::G<self::Class<dynamic>>? field1d = null;
|
||||
field self::G<dynamic>? field2c = null;
|
||||
field self::G<dynamic>? field2d = null;
|
||||
field self::G<self::Class<dynamic>>? field3c = null;
|
||||
field self::G<self::Class<dynamic>>? field3d = null;
|
||||
field self::G<self::Class<dynamic>>? field4c = null;
|
||||
field self::G<self::Class<dynamic>>? field4d = null;
|
||||
field self::G<self::ConcreteClass>? field5c = null;
|
||||
field self::G<self::ConcreteClass>? field5d = null;
|
||||
field self::G<self::Class<self::ConcreteClass>>? field6c = null;
|
||||
field self::G<self::Class<self::ConcreteClass>>? field6d = null;
|
||||
field self::G<core::Object>? field7c = null;
|
||||
field self::G<core::Object>? field8d = null;
|
||||
field self::G<core::int>? field8c = null;
|
||||
field self::G<core::int>? field7d = null;
|
||||
synthetic constructor •() → self::Class1
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
extension Extension1 on core::int {
|
||||
static field field1a = self::Extension1|field1a;
|
||||
static field field1b = self::Extension1|field1b;
|
||||
static field field2a = self::Extension1|field2a;
|
||||
static field field2b = self::Extension1|field2b;
|
||||
static field field3a = self::Extension1|field3a;
|
||||
static field field3b = self::Extension1|field3b;
|
||||
static field field4a = self::Extension1|field4a;
|
||||
static field field4b = self::Extension1|field4b;
|
||||
static field field5a = self::Extension1|field5a;
|
||||
static field field5b = self::Extension1|field5b;
|
||||
static field field6a = self::Extension1|field6a;
|
||||
static field field6b = self::Extension1|field6b;
|
||||
static field field7a = self::Extension1|field7a;
|
||||
static field field7b = self::Extension1|field7b;
|
||||
static field field8a = self::Extension1|field8a;
|
||||
static field field8b = self::Extension1|field8b;
|
||||
static field field1c = self::Extension1|field1c;
|
||||
static field field1d = self::Extension1|field1d;
|
||||
static field field2c = self::Extension1|field2c;
|
||||
static field field2d = self::Extension1|field2d;
|
||||
static field field3c = self::Extension1|field3c;
|
||||
static field field3d = self::Extension1|field3d;
|
||||
static field field4c = self::Extension1|field4c;
|
||||
static field field4d = self::Extension1|field4d;
|
||||
static field field5c = self::Extension1|field5c;
|
||||
static field field5d = self::Extension1|field5d;
|
||||
static field field6c = self::Extension1|field6c;
|
||||
static field field6d = self::Extension1|field6d;
|
||||
static field field7c = self::Extension1|field7c;
|
||||
static field field8d = self::Extension1|field8d;
|
||||
static field field8c = self::Extension1|field8c;
|
||||
static field field7d = self::Extension1|field7d;
|
||||
}
|
||||
static field self::Class<dynamic>? field1a;
|
||||
static field self::Class<dynamic>? field1b;
|
||||
static field dynamic field2a;
|
||||
static field dynamic field2b;
|
||||
static field self::Class<dynamic>? field3a;
|
||||
static field self::Class<dynamic>? field3b;
|
||||
static field self::Class<dynamic>? field4a;
|
||||
static field self::Class<dynamic>? field4b;
|
||||
static field self::ConcreteClass? field5a;
|
||||
static field self::ConcreteClass? field5b;
|
||||
static field self::Class<self::ConcreteClass>? field6a;
|
||||
static field self::Class<self::ConcreteClass>? field6b;
|
||||
static field core::Object? field7a;
|
||||
static field core::Object? field7b;
|
||||
static field core::int? field8a;
|
||||
static field core::int? field8b;
|
||||
static field self::G<self::Class<dynamic>>? field1c;
|
||||
static field self::G<self::Class<dynamic>>? field1d;
|
||||
static field self::G<dynamic>? field2c;
|
||||
static field self::G<dynamic>? field2d;
|
||||
static field self::G<self::Class<dynamic>>? field3c;
|
||||
static field self::G<self::Class<dynamic>>? field3d;
|
||||
static field self::G<self::Class<dynamic>>? field4c;
|
||||
static field self::G<self::Class<dynamic>>? field4d;
|
||||
static field self::G<self::ConcreteClass>? field5c;
|
||||
static field self::G<self::ConcreteClass>? field5d;
|
||||
static field self::G<self::Class<self::ConcreteClass>>? field6c;
|
||||
static field self::G<self::Class<self::ConcreteClass>>? field6d;
|
||||
static field self::G<core::Object>? field7c;
|
||||
static field self::G<core::Object>? field8d;
|
||||
static field self::G<core::int>? field8c;
|
||||
static field self::G<core::int>? field7d;
|
||||
static field self::Class<dynamic>? Extension1|field1a;
|
||||
static field self::Class<dynamic>? Extension1|field1b;
|
||||
static field dynamic Extension1|field2a;
|
||||
static field dynamic Extension1|field2b;
|
||||
static field self::Class<dynamic>? Extension1|field3a;
|
||||
static field self::Class<dynamic>? Extension1|field3b;
|
||||
static field self::Class<dynamic>? Extension1|field4a;
|
||||
static field self::Class<dynamic>? Extension1|field4b;
|
||||
static field self::ConcreteClass? Extension1|field5a;
|
||||
static field self::ConcreteClass? Extension1|field5b;
|
||||
static field self::Class<self::ConcreteClass>? Extension1|field6a;
|
||||
static field self::Class<self::ConcreteClass>? Extension1|field6b;
|
||||
static field core::Object? Extension1|field7a;
|
||||
static field core::Object? Extension1|field7b;
|
||||
static field core::int? Extension1|field8a;
|
||||
static field core::int? Extension1|field8b;
|
||||
static field self::G<self::Class<dynamic>>? Extension1|field1c;
|
||||
static field self::G<self::Class<dynamic>>? Extension1|field1d;
|
||||
static field self::G<dynamic>? Extension1|field2c;
|
||||
static field self::G<dynamic>? Extension1|field2d;
|
||||
static field self::G<self::Class<dynamic>>? Extension1|field3c;
|
||||
static field self::G<self::Class<dynamic>>? Extension1|field3d;
|
||||
static field self::G<self::Class<dynamic>>? Extension1|field4c;
|
||||
static field self::G<self::Class<dynamic>>? Extension1|field4d;
|
||||
static field self::G<self::ConcreteClass>? Extension1|field5c;
|
||||
static field self::G<self::ConcreteClass>? Extension1|field5d;
|
||||
static field self::G<self::Class<self::ConcreteClass>>? Extension1|field6c;
|
||||
static field self::G<self::Class<self::ConcreteClass>>? Extension1|field6d;
|
||||
static field self::G<core::Object>? Extension1|field7c;
|
||||
static field self::G<core::Object>? Extension1|field8d;
|
||||
static field self::G<core::int>? Extension1|field8c;
|
||||
static field self::G<core::int>? Extension1|field7d;
|
||||
static method main() → dynamic {}
|
||||
@@ -0,0 +1,51 @@
|
||||
// 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.
|
||||
|
||||
class Class<T> {}
|
||||
|
||||
class ConcreteClass implements Class<ConcreteClass> {}
|
||||
|
||||
typedef F<X extends Class<X>> = Class1;
|
||||
|
||||
class G<X extends Class<X>> {}
|
||||
|
||||
class Class1 {}
|
||||
|
||||
test() {
|
||||
new F(); // Error
|
||||
new F<dynamic>(); // Error
|
||||
new F<Class>(); // Error
|
||||
new F<Class<dynamic>>(); // Error
|
||||
new F<ConcreteClass>(); // Ok
|
||||
new F<Class<ConcreteClass>>(); // Ok
|
||||
new F<Object>(); // Error
|
||||
new F<int>(); // Error
|
||||
new G(); // Error
|
||||
new G<dynamic>(); // Error
|
||||
new G<Class>(); // Error
|
||||
new G<Class<dynamic>>(); // Error
|
||||
new G<ConcreteClass>(); // Ok
|
||||
new G<Class<ConcreteClass>>(); // Ok
|
||||
new G<Object>(); // Error
|
||||
new G<int>(); // Error
|
||||
|
||||
F.new; // Ok
|
||||
F<dynamic>.new; // Ok
|
||||
F<Class>.new; // Ok
|
||||
F<Class<dynamic>>.new; // Ok
|
||||
F<ConcreteClass>.new; // Ok
|
||||
F<Class<ConcreteClass>>.new; // Ok
|
||||
F<Object>.new; // Error
|
||||
F<int>.new; // Error
|
||||
G.new; // Ok
|
||||
G<dynamic>.new; // Error
|
||||
G<Class>.new; // Error
|
||||
G<Class<dynamic>>.new; // Error
|
||||
G<ConcreteClass>.new; // Ok
|
||||
G<Class<ConcreteClass>>.new; // Ok
|
||||
G<Object>.new; // Error
|
||||
G<int>.new; // Error
|
||||
}
|
||||
|
||||
main() {}
|
||||
@@ -0,0 +1,12 @@
|
||||
class Class<T> {}
|
||||
|
||||
class ConcreteClass implements Class<ConcreteClass> {}
|
||||
|
||||
typedef F<X extends Class<X>> = Class1;
|
||||
|
||||
class G<X extends Class<X>> {}
|
||||
|
||||
class Class1 {}
|
||||
|
||||
test() {}
|
||||
main() {}
|
||||
@@ -0,0 +1,11 @@
|
||||
class Class<T> {}
|
||||
|
||||
class Class1 {}
|
||||
|
||||
class ConcreteClass implements Class<ConcreteClass> {}
|
||||
|
||||
class G<X extends Class<X>> {}
|
||||
|
||||
main() {}
|
||||
test() {}
|
||||
typedef F<X extends Class<X>> = Class1;
|
||||
@@ -0,0 +1,244 @@
|
||||
library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:17:7: Error: Type argument 'dynamic' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// new F<dynamic>(); // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = Class1;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:18:7: Error: Type argument 'Class<dynamic>' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// new F<Class>(); // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = Class1;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:19:7: Error: Type argument 'Class<dynamic>' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// new F<Class<dynamic>>(); // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = Class1;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:22:7: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// new F<Object>(); // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = Class1;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:23:7: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// new F<int>(); // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = Class1;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:25:7: Error: Type argument 'dynamic' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// new G<dynamic>(); // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:26:7: Error: Type argument 'Class<dynamic>' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// new G<Class>(); // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:27:7: Error: Type argument 'Class<dynamic>' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// new G<Class<dynamic>>(); // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:30:7: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// new G<Object>(); // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:31:7: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// new G<int>(); // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:24:7: Error: Inferred type argument 'Class<Object?>' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// Try specifying type arguments explicitly so that they conform to the bounds.
|
||||
// new G(); // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:42:3: Error: Type argument 'dynamic' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G<X> Function<X extends Class<X>>()'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
|
||||
// - 'G' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// G<dynamic>.new; // Error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:43:3: Error: Type argument 'Class<dynamic>' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G<X> Function<X extends Class<X>>()'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
|
||||
// - 'G' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// G<Class>.new; // Error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:44:3: Error: Type argument 'Class<dynamic>' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G<X> Function<X extends Class<X>>()'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
|
||||
// - 'G' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// G<Class<dynamic>>.new; // Error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:47:3: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G<X> Function<X extends Class<X>>()'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
|
||||
// - 'G' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// G<Object>.new; // Error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:48:3: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G<X> Function<X extends Class<X>>()'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
|
||||
// - 'G' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// G<int>.new; // Error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:16:7: Error: Inferred type argument 'Class<Object?>' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// Try specifying type arguments explicitly so that they conform to the bounds.
|
||||
// new F(); // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = Class1;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:39:3: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// F<Object>.new; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = Class1;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:40:3: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// F<int>.new; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = Class1;
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
typedef F<unrelated X extends self::Class<X> = self::Class<dynamic>> = self::Class1;
|
||||
class Class<T extends core::Object? = dynamic> extends core::Object {
|
||||
synthetic constructor •() → self::Class<self::Class::T%>
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
class ConcreteClass extends core::Object implements self::Class<self::ConcreteClass> {
|
||||
synthetic constructor •() → self::ConcreteClass
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
class G<X extends self::Class<self::G::X> = self::Class<dynamic>> extends core::Object {
|
||||
synthetic constructor •() → self::G<self::G::X>
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
class Class1 extends core::Object {
|
||||
synthetic constructor •() → self::Class1
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
static method test() → dynamic {
|
||||
new self::Class1::•();
|
||||
new self::Class1::•();
|
||||
new self::Class1::•();
|
||||
new self::Class1::•();
|
||||
new self::Class1::•();
|
||||
new self::Class1::•();
|
||||
new self::Class1::•();
|
||||
new self::Class1::•();
|
||||
new self::G::•<self::Class<core::Object?>>();
|
||||
new self::G::•<dynamic>();
|
||||
new self::G::•<self::Class<dynamic>>();
|
||||
new self::G::•<self::Class<dynamic>>();
|
||||
new self::G::•<self::ConcreteClass>();
|
||||
new self::G::•<self::Class<self::ConcreteClass>>();
|
||||
new self::G::•<core::Object>();
|
||||
new self::G::•<core::int>();
|
||||
#C1;
|
||||
#C2;
|
||||
#C2;
|
||||
#C2;
|
||||
#C2;
|
||||
#C2;
|
||||
#C2;
|
||||
#C2;
|
||||
#C3;
|
||||
#C4;
|
||||
#C5;
|
||||
#C5;
|
||||
#C6;
|
||||
#C7;
|
||||
#C8;
|
||||
#C9;
|
||||
}
|
||||
static method main() → dynamic {}
|
||||
static method _#F#new#tearOff<unrelated X extends self::Class<self::_#F#new#tearOff::X> = self::Class<dynamic>>() → self::Class1
|
||||
return new self::Class1::•();
|
||||
|
||||
constants {
|
||||
#C1 = static-tearoff self::_#F#new#tearOff
|
||||
#C2 = constructor-tearoff self::Class1::•
|
||||
#C3 = constructor-tearoff self::G::•
|
||||
#C4 = instantiation #C3 <dynamic>
|
||||
#C5 = instantiation #C3 <self::Class<dynamic>*>
|
||||
#C6 = instantiation #C3 <self::ConcreteClass*>
|
||||
#C7 = instantiation #C3 <self::Class<self::ConcreteClass*>*>
|
||||
#C8 = instantiation #C3 <core::Object*>
|
||||
#C9 = instantiation #C3 <core::int*>
|
||||
}
|
||||
@@ -0,0 +1,244 @@
|
||||
library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:17:7: Error: Type argument 'dynamic' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// new F<dynamic>(); // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = Class1;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:18:7: Error: Type argument 'Class<dynamic>' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// new F<Class>(); // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = Class1;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:19:7: Error: Type argument 'Class<dynamic>' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// new F<Class<dynamic>>(); // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = Class1;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:22:7: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// new F<Object>(); // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = Class1;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:23:7: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// new F<int>(); // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = Class1;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:25:7: Error: Type argument 'dynamic' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// new G<dynamic>(); // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:26:7: Error: Type argument 'Class<dynamic>' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// new G<Class>(); // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:27:7: Error: Type argument 'Class<dynamic>' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// new G<Class<dynamic>>(); // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:30:7: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// new G<Object>(); // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:31:7: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// new G<int>(); // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:24:7: Error: Inferred type argument 'Class<Object?>' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// Try specifying type arguments explicitly so that they conform to the bounds.
|
||||
// new G(); // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:11:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class G<X extends Class<X>> {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:42:3: Error: Type argument 'dynamic' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G<X> Function<X extends Class<X>>()'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
|
||||
// - 'G' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// G<dynamic>.new; // Error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:43:3: Error: Type argument 'Class<dynamic>' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G<X> Function<X extends Class<X>>()'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
|
||||
// - 'G' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// G<Class>.new; // Error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:44:3: Error: Type argument 'Class<dynamic>' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G<X> Function<X extends Class<X>>()'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
|
||||
// - 'G' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// G<Class<dynamic>>.new; // Error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:47:3: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G<X> Function<X extends Class<X>>()'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
|
||||
// - 'G' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// G<Object>.new; // Error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:48:3: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'G<X> Function<X extends Class<X>>()'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
|
||||
// - 'G' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// G<int>.new; // Error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:16:7: Error: Inferred type argument 'Class<Object?>' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// Try specifying type arguments explicitly so that they conform to the bounds.
|
||||
// new F(); // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = Class1;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:39:3: Error: Type argument 'Object' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Object' is from 'dart:core'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// F<Object>.new; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = Class1;
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:40:3: Error: Type argument 'int' doesn't conform to the bound 'Class<X>' of the type variable 'X' on 'F'.
|
||||
// - 'Class' is from 'pkg/front_end/testcases/general/bounds_instances.dart'.
|
||||
// Try changing type arguments so that they conform to the bounds.
|
||||
// F<int>.new; // Error
|
||||
// ^
|
||||
// pkg/front_end/testcases/general/bounds_instances.dart:9:11: Context: This is the type variable whose bound isn't conformed to.
|
||||
// typedef F<X extends Class<X>> = Class1;
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
typedef F<unrelated X extends self::Class<X> = self::Class<dynamic>> = self::Class1;
|
||||
class Class<T extends core::Object? = dynamic> extends core::Object {
|
||||
synthetic constructor •() → self::Class<self::Class::T%>
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
class ConcreteClass extends core::Object implements self::Class<self::ConcreteClass> {
|
||||
synthetic constructor •() → self::ConcreteClass
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
class G<X extends self::Class<self::G::X> = self::Class<dynamic>> extends core::Object {
|
||||
synthetic constructor •() → self::G<self::G::X>
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
class Class1 extends core::Object {
|
||||
synthetic constructor •() → self::Class1
|
||||
: super core::Object::•()
|
||||
;
|
||||
}
|
||||
static method test() → dynamic {
|
||||
new self::Class1::•();
|
||||
new self::Class1::•();
|
||||
new self::Class1::•();
|
||||
new self::Class1::•();
|
||||
new self::Class1::•();
|
||||
new self::Class1::•();
|
||||
new self::Class1::•();
|
||||
new self::Class1::•();
|
||||
new self::G::•<self::Class<core::Object?>>();
|
||||
new self::G::•<dynamic>();
|
||||
new self::G::•<self::Class<dynamic>>();
|
||||
new self::G::•<self::Class<dynamic>>();
|
||||
new self::G::•<self::ConcreteClass>();
|
||||
new self::G::•<self::Class<self::ConcreteClass>>();
|
||||
new self::G::•<core::Object>();
|
||||
new self::G::•<core::int>();
|
||||
#C1;
|
||||
#C2;
|
||||
#C2;
|
||||
#C2;
|
||||
#C2;
|
||||
#C2;
|
||||
#C2;
|
||||
#C2;
|
||||
#C3;
|
||||
#C4;
|
||||
#C5;
|
||||
#C5;
|
||||
#C6;
|
||||
#C7;
|
||||
#C8;
|
||||
#C9;
|
||||
}
|
||||
static method main() → dynamic {}
|
||||
static method _#F#new#tearOff<unrelated X extends self::Class<self::_#F#new#tearOff::X> = self::Class<dynamic>>() → self::Class1
|
||||
return new self::Class1::•();
|
||||
|
||||
constants {
|
||||
#C1 = static-tearoff self::_#F#new#tearOff
|
||||
#C2 = constructor-tearoff self::Class1::•
|
||||
#C3 = constructor-tearoff self::G::•
|
||||
#C4 = instantiation #C3 <dynamic>
|
||||
#C5 = instantiation #C3 <self::Class<dynamic>*>
|
||||
#C6 = instantiation #C3 <self::ConcreteClass*>
|
||||
#C7 = instantiation #C3 <self::Class<self::ConcreteClass*>*>
|
||||
#C8 = instantiation #C3 <core::Object*>
|
||||
#C9 = instantiation #C3 <core::int*>
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
typedef F<unrelated X extends self::Class<X> = self::Class<dynamic>> = self::Class1;
|
||||
class Class<T extends core::Object? = dynamic> extends core::Object {
|
||||
synthetic constructor •() → self::Class<self::Class::T%>
|
||||
;
|
||||
}
|
||||
class ConcreteClass extends core::Object implements self::Class<self::ConcreteClass> {
|
||||
synthetic constructor •() → self::ConcreteClass
|
||||
;
|
||||
}
|
||||
class G<X extends self::Class<self::G::X> = self::Class<dynamic>> extends core::Object {
|
||||
synthetic constructor •() → self::G<self::G::X>
|
||||
;
|
||||
}
|
||||
class Class1 extends core::Object {
|
||||
synthetic constructor •() → self::Class1
|
||||
;
|
||||
}
|
||||
static method test() → dynamic
|
||||
;
|
||||
static method main() → dynamic
|
||||
;
|
||||
static method _#F#new#tearOff<unrelated X extends self::Class<self::_#F#new#tearOff::X> = self::Class<dynamic>>() → self::Class1
|
||||
return new self::Class1::•();
|
||||
@@ -0,0 +1,58 @@
|
||||
// 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.
|
||||
|
||||
class Class<T> {}
|
||||
|
||||
class ConcreteClass implements Class<ConcreteClass> {}
|
||||
|
||||
typedef F<X extends Class<X>> = X;
|
||||
|
||||
class G<X extends Class<X>> {}
|
||||
|
||||
test() {
|
||||
<F, F<dynamic>>{}; // Ok
|
||||
<F<Class>, F<Class<dynamic>>>{}; // Ok
|
||||
<F<ConcreteClass>, F<Class<ConcreteClass>>>{}; // Ok
|
||||
<F<Object>, F<int>>{}; // Error
|
||||
<G, G<dynamic>>{}; // Ok
|
||||
<G<Class>, G<Class<dynamic>>>{}; // Ok
|
||||
<G<ConcreteClass>, G<Class<ConcreteClass>>>{}; // Ok
|
||||
<G<Object>, G<int>>{}; // Error
|
||||
|
||||
<F>{}; // Ok
|
||||
<F<dynamic>>{}; // Ok
|
||||
<F<Class>>{}; // Ok
|
||||
<F<Class<dynamic>>>{}; // Ok
|
||||
<F<Object>>{}; // Error
|
||||
<F<int>>{}; // Error
|
||||
<F<ConcreteClass>>{}; // Ok
|
||||
<F<Class<ConcreteClass>>>{}; // Ok
|
||||
<G>{}; // Ok
|
||||
<G<dynamic>>{}; // Ok
|
||||
<G<Class>>{}; // Ok
|
||||
<G<Class<dynamic>>>{}; // Ok
|
||||
<G<ConcreteClass>>{}; // Ok
|
||||
<G<Class<ConcreteClass>>>{}; // Ok
|
||||
<G<Object>>{}; // Error
|
||||
<G<int>>{}; // Error
|
||||
|
||||
<F>[]; // Ok
|
||||
<F<dynamic>>[]; // Ok
|
||||
<F<Class>>[]; // Ok
|
||||
<F<Class<dynamic>>>[]; // Ok
|
||||
<F<ConcreteClass>>[]; // Ok
|
||||
<F<Class<ConcreteClass>>>[]; // Ok
|
||||
<F<Object>>[]; // Error
|
||||
<F<int>>[]; // Error
|
||||
<G>[]; // Ok
|
||||
<G<dynamic>>[]; // Ok
|
||||
<G<Class>>[]; // Ok
|
||||
<G<Class<dynamic>>>[]; // Ok
|
||||
<G<ConcreteClass>>[]; // Ok
|
||||
<G<Class<ConcreteClass>>>[]; // Ok
|
||||
<G<Object>>[]; // Error
|
||||
<G<int>>[]; // Error
|
||||
}
|
||||
|
||||
main() {}
|
||||
@@ -0,0 +1,10 @@
|
||||
class Class<T> {}
|
||||
|
||||
class ConcreteClass implements Class<ConcreteClass> {}
|
||||
|
||||
typedef F<X extends Class<X>> = X;
|
||||
|
||||
class G<X extends Class<X>> {}
|
||||
|
||||
test() {}
|
||||
main() {}
|
||||
@@ -0,0 +1,9 @@
|
||||
class Class<T> {}
|
||||
|
||||
class ConcreteClass implements Class<ConcreteClass> {}
|
||||
|
||||
class G<X extends Class<X>> {}
|
||||
|
||||
main() {}
|
||||
test() {}
|
||||
typedef F<X extends Class<X>> = X;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user