Version 2.15.0-36.0.dev
Merge commit 'b44250c3f6fa607a52325dfdf753268fffe1dea6' into 'dev'
diff --git a/DEPS b/DEPS
index c7ffc18..402eae5 100644
--- a/DEPS
+++ b/DEPS
@@ -172,7 +172,7 @@
"web_components_rev": "8f57dac273412a7172c8ade6f361b407e2e4ed02",
"web_socket_channel_rev": "6448ce532445a8a458fa191d9346df071ae0acad",
"WebCore_rev": "fb11e887f77919450e497344da570d780e078bc8",
- "webdev_rev": "50fe70a3137d9665fbe94cd34af5277b65d95079",
+ "webdev_rev": "832b096c0c24798d3df46faa7b7661fe930573c2",
"webkit_inspection_protocol_rev": "dd6fb5d8b536e19cedb384d0bbf1f5631923f1e8",
"yaml_rev": "b4c4411631bda556ce9a45af1ab0eecaf9f3ac53",
"zlib_rev": "bf44340d1b6be1af8950bbdf664fec0cf5a831cc",
diff --git a/pkg/analysis_server/test/abstract_context.dart b/pkg/analysis_server/test/abstract_context.dart
index fb9d441..94e46a7 100644
--- a/pkg/analysis_server/test/abstract_context.dart
+++ b/pkg/analysis_server/test/abstract_context.dart
@@ -300,20 +300,6 @@
}
}
-mixin WithNonFunctionTypeAliasesMixin on AbstractContextTest {
- @override
- String? get testPackageLanguageVersion => null;
-
- @override
- void setUp() {
- super.setUp();
-
- createAnalysisOptionsFile(
- experiments: [EnableString.nonfunction_type_aliases],
- );
- }
-}
-
mixin WithNullSafetyMixin on AbstractContextTest {
@override
String get testPackageLanguageVersion => '2.12';
diff --git a/pkg/analysis_server/test/plugin/protocol_dart_test.dart b/pkg/analysis_server/test/plugin/protocol_dart_test.dart
index 2f7ae488..85c36ff 100644
--- a/pkg/analysis_server/test/plugin/protocol_dart_test.dart
+++ b/pkg/analysis_server/test/plugin/protocol_dart_test.dart
@@ -9,7 +9,6 @@
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
-import '../abstract_context.dart';
import '../abstract_single_unit.dart';
void main() {
@@ -74,8 +73,7 @@
}
@reflectiveTest
-class ConvertElementTest extends AbstractSingleUnitTest
- with WithNonFunctionTypeAliasesMixin {
+class ConvertElementTest extends AbstractSingleUnitTest {
Future<void> test_CLASS() async {
await resolveTestCode('''
@deprecated
diff --git a/pkg/analysis_server/test/services/completion/dart/completion_contributor_util.dart b/pkg/analysis_server/test/services/completion/dart/completion_contributor_util.dart
index 546faf8..55a731a 100644
--- a/pkg/analysis_server/test/services/completion/dart/completion_contributor_util.dart
+++ b/pkg/analysis_server/test/services/completion/dart/completion_contributor_util.dart
@@ -63,8 +63,7 @@
}
}
-abstract class _BaseDartCompletionContributorTest extends AbstractContextTest
- with WithNonFunctionTypeAliasesMixin {
+abstract class _BaseDartCompletionContributorTest extends AbstractContextTest {
static const String _UNCHECKED = '__UNCHECKED__';
late String testFile;
int _completionOffset = -1;
diff --git a/pkg/analysis_server/test/services/refactoring/abstract_refactoring.dart b/pkg/analysis_server/test/services/refactoring/abstract_refactoring.dart
index 1ab4b27..4fa30e3 100644
--- a/pkg/analysis_server/test/services/refactoring/abstract_refactoring.dart
+++ b/pkg/analysis_server/test/services/refactoring/abstract_refactoring.dart
@@ -12,7 +12,6 @@
show RefactoringProblemSeverity, SourceChange, SourceEdit;
import 'package:test/test.dart';
-import '../../abstract_context.dart';
import '../../abstract_single_unit.dart';
int findIdentifierLength(String search) {
@@ -30,8 +29,7 @@
}
/// The base class for all [Refactoring] tests.
-abstract class RefactoringTest extends AbstractSingleUnitTest
- with WithNonFunctionTypeAliasesMixin {
+abstract class RefactoringTest extends AbstractSingleUnitTest {
late SearchEngine searchEngine;
late SourceChange refactoringChange;
diff --git a/pkg/analysis_server/test/services/search/search_engine_test.dart b/pkg/analysis_server/test/services/search/search_engine_test.dart
index 512db98..10cb93c 100644
--- a/pkg/analysis_server/test/services/search/search_engine_test.dart
+++ b/pkg/analysis_server/test/services/search/search_engine_test.dart
@@ -441,7 +441,7 @@
@reflectiveTest
class SearchEngineImplWithNonFunctionTypeAliasesTest
- extends SearchEngineImplTest with WithNonFunctionTypeAliasesMixin {
+ extends SearchEngineImplTest {
Future<void> test_searchReferences_typeAlias_interfaceType() async {
await resolveTestCode('''
typedef A<T> = Map<T, String>;
diff --git a/pkg/analysis_server/test/src/computer/outline_computer_test.dart b/pkg/analysis_server/test/src/computer/outline_computer_test.dart
index a005ff2..185338f 100644
--- a/pkg/analysis_server/test/src/computer/outline_computer_test.dart
+++ b/pkg/analysis_server/test/src/computer/outline_computer_test.dart
@@ -17,8 +17,7 @@
});
}
-class AbstractOutlineComputerTest extends AbstractContextTest
- with WithNonFunctionTypeAliasesMixin {
+class AbstractOutlineComputerTest extends AbstractContextTest {
late String testPath;
late String testCode;
diff --git a/pkg/analysis_server/test/src/services/correction/fix/create_function_test.dart b/pkg/analysis_server/test/src/services/correction/fix/create_function_test.dart
index fd2fea7..2d663fc 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/create_function_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/create_function_test.dart
@@ -7,7 +7,6 @@
import 'package:analyzer_plugin/utilities/fixes/fixes.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
-import '../../../../abstract_context.dart';
import 'fix_processor.dart';
void main() {
@@ -17,8 +16,7 @@
}
@reflectiveTest
-class CreateFunctionTest extends FixProcessorTest
- with WithNonFunctionTypeAliasesMixin {
+class CreateFunctionTest extends FixProcessorTest {
@override
FixKind get kind => DartFixKind.CREATE_FUNCTION;
diff --git a/pkg/analyzer/lib/error/error.dart b/pkg/analyzer/lib/error/error.dart
index d315c84..1b7a17f 100644
--- a/pkg/analyzer/lib/error/error.dart
+++ b/pkg/analyzer/lib/error/error.dart
@@ -141,7 +141,6 @@
CompileTimeErrorCode.CONST_WITH_TYPE_PARAMETERS,
CompileTimeErrorCode.CONST_WITH_UNDEFINED_CONSTRUCTOR,
CompileTimeErrorCode.CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT,
- CompileTimeErrorCode.CONSTRUCTOR_TEAROFFS_NOT_ENABLED,
CompileTimeErrorCode.CONTINUE_LABEL_ON_SWITCH,
CompileTimeErrorCode.COULD_NOT_INFER,
CompileTimeErrorCode.DEFAULT_LIST_CONSTRUCTOR,
@@ -594,6 +593,7 @@
HintCode.SDK_VERSION_AS_EXPRESSION_IN_CONST_CONTEXT,
HintCode.SDK_VERSION_ASYNC_EXPORTED_FROM_CORE,
HintCode.SDK_VERSION_BOOL_OPERATOR_IN_CONST_CONTEXT,
+ HintCode.SDK_VERSION_CONSTRUCTOR_TEAROFFS,
HintCode.SDK_VERSION_EQ_EQ_OPERATOR_IN_CONST_CONTEXT,
HintCode.SDK_VERSION_EXTENSION_METHODS,
HintCode.SDK_VERSION_GT_GT_GT_OPERATOR,
diff --git a/pkg/analyzer/lib/src/dart/error/hint_codes.dart b/pkg/analyzer/lib/src/dart/error/hint_codes.dart
index afaad1f..24533f2 100644
--- a/pkg/analyzer/lib/src/dart/error/hint_codes.dart
+++ b/pkg/analyzer/lib/src/dart/error/hint_codes.dart
@@ -96,37 +96,6 @@
correction: "Replace the '.' with a '?.' in the invocation.");
/**
- * Generate a hint for method, property or function annotated with
- * `@useResult` whose invocation is unchecked.
- *
- * Parameters:
- * 0: the name of the annotated method, property or function
- */
- static const HintCode UNUSED_RESULT = HintCode(
- 'UNUSED_RESULT', "'{0}' should be used.",
- correction:
- "Try using the result by invoking a member, passing it to a function, or returning it from this function.",
- hasPublishedDocs: false);
-
- /**
- * Generate a hint for method, property or function annotated with
- * `@useResult` whose invocation is unchecked.
- *
- * Parameters:
- * 0: the name of the annotated method, property or function
- * 1: message details
- */
- static const HintCode UNUSED_RESULT_WITH_MESSAGE = HintCode(
- 'UNUSED_RESULT',
- "'{0}' should be used. {1}.",
- // todo(pq): consider passing in correction details: https://github.com/dart-lang/sdk/issues/46066
- correction:
- "Try using the result by invoking a member, passing it to a function, or returning it from this function.",
- hasPublishedDocs: false,
- uniqueName: 'HintCode.UNUSED_RESULT_WITH_MESSAGE',
- );
-
- /**
* Dead code is code that is never reached, this can happen for instance if a
* statement follows a return statement.
*
@@ -2245,6 +2214,25 @@
hasPublishedDocs: true);
/**
+ * A constructor cannot be torn off without the 'constructor-tearoffs'
+ * language feature.
+ *
+ * There is also a [ParserError.EXPERIMENT_NOT_ENABLED] code which catches
+ * some cases of constructor tearoff features (like `List<int>.filled;`).
+ * Other constructor tearoff cases are not realized until resolution
+ * (like `List.filled;`).
+ */
+ static const HintCode SDK_VERSION_CONSTRUCTOR_TEAROFFS = HintCode(
+ 'SDK_VERSION_CONSTRUCTOR_TEAROFFS',
+ "Tearing off a constructor requires the 'constructor-tearoffs' "
+ "language feature.",
+ // TODO(srawlins): Update this text to something like "Try updating
+ // your pubspec.yaml to set the minimum SDK constraint to 2.14 or
+ // higher, and running 'pub get'."
+ correction: "Try enabling the experiment by including "
+ "'--enable-experiments=constructor-tearoffs' in the 'dart' command.");
+
+ /**
* No parameters.
*/
// #### Description
@@ -3474,6 +3462,43 @@
hasPublishedDocs: true);
/**
+ * The result of invoking a method, property, or function annotated with
+ * `@useResult` must be used (assigned, passed to a function as an argument,
+ * or returned by a function).
+ *
+ * Parameters:
+ * 0: the name of the annotated method, property or function
+ */
+ static const HintCode UNUSED_RESULT = HintCode(
+ 'UNUSED_RESULT',
+ "'{0}' should be used.",
+ correction: "Try using the result by invoking a member, passing it to a "
+ "function, or returning it from this function.",
+ hasPublishedDocs: false,
+ );
+
+ /**
+ * The result of invoking a method, property, or function annotated with
+ * `@useResult` must be used (assigned, passed to a function as an argument,
+ * or returned by a function).
+ *
+ * Parameters:
+ * 0: the name of the annotated method, property or function
+ * 1: message details
+ */
+ static const HintCode UNUSED_RESULT_WITH_MESSAGE = HintCode(
+ 'UNUSED_RESULT',
+ "'{0}' should be used. {1}.",
+ // todo(pq): consider passing in correction details:
+ // https://github.com/dart-lang/sdk/issues/46066
+ correction:
+ "Try using the result by invoking a member, passing it to a function, "
+ "or returning it from this function.",
+ hasPublishedDocs: false,
+ uniqueName: 'HintCode.UNUSED_RESULT_WITH_MESSAGE',
+ );
+
+ /**
* Parameters:
* 0: the name that is shown but not used
*/
diff --git a/pkg/analyzer/lib/src/dart/resolver/constructor_reference_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/constructor_reference_resolver.dart
index ce1fd84..ac1868d 100644
--- a/pkg/analyzer/lib/src/dart/resolver/constructor_reference_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/constructor_reference_resolver.dart
@@ -22,7 +22,7 @@
// Only report this if [node] has no explicit type arguments; otherwise
// the parser has already reported an error.
_resolver.errorReporter.reportErrorForNode(
- CompileTimeErrorCode.CONSTRUCTOR_TEAROFFS_NOT_ENABLED, node, []);
+ HintCode.SDK_VERSION_CONSTRUCTOR_TEAROFFS, node, []);
}
node.constructorName.accept(_resolver);
_inferArgumentTypes(node);
diff --git a/pkg/analyzer/lib/src/error/codes.dart b/pkg/analyzer/lib/src/error/codes.dart
index dce95dc..cadf3c7 100644
--- a/pkg/analyzer/lib/src/error/codes.dart
+++ b/pkg/analyzer/lib/src/error/codes.dart
@@ -2263,23 +2263,6 @@
"IntegerDivisionByZeroException.");
/**
- * A constructor cannot be torn off without the 'constructor-tearoffs'
- * language feature.
- *
- * There is also a [ParserError.EXPERIMENT_NOT_ENABLED] code which catches
- * some cases of constructor tearoff features (like `List<int>.filled;`).
- * Other constructor tearoff cases are not realized until resolution
- * (like `List.filled;`).
- */
- static const CompileTimeErrorCode CONSTRUCTOR_TEAROFFS_NOT_ENABLED =
- CompileTimeErrorCode(
- 'CONSTRUCTOR_TEAROFFS_NOT_ENABLED',
- "Tearing off a constructor requires the 'constructor-tearoffs' "
- "language feature.",
- correction: "Try updating your pubspec.yaml to set the minimum SDK "
- "constraint to 2.14 or higher, and running 'pub get'.");
-
- /**
* 16.12.2 Const: An expression of one of the forms !e, e1 && e2 or e1 || e2,
* where e, e1 and e2 are constant expressions that evaluate to a boolean
* value.
diff --git a/pkg/analyzer/lib/src/fasta/ast_builder.dart b/pkg/analyzer/lib/src/fasta/ast_builder.dart
index f698b3d7..873ca31 100644
--- a/pkg/analyzer/lib/src/fasta/ast_builder.dart
+++ b/pkg/analyzer/lib/src/fasta/ast_builder.dart
@@ -23,7 +23,6 @@
messageInvalidInitializer,
messageInvalidSuperInInitializer,
messageInvalidThisInInitializer,
- messageMetadataTypeArguments,
messageMissingAssignableSelector,
messageNativeClauseShouldBeAnnotation,
messageOperatorWithTypeParameters,
@@ -1867,8 +1866,15 @@
var typeArguments = pop() as TypeArgumentList?;
if (typeArguments != null &&
!_featureSet.isEnabled(Feature.generic_metadata)) {
- handleRecoverableError(messageMetadataTypeArguments,
- typeArguments.beginToken, typeArguments.beginToken);
+ var feature = Feature.generic_metadata;
+ handleRecoverableError(
+ templateExperimentNotEnabled.withArguments(
+ feature.enableString,
+ _versionAsString(feature.releaseVersion!),
+ ),
+ typeArguments.beginToken,
+ typeArguments.beginToken,
+ );
}
var name = pop() as Identifier;
push(ast.annotation(
diff --git a/pkg/analyzer/lib/src/summary2/ast_binary_reader.dart b/pkg/analyzer/lib/src/summary2/ast_binary_reader.dart
index b41a15b..00cf9f8 100644
--- a/pkg/analyzer/lib/src/summary2/ast_binary_reader.dart
+++ b/pkg/analyzer/lib/src/summary2/ast_binary_reader.dart
@@ -87,6 +87,8 @@
return _readFunctionExpression();
case Tag.FunctionExpressionInvocation:
return _readFunctionExpressionInvocation();
+ case Tag.FunctionReference:
+ return _readFunctionReference();
case Tag.FunctionTypedFormalParameter:
return _readFunctionTypedFormalParameter();
case Tag.GenericFunctionType:
@@ -568,6 +570,19 @@
return node;
}
+ FunctionReference _readFunctionReference() {
+ var function = readNode() as Expression;
+ var typeArguments = _readOptionalNode() as TypeArgumentList?;
+
+ var node = astFactory.functionReference(
+ function: function,
+ typeArguments: typeArguments,
+ );
+ node.typeArgumentTypes = _reader.readOptionalTypeList();
+ _readExpressionResolution(node);
+ return node;
+ }
+
FunctionTypedFormalParameter _readFunctionTypedFormalParameter() {
var typeParameters = _readOptionalNode() as TypeParameterList?;
var returnType = _readOptionalNode() as TypeAnnotation?;
diff --git a/pkg/analyzer/lib/src/summary2/ast_binary_tag.dart b/pkg/analyzer/lib/src/summary2/ast_binary_tag.dart
index 8e4b91c..91f911c 100644
--- a/pkg/analyzer/lib/src/summary2/ast_binary_tag.dart
+++ b/pkg/analyzer/lib/src/summary2/ast_binary_tag.dart
@@ -50,6 +50,7 @@
static const int FunctionDeclaration_setter = 58;
static const int FunctionExpressionStub = 19;
static const int FunctionExpressionInvocation = 93;
+ static const int FunctionReference = 103;
static const int FunctionTypedFormalParameter = 20;
static const int GenericFunctionType = 21;
static const int HideCombinator = 48;
diff --git a/pkg/analyzer/lib/src/summary2/ast_binary_writer.dart b/pkg/analyzer/lib/src/summary2/ast_binary_writer.dart
index c867be4..7f49c50 100644
--- a/pkg/analyzer/lib/src/summary2/ast_binary_writer.dart
+++ b/pkg/analyzer/lib/src/summary2/ast_binary_writer.dart
@@ -313,6 +313,15 @@
}
@override
+ void visitFunctionReference(FunctionReference node) {
+ _writeByte(Tag.FunctionReference);
+ _writeNode(node.function);
+ _writeOptionalNode(node.typeArguments);
+ _sink.writeOptionalTypeList(node.typeArgumentTypes);
+ _storeExpression(node);
+ }
+
+ @override
void visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node) {
_writeByte(Tag.FunctionTypedFormalParameter);
diff --git a/pkg/analyzer/test/generated/generic_metadata_parser_test.dart b/pkg/analyzer/test/generated/generic_metadata_parser_test.dart
index d3ff54e..05e1c6d 100644
--- a/pkg/analyzer/test/generated/generic_metadata_parser_test.dart
+++ b/pkg/analyzer/test/generated/generic_metadata_parser_test.dart
@@ -49,8 +49,8 @@
mixin GenericMetadataParserTest on FastaParserTestCase {
void test_className_prefixed_constructorName_absent() {
var compilationUnit = _parseCompilationUnit('@p.A<B>() class C {}',
- disabledError: expectedError(
- ParserErrorCode.ANNOTATION_WITH_TYPE_ARGUMENTS, 4, 1));
+ disabledError:
+ expectedError(ParserErrorCode.EXPERIMENT_NOT_ENABLED, 4, 1));
var classDeclaration =
compilationUnit.declarations.single as ClassDeclaration;
var annotation = classDeclaration.metadata.single;
@@ -65,8 +65,8 @@
void test_className_prefixed_constructorName_present() {
var compilationUnit = _parseCompilationUnit('@p.A<B>.ctor() class C {}',
- disabledError: expectedError(
- ParserErrorCode.ANNOTATION_WITH_TYPE_ARGUMENTS, 4, 1));
+ disabledError:
+ expectedError(ParserErrorCode.EXPERIMENT_NOT_ENABLED, 4, 1));
var classDeclaration =
compilationUnit.declarations.single as ClassDeclaration;
var annotation = classDeclaration.metadata.single;
@@ -81,8 +81,8 @@
void test_className_unprefixed_constructorName_absent() {
var compilationUnit = _parseCompilationUnit('@A<B>() class C {}',
- disabledError: expectedError(
- ParserErrorCode.ANNOTATION_WITH_TYPE_ARGUMENTS, 2, 1));
+ disabledError:
+ expectedError(ParserErrorCode.EXPERIMENT_NOT_ENABLED, 2, 1));
var classDeclaration =
compilationUnit.declarations.single as ClassDeclaration;
var annotation = classDeclaration.metadata.single;
@@ -96,8 +96,8 @@
void test_className_unprefixed_constructorName_present() {
var compilationUnit = _parseCompilationUnit('@A<B>.ctor() class C {}',
- disabledError: expectedError(
- ParserErrorCode.ANNOTATION_WITH_TYPE_ARGUMENTS, 2, 1));
+ disabledError:
+ expectedError(ParserErrorCode.EXPERIMENT_NOT_ENABLED, 2, 1));
var classDeclaration =
compilationUnit.declarations.single as ClassDeclaration;
var annotation = classDeclaration.metadata.single;
@@ -117,8 +117,8 @@
6,
1),
],
- disabledError: expectedError(
- ParserErrorCode.ANNOTATION_WITH_TYPE_ARGUMENTS, 4, 1));
+ disabledError:
+ expectedError(ParserErrorCode.EXPERIMENT_NOT_ENABLED, 4, 1));
var classDeclaration =
compilationUnit.declarations.single as ClassDeclaration;
var annotation = classDeclaration.metadata.single;
@@ -139,8 +139,8 @@
4,
1),
],
- disabledError: expectedError(
- ParserErrorCode.ANNOTATION_WITH_TYPE_ARGUMENTS, 2, 1));
+ disabledError:
+ expectedError(ParserErrorCode.EXPERIMENT_NOT_ENABLED, 2, 1));
var classDeclaration =
compilationUnit.declarations.single as ClassDeclaration;
var annotation = classDeclaration.metadata.single;
@@ -174,8 +174,8 @@
expectedError(ParserErrorCode.EXPECTED_EXECUTABLE, 7, 1),
expectedError(ParserErrorCode.MISSING_FUNCTION_BODY, 15, 5),
],
- disabledError: expectedError(
- ParserErrorCode.ANNOTATION_WITH_TYPE_ARGUMENTS, 2, 1));
+ disabledError:
+ expectedError(ParserErrorCode.EXPERIMENT_NOT_ENABLED, 2, 1));
}
CompilationUnit _parseCompilationUnit(String content,
diff --git a/pkg/analyzer/test/src/dart/analysis/driver_resolution_test.dart b/pkg/analyzer/test/src/dart/analysis/driver_resolution_test.dart
index 367f7ef..9da6792 100644
--- a/pkg/analyzer/test/src/dart/analysis/driver_resolution_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/driver_resolution_test.dart
@@ -8,7 +8,6 @@
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/nullability_suffix.dart';
import 'package:analyzer/dart/element/type.dart';
-import 'package:analyzer/src/dart/analysis/experiments.dart';
import 'package:analyzer/src/dart/ast/extensions.dart';
import 'package:analyzer/src/dart/element/element.dart';
import 'package:analyzer/src/dart/element/member.dart';
@@ -788,23 +787,6 @@
}
test_binaryExpression_gtGtGt() async {
- var latestLanguageVersionStr = '${ExperimentStatus.currentVersion.major}.'
- '${ExperimentStatus.currentVersion.minor}';
-
- writeTestPackageConfig(
- PackageConfigFileBuilder(),
- languageVersion: latestLanguageVersionStr,
- );
-
- writeTestPackageAnalysisOptionsFile(
- AnalysisOptionsFileConfig(
- experiments: [
- EnableString.non_nullable,
- EnableString.triple_shift,
- ],
- ),
- );
-
await resolveTestCode('''
class A {
A operator >>>(int amount) => this;
diff --git a/pkg/analyzer/test/src/dart/resolution/constructor_reference_test.dart b/pkg/analyzer/test/src/dart/resolution/constructor_reference_test.dart
index 0c94b3c..21b86f7 100644
--- a/pkg/analyzer/test/src/dart/resolution/constructor_reference_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/constructor_reference_test.dart
@@ -584,7 +584,7 @@
A.foo;
}
''', [
- error(CompileTimeErrorCode.CONSTRUCTOR_TEAROFFS_NOT_ENABLED, 39, 5),
+ error(HintCode.SDK_VERSION_CONSTRUCTOR_TEAROFFS, 39, 5),
]);
var classElement = findElement.class_('A');
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 1b5b4f4..db0e26c 100644
--- a/pkg/analyzer/test/src/dart/resolution/context_collection_resolution.dart
+++ b/pkg/analyzer/test/src/dart/resolution/context_collection_resolution.dart
@@ -251,9 +251,6 @@
List<String> get collectionIncludedPaths => [workspaceRootPath];
List<String> get experiments => [
- EnableString.generic_metadata,
- EnableString.nonfunction_type_aliases,
- EnableString.triple_shift,
EnableString.constructor_tearoffs,
];
diff --git a/pkg/analyzer/test/src/summary/resolved_ast_printer.dart b/pkg/analyzer/test/src/summary/resolved_ast_printer.dart
index fd4210e..9b9051e 100644
--- a/pkg/analyzer/test/src/summary/resolved_ast_printer.dart
+++ b/pkg/analyzer/test/src/summary/resolved_ast_printer.dart
@@ -693,6 +693,19 @@
}
@override
+ void visitFunctionReference(FunctionReference node) {
+ _writeln('FunctionReference');
+ _withIndent(() {
+ var properties = _Properties();
+ properties.addNode('function', node.function);
+ properties.addNode('typeArguments', node.typeArguments);
+ properties.addTypeList('typeArgumentTypes', node.typeArgumentTypes!);
+ _addExpression(properties, node);
+ _writeProperties(properties);
+ });
+ }
+
+ @override
void visitFunctionTypeAlias(FunctionTypeAlias node) {
_writeNextCodeLine(node);
_writeln('FunctionTypeAlias');
diff --git a/pkg/analyzer/test/src/summary/resynthesize_ast2_test.dart b/pkg/analyzer/test/src/summary/resynthesize_ast2_test.dart
index c18ab0cf..d85eb96 100644
--- a/pkg/analyzer/test/src/summary/resynthesize_ast2_test.dart
+++ b/pkg/analyzer/test/src/summary/resynthesize_ast2_test.dart
@@ -151,7 +151,7 @@
}
void setUp() {
- featureSet = FeatureSets.nullSafe;
+ featureSet = FeatureSets.latestWithExperiments;
}
void _addLibraryUnits(
diff --git a/pkg/analyzer/test/src/summary/resynthesize_common.dart b/pkg/analyzer/test/src/summary/resynthesize_common.dart
index ebf403c..9ea82b2 100644
--- a/pkg/analyzer/test/src/summary/resynthesize_common.dart
+++ b/pkg/analyzer/test/src/summary/resynthesize_common.dart
@@ -81,29 +81,21 @@
}
class FeatureSets {
- static final FeatureSet beforeNullSafe = FeatureSet.fromEnableFlags2(
+ static final FeatureSet language_2_9 = FeatureSet.fromEnableFlags2(
sdkLanguageVersion: Version.parse('2.9.0'),
flags: [],
);
- static final FeatureSet nullSafe = FeatureSet.fromEnableFlags2(
+ static final FeatureSet language_2_12 = FeatureSet.fromEnableFlags2(
sdkLanguageVersion: Version.parse('2.12.0'),
flags: [],
);
- static final FeatureSet nonFunctionTypeAliases = FeatureSet.fromEnableFlags2(
- sdkLanguageVersion: Version.parse('2.12.0'),
- flags: [EnableString.nonfunction_type_aliases],
- );
-
- static final FeatureSet genericMetadata = FeatureSet.fromEnableFlags2(
- sdkLanguageVersion: Version.parse('2.13.0'),
- flags: [EnableString.generic_metadata],
- );
-
- static final FeatureSet constructorTearOffs = FeatureSet.fromEnableFlags2(
+ static final FeatureSet latestWithExperiments = FeatureSet.fromEnableFlags2(
sdkLanguageVersion: Version.parse('2.15.0'),
- flags: [EnableString.constructor_tearoffs],
+ flags: [
+ EnableString.constructor_tearoffs,
+ ],
);
}
@@ -2623,17 +2615,17 @@
notSimplyBounded class C @6
typeParameters
covariant T @8
- bound: dynamic Function()
- defaultType: dynamic Function()
+ bound: dynamic
+ defaultType: dynamic
constructors
synthetic @-1
typeAliases
functionTypeAliasBased notSimplyBounded F @32
- aliasedType: dynamic Function(C<dynamic Function()>)
+ aliasedType: dynamic Function(C<dynamic>)
aliasedElement: GenericFunctionTypeElement
parameters
requiredPositional value @36
- type: C<dynamic Function()>
+ type: C<dynamic>
returnType: dynamic
''');
}
@@ -2696,7 +2688,7 @@
notSimplyBounded C @8
typeParameters
unrelated T @10
- bound: dynamic Function()
+ bound: dynamic
defaultType: dynamic
aliasedType: void Function()
aliasedElement: GenericFunctionTypeElement
@@ -2704,7 +2696,7 @@
notSimplyBounded D @50
typeParameters
unrelated T @52
- bound: dynamic Function()
+ bound: dynamic
defaultType: dynamic
aliasedType: void Function()
aliasedElement: GenericFunctionTypeElement
@@ -2713,7 +2705,6 @@
}
test_class_notSimplyBounded_complex_by_cycle_typedef_interfaceType() async {
- featureSet = FeatureSets.nonFunctionTypeAliases;
var library = await checkLibrary('''
typedef C<T extends D> = List<T>;
typedef D<T extends C> = List<T>;
@@ -2835,7 +2826,7 @@
}
test_class_notSimplyBounded_function_typed_bound_complex_via_parameter_type_legacy() async {
- featureSet = FeatureSets.beforeNullSafe;
+ featureSet = FeatureSets.language_2_9;
var library = await checkLibrary('''
class C<T extends void Function(T)> {}
''');
@@ -2905,24 +2896,24 @@
notSimplyBounded class C @6
typeParameters
covariant T @8
- bound: dynamic Function()
- defaultType: dynamic Function()
+ bound: dynamic
+ defaultType: dynamic
constructors
synthetic @-1
typeAliases
functionTypeAliasBased notSimplyBounded F @32
- aliasedType: dynamic Function(dynamic Function())
+ aliasedType: dynamic Function(dynamic)
aliasedElement: GenericFunctionTypeElement
parameters
requiredPositional value @36
- type: dynamic Function()
+ type: dynamic
returnType: dynamic
functionTypeAliasBased notSimplyBounded G @52
- aliasedType: dynamic Function(dynamic Function())
+ aliasedType: dynamic Function(dynamic)
aliasedElement: GenericFunctionTypeElement
parameters
requiredPositional value @56
- type: dynamic Function()
+ type: dynamic
returnType: dynamic
''');
}
@@ -3058,7 +3049,7 @@
}
test_class_ref_nullability_star() async {
- featureSet = FeatureSets.beforeNullSafe;
+ featureSet = FeatureSets.language_2_9;
var library = await checkLibrary('''
class C {}
C c;
@@ -3546,7 +3537,6 @@
}
test_class_typeParameters_defaultType_cycle_genericFunctionType2() async {
- featureSet = FeatureSets.genericMetadata;
var library = await checkLibrary(r'''
class C<T extends void Function<U extends C>()> {}
''');
@@ -3565,7 +3555,7 @@
}
test_class_typeParameters_defaultType_functionTypeAlias_contravariant_legacy() async {
- featureSet = FeatureSets.beforeNullSafe;
+ featureSet = FeatureSets.language_2_9;
var library = await checkLibrary(r'''
typedef F<X> = void Function(X);
@@ -3748,7 +3738,7 @@
}
test_class_typeParameters_defaultType_genericFunctionType_both_legacy() async {
- featureSet = FeatureSets.beforeNullSafe;
+ featureSet = FeatureSets.language_2_9;
var library = await checkLibrary(r'''
class A<X extends X Function(X)> {}
''');
@@ -3785,7 +3775,7 @@
}
test_class_typeParameters_defaultType_genericFunctionType_contravariant_legacy() async {
- featureSet = FeatureSets.beforeNullSafe;
+ featureSet = FeatureSets.language_2_9;
var library = await checkLibrary(r'''
class A<X extends void Function(X)> {}
''');
@@ -3858,7 +3848,6 @@
}
test_class_typeParameters_defaultType_typeAlias_interface_contravariant() async {
- featureSet = FeatureSets.nonFunctionTypeAliases;
var library = await checkLibrary(r'''
typedef A<X> = List<void Function(X)>;
@@ -3891,7 +3880,6 @@
}
test_class_typeParameters_defaultType_typeAlias_interface_covariant() async {
- featureSet = FeatureSets.nonFunctionTypeAliases;
var library = await checkLibrary(r'''
typedef A<X> = Map<X, int>;
@@ -6005,7 +5993,7 @@
}
test_compilationUnit_nnbd_disabled_via_feature_set() async {
- featureSet = FeatureSets.beforeNullSafe;
+ featureSet = FeatureSets.language_2_9;
var library = await checkLibrary('');
expect(library.isNonNullableByDefault, isFalse);
}
@@ -6312,7 +6300,6 @@
}
test_const_constructorReference() async {
- featureSet = FeatureSets.constructorTearOffs;
var library = await checkLibrary(r'''
class A {
A.named();
@@ -6380,6 +6367,50 @@
''');
}
+ test_const_functionReference() async {
+ var library = await checkLibrary(r'''
+void f<T>(T a) {}
+const v = f<int>;
+''');
+ checkElementText(library, r'''
+library
+ definingUnit
+ topLevelVariables
+ static const v @24
+ type: void Function(int)
+ constantInitializer
+ FunctionReference
+ function: SimpleIdentifier
+ staticElement: self::@function::f
+ staticType: void Function<T>(T)
+ token: f @28
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+ typeArguments: TypeArgumentList
+ arguments
+ TypeName
+ name: SimpleIdentifier
+ staticElement: dart:core::@class::int
+ staticType: null
+ token: int @30
+ type: int
+ leftBracket: < @29
+ rightBracket: > @33
+ accessors
+ synthetic static get v @-1
+ returnType: void Function(int)
+ functions
+ f @5
+ typeParameters
+ covariant T @7
+ parameters
+ requiredPositional a @12
+ type: T
+ returnType: void
+''');
+ }
+
test_const_indexExpression() async {
var library = await checkLibrary(r'''
const a = [0];
@@ -11140,7 +11171,7 @@
}
test_const_topLevel_throw_legacy() async {
- featureSet = FeatureSets.beforeNullSafe;
+ featureSet = FeatureSets.language_2_9;
var library = await checkLibrary(r'''
const c = throw 42;
''');
@@ -11804,7 +11835,6 @@
}
test_const_typeLiteral() async {
- featureSet = FeatureSets.constructorTearOffs;
var library = await checkLibrary(r'''
const v = List<int>;
''');
@@ -12786,7 +12816,6 @@
}
test_constructor_redirected_factory_named_generic_viaTypeAlias() async {
- featureSet = FeatureSets.nonFunctionTypeAliases;
var library = await checkLibrary('''
typedef A<T, U> = C<T, U>;
class B<T, U> {
@@ -13086,7 +13115,6 @@
}
test_constructor_redirected_factory_unnamed_generic_viaTypeAlias() async {
- featureSet = FeatureSets.nonFunctionTypeAliases;
var library = await checkLibrary('''
typedef A<T, U> = C<T, U>;
class B<T, U> {
@@ -13203,7 +13231,6 @@
}
test_constructor_redirected_factory_unnamed_imported_viaTypeAlias() async {
- featureSet = FeatureSets.nonFunctionTypeAliases;
addLibrarySource('/foo.dart', '''
import 'test.dart';
typedef A = B;
@@ -13302,7 +13329,6 @@
}
test_constructor_redirected_factory_unnamed_prefixed_viaTypeAlias() async {
- featureSet = FeatureSets.nonFunctionTypeAliases;
addLibrarySource('/foo.dart', '''
import 'test.dart';
typedef A = B;
@@ -13353,7 +13379,6 @@
}
test_constructor_redirected_factory_unnamed_viaTypeAlias() async {
- featureSet = FeatureSets.nonFunctionTypeAliases;
var library = await checkLibrary('''
typedef A = C;
class B {
@@ -13701,7 +13726,7 @@
}
test_defaultValue_eliminateTypeParameters_legacy() async {
- featureSet = FeatureSets.beforeNullSafe;
+ featureSet = FeatureSets.language_2_9;
var library = await checkLibrary('''
class A<T> {
const X({List<T> a = const []});
@@ -13890,7 +13915,7 @@
}
test_defaultValue_methodMember_legacy() async {
- featureSet = FeatureSets.beforeNullSafe;
+ featureSet = FeatureSets.language_2_9;
var library = await checkLibrary('''
void f([Comparator<T> compare = Comparable.compare]) {}
''');
@@ -14118,7 +14143,7 @@
}
test_defaultValue_refersToGenericClass_constructor2_legacy() async {
- featureSet = FeatureSets.beforeNullSafe;
+ featureSet = FeatureSets.language_2_9;
var library = await checkLibrary('''
abstract class A<T> {}
class B<T> implements A<T> {
@@ -14178,7 +14203,7 @@
}
test_defaultValue_refersToGenericClass_constructor_legacy() async {
- featureSet = FeatureSets.beforeNullSafe;
+ featureSet = FeatureSets.language_2_9;
var library = await checkLibrary('''
class B<T> {
const B();
@@ -17250,7 +17275,7 @@
}
test_generic_function_type_nullability_star() async {
- featureSet = FeatureSets.beforeNullSafe;
+ featureSet = FeatureSets.language_2_9;
var library = await checkLibrary('''
void Function() f;
''');
@@ -17440,7 +17465,7 @@
atSign: @ @29
element: ConstructorMember
base: self::@class::A::@constructor::•
- substitution: {T: dynamic}
+ substitution: {T: int Function(String)}
name: SimpleIdentifier
staticElement: self::@class::A
staticType: null
@@ -17516,7 +17541,7 @@
atSign: @ @29
element: ConstructorMember
base: self::@class::A::@constructor::•
- substitution: {T: dynamic}
+ substitution: {T: int Function(String)}
name: SimpleIdentifier
staticElement: self::@class::A
staticType: null
@@ -18037,13 +18062,13 @@
notSimplyBounded F @8
typeParameters
unrelated X @10
- bound: dynamic Function()
+ bound: dynamic
defaultType: dynamic
- aliasedType: dynamic Function(dynamic Function())
+ aliasedType: dynamic Function(dynamic)
aliasedElement: GenericFunctionTypeElement
parameters
requiredPositional @-1
- type: dynamic Function()
+ type: dynamic
returnType: dynamic
''');
}
@@ -20209,7 +20234,7 @@
}
test_instanceInference_operator_equal_legacy_from_legacy() async {
- featureSet = FeatureSets.beforeNullSafe;
+ featureSet = FeatureSets.language_2_9;
addLibrarySource('/legacy.dart', r'''
// @dart = 2.7
class LegacyDefault {
@@ -20511,7 +20536,7 @@
}
test_instantiateToBounds_boundRefersToItself_legacy() async {
- featureSet = FeatureSets.beforeNullSafe;
+ featureSet = FeatureSets.language_2_9;
var library = await checkLibrary('''
class C<T extends C<T>> {}
C c;
@@ -22281,7 +22306,6 @@
}
test_metadata_constructor_call_named_generic_inference() async {
- featureSet = FeatureSets.genericMetadata;
var library = await checkLibrary('''
class A<T> {
const A.named(T _);
@@ -22341,7 +22365,6 @@
}
test_metadata_constructor_call_named_generic_typeArguments() async {
- featureSet = FeatureSets.genericMetadata;
var library = await checkLibrary('''
class A<T> {
const A.named();
@@ -22428,12 +22451,12 @@
constructorName: SimpleIdentifier
staticElement: ConstructorMember
base: self::@class::A::@constructor::named
- substitution: {T: dynamic}
+ substitution: {T: int}
staticType: null
token: named @43
element: ConstructorMember
base: self::@class::A::@constructor::named
- substitution: {T: dynamic}
+ substitution: {T: int}
name: SimpleIdentifier
staticElement: self::@class::A
staticType: null
@@ -22505,7 +22528,6 @@
}
test_metadata_constructor_call_named_prefixed_generic_inference() async {
- featureSet = FeatureSets.genericMetadata;
addLibrarySource('/home/test/lib/foo.dart', '''
class A<T> {
const A.named(T _);
@@ -22561,7 +22583,6 @@
}
test_metadata_constructor_call_named_prefixed_generic_typeArguments() async {
- featureSet = FeatureSets.genericMetadata;
addLibrarySource('/home/test/lib/foo.dart', '''
class A<T> {
const A.named();
@@ -22743,7 +22764,6 @@
}
test_metadata_constructor_call_unnamed_generic_inference() async {
- featureSet = FeatureSets.genericMetadata;
var library = await checkLibrary('''
class A<T> {
const A(T _);
@@ -22789,7 +22809,6 @@
}
test_metadata_constructor_call_unnamed_generic_typeArguments() async {
- featureSet = FeatureSets.genericMetadata;
var library = await checkLibrary('''
class A<T> {
const A();
@@ -22878,7 +22897,6 @@
}
test_metadata_constructor_call_unnamed_prefixed_generic_inference() async {
- featureSet = FeatureSets.genericMetadata;
addLibrarySource('/home/test/lib/foo.dart', '''
class A<T> {
const A(T _);
@@ -22928,7 +22946,6 @@
}
test_metadata_constructor_call_unnamed_prefixed_generic_typeArguments() async {
- featureSet = FeatureSets.genericMetadata;
addLibrarySource('/home/test/lib/foo.dart', '''
class A<T> {
const A();
@@ -26463,7 +26480,7 @@
}
test_mixin_inference_legacy() async {
- featureSet = FeatureSets.beforeNullSafe;
+ featureSet = FeatureSets.language_2_9;
var library = await checkLibrary(r'''
class A<T> {}
mixin M<U> on A<U> {}
@@ -27249,13 +27266,13 @@
definingUnit
typeAliases
notSimplyBounded F @8
- aliasedType: dynamic Function() Function()
+ aliasedType: dynamic Function()
aliasedElement: GenericFunctionTypeElement
- returnType: dynamic Function()
+ returnType: dynamic
notSimplyBounded G @34
- aliasedType: dynamic Function() Function()
+ aliasedType: dynamic Function()
aliasedElement: GenericFunctionTypeElement
- returnType: dynamic Function()
+ returnType: dynamic
''');
}
@@ -27268,9 +27285,9 @@
definingUnit
typeAliases
notSimplyBounded F @8
- aliasedType: List<dynamic Function()> Function()
+ aliasedType: List<dynamic> Function()
aliasedElement: GenericFunctionTypeElement
- returnType: List<dynamic Function()>
+ returnType: List<dynamic>
''');
}
@@ -27285,7 +27302,7 @@
notSimplyBounded F @8
typeParameters
unrelated T @10
- bound: dynamic Function()
+ bound: dynamic
defaultType: dynamic
aliasedType: void Function()
aliasedElement: GenericFunctionTypeElement
@@ -27327,7 +27344,6 @@
}
test_new_typedef_nonFunction_notSimplyBounded_self() async {
- featureSet = FeatureSets.nonFunctionTypeAliases;
var library = await checkLibrary('''
typedef F<T extends F> = List<int>;
''');
@@ -27345,7 +27361,6 @@
}
test_new_typedef_nonFunction_notSimplyBounded_viaInterfaceType() async {
- featureSet = FeatureSets.nonFunctionTypeAliases;
var library = await checkLibrary('''
typedef F = List<F>;
''');
@@ -27773,7 +27788,7 @@
functionTypeAliasBased notSimplyBounded F @13
typeParameters
unrelated T @15
- bound: dynamic Function()
+ bound: dynamic
defaultType: dynamic
aliasedType: void Function()
aliasedElement: GenericFunctionTypeElement
@@ -29631,7 +29646,7 @@
}
test_type_never_disableNnbd() async {
- featureSet = FeatureSets.beforeNullSafe;
+ featureSet = FeatureSets.language_2_9;
var library = await checkLibrary('Never d;');
checkElementText(library, r'''
library
@@ -29730,7 +29745,7 @@
}
test_type_param_ref_nullability_star() async {
- featureSet = FeatureSets.beforeNullSafe;
+ featureSet = FeatureSets.language_2_9;
var library = await checkLibrary('''
class C<T> {
T t;
@@ -31108,7 +31123,6 @@
}
test_typeAlias_typeParameters_variance_interface_contravariant() async {
- featureSet = FeatureSets.nonFunctionTypeAliases;
var library = await checkLibrary(r'''
typedef A<T> = List<void Function(T)>;
''');
@@ -31125,7 +31139,6 @@
}
test_typeAlias_typeParameters_variance_interface_contravariant2() async {
- featureSet = FeatureSets.nonFunctionTypeAliases;
var library = await checkLibrary(r'''
typedef A<T> = void Function(T);
typedef B<T> = List<A<T>>;
@@ -31153,7 +31166,6 @@
}
test_typeAlias_typeParameters_variance_interface_covariant() async {
- featureSet = FeatureSets.nonFunctionTypeAliases;
var library = await checkLibrary(r'''
typedef A<T> = List<T>;
''');
@@ -31170,7 +31182,6 @@
}
test_typeAlias_typeParameters_variance_interface_covariant2() async {
- featureSet = FeatureSets.nonFunctionTypeAliases;
var library = await checkLibrary(r'''
typedef A<T> = Map<int, T>;
typedef B<T> = List<A<T>>;
@@ -31297,19 +31308,19 @@
definingUnit
typeAliases
F @8
- aliasedType: dynamic Function()
+ aliasedType: int
topLevelVariables
static f @19
- type: dynamic Function()
+ type: int
aliasElement: self::@typeAlias::F
accessors
synthetic static get f @-1
- returnType: dynamic Function()
+ returnType: int
aliasElement: self::@typeAlias::F
synthetic static set f @-1
parameters
requiredPositional _f @-1
- type: dynamic Function()
+ type: int
aliasElement: self::@typeAlias::F
returnType: void
''');
@@ -31320,7 +31331,6 @@
reason: 'Type dynamic is special, no support for its aliases yet',
)
test_typedef_nonFunction_aliasElement_dynamic() async {
- featureSet = FeatureSets.nonFunctionTypeAliases;
var library = await checkLibrary(r'''
typedef A = dynamic;
void f(A a) {}
@@ -31333,7 +31343,6 @@
}
test_typedef_nonFunction_aliasElement_functionType() async {
- featureSet = FeatureSets.nonFunctionTypeAliases;
var library = await checkLibrary(r'''
typedef A1 = void Function();
typedef A2<R> = R Function();
@@ -31375,7 +31384,6 @@
}
test_typedef_nonFunction_aliasElement_interfaceType() async {
- featureSet = FeatureSets.nonFunctionTypeAliases;
var library = await checkLibrary(r'''
typedef A1 = List<int>;
typedef A2<T, U> = Map<T, U>;
@@ -31420,7 +31428,6 @@
reason: 'Type Never is special, no support for its aliases yet',
)
test_typedef_nonFunction_aliasElement_never() async {
- featureSet = FeatureSets.nonFunctionTypeAliases;
var library = await checkLibrary(r'''
typedef A1 = Never;
typedef A2<T> = Never?;
@@ -31437,7 +31444,6 @@
}
test_typedef_nonFunction_aliasElement_typeParameterType() async {
- featureSet = FeatureSets.nonFunctionTypeAliases;
var library = await checkLibrary(r'''
typedef A<T> = T;
void f<U>(A<U> a) {}
@@ -31471,7 +31477,6 @@
reason: 'Type void is special, no support for its aliases yet',
)
test_typedef_nonFunction_aliasElement_void() async {
- featureSet = FeatureSets.nonFunctionTypeAliases;
var library = await checkLibrary(r'''
typedef A = void;
void f(A a) {}
@@ -31484,7 +31489,6 @@
}
test_typedef_nonFunction_asInterfaceType_interfaceType_none() async {
- featureSet = FeatureSets.nonFunctionTypeAliases;
var library = await checkLibrary(r'''
typedef X<T> = A<int, T>;
class A<T, U> {}
@@ -31520,7 +31524,6 @@
}
test_typedef_nonFunction_asInterfaceType_interfaceType_question() async {
- featureSet = FeatureSets.nonFunctionTypeAliases;
var library = await checkLibrary(r'''
typedef X<T> = A<T>?;
class A<T> {}
@@ -31560,7 +31563,6 @@
}
test_typedef_nonFunction_asInterfaceType_interfaceType_question2() async {
- featureSet = FeatureSets.nonFunctionTypeAliases;
var library = await checkLibrary(r'''
typedef X<T> = A<T?>;
class A<T> {}
@@ -31604,7 +31606,6 @@
}
test_typedef_nonFunction_asInterfaceType_Never_none() async {
- featureSet = FeatureSets.nonFunctionTypeAliases;
var library = await checkLibrary(r'''
typedef X = Never;
class A implements X {}
@@ -31623,7 +31624,6 @@
}
test_typedef_nonFunction_asInterfaceType_Null_none() async {
- featureSet = FeatureSets.nonFunctionTypeAliases;
var library = await checkLibrary(r'''
typedef X = Null;
class A implements X {}
@@ -31642,7 +31642,6 @@
}
test_typedef_nonFunction_asInterfaceType_typeParameterType() async {
- featureSet = FeatureSets.nonFunctionTypeAliases;
var library = await checkLibrary(r'''
typedef X<T> = T;
class A {}
@@ -31678,7 +31677,6 @@
}
test_typedef_nonFunction_asInterfaceType_void() async {
- featureSet = FeatureSets.nonFunctionTypeAliases;
var library = await checkLibrary(r'''
typedef X = void;
class A {}
@@ -31708,7 +31706,6 @@
}
test_typedef_nonFunction_asMixinType_none() async {
- featureSet = FeatureSets.nonFunctionTypeAliases;
var library = await checkLibrary(r'''
typedef X = A<int>;
class A<T> {}
@@ -31738,7 +31735,6 @@
}
test_typedef_nonFunction_asMixinType_question() async {
- featureSet = FeatureSets.nonFunctionTypeAliases;
var library = await checkLibrary(r'''
typedef X = A<int>?;
class A<T> {}
@@ -31781,7 +31777,6 @@
}
test_typedef_nonFunction_asMixinType_question2() async {
- featureSet = FeatureSets.nonFunctionTypeAliases;
var library = await checkLibrary(r'''
typedef X = A<int?>;
class A<T> {}
@@ -31826,7 +31821,6 @@
}
test_typedef_nonFunction_asSuperType_interfaceType_Never_none() async {
- featureSet = FeatureSets.nonFunctionTypeAliases;
var library = await checkLibrary(r'''
typedef X = Never;
class A extends X {}
@@ -31845,7 +31839,6 @@
}
test_typedef_nonFunction_asSuperType_interfaceType_none() async {
- featureSet = FeatureSets.nonFunctionTypeAliases;
var library = await checkLibrary(r'''
typedef X = A<int>;
class A<T> {}
@@ -31873,7 +31866,6 @@
}
test_typedef_nonFunction_asSuperType_interfaceType_none_viaTypeParameter() async {
- featureSet = FeatureSets.nonFunctionTypeAliases;
var library = await checkLibrary(r'''
typedef X<T> = T;
class A<T> {}
@@ -31906,7 +31898,6 @@
}
test_typedef_nonFunction_asSuperType_interfaceType_Null_none() async {
- featureSet = FeatureSets.nonFunctionTypeAliases;
var library = await checkLibrary(r'''
typedef X = Null;
class A extends X {}
@@ -31925,7 +31916,6 @@
}
test_typedef_nonFunction_asSuperType_interfaceType_question() async {
- featureSet = FeatureSets.nonFunctionTypeAliases;
var library = await checkLibrary(r'''
typedef X = A<int>?;
class A<T> {}
@@ -31951,7 +31941,6 @@
}
test_typedef_nonFunction_asSuperType_interfaceType_question2() async {
- featureSet = FeatureSets.nonFunctionTypeAliases;
var library = await checkLibrary(r'''
typedef X = A<int?>;
class A<T> {}
@@ -31979,7 +31968,6 @@
}
test_typedef_nonFunction_asSuperType_Never_none() async {
- featureSet = FeatureSets.nonFunctionTypeAliases;
var library = await checkLibrary(r'''
typedef X = Never;
class A extends X {}
@@ -31998,7 +31986,6 @@
}
test_typedef_nonFunction_asSuperType_Null_none() async {
- featureSet = FeatureSets.nonFunctionTypeAliases;
var library = await checkLibrary(r'''
typedef X = Null;
class A extends X {}
@@ -32017,7 +32004,6 @@
}
test_typedef_nonFunction_using_dynamic() async {
- featureSet = FeatureSets.nonFunctionTypeAliases;
var library = await checkLibrary(r'''
typedef A = dynamic;
void f(A a) {}
@@ -32038,6 +32024,7 @@
}
test_typedef_nonFunction_using_interface_disabled() async {
+ featureSet = FeatureSets.language_2_12;
var library = await checkLibrary(r'''
typedef A = int;
void f(A a) {}
@@ -32063,7 +32050,6 @@
}
test_typedef_nonFunction_using_interface_noTypeParameters() async {
- featureSet = FeatureSets.nonFunctionTypeAliases;
var library = await checkLibrary(r'''
typedef A = int;
void f(A a) {}
@@ -32085,7 +32071,6 @@
}
test_typedef_nonFunction_using_interface_noTypeParameters_legacy() async {
- featureSet = FeatureSets.nonFunctionTypeAliases;
newFile('/a.dart', content: r'''
typedef A = List<int>;
''');
@@ -32110,7 +32095,6 @@
}
test_typedef_nonFunction_using_interface_noTypeParameters_question() async {
- featureSet = FeatureSets.nonFunctionTypeAliases;
var library = await checkLibrary(r'''
typedef A = int?;
void f(A a) {}
@@ -32132,7 +32116,6 @@
}
test_typedef_nonFunction_using_interface_withTypeParameters() async {
- featureSet = FeatureSets.nonFunctionTypeAliases;
var library = await checkLibrary(r'''
typedef A<T> = Map<int, T>;
void f(A<String> a) {}
@@ -32159,7 +32142,6 @@
}
test_typedef_nonFunction_using_Never_none() async {
- featureSet = FeatureSets.nonFunctionTypeAliases;
var library = await checkLibrary(r'''
typedef A = Never;
void f(A a) {}
@@ -32180,7 +32162,6 @@
}
test_typedef_nonFunction_using_Never_question() async {
- featureSet = FeatureSets.nonFunctionTypeAliases;
var library = await checkLibrary(r'''
typedef A = Never?;
void f(A a) {}
@@ -32201,7 +32182,6 @@
}
test_typedef_nonFunction_using_typeParameter_none() async {
- featureSet = FeatureSets.nonFunctionTypeAliases;
var library = await checkLibrary(r'''
typedef A<T> = T;
void f1(A a) {}
@@ -32234,7 +32214,6 @@
}
test_typedef_nonFunction_using_typeParameter_question() async {
- featureSet = FeatureSets.nonFunctionTypeAliases;
var library = await checkLibrary(r'''
typedef A<T> = T?;
void f1(A a) {}
@@ -32267,7 +32246,6 @@
}
test_typedef_nonFunction_using_void() async {
- featureSet = FeatureSets.nonFunctionTypeAliases;
var library = await checkLibrary(r'''
typedef A = void;
void f(A a) {}
@@ -32687,7 +32665,7 @@
functionTypeAliasBased notSimplyBounded F @13
typeParameters
unrelated T @15
- bound: dynamic Function()
+ bound: dynamic
defaultType: dynamic
aliasedType: void Function()
aliasedElement: GenericFunctionTypeElement
@@ -32705,7 +32683,7 @@
functionTypeAliasBased notSimplyBounded F @13
typeParameters
unrelated T @15
- bound: List<dynamic Function()>
+ bound: List<dynamic>
defaultType: dynamic
aliasedType: void Function()
aliasedElement: GenericFunctionTypeElement
@@ -32736,7 +32714,7 @@
}
test_typedef_type_parameters_f_bound_complex_legacy() async {
- featureSet = FeatureSets.beforeNullSafe;
+ featureSet = FeatureSets.language_2_9;
var library = await checkLibrary('typedef U F<T extends List<U>, U>(T t);');
checkElementText(library, r'''
library
@@ -32781,7 +32759,7 @@
}
test_typedef_type_parameters_f_bound_simple_legacy() async {
- featureSet = FeatureSets.beforeNullSafe;
+ featureSet = FeatureSets.language_2_9;
var library = await checkLibrary('typedef U F<T extends U, U>(T t);');
checkElementText(library, r'''
library
@@ -32827,7 +32805,7 @@
}
test_typedef_type_parameters_f_bound_simple_new_syntax_legacy() async {
- featureSet = FeatureSets.beforeNullSafe;
+ featureSet = FeatureSets.language_2_9;
var library =
await checkLibrary('typedef F<T extends U, U> = U Function(T t);');
checkElementText(library, r'''
diff --git a/pkg/dartdev/benchmark/bench.dart b/pkg/dartdev/benchmark/bench.dart
deleted file mode 100644
index abfeaff..0000000
--- a/pkg/dartdev/benchmark/bench.dart
+++ /dev/null
@@ -1,253 +0,0 @@
-// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'dart:convert';
-import 'dart:io' as io;
-
-import 'package:args/args.dart';
-import 'package:meta/meta.dart';
-
-List<Benchmark> benchmarks = [
- DartStartup(),
- DartRunStartup(),
- SdkSize(),
-];
-
-void main(List<String> args) async {
- ArgParser argParser = _createArgParser();
-
- ArgResults argResults;
-
- try {
- argResults = argParser.parse(args);
- } on FormatException catch (e) {
- print(e.message);
- print('');
- printUsage(argParser, includeDescription: false);
- io.exit(1);
- }
-
- if (argResults['help'] || argResults.arguments.isEmpty) {
- printUsage(argParser);
- io.exit(0);
- }
-
- if (!argResults.wasParsed('dart-sdk')) {
- print('No value passed for `dart-sdk`.');
- print('');
- printUsage(argParser);
- io.exit(1);
- }
-
- if (!argResults.wasParsed('run')) {
- print('No value passed for `run`.');
- print('');
- printUsage(argParser);
- io.exit(1);
- }
-
- Context context = Context(argResults['dart-sdk']);
-
- String benchmarkName = argResults['run'];
- Benchmark benchmark = benchmarks.singleWhere((b) => b.id == benchmarkName);
-
- BenchmarkResult result = await benchmark.run(context);
- print(result.toJson());
- io.exit(0);
-}
-
-void printUsage(ArgParser argParser, {bool includeDescription = true}) {
- print('usage: dart bin/bench.dart <options>');
- print('');
- if (includeDescription) {
- print('Run benchmarks for the dartdev tool.');
- print('');
- }
- print('Options:');
- print(argParser.usage);
-}
-
-ArgParser _createArgParser() {
- ArgParser argParser = ArgParser(usageLineLength: io.stdout.terminalColumns);
- argParser.addFlag(
- 'help',
- abbr: 'h',
- negatable: false,
- help: 'Print this usage information.',
- );
- argParser.addOption(
- 'dart-sdk',
- valueHelp: 'sdk path',
- help: 'The path to the Dart SDK to use for benchmarking.',
- );
- argParser.addOption(
- 'run',
- valueHelp: 'benchmark',
- allowed: benchmarks.map((b) => b.id).toList(),
- allowedHelp: {
- for (var benchmark in benchmarks) benchmark.id: benchmark.description,
- },
- help: 'The benchmark to run.',
- );
- return argParser;
-}
-
-abstract class Benchmark {
- final String id;
- final String description;
-
- Benchmark(this.id, this.description);
-
- Future<BenchmarkResult> run(Context context);
-}
-
-class DartStartup extends Benchmark {
- DartStartup()
- : super(
- 'script-startup',
- 'Benchmark the startup time of a minimal Dart script (μs).',
- );
-
- @override
- Future<BenchmarkResult> run(Context context) async {
- // setup
- io.Directory dir = io.Directory.systemTemp.createTempSync('dartdev');
- io.File file = io.File('${dir.path}/hello.dart');
- file.writeAsStringSync('void main() => print(\'hello\');');
-
- // perform the benchmark
- Stopwatch timer = Stopwatch()..start();
- io.Process.runSync(
- '${context.sdkPath}/bin/dart',
- [file.absolute.path],
- );
- timer.stop();
-
- // cleanup
- dir.deleteSync(recursive: true);
-
- // report the result
- int micros = timer.elapsedMicroseconds;
- return BenchmarkResult(
- id: id,
- value: micros,
- units: 'microseconds',
- userDescription: '${(micros / 1000.0).toStringAsFixed(2)}ms',
- );
- }
-}
-
-class DartRunStartup extends Benchmark {
- DartRunStartup()
- : super(
- 'run-script-startup',
- 'Benchmark the startup time of a minimal Dart script, executed with '
- '`dart run` (μs).',
- );
-
- @override
- Future<BenchmarkResult> run(Context context) async {
- // setup
- io.Directory dir = io.Directory.systemTemp.createTempSync('dartdev');
- io.File file = io.File('${dir.path}/hello.dart');
- file.writeAsStringSync('void main() => print(\'hello\');');
-
- // perform the benchmark
- Stopwatch timer = Stopwatch()..start();
- io.Process.runSync(
- '${context.sdkPath}/bin/dart',
- ['run', file.absolute.path],
- );
- timer.stop();
-
- // cleanup
- dir.deleteSync(recursive: true);
-
- // report the result
- int micros = timer.elapsedMicroseconds;
- return BenchmarkResult(
- id: id,
- value: micros,
- units: 'microseconds',
- userDescription: '${(micros / 1000.0).toStringAsFixed(2)}ms',
- );
- }
-}
-
-class SdkSize extends Benchmark {
- SdkSize()
- : super(
- 'sdk-size',
- 'Benchmark the compressed size of the Dart SDK (bytes).',
- );
-
- @override
- Future<BenchmarkResult> run(Context context) async {
- // setup
- io.Directory tempDir = io.Directory.systemTemp.createTempSync('dartdev');
-
- // perform the benchmark
- io.File sdkArchive = compress(io.Directory(context.sdkPath), tempDir);
- int bytes = sdkArchive.lengthSync();
-
- // cleanup
- tempDir.deleteSync(recursive: true);
-
- // report the result
- return BenchmarkResult(
- id: id,
- value: bytes,
- units: 'bytes',
- userDescription: '${(bytes / (1024.0 * 1024.0)).toStringAsFixed(1)}MB',
- );
- }
-
- io.File compress(io.Directory sourceDir, io.Directory targetDir) {
- String name = sourceDir.path.substring(sourceDir.path.lastIndexOf('/') + 1);
- io.File outFile = io.File('${targetDir.absolute.path}/$name.zip');
-
- if (io.Platform.isMacOS || io.Platform.isLinux) {
- io.Process.runSync('zip', [
- '-r',
- '-9', // optimized for compressed size
- outFile.absolute.path,
- sourceDir.absolute.path,
- ]);
- } else {
- throw Exception('platform not supported: ${io.Platform.operatingSystem}');
- }
-
- return outFile;
- }
-}
-
-class Context {
- final String sdkPath;
-
- Context(this.sdkPath);
-}
-
-class BenchmarkResult {
- final String id;
- final int value;
- final String units;
- final String userDescription;
-
- BenchmarkResult({
- @required this.id,
- @required this.value,
- @required this.units,
- @required this.userDescription,
- });
-
- String toJson() {
- Map m = {
- 'id': id,
- 'value': value,
- 'units': units,
- 'userDescription': userDescription,
- };
- return JsonEncoder.withIndent(' ').convert(m);
- }
-}
diff --git a/tests/language/constructor/reference_test.dart b/tests/language/constructor/reference_test.dart
index 36ca27d..3755880 100644
--- a/tests/language/constructor/reference_test.dart
+++ b/tests/language/constructor/reference_test.dart
@@ -88,8 +88,6 @@
Foo.bar.baz();
// ^^^
// [cfe] Getter not found: 'bar'.
-//^^^^^^^
-// [analyzer] COMPILE_TIME_ERROR.CONSTRUCTOR_TEAROFFS_NOT_ENABLED
// ^^^
// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_METHOD
Foo<int>();
@@ -117,8 +115,6 @@
Foo.bar.baz<int>();
// ^^^
// [cfe] Getter not found: 'bar'.
-//^^^^^^^
-// [analyzer] COMPILE_TIME_ERROR.CONSTRUCTOR_TEAROFFS_NOT_ENABLED
// ^^^
// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_METHOD
}
diff --git a/tests/language/generic/metadata_in_function_body_test.dart b/tests/language/generic/metadata_in_function_body_test.dart
index 8b64190..de229e5 100644
--- a/tests/language/generic/metadata_in_function_body_test.dart
+++ b/tests/language/generic/metadata_in_function_body_test.dart
@@ -17,11 +17,11 @@
@C()
@C<dynamic>()
//^
- // [analyzer] SYNTACTIC_ERROR.ANNOTATION_WITH_TYPE_ARGUMENTS
+ // [analyzer] SYNTACTIC_ERROR.EXPERIMENT_NOT_ENABLED
// [cfe] An annotation can't use type arguments.
@C<int>()
//^
- // [analyzer] SYNTACTIC_ERROR.ANNOTATION_WITH_TYPE_ARGUMENTS
+ // [analyzer] SYNTACTIC_ERROR.EXPERIMENT_NOT_ENABLED
// [cfe] An annotation can't use type arguments.
int i = 0;
ignore(i);
diff --git a/tests/language/generic/metadata_test.dart b/tests/language/generic/metadata_test.dart
index 70156d6..851dda9 100644
--- a/tests/language/generic/metadata_test.dart
+++ b/tests/language/generic/metadata_test.dart
@@ -13,10 +13,10 @@
@C()
@C<dynamic>()
//^
-// [analyzer] SYNTACTIC_ERROR.ANNOTATION_WITH_TYPE_ARGUMENTS
+// [analyzer] SYNTACTIC_ERROR.EXPERIMENT_NOT_ENABLED
// [cfe] An annotation can't use type arguments.
@C<int>()
//^
-// [analyzer] SYNTACTIC_ERROR.ANNOTATION_WITH_TYPE_ARGUMENTS
+// [analyzer] SYNTACTIC_ERROR.EXPERIMENT_NOT_ENABLED
// [cfe] An annotation can't use type arguments.
main() {}
diff --git a/tests/language_2/constructor/reference_test.dart b/tests/language_2/constructor/reference_test.dart
index 6dff1ad..03d4c56 100644
--- a/tests/language_2/constructor/reference_test.dart
+++ b/tests/language_2/constructor/reference_test.dart
@@ -90,8 +90,6 @@
Foo.bar.baz();
// ^^^
// [cfe] Getter not found: 'bar'.
-//^^^^^^^
-// [analyzer] COMPILE_TIME_ERROR.CONSTRUCTOR_TEAROFFS_NOT_ENABLED
// ^^^
// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_METHOD
Foo<int>();
@@ -119,8 +117,6 @@
Foo.bar.baz<int>();
// ^^^
// [cfe] Getter not found: 'bar'.
-//^^^^^^^
-// [analyzer] COMPILE_TIME_ERROR.CONSTRUCTOR_TEAROFFS_NOT_ENABLED
// ^^^
// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_METHOD
}
diff --git a/tests/language_2/generic/metadata_in_function_body_test.dart b/tests/language_2/generic/metadata_in_function_body_test.dart
index d98f743..79af7e0 100644
--- a/tests/language_2/generic/metadata_in_function_body_test.dart
+++ b/tests/language_2/generic/metadata_in_function_body_test.dart
@@ -19,11 +19,11 @@
@C()
@C<dynamic>()
//^
- // [analyzer] SYNTACTIC_ERROR.ANNOTATION_WITH_TYPE_ARGUMENTS
+ // [analyzer] SYNTACTIC_ERROR.EXPERIMENT_NOT_ENABLED
// [cfe] An annotation can't use type arguments.
@C<int>()
//^
- // [analyzer] SYNTACTIC_ERROR.ANNOTATION_WITH_TYPE_ARGUMENTS
+ // [analyzer] SYNTACTIC_ERROR.EXPERIMENT_NOT_ENABLED
// [cfe] An annotation can't use type arguments.
int i = 0;
ignore(i);
diff --git a/tests/language_2/generic/metadata_test.dart b/tests/language_2/generic/metadata_test.dart
index 4a4dcad..29ec0d9 100644
--- a/tests/language_2/generic/metadata_test.dart
+++ b/tests/language_2/generic/metadata_test.dart
@@ -15,10 +15,10 @@
@C()
@C<dynamic>()
//^
-// [analyzer] SYNTACTIC_ERROR.ANNOTATION_WITH_TYPE_ARGUMENTS
+// [analyzer] SYNTACTIC_ERROR.EXPERIMENT_NOT_ENABLED
// [cfe] An annotation can't use type arguments.
@C<int>()
//^
-// [analyzer] SYNTACTIC_ERROR.ANNOTATION_WITH_TYPE_ARGUMENTS
+// [analyzer] SYNTACTIC_ERROR.EXPERIMENT_NOT_ENABLED
// [cfe] An annotation can't use type arguments.
main() {}
diff --git a/tools/VERSION b/tools/VERSION
index 9673472..f951325 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 15
PATCH 0
-PRERELEASE 35
+PRERELEASE 36
PRERELEASE_PATCH 0
\ No newline at end of file