Version 2.17.0-76.0.dev
Merge commit 'eb4f5077abd3b21a80f07d0f8ff1f22caeb30b3b' into 'dev'
diff --git a/DEPS b/DEPS
index 1ec4625..046a19c 100644
--- a/DEPS
+++ b/DEPS
@@ -117,7 +117,7 @@
"glob_rev": "a62acf590598f458d3198d9f2930c1c9dd4b1379",
"html_rev": "00cd3c22dac0e68e6ed9e7e4945101aedb1b3109",
"http_io_rev": "2fa188caf7937e313026557713f7feffedd4978b",
- "http_multi_server_rev": "de1b312164c24a1690b46c6e97bd47eff40c4649",
+ "http_multi_server_rev": "34bf7f04b61cce561f47f7f275c2cc811534a05a",
"http_parser_rev": "202391286ddc13c4c3c284ac5b511f04697250ed",
"http_rev": "1e42ffa181b263f7790f276a5465832bff7ce615",
"icu_rev" : "81d656878ec611cb0b42d52c82e9dae93920d9ba",
diff --git a/pkg/analysis_server/lib/src/cider/rename.dart b/pkg/analysis_server/lib/src/cider/rename.dart
index 0b7a0fc..44eadad 100644
--- a/pkg/analysis_server/lib/src/cider/rename.dart
+++ b/pkg/analysis_server/lib/src/cider/rename.dart
@@ -31,19 +31,21 @@
_flutterWidgetState = _findFlutterStateClass(element, name);
RefactoringStatus? status;
- if (element is LocalVariableElement) {
- status = validateVariableName(name);
- } else if (element is ParameterElement) {
+ if (element is ParameterElement) {
status = validateParameterName(name);
+ } else if (element is VariableElement) {
+ status = validateVariableName(name);
} else if (element is FunctionElement) {
status = validateFunctionName(name);
- } else if (element is TopLevelVariableElement) {
- status = validateVariableName(name);
+ } else if (element is FieldElement) {
+ status = validateFieldName(name);
} else if (element is TypeAliasElement) {
status = validateTypeAliasName(name);
} else if (element is ClassElement) {
status = validateClassName(name);
- } else if (status == null) {
+ }
+
+ if (status == null) {
return null;
}
return CheckNameResponse(status, this);
@@ -95,7 +97,6 @@
for (var element in elements) {
matches.addAll(canRename._fileResolver.findReferences(element));
}
-
FlutterWidgetRename? flutterRename;
if (canRename._flutterWidgetState != null) {
var stateWidget = canRename._flutterWidgetState!;
diff --git a/pkg/analysis_server/test/src/cider/rename_test.dart b/pkg/analysis_server/test/src/cider/rename_test.dart
index 02368a6..59f686d 100644
--- a/pkg/analysis_server/test/src/cider/rename_test.dart
+++ b/pkg/analysis_server/test/src/cider/rename_test.dart
@@ -51,6 +51,18 @@
expect(refactor.refactoringElement.offset, _correctionContext.offset);
}
+ void test_canRename_field_static_private() {
+ var refactor = _compute(r'''
+class A{
+ static const ^_val = 1234;
+}
+''');
+
+ expect(refactor, isNotNull);
+ expect(refactor!.refactoringElement.element.name, '_val');
+ expect(refactor.refactoringElement.offset, _correctionContext.offset);
+ }
+
void test_canRename_function() {
var refactor = _compute(r'''
void ^foo() {
@@ -256,6 +268,42 @@
]);
}
+ void test_rename_field() {
+ var result = _rename(r'''
+class A{
+ int get ^x => 5;
+}
+
+void foo() {
+ var m = A().x;
+}
+''', 'y');
+
+ expect(result, isNotNull);
+ expect(result!.matches, [
+ CiderSearchMatch(convertPath('/workspace/dart/test/lib/test.dart'),
+ [CharacterLocation(2, 11), CharacterLocation(6, 15)]),
+ ]);
+ }
+
+ void test_rename_field_static_private() {
+ var result = _rename(r'''
+class A{
+ static const ^_val = 1234;
+}
+
+void foo() {
+ print(A._val);
+}
+''', '_newVal');
+
+ expect(result, isNotNull);
+ expect(result!.matches, [
+ CiderSearchMatch(convertPath('/workspace/dart/test/lib/test.dart'),
+ [CharacterLocation(2, 16), CharacterLocation(6, 11)]),
+ ]);
+ }
+
void test_rename_function() {
var result = _rename(r'''
test() {}
@@ -341,7 +389,7 @@
]);
}
- void test_typeAlias_functionType() {
+ void test_rename_typeAlias_functionType() {
var result = _rename(r'''
typedef ^F = void Function();
void f(F a) {}
diff --git a/pkg/analyzer/lib/error/error.dart b/pkg/analyzer/lib/error/error.dart
index 4dcc569..d643def 100644
--- a/pkg/analyzer/lib/error/error.dart
+++ b/pkg/analyzer/lib/error/error.dart
@@ -258,6 +258,7 @@
CompileTimeErrorCode.INVALID_MODIFIER_ON_CONSTRUCTOR,
CompileTimeErrorCode.INVALID_MODIFIER_ON_SETTER,
CompileTimeErrorCode.INVALID_OVERRIDE,
+ CompileTimeErrorCode.INVALID_REFERENCE_TO_GENERATIVE_ENUM_CONSTRUCTOR,
CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS,
CompileTimeErrorCode.INVALID_SUPER_FORMAL_PARAMETER_LOCATION,
CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_IN_CONST_LIST,
@@ -314,6 +315,7 @@
CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT,
CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT,
CompileTimeErrorCode.NO_GENERATIVE_CONSTRUCTORS_IN_SUPERCLASS,
+ CompileTimeErrorCode.NON_ABSTRACT_CLASS_HAS_ENUM_SUPERINTERFACE,
CompileTimeErrorCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FIVE_PLUS,
CompileTimeErrorCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FOUR,
CompileTimeErrorCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE,
diff --git a/pkg/analyzer/lib/src/dart/ast/ast.dart b/pkg/analyzer/lib/src/dart/ast/ast.dart
index 5218135..0592060 100644
--- a/pkg/analyzer/lib/src/dart/ast/ast.dart
+++ b/pkg/analyzer/lib/src/dart/ast/ast.dart
@@ -15,7 +15,9 @@
import 'package:analyzer/dart/element/type.dart';
import 'package:analyzer/src/dart/ast/to_source_visitor.dart';
import 'package:analyzer/src/dart/ast/token.dart';
+import 'package:analyzer/src/dart/resolver/typed_literal_resolver.dart';
import 'package:analyzer/src/fasta/token_utils.dart' as util show findPrevious;
+import 'package:analyzer/src/generated/resolver.dart';
import 'package:analyzer/src/generated/source.dart' show LineInfo, Source;
import 'package:analyzer/src/generated/utilities_dart.dart';
@@ -1759,7 +1761,12 @@
}
abstract class CollectionElementImpl extends AstNodeImpl
- implements CollectionElement {}
+ implements CollectionElement {
+ /// Dispatches this collection element to the [resolver], with the given
+ /// [context] information.
+ void resolveElement(
+ ResolverVisitor resolver, CollectionLiteralContext? context);
+}
/// A combinator associated with an import or export directive.
///
@@ -3740,6 +3747,12 @@
@override
ExpressionImpl get unParenthesized => this;
+
+ @override
+ void resolveElement(
+ ResolverVisitor resolver, CollectionLiteralContext? context) {
+ resolver.analyzeExpression(this, context?.elementType);
+ }
}
/// An expression used as a statement.
@@ -4475,6 +4488,12 @@
E? accept<E>(AstVisitor<E> visitor) => visitor.visitForElement(this);
@override
+ void resolveElement(
+ ResolverVisitor resolver, CollectionLiteralContext? context) {
+ resolver.visitForElement(this, context: context);
+ }
+
+ @override
void visitChildren(AstVisitor visitor) {
_forLoopParts.accept(visitor);
_body.accept(visitor);
@@ -5822,6 +5841,12 @@
E? accept<E>(AstVisitor<E> visitor) => visitor.visitIfElement(this);
@override
+ void resolveElement(
+ ResolverVisitor resolver, CollectionLiteralContext? context) {
+ resolver.visitIfElement(this, context: context);
+ }
+
+ @override
void visitChildren(AstVisitor visitor) {
_condition.accept(visitor);
_thenElement.accept(visitor);
@@ -7096,6 +7121,12 @@
E? accept<E>(AstVisitor<E> visitor) => visitor.visitMapLiteralEntry(this);
@override
+ void resolveElement(
+ ResolverVisitor resolver, CollectionLiteralContext? context) {
+ resolver.visitMapLiteralEntry(this, context: context);
+ }
+
+ @override
void visitChildren(AstVisitor visitor) {
_key.accept(visitor);
_value.accept(visitor);
@@ -9542,6 +9573,12 @@
}
@override
+ void resolveElement(
+ ResolverVisitor resolver, CollectionLiteralContext? context) {
+ resolver.visitSpreadElement(this, context: context);
+ }
+
+ @override
void visitChildren(AstVisitor visitor) {
_expression.accept(visitor);
}
diff --git a/pkg/analyzer/lib/src/dart/element/extensions.dart b/pkg/analyzer/lib/src/dart/element/extensions.dart
index decbd59..69fc60b 100644
--- a/pkg/analyzer/lib/src/dart/element/extensions.dart
+++ b/pkg/analyzer/lib/src/dart/element/extensions.dart
@@ -8,6 +8,18 @@
import 'package:analyzer/src/generated/utilities_dart.dart';
import 'package:meta/meta_meta.dart';
+extension ClassElementExtension on ClassElement {
+ bool get isDartCoreEnum {
+ return name == 'Enum' && library.isDartCore;
+ }
+}
+
+extension ConstructorElementExtension on ConstructorElement {
+ bool get isGenerative {
+ return !isFactory;
+ }
+}
+
extension ElementAnnotationExtensions on ElementAnnotation {
static final Map<String, TargetKind> _targetKindsByName = {
for (final kind in TargetKind.values) kind.toString(): kind,
@@ -109,6 +121,12 @@
}
}
+extension InterfaceTypeExtension on InterfaceType {
+ bool get isDartCoreEnum {
+ return element.isDartCoreEnum;
+ }
+}
+
extension ParameterElementExtensions on ParameterElement {
/// Return [ParameterElement] with the specified properties replaced.
ParameterElement copyWith({
diff --git a/pkg/analyzer/lib/src/dart/resolver/annotation_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/annotation_resolver.dart
index 578cfdf..169a6e2 100644
--- a/pkg/analyzer/lib/src/dart/resolver/annotation_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/annotation_resolver.dart
@@ -122,7 +122,7 @@
CompileTimeErrorCode.INVALID_ANNOTATION,
node,
);
- _resolver.visitArgumentList(argumentList,
+ _resolver.analyzeArgumentList(argumentList, null,
whyNotPromotedList: whyNotPromotedList);
return;
}
@@ -142,8 +142,7 @@
);
}
_resolveConstructorInvocationArguments(node);
- InferenceContext.setType(argumentList, constructorElement.type);
- _resolver.visitArgumentList(argumentList,
+ _resolver.analyzeArgumentList(argumentList, constructorElement.parameters,
whyNotPromotedList: whyNotPromotedList);
return;
}
@@ -158,8 +157,7 @@
node.element = constructorElement;
_resolveConstructorInvocationArguments(node);
- InferenceContext.setType(argumentList, constructorElement.type);
- _resolver.visitArgumentList(argumentList,
+ _resolver.analyzeArgumentList(argumentList, constructorElement.parameters,
whyNotPromotedList: whyNotPromotedList);
}
@@ -221,7 +219,7 @@
typeParameters,
constructorElement,
);
- inferArgumentTypes(
+ var inferenceResult = inferArgumentTypes(
inferenceNode: node,
constructorElement: constructorElement,
elementToInfer: elementToInfer,
@@ -229,7 +227,10 @@
arguments: node.arguments!,
errorNode: node,
isConst: true);
- _resolver.visitArgumentList(argumentList,
+ if (inferenceResult != null) {
+ constructorElement = inferenceResult.constructorElement;
+ }
+ _resolver.analyzeArgumentList(argumentList, constructorElement.parameters,
whyNotPromotedList: whyNotPromotedList);
var constructorRawType = elementToInfer.asType;
@@ -528,7 +529,7 @@
AnnotationImpl node, List<WhyNotPromotedGetter> whyNotPromotedList) {
var arguments = node.arguments;
if (arguments != null) {
- _resolver.visitArgumentList(arguments,
+ _resolver.analyzeArgumentList(arguments, null,
whyNotPromotedList: whyNotPromotedList);
}
}
diff --git a/pkg/analyzer/lib/src/dart/resolver/extension_member_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/extension_member_resolver.dart
index 517ff5c..5199087 100644
--- a/pkg/analyzer/lib/src/dart/resolver/extension_member_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/extension_member_resolver.dart
@@ -42,6 +42,41 @@
TypeSystemImpl get _typeSystem => _resolver.typeSystem;
+ /// Set the type context for the receiver of the override.
+ ///
+ /// The context of the invocation that is made through the override does
+ /// not affect the type inference of the override and the receiver.
+ DartType? computeOverrideReceiverContextType(ExtensionOverride node) {
+ var element = node.staticElement!;
+ var typeParameters = element.typeParameters;
+
+ var arguments = node.argumentList.arguments;
+ if (arguments.length != 1) {
+ return null;
+ }
+
+ List<DartType> typeArgumentTypes;
+ var typeArguments = node.typeArguments;
+ if (typeArguments != null) {
+ var arguments = typeArguments.arguments;
+ if (arguments.length == typeParameters.length) {
+ typeArgumentTypes = arguments.map((a) => a.typeOrThrow).toList();
+ } else {
+ typeArgumentTypes = _listOfDynamic(typeParameters);
+ }
+ } else {
+ typeArgumentTypes = List.filled(
+ typeParameters.length,
+ UnknownInferredType.instance,
+ );
+ }
+
+ return Substitution.fromPairs(
+ typeParameters,
+ typeArgumentTypes,
+ ).substituteType(element.extendedType);
+ }
+
/// Return the most specific extension in the current scope for this [type],
/// that defines the member with the given [name].
///
@@ -203,44 +238,6 @@
}
}
- /// Set the type context for the receiver of the override.
- ///
- /// The context of the invocation that is made through the override does
- /// not affect the type inference of the override and the receiver.
- void setOverrideReceiverContextType(ExtensionOverride node) {
- var element = node.staticElement!;
- var typeParameters = element.typeParameters;
-
- var arguments = node.argumentList.arguments;
- if (arguments.length != 1) {
- return;
- }
-
- List<DartType> typeArgumentTypes;
- var typeArguments = node.typeArguments;
- if (typeArguments != null) {
- var arguments = typeArguments.arguments;
- if (arguments.length == typeParameters.length) {
- typeArgumentTypes = arguments.map((a) => a.typeOrThrow).toList();
- } else {
- typeArgumentTypes = _listOfDynamic(typeParameters);
- }
- } else {
- typeArgumentTypes = List.filled(
- typeParameters.length,
- UnknownInferredType.instance,
- );
- }
-
- var extendedForDownward = Substitution.fromPairs(
- typeParameters,
- typeArgumentTypes,
- ).substituteType(element.extendedType);
-
- var receiver = arguments[0];
- InferenceContext.setType(receiver, extendedForDownward);
- }
-
void _checkTypeArgumentsMatchingBounds(
List<TypeParameterElement> typeParameters,
TypeArgumentList? typeArgumentList,
diff --git a/pkg/analyzer/lib/src/dart/resolver/for_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/for_resolver.dart
index d243983..82ca086 100644
--- a/pkg/analyzer/lib/src/dart/resolver/for_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/for_resolver.dart
@@ -10,6 +10,7 @@
import 'package:analyzer/src/dart/element/type.dart';
import 'package:analyzer/src/dart/element/type_schema.dart';
import 'package:analyzer/src/dart/resolver/assignment_expression_resolver.dart';
+import 'package:analyzer/src/dart/resolver/typed_literal_resolver.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/resolver.dart';
@@ -21,12 +22,13 @@
required ResolverVisitor resolver,
}) : _resolver = resolver;
- void resolveElement(ForElementImpl node) {
+ void resolveElement(ForElementImpl node, CollectionLiteralContext? context) {
var forLoopParts = node.forLoopParts;
if (forLoopParts is ForPartsImpl) {
- _forParts(node, forLoopParts, node.body);
+ _forParts(node, forLoopParts, node.body, context: context);
} else if (forLoopParts is ForEachPartsImpl) {
- _forEachParts(node, node.awaitKeyword != null, forLoopParts, node.body);
+ _forEachParts(node, node.awaitKeyword != null, forLoopParts, node.body,
+ context: context);
}
}
@@ -67,11 +69,8 @@
}
void _forEachParts(
- AstNode node,
- bool isAsync,
- ForEachParts forEachParts,
- AstNode body,
- ) {
+ AstNode node, bool isAsync, ForEachParts forEachParts, AstNode body,
+ {CollectionLiteralContext? context}) {
Expression iterable = forEachParts.iterable;
DeclaredIdentifier? loopVariable;
SimpleIdentifier? identifier;
@@ -140,12 +139,13 @@
elementType ?? DynamicTypeImpl.instance, null);
}
- body.accept(_resolver);
+ _visitBody(body, context);
_resolver.flowAnalysis.flow?.forEach_end();
}
- void _forParts(AstNode node, ForParts forParts, AstNode body) {
+ void _forParts(AstNode node, ForParts forParts, AstNode body,
+ {CollectionLiteralContext? context}) {
if (forParts is ForPartsWithDeclarations) {
forParts.variables.accept(_resolver);
} else if (forParts is ForPartsWithExpression) {
@@ -166,11 +166,20 @@
}
_resolver.flowAnalysis.for_bodyBegin(node, condition);
- body.accept(_resolver);
+ _visitBody(body, context);
_resolver.flowAnalysis.flow?.for_updaterBegin();
forParts.updaters.accept(_resolver);
_resolver.flowAnalysis.flow?.for_end();
}
+
+ void _visitBody(AstNode body, CollectionLiteralContext? context) {
+ if (body is CollectionElementImpl) {
+ body.resolveElement(_resolver, context);
+ } else {
+ assert(body is Statement);
+ body.accept(_resolver);
+ }
+ }
}
diff --git a/pkg/analyzer/lib/src/dart/resolver/function_expression_invocation_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/function_expression_invocation_resolver.dart
index 42070dc..3ca36ca 100644
--- a/pkg/analyzer/lib/src/dart/resolver/function_expression_invocation_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/function_expression_invocation_resolver.dart
@@ -120,7 +120,7 @@
void _resolveArguments(FunctionExpressionInvocationImpl node,
List<WhyNotPromotedGetter> whyNotPromotedList) {
- _resolver.visitArgumentList(node.argumentList,
+ _resolver.analyzeArgumentList(node.argumentList, null,
whyNotPromotedList: whyNotPromotedList);
}
diff --git a/pkg/analyzer/lib/src/dart/resolver/instance_creation_expression_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/instance_creation_expression_resolver.dart
index 2ff2199..2e12dd0 100644
--- a/pkg/analyzer/lib/src/dart/resolver/instance_creation_expression_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/instance_creation_expression_resolver.dart
@@ -61,9 +61,10 @@
definingLibrary: _resolver.definingLibrary,
);
var typeName = constructorName.type2;
+ var constructorElement = constructorName.staticElement;
var inferenceResult = inferArgumentTypes(
inferenceNode: node,
- constructorElement: constructorName.staticElement,
+ constructorElement: constructorElement,
elementToInfer: elementToInfer,
typeArguments: typeName.typeArguments,
arguments: node.argumentList,
@@ -71,9 +72,11 @@
isConst: node.isConst);
if (inferenceResult != null) {
typeName.type = inferenceResult.constructedType;
- constructorName.staticElement = inferenceResult.constructorElement;
+ constructorElement =
+ constructorName.staticElement = inferenceResult.constructorElement;
}
- _resolver.visitArgumentList(node.argumentList,
+ _resolver.analyzeArgumentList(
+ node.argumentList, constructorElement?.parameters,
whyNotPromotedList: whyNotPromotedList);
_resolver.elementResolver.visitInstanceCreationExpression(node);
_resolver.typeAnalyzer.visitInstanceCreationExpression(node);
diff --git a/pkg/analyzer/lib/src/dart/resolver/instance_creation_resolver_helper.dart b/pkg/analyzer/lib/src/dart/resolver/instance_creation_resolver_helper.dart
index 9177b2b..a568421 100644
--- a/pkg/analyzer/lib/src/dart/resolver/instance_creation_resolver_helper.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/instance_creation_resolver_helper.dart
@@ -66,7 +66,6 @@
isConst: isConst, errorNode: errorNode);
if (inferred != null) {
- InferenceContext.setType(arguments, inferred);
// Fix up the parameter elements based on inferred method.
arguments.correspondingStaticParameters =
ResolverVisitor.resolveArgumentsToParameters(
@@ -90,7 +89,6 @@
if (constructorElement != null) {
var type = constructorElement.type;
type = resolver.toLegacyTypeIfOptOut(type) as FunctionType;
- InferenceContext.setType(arguments, type);
}
}
diff --git a/pkg/analyzer/lib/src/dart/resolver/invocation_inference_helper.dart b/pkg/analyzer/lib/src/dart/resolver/invocation_inference_helper.dart
index 765d3d5..e31ad4c 100644
--- a/pkg/analyzer/lib/src/dart/resolver/invocation_inference_helper.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/invocation_inference_helper.dart
@@ -163,13 +163,12 @@
return null;
}
- void inferArgumentTypesForInvocation(
+ DartType? inferArgumentTypesForInvocation(
InvocationExpression node,
DartType? type,
) {
- var inferred = inferArgumentTypesForGeneric(node, type, node.typeArguments);
- InferenceContext.setType(
- node.argumentList, inferred ?? node.staticInvokeType);
+ return inferArgumentTypesForGeneric(node, type, node.typeArguments) ??
+ node.staticInvokeType;
}
/// Given a possibly generic invocation like `o.m(args)` or `(f)(args)` try to
@@ -419,9 +418,11 @@
return false;
}
- void _resolveArguments(ArgumentList argumentList,
- List<WhyNotPromotedGetter> whyNotPromotedList) {
- _resolver.visitArgumentList(argumentList,
+ void _resolveArguments(
+ ArgumentList argumentList,
+ List<WhyNotPromotedGetter> whyNotPromotedList,
+ List<ParameterElement> parameters) {
+ _resolver.analyzeArgumentList(argumentList, parameters,
isIdentical: _isCallToIdentical(argumentList.parent),
whyNotPromotedList: whyNotPromotedList);
}
@@ -466,8 +467,7 @@
var typeParameters = rawType.typeFormals;
if (typeParameters.isEmpty) {
- InferenceContext.setType(argumentList, rawType);
- _resolveArguments(argumentList, whyNotPromotedList);
+ _resolveArguments(argumentList, whyNotPromotedList, rawType.parameters);
_typeArgumentTypes = const <DartType>[];
_invokeType = rawType;
@@ -482,9 +482,9 @@
)!;
var downwardsInvokeType = rawType.instantiate(downwardsTypeArguments);
- InferenceContext.setType(argumentList, downwardsInvokeType);
- _resolveArguments(argumentList, whyNotPromotedList);
+ _resolveArguments(
+ argumentList, whyNotPromotedList, downwardsInvokeType.parameters);
_typeArgumentTypes = _inferUpwards(
rawType: rawType,
@@ -527,9 +527,8 @@
}
var invokeType = rawType.instantiate(typeArguments);
- InferenceContext.setType(argumentList, invokeType);
- _resolveArguments(argumentList, whyNotPromotedList);
+ _resolveArguments(argumentList, whyNotPromotedList, invokeType.parameters);
_typeArgumentTypes = typeArguments;
_invokeType = invokeType;
diff --git a/pkg/analyzer/lib/src/dart/resolver/method_invocation_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/method_invocation_resolver.dart
index 2c26796..259c982 100644
--- a/pkg/analyzer/lib/src/dart/resolver/method_invocation_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/method_invocation_resolver.dart
@@ -307,11 +307,12 @@
void _resolveArguments(MethodInvocationImpl node,
List<WhyNotPromotedGetter> whyNotPromotedList) {
// TODO(scheglov) This is bad, don't write raw type, carry it
- _inferenceHelper.inferArgumentTypesForInvocation(
+ var callerType = _inferenceHelper.inferArgumentTypesForInvocation(
node,
node.methodName.staticType,
);
- _resolver.visitArgumentList(node.argumentList,
+ _resolver.analyzeArgumentList(node.argumentList,
+ callerType is FunctionType ? callerType.parameters : null,
whyNotPromotedList: whyNotPromotedList);
}
@@ -456,7 +457,7 @@
}
_setExplicitTypeArgumentTypes();
- _resolver.visitArgumentList(node.argumentList,
+ _resolver.analyzeArgumentList(node.argumentList, null,
whyNotPromotedList: whyNotPromotedList);
}
diff --git a/pkg/analyzer/lib/src/dart/resolver/typed_literal_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/typed_literal_resolver.dart
index bb7a033..5c56ff1 100644
--- a/pkg/analyzer/lib/src/dart/resolver/typed_literal_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/typed_literal_resolver.dart
@@ -20,6 +20,28 @@
import 'package:analyzer/src/generated/resolver.dart';
import 'package:analyzer/src/generated/utilities_dart.dart';
+/// Context for inferring the types of elements of a collection literal.
+class CollectionLiteralContext {
+ /// The type context for ordinary collection elements, if this is a list or
+ /// set literal. Otherwise `null`.
+ final DartType? elementType;
+
+ /// The type context for spread expressions.
+ final DartType iterableType;
+
+ /// The type context for keys, if this is a map literal. Otherwise `null`.
+ final DartType? keyType;
+
+ /// The type context for values, if this is a map literal. Otherwise `null`.
+ final DartType? valueType;
+
+ CollectionLiteralContext(
+ {this.elementType,
+ required this.iterableType,
+ this.keyType,
+ this.valueType});
+}
+
/// Helper for resolving [ListLiteral]s and [SetOrMapLiteral]s.
class TypedLiteralResolver {
final ResolverVisitor _resolver;
@@ -87,17 +109,16 @@
} else {
listType = _inferListType(node, downwards: true);
}
+ CollectionLiteralContext? context;
if (listType != null) {
DartType elementType = listType.typeArguments[0];
DartType iterableType = _typeProvider.iterableType(elementType);
- _pushCollectionTypesDownToAll(_getListElements(node),
+ context = CollectionLiteralContext(
elementType: elementType, iterableType: iterableType);
- InferenceContext.setType(node, listType);
- } else {
- InferenceContext.clearType(node);
}
- node.visitChildren(_resolver);
+ node.typeArguments?.accept(_resolver);
+ _resolveElements(node.elements, context);
_insertImplicitCallReferences(node);
_resolveListLiteral2(node);
}
@@ -129,15 +150,17 @@
assert(literalResolution.kind == _LiteralResolutionKind.ambiguous);
literalType = null;
}
+ var elements = _getSetOrMapElements(node);
+ CollectionLiteralContext? context;
if (literalType is InterfaceType) {
List<DartType> typeArguments = literalType.typeArguments;
if (typeArguments.length == 1) {
DartType elementType = literalType.typeArguments[0];
DartType iterableType = _typeProvider.iterableType(elementType);
- _pushCollectionTypesDownToAll(_getSetOrMapElements(node),
+ context = CollectionLiteralContext(
elementType: elementType, iterableType: iterableType);
if (!_uiAsCodeEnabled &&
- _getSetOrMapElements(node).isEmpty &&
+ elements.isEmpty &&
node.typeArguments == null &&
node.isMap) {
// The node is really an empty set literal with no type arguments.
@@ -146,7 +169,7 @@
} else if (typeArguments.length == 2) {
DartType keyType = typeArguments[0];
DartType valueType = typeArguments[1];
- _pushCollectionTypesDownToAll(_getSetOrMapElements(node),
+ context = CollectionLiteralContext(
iterableType: literalType, keyType: keyType, valueType: valueType);
}
node.contextType = literalType;
@@ -154,7 +177,8 @@
node.contextType = null;
}
- node.visitChildren(_resolver);
+ node.typeArguments?.accept(_resolver);
+ _resolveElements(node.elements, context);
_insertImplicitCallReferences(node);
_resolveSetOrMapLiteral2(node);
}
@@ -627,52 +651,10 @@
}
}
- void _pushCollectionTypesDown(CollectionElement? element,
- {DartType? elementType,
- required DartType iterableType,
- DartType? keyType,
- DartType? valueType}) {
- if (element is Expression) {
- InferenceContext.setType(element, elementType);
- } else if (element is ForElement) {
- _pushCollectionTypesDown(element.body,
- elementType: elementType,
- iterableType: iterableType,
- keyType: keyType,
- valueType: valueType);
- } else if (element is IfElement) {
- _pushCollectionTypesDown(element.thenElement,
- elementType: elementType,
- iterableType: iterableType,
- keyType: keyType,
- valueType: valueType);
- _pushCollectionTypesDown(element.elseElement,
- elementType: elementType,
- iterableType: iterableType,
- keyType: keyType,
- valueType: valueType);
- } else if (element is MapLiteralEntry) {
- InferenceContext.setType(element.key, keyType);
- InferenceContext.setType(element.value, valueType);
- } else if (element is SpreadElement) {
- if (_isNonNullableByDefault && element.isNullAware) {
- iterableType = _typeSystem.makeNullable(iterableType);
- }
- InferenceContext.setType(element.expression, iterableType);
- }
- }
-
- void _pushCollectionTypesDownToAll(List<CollectionElement> elements,
- {DartType? elementType,
- required DartType iterableType,
- DartType? keyType,
- DartType? valueType}) {
- for (CollectionElement element in elements) {
- _pushCollectionTypesDown(element,
- elementType: elementType,
- iterableType: iterableType,
- keyType: keyType,
- valueType: valueType);
+ void _resolveElements(
+ List<CollectionElement> elements, CollectionLiteralContext? context) {
+ for (var element in elements) {
+ (element as CollectionElementImpl).resolveElement(_resolver, context);
}
}
diff --git a/pkg/analyzer/lib/src/error/codes.g.dart b/pkg/analyzer/lib/src/error/codes.g.dart
index 8291121..9666c16 100644
--- a/pkg/analyzer/lib/src/error/codes.g.dart
+++ b/pkg/analyzer/lib/src/error/codes.g.dart
@@ -6568,6 +6568,7 @@
// instantiated:
//
// ```dart
+ // // @dart = 2.16
// enum E {a}
//
// var e = [!E!]();
@@ -6579,6 +6580,7 @@
// constants defined in the enum:
//
// ```dart
+ // // @dart = 2.16
// enum E {a}
//
// var e = E.a;
@@ -7499,6 +7501,13 @@
hasPublishedDocs: true,
);
+ static const CompileTimeErrorCode
+ INVALID_REFERENCE_TO_GENERATIVE_ENUM_CONSTRUCTOR = CompileTimeErrorCode(
+ 'INVALID_REFERENCE_TO_GENERATIVE_ENUM_CONSTRUCTOR',
+ "Generative enum constructors can only be used as targets of redirection.",
+ correctionMessage: "Try using a factory constructor, or an enum constant.",
+ );
+
/**
* No parameters.
*/
@@ -9387,6 +9396,15 @@
hasPublishedDocs: true,
);
+ static const CompileTimeErrorCode NON_ABSTRACT_CLASS_HAS_ENUM_SUPERINTERFACE =
+ CompileTimeErrorCode(
+ 'NON_ABSTRACT_CLASS_HAS_ENUM_SUPERINTERFACE',
+ "Non-abstract classes can't have 'Enum' as a superinterface.",
+ correctionMessage:
+ "Try specifying a different interface, or remove it from the list.",
+ uniqueName: 'NON_ABSTRACT_CLASS_HAS_ENUM_SUPERINTERFACE',
+ );
+
/**
* Parameters:
* 0: the name of the first member
diff --git a/pkg/analyzer/lib/src/error/inheritance_override.dart b/pkg/analyzer/lib/src/error/inheritance_override.dart
index b6d1951..5b3d27f 100644
--- a/pkg/analyzer/lib/src/error/inheritance_override.dart
+++ b/pkg/analyzer/lib/src/error/inheritance_override.dart
@@ -12,6 +12,7 @@
import 'package:analyzer/error/listener.dart';
import 'package:analyzer/src/dart/ast/extensions.dart';
import 'package:analyzer/src/dart/element/element.dart';
+import 'package:analyzer/src/dart/element/extensions.dart';
import 'package:analyzer/src/dart/element/inheritance_manager3.dart';
import 'package:analyzer/src/dart/element/type_system.dart';
import 'package:analyzer/src/error/codes.dart';
@@ -128,6 +129,15 @@
return;
}
+ if (!classElement.isAbstract &&
+ classElement.allSupertypes.any((e) => e.isDartCoreEnum)) {
+ reporter.reportErrorForNode(
+ CompileTimeErrorCode.NON_ABSTRACT_CLASS_HAS_ENUM_SUPERINTERFACE,
+ classNameNode,
+ );
+ return;
+ }
+
if (_checkForRecursiveInterfaceInheritance(classElement)) {
return;
}
@@ -332,8 +342,19 @@
}
DartType type = namedType.typeOrThrow;
- if (type is InterfaceType &&
- typeProvider.isNonSubtypableClass(type.element)) {
+ if (type is! InterfaceType) {
+ return false;
+ }
+
+ var interfaceElement = type.element;
+
+ if (interfaceElement.isDartCoreEnum &&
+ library.featureSet.isEnabled(Feature.enhanced_enums) &&
+ classElement.isAbstract) {
+ return false;
+ }
+
+ if (typeProvider.isNonSubtypableClass(interfaceElement)) {
reporter.reportErrorForNode(errorCode, namedType, [type]);
return true;
}
diff --git a/pkg/analyzer/lib/src/generated/error_verifier.dart b/pkg/analyzer/lib/src/generated/error_verifier.dart
index 8b4fd62..6d17094 100644
--- a/pkg/analyzer/lib/src/generated/error_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/error_verifier.dart
@@ -22,6 +22,7 @@
import 'package:analyzer/src/dart/ast/extensions.dart';
import 'package:analyzer/src/dart/element/class_hierarchy.dart';
import 'package:analyzer/src/dart/element/element.dart';
+import 'package:analyzer/src/dart/element/extensions.dart';
import 'package:analyzer/src/dart/element/inheritance_manager3.dart';
import 'package:analyzer/src/dart/element/type.dart';
import 'package:analyzer/src/dart/element/type_provider.dart';
@@ -534,6 +535,7 @@
@override
void visitConstructorReference(ConstructorReference node) {
_typeArgumentsVerifier.checkConstructorReference(node);
+ _checkForInvalidGenerativeConstructorReference(node.constructorName);
}
@override
@@ -842,7 +844,7 @@
DartType type = namedType.typeOrThrow;
if (type is InterfaceType) {
_checkForConstOrNewWithAbstractClass(node, namedType, type);
- _checkForConstOrNewWithEnum(node, namedType, type);
+ _checkForInvalidGenerativeConstructorReference(constructorName);
_checkForConstOrNewWithMixin(node, namedType, type);
_requiredParametersVerifier.visitInstanceCreationExpression(node);
if (node.isConst) {
@@ -2149,21 +2151,6 @@
}
}
- /// Verify that the given instance creation [expression] is not being invoked
- /// on an enum. The [namedType] is the [NamedType] of the [ConstructorName] from
- /// the [InstanceCreationExpression], this is the AST node that the error is
- /// attached to. The [type] is the type being constructed with this
- /// [InstanceCreationExpression].
- ///
- /// See [CompileTimeErrorCode.INSTANTIATE_ENUM].
- void _checkForConstOrNewWithEnum(InstanceCreationExpression expression,
- NamedType namedType, InterfaceType type) {
- if (type.element.isEnum) {
- errorReporter.reportErrorForNode(
- CompileTimeErrorCode.INSTANTIATE_ENUM, namedType);
- }
- }
-
/// Verify that the given [expression] is not a mixin instantiation.
void _checkForConstOrNewWithMixin(InstanceCreationExpression expression,
NamedType namedType, InterfaceType type) {
@@ -2902,6 +2889,25 @@
}
}
+ void _checkForInvalidGenerativeConstructorReference(ConstructorName node) {
+ var constructorElement = node.staticElement;
+ if (constructorElement != null &&
+ constructorElement.isGenerative &&
+ constructorElement.enclosingElement.isEnum) {
+ if (_currentLibrary.featureSet.isEnabled(Feature.enhanced_enums)) {
+ errorReporter.reportErrorForNode(
+ CompileTimeErrorCode.INVALID_REFERENCE_TO_GENERATIVE_ENUM_CONSTRUCTOR,
+ node,
+ );
+ } else {
+ errorReporter.reportErrorForNode(
+ CompileTimeErrorCode.INSTANTIATE_ENUM,
+ node.type2,
+ );
+ }
+ }
+ }
+
/// Verify that if the given [identifier] is part of a constructor
/// initializer, then it does not implicitly reference 'this' expression.
///
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index 6dc5ce0..3b38316 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -69,6 +69,7 @@
import 'package:analyzer/src/generated/source.dart';
import 'package:analyzer/src/generated/static_type_analyzer.dart';
import 'package:analyzer/src/generated/this_access_tracker.dart';
+import 'package:analyzer/src/generated/utilities_dart.dart';
import 'package:analyzer/src/generated/variable_type_provider.dart';
import 'package:analyzer/src/util/ast_data_extractor.dart';
import 'package:meta/meta.dart';
@@ -141,12 +142,19 @@
/// You can use [TypeSystemImpl.upperBoundForType] or
/// [TypeSystemImpl.lowerBoundForType] if you would prefer a known type
/// that represents the bound of the context type.
- static DartType? getContext(AstNode? node) =>
- node?.getProperty(_typeProperty);
+ static DartType? getContext(AstNode? node) {
+ if (node is ArgumentList) {
+ assert(false, 'Nodes of type ${node.runtimeType} should use context');
+ }
+ return node?.getProperty(_typeProperty);
+ }
/// Attach contextual type information [type] to [node] for use during
/// inference.
static void setType(AstNode? node, DartType? type) {
+ if (node is ArgumentList) {
+ assert(false, 'Nodes of type ${node.runtimeType} should use context');
+ }
if (type == null || type.isDynamic) {
clearType(node);
} else {
@@ -441,6 +449,79 @@
bool get _isNonNullableByDefault =>
_featureSet.isEnabled(Feature.non_nullable);
+ void analyzeArgumentList(
+ ArgumentList node, List<ParameterElement>? parameters,
+ {bool isIdentical = false,
+ List<WhyNotPromotedGetter>? whyNotPromotedList}) {
+ whyNotPromotedList ??= [];
+ NodeList<Expression> arguments = node.arguments;
+ var namedParameters = <String, ParameterElement>{};
+ DartType? targetType;
+ Element? methodElement;
+ DartType? invocationContext;
+ if (parameters != null) {
+ for (var i = 0; i < parameters.length; i++) {
+ var parameter = parameters[i];
+ if (parameter.isNamed) {
+ namedParameters[parameter.name] = parameter;
+ }
+ }
+
+ var parent = node.parent;
+ if (parent is MethodInvocation) {
+ targetType = parent.realTarget?.staticType;
+ methodElement = parent.methodName.staticElement;
+ invocationContext = InferenceContext.getContext(parent);
+ }
+ }
+ checkUnreachableNode(node);
+ int length = arguments.length;
+ var flow = flowAnalysis.flow;
+ var positionalParameterIndex = 0;
+ for (var i = 0; i < length; i++) {
+ if (isIdentical && length > 1 && i == 1) {
+ var firstArg = arguments[0];
+ flow?.equalityOp_rightBegin(firstArg, firstArg.typeOrThrow);
+ }
+ var argument = arguments[i];
+ ParameterElement? parameter;
+ if (argument is NamedExpression) {
+ parameter = namedParameters[argument.name.label.name];
+ } else if (parameters != null) {
+ while (positionalParameterIndex < parameters.length) {
+ parameter = parameters[positionalParameterIndex++];
+ if (!parameter.isNamed) {
+ break;
+ }
+ }
+ }
+ DartType? contextType;
+ if (parameter != null) {
+ var parameterType = parameter.type;
+ if (targetType != null) {
+ contextType = typeSystem.refineNumericInvocationContext(
+ targetType, methodElement, invocationContext, parameterType);
+ } else {
+ contextType = parameterType;
+ }
+ }
+ analyzeExpression(argument, contextType);
+ if (flow != null) {
+ whyNotPromotedList.add(flow.whyNotPromoted(arguments[i]));
+ }
+ }
+ if (isIdentical && length > 1) {
+ var secondArg = arguments[1];
+ flow?.equalityOp_end(
+ node.parent as Expression, secondArg, secondArg.typeOrThrow);
+ }
+ }
+
+ void analyzeExpression(Expression expression, DartType? contextType) {
+ InferenceContext.setType(expression, contextType);
+ expression.accept(this);
+ }
+
/// Verify that the arguments in the given [argumentList] can be assigned to
/// their corresponding parameters.
///
@@ -1076,81 +1157,9 @@
}
@override
- void visitArgumentList(ArgumentList node,
- {bool isIdentical = false,
- List<WhyNotPromotedGetter>? whyNotPromotedList}) {
- whyNotPromotedList ??= [];
- var callerType = InferenceContext.getContext(node);
- NodeList<Expression> arguments = node.arguments;
- if (callerType is FunctionType) {
- var parameters = callerType.parameters;
-
- var namedParameters = <String, ParameterElement>{};
- for (var i = 0; i < parameters.length; i++) {
- var parameter = parameters[i];
- if (parameter.isNamed) {
- namedParameters[parameter.name] = parameter;
- }
- }
-
- var parent = node.parent;
- DartType? targetType;
- Element? methodElement;
- DartType? invocationContext;
- if (parent is MethodInvocation) {
- targetType = parent.realTarget?.staticType;
- methodElement = parent.methodName.staticElement;
- invocationContext = InferenceContext.getContext(parent);
- }
-
- //TODO(leafp): Consider using the parameter elements here instead.
- //TODO(leafp): Make sure that the parameter elements are getting
- // setup correctly with inference.
- var positionalParameterIndex = 0;
- for (var i = 0; i < arguments.length; i++) {
- var argument = arguments[i];
- ParameterElement? parameter;
- if (argument is NamedExpression) {
- parameter = namedParameters[argument.name.label.name];
- } else {
- while (positionalParameterIndex < parameters.length) {
- parameter = parameters[positionalParameterIndex++];
- if (!parameter.isNamed) {
- break;
- }
- }
- }
- if (parameter != null) {
- var parameterType = parameter.type;
- if (targetType != null) {
- InferenceContext.setType(
- argument,
- typeSystem.refineNumericInvocationContext(targetType,
- methodElement, invocationContext, parameterType));
- } else {
- InferenceContext.setType(argument, parameterType);
- }
- }
- }
- }
- checkUnreachableNode(node);
- int length = arguments.length;
- var flow = flowAnalysis.flow;
- for (var i = 0; i < length; i++) {
- if (isIdentical && length > 1 && i == 1) {
- var firstArg = arguments[0];
- flow?.equalityOp_rightBegin(firstArg, firstArg.typeOrThrow);
- }
- arguments[i].accept(this);
- if (flow != null) {
- whyNotPromotedList.add(flow.whyNotPromoted(arguments[i]));
- }
- }
- if (isIdentical && length > 1) {
- var secondArg = arguments[1];
- flow?.equalityOp_end(
- node.parent as Expression, secondArg, secondArg.typeOrThrow);
- }
+ void visitArgumentList(ArgumentList node) {
+ assert(false, 'analyzeArgumentList should be used instead');
+ analyzeArgumentList(node, null);
}
@override
@@ -1554,7 +1563,6 @@
if (arguments != null) {
var argumentList = arguments.argumentList;
if (constructor != null) {
- InferenceContext.setType(argumentList, constructor.type);
argumentList.correspondingStaticParameters =
ResolverVisitor.resolveArgumentsToParameters(
argumentList: argumentList,
@@ -1656,8 +1664,16 @@
node.extensionName.accept(this);
node.typeArguments?.accept(this);
- ExtensionMemberResolver(this).setOverrideReceiverContextType(node);
- visitArgumentList(node.argumentList,
+ var contextType =
+ ExtensionMemberResolver(this).computeOverrideReceiverContextType(node);
+ analyzeArgumentList(
+ node.argumentList,
+ contextType == null
+ ? null
+ : [
+ ParameterElementImpl.synthetic(
+ null, contextType, ParameterKind.REQUIRED)
+ ],
whyNotPromotedList: whyNotPromotedList);
extensionResolver.resolveOverride(node, whyNotPromotedList);
@@ -1686,8 +1702,8 @@
}
@override
- void visitForElement(ForElement node) {
- _forResolver.resolveElement(node as ForElementImpl);
+ void visitForElement(ForElement node, {CollectionLiteralContext? context}) {
+ _forResolver.resolveElement(node as ForElementImpl, context);
}
@override
@@ -1814,7 +1830,7 @@
void visitHideCombinator(HideCombinator node) {}
@override
- void visitIfElement(IfElement node) {
+ void visitIfElement(IfElement node, {CollectionLiteralContext? context}) {
flowAnalysis.flow?.ifStatement_conditionBegin();
Expression condition = node.condition;
InferenceContext.setType(condition, typeProvider.boolType);
@@ -1826,13 +1842,13 @@
whyNotPromoted: whyNotPromoted);
flowAnalysis.flow?.ifStatement_thenBegin(condition, node);
- node.thenElement.accept(this);
+ (node.thenElement as CollectionElementImpl).resolveElement(this, context);
nullSafetyDeadCodeVerifier.flowEnd(node.thenElement);
var elseElement = node.elseElement;
if (elseElement != null) {
flowAnalysis.flow?.ifStatement_elseBegin();
- elseElement.accept(this);
+ (elseElement as CollectionElementImpl).resolveElement(this, context);
nullSafetyDeadCodeVerifier.flowEnd(elseElement);
}
@@ -1986,9 +2002,11 @@
}
@override
- void visitMapLiteralEntry(MapLiteralEntry node) {
+ void visitMapLiteralEntry(MapLiteralEntry node,
+ {CollectionLiteralContext? context}) {
checkUnreachableNode(node);
- node.visitChildren(this);
+ analyzeExpression(node.key, context?.keyType);
+ analyzeExpression(node.value, context?.valueType);
}
@override
@@ -2221,8 +2239,7 @@
var whyNotPromotedList = <Map<DartType, NonPromotionReason> Function()>[];
elementResolver.visitRedirectingConstructorInvocation(
node as RedirectingConstructorInvocationImpl);
- InferenceContext.setType(node.argumentList, node.staticElement?.type);
- visitArgumentList(node.argumentList,
+ analyzeArgumentList(node.argumentList, node.staticElement?.parameters,
whyNotPromotedList: whyNotPromotedList);
checkForArgumentTypesNotAssignableInList(
node.argumentList, whyNotPromotedList);
@@ -2285,9 +2302,14 @@
}
@override
- void visitSpreadElement(SpreadElement node) {
+ void visitSpreadElement(SpreadElement node,
+ {CollectionLiteralContext? context}) {
+ var iterableType = context?.iterableType;
+ if (iterableType != null && _isNonNullableByDefault && node.isNullAware) {
+ iterableType = typeSystem.makeNullable(iterableType);
+ }
checkUnreachableNode(node);
- node.visitChildren(this);
+ analyzeExpression(node.expression, iterableType);
if (!node.isNullAware) {
nullableDereferenceVerifier.expression(
@@ -2314,8 +2336,7 @@
var whyNotPromotedList = <Map<DartType, NonPromotionReason> Function()>[];
elementResolver.visitSuperConstructorInvocation(
node as SuperConstructorInvocationImpl);
- InferenceContext.setType(node.argumentList, node.staticElement?.type);
- visitArgumentList(node.argumentList,
+ analyzeArgumentList(node.argumentList, node.staticElement?.parameters,
whyNotPromotedList: whyNotPromotedList);
checkForArgumentTypesNotAssignableInList(
node.argumentList, whyNotPromotedList);
@@ -2781,15 +2802,17 @@
}
@override
- void visitIfElement(IfElement node) {
+ void visitIfElement(IfElement node, {CollectionLiteralContext? context}) {
var conditionalKnownValue =
_migrationResolutionHooks.getConditionalKnownValue(node);
if (conditionalKnownValue == null) {
- super.visitIfElement(node);
+ super.visitIfElement(node, context: context);
return;
} else {
- (conditionalKnownValue ? node.thenElement : node.elseElement)
- ?.accept(this);
+ var element = conditionalKnownValue ? node.thenElement : node.elseElement;
+ if (element != null) {
+ (element as CollectionElementImpl).resolveElement(this, context);
+ }
}
}
diff --git a/pkg/analyzer/messages.yaml b/pkg/analyzer/messages.yaml
index c45122e..8fa7b1a 100644
--- a/pkg/analyzer/messages.yaml
+++ b/pkg/analyzer/messages.yaml
@@ -5713,6 +5713,7 @@
instantiated:
```dart
+ // @dart = 2.16
enum E {a}
var e = [!E!]();
@@ -5724,6 +5725,7 @@
constants defined in the enum:
```dart
+ // @dart = 2.16
enum E {a}
var e = E.a;
@@ -6504,6 +6506,9 @@
void m2(String s) {}
}
```
+ INVALID_REFERENCE_TO_GENERATIVE_ENUM_CONSTRUCTOR:
+ problemMessage: Generative enum constructors can only be used as targets of redirection.
+ correctionMessage: Try using a factory constructor, or an enum constant.
INVALID_REFERENCE_TO_THIS:
problemMessage: "Invalid reference to 'this' expression."
hasPublishedDocs: true
@@ -8031,6 +8036,10 @@
A f() => A();
```
+ NON_ABSTRACT_CLASS_HAS_ENUM_SUPERINTERFACE:
+ sharedName: NON_ABSTRACT_CLASS_HAS_ENUM_SUPERINTERFACE
+ problemMessage: "Non-abstract classes can't have 'Enum' as a superinterface."
+ correctionMessage: Try specifying a different interface, or remove it from the list.
NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FIVE_PLUS:
sharedName: NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER
problemMessage: "Missing concrete implementations of '{0}', '{1}', '{2}', '{3}', and {4} more."
diff --git a/pkg/analyzer/test/src/dart/resolution/context_collection_resolution.dart b/pkg/analyzer/test/src/dart/resolution/context_collection_resolution.dart
index 3f5a183..9f2e227 100644
--- a/pkg/analyzer/test/src/dart/resolution/context_collection_resolution.dart
+++ b/pkg/analyzer/test/src/dart/resolution/context_collection_resolution.dart
@@ -440,6 +440,11 @@
String? get testPackageLanguageVersion => '2.14';
}
+mixin WithoutEnhancedEnumsMixin on PubPackageResolutionTest {
+ @override
+ String? get testPackageLanguageVersion => '2.16';
+}
+
mixin WithoutNullSafetyMixin on PubPackageResolutionTest {
@override
String? get testPackageLanguageVersion => '2.9';
diff --git a/pkg/analyzer/test/src/diagnostics/implements_disallowed_class_test.dart b/pkg/analyzer/test/src/diagnostics/implements_disallowed_class_test.dart
index 84629e0..37f5e9e 100644
--- a/pkg/analyzer/test/src/diagnostics/implements_disallowed_class_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/implements_disallowed_class_test.dart
@@ -23,6 +23,38 @@
]);
}
+ test_class_dartCoreEnum_abstract() async {
+ await assertNoErrorsInCode('''
+abstract class A implements Enum {}
+''');
+ }
+
+ test_class_dartCoreEnum_concrete_direct() async {
+ await assertErrorsInCode('''
+class A implements Enum {}
+''', [
+ error(CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS, 19, 4),
+ ]);
+ }
+
+ test_class_dartCoreEnum_language216_abstract() async {
+ await assertErrorsInCode('''
+// @dart = 2.16
+abstract class A implements Enum {}
+''', [
+ error(CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS, 44, 4),
+ ]);
+ }
+
+ test_class_dartCoreEnum_language216_concrete() async {
+ await assertErrorsInCode('''
+// @dart = 2.16
+class A implements Enum {}
+''', [
+ error(CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS, 35, 4),
+ ]);
+ }
+
test_class_double() async {
await assertErrorsInCode('''
class A implements double {}
@@ -49,6 +81,16 @@
]);
}
+ test_class_FutureOr_typedef() async {
+ await assertErrorsInCode('''
+import 'dart:async';
+typedef F = FutureOr<void>;
+class A implements F {}
+''', [
+ error(CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS, 68, 1),
+ ]);
+ }
+
test_class_FutureOr_typeVariable() async {
await assertErrorsInCode('''
import 'dart:async';
@@ -109,6 +151,42 @@
]);
}
+ test_classTypeAlias_dartCoreEnum_abstract() async {
+ await assertNoErrorsInCode('''
+class M {}
+abstract class A = Object with M implements Enum;
+''');
+ }
+
+ test_classTypeAlias_dartCoreEnum_concrete_direct() async {
+ await assertErrorsInCode('''
+class M {}
+class A = Object with M implements Enum;
+''', [
+ error(CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS, 46, 4),
+ ]);
+ }
+
+ test_classTypeAlias_dartCoreEnum_language216_abstract() async {
+ await assertErrorsInCode('''
+// @dart = 2.16
+mixin M {}
+abstract class A = Object with M implements Enum;
+''', [
+ error(CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS, 71, 4),
+ ]);
+ }
+
+ test_classTypeAlias_dartCoreEnum_language216_concrete() async {
+ await assertErrorsInCode('''
+// @dart = 2.16
+mixin M {}
+class A = Object with M implements Enum;
+''', [
+ error(CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS, 62, 4),
+ ]);
+ }
+
test_classTypeAlias_double() async {
await assertErrorsInCode(r'''
class A {}
@@ -181,6 +259,21 @@
]);
}
+ test_mixin_dartCoreEnum() async {
+ await assertNoErrorsInCode('''
+mixin M implements Enum {}
+''');
+ }
+
+ test_mixin_dartCoreEnum_language216() async {
+ await assertErrorsInCode('''
+// @dart = 2.16
+mixin M implements Enum {}
+''', [
+ error(CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS, 35, 4),
+ ]);
+ }
+
test_mixin_int() async {
await assertErrorsInCode(r'''
mixin M implements int {}
diff --git a/pkg/analyzer/test/src/diagnostics/instantiate_enum_test.dart b/pkg/analyzer/test/src/diagnostics/instantiate_enum_test.dart
index 0fd804c..2d6b19e 100644
--- a/pkg/analyzer/test/src/diagnostics/instantiate_enum_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/instantiate_enum_test.dart
@@ -14,7 +14,8 @@
}
@reflectiveTest
-class InstantiateEnumTest extends PubPackageResolutionTest {
+class InstantiateEnumTest extends PubPackageResolutionTest
+ with WithoutEnhancedEnumsMixin {
test_const() async {
await assertErrorsInCode(r'''
enum E { ONE }
diff --git a/pkg/analyzer/test/src/diagnostics/invalid_reference_to_generative_enum_constructor_test.dart b/pkg/analyzer/test/src/diagnostics/invalid_reference_to_generative_enum_constructor_test.dart
new file mode 100644
index 0000000..913b93f
--- /dev/null
+++ b/pkg/analyzer/test/src/diagnostics/invalid_reference_to_generative_enum_constructor_test.dart
@@ -0,0 +1,177 @@
+// 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.
+
+import 'package:analyzer/src/error/codes.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import '../dart/resolution/context_collection_resolution.dart';
+
+main() {
+ defineReflectiveSuite(() {
+ defineReflectiveTests(InvalidReferenceToGenerativeEnumConstructorTest);
+ });
+}
+
+@reflectiveTest
+class InvalidReferenceToGenerativeEnumConstructorTest
+ extends PubPackageResolutionTest {
+ test_factory_named() async {
+ await assertNoErrorsInCode('''
+enum E {
+ v();
+
+ factory E.named() => v;
+}
+
+void f() {
+ E.named;
+ E.named();
+}
+''');
+ }
+
+ test_factory_unnamed() async {
+ await assertNoErrorsInCode('''
+enum E {
+ v.named();
+
+ const E.named();
+ factory E() => v;
+}
+
+void f() {
+ E.new;
+ E();
+}
+''');
+ }
+
+ test_generative_named_constructorReference() async {
+ await assertErrorsInCode('''
+enum E {
+ v.named();
+
+ const E.named();
+}
+
+void f() {
+ E.named;
+}
+''', [
+ error(
+ CompileTimeErrorCode.INVALID_REFERENCE_TO_GENERATIVE_ENUM_CONSTRUCTOR,
+ 58,
+ 7),
+ ]);
+ }
+
+ test_generative_named_instanceCreation_implicitNew() async {
+ await assertErrorsInCode('''
+enum E {
+ v.named();
+
+ const E.named();
+}
+
+void f() {
+ E.named();
+}
+''', [
+ error(
+ CompileTimeErrorCode.INVALID_REFERENCE_TO_GENERATIVE_ENUM_CONSTRUCTOR,
+ 58,
+ 7),
+ ]);
+ }
+
+ test_generative_named_redirectingConstructorInvocation() async {
+ await assertNoErrorsInCode('''
+enum E {
+ v;
+
+ const E() : this.named();
+ const E.named();
+}
+''');
+ }
+
+ test_generative_unnamed_constructorReference() async {
+ await assertErrorsInCode('''
+enum E {
+ v
+}
+
+void f() {
+ E.new;
+}
+''', [
+ error(
+ CompileTimeErrorCode.INVALID_REFERENCE_TO_GENERATIVE_ENUM_CONSTRUCTOR,
+ 29,
+ 5),
+ ]);
+ }
+
+ test_generative_unnamed_instanceCreation_explicitConst() async {
+ await assertErrorsInCode('''
+enum E {
+ v
+}
+
+void f() {
+ const E();
+}
+''', [
+ error(
+ CompileTimeErrorCode.INVALID_REFERENCE_TO_GENERATIVE_ENUM_CONSTRUCTOR,
+ 35,
+ 1),
+ ]);
+ }
+
+ test_generative_unnamed_instanceCreation_explicitNew() async {
+ await assertErrorsInCode('''
+enum E {
+ v
+}
+
+void f() {
+ new E();
+}
+''', [
+ error(
+ CompileTimeErrorCode.INVALID_REFERENCE_TO_GENERATIVE_ENUM_CONSTRUCTOR,
+ 33,
+ 1),
+ ]);
+ }
+
+ test_generative_unnamed_instanceCreation_implicitNew() async {
+ await assertErrorsInCode('''
+enum E {
+ v
+}
+
+void f() {
+ E();
+}
+''', [
+ error(
+ CompileTimeErrorCode.INVALID_REFERENCE_TO_GENERATIVE_ENUM_CONSTRUCTOR,
+ 29,
+ 1),
+ ]);
+ }
+
+ test_generative_unnamed_redirectingConstructorInvocation() async {
+ await assertNoErrorsInCode('''
+enum E {
+ v;
+
+ const E();
+ const E.named() : this();
+}
+''');
+ }
+}
diff --git a/pkg/analyzer/test/src/diagnostics/mixin_super_class_constraint_disallowed_class_test.dart b/pkg/analyzer/test/src/diagnostics/mixin_super_class_constraint_disallowed_class_test.dart
index f52ca1e..20d8612 100644
--- a/pkg/analyzer/test/src/diagnostics/mixin_super_class_constraint_disallowed_class_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/mixin_super_class_constraint_disallowed_class_test.dart
@@ -16,6 +16,32 @@
@reflectiveTest
class MixinSuperClassConstraintDisallowedClassTest
extends PubPackageResolutionTest {
+ test_dartCoreEnum() async {
+ await assertNoErrorsInCode(r'''
+mixin M on Enum {}
+''');
+ }
+
+ test_dartCoreEnum_language216() async {
+ await assertErrorsInCode(r'''
+// @dart = 2.16
+mixin M on Enum {}
+''', [
+ error(CompileTimeErrorCode.MIXIN_SUPER_CLASS_CONSTRAINT_DISALLOWED_CLASS,
+ 27, 4),
+ ]);
+
+ var element = findElement.mixin('M');
+ assertElementTypes(element.superclassConstraints, ['Enum']);
+
+ var typeRef = findNode.namedType('Enum {}');
+ assertNamedType(
+ typeRef,
+ findElement.importFind('dart:core').class_('Enum'),
+ 'Enum',
+ );
+ }
+
test_int() async {
await assertErrorsInCode(r'''
mixin M on int {}
diff --git a/pkg/analyzer/test/src/diagnostics/non_abstract_class_has_enum_superinterface_test.dart b/pkg/analyzer/test/src/diagnostics/non_abstract_class_has_enum_superinterface_test.dart
new file mode 100644
index 0000000..b0a423c
--- /dev/null
+++ b/pkg/analyzer/test/src/diagnostics/non_abstract_class_has_enum_superinterface_test.dart
@@ -0,0 +1,45 @@
+// 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.
+
+import 'package:analyzer/src/error/codes.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import '../dart/resolution/context_collection_resolution.dart';
+
+main() {
+ defineReflectiveSuite(() {
+ defineReflectiveTests(NonAbstractClassHasEnumSuperinterfaceTest);
+ });
+}
+
+@reflectiveTest
+class NonAbstractClassHasEnumSuperinterfaceTest
+ extends PubPackageResolutionTest {
+ test_class_abstract() async {
+ await assertNoErrorsInCode('''
+abstract class A implements Enum {}
+''');
+ }
+
+ test_class_concrete_indirect() async {
+ await assertErrorsInCode('''
+abstract class A implements Enum {}
+class B implements A {}
+''', [
+ error(CompileTimeErrorCode.NON_ABSTRACT_CLASS_HAS_ENUM_SUPERINTERFACE, 42,
+ 1),
+ ]);
+ }
+
+ test_classTypeAlias_concrete_indirect() async {
+ await assertErrorsInCode('''
+mixin M {}
+abstract class A implements Enum {}
+class B = Object with M implements A;
+''', [
+ error(CompileTimeErrorCode.NON_ABSTRACT_CLASS_HAS_ENUM_SUPERINTERFACE, 53,
+ 1),
+ ]);
+ }
+}
diff --git a/pkg/analyzer/test/src/diagnostics/test_all.dart b/pkg/analyzer/test/src/diagnostics/test_all.dart
index 21cd92f..32e5d07 100644
--- a/pkg/analyzer/test/src/diagnostics/test_all.dart
+++ b/pkg/analyzer/test/src/diagnostics/test_all.dart
@@ -341,6 +341,8 @@
import 'invalid_override_of_non_virtual_member_test.dart'
as invalid_override_of_non_virtual_member;
import 'invalid_override_test.dart' as invalid_override;
+import 'invalid_reference_to_generative_enum_constructor_test.dart'
+ as invalid_reference_to_generative_enum_constructor;
import 'invalid_reference_to_this_test.dart' as invalid_reference_to_this;
import 'invalid_required_named_param_test.dart' as invalid_required_named_param;
import 'invalid_required_optional_positional_param_test.dart'
@@ -465,6 +467,8 @@
import 'no_default_super_constructor_test.dart' as no_default_super_constructor;
import 'no_generative_constructors_in_superclass_test.dart'
as no_generative_constructors_in_superclass;
+import 'non_abstract_class_has_enum_superinterface_test.dart'
+ as non_abstract_class_has_enum_superinterface;
import 'non_abstract_class_inherits_abstract_member_test.dart'
as non_abstract_class_inherits_abstract_member;
import 'non_bool_condition_test.dart' as non_bool_condition;
@@ -974,6 +978,7 @@
invalid_override_different_default_values_positional.main();
invalid_override_of_non_virtual_member.main();
invalid_override.main();
+ invalid_reference_to_generative_enum_constructor.main();
invalid_reference_to_this.main();
invalid_required_named_param.main();
invalid_required_optional_positional_param.main();
@@ -1051,6 +1056,7 @@
no_combined_super_signature.main();
no_default_super_constructor.main();
no_generative_constructors_in_superclass.main();
+ non_abstract_class_has_enum_superinterface.main();
non_abstract_class_inherits_abstract_member.main();
non_bool_condition.main();
non_bool_expression.main();
diff --git a/pkg/analyzer/tool/diagnostics/diagnostics.md b/pkg/analyzer/tool/diagnostics/diagnostics.md
index c8454b0..76fd405 100644
--- a/pkg/analyzer/tool/diagnostics/diagnostics.md
+++ b/pkg/analyzer/tool/diagnostics/diagnostics.md
@@ -6616,6 +6616,7 @@
instantiated:
{% prettify dart tag=pre+code %}
+// @dart = 2.16
enum E {a}
var e = [!E!]();
@@ -6627,6 +6628,7 @@
constants defined in the enum:
{% prettify dart tag=pre+code %}
+// @dart = 2.16
enum E {a}
var e = E.a;
diff --git a/pkg/compiler/lib/src/util/testing.dart b/pkg/compiler/lib/src/util/testing.dart
new file mode 100644
index 0000000..405d495
--- /dev/null
+++ b/pkg/compiler/lib/src/util/testing.dart
@@ -0,0 +1,18 @@
+// 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.
+
+// @dart = 2.15
+
+/// Marks its argument as live and prevents tree-shaking.
+///
+/// This is more hermetic than using `package:expect` or `print`. This function
+/// may need to be updated as optimizations improve.
+@pragma('dart2js:noInline')
+void makeLive(dynamic x) => x;
+
+@pragma('dart2js:noInline')
+void _subtypeAtRuntime<Sub, Super>() => makeLive(<Sub>[] is List<Super>);
+
+void subtype<Sub extends Super, Super>() => _subtypeAtRuntime<Sub, Super>();
+void notSubtype<Sub, Super>() => _subtypeAtRuntime<Sub, Super>();
diff --git a/pkg/compiler/test/rti/data/as.dart b/pkg/compiler/test/rti/data/as.dart
index 0c2c5da..5daeea2 100644
--- a/pkg/compiler/test/rti/data/as.dart
+++ b/pkg/compiler/test/rti/data/as.dart
@@ -6,7 +6,7 @@
// Derived from tests/web_2/generic_type_error_message_test.
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
/*class: Foo:*/
class Foo<T extends num> {}
@@ -30,7 +30,7 @@
void test(dynamic object, Type type, {bool expectTypeArguments}) {
bool caught = false;
try {
- print(type);
+ makeLive(type);
object as List<String>;
} catch (e) {
String expected = '$type';
@@ -38,10 +38,9 @@
expected = expected.substring(0, expected.indexOf('<'));
}
expected = "'$expected'";
- Expect.isTrue(e.toString().contains(expected),
- 'Expected "$expected" in the message: $e');
+ makeLive(e.toString().contains(expected));
caught = true;
- print(e);
+ makeLive(e);
}
- Expect.isTrue(caught);
+ makeLive(caught);
}
diff --git a/pkg/compiler/test/rti/data/async_foreach.dart b/pkg/compiler/test/rti/data/async_foreach.dart
index 2aa3f8a..1a14bd2 100644
--- a/pkg/compiler/test/rti/data/async_foreach.dart
+++ b/pkg/compiler/test/rti/data/async_foreach.dart
@@ -4,6 +4,8 @@
// @dart = 2.7
+import 'package:compiler/src/util/testing.dart';
+
/*spec.class: Class:direct,explicit=[Class.T*],implicit=[Class.T],needsArgs*/
/*prod.class: Class:needsArgs*/
class Class<T> {
@@ -17,7 +19,7 @@
// async.errorHandler callback.
list.forEach(
/*needsSignature*/
- (x) => print(x));
+ (x) => makeLive(x));
}
}
diff --git a/pkg/compiler/test/rti/data/async_foreach_nonasync.dart b/pkg/compiler/test/rti/data/async_foreach_nonasync.dart
index 36ce830..0cb5ac1 100644
--- a/pkg/compiler/test/rti/data/async_foreach_nonasync.dart
+++ b/pkg/compiler/test/rti/data/async_foreach_nonasync.dart
@@ -4,6 +4,8 @@
// @dart = 2.7
+import 'package:compiler/src/util/testing.dart';
+
/*spec.class: Class:direct,explicit=[Class.T*],implicit=[Class.T],needsArgs*/
class Class<T> {
method() {
@@ -12,7 +14,7 @@
// arguments on `Class`. See the 'async_foreach.dart' test.
list.forEach(
/*spec.needsSignature*/
- (x) => print(x));
+ (x) => makeLive(x));
}
}
diff --git a/pkg/compiler/test/rti/data/call_typed.dart b/pkg/compiler/test/rti/data/call_typed.dart
index 720048e..249fd21 100644
--- a/pkg/compiler/test/rti/data/call_typed.dart
+++ b/pkg/compiler/test/rti/data/call_typed.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
class A {
call(int i) {}
@@ -14,6 +14,6 @@
test(o) => o is Function(int);
main() {
- Expect.isFalse(test(new A()));
- Expect.isFalse(test(null));
+ makeLive(test(new A()));
+ makeLive(test(null));
}
diff --git a/pkg/compiler/test/rti/data/call_typed_generic.dart b/pkg/compiler/test/rti/data/call_typed_generic.dart
index bf70f5f..cc7b472 100644
--- a/pkg/compiler/test/rti/data/call_typed_generic.dart
+++ b/pkg/compiler/test/rti/data/call_typed_generic.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
/*spec.class: A:direct,explicit=[A.T*],needsArgs*/
class A<T> {
@@ -15,7 +15,7 @@
test(o) => o is Function(int);
main() {
- Expect.isFalse(test(new A<int>()));
- Expect.isFalse(test(new A<String>()));
+ makeLive(test(new A<int>()));
+ makeLive(test(new A<String>()));
new A().call(null); // Use .call to ensure it is live.
}
diff --git a/pkg/compiler/test/rti/data/function_subtype_local5.dart b/pkg/compiler/test/rti/data/function_subtype_local5.dart
index 9d8459d..bf14939 100644
--- a/pkg/compiler/test/rti/data/function_subtype_local5.dart
+++ b/pkg/compiler/test/rti/data/function_subtype_local5.dart
@@ -3,13 +3,14 @@
// BSD-style license that can be found in the LICENSE file.
// @dart = 2.7
+
+import 'package:compiler/src/util/testing.dart';
+
// Dart test program for constructors and initializers.
// Check function subtyping for local functions on generic type against generic
// typedefs.
-import 'package:expect/expect.dart';
-
typedef int Foo<T>(T a, [String b]);
typedef int Bar<T>(T a, [String b]);
typedef int Baz<T>(T a, {String b});
@@ -27,17 +28,17 @@
/*needsSignature*/
int baz(bool a, {String b}) => null;
- Expect.equals(expectedResult, foo is Foo<T>, 'foo is Foo<$nameOfT>');
- Expect.equals(expectedResult, foo is Bar<T>, 'foo is Bar<$nameOfT>');
- Expect.isFalse(foo is Baz<T>, 'foo is Baz<$nameOfT>');
- Expect.equals(expectedResult, foo is Boz<T>, 'foo is Boz<$nameOfT>');
- Expect.isFalse(foo is Biz<T>, 'foo is Biz<$nameOfT>');
+ makeLive(expectedResult == foo is Foo<T>);
+ makeLive(expectedResult == foo is Bar<T>);
+ makeLive(foo is Baz<T>);
+ makeLive(expectedResult == foo is Boz<T>);
+ makeLive(foo is Biz<T>);
- Expect.isFalse(baz is Foo<T>, 'baz is Foo<$nameOfT>');
- Expect.isFalse(baz is Bar<T>, 'baz is Bar<$nameOfT>');
- Expect.equals(expectedResult, baz is Baz<T>, 'baz is Baz<$nameOfT>');
- Expect.equals(expectedResult, baz is Boz<T>, 'baz is Boz<$nameOfT>');
- Expect.isFalse(baz is Biz<T>, 'bar is Biz<$nameOfT>');
+ makeLive(baz is Foo<T>);
+ makeLive(baz is Bar<T>);
+ makeLive(expectedResult == baz is Baz<T>);
+ makeLive(expectedResult == baz is Boz<T>);
+ makeLive(baz is Biz<T>);
}
}
diff --git a/pkg/compiler/test/rti/data/generic_bounds.dart b/pkg/compiler/test/rti/data/generic_bounds.dart
index 4693b39..ef3e3f5 100644
--- a/pkg/compiler/test/rti/data/generic_bounds.dart
+++ b/pkg/compiler/test/rti/data/generic_bounds.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
/*spec.class: Class1a:explicit=[Class1a*]*/
class Class1a {}
@@ -41,15 +41,15 @@
method10<T extends Class4>() => null;
main() {
- /*needsArgs,needsSignature,selectors=[Selector(call, call, arity=0, types=1)]*/
+ /*spec.needsArgs,selectors=[Selector(call, call, arity=0, types=1)]*/
+ /*prod.*/
method7<T extends Class1a>() => null;
- /*needsArgs,needsSignature,selectors=[Selector(call, call, arity=0, types=1)]*/
+ /*spec.needsArgs,selectors=[Selector(call, call, arity=0, types=1)]*/
+ /*prod.*/
method8<T extends Class2a<num>>() => null;
- /*needsArgs,needsSignature,selectors=[Selector(call, call, arity=0, types=1)]*/ method9<
- T>() =>
- null;
+ /**/ method9<T>() => null;
dynamic f1 = method1;
dynamic f2 = method2;
@@ -69,21 +69,13 @@
f8<Class2b<int>>();
f9<int>();
- if (typeAssertionsEnabled) {
- Expect.throws(/*needsSignature*/ () => f1<Class2a<num>>());
- Expect.throws(/*needsSignature*/ () => f2<Class2b<String>>());
- Expect.throws(/*needsSignature*/ () => c3.method4<Class2a<num>>());
- Expect.throws(/*needsSignature*/ () => c3.method5<Class2b<String>>());
- Expect.throws(/*needsSignature*/ () => f7<Class2a<num>>());
- Expect.throws(/*needsSignature*/ () => f8<Class2b<String>>());
- } else {
- f1<Class2a<num>>();
- f2<Class2b<String>>();
- c3.method4<Class2a<num>>();
- c3.method5<Class2b<String>>();
- f7<Class2a<num>>();
- f8<Class2b<String>>();
- }
+ makeLive(/**/ () => f1<Class2a<num>>());
+ makeLive(/**/ () => f2<Class2b<String>>());
+ makeLive(/**/ () => c3.method4<Class2a<num>>());
+ makeLive(
+ /**/ () => c3.method5<Class2b<String>>());
+ makeLive(/**/ () => f7<Class2a<num>>());
+ makeLive(/**/ () => f8<Class2b<String>>());
method10();
}
diff --git a/pkg/compiler/test/rti/data/generic_class_is2.dart b/pkg/compiler/test/rti/data/generic_class_is2.dart
index 9b121f0..2703f47 100644
--- a/pkg/compiler/test/rti/data/generic_class_is2.dart
+++ b/pkg/compiler/test/rti/data/generic_class_is2.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
/*class: A:implicit=[List<A<C*>*>,List<A<C2*>*>]*/
class A<T> {}
@@ -27,6 +27,6 @@
class C2 implements C {}
main() {
- Expect.isTrue(new B<List<A<C>>>().method(new List<A1>()));
- Expect.isFalse(new B<List<A<C2>>>().method(new List<A1>()));
+ makeLive(new B<List<A<C>>>().method(new List<A1>()));
+ makeLive(new B<List<A<C2>>>().method(new List<A1>()));
}
diff --git a/pkg/compiler/test/rti/data/generic_creation.dart b/pkg/compiler/test/rti/data/generic_creation.dart
index 2125b27..5c7ba40 100644
--- a/pkg/compiler/test/rti/data/generic_creation.dart
+++ b/pkg/compiler/test/rti/data/generic_creation.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import "package:expect/expect.dart";
+import 'package:compiler/src/util/testing.dart';
/*class: A:needsArgs*/
@@ -36,7 +36,7 @@
class W {}
-sameType(a, b) => Expect.equals(a.runtimeType, b.runtimeType);
+sameType(a, b) => makeLive(a.runtimeType == b.runtimeType);
main() {
A a = new A<U, V, W>();
diff --git a/pkg/compiler/test/rti/data/generic_method1.dart b/pkg/compiler/test/rti/data/generic_method1.dart
index bc43b59..f0f6f81 100644
--- a/pkg/compiler/test/rti/data/generic_method1.dart
+++ b/pkg/compiler/test/rti/data/generic_method1.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import "package:expect/expect.dart";
+import 'package:compiler/src/util/testing.dart';
/*class: A:deps=[method2],direct,explicit=[A.T*],needsArgs*/
class A<T> {
@@ -36,6 +36,6 @@
}
main() {
- Expect.isTrue(method1<BB>());
- Expect.isFalse(method1<String>());
+ makeLive(method1<BB>());
+ makeLive(method1<String>());
}
diff --git a/pkg/compiler/test/rti/data/generic_method2.dart b/pkg/compiler/test/rti/data/generic_method2.dart
index d522565..9fc5d87 100644
--- a/pkg/compiler/test/rti/data/generic_method2.dart
+++ b/pkg/compiler/test/rti/data/generic_method2.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import "package:expect/expect.dart";
+import 'package:compiler/src/util/testing.dart';
/*class: A:deps=[B],direct,explicit=[A.T*],needsArgs*/
class A<T> {
@@ -32,6 +32,6 @@
}
main() {
- Expect.isTrue(method1<BB>());
- Expect.isFalse(method1<String>());
+ makeLive(method1<BB>());
+ makeLive(method1<String>());
}
diff --git a/pkg/compiler/test/rti/data/generic_method3.dart b/pkg/compiler/test/rti/data/generic_method3.dart
index affff5e..2bc69b6 100644
--- a/pkg/compiler/test/rti/data/generic_method3.dart
+++ b/pkg/compiler/test/rti/data/generic_method3.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import "package:expect/expect.dart";
+import 'package:compiler/src/util/testing.dart';
/*class: A:deps=[method2],direct,explicit=[A.T*],needsArgs*/
class A<T> {
@@ -30,6 +30,6 @@
}
main() {
- Expect.isTrue(new B<BB>().foo());
- Expect.isFalse(new B<String>().foo());
+ makeLive(new B<BB>().foo());
+ makeLive(new B<String>().foo());
}
diff --git a/pkg/compiler/test/rti/data/generic_method4.dart b/pkg/compiler/test/rti/data/generic_method4.dart
index 645530a..d1b48b4 100644
--- a/pkg/compiler/test/rti/data/generic_method4.dart
+++ b/pkg/compiler/test/rti/data/generic_method4.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import "package:expect/expect.dart";
+import 'package:compiler/src/util/testing.dart';
/*class: A:deps=[C.method2],direct,explicit=[A.T*],needsArgs*/
class A<T> {
@@ -39,6 +39,6 @@
main() {
var c = new C();
- Expect.isTrue(c.method1<BB>());
- Expect.isFalse(c.method1<String>());
+ makeLive(c.method1<BB>());
+ makeLive(c.method1<String>());
}
diff --git a/pkg/compiler/test/rti/data/generic_method_tearoff.dart b/pkg/compiler/test/rti/data/generic_method_tearoff.dart
index 5fff48f..2cd8f5e 100644
--- a/pkg/compiler/test/rti/data/generic_method_tearoff.dart
+++ b/pkg/compiler/test/rti/data/generic_method_tearoff.dart
@@ -4,6 +4,8 @@
// @dart = 2.7
+import 'package:compiler/src/util/testing.dart';
+
T method1a<T>() => null;
T method1b<T>() => null;
@@ -20,5 +22,5 @@
c.method2a();
T Function<T>() f2 = c.method2b;
- print(f1.runtimeType == f2.runtimeType);
+ makeLive(f1.runtimeType == f2.runtimeType);
}
diff --git a/pkg/compiler/test/rti/data/generic_methods_dynamic_05.dart b/pkg/compiler/test/rti/data/generic_methods_dynamic_05.dart
index 8b4ebb0..051894e 100644
--- a/pkg/compiler/test/rti/data/generic_methods_dynamic_05.dart
+++ b/pkg/compiler/test/rti/data/generic_methods_dynamic_05.dart
@@ -4,6 +4,8 @@
// @dart = 2.7
+import 'package:compiler/src/util/testing.dart';
+
// Test derived from language_2/generic_methods_dynamic_test/05
/*spec.class: global#JSArray:deps=[ArrayIterator,List],explicit=[JSArray,JSArray.E,JSArray<ArrayIterator.E>],implicit=[JSArray.E],indirect,needsArgs*/
@@ -11,8 +13,6 @@
/*spec.class: global#List:deps=[C.bar,JSArray.markFixedList],explicit=[List,List<B*>*,List<Object>,List<String>?,List<markFixedList.T>],indirect,needsArgs*/
/*prod.class: global#List:deps=[C.bar],explicit=[List<B*>*],needsArgs*/
-import "package:expect/expect.dart";
-
class A {}
/*spec.class: B:explicit=[List<B*>*],implicit=[B]*/
@@ -28,5 +28,5 @@
main() {
C c = new C();
dynamic x = c.bar<B>(<B>[new B()]);
- Expect.isTrue(x is List<B>);
+ makeLive(x is List<B>);
}
diff --git a/pkg/compiler/test/rti/data/generic_methods_dynamic_05a.dart b/pkg/compiler/test/rti/data/generic_methods_dynamic_05a.dart
index d06db8d..3226063 100644
--- a/pkg/compiler/test/rti/data/generic_methods_dynamic_05a.dart
+++ b/pkg/compiler/test/rti/data/generic_methods_dynamic_05a.dart
@@ -4,9 +4,9 @@
// @dart = 2.7
-// Reduced version of generic_methods_dynamic_05a_strong.
+import 'package:compiler/src/util/testing.dart';
-import "package:expect/expect.dart";
+// Reduced version of generic_methods_dynamic_05a_strong.
/*spec.class: A:deps=[C.bar],direct,explicit=[A.T*,A<B*>*,A<bar.T*>*],needsArgs*/
/*prod.class: A:deps=[C.bar],explicit=[A<B*>*],needsArgs*/
@@ -30,5 +30,5 @@
C c = new C();
dynamic x = c.bar<B>(new A<B>(new B()));
- Expect.isTrue(x is A<B>);
+ makeLive(x is A<B>);
}
diff --git a/pkg/compiler/test/rti/data/indirect_type_literal.dart b/pkg/compiler/test/rti/data/indirect_type_literal.dart
index 087d10f..a1a22cc 100644
--- a/pkg/compiler/test/rti/data/indirect_type_literal.dart
+++ b/pkg/compiler/test/rti/data/indirect_type_literal.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import "package:expect/expect.dart";
+import 'package:compiler/src/util/testing.dart';
class A<T> {}
@@ -16,10 +16,10 @@
}
void main() {
- Expect.equals(A, new Indirect<A>().type);
- Expect.equals(A, new Indirect<A<dynamic>>().type);
- Expect.notEquals(A, new Indirect<A<num>>().type);
- Expect.equals(B, new Indirect<B>().type);
- Expect.equals(B, new Indirect<B<num>>().type);
- Expect.notEquals(B, new Indirect<B<int>>().type);
+ makeLive(A == new Indirect<A>().type);
+ makeLive(A == new Indirect<A<dynamic>>().type);
+ makeLive(A == new Indirect<A<num>>().type);
+ makeLive(B == new Indirect<B>().type);
+ makeLive(B == new Indirect<B<num>>().type);
+ makeLive(B == new Indirect<B<int>>().type);
}
diff --git a/pkg/compiler/test/rti/data/local_function_generic.dart b/pkg/compiler/test/rti/data/local_function_generic.dart
index 2a08e7c..80892aa 100644
--- a/pkg/compiler/test/rti/data/local_function_generic.dart
+++ b/pkg/compiler/test/rti/data/local_function_generic.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
method1() {
/*spec.direct,explicit=[local.T*],needsArgs,needsSignature*/
@@ -17,5 +17,5 @@
test(o) => o is S Function<S>(S);
main() {
- Expect.isTrue(test(method1()));
+ makeLive(test(method1()));
}
diff --git a/pkg/compiler/test/rti/data/local_function_list_literal.dart b/pkg/compiler/test/rti/data/local_function_list_literal.dart
index 9fd1e90..3de5b69 100644
--- a/pkg/compiler/test/rti/data/local_function_list_literal.dart
+++ b/pkg/compiler/test/rti/data/local_function_list_literal.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
/*spec.class: global#JSArray:deps=[ArrayIterator,List],explicit=[JSArray,JSArray.E,JSArray<ArrayIterator.E>],implicit=[JSArray.E],indirect,needsArgs*/
/*prod.class: global#JSArray:deps=[List],needsArgs*/
@@ -13,13 +13,13 @@
/*spec.member: method:implicit=[method.T],indirect,needsArgs*/
/*prod.member: method:needsArgs*/
method<T>() {
- return () => <T>[];
+ return /*spec.*/ () => <T>[];
}
@pragma('dart2js:noInline')
test(o) => o is List<int>;
main() {
- Expect.isTrue(test(method<int>().call()));
- Expect.isFalse(test(method<String>().call()));
+ makeLive(test(method<int>().call()));
+ makeLive(test(method<String>().call()));
}
diff --git a/pkg/compiler/test/rti/data/local_function_map_literal.dart b/pkg/compiler/test/rti/data/local_function_map_literal.dart
index 851d076..a0dca5f 100644
--- a/pkg/compiler/test/rti/data/local_function_map_literal.dart
+++ b/pkg/compiler/test/rti/data/local_function_map_literal.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
/*spec.class: global#LinkedHashMap:deps=[Map],direct,explicit=[LinkedHashMap<LinkedHashMap.K,LinkedHashMap.V>],implicit=[LinkedHashMap.K,LinkedHashMap.V],needsArgs*/
/*prod.class: global#LinkedHashMap:deps=[Map],needsArgs*/
@@ -20,6 +20,6 @@
test(o) => o is Map<int, int>;
main() {
- Expect.isTrue(test(method<int>().call()));
- Expect.isFalse(test(method<String>().call()));
+ makeLive(test(method<int>().call()));
+ makeLive(test(method<String>().call()));
}
diff --git a/pkg/compiler/test/rti/data/local_function_signature2.dart b/pkg/compiler/test/rti/data/local_function_signature2.dart
index 0df4990..06bcb64 100644
--- a/pkg/compiler/test/rti/data/local_function_signature2.dart
+++ b/pkg/compiler/test/rti/data/local_function_signature2.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
class Class1 {
method1() {
@@ -94,16 +94,16 @@
test(o) => o is num Function(num);
main() {
- Expect.isFalse(test(new Class1().method1()));
- Expect.isFalse(test(new Class1().method2()));
- Expect.isFalse(test(new Class1().method3()));
- Expect.isTrue(test(new Class2().method4<num>()));
- Expect.isTrue(test(new Class3().method5<num>()));
- Expect.isFalse(test(new Class4().method6<num>()));
- Expect.isTrue(test(method7<num>()));
- Expect.isTrue(test(method8<num>()));
- Expect.isFalse(test(method9()));
- Expect.isFalse(test(method10()));
- Expect.isFalse(test(method11()));
- Expect.isFalse(test(method12()));
+ makeLive(test(new Class1().method1()));
+ makeLive(test(new Class1().method2()));
+ makeLive(test(new Class1().method3()));
+ makeLive(test(new Class2().method4<num>()));
+ makeLive(test(new Class3().method5<num>()));
+ makeLive(test(new Class4().method6<num>()));
+ makeLive(test(method7<num>()));
+ makeLive(test(method8<num>()));
+ makeLive(test(method9()));
+ makeLive(test(method10()));
+ makeLive(test(method11()));
+ makeLive(test(method12()));
}
diff --git a/pkg/compiler/test/rti/data/local_function_signatures.dart b/pkg/compiler/test/rti/data/local_function_signatures.dart
index 9a901bd..ad97152 100644
--- a/pkg/compiler/test/rti/data/local_function_signatures.dart
+++ b/pkg/compiler/test/rti/data/local_function_signatures.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
class Class1 {
method1() {
@@ -56,10 +56,10 @@
test(o) => o is num Function(num);
main() {
- Expect.isTrue(test(new Class1().method1()));
- Expect.isFalse(test(new Class1().method2()));
- Expect.isFalse(test(new Class1().method3()));
- Expect.isTrue(test(new Class2<num>().method4()));
- Expect.isTrue(test(new Class3<num>().method5()));
- Expect.isFalse(test(new Class4<num>().method6()));
+ makeLive(test(new Class1().method1()));
+ makeLive(test(new Class1().method2()));
+ makeLive(test(new Class1().method3()));
+ makeLive(test(new Class2<num>().method4()));
+ makeLive(test(new Class3<num>().method5()));
+ makeLive(test(new Class4<num>().method6()));
}
diff --git a/pkg/compiler/test/rti/data/local_function_signatures_generic.dart b/pkg/compiler/test/rti/data/local_function_signatures_generic.dart
index 38f07cb..fa0d44f 100644
--- a/pkg/compiler/test/rti/data/local_function_signatures_generic.dart
+++ b/pkg/compiler/test/rti/data/local_function_signatures_generic.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
class Class1 {
method1() {
@@ -118,19 +118,19 @@
test(o) => o is num Function(num);
main() {
- Expect.isFalse(test(new Class1().method1()));
- Expect.isFalse(test(new Class1().method2()));
- Expect.isFalse(test(new Class1().method3()));
- Expect.isTrue(test(new Class2().method4<num>()));
- Expect.isTrue(test(new Class3().method5<num>()));
- Expect.isFalse(test(new Class4().method6<num>()));
- Expect.isTrue(test(method7<num>()));
- Expect.isTrue(test(method8<num>()));
- Expect.isFalse(test(method9()));
- Expect.isFalse(test(method10()));
- Expect.isFalse(test(method11()));
- Expect.isFalse(test(method12()));
- Expect.isTrue(test(method13()));
- Expect.isTrue(test(method14()));
- Expect.isTrue(test(method15()));
+ makeLive(test(new Class1().method1()));
+ makeLive(test(new Class1().method2()));
+ makeLive(test(new Class1().method3()));
+ makeLive(test(new Class2().method4<num>()));
+ makeLive(test(new Class3().method5<num>()));
+ makeLive(test(new Class4().method6<num>()));
+ makeLive(test(method7<num>()));
+ makeLive(test(method8<num>()));
+ makeLive(test(method9()));
+ makeLive(test(method10()));
+ makeLive(test(method11()));
+ makeLive(test(method12()));
+ makeLive(test(method13()));
+ makeLive(test(method14()));
+ makeLive(test(method15()));
}
diff --git a/pkg/compiler/test/rti/data/method_signatures.dart b/pkg/compiler/test/rti/data/method_signatures.dart
index 0c86bc1..93ab6d2 100644
--- a/pkg/compiler/test/rti/data/method_signatures.dart
+++ b/pkg/compiler/test/rti/data/method_signatures.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
class Class1 {
/*member: Class1.method1:*/
@@ -47,13 +47,13 @@
test(o) => o is num Function(num);
main() {
- Expect.isTrue(test(new Class1().method1));
- Expect.isFalse(test(new Class1().method2));
- Expect.isFalse(test(new Class1().method3));
- Expect.isTrue(test(new Class2<num>().method4));
- Expect.isTrue(test(new Class3<num>().method5));
- Expect.isFalse(test(new Class4<num>().method6));
- Expect.isTrue(test(method7));
- Expect.isFalse(test(method8));
- Expect.isFalse(test(method9));
+ makeLive(test(new Class1().method1));
+ makeLive(test(new Class1().method2));
+ makeLive(test(new Class1().method3));
+ makeLive(test(new Class2<num>().method4));
+ makeLive(test(new Class3<num>().method5));
+ makeLive(test(new Class4<num>().method6));
+ makeLive(test(method7));
+ makeLive(test(method8));
+ makeLive(test(method9));
}
diff --git a/pkg/compiler/test/rti/data/method_signatures_generic.dart b/pkg/compiler/test/rti/data/method_signatures_generic.dart
index b7e0859..96dd598 100644
--- a/pkg/compiler/test/rti/data/method_signatures_generic.dart
+++ b/pkg/compiler/test/rti/data/method_signatures_generic.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
class Class1 {
/*member: Class1.method1:*/
@@ -47,13 +47,13 @@
forceInstantiation(num Function(num) f) => f;
main() {
- Expect.isFalse(test(new Class1().method1));
- Expect.isFalse(test(new Class1().method2));
- Expect.isFalse(test(new Class1().method3));
- Expect.isTrue(test(forceInstantiation(new Class2().method4)));
- Expect.isTrue(test(forceInstantiation(new Class3().method5)));
- Expect.isFalse(test(new Class4().method6));
- Expect.isTrue(test(forceInstantiation(method7)));
- Expect.isTrue(test(forceInstantiation(method8)));
- Expect.isFalse(test(method9));
+ makeLive(test(new Class1().method1));
+ makeLive(test(new Class1().method2));
+ makeLive(test(new Class1().method3));
+ makeLive(test(forceInstantiation(new Class2().method4)));
+ makeLive(test(forceInstantiation(new Class3().method5)));
+ makeLive(test(new Class4().method6));
+ makeLive(test(forceInstantiation(method7)));
+ makeLive(test(forceInstantiation(method8)));
+ makeLive(test(method9));
}
diff --git a/pkg/compiler/test/rti/data/no_such_method1.dart b/pkg/compiler/test/rti/data/no_such_method1.dart
index 93be16b..9592429 100644
--- a/pkg/compiler/test/rti/data/no_such_method1.dart
+++ b/pkg/compiler/test/rti/data/no_such_method1.dart
@@ -4,6 +4,8 @@
// @dart = 2.7
+import 'package:compiler/src/util/testing.dart';
+
class C {
/*member: C.noSuchMethod:needsArgs,selectors=[Selector(call, call, arity=0, types=2),Selector(call, foo, arity=0, types=2)]*/
noSuchMethod(i) => i.typeArguments;
@@ -11,7 +13,7 @@
@pragma('dart2js:noInline')
test(dynamic x) {
- print(x.foo<int, String>());
+ makeLive(x.foo<int, String>());
}
main() {
diff --git a/pkg/compiler/test/rti/data/no_such_method2.dart b/pkg/compiler/test/rti/data/no_such_method2.dart
index 0d22825..53b99ea 100644
--- a/pkg/compiler/test/rti/data/no_such_method2.dart
+++ b/pkg/compiler/test/rti/data/no_such_method2.dart
@@ -4,6 +4,8 @@
// @dart = 2.7
+import 'package:compiler/src/util/testing.dart';
+
class C {
/*member: C.noSuchMethod:needsArgs,selectors=[Selector(call, call, arity=0, types=2),Selector(call, foo, arity=0, types=2)]*/
noSuchMethod(i) => i.typeArguments;
@@ -16,7 +18,7 @@
@pragma('dart2js:noInline')
test(dynamic x) {
- print(x.foo<int, String>());
+ makeLive(x.foo<int, String>());
}
main() {
diff --git a/pkg/compiler/test/rti/data/no_such_method3.dart b/pkg/compiler/test/rti/data/no_such_method3.dart
index f25295b..3a708d2 100644
--- a/pkg/compiler/test/rti/data/no_such_method3.dart
+++ b/pkg/compiler/test/rti/data/no_such_method3.dart
@@ -4,6 +4,8 @@
// @dart = 2.7
+import 'package:compiler/src/util/testing.dart';
+
class C {
/*member: C.noSuchMethod:*/
noSuchMethod(i) => null;
@@ -11,7 +13,7 @@
@pragma('dart2js:noInline')
test(dynamic x) {
- print(x.foo<int, String>());
+ makeLive(x.foo<int, String>());
}
main() {
diff --git a/pkg/compiler/test/rti/data/runtime_type_closure_equals1.dart b/pkg/compiler/test/rti/data/runtime_type_closure_equals1.dart
index eb0b49e..c4a1a61 100644
--- a/pkg/compiler/test/rti/data/runtime_type_closure_equals1.dart
+++ b/pkg/compiler/test/rti/data/runtime_type_closure_equals1.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
class Class<T> {
Class();
@@ -20,7 +20,7 @@
/*needsSignature*/
local2(int i, String s) => i;
- Expect.isTrue(local1a.runtimeType == local1b.runtimeType);
- Expect.isFalse(local1a.runtimeType == local2.runtimeType);
+ makeLive(local1a.runtimeType == local1b.runtimeType);
+ makeLive(local1a.runtimeType == local2.runtimeType);
new Class();
}
diff --git a/pkg/compiler/test/rti/data/runtime_type_closure_equals2.dart b/pkg/compiler/test/rti/data/runtime_type_closure_equals2.dart
index 47b8bb3..a9199b1 100644
--- a/pkg/compiler/test/rti/data/runtime_type_closure_equals2.dart
+++ b/pkg/compiler/test/rti/data/runtime_type_closure_equals2.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
class Class<T> {
Class();
@@ -21,7 +21,7 @@
/*prod.needsArgs,needsSignature*/
T local2<T>(T t, String s) => t;
- Expect.isTrue(local1a.runtimeType == local1b.runtimeType);
- Expect.isFalse(local1a.runtimeType == local2.runtimeType);
+ makeLive(local1a.runtimeType == local1b.runtimeType);
+ makeLive(local1a.runtimeType == local2.runtimeType);
new Class();
}
diff --git a/pkg/compiler/test/rti/data/runtime_type_closure_equals3.dart b/pkg/compiler/test/rti/data/runtime_type_closure_equals3.dart
index bdebd0f..bba535c 100644
--- a/pkg/compiler/test/rti/data/runtime_type_closure_equals3.dart
+++ b/pkg/compiler/test/rti/data/runtime_type_closure_equals3.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
String method() => null;
@@ -23,9 +23,9 @@
/*needsSignature*/
T local2(T t, String s) => t;
- Expect.isTrue(local1a.runtimeType == local1b.runtimeType);
- Expect.isFalse(local1a.runtimeType == local2.runtimeType);
- Expect.isFalse(local1a.runtimeType == method.runtimeType);
+ makeLive(local1a.runtimeType == local1b.runtimeType);
+ makeLive(local1a.runtimeType == local2.runtimeType);
+ makeLive(local1a.runtimeType == method.runtimeType);
}
}
diff --git a/pkg/compiler/test/rti/data/runtime_type_closure_equals4.dart b/pkg/compiler/test/rti/data/runtime_type_closure_equals4.dart
index f2f5dcb..8053167 100644
--- a/pkg/compiler/test/rti/data/runtime_type_closure_equals4.dart
+++ b/pkg/compiler/test/rti/data/runtime_type_closure_equals4.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
class Class1<T> {
Class1();
@@ -27,7 +27,7 @@
main() {
var c = new Class1<int>();
- Expect.isTrue(c.method1a.runtimeType == c.method1b.runtimeType);
- Expect.isFalse(c.method1a.runtimeType == c.method2.runtimeType);
+ makeLive(c.method1a.runtimeType == c.method1b.runtimeType);
+ makeLive(c.method1a.runtimeType == c.method2.runtimeType);
new Class2<int>();
}
diff --git a/pkg/compiler/test/rti/data/runtime_type_closure_equals5.dart b/pkg/compiler/test/rti/data/runtime_type_closure_equals5.dart
index 6b9ef8b..b3477bb 100644
--- a/pkg/compiler/test/rti/data/runtime_type_closure_equals5.dart
+++ b/pkg/compiler/test/rti/data/runtime_type_closure_equals5.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
/*spec.class: Class1:direct,explicit=[Class1.T*],needsArgs*/
/*prod.class: Class1:needsArgs*/
@@ -28,7 +28,7 @@
main() {
var c = new Class1<int>();
- Expect.isTrue(c.method1a.runtimeType == c.method1b.runtimeType);
- Expect.isFalse(c.method1a.runtimeType == c.method2.runtimeType);
+ makeLive(c.method1a.runtimeType == c.method1b.runtimeType);
+ makeLive(c.method1a.runtimeType == c.method2.runtimeType);
new Class2<int>();
}
diff --git a/pkg/compiler/test/rti/data/runtime_type_closure_equals6.dart b/pkg/compiler/test/rti/data/runtime_type_closure_equals6.dart
index d8cc4f4..08e2bb2 100644
--- a/pkg/compiler/test/rti/data/runtime_type_closure_equals6.dart
+++ b/pkg/compiler/test/rti/data/runtime_type_closure_equals6.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
method1a() => null;
@@ -17,7 +17,7 @@
}
main() {
- Expect.isTrue(method1a.runtimeType == method1b.runtimeType);
- Expect.isFalse(method1a.runtimeType == method2.runtimeType);
+ makeLive(method1a.runtimeType == method1b.runtimeType);
+ makeLive(method1a.runtimeType == method2.runtimeType);
new Class<int>();
}
diff --git a/pkg/compiler/test/rti/data/runtime_type_closure_equals7.dart b/pkg/compiler/test/rti/data/runtime_type_closure_equals7.dart
index c1c2a43..8ffc992 100644
--- a/pkg/compiler/test/rti/data/runtime_type_closure_equals7.dart
+++ b/pkg/compiler/test/rti/data/runtime_type_closure_equals7.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
/*member: method1a:*/
T method1a<T>() => null;
@@ -20,7 +20,7 @@
}
main() {
- Expect.isTrue(method1a.runtimeType == method1b.runtimeType);
- Expect.isFalse(method1a.runtimeType == method2.runtimeType);
+ makeLive(method1a.runtimeType == method1b.runtimeType);
+ makeLive(method1a.runtimeType == method2.runtimeType);
new Class<int>();
}
diff --git a/pkg/compiler/test/rti/data/runtime_type_closure_equals8.dart b/pkg/compiler/test/rti/data/runtime_type_closure_equals8.dart
index 392562c..fae683f 100644
--- a/pkg/compiler/test/rti/data/runtime_type_closure_equals8.dart
+++ b/pkg/compiler/test/rti/data/runtime_type_closure_equals8.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
class Class1<S> {
Class1();
@@ -26,7 +26,7 @@
main() {
var c = new Class1<int>();
- Expect.isTrue(c.method1a.runtimeType == c.method1b.runtimeType);
- Expect.isFalse(c.method1a.runtimeType == c.method2.runtimeType);
+ makeLive(c.method1a.runtimeType == c.method1b.runtimeType);
+ makeLive(c.method1a.runtimeType == c.method2.runtimeType);
new Class2<int>();
}
diff --git a/pkg/compiler/test/rti/data/runtime_type_closure_to_string1.dart b/pkg/compiler/test/rti/data/runtime_type_closure_to_string1.dart
index ba7f1b9..05da330 100644
--- a/pkg/compiler/test/rti/data/runtime_type_closure_to_string1.dart
+++ b/pkg/compiler/test/rti/data/runtime_type_closure_to_string1.dart
@@ -4,6 +4,8 @@
// @dart = 2.7
+import 'package:compiler/src/util/testing.dart';
+
class Class<T> {
Class();
}
@@ -15,7 +17,7 @@
/*spec.needsSignature*/
local2(int i, String s) => i;
- print('${local1.runtimeType}');
+ makeLive('${local1.runtimeType}');
local2(0, '');
new Class();
}
diff --git a/pkg/compiler/test/rti/data/runtime_type_closure_to_string2.dart b/pkg/compiler/test/rti/data/runtime_type_closure_to_string2.dart
index ac017d9..29e83bb 100644
--- a/pkg/compiler/test/rti/data/runtime_type_closure_to_string2.dart
+++ b/pkg/compiler/test/rti/data/runtime_type_closure_to_string2.dart
@@ -4,6 +4,8 @@
// @dart = 2.7
+import 'package:compiler/src/util/testing.dart';
+
class Class<T> {
Class();
}
@@ -15,7 +17,7 @@
/*spec.needsArgs,needsSignature,selectors=[Selector(call, call, arity=2, types=1)]*/
local2<T>(t, s) => t;
- print('${local1.runtimeType}');
+ makeLive('${local1.runtimeType}');
local2(0, '');
new Class();
}
diff --git a/pkg/compiler/test/rti/data/runtime_type_closure_to_string3.dart b/pkg/compiler/test/rti/data/runtime_type_closure_to_string3.dart
index 3e6538a..70ef21a 100644
--- a/pkg/compiler/test/rti/data/runtime_type_closure_to_string3.dart
+++ b/pkg/compiler/test/rti/data/runtime_type_closure_to_string3.dart
@@ -4,6 +4,8 @@
// @dart = 2.7
+import 'package:compiler/src/util/testing.dart';
+
/*spec.class: Class1:needsArgs*/
class Class1<T> {
Class1();
@@ -18,6 +20,6 @@
main() {
Class1<int> cls1 = new Class1<int>();
- print(cls1.method.runtimeType.toString());
+ makeLive(cls1.method.runtimeType.toString());
new Class2<int>();
}
diff --git a/pkg/compiler/test/rti/data/runtime_type_closure_to_string4.dart b/pkg/compiler/test/rti/data/runtime_type_closure_to_string4.dart
index cb5ab6e..fa09fc9 100644
--- a/pkg/compiler/test/rti/data/runtime_type_closure_to_string4.dart
+++ b/pkg/compiler/test/rti/data/runtime_type_closure_to_string4.dart
@@ -4,6 +4,8 @@
// @dart = 2.7
+import 'package:compiler/src/util/testing.dart';
+
/*class: Class1:*/
class Class1 {
/*member: Class1.:*/
@@ -22,6 +24,6 @@
/*member: main:*/
main() {
Class1 cls1 = new Class1();
- print(cls1.method.runtimeType.toString());
+ makeLive(cls1.method.runtimeType.toString());
new Class2<int>();
}
diff --git a/pkg/compiler/test/rti/data/runtime_type_closure_to_string5.dart b/pkg/compiler/test/rti/data/runtime_type_closure_to_string5.dart
index 1db7626..a485830 100644
--- a/pkg/compiler/test/rti/data/runtime_type_closure_to_string5.dart
+++ b/pkg/compiler/test/rti/data/runtime_type_closure_to_string5.dart
@@ -4,6 +4,8 @@
// @dart = 2.7
+import 'package:compiler/src/util/testing.dart';
+
class Class<T> {
Class();
}
@@ -13,7 +15,7 @@
method2(int i, String s) => i;
main() {
- print('${method1.runtimeType}');
+ makeLive('${method1.runtimeType}');
method2(0, '');
new Class();
}
diff --git a/pkg/compiler/test/rti/data/runtime_type_closure_to_string6.dart b/pkg/compiler/test/rti/data/runtime_type_closure_to_string6.dart
index 1e1bce8..a0d9384 100644
--- a/pkg/compiler/test/rti/data/runtime_type_closure_to_string6.dart
+++ b/pkg/compiler/test/rti/data/runtime_type_closure_to_string6.dart
@@ -4,6 +4,8 @@
// @dart = 2.7
+import 'package:compiler/src/util/testing.dart';
+
/*class: Class:*/
class Class<T> {
/*member: Class.:*/
@@ -18,7 +20,7 @@
/*member: main:*/
main() {
- print('${method1.runtimeType}');
+ makeLive('${method1.runtimeType}');
method2(0, '');
new Class();
}
diff --git a/pkg/compiler/test/rti/data/runtime_type_equals1.dart b/pkg/compiler/test/rti/data/runtime_type_equals1.dart
index 2341118..ba7bc28 100644
--- a/pkg/compiler/test/rti/data/runtime_type_equals1.dart
+++ b/pkg/compiler/test/rti/data/runtime_type_equals1.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
/*class: Class1a:needsArgs*/
class Class1a<T> {
@@ -38,8 +38,8 @@
Class1a<int> cls1b2 = new Class1b<int>();
Class1c<int> cls1c = new Class1c<int>();
Class2<int> cls2 = new Class2<int>();
- Expect.isFalse(cls1a == cls1b1);
- Expect.isTrue(cls1b1 == cls1b2);
- Expect.isFalse(cls1a == cls1c);
- Expect.isFalse(cls1a == cls2);
+ makeLive(cls1a == cls1b1);
+ makeLive(cls1b1 == cls1b2);
+ makeLive(cls1a == cls1c);
+ makeLive(cls1a == cls2);
}
diff --git a/pkg/compiler/test/rti/data/runtime_type_equals2.dart b/pkg/compiler/test/rti/data/runtime_type_equals2.dart
index 8987068..12ddf17 100644
--- a/pkg/compiler/test/rti/data/runtime_type_equals2.dart
+++ b/pkg/compiler/test/rti/data/runtime_type_equals2.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
/*class: Class1a:needsArgs*/
class Class1a<T> {
@@ -38,8 +38,8 @@
Class1a<int> cls1b2 = new Class1b<int>();
Class1c<int> cls1c = new Class1c<int>();
Class2<int> cls2 = new Class2<int>();
- Expect.isFalse(cls1a == cls1b1);
- Expect.isTrue(cls1b1 == cls1b2);
- Expect.isFalse(cls1a == cls1c);
- Expect.isFalse(cls1a == cls2);
+ makeLive(cls1a == cls1b1);
+ makeLive(cls1b1 == cls1b2);
+ makeLive(cls1a == cls1c);
+ makeLive(cls1a == cls2);
}
diff --git a/pkg/compiler/test/rti/data/runtime_type_equals3.dart b/pkg/compiler/test/rti/data/runtime_type_equals3.dart
index ca06e3e..e1dc6a8 100644
--- a/pkg/compiler/test/rti/data/runtime_type_equals3.dart
+++ b/pkg/compiler/test/rti/data/runtime_type_equals3.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
/*class: Class1a:needsArgs*/
class Class1a<T> {
@@ -45,8 +45,8 @@
Class1a<int> cls1b2 = new Class1b<int>();
Class1c<int> cls1c = new Class1c<int>();
Class2<int> cls2 = new Class2<int>();
- Expect.isFalse(cls1a == cls1b1);
- Expect.isTrue(cls1b1 == cls1b2);
- Expect.isFalse(cls1a == cls1c);
- Expect.isFalse(cls1a == cls2);
+ makeLive(cls1a == cls1b1);
+ makeLive(cls1b1 == cls1b2);
+ makeLive(cls1a == cls1c);
+ makeLive(cls1a == cls2);
}
diff --git a/pkg/compiler/test/rti/data/runtime_type_equals4.dart b/pkg/compiler/test/rti/data/runtime_type_equals4.dart
index 220d033..d519d6c 100644
--- a/pkg/compiler/test/rti/data/runtime_type_equals4.dart
+++ b/pkg/compiler/test/rti/data/runtime_type_equals4.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
/*class: Class1a:needsArgs*/
class Class1a<T> {
@@ -45,8 +45,8 @@
Class1a<int> cls1b2 = new Class1b<int>();
Class1c<int> cls1c = new Class1c<int>();
Class2<int> cls2 = new Class2<int>();
- Expect.isFalse(cls1a == cls1b1);
- Expect.isTrue(cls1b1 == cls1b2);
- Expect.isFalse(cls1a == cls1c);
- Expect.isFalse(cls1a == cls2);
+ makeLive(cls1a == cls1b1);
+ makeLive(cls1b1 == cls1b2);
+ makeLive(cls1a == cls1c);
+ makeLive(cls1a == cls2);
}
diff --git a/pkg/compiler/test/rti/data/runtime_type_equals5.dart b/pkg/compiler/test/rti/data/runtime_type_equals5.dart
index ae4bee6..0041d0f 100644
--- a/pkg/compiler/test/rti/data/runtime_type_equals5.dart
+++ b/pkg/compiler/test/rti/data/runtime_type_equals5.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
/*spec.class: Class1a:explicit=[Class1a*]*/
class Class1a {
@@ -30,8 +30,8 @@
}
main() {
- Expect.isTrue(test(new Class1a(), Class1a));
- Expect.isFalse(test(new Class1b<int>(), Class1a));
- Expect.isFalse(test(new Class1c<int>(), Class1a));
+ makeLive(test(new Class1a(), Class1a));
+ makeLive(test(new Class1b<int>(), Class1a));
+ makeLive(test(new Class1c<int>(), Class1a));
new Class2<int>();
}
diff --git a/pkg/compiler/test/rti/data/runtime_type_equals6.dart b/pkg/compiler/test/rti/data/runtime_type_equals6.dart
index 62c2fcb..1a18a1c 100644
--- a/pkg/compiler/test/rti/data/runtime_type_equals6.dart
+++ b/pkg/compiler/test/rti/data/runtime_type_equals6.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
/*spec.class: Class1a:explicit=[Class1a*],needsArgs*/
/*prod.class: Class1a:needsArgs*/
@@ -31,8 +31,8 @@
}
main() {
- Expect.isTrue(test(new Class1a(), Class1a));
- Expect.isFalse(test(new Class1b<int>(), Class1a));
- Expect.isFalse(test(new Class1c<int>(), Class1a));
+ makeLive(test(new Class1a(), Class1a));
+ makeLive(test(new Class1b<int>(), Class1a));
+ makeLive(test(new Class1c<int>(), Class1a));
new Class2<int>();
}
diff --git a/pkg/compiler/test/rti/data/runtime_type_equals7.dart b/pkg/compiler/test/rti/data/runtime_type_equals7.dart
index 9a63cc2..661bb4f 100644
--- a/pkg/compiler/test/rti/data/runtime_type_equals7.dart
+++ b/pkg/compiler/test/rti/data/runtime_type_equals7.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
/*spec.class: Class1a:explicit=[Class1a*]*/
class Class1a {
@@ -37,8 +37,8 @@
}
main() {
- Expect.isTrue(test(new Class3<int>(new Class1a()), Class1a));
- Expect.isFalse(test(new Class3<int>(new Class1b<int>()), Class1a));
- Expect.isFalse(test(new Class3<int>(new Class1c<int>()), Class1a));
+ makeLive(test(new Class3<int>(new Class1a()), Class1a));
+ makeLive(test(new Class3<int>(new Class1b<int>()), Class1a));
+ makeLive(test(new Class3<int>(new Class1c<int>()), Class1a));
new Class2<int>();
}
diff --git a/pkg/compiler/test/rti/data/runtime_type_instantiate_to_string1.dart b/pkg/compiler/test/rti/data/runtime_type_instantiate_to_string1.dart
index 80f9c5f..f8ee428 100644
--- a/pkg/compiler/test/rti/data/runtime_type_instantiate_to_string1.dart
+++ b/pkg/compiler/test/rti/data/runtime_type_instantiate_to_string1.dart
@@ -4,11 +4,13 @@
// @dart = 2.7
+import 'package:compiler/src/util/testing.dart';
+
/*member: global#instantiate1:needsArgs*/
main() {
/*spec.direct,explicit=[id.T*],needsArgs,needsInst=[<int*>],needsSignature*/
T id<T>(T t, String s) => t;
int Function(int, String s) x = id;
- print("${x.runtimeType}");
+ makeLive("${x.runtimeType}");
}
diff --git a/pkg/compiler/test/rti/data/runtime_type_instantiate_to_string2.dart b/pkg/compiler/test/rti/data/runtime_type_instantiate_to_string2.dart
index ea1f538..09002a4 100644
--- a/pkg/compiler/test/rti/data/runtime_type_instantiate_to_string2.dart
+++ b/pkg/compiler/test/rti/data/runtime_type_instantiate_to_string2.dart
@@ -4,6 +4,8 @@
// @dart = 2.7
+import 'package:compiler/src/util/testing.dart';
+
/*member: global#instantiate1:needsArgs*/
/*spec.member: id:direct,explicit=[id.T*],needsArgs,needsInst=[<int*>]*/
@@ -11,5 +13,5 @@
main() {
int Function(int, String s) x = id;
- print("${x.runtimeType}");
+ makeLive("${x.runtimeType}");
}
diff --git a/pkg/compiler/test/rti/data/runtime_type_instantiate_to_string3.dart b/pkg/compiler/test/rti/data/runtime_type_instantiate_to_string3.dart
index 1afde94..5de5547 100644
--- a/pkg/compiler/test/rti/data/runtime_type_instantiate_to_string3.dart
+++ b/pkg/compiler/test/rti/data/runtime_type_instantiate_to_string3.dart
@@ -4,6 +4,8 @@
// @dart = 2.7
+import 'package:compiler/src/util/testing.dart';
+
/*member: global#instantiate1:needsArgs*/
class Class {
@@ -13,5 +15,5 @@
main() {
int Function(int, String s) x = new Class().id;
- print("${x.runtimeType}");
+ makeLive("${x.runtimeType}");
}
diff --git a/pkg/compiler/test/rti/data/runtime_type_to_string1.dart b/pkg/compiler/test/rti/data/runtime_type_to_string1.dart
index 81e57ce..a07f484 100644
--- a/pkg/compiler/test/rti/data/runtime_type_to_string1.dart
+++ b/pkg/compiler/test/rti/data/runtime_type_to_string1.dart
@@ -4,6 +4,8 @@
// @dart = 2.7
+import 'package:compiler/src/util/testing.dart';
+
class Class1 {
Class1();
}
@@ -19,8 +21,8 @@
main() {
Class1 cls1 = new Class1();
- print(cls1.runtimeType.toString());
+ makeLive(cls1.runtimeType.toString());
new Class2<int>();
Class1 cls3 = new Class3<int>();
- print(cls3.runtimeType.toString());
+ makeLive(cls3.runtimeType.toString());
}
diff --git a/pkg/compiler/test/rti/data/runtime_type_to_string2.dart b/pkg/compiler/test/rti/data/runtime_type_to_string2.dart
index 2995668..981254f 100644
--- a/pkg/compiler/test/rti/data/runtime_type_to_string2.dart
+++ b/pkg/compiler/test/rti/data/runtime_type_to_string2.dart
@@ -4,6 +4,8 @@
// @dart = 2.7
+import 'package:compiler/src/util/testing.dart';
+
/*spec.class: Class1:needsArgs*/
class Class1<T> {
Class1();
@@ -15,6 +17,6 @@
main() {
Class1<int> cls1 = new Class1<int>();
- print('${cls1.runtimeType}');
+ makeLive('${cls1.runtimeType}');
new Class2<int>();
}
diff --git a/pkg/compiler/test/rti/data/runtime_type_to_string3.dart b/pkg/compiler/test/rti/data/runtime_type_to_string3.dart
index 4b978bd..d55f069 100644
--- a/pkg/compiler/test/rti/data/runtime_type_to_string3.dart
+++ b/pkg/compiler/test/rti/data/runtime_type_to_string3.dart
@@ -4,6 +4,8 @@
// @dart = 2.7
+import 'package:compiler/src/util/testing.dart';
+
/*spec.class: Class1:needsArgs*/
class Class1<T> {
Class1();
@@ -15,6 +17,6 @@
main() {
Class1<int> cls1 = new Class1<int>();
- print(cls1.runtimeType?.toString());
+ makeLive(cls1.runtimeType?.toString());
new Class2<int>();
}
diff --git a/pkg/compiler/test/rti/data/runtime_type_to_string4.dart b/pkg/compiler/test/rti/data/runtime_type_to_string4.dart
index 645fd04..2ca025a 100644
--- a/pkg/compiler/test/rti/data/runtime_type_to_string4.dart
+++ b/pkg/compiler/test/rti/data/runtime_type_to_string4.dart
@@ -4,6 +4,8 @@
// @dart = 2.7
+import 'package:compiler/src/util/testing.dart';
+
/*spec.class: Class1:needsArgs*/
class Class1<T> {
Class1();
@@ -15,6 +17,6 @@
main() {
Class1<int> cls1 = new Class1<int>();
- print(cls1?.runtimeType?.toString());
+ makeLive(cls1?.runtimeType?.toString());
new Class2<int>();
}
diff --git a/pkg/compiler/test/rti/data/runtime_type_to_string5.dart b/pkg/compiler/test/rti/data/runtime_type_to_string5.dart
index 03013b3..c5a2b3e 100644
--- a/pkg/compiler/test/rti/data/runtime_type_to_string5.dart
+++ b/pkg/compiler/test/rti/data/runtime_type_to_string5.dart
@@ -4,6 +4,8 @@
// @dart = 2.7
+import 'package:compiler/src/util/testing.dart';
+
/*spec.class: Class1:needsArgs*/
class Class1<T> {
Class1();
@@ -15,6 +17,6 @@
main() {
Class1<int> cls1 = new Class1<int>();
- print('${cls1?.runtimeType}');
+ makeLive('${cls1?.runtimeType}');
new Class2<int>();
}
diff --git a/pkg/compiler/test/rti/data/runtime_type_to_string6.dart b/pkg/compiler/test/rti/data/runtime_type_to_string6.dart
index 70e17a4..adf0c44 100644
--- a/pkg/compiler/test/rti/data/runtime_type_to_string6.dart
+++ b/pkg/compiler/test/rti/data/runtime_type_to_string6.dart
@@ -4,6 +4,8 @@
// @dart = 2.7
+import 'package:compiler/src/util/testing.dart';
+
/*spec.class: Class1:needsArgs*/
class Class1<T> {
Class1();
@@ -16,7 +18,7 @@
main() {
dynamic cls1 = new Class1<int>();
- print('${cls1.runtimeType}');
+ makeLive('${cls1.runtimeType}');
new Class2<int>();
cls1 = null;
}
diff --git a/pkg/compiler/test/rti/data/runtime_type_to_string7.dart b/pkg/compiler/test/rti/data/runtime_type_to_string7.dart
index 81e57ce..a07f484 100644
--- a/pkg/compiler/test/rti/data/runtime_type_to_string7.dart
+++ b/pkg/compiler/test/rti/data/runtime_type_to_string7.dart
@@ -4,6 +4,8 @@
// @dart = 2.7
+import 'package:compiler/src/util/testing.dart';
+
class Class1 {
Class1();
}
@@ -19,8 +21,8 @@
main() {
Class1 cls1 = new Class1();
- print(cls1.runtimeType.toString());
+ makeLive(cls1.runtimeType.toString());
new Class2<int>();
Class1 cls3 = new Class3<int>();
- print(cls3.runtimeType.toString());
+ makeLive(cls3.runtimeType.toString());
}
diff --git a/pkg/compiler/test/rti/data/subtype_named_args.dart b/pkg/compiler/test/rti/data/subtype_named_args.dart
index 530b914..365ef9a 100644
--- a/pkg/compiler/test/rti/data/subtype_named_args.dart
+++ b/pkg/compiler/test/rti/data/subtype_named_args.dart
@@ -4,9 +4,9 @@
// @dart = 2.7
-// From co19/Language/Types/Function_Types/subtype_named_args_t02.
+import 'package:compiler/src/util/testing.dart';
-import 'package:expect/expect.dart';
+// From co19/Language/Types/Function_Types/subtype_named_args_t02.
/*spec.class: A:explicit=[A*,G<A*,A1*,A1*,A1*>*,dynamic Function({a:A*,b:A1*,c:A1*,d:A1*})*,dynamic Function({a:A*,b:B*,c:C*,d:D*})*,dynamic Function({b:B*,f:dynamic Function({f1:dynamic Function({a:A*,b:B*,c:C*,d:D*})*,f2:dynamic Function({g:G<A*,B*,C*,D*>*,l:List<List<B*>*>*,m:Map<num*,int*>*})*,f3:dynamic Function({v:dynamic,x:dynamic,y:dynamic,z:dynamic})*})*,g:G<A*,B*,C*,D*>*,x:dynamic})*,dynamic Function({f1:dynamic Function({a:A*,b:B*,c:C*,d:D*})*,f2:dynamic Function({g:G<A*,B*,C*,D*>*,l:List<List<B*>*>*,m:Map<num*,int*>*})*,f3:dynamic Function({v:dynamic,x:dynamic,y:dynamic,z:dynamic})*})*,dynamic Function({g:G<A*,A1*,A1*,A1*>*,l:List<List<A1*>*>*,m:Map<num*,num*>*})*,dynamic Function({g:G<A*,B*,C*,D*>*,l:List<List<B*>*>*,m:Map<num*,int*>*})*,dynamic Function({v:dynamic Function({a:A*,b:B*,c:C*,d:D*})*,x:int*,y:bool*,z:List<Map*>*})*,dynamic Function({v:dynamic,x:A*,y:G*,z:dynamic Function({b:B*,f:dynamic Function({f1:dynamic Function({a:A*,b:B*,c:C*,d:D*})*,f2:dynamic Function({g:G<A*,B*,C*,D*>*,l:List<List<B*>*>*,m:Map<num*,int*>*})*,f3:dynamic Function({v:dynamic,x:dynamic,y:dynamic,z:dynamic})*})*,g:G<A*,B*,C*,D*>*,x:dynamic})*})*]*/
/*prod.class: A:explicit=[dynamic Function({a:A*,b:B*,c:C*,d:D*})*,dynamic Function({f1:dynamic Function({a:A*,b:B*,c:C*,d:D*})*,f2:dynamic Function({g:G<A*,B*,C*,D*>*,l:List<List<B*>*>*,m:Map<num*,int*>*})*,f3:dynamic Function({v:dynamic,x:dynamic,y:dynamic,z:dynamic})*})*,dynamic Function({g:G<A*,B*,C*,D*>*,l:List<List<B*>*>*,m:Map<num*,int*>*})*]*/
@@ -52,54 +52,54 @@
typedef okWithDynamicFunc_2({int x, bool y, List<Map> z, classesFunc v});
main() {
- Expect.isTrue(
+ makeLive(
/*needsSignature*/
({D a, B b, C c, A d}) {} is classesFunc);
- Expect.isTrue(
+ makeLive(
/*needsSignature*/
({A a, A b, A c, A d}) {} is classesFunc);
- Expect.isTrue(
+ makeLive(
/*needsSignature*/
({D a, A1 b, A1 c, A1 d}) {} is classesFunc);
- Expect.isTrue(
+ makeLive(
/*needsSignature*/
({D a, A2 b, A2 c, A2 d}) {} is classesFunc);
- Expect.isTrue(
+ makeLive(
/*needsSignature*/
({D a, D b, D c, D d}) {} is classesFunc);
- Expect.isTrue(
+ makeLive(
/*needsSignature*/
({var a, var b, var c, var d}) {} is classesFunc);
- Expect.isTrue(
+ makeLive(
/*needsSignature*/
({Object a, Object b, Object c, Object d}) {} is classesFunc);
- Expect.isTrue(
+ makeLive(
/*needsSignature*/
({Map<num, num> m, List<List<A1>> l, G<A, A1, A1, A1> g}) {}
is genericsFunc);
- Expect.isTrue(
+ makeLive(
/*needsSignature*/
({Map<int, int> m, List<List<D>> l, G<D, D, D, D> g}) {} is genericsFunc);
- Expect.isTrue(
+ makeLive(
/*needsSignature*/
({var m, var l, var g}) {} is genericsFunc);
- Expect.isTrue(
+ makeLive(
/*needsSignature*/
({Object m, Object l, Object g}) {} is genericsFunc);
- Expect.isTrue(
+ makeLive(
/*needsSignature*/
({A x, G y, mixFunc z, var v}) {} is dynamicFunc);
- Expect.isTrue(
+ makeLive(
/*needsSignature*/
({int x, bool y, List<Map> z, classesFunc v}) {} is dynamicFunc);
- Expect.isTrue(/*needsSignature*/ (
+ makeLive(/*needsSignature*/ (
{okWithClassesFunc_1 f1,
okWithGenericsFunc_1 f2,
okWithDynamicFunc_1 f3}) {} is funcFunc);
- Expect.isTrue(
+ makeLive(
/*needsSignature*/
(
{okWithClassesFunc_2 f1,
diff --git a/pkg/compiler/test/rti/data/subtype_named_args1.dart b/pkg/compiler/test/rti/data/subtype_named_args1.dart
index b2b3cf9..9ffa6ba 100644
--- a/pkg/compiler/test/rti/data/subtype_named_args1.dart
+++ b/pkg/compiler/test/rti/data/subtype_named_args1.dart
@@ -4,9 +4,9 @@
// @dart = 2.7
-// From co19/Language/Types/Function_Types/subtype_named_args_t01.
+import 'package:compiler/src/util/testing.dart';
-import "package:expect/expect.dart";
+// From co19/Language/Types/Function_Types/subtype_named_args_t01.
/*spec.class: A:explicit=[A*,dynamic Function({a:A*})*]*/
class A {}
@@ -37,68 +37,68 @@
typedef okWithT1_4({D a});
main() {
- Expect.isTrue(/*needsSignature*/ ({A a}) {} is t1);
- Expect.isTrue(/*needsSignature*/ ({B a}) {} is t1);
- Expect.isTrue(/*needsSignature*/ ({C a}) {} is t1);
- Expect.isTrue(/*needsSignature*/ ({D a}) {} is t1);
- Expect.isTrue(/*needsSignature*/ ({Object a}) {} is t1);
- Expect.isTrue(/*needsSignature*/ ({var a}) {} is t1);
+ makeLive(/*needsSignature*/ ({A a}) {} is t1);
+ makeLive(/*needsSignature*/ ({B a}) {} is t1);
+ makeLive(/*needsSignature*/ ({C a}) {} is t1);
+ makeLive(/*needsSignature*/ ({D a}) {} is t1);
+ makeLive(/*needsSignature*/ ({Object a}) {} is t1);
+ makeLive(/*needsSignature*/ ({var a}) {} is t1);
- Expect.isTrue(/*needsSignature*/ ({A c}) {} is t2);
- Expect.isTrue(/*needsSignature*/ ({B c}) {} is t2);
- Expect.isTrue(/*needsSignature*/ ({C c}) {} is t2);
- Expect.isTrue(/*needsSignature*/ ({D c}) {} is t2);
- Expect.isTrue(/*needsSignature*/ ({Object c}) {} is t2);
- Expect.isTrue(/*needsSignature*/ ({var c}) {} is t2);
+ makeLive(/*needsSignature*/ ({A c}) {} is t2);
+ makeLive(/*needsSignature*/ ({B c}) {} is t2);
+ makeLive(/*needsSignature*/ ({C c}) {} is t2);
+ makeLive(/*needsSignature*/ ({D c}) {} is t2);
+ makeLive(/*needsSignature*/ ({Object c}) {} is t2);
+ makeLive(/*needsSignature*/ ({var c}) {} is t2);
- Expect.isTrue(/*needsSignature*/ ({num i}) {} is t3);
- Expect.isTrue(/*needsSignature*/ ({int i}) {} is t3);
- Expect.isTrue(/*needsSignature*/ ({Object i}) {} is t3);
- Expect.isTrue(/*needsSignature*/ ({var i}) {} is t3);
+ makeLive(/*needsSignature*/ ({num i}) {} is t3);
+ makeLive(/*needsSignature*/ ({int i}) {} is t3);
+ makeLive(/*needsSignature*/ ({Object i}) {} is t3);
+ makeLive(/*needsSignature*/ ({var i}) {} is t3);
- Expect.isTrue(/*needsSignature*/ ({A v}) {} is t4);
- Expect.isTrue(/*needsSignature*/ ({B v}) {} is t4);
- Expect.isTrue(/*needsSignature*/ ({C v}) {} is t4);
- Expect.isTrue(/*needsSignature*/ ({D v}) {} is t4);
- Expect.isTrue(/*needsSignature*/ ({Object v}) {} is t4);
- Expect.isTrue(/*needsSignature*/ ({var v}) {} is t4);
- Expect.isTrue(/*needsSignature*/ ({num v}) {} is t4);
- Expect.isTrue(/*needsSignature*/ ({int v}) {} is t4);
- Expect.isTrue(/*needsSignature*/ ({Map v}) {} is t4);
- Expect.isTrue(
+ makeLive(/*needsSignature*/ ({A v}) {} is t4);
+ makeLive(/*needsSignature*/ ({B v}) {} is t4);
+ makeLive(/*needsSignature*/ ({C v}) {} is t4);
+ makeLive(/*needsSignature*/ ({D v}) {} is t4);
+ makeLive(/*needsSignature*/ ({Object v}) {} is t4);
+ makeLive(/*needsSignature*/ ({var v}) {} is t4);
+ makeLive(/*needsSignature*/ ({num v}) {} is t4);
+ makeLive(/*needsSignature*/ ({int v}) {} is t4);
+ makeLive(/*needsSignature*/ ({Map v}) {} is t4);
+ makeLive(
/*needsSignature*/ ({Map<List<Map<List, List<int>>>, List> v}) {} is t4);
- Expect.isTrue(/*needsSignature*/ ({List v}) {} is t4);
- Expect.isTrue(/*needsSignature*/ ({t8 v}) {} is t4);
- Expect.isTrue(/*needsSignature*/ ({t7 v}) {} is t4);
+ makeLive(/*needsSignature*/ ({List v}) {} is t4);
+ makeLive(/*needsSignature*/ ({t8 v}) {} is t4);
+ makeLive(/*needsSignature*/ ({t7 v}) {} is t4);
- Expect.isTrue(/*needsSignature*/ ({Map m}) {} is t5);
- Expect.isTrue(/*needsSignature*/ ({Map<List, t8> m}) {} is t5);
- Expect.isTrue(/*needsSignature*/ ({Object m}) {} is t5);
- Expect.isTrue(/*needsSignature*/ ({var m}) {} is t5);
- Expect.isTrue(/*needsSignature*/ ({Map<List, List> m}) {} is t5);
- Expect.isTrue(/*needsSignature*/ ({Map<int, t8> m}) {} is t5);
+ makeLive(/*needsSignature*/ ({Map m}) {} is t5);
+ makeLive(/*needsSignature*/ ({Map<List, t8> m}) {} is t5);
+ makeLive(/*needsSignature*/ ({Object m}) {} is t5);
+ makeLive(/*needsSignature*/ ({var m}) {} is t5);
+ makeLive(/*needsSignature*/ ({Map<List, List> m}) {} is t5);
+ makeLive(/*needsSignature*/ ({Map<int, t8> m}) {} is t5);
- Expect.isTrue(/*needsSignature*/ ({Map<num, num> m}) {} is t6);
- Expect.isTrue(/*needsSignature*/ ({Map<int, int> m}) {} is t6);
- Expect.isTrue(/*needsSignature*/ ({Map m}) {} is t6);
- Expect.isTrue(/*needsSignature*/ ({Object m}) {} is t6);
- Expect.isTrue(/*needsSignature*/ ({var m}) {} is t6);
+ makeLive(/*needsSignature*/ ({Map<num, num> m}) {} is t6);
+ makeLive(/*needsSignature*/ ({Map<int, int> m}) {} is t6);
+ makeLive(/*needsSignature*/ ({Map m}) {} is t6);
+ makeLive(/*needsSignature*/ ({Object m}) {} is t6);
+ makeLive(/*needsSignature*/ ({var m}) {} is t6);
- Expect.isTrue(/*needsSignature*/ ({okWithT1_1 f}) {} is t7);
- Expect.isTrue(/*needsSignature*/ ({okWithT1_2 f}) {} is t7);
- Expect.isTrue(/*needsSignature*/ ({okWithT1_3 f}) {} is t7);
- Expect.isTrue(/*needsSignature*/ ({okWithT1_4 f}) {} is t7);
+ makeLive(/*needsSignature*/ ({okWithT1_1 f}) {} is t7);
+ makeLive(/*needsSignature*/ ({okWithT1_2 f}) {} is t7);
+ makeLive(/*needsSignature*/ ({okWithT1_3 f}) {} is t7);
+ makeLive(/*needsSignature*/ ({okWithT1_4 f}) {} is t7);
- Expect.isTrue(/*needsSignature*/ ({A a}) {} is t8);
- Expect.isTrue(/*needsSignature*/ ({B a}) {} is t8);
- Expect.isTrue(/*needsSignature*/ ({C a}) {} is t8);
- Expect.isTrue(/*needsSignature*/ ({D a}) {} is t8);
- Expect.isTrue(/*needsSignature*/ ({Object a}) {} is t8);
- Expect.isTrue(/*needsSignature*/ ({var a}) {} is t8);
- Expect.isTrue(/*needsSignature*/ ({num a}) {} is t8);
- Expect.isTrue(/*needsSignature*/ ({int a}) {} is t8);
- Expect.isTrue(/*needsSignature*/ ({Map a}) {} is t8);
- Expect.isTrue(
+ makeLive(/*needsSignature*/ ({A a}) {} is t8);
+ makeLive(/*needsSignature*/ ({B a}) {} is t8);
+ makeLive(/*needsSignature*/ ({C a}) {} is t8);
+ makeLive(/*needsSignature*/ ({D a}) {} is t8);
+ makeLive(/*needsSignature*/ ({Object a}) {} is t8);
+ makeLive(/*needsSignature*/ ({var a}) {} is t8);
+ makeLive(/*needsSignature*/ ({num a}) {} is t8);
+ makeLive(/*needsSignature*/ ({int a}) {} is t8);
+ makeLive(/*needsSignature*/ ({Map a}) {} is t8);
+ makeLive(
/*needsSignature*/ ({Map<List<Map<List, List<int>>>, List> a}) {} is t8);
- Expect.isTrue(/*needsSignature*/ ({List a}) {} is t8);
+ makeLive(/*needsSignature*/ ({List a}) {} is t8);
}
diff --git a/pkg/compiler/test/rti/data/type_argument_substitution.dart b/pkg/compiler/test/rti/data/type_argument_substitution.dart
index cbc19f9..a8f7369 100644
--- a/pkg/compiler/test/rti/data/type_argument_substitution.dart
+++ b/pkg/compiler/test/rti/data/type_argument_substitution.dart
@@ -4,11 +4,11 @@
// @dart = 2.7
+import 'package:compiler/src/util/testing.dart';
+
// Test that substitutions are emitted for classes that are only used as
// type arguments.
-import 'package:expect/expect.dart';
-
class K {}
/*class: A:explicit=[X<A<String*>*>*]*/
@@ -23,5 +23,5 @@
var v = new DateTime.now().millisecondsSinceEpoch != 42
? new X<B>()
: new X<A<String>>();
- Expect.isFalse(v is X<A<String>>);
+ makeLive(v is X<A<String>>);
}
diff --git a/pkg/compiler/test/rti/data/type_variable_function_type.dart b/pkg/compiler/test/rti/data/type_variable_function_type.dart
index 7b4543f..d36e45f 100644
--- a/pkg/compiler/test/rti/data/type_variable_function_type.dart
+++ b/pkg/compiler/test/rti/data/type_variable_function_type.dart
@@ -4,9 +4,9 @@
// @dart = 2.7
-// Based on tests\language_2\type_variable_function_type_test.dart
+import 'package:compiler/src/util/testing.dart';
-import 'package:expect/expect.dart';
+// Based on tests\language_2\type_variable_function_type_test.dart
typedef T Func<T>();
@@ -26,6 +26,6 @@
void main() {
dynamic x = new Foo<List<String>>();
if (new DateTime.now().millisecondsSinceEpoch == 42) x = new Foo<int>();
- Expect.isFalse(x.m(new Bar<String>().f()));
- Expect.isTrue(x.m(new Bar<List<String>>().f()));
+ makeLive(x.m(new Bar<String>().f()));
+ makeLive(x.m(new Bar<List<String>>().f()));
}
diff --git a/pkg/compiler/test/rti/emission/call.dart b/pkg/compiler/test/rti/emission/call.dart
index 921de31..6efcbf7 100644
--- a/pkg/compiler/test/rti/emission/call.dart
+++ b/pkg/compiler/test/rti/emission/call.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
/*class: A:checks=[],instance*/
class A {
@@ -15,6 +15,6 @@
test(o) => o is Function;
main() {
- Expect.isFalse(test(new A()));
- Expect.isFalse(test(null));
+ makeLive(test(new A()));
+ makeLive(test(null));
}
diff --git a/pkg/compiler/test/rti/emission/call_typed.dart b/pkg/compiler/test/rti/emission/call_typed.dart
index ab3dbfe..a5ece48 100644
--- a/pkg/compiler/test/rti/emission/call_typed.dart
+++ b/pkg/compiler/test/rti/emission/call_typed.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
/*class: A:checks=[],instance*/
class A {
@@ -15,6 +15,6 @@
test(o) => o is Function(int);
main() {
- Expect.isFalse(test(new A()));
- Expect.isFalse(test(null));
+ makeLive(test(new A()));
+ makeLive(test(null));
}
diff --git a/pkg/compiler/test/rti/emission/call_typed_generic.dart b/pkg/compiler/test/rti/emission/call_typed_generic.dart
index c80f395..7d770fd 100644
--- a/pkg/compiler/test/rti/emission/call_typed_generic.dart
+++ b/pkg/compiler/test/rti/emission/call_typed_generic.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
/*class: A:checks=[],instance*/
class A<T> {
@@ -15,6 +15,6 @@
test(o) => o is Function(int);
main() {
- Expect.isFalse(test(new A<int>()));
- Expect.isFalse(test(new A<String>()));
+ makeLive(test(new A<int>()));
+ makeLive(test(new A<String>()));
}
diff --git a/pkg/compiler/test/rti/emission/constructor_argument_static.dart b/pkg/compiler/test/rti/emission/constructor_argument_static.dart
index 01c651a..325f250 100644
--- a/pkg/compiler/test/rti/emission/constructor_argument_static.dart
+++ b/pkg/compiler/test/rti/emission/constructor_argument_static.dart
@@ -4,6 +4,8 @@
// @dart = 2.7
+import 'package:compiler/src/util/testing.dart';
+
/*spec.class: A1:checkedInstance,checks=[],instance*/
/*prod.class: A1:checks=[],instance*/
class A1 {}
@@ -33,7 +35,7 @@
abstract class Test2 {
@pragma('dart2js:noInline')
Test2(A2 x) {
- print(x);
+ makeLive(x);
}
}
diff --git a/pkg/compiler/test/rti/emission/dynamic_instance.dart b/pkg/compiler/test/rti/emission/dynamic_instance.dart
index 5afac9b..7e70cad 100644
--- a/pkg/compiler/test/rti/emission/dynamic_instance.dart
+++ b/pkg/compiler/test/rti/emission/dynamic_instance.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
/*class: B:checkedInstance,typeArgument*/
class B {}
@@ -25,6 +25,6 @@
test(o) => new C().method1<B>(o);
main() {
- Expect.isTrue(test(new D()));
- Expect.isFalse(test(null));
+ makeLive(test(new D()));
+ makeLive(test(null));
}
diff --git a/pkg/compiler/test/rti/emission/dynamic_type_argument.dart b/pkg/compiler/test/rti/emission/dynamic_type_argument.dart
index 6d21d6e..6fd84a6 100644
--- a/pkg/compiler/test/rti/emission/dynamic_type_argument.dart
+++ b/pkg/compiler/test/rti/emission/dynamic_type_argument.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
/*class: A:checkedInstance,checks=[],instance*/
class A<T> {}
@@ -31,7 +31,7 @@
test(o) => o is A<B>;
main() {
- Expect.isTrue(test(new C().method1<B>()));
- Expect.isTrue(test(new C().method1<D>()));
- Expect.isFalse(test(new C().method1<E>()));
+ makeLive(test(new C().method1<B>()));
+ makeLive(test(new C().method1<D>()));
+ makeLive(test(new C().method1<E>()));
}
diff --git a/pkg/compiler/test/rti/emission/dynamic_type_literal.dart b/pkg/compiler/test/rti/emission/dynamic_type_literal.dart
index 04c8efc..99fe934 100644
--- a/pkg/compiler/test/rti/emission/dynamic_type_literal.dart
+++ b/pkg/compiler/test/rti/emission/dynamic_type_literal.dart
@@ -6,9 +6,9 @@
/*class: global#Type:instance,typeLiteral*/
-import "package:expect/expect.dart";
+import "package:compiler/src/util/testing.dart";
void main(bool b) {
- Expect.isTrue(dynamic is Type);
- Expect.isFalse(dynamic == (b ? Type : dynamic)); // ?: avoids constant folding
+ makeLive(dynamic is Type);
+ makeLive(dynamic == (b ? Type : dynamic)); // ?: avoids constant folding
}
diff --git a/pkg/compiler/test/rti/emission/event_callback.dart b/pkg/compiler/test/rti/emission/event_callback.dart
index 5e77e38..a70c6f8 100644
--- a/pkg/compiler/test/rti/emission/event_callback.dart
+++ b/pkg/compiler/test/rti/emission/event_callback.dart
@@ -5,6 +5,7 @@
// @dart = 2.7
import 'dart:html';
+import 'package:compiler/src/util/testing.dart';
/*spec.class: global#Event:checkedInstance,checkedTypeArgument,checks=[$isEvent],instance,typeArgument*/
/*prod.class: global#Event:checkedTypeArgument,checks=[$isEvent],instance,typeArgument*/
@@ -14,21 +15,14 @@
/*prod.class: global#KeyboardEvent:checks=[$isKeyboardEvent],instance,typeArgument*/
void main() {
- print('InputElement');
var i = new InputElement();
- print('> onKeyPress');
i.onKeyPress.listen(onEvent);
- print('> onClick');
i.onClick.listen(onEvent);
- print('TextAreaElement');
var e = new TextAreaElement();
- print('> onKeyPress');
e.onKeyPress.listen(onEvent);
- print('> onClick');
e.onClick.listen(onEvent);
- print('Done!');
}
void onEvent(Event e) {
- print(e);
+ makeLive(e);
}
diff --git a/pkg/compiler/test/rti/emission/function_type_argument.dart b/pkg/compiler/test/rti/emission/function_type_argument.dart
index ee42353..a478a13 100644
--- a/pkg/compiler/test/rti/emission/function_type_argument.dart
+++ b/pkg/compiler/test/rti/emission/function_type_argument.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
/*spec.class: C:checkedInstance,checks=[],instance,typeArgument*/
/*prod.class: C:checks=[],instance,typeArgument*/
@@ -25,8 +25,8 @@
test2(o) => o is List<Function(int)>;
main() {
- Expect.isFalse(test1(new C()));
- Expect.isFalse(test1(new D()));
- Expect.isFalse(test2(<C>[]));
- Expect.isFalse(test2(<D>[]));
+ makeLive(test1(new C()));
+ makeLive(test1(new D()));
+ makeLive(test2(<C>[]));
+ makeLive(test2(<D>[]));
}
diff --git a/pkg/compiler/test/rti/emission/function_typed_arguments.dart b/pkg/compiler/test/rti/emission/function_typed_arguments.dart
index b09784a..806756c7 100644
--- a/pkg/compiler/test/rti/emission/function_typed_arguments.dart
+++ b/pkg/compiler/test/rti/emission/function_typed_arguments.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
/*class: A:checkedInstance,checks=[],instance*/
class A<T> {}
@@ -26,9 +26,9 @@
@pragma('dart2js:noInline')
test1() {
- Expect.isTrue(_test1(new A<void Function(C1)>()));
- Expect.isTrue(_test1(new A<void Function(B1<int>)>()));
- Expect.isFalse(_test1(new A<void Function(B1<String>)>()));
+ makeLive(_test1(new A<void Function(C1)>()));
+ makeLive(_test1(new A<void Function(B1<int>)>()));
+ makeLive(_test1(new A<void Function(B1<String>)>()));
}
@pragma('dart2js:noInline')
@@ -42,9 +42,9 @@
@pragma('dart2js:noInline')
test2() {
- Expect.isTrue(_test2(new A<C2 Function()>()));
- Expect.isFalse(_test2(new A<B2<int> Function()>()));
- Expect.isFalse(_test2(new A<B2<String> Function()>()));
+ makeLive(_test2(new A<C2 Function()>()));
+ makeLive(_test2(new A<B2<int> Function()>()));
+ makeLive(_test2(new A<B2<String> Function()>()));
}
@pragma('dart2js:noInline')
@@ -58,9 +58,9 @@
@pragma('dart2js:noInline')
test3() {
- Expect.isFalse(_test3(new A<void Function(C3)>()));
- Expect.isTrue(_test3(new A<void Function(B3<int>)>()));
- Expect.isFalse(_test3(new A<void Function(B3<String>)>()));
+ makeLive(_test3(new A<void Function(C3)>()));
+ makeLive(_test3(new A<void Function(B3<int>)>()));
+ makeLive(_test3(new A<void Function(B3<String>)>()));
}
@pragma('dart2js:noInline')
@@ -74,9 +74,9 @@
@pragma('dart4js:noInline')
test4() {
- Expect.isTrue(_test4(new A<C4 Function()>()));
- Expect.isTrue(_test4(new A<B4<int> Function()>()));
- Expect.isFalse(_test4(new A<B4<String> Function()>()));
+ makeLive(_test4(new A<C4 Function()>()));
+ makeLive(_test4(new A<B4<int> Function()>()));
+ makeLive(_test4(new A<B4<String> Function()>()));
}
@pragma('dart4js:noInline')
@@ -90,9 +90,9 @@
@pragma('dart2js:noInline')
test5() {
- Expect.isTrue(_test5(new A<void Function(C5 Function())>()));
- Expect.isTrue(_test5(new A<void Function(B5<int> Function())>()));
- Expect.isFalse(_test5(new A<void Function(B5<String> Function())>()));
+ makeLive(_test5(new A<void Function(C5 Function())>()));
+ makeLive(_test5(new A<void Function(B5<int> Function())>()));
+ makeLive(_test5(new A<void Function(B5<String> Function())>()));
}
@pragma('dart2js:noInline')
@@ -106,9 +106,9 @@
@pragma('dart2js:noInline')
test6() {
- Expect.isTrue(_test6(new A<void Function(void Function(C6))>()));
- Expect.isFalse(_test6(new A<void Function(void Function(B6<int>))>()));
- Expect.isFalse(_test6(new A<void Function(void Function(B6<String>))>()));
+ makeLive(_test6(new A<void Function(void Function(C6))>()));
+ makeLive(_test6(new A<void Function(void Function(B6<int>))>()));
+ makeLive(_test6(new A<void Function(void Function(B6<String>))>()));
}
@pragma('dart2js:noInline')
diff --git a/pkg/compiler/test/rti/emission/future_or.dart b/pkg/compiler/test/rti/emission/future_or.dart
index 61a2b8d..6fd0a4b 100644
--- a/pkg/compiler/test/rti/emission/future_or.dart
+++ b/pkg/compiler/test/rti/emission/future_or.dart
@@ -5,7 +5,7 @@
// @dart = 2.7
import 'dart:async';
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
/*class: global#Future:checkedInstance*/
@@ -43,8 +43,8 @@
test(o) => o is FutureOr<A>;
main() {
- Expect.isTrue(test(new A()));
- Expect.isTrue(test(new FutureMock<A>(new A())));
- Expect.isFalse(test(new B()));
- Expect.isFalse(test(new FutureMock<B>(new B())));
+ makeLive(test(new A()));
+ makeLive(test(new FutureMock<A>(new A())));
+ makeLive(test(new B()));
+ makeLive(test(new FutureMock<B>(new B())));
}
diff --git a/pkg/compiler/test/rti/emission/future_or_future_or.dart b/pkg/compiler/test/rti/emission/future_or_future_or.dart
index 55abe4b..4d62f43 100644
--- a/pkg/compiler/test/rti/emission/future_or_future_or.dart
+++ b/pkg/compiler/test/rti/emission/future_or_future_or.dart
@@ -5,7 +5,7 @@
// @dart = 2.7
import 'dart:async';
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
/*class: global#Future:checkedInstance*/
@@ -19,6 +19,6 @@
test(o) => o is FutureOr<FutureOr<A>>;
main() {
- Expect.isTrue(test(new A()));
- Expect.isFalse(test(new B()));
+ makeLive(test(new A()));
+ makeLive(test(new B()));
}
diff --git a/pkg/compiler/test/rti/emission/future_or_future_or_generic.dart b/pkg/compiler/test/rti/emission/future_or_future_or_generic.dart
index 629d268..5a5ebf3 100644
--- a/pkg/compiler/test/rti/emission/future_or_future_or_generic.dart
+++ b/pkg/compiler/test/rti/emission/future_or_future_or_generic.dart
@@ -5,7 +5,7 @@
// @dart = 2.7
import 'dart:async';
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
/*class: global#Future:checkedInstance*/
@@ -25,6 +25,6 @@
class D {}
main() {
- Expect.isTrue(new A<FutureOr<C>>().m(new B<C>()));
- Expect.isFalse(new A<FutureOr<D>>().m(new B<C>()));
+ makeLive(new A<FutureOr<C>>().m(new B<C>()));
+ makeLive(new A<FutureOr<D>>().m(new B<C>()));
}
diff --git a/pkg/compiler/test/rti/emission/future_or_generic.dart b/pkg/compiler/test/rti/emission/future_or_generic.dart
index 7576c46..400464e 100644
--- a/pkg/compiler/test/rti/emission/future_or_generic.dart
+++ b/pkg/compiler/test/rti/emission/future_or_generic.dart
@@ -5,7 +5,7 @@
// @dart = 2.7
import 'dart:async';
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
/*class: global#Future:checkedInstance*/
@@ -48,8 +48,8 @@
}
main() {
- Expect.isTrue(new A<B>().m(new B()));
- Expect.isTrue(new A<B>().m(new FutureMock<B>(new B())));
- Expect.isFalse(new A<C>().m(new B()));
- Expect.isFalse(new A<C>().m(new FutureMock<B>(new B())));
+ makeLive(new A<B>().m(new B()));
+ makeLive(new A<B>().m(new FutureMock<B>(new B())));
+ makeLive(new A<C>().m(new B()));
+ makeLive(new A<C>().m(new FutureMock<B>(new B())));
}
diff --git a/pkg/compiler/test/rti/emission/future_or_generic2.dart b/pkg/compiler/test/rti/emission/future_or_generic2.dart
index ae3dc31..1bb791c 100644
--- a/pkg/compiler/test/rti/emission/future_or_generic2.dart
+++ b/pkg/compiler/test/rti/emission/future_or_generic2.dart
@@ -5,7 +5,7 @@
// @dart = 2.7
import 'dart:async';
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
/*class: global#Future:checkedInstance*/
@@ -25,6 +25,6 @@
class D {}
main() {
- Expect.isTrue(new A<C>().m(new B<C>()));
- Expect.isFalse(new A<D>().m(new B<C>()));
+ makeLive(new A<C>().m(new B<C>()));
+ makeLive(new A<D>().m(new B<C>()));
}
diff --git a/pkg/compiler/test/rti/emission/future_or_type_argument.dart b/pkg/compiler/test/rti/emission/future_or_type_argument.dart
index b095626..2f83645 100644
--- a/pkg/compiler/test/rti/emission/future_or_type_argument.dart
+++ b/pkg/compiler/test/rti/emission/future_or_type_argument.dart
@@ -5,7 +5,7 @@
// @dart = 2.7
import 'dart:async';
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
/*class: global#Future:typeArgument*/
@@ -22,8 +22,8 @@
test(o) => o is A<FutureOr<B>>;
main() {
- Expect.isTrue(test(new A<B>()));
- Expect.isTrue(test(new A<Future<B>>()));
- Expect.isFalse(test(new A<C>()));
- Expect.isFalse(test(new A<Future<C>>()));
+ makeLive(test(new A<B>()));
+ makeLive(test(new A<Future<B>>()));
+ makeLive(test(new A<C>()));
+ makeLive(test(new A<Future<C>>()));
}
diff --git a/pkg/compiler/test/rti/emission/inherited_is.dart b/pkg/compiler/test/rti/emission/inherited_is.dart
index 608ae74..92c8579 100644
--- a/pkg/compiler/test/rti/emission/inherited_is.dart
+++ b/pkg/compiler/test/rti/emission/inherited_is.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
/*class: A:checkedInstance*/
class A {}
@@ -22,6 +22,6 @@
test(o) => o is A;
main() {
- Expect.isTrue(test(new D()));
- Expect.isFalse(test(null));
+ makeLive(test(new D()));
+ makeLive(test(null));
}
diff --git a/pkg/compiler/test/rti/emission/inherited_is2.dart b/pkg/compiler/test/rti/emission/inherited_is2.dart
index c63bcad..7140429 100644
--- a/pkg/compiler/test/rti/emission/inherited_is2.dart
+++ b/pkg/compiler/test/rti/emission/inherited_is2.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
/*class: A:checkedInstance*/
class A {}
@@ -22,6 +22,6 @@
test(o) => o is A;
main() {
- Expect.isTrue(test(new D()));
- Expect.isFalse(test(null));
+ makeLive(test(new D()));
+ makeLive(test(null));
}
diff --git a/pkg/compiler/test/rti/emission/instantiated_type_literal.dart b/pkg/compiler/test/rti/emission/instantiated_type_literal.dart
index de04f0c..5e4cee2 100644
--- a/pkg/compiler/test/rti/emission/instantiated_type_literal.dart
+++ b/pkg/compiler/test/rti/emission/instantiated_type_literal.dart
@@ -2,7 +2,7 @@
// 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 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
/*class: A:checks=[],instance*/
class A<T> {
@@ -20,6 +20,6 @@
var b = new B<int, String>();
String name2 = '${b.instanceMethod<bool>()}';
- Expect.equals('A<int>', name1);
- Expect.equals('B<String, bool>', name2);
+ makeLive('A<int>' == name1);
+ makeLive('B<String, bool>' == name2);
}
diff --git a/pkg/compiler/test/rti/emission/jsinterop_generic.dart b/pkg/compiler/test/rti/emission/jsinterop_generic.dart
index 31cade2..8281ee4 100644
--- a/pkg/compiler/test/rti/emission/jsinterop_generic.dart
+++ b/pkg/compiler/test/rti/emission/jsinterop_generic.dart
@@ -13,7 +13,7 @@
// jsinterop classes implement the same interface.
/*class: global#LegacyJavaScriptObject:checks=[$isA,$isB,$isB],instance*/
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
import 'package:js/js.dart';
/*class: A:checkedInstance,checks=[],instance,onlyForRti*/
@@ -51,11 +51,11 @@
}
test(o) {
- Expect.isTrue(o is A<int>, "Expected $o to be A<int>");
- Expect.isTrue(o is A<String>, "Expected $o to be A<String>");
+ makeLive(o is A<int>);
+ makeLive(o is A<String>);
- Expect.isTrue(o is B<int>, "Expected $o to be B<int>");
- Expect.isTrue(o is B<String>, "Expected $o to be B<String>");
+ makeLive(o is B<int>);
+ makeLive(o is B<String>);
- Expect.isFalse(o is D<int>, "Expected $o not to be D<int>");
+ makeLive(o is D<int>);
}
diff --git a/pkg/compiler/test/rti/emission/jsinterop_generic_factory_args.dart b/pkg/compiler/test/rti/emission/jsinterop_generic_factory_args.dart
index 77b181d..3945cdc 100644
--- a/pkg/compiler/test/rti/emission/jsinterop_generic_factory_args.dart
+++ b/pkg/compiler/test/rti/emission/jsinterop_generic_factory_args.dart
@@ -9,7 +9,7 @@
/*class: global#LegacyJavaScriptObject:*/
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
import 'package:js/js.dart';
@JS()
@@ -44,13 +44,11 @@
}
test1(o) {
- Expect.isTrue(o is List<A<int>>, "Expected $o to be List<A<int>>");
- Expect.isTrue(o is List<A<String>>, "Expected $o to be List<A<String>>");
+ makeLive(o is List<A<int>>);
+ makeLive(o is List<A<String>>);
}
test2(o) {
- Expect.isTrue(o is List<A<int> Function()>,
- "Expected $o to be List<A<int> Function()>");
- Expect.isTrue(o is List<A<String> Function()>,
- "Expected $o to be List<A<String> Function()>");
+ makeLive(o is List<A<int> Function()>);
+ makeLive(o is List<A<String> Function()>);
}
diff --git a/pkg/compiler/test/rti/emission/local_function_list_literal.dart b/pkg/compiler/test/rti/emission/local_function_list_literal.dart
index fa8d54f..cf87b88 100644
--- a/pkg/compiler/test/rti/emission/local_function_list_literal.dart
+++ b/pkg/compiler/test/rti/emission/local_function_list_literal.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
/*spec.class: global#JSArray:checkedInstance,checks=[$isIterable,$isList],instance*/
/*prod.class: global#JSArray:checks=[$isList],instance*/
@@ -18,6 +18,6 @@
test(o) => o is List<int>;
main() {
- Expect.isTrue(test(method<int>().call()));
- Expect.isFalse(test(method<String>().call()));
+ makeLive(test(method<int>().call()));
+ makeLive(test(method<String>().call()));
}
diff --git a/pkg/compiler/test/rti/emission/local_function_map_literal.dart b/pkg/compiler/test/rti/emission/local_function_map_literal.dart
index 8c54820..0280357 100644
--- a/pkg/compiler/test/rti/emission/local_function_map_literal.dart
+++ b/pkg/compiler/test/rti/emission/local_function_map_literal.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
/*spec.class: global#JsLinkedHashMap:checkedInstance,checks=[],instance*/
@@ -22,6 +22,6 @@
test(o) => o is Map<int, int>;
main() {
- Expect.isTrue(test(method<int>().call()));
- Expect.isFalse(test(method<String>().call()));
+ makeLive(test(method<int>().call()));
+ makeLive(test(method<String>().call()));
}
diff --git a/pkg/compiler/test/rti/emission/mixin_mixin2.dart b/pkg/compiler/test/rti/emission/mixin_mixin2.dart
index fb95f94..6e73feb 100644
--- a/pkg/compiler/test/rti/emission/mixin_mixin2.dart
+++ b/pkg/compiler/test/rti/emission/mixin_mixin2.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import "package:expect/expect.dart";
+import "package:compiler/src/util/testing.dart";
/*class: M:checks=[]*/
class M<T> {
@@ -38,8 +38,8 @@
class H<T> extends D<Map<String, T>> {}
main() {
- Expect.equals("num", new E().t().toString());
- Expect.equals("String", new F().t().toString());
- Expect.equals("List<bool>", new G<bool>().t().toString());
- Expect.equals("List<Set<Map<String, int>>>", new H<int>().t().toString());
+ makeLive("num" == new E().t().toString());
+ makeLive("String" == new F().t().toString());
+ makeLive("List<bool>" == new G<bool>().t().toString());
+ makeLive("List<Set<Map<String, int>>>" == new H<int>().t().toString());
}
diff --git a/pkg/compiler/test/rti/emission/mixin_mixin4.dart b/pkg/compiler/test/rti/emission/mixin_mixin4.dart
index e77b220..0dde26f 100644
--- a/pkg/compiler/test/rti/emission/mixin_mixin4.dart
+++ b/pkg/compiler/test/rti/emission/mixin_mixin4.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import "package:expect/expect.dart";
+import "package:compiler/src/util/testing.dart";
/*class: I:checkedInstance*/
class I<T> {}
@@ -30,12 +30,12 @@
@pragma('dart2js:noInline')
test(c) {
- Expect.equals("Map<int, List<bool>>", c.t().toString());
- Expect.isTrue(c is I<List<bool>>);
- Expect.isTrue(c is J<bool>);
- Expect.isTrue(c is S<int>);
- Expect.isTrue(c is A<int, List<bool>>);
- Expect.isTrue(c is M<Map<int, List<bool>>>);
+ makeLive("Map<int, List<bool>>" == c.t().toString());
+ makeLive(c is I<List<bool>>);
+ makeLive(c is J<bool>);
+ makeLive(c is S<int>);
+ makeLive(c is A<int, List<bool>>);
+ makeLive(c is M<Map<int, List<bool>>>);
}
main() {
diff --git a/pkg/compiler/test/rti/emission/mixin_subtype.dart b/pkg/compiler/test/rti/emission/mixin_subtype.dart
index 57b30b3..7f0656a 100644
--- a/pkg/compiler/test/rti/emission/mixin_subtype.dart
+++ b/pkg/compiler/test/rti/emission/mixin_subtype.dart
@@ -6,7 +6,7 @@
// Derived from language_2/mixin_declaration/mixin_declaration_subtype_test.
-import "package:expect/expect.dart";
+import "package:compiler/src/util/testing.dart";
// A mixin declaration introduces a type.
@@ -82,33 +82,30 @@
/*class: GD:checkedInstance,typeArgument*/
class GD<T> = GC<T> with GM<T>;
-@pragma('dart2js:noInline')
-test(o) {}
-
main() {
- test(new M3());
- test(new D2());
- test(new D4());
- test(new E5());
- Expect.subtype<M1, A>();
- Expect.subtype<M1, B>();
- Expect.subtype<M1, I>();
- Expect.subtype<M1, J>();
- Expect.subtype<D1, M1>();
- Expect.subtype<D2, M2>();
- Expect.subtype<D3, M3>();
- Expect.subtype<D4, M4>();
- Expect.subtype<D5, M5>();
- Expect.subtype<E5, M5>();
- Expect.notSubtype<M1, C>();
- Expect.notSubtype<C, M1>();
+ makeLive(new M3());
+ makeLive(new D2());
+ makeLive(new D4());
+ makeLive(new E5());
+ subtype<M1, A>();
+ subtype<M1, B>();
+ subtype<M1, I>();
+ subtype<M1, J>();
+ subtype<D1, M1>();
+ subtype<D2, M2>();
+ subtype<D3, M3>();
+ subtype<D4, M4>();
+ subtype<D5, M5>();
+ subtype<E5, M5>();
+ notSubtype<M1, C>();
+ notSubtype<C, M1>();
- Expect.subtype<GM<int>, GA<int>>();
- Expect.subtype<GM<int>, GB<List<int>>>();
- Expect.subtype<GM<int>, GI<Iterable<int>>>();
- Expect.subtype<GM<int>, GJ<Set<int>>>();
- Expect.subtype<GD<int>, GM<int>>();
- Expect.subtype<GD<int>, GC<int>>();
- Expect.notSubtype<GM<int>, GC<int>>();
- Expect.notSubtype<GC<int>, GM<int>>();
+ subtype<GM<int>, GA<int>>();
+ subtype<GM<int>, GB<List<int>>>();
+ subtype<GM<int>, GI<Iterable<int>>>();
+ subtype<GM<int>, GJ<Set<int>>>();
+ subtype<GD<int>, GM<int>>();
+ subtype<GD<int>, GC<int>>();
+ notSubtype<GM<int>, GC<int>>();
+ notSubtype<GC<int>, GM<int>>();
}
diff --git a/pkg/compiler/test/rti/emission/mixin_type_arguments.dart b/pkg/compiler/test/rti/emission/mixin_type_arguments.dart
index eced8f0..e3177da 100644
--- a/pkg/compiler/test/rti/emission/mixin_type_arguments.dart
+++ b/pkg/compiler/test/rti/emission/mixin_type_arguments.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import 'package:expect/expect.dart' show Expect;
+import 'package:compiler/src/util/testing.dart';
/*class: A:typeArgument*/
class A {}
@@ -84,26 +84,22 @@
trace(x) => "${x.m1()}, ${x.m2()}, ${x.m3()}, ${x.m4()}, ${x.m5()}";
main() {
- Expect.stringEquals(
- "M1<dynamic>, M2<A>, M3<dynamic>, M4<B>, M5<C>", trace(new C1()));
- Expect.stringEquals("M1<A>, M2<B>, M3<C>, M4<D>, M5<E>", trace(new C2()));
- Expect.stringEquals(
- "M1<A>, M2<dynamic>, M3<dynamic>, M4<dynamic>, M5<B>", trace(new C3()));
- Expect.stringEquals(
- "M1<A>, M2<F>, M3<dynamic>, M4<dynamic>, M5<B>", trace(new C3<F>()));
- Expect.stringEquals(
- "M1<dynamic>, M2<A>, M3<dynamic>, M4<B>, M5<C>", trace(new C4()));
- Expect.stringEquals("M1<A>, M2<B>, M3<C>, M4<D>, M5<E>", trace(new C5()));
- Expect.stringEquals(
- "M1<A>, M2<dynamic>, M3<dynamic>, M4<dynamic>, M5<B>", trace(new C6()));
- Expect.stringEquals(
- "M1<A>, M2<F>, M3<dynamic>, M4<dynamic>, M5<B>", trace(new C6<F>()));
- Expect.stringEquals("M1<A>, M2<A>, M3<A>, M4<A>, M5<A>", trace(new C7()));
- Expect.stringEquals("M1<A>, M2<A>, M3<A>, M4<A>, M5<A>", trace(new C8()));
- Expect.stringEquals(
- "M1<List<A>>, M2<List<A>>, M3<List<A>>, M4<List<A>>, M5<List<A>>",
+ makeLive("M1<dynamic>, M2<A>, M3<dynamic>, M4<B>, M5<C>" == trace(new C1()));
+ makeLive("M1<A>, M2<B>, M3<C>, M4<D>, M5<E>" == trace(new C2()));
+ makeLive(
+ "M1<A>, M2<dynamic>, M3<dynamic>, M4<dynamic>, M5<B>" == trace(new C3()));
+ makeLive(
+ "M1<A>, M2<F>, M3<dynamic>, M4<dynamic>, M5<B>" == trace(new C3<F>()));
+ makeLive("M1<dynamic>, M2<A>, M3<dynamic>, M4<B>, M5<C>" == trace(new C4()));
+ makeLive("M1<A>, M2<B>, M3<C>, M4<D>, M5<E>" == trace(new C5()));
+ makeLive(
+ "M1<A>, M2<dynamic>, M3<dynamic>, M4<dynamic>, M5<B>" == trace(new C6()));
+ makeLive(
+ "M1<A>, M2<F>, M3<dynamic>, M4<dynamic>, M5<B>" == trace(new C6<F>()));
+ makeLive("M1<A>, M2<A>, M3<A>, M4<A>, M5<A>" == trace(new C7()));
+ makeLive("M1<A>, M2<A>, M3<A>, M4<A>, M5<A>" == trace(new C8()));
+ makeLive("M1<List<A>>, M2<List<A>>, M3<List<A>>, M4<List<A>>, M5<List<A>>" ==
trace(new C9()));
- Expect.stringEquals(
- "M1<List<A>>, M2<List<A>>, M3<List<A>>, M4<List<A>>, M5<List<A>>",
+ makeLive("M1<List<A>>, M2<List<A>>, M3<List<A>>, M4<List<A>>, M5<List<A>>" ==
trace(new CA()));
}
diff --git a/pkg/compiler/test/rti/emission/native.dart b/pkg/compiler/test/rti/emission/native.dart
index 6e75a73..5c1e846 100644
--- a/pkg/compiler/test/rti/emission/native.dart
+++ b/pkg/compiler/test/rti/emission/native.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import "package:expect/expect.dart";
+import "package:compiler/src/util/testing.dart";
// ignore: import_internal_library
import 'dart:_js_helper' show Native;
// ignore: import_internal_library
@@ -27,9 +27,9 @@
@pragma('dart2js:noInline')
testNative() {
var x = makeP();
- Expect.isTrue(x is Purple);
+ makeLive(x is Purple);
x = makeQ();
- Expect.isFalse(x is Purple);
+ makeLive(x is Purple);
}
main() {
diff --git a/pkg/compiler/test/rti/emission/optimized_is_check.dart b/pkg/compiler/test/rti/emission/optimized_is_check.dart
index 726440d..58ef9aa 100644
--- a/pkg/compiler/test/rti/emission/optimized_is_check.dart
+++ b/pkg/compiler/test/rti/emission/optimized_is_check.dart
@@ -4,6 +4,8 @@
// @dart = 2.7
+import 'package:compiler/src/util/testing.dart';
+
// It is sometimes possible to compile is-checks to 'instanceof', when the class
// is not in an 'implements' clause or used as a mixin.
@@ -51,19 +53,19 @@
var removed = Removed(); // This is optimized out.
// Tests that can be compiled to instanceof:
- if (things[0] is Instantiated) print('expected');
- if (things[1] is Instantiated) print('unexpected');
- if (things[1] is Removed) print('unexpected');
- if (things[1] is DeferredAndRemoved) print('unexpected');
- if (things[1] is Deferred) print('unexpected');
+ makeLive(things[0] is Instantiated);
+ makeLive(things[1] is Instantiated);
+ makeLive(things[1] is Removed);
+ makeLive(things[1] is DeferredAndRemoved);
+ makeLive(things[1] is Deferred);
// Tests that might be optimized to false since there are no allocations:
- if (things[1] is Unused) print('unexpected');
- if (things[1] is UsedAsTypeParameter) print('unexpected');
+ makeLive(things[1] is Unused);
+ makeLive(things[1] is UsedAsTypeParameter);
- if (checkX.check(things[0])) print('expected');
- if (checkX.check(things[1])) print('unexpected');
- if (checkU1.check(things[1])) print('unexpected');
- if (checkU2.check(things[1])) print('unexpected');
+ makeLive(checkX.check(things[0]));
+ makeLive(checkX.check(things[1]));
+ makeLive(checkU1.check(things[1]));
+ makeLive(checkU2.check(things[1]));
// ignore: UNUSED_LOCAL_VARIABLE
var removed2 = DeferredAndRemoved(); // This is optimized out.
@@ -72,13 +74,13 @@
things.setRange(0, 3, [Instantiated(), 1, Deferred()]);
// Tests that can be compiled to instanceof:
- if (things[0] is Instantiated) print('expected');
- if (things[1] is Instantiated) print('unexpected');
- if (things[1] is Removed) print('unexpected');
- if (things[1] is DeferredAndRemoved) print('unexpected');
- if (things[1] is Deferred) print('unexpected');
- if (things[2] is Deferred) print('expected');
+ makeLive(things[0] is Instantiated);
+ makeLive(things[1] is Instantiated);
+ makeLive(things[1] is Removed);
+ makeLive(things[1] is DeferredAndRemoved);
+ makeLive(things[1] is Deferred);
+ makeLive(things[2] is Deferred);
// Tests that might be optimized to false since there are no allocations:
- if (things[1] is Unused) print('unexpected');
- if (things[1] is UsedAsTypeParameter) print('unexpected');
+ makeLive(things[1] is Unused);
+ makeLive(things[1] is UsedAsTypeParameter);
}
diff --git a/pkg/compiler/test/rti/emission/regress_18713.dart b/pkg/compiler/test/rti/emission/regress_18713.dart
index 6bd17d3..d2df779 100644
--- a/pkg/compiler/test/rti/emission/regress_18713.dart
+++ b/pkg/compiler/test/rti/emission/regress_18713.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import "package:expect/expect.dart";
+import "package:compiler/src/util/testing.dart";
/*class: T:checks=[],indirectInstance*/
class T<X> {
@@ -28,13 +28,13 @@
main() {
var ts = new TS<int, String>();
- Expect.equals("String", ts.sType.toString());
- Expect.equals("int", ts.tType.toString());
- Expect.equals("String", ts.getSType.toString());
- Expect.equals("int", ts.getTType.toString());
+ makeLive("String" == ts.sType.toString());
+ makeLive("int" == ts.tType.toString());
+ makeLive("String" == ts.getSType.toString());
+ makeLive("int" == ts.getTType.toString());
- Expect.equals("String", dyn(ts).sType.toString());
- Expect.equals("int", dyn(ts).tType.toString());
- Expect.equals("String", dyn(ts).getSType.toString());
- Expect.equals("int", dyn(ts).getTType.toString());
+ makeLive("String" == dyn(ts).sType.toString());
+ makeLive("int" == dyn(ts).tType.toString());
+ makeLive("String" == dyn(ts).getSType.toString());
+ makeLive("int" == dyn(ts).getTType.toString());
}
diff --git a/pkg/compiler/test/rti/emission/replaced_type_variable.dart b/pkg/compiler/test/rti/emission/replaced_type_variable.dart
index 92ccac4..49fa658 100644
--- a/pkg/compiler/test/rti/emission/replaced_type_variable.dart
+++ b/pkg/compiler/test/rti/emission/replaced_type_variable.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
// This class is inlined away.
/*class: Class:checks=[],instance*/
@@ -18,7 +18,7 @@
class A {}
@pragma('dart2js:noInline')
-test(o) => Expect.notEquals('dynamic', '$o');
+test(o) => makeLive('dynamic' != '$o');
main() {
test(const Class<A>().type);
diff --git a/pkg/compiler/test/rti/emission/runtime_type.dart b/pkg/compiler/test/rti/emission/runtime_type.dart
index d047f5f..d64a51d 100644
--- a/pkg/compiler/test/rti/emission/runtime_type.dart
+++ b/pkg/compiler/test/rti/emission/runtime_type.dart
@@ -4,6 +4,8 @@
// @dart = 2.7
+import 'package:compiler/src/util/testing.dart';
+
/*class: A:checks=[],instance*/
class A<T> {}
@@ -11,5 +13,5 @@
class B<T> {}
main() {
- print("A<B<int>>" == new A<B<int>>().runtimeType.toString());
+ makeLive("A<B<int>>" == new A<B<int>>().runtimeType.toString());
}
diff --git a/pkg/compiler/test/rti/emission/runtime_type_instantiate_to_string1.dart b/pkg/compiler/test/rti/emission/runtime_type_instantiate_to_string1.dart
index 8f20f2e..e6da07f 100644
--- a/pkg/compiler/test/rti/emission/runtime_type_instantiate_to_string1.dart
+++ b/pkg/compiler/test/rti/emission/runtime_type_instantiate_to_string1.dart
@@ -4,9 +4,11 @@
// @dart = 2.7
+import 'package:compiler/src/util/testing.dart';
+
main() {
/*spec.checks=[$signature],instance*/
/*prod.checks=[],instance*/ T id<T>(T t) => t;
int Function(int) x = id;
- print("${x.runtimeType}");
+ makeLive("${x.runtimeType}");
}
diff --git a/pkg/compiler/test/rti/emission/runtime_type_instantiate_to_string2.dart b/pkg/compiler/test/rti/emission/runtime_type_instantiate_to_string2.dart
index ab00cba..75b712e 100644
--- a/pkg/compiler/test/rti/emission/runtime_type_instantiate_to_string2.dart
+++ b/pkg/compiler/test/rti/emission/runtime_type_instantiate_to_string2.dart
@@ -4,9 +4,11 @@
// @dart = 2.7
+import 'package:compiler/src/util/testing.dart';
+
T id<T>(T t) => t;
main() {
int Function(int) x = id;
- print("${x.runtimeType}");
+ makeLive("${x.runtimeType}");
}
diff --git a/pkg/compiler/test/rti/emission/runtime_type_instantiate_to_string3.dart b/pkg/compiler/test/rti/emission/runtime_type_instantiate_to_string3.dart
index 326ed8f..1c6aabc 100644
--- a/pkg/compiler/test/rti/emission/runtime_type_instantiate_to_string3.dart
+++ b/pkg/compiler/test/rti/emission/runtime_type_instantiate_to_string3.dart
@@ -4,6 +4,8 @@
// @dart = 2.7
+import 'package:compiler/src/util/testing.dart';
+
/*class: Class:checks=[],instance*/
class Class {
T id<T>(T t) => t;
@@ -11,5 +13,5 @@
main() {
int Function(int) x = new Class().id;
- print("${x.runtimeType}");
+ makeLive("${x.runtimeType}");
}
diff --git a/pkg/compiler/test/rti/emission/subtype_named_args.dart b/pkg/compiler/test/rti/emission/subtype_named_args.dart
index ecc3fed..0f24520 100644
--- a/pkg/compiler/test/rti/emission/subtype_named_args.dart
+++ b/pkg/compiler/test/rti/emission/subtype_named_args.dart
@@ -6,7 +6,7 @@
// From co19/Language/Types/Function_Types/subtype_named_args_t02.
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
/*spec.class: A:checkedInstance,checkedTypeArgument,typeArgument*/
/*prod.class: A:checkedTypeArgument,typeArgument*/
@@ -54,56 +54,56 @@
typedef okWithDynamicFunc_2({int x, bool y, List<Map> z, classesFunc v});
main() {
- Expect.isTrue(
+ makeLive(
/*checks=[$signature],instance*/
({D a, B b, C c, A d}) {} is classesFunc);
- Expect.isTrue(
+ makeLive(
/*checks=[$signature],instance*/
({A a, A b, A c, A d}) {} is classesFunc);
- Expect.isTrue(
+ makeLive(
/*checks=[$signature],instance*/
({D a, A1 b, A1 c, A1 d}) {} is classesFunc);
- Expect.isTrue(
+ makeLive(
/*checks=[$signature],instance*/
({D a, A2 b, A2 c, A2 d}) {} is classesFunc);
- Expect.isTrue(
+ makeLive(
/*checks=[$signature],instance*/
({D a, D b, D c, D d}) {} is classesFunc);
- Expect.isTrue(
+ makeLive(
/*checks=[$signature],instance*/
({var a, var b, var c, var d}) {} is classesFunc);
- Expect.isTrue(
+ makeLive(
/*checks=[$signature],instance*/
({Object a, Object b, Object c, Object d}) {} is classesFunc);
- Expect.isTrue(
+ makeLive(
/*checks=[$signature],instance*/
({Map<num, num> m, List<List<A1>> l, G<A, A1, A1, A1> g}) {}
is genericsFunc);
- Expect.isTrue(
+ makeLive(
/*checks=[$signature],instance*/
({Map<int, int> m, List<List<D>> l, G<D, D, D, D> g}) {} is genericsFunc);
- Expect.isTrue(
+ makeLive(
/*checks=[$signature],instance*/
({var m, var l, var g}) {} is genericsFunc);
- Expect.isTrue(
+ makeLive(
/*checks=[$signature],instance*/
({Object m, Object l, Object g}) {} is genericsFunc);
- Expect.isTrue(
+ makeLive(
/*checks=[$signature],instance*/
({A x, G y, mixFunc z, var v}) {} is dynamicFunc);
- Expect.isTrue(
+ makeLive(
/*checks=[$signature],instance*/
({int x, bool y, List<Map> z, classesFunc v}) {} is dynamicFunc);
- Expect.isTrue(
+ makeLive(
/*checks=[$signature],instance*/
(
{okWithClassesFunc_1 f1,
okWithGenericsFunc_1 f2,
okWithDynamicFunc_1 f3}) {} is funcFunc);
- Expect.isTrue(
+ makeLive(
/*checks=[$signature],instance*/
(
{okWithClassesFunc_2 f1,
diff --git a/pkg/compiler/test/rti/emission/superclass_as.dart b/pkg/compiler/test/rti/emission/superclass_as.dart
index 01f4a3e..e96e978 100644
--- a/pkg/compiler/test/rti/emission/superclass_as.dart
+++ b/pkg/compiler/test/rti/emission/superclass_as.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
/*class: A:checkedInstance,checks=[],instance*/
class A<T> {}
@@ -22,6 +22,6 @@
test(o) => o is A<int>;
main() {
- Expect.isTrue(test(new C<int>().method()));
- Expect.isFalse(test(new C<String>().method()));
+ makeLive(test(new C<int>().method()));
+ makeLive(test(new C<String>().method()));
}
diff --git a/pkg/compiler/test/rti/emission/tear_off_types.dart b/pkg/compiler/test/rti/emission/tear_off_types.dart
index ef8fb52..0c0b64f 100644
--- a/pkg/compiler/test/rti/emission/tear_off_types.dart
+++ b/pkg/compiler/test/rti/emission/tear_off_types.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
main() {
test1();
@@ -24,9 +24,9 @@
@pragma('dart2js:noInline')
test1() {
- Expect.isTrue(_test1(method1a));
- Expect.isTrue(_test1(method1b));
- Expect.isFalse(_test1(method1c));
+ makeLive(_test1(method1a));
+ makeLive(_test1(method1b));
+ makeLive(_test1(method1c));
}
B1 method1a() => null;
@@ -46,9 +46,9 @@
@pragma('dart2js:noInline')
test2() {
- Expect.isFalse(_test2(method2a));
- Expect.isTrue(_test2(method2b));
- Expect.isFalse(_test2(method2c));
+ makeLive(_test2(method2a));
+ makeLive(_test2(method2b));
+ makeLive(_test2(method2c));
}
void method2a(B2 b) {}
@@ -68,9 +68,9 @@
@pragma('dart3js:noInline')
test3() {
- Expect.isTrue(_test3(method3a));
- Expect.isTrue(_test3(method3b));
- Expect.isFalse(_test3(method3c));
+ makeLive(_test3(method3a));
+ makeLive(_test3(method3b));
+ makeLive(_test3(method3c));
}
void method3a(B3 b) {}
@@ -88,9 +88,9 @@
@pragma('dart4js:noInline')
test4() {
- Expect.isTrue(_test4(method4a));
- Expect.isFalse(_test4(method4b));
- Expect.isFalse(_test4(method4c));
+ makeLive(_test4(method4a));
+ makeLive(_test4(method4b));
+ makeLive(_test4(method4c));
}
B4 method4a() => null;
@@ -108,9 +108,9 @@
@pragma('dart2js:noInline')
test5() {
- Expect.isTrue(_test5(method5a));
- Expect.isTrue(_test5(method5b));
- Expect.isFalse(_test5(method5c));
+ makeLive(_test5(method5a));
+ makeLive(_test5(method5b));
+ makeLive(_test5(method5c));
}
void method5a(void Function(B5) f) => null;
@@ -128,9 +128,9 @@
@pragma('dart6js:noInline')
test6() {
- Expect.isTrue(_test6(method6a));
- Expect.isTrue(_test6(method6b));
- Expect.isFalse(_test6(method6c));
+ makeLive(_test6(method6a));
+ makeLive(_test6(method6b));
+ makeLive(_test6(method6c));
}
void Function(B6) method6a() => null;
@@ -148,9 +148,9 @@
@pragma('dart7js:noInline')
test7() {
- Expect.isTrue(_test7(method7a));
- Expect.isFalse(_test7(method7b));
- Expect.isFalse(_test7(method7c));
+ makeLive(_test7(method7a));
+ makeLive(_test7(method7b));
+ makeLive(_test7(method7c));
}
void method7a(void Function(B7) f) => null;
diff --git a/pkg/compiler/test/rti/emission/type_argument_dynamic.dart b/pkg/compiler/test/rti/emission/type_argument_dynamic.dart
index 745eb80..a3c510f 100644
--- a/pkg/compiler/test/rti/emission/type_argument_dynamic.dart
+++ b/pkg/compiler/test/rti/emission/type_argument_dynamic.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
/*class: A:checkedTypeArgument,typeArgument*/
class A {}
@@ -36,6 +36,6 @@
main() {
dynamic o =
new DateTime.now().millisecondsSinceEpoch == 0 ? new F() : new E();
- Expect.isTrue(test(o.m<B>()));
- Expect.isFalse(test(o.m<D>()));
+ makeLive(test(o.m<B>()));
+ makeLive(test(o.m<D>()));
}
diff --git a/pkg/compiler/test/rti/emission/type_argument_static.dart b/pkg/compiler/test/rti/emission/type_argument_static.dart
index 79dd1d5..d773d23 100644
--- a/pkg/compiler/test/rti/emission/type_argument_static.dart
+++ b/pkg/compiler/test/rti/emission/type_argument_static.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
/*class: A:checkedTypeArgument,typeArgument*/
class A {}
@@ -25,6 +25,6 @@
test(o) => o is C<A>;
main() {
- Expect.isTrue(test(m<B>()));
- Expect.isFalse(test(m<D>()));
+ makeLive(test(m<B>()));
+ makeLive(test(m<D>()));
}
diff --git a/pkg/compiler/test/rti/emission/type_literal.dart b/pkg/compiler/test/rti/emission/type_literal.dart
index c075324..6c7a95d 100644
--- a/pkg/compiler/test/rti/emission/type_literal.dart
+++ b/pkg/compiler/test/rti/emission/type_literal.dart
@@ -4,7 +4,7 @@
// @dart = 2.7
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
/*class: Class1:typeLiteral*/
class Class1 {}
@@ -15,6 +15,6 @@
void main() {
String name1 = '${Class1}';
String name2 = '${Class2}';
- Expect.equals('Class1', name1);
- Expect.equals('Class2<dynamic>', name2);
+ makeLive('Class1' == name1);
+ makeLive('Class2<dynamic>' == name2);
}
diff --git a/pkg/compiler/test/rti/emission/type_variable_function_type.dart b/pkg/compiler/test/rti/emission/type_variable_function_type.dart
index 5509423..ae801a8 100644
--- a/pkg/compiler/test/rti/emission/type_variable_function_type.dart
+++ b/pkg/compiler/test/rti/emission/type_variable_function_type.dart
@@ -6,7 +6,7 @@
// Based on tests/language_2/type_variable_function_type_test.dart
-import 'package:expect/expect.dart';
+import 'package:compiler/src/util/testing.dart';
typedef T Func<T>();
@@ -27,6 +27,6 @@
void main() {
dynamic x = new Foo<List<String>>();
if (new DateTime.now().millisecondsSinceEpoch == 42) x = new Foo<int>();
- Expect.isFalse(x.m(new Bar<String>().f()));
- Expect.isTrue(x.m(new Bar<List<String>>().f()));
+ makeLive(x.m(new Bar<String>().f()));
+ makeLive(x.m(new Bar<List<String>>().f()));
}
diff --git a/pkg/dds/lib/src/devtools/memory_profile.dart b/pkg/dds/lib/src/devtools/memory_profile.dart
index f99caf4..da6fa61 100644
--- a/pkg/dds/lib/src/devtools/memory_profile.dart
+++ b/pkg/dds/lib/src/devtools/memory_profile.dart
@@ -117,7 +117,7 @@
AdbMemoryInfo? adbMemoryInfo;
- late EventSample eventSample;
+ EventSample eventSample = EventSample.empty();
RasterCache? rasterCache;
diff --git a/pkg/dev_compiler/lib/src/kernel/compiler.dart b/pkg/dev_compiler/lib/src/kernel/compiler.dart
index e0efac6..3255b97 100644
--- a/pkg/dev_compiler/lib/src/kernel/compiler.dart
+++ b/pkg/dev_compiler/lib/src/kernel/compiler.dart
@@ -518,6 +518,12 @@
Iterable<String> jsPartDebuggerNames(Library library) =>
library.parts.map((part) => part.partUri);
+ /// True when [library] is the sdk internal library 'dart:_internal'.
+ bool _isDartInternal(Library library) {
+ var importUri = library.importUri;
+ return importUri.scheme == 'dart' && importUri.path == '_internal';
+ }
+
@override
bool isSdkInternalRuntime(Library l) {
return isSdkInternalRuntimeUri(l.importUri);
@@ -5465,6 +5471,15 @@
if (target.isFactory) return _emitFactoryInvocation(node);
// Optimize some internal SDK calls.
+ if (_isDartInternal(target.enclosingLibrary)) {
+ var args = node.arguments;
+ if (args.positional.length == 1 &&
+ args.types.length == 1 &&
+ args.named.isEmpty &&
+ target.name.text == 'unsafeCast') {
+ return args.positional.single.accept(this);
+ }
+ }
if (isSdkInternalRuntime(target.enclosingLibrary)) {
var name = target.name.text;
if (node.arguments.positional.isEmpty &&
diff --git a/pkg/front_end/lib/src/base/processed_options.dart b/pkg/front_end/lib/src/base/processed_options.dart
index f8a8de9..ea79f68 100644
--- a/pkg/front_end/lib/src/base/processed_options.dart
+++ b/pkg/front_end/lib/src/base/processed_options.dart
@@ -577,7 +577,7 @@
Uri input = inputs.first;
- if (input.scheme == 'packages') {
+ if (input.scheme == 'package') {
report(
messageCantInferPackagesFromPackageUri.withLocation(
input, -1, noLength),
diff --git a/pkg/nnbd_migration/lib/src/fix_builder.dart b/pkg/nnbd_migration/lib/src/fix_builder.dart
index df0c74e..e46d892 100644
--- a/pkg/nnbd_migration/lib/src/fix_builder.dart
+++ b/pkg/nnbd_migration/lib/src/fix_builder.dart
@@ -378,17 +378,14 @@
@override
List<ParameterElement> getExecutableParameters(
ExecutableElementImpl element) {
- if (_fixBuilder!._graph.isBeingMigrated(element.library.source)) {
- // The element is part of a library that's being migrated, so its
- // parameters all have been visited (and thus have their own final
- // types). So we don't need to do anything.
- return const ElementTypeProvider().getExecutableParameters(element);
- } else {
- // The element is not part of a library that's being migrated, so its
- // parameters probably haven't been visited; we need to get the parameters
- // from the final function type.
- return getExecutableType(element).parameters;
- }
+ // Note: even if the element is part of a library that's being migrated,
+ // there's no guarantee that the parameter elements have been appropriately
+ // updated by the migration process, because they might be synthetic
+ // parameters. (This happens when the code being migrated contains a mixin
+ // application and there's a synthetic constructor). So we can't safely get
+ // the parameters out of the element. But it is always safe to defer to
+ // `getExecutableType` and get the parameter list from the function type.
+ return getExecutableType(element).parameters;
}
@override
diff --git a/runtime/vm/raw_object_fields.cc b/runtime/vm/raw_object_fields.cc
index e59f439..9fcc4d2 100644
--- a/runtime/vm/raw_object_fields.cc
+++ b/runtime/vm/raw_object_fields.cc
@@ -6,7 +6,7 @@
namespace dart {
-#if defined(DART_PRECOMPILER) || !defined(DART_PRODUCT)
+#if defined(DART_PRECOMPILER) || !defined(PRODUCT)
#define COMMON_CLASSES_AND_FIELDS(F) \
F(Class, name_) \
diff --git a/runtime/vm/raw_object_fields.h b/runtime/vm/raw_object_fields.h
index be56a51..611f9dd 100644
--- a/runtime/vm/raw_object_fields.h
+++ b/runtime/vm/raw_object_fields.h
@@ -19,7 +19,7 @@
namespace dart {
-#if defined(DART_PRECOMPILER) || !defined(DART_PRODUCT)
+#if defined(DART_PRECOMPILER) || !defined(PRODUCT)
class OffsetsTable : public ZoneAllocated {
public:
diff --git a/tools/VERSION b/tools/VERSION
index 93db02d..7c42271 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 17
PATCH 0
-PRERELEASE 75
+PRERELEASE 76
PRERELEASE_PATCH 0
\ No newline at end of file
diff --git a/tools/bots/test_matrix.json b/tools/bots/test_matrix.json
index a73165a..a3d9215 100644
--- a/tools/bots/test_matrix.json
+++ b/tools/bots/test_matrix.json
@@ -1311,6 +1311,7 @@
"name": "build dart",
"script": "tools/build.py",
"arguments": [
+ "--no-clang",
"--use-qemu",
"dart_precompiled_runtime",
"runtime"