Version 2.13.0-32.0.dev
Merge commit '2439c412f0df54c18992194056a3350a55f54085' into 'dev'
diff --git a/DEPS b/DEPS
index 6318463..990085c 100644
--- a/DEPS
+++ b/DEPS
@@ -122,7 +122,7 @@
"logging_rev": "e2f633b543ef89c54688554b15ca3d7e425b86a2",
"markupsafe_rev": "8f45f5cfa0009d2a70589bcda0349b8cb2b72783",
"markdown_rev": "9c4beaac96d8f008078e00b027915f81b665d2de",
- "matcher_rev": "43d5cac48fcd386643016e767164da87c5c25e29",
+ "matcher_rev": "1f7b6f0cb15eb6659a1de0513571575a5c8a51d0",
"mime_rev": "c931f4bed87221beaece356494b43731445ce7b8",
"mockito_rev": "d39ac507483b9891165e422ec98d9fb480037c8b",
"mustache_rev": "664737ecad027e6b96d0d1e627257efa0e46fcb1",
diff --git a/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart b/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
index 5ba8d5f..b372ad4 100644
--- a/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
@@ -3767,32 +3767,6 @@
}
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
-const Template<
- Message Function(
- String
- name)> templateFfiEmptyStructWarning = const Template<
- Message Function(String name)>(
- messageTemplate:
- r"""Struct '#name' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead.""",
- withArguments: _withArgumentsFfiEmptyStructWarning);
-
-// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
-const Code<Message Function(String name)> codeFfiEmptyStructWarning =
- const Code<Message Function(String name)>("FfiEmptyStructWarning",
- analyzerCodes: <String>["EMPTY_STRUCT_WARNING"],
- severity: Severity.info);
-
-// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
-Message _withArgumentsFfiEmptyStructWarning(String name) {
- if (name.isEmpty) throw 'No name provided';
- name = demangleMixinApplicationName(name);
- return new Message(codeFfiEmptyStructWarning,
- message:
- """Struct '${name}' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead.""",
- arguments: {'name': name});
-}
-
-// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeFfiExceptionalReturnNull = messageFfiExceptionalReturnNull;
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
diff --git a/pkg/analysis_server/lib/src/context_manager.dart b/pkg/analysis_server/lib/src/context_manager.dart
index 458856b..0b408fb 100644
--- a/pkg/analysis_server/lib/src/context_manager.dart
+++ b/pkg/analysis_server/lib/src/context_manager.dart
@@ -737,7 +737,7 @@
List<protocol.AnalysisError> convertedErrors;
try {
var file = resourceProvider.getFile(path);
- var packageName = file.parent.parent.shortName;
+ var packageName = file.parent2.parent2.shortName;
var content = _readFile(path);
var errorListener = RecordingErrorListener();
var errorReporter = ErrorReporter(errorListener, file.createSource());
@@ -1119,7 +1119,7 @@
/// Extract a new [packagespecFile]-based context from [oldInfo].
void _extractContext(ContextInfo oldInfo, File packagespecFile) {
- var newFolder = packagespecFile.parent;
+ var newFolder = packagespecFile.parent2;
var newInfo =
_createContext(oldInfo, newFolder, excludedPaths, packagespecFile);
// prepare sources to extract
diff --git a/pkg/analysis_server/lib/src/edit/edit_dartfix.dart b/pkg/analysis_server/lib/src/edit/edit_dartfix.dart
index ef883bc..fa3c671 100644
--- a/pkg/analysis_server/lib/src/edit/edit_dartfix.dart
+++ b/pkg/analysis_server/lib/src/edit/edit_dartfix.dart
@@ -147,13 +147,12 @@
).toResponse(request.id);
}
- Folder findPkgFolder(Folder folder) {
- while (folder != null) {
+ Folder findPkgFolder(Folder start) {
+ for (var folder in start.withAncestors) {
if (folder.getChild('analysis_options.yaml').exists ||
folder.getChild('pubspec.yaml').exists) {
return folder;
}
- folder = folder.parent;
}
return null;
}
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/feature_computer.dart b/pkg/analysis_server/lib/src/services/completion/dart/feature_computer.dart
index ecac3e6..b6aaae5 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/feature_computer.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/feature_computer.dart
@@ -53,13 +53,13 @@
} else if (numNames.contains(name)) {
return typeProvider.numType;
} else if (listNames.contains(name)) {
- return typeProvider.listType2(typeProvider.dynamicType);
+ return typeProvider.listType(typeProvider.dynamicType);
} else if (stringNames.contains(name)) {
return typeProvider.stringType;
} else if (name == 'iterator') {
return typeProvider.iterableDynamicType;
} else if (name == 'map') {
- return typeProvider.mapType2(
+ return typeProvider.mapType(
typeProvider.dynamicType, typeProvider.dynamicType);
}
return null;
@@ -890,7 +890,7 @@
if (currentNode.isSet) {
return typeProvider.iterableDynamicType;
}
- return typeProvider.mapType2(
+ return typeProvider.mapType(
typeProvider.dynamicType, typeProvider.dynamicType);
}
currentNode = currentNode.parent;
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_null_check.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_null_check.dart
index c297b3c..1eaee2a 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/add_null_check.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/add_null_check.dart
@@ -45,9 +45,9 @@
toType = parent.realTarget.staticType;
} else if (parent is ForEachPartsWithDeclaration) {
toType =
- typeProvider.iterableType2(parent.loopVariable.declaredElement.type);
+ typeProvider.iterableType(parent.loopVariable.declaredElement.type);
} else if (parent is ForEachPartsWithIdentifier) {
- toType = typeProvider.iterableType2(parent.identifier.staticType);
+ toType = typeProvider.iterableType(parent.identifier.staticType);
} else if (parent is SpreadElement) {
var literal = parent.thisOrAncestorOfType<TypedLiteral>();
if (literal is ListLiteral) {
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/update_sdk_constraints.dart b/pkg/analysis_server/lib/src/services/correction/dart/update_sdk_constraints.dart
index dcf3765..f25d116 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/update_sdk_constraints.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/update_sdk_constraints.dart
@@ -32,7 +32,7 @@
break;
}
pubspecFile = null;
- folder = folder.parent;
+ folder = folder.parent2;
}
if (pubspecFile == null) {
return;
diff --git a/pkg/analysis_server/lib/src/services/correction/fix.dart b/pkg/analysis_server/lib/src/services/correction/fix.dart
index 8adc153..da0af33 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix.dart
@@ -145,19 +145,24 @@
class DartFixKind {
static const ADD_ASYNC =
FixKind('dart.fix.add.async', 50, "Add 'async' modifier");
- static const ADD_AWAIT =
- FixKind('dart.fix.add.await', 50, "Add 'await' keyword");
+ static const ADD_AWAIT = FixKind(
+ 'dart.fix.add.await', 50, "Add 'await' keyword",
+ appliedTogetherMessage: "Add 'await's everywhere in file");
static const ADD_EXPLICIT_CAST = FixKind(
'dart.fix.add.explicitCast', 50, 'Add cast',
appliedTogetherMessage: 'Add all casts in file');
- static const ADD_CONST =
- FixKind('dart.fix.add.const', 50, "Add 'const' modifier");
- static const ADD_CURLY_BRACES =
- FixKind('dart.fix.add.curlyBraces', 50, 'Add curly braces');
+ static const ADD_CONST = FixKind(
+ 'dart.fix.add.const', 50, "Add 'const' modifier",
+ appliedTogetherMessage: "Add 'const' modifiers everywhere in file");
+ static const ADD_CURLY_BRACES = FixKind(
+ 'dart.fix.add.curlyBraces', 50, 'Add curly braces',
+ appliedTogetherMessage: 'Add curly braces everywhere in file');
static const ADD_DIAGNOSTIC_PROPERTY_REFERENCE = FixKind(
'dart.fix.add.diagnosticPropertyReference',
50,
- 'Add a debug reference to this property');
+ 'Add a debug reference to this property',
+ appliedTogetherMessage:
+ 'Add missing debug property references everywhere in file');
static const ADD_FIELD_FORMAL_PARAMETERS = FixKind(
'dart.fix.add.fieldFormalParameters',
70,
@@ -184,22 +189,27 @@
appliedTogetherMessage: 'Add != null everywhere in file');
static const ADD_NULL_CHECK =
FixKind('dart.fix.add.nullCheck', 50, 'Add a null check (!)');
- static const ADD_OVERRIDE =
- FixKind('dart.fix.add.override', 50, "Add '@override' annotation");
- static const ADD_REQUIRED =
- FixKind('dart.fix.add.required', 50, "Add '@required' annotation");
- static const ADD_REQUIRED2 =
- FixKind('dart.fix.add.required', 50, "Add 'required' keyword");
- static const ADD_RETURN_TYPE =
- FixKind('dart.fix.add.returnType', 50, 'Add return type');
+ static const ADD_OVERRIDE = FixKind(
+ 'dart.fix.add.override', 50, "Add '@override' annotation",
+ appliedTogetherMessage: "Add '@override' annotations everywhere in file");
+ static const ADD_REQUIRED = FixKind(
+ 'dart.fix.add.required', 50, "Add '@required' annotation",
+ appliedTogetherMessage: "Add '@required' annotations everywhere in file");
+ static const ADD_REQUIRED2 = FixKind(
+ 'dart.fix.add.required', 50, "Add 'required' keyword",
+ appliedTogetherMessage: "Add 'required' keywords everywhere in file");
+ static const ADD_RETURN_TYPE = FixKind(
+ 'dart.fix.add.returnType', 50, 'Add return type',
+ appliedTogetherMessage: 'Add return types everywhere in file');
static const ADD_STATIC =
FixKind('dart.fix.add.static', 50, "Add 'static' modifier");
static const ADD_SUPER_CONSTRUCTOR_INVOCATION = FixKind(
'dart.fix.add.superConstructorInvocation',
50,
'Add super constructor {0} invocation');
- static const ADD_TYPE_ANNOTATION =
- FixKind('dart.fix.add.typeAnnotation', 50, 'Add type annotation');
+ static const ADD_TYPE_ANNOTATION = FixKind(
+ 'dart.fix.add.typeAnnotation', 50, 'Add type annotation',
+ appliedTogetherMessage: 'Add type annotations everywhere in file');
static const CHANGE_ARGUMENT_NAME =
FixKind('dart.fix.change.argumentName', 60, "Change to '{0}'");
static const CHANGE_TO = FixKind('dart.fix.change.to', 51, "Change to '{0}'");
@@ -220,51 +230,75 @@
static const CONVERT_FLUTTER_CHILDREN = FixKind(
'dart.fix.flutter.convert.childrenToChild', 50, 'Convert to child:');
static const CONVERT_INTO_EXPRESSION_BODY = FixKind(
- 'dart.fix.convert.toExpressionBody', 50, 'Convert to expression body');
- static const CONVERT_TO_CONTAINS =
- FixKind('dart.fix.convert.toContains', 50, "Convert to using 'contains'");
+ 'dart.fix.convert.toExpressionBody', 50, 'Convert to expression body',
+ appliedTogetherMessage:
+ 'Convert to expression bodies everywhere in file');
+ static const CONVERT_TO_CONTAINS = FixKind(
+ 'dart.fix.convert.toContains', 50, "Convert to using 'contains'",
+ appliedTogetherMessage: "Convert to using 'contains' everywhere in file");
static const CONVERT_TO_FOR_ELEMENT = FixKind(
- 'dart.fix.convert.toForElement', 50, "Convert to a 'for' element");
+ 'dart.fix.convert.toForElement', 50, "Convert to a 'for' element",
+ appliedTogetherMessage: "Convert to 'for' elements everywhere in file");
static const CONVERT_TO_GENERIC_FUNCTION_SYNTAX = FixKind(
'dart.fix.convert.toGenericFunctionSyntax',
50,
- "Convert into 'Function' syntax");
- static const CONVERT_TO_IF_ELEMENT =
- FixKind('dart.fix.convert.toIfElement', 50, "Convert to an 'if' element");
- static const CONVERT_TO_IF_NULL =
- FixKind('dart.fix.convert.toIfNull', 50, "Convert to use '??'");
- static const CONVERT_TO_INT_LITERAL =
- FixKind('dart.fix.convert.toIntLiteral', 50, 'Convert to an int literal');
+ "Convert into 'Function' syntax",
+ appliedTogetherMessage:
+ "Convert to 'Function' syntax everywhere in file");
+ static const CONVERT_TO_IF_ELEMENT = FixKind(
+ 'dart.fix.convert.toIfElement', 50, "Convert to an 'if' element",
+ appliedTogetherMessage: "Convert to 'if' elements everywhere in file");
+ static const CONVERT_TO_IF_NULL = FixKind(
+ 'dart.fix.convert.toIfNull', 50, "Convert to use '??'",
+ appliedTogetherMessage: "Convert to '??'s everywhere in file");
+ static const CONVERT_TO_INT_LITERAL = FixKind(
+ 'dart.fix.convert.toIntLiteral', 50, 'Convert to an int literal',
+ appliedTogetherMessage: 'Convert to int literals everywhere in file');
static const CONVERT_TO_LINE_COMMENT = FixKind(
'dart.fix.convert.toLineComment',
50,
- 'Convert to line documentation comment');
- static const CONVERT_TO_LIST_LITERAL =
- FixKind('dart.fix.convert.toListLiteral', 50, 'Convert to list literal');
- static const CONVERT_TO_MAP_LITERAL =
- FixKind('dart.fix.convert.toMapLiteral', 50, 'Convert to map literal');
+ 'Convert to line documentation comment',
+ appliedTogetherMessage:
+ 'Convert to line documentation comments everywhere in file');
+ static const CONVERT_TO_LIST_LITERAL = FixKind(
+ 'dart.fix.convert.toListLiteral', 50, 'Convert to list literal',
+ appliedTogetherMessage: 'Convert to list literals everywhere in file');
+ static const CONVERT_TO_MAP_LITERAL = FixKind(
+ 'dart.fix.convert.toMapLiteral', 50, 'Convert to map literal',
+ appliedTogetherMessage: 'Convert to map literals everywhere in file');
static const CONVERT_TO_NAMED_ARGUMENTS = FixKind(
'dart.fix.convert.toNamedArguments', 50, 'Convert to named arguments');
- static const CONVERT_TO_NULL_AWARE =
- FixKind('dart.fix.convert.toNullAware', 50, "Convert to use '?.'");
+ static const CONVERT_TO_NULL_AWARE = FixKind(
+ 'dart.fix.convert.toNullAware', 50, "Convert to use '?.'",
+ appliedTogetherMessage: "Convert to use '?.' everywhere in file");
static const CONVERT_TO_NULL_AWARE_SPREAD = FixKind(
- 'dart.fix.convert.toNullAwareSpread', 50, "Convert to use '...?'");
+ 'dart.fix.convert.toNullAwareSpread', 50, "Convert to use '...?'",
+ appliedTogetherMessage: "Convert to use '...?' everywhere in file");
static const CONVERT_TO_ON_TYPE =
FixKind('dart.fix.convert.toOnType', 50, "Convert to 'on {0}'");
static const CONVERT_TO_PACKAGE_IMPORT = FixKind(
- 'dart.fix.convert.toPackageImport', 50, "Convert to 'package:' import");
+ 'dart.fix.convert.toPackageImport', 50, "Convert to 'package:' import",
+ appliedTogetherMessage:
+ "Convert to 'package:' imports everywhere in file");
static const CONVERT_TO_RELATIVE_IMPORT = FixKind(
- 'dart.fix.convert.toRelativeImport', 50, 'Convert to relative import');
- static const CONVERT_TO_SET_LITERAL =
- FixKind('dart.fix.convert.toSetLiteral', 50, 'Convert to set literal');
+ 'dart.fix.convert.toRelativeImport', 50, 'Convert to relative import',
+ appliedTogetherMessage: 'Convert to relative imports everywhere in file');
+ static const CONVERT_TO_SET_LITERAL = FixKind(
+ 'dart.fix.convert.toSetLiteral', 50, 'Convert to set literal',
+ appliedTogetherMessage: 'Convert to set literals everywhere in file');
static const CONVERT_TO_SINGLE_QUOTED_STRING = FixKind(
'dart.fix.convert.toSingleQuotedString',
50,
- 'Convert to single quoted string');
- static const CONVERT_TO_SPREAD =
- FixKind('dart.fix.convert.toSpread', 50, 'Convert to a spread');
- static const CONVERT_TO_WHERE_TYPE =
- FixKind('dart.fix.convert.toWhereType', 50, "Convert to use 'whereType'");
+ 'Convert to single quoted string',
+ appliedTogetherMessage:
+ 'Convert to single quoted strings everywhere in file');
+ static const CONVERT_TO_SPREAD = FixKind(
+ 'dart.fix.convert.toSpread', 50, 'Convert to a spread',
+ appliedTogetherMessage: 'Convert to spreads everywhere in file');
+ static const CONVERT_TO_WHERE_TYPE = FixKind(
+ 'dart.fix.convert.toWhereType', 50, "Convert to use 'whereType'",
+ appliedTogetherMessage:
+ "Convert to using 'whereType' everywhere in file");
static const CREATE_CLASS =
FixKind('dart.fix.create.class', 50, "Create class '{0}'");
static const CREATE_CONSTRUCTOR =
@@ -286,7 +320,9 @@
static const CREATE_LOCAL_VARIABLE = FixKind(
'dart.fix.create.localVariable', 50, "Create local variable '{0}'");
static const CREATE_METHOD =
- FixKind('dart.fix.create.method', 50, "Create method '{0}'");
+ FixKind('dart.fix.create.method', 50, "Create method '{0}'",
+ // todo (pq): used by LintNames.hash_and_equals; consider removing.
+ appliedTogetherMessage: 'Create methods in file');
static const CREATE_MISSING_OVERRIDES = FixKind(
'dart.fix.create.missingOverrides', 51, 'Create {0} missing override(s)');
static const CREATE_MIXIN =
@@ -312,17 +348,21 @@
FixKind('dart.fix.import.librarySdk', 54, "Import library '{0}'");
static const IMPORT_LIBRARY_SHOW =
FixKind('dart.fix.import.libraryShow', 55, "Update library '{0}' import");
- static const INLINE_INVOCATION =
- FixKind('dart.fix.inlineInvocation', 30, "Inline invocation of '{0}'");
- static const INLINE_TYPEDEF =
- FixKind('dart.fix.inlineTypedef', 30, "Inline the definition of '{0}'");
+ static const INLINE_INVOCATION = FixKind(
+ 'dart.fix.inlineInvocation', 30, "Inline invocation of '{0}'",
+ appliedTogetherMessage: 'Inline invocations everywhere in file');
+ static const INLINE_TYPEDEF = FixKind(
+ 'dart.fix.inlineTypedef', 30, "Inline the definition of '{0}'",
+ appliedTogetherMessage: 'Inline type definitions everywhere in file');
static const INSERT_SEMICOLON =
FixKind('dart.fix.insertSemicolon', 50, "Insert ';'");
static const MAKE_CLASS_ABSTRACT =
FixKind('dart.fix.makeClassAbstract', 50, "Make class '{0}' abstract");
static const MAKE_FIELD_NOT_FINAL =
FixKind('dart.fix.makeFieldNotFinal', 50, "Make field '{0}' not final");
- static const MAKE_FINAL = FixKind('dart.fix.makeFinal', 50, 'Make final');
+ static const MAKE_FINAL = FixKind('dart.fix.makeFinal', 50, 'Make final',
+ // todo (pq): consider parameterizing: 'Make {fields} final...'
+ appliedTogetherMessage: 'Make final where possible in file');
static const MAKE_RETURN_TYPE_NULLABLE = FixKind(
'dart.fix.makeReturnTypeNullable', 50, 'Make the return type nullable');
static const MOVE_TYPE_ARGUMENTS_TO_CLASS = FixKind(
@@ -339,10 +379,13 @@
FixKind('dart.fix.qualifyReference', 50, "Use '{0}'");
static const REMOVE_ANNOTATION =
FixKind('dart.fix.remove.annotation', 50, "Remove the '{0}' annotation");
- static const REMOVE_ARGUMENT =
- FixKind('dart.fix.remove.argument', 50, 'Remove argument');
- static const REMOVE_AWAIT =
- FixKind('dart.fix.remove.await', 50, 'Remove await');
+ static const REMOVE_ARGUMENT = FixKind(
+ 'dart.fix.remove.argument', 50, 'Remove argument',
+ // todo (pq): used by LintNames.avoid_redundant_argument_values; consider a parameterized message
+ appliedTogetherMessage: 'Remove arguments in file');
+ static const REMOVE_AWAIT = FixKind(
+ 'dart.fix.remove.await', 50, 'Remove await',
+ appliedTogetherMessage: 'Remove awaits in file');
static const REMOVE_COMPARISON =
FixKind('dart.fix.remove.comparison', 50, 'Remove comparison');
static const REMOVE_CONST =
@@ -350,33 +393,49 @@
static const REMOVE_DEAD_CODE =
FixKind('dart.fix.remove.deadCode', 50, 'Remove dead code');
static const REMOVE_DUPLICATE_CASE = FixKind(
- 'dart.fix.remove.duplicateCase', 50, 'Remove duplicate case statement');
- static const REMOVE_EMPTY_CATCH =
- FixKind('dart.fix.remove.emptyCatch', 50, 'Remove empty catch clause');
+ 'dart.fix.remove.duplicateCase', 50, 'Remove duplicate case statement',
+ // todo (pq): is this dangerous to bulk apply? Consider removing.
+ appliedTogetherMessage:
+ 'Remove duplicate case statements everywhere in file');
+ static const REMOVE_EMPTY_CATCH = FixKind(
+ 'dart.fix.remove.emptyCatch', 50, 'Remove empty catch clause',
+ appliedTogetherMessage: 'Remove empty catch clauses everywhere in file');
static const REMOVE_EMPTY_CONSTRUCTOR_BODY = FixKind(
'dart.fix.remove.emptyConstructorBody',
50,
- 'Remove empty constructor body');
- static const REMOVE_EMPTY_ELSE =
- FixKind('dart.fix.remove.emptyElse', 50, 'Remove empty else clause');
- static const REMOVE_EMPTY_STATEMENT =
- FixKind('dart.fix.remove.emptyStatement', 50, 'Remove empty statement');
- static const REMOVE_IF_NULL_OPERATOR =
- FixKind('dart.fix.remove.ifNullOperator', 50, "Remove the '??' operator");
- static const REMOVE_INITIALIZER =
- FixKind('dart.fix.remove.initializer', 50, 'Remove initializer');
+ 'Remove empty constructor body',
+ appliedTogetherMessage: 'Remove empty constructor bodies in file');
+ static const REMOVE_EMPTY_ELSE = FixKind(
+ 'dart.fix.remove.emptyElse', 50, 'Remove empty else clause',
+ appliedTogetherMessage: 'Remove empty else clauses everywhere in file');
+ static const REMOVE_EMPTY_STATEMENT = FixKind(
+ 'dart.fix.remove.emptyStatement', 50, 'Remove empty statement',
+ appliedTogetherMessage: 'Remove empty statements everywhere in file');
+ static const REMOVE_IF_NULL_OPERATOR = FixKind(
+ 'dart.fix.remove.ifNullOperator', 50, "Remove the '??' operator",
+ appliedTogetherMessage:
+ "Remove unnecessary '??' operators everywhere in file");
+ static const REMOVE_INITIALIZER = FixKind(
+ 'dart.fix.remove.initializer', 50, 'Remove initializer',
+ appliedTogetherMessage:
+ 'Remove unnecessary initializers everywhere in file');
static const REMOVE_INTERPOLATION_BRACES = FixKind(
'dart.fix.remove.interpolationBraces',
50,
- 'Remove unnecessary interpolation braces');
+ 'Remove unnecessary interpolation braces',
+ appliedTogetherMessage:
+ 'Remove unnecessary interpolation braces everywhere in file');
static const REMOVE_METHOD_DECLARATION = FixKind(
- 'dart.fix.remove.methodDeclaration', 50, 'Remove method declaration');
+ 'dart.fix.remove.methodDeclaration', 50, 'Remove method declaration',
+ // todo (pq): parameterize to make scope explicit
+ appliedTogetherMessage: 'Remove unnecessary method declarations in file');
static const REMOVE_NAME_FROM_COMBINATOR = FixKind(
'dart.fix.remove.nameFromCombinator', 50, "Remove name from '{0}'");
static const REMOVE_NON_NULL_ASSERTION =
FixKind('dart.fix.remove.nonNullAssertion', 50, "Remove the '!'");
- static const REMOVE_OPERATOR =
- FixKind('dart.fix.remove.operator', 50, 'Remove the operator');
+ static const REMOVE_OPERATOR = FixKind(
+ 'dart.fix.remove.operator', 50, 'Remove the operator',
+ appliedTogetherMessage: 'Remove operators in file');
static const REMOVE_PARAMETERS_IN_GETTER_DECLARATION = FixKind(
'dart.fix.remove.parametersInGetterDeclaration',
50,
@@ -387,10 +446,13 @@
'Remove parentheses in getter invocation');
static const REMOVE_QUESTION_MARK =
FixKind('dart.fix.remove.questionMark', 50, "Remove the '?'");
- static const REMOVE_THIS_EXPRESSION =
- FixKind('dart.fix.remove.thisExpression', 50, 'Remove this expression');
- static const REMOVE_TYPE_ANNOTATION =
- FixKind('dart.fix.remove.typeAnnotation', 50, 'Remove type annotation');
+ static const REMOVE_THIS_EXPRESSION = FixKind(
+ 'dart.fix.remove.thisExpression', 50, 'Remove this expression',
+ appliedTogetherMessage:
+ 'Remove unnecessary this expressions everywhere in file');
+ static const REMOVE_TYPE_ANNOTATION = FixKind(
+ 'dart.fix.remove.typeAnnotation', 50, 'Remove type annotation',
+ appliedTogetherMessage: 'Remove unnecessary type annotations in file');
static const REMOVE_TYPE_ARGUMENTS =
FixKind('dart.fix.remove.typeArguments', 49, 'Remove type arguments');
static const REMOVE_UNNECESSARY_CAST = FixKind(
@@ -399,9 +461,13 @@
static const REMOVE_UNNECESSARY_CONST = FixKind(
'dart.fix.remove.unnecessaryConst',
50,
- 'Remove unnecessary const keyword');
+ 'Remove unnecessary const keyword',
+ appliedTogetherMessage:
+ 'Remove unnecessary const keywords everywhere in file');
static const REMOVE_UNNECESSARY_NEW = FixKind(
- 'dart.fix.remove.unnecessaryNew', 50, 'Remove unnecessary new keyword');
+ 'dart.fix.remove.unnecessaryNew', 50, 'Remove unnecessary new keyword',
+ appliedTogetherMessage:
+ 'Remove unnecessary new keywords everywhere in file');
static const REMOVE_UNNECESSARY_PARENTHESES = FixKind(
'dart.fix.remove.unnecessaryParentheses',
50,
@@ -433,46 +499,63 @@
50,
'Remove unused local variable');
static const REMOVE_UNUSED_PARAMETER = FixKind(
- 'dart.fix.remove.unusedParameter', 50, 'Remove the unused parameter');
- static const RENAME_TO_CAMEL_CASE =
- FixKind('dart.fix.rename.toCamelCase', 50, "Rename to '{0}'");
+ 'dart.fix.remove.unusedParameter', 50, 'Remove the unused parameter',
+ appliedTogetherMessage: 'Remove unused parameters everywhere in file');
+ static const RENAME_TO_CAMEL_CASE = FixKind(
+ 'dart.fix.rename.toCamelCase', 50, "Rename to '{0}'",
+ appliedTogetherMessage: 'Rename to camel case everywhere in file');
static const REPLACE_BOOLEAN_WITH_BOOL = FixKind(
'dart.fix.replace.booleanWithBool', 50, "Replace 'boolean' with 'bool'",
appliedTogetherMessage: "Replace all 'boolean's with 'bool' in file");
- static const REPLACE_CASCADE_WITH_DOT =
- FixKind('dart.fix.replace.cascadeWithDot', 50, "Replace '..' with '.'");
- static const REPLACE_COLON_WITH_EQUALS =
- FixKind('dart.fix.replace.colonWithEquals', 50, "Replace ':' with '='");
+ static const REPLACE_CASCADE_WITH_DOT = FixKind(
+ 'dart.fix.replace.cascadeWithDot', 50, "Replace '..' with '.'",
+ appliedTogetherMessage:
+ "Replace unnecessary '..'s with '.'s everywhere in file");
+ static const REPLACE_COLON_WITH_EQUALS = FixKind(
+ 'dart.fix.replace.colonWithEquals', 50, "Replace ':' with '='",
+ appliedTogetherMessage: "Replace ':'s with '='s everywhere in file");
static const REPLACE_WITH_FILLED = FixKind(
'dart.fix.replace.finalWithListFilled', 50, "Replace with 'List.filled'");
static const REPLACE_FINAL_WITH_CONST = FixKind(
- 'dart.fix.replace.finalWithConst', 50, "Replace 'final' with 'const'");
+ 'dart.fix.replace.finalWithConst', 50, "Replace 'final' with 'const'",
+ appliedTogetherMessage:
+ "Replace 'final' with 'const' where possible in file");
static const REPLACE_NEW_WITH_CONST = FixKind(
'dart.fix.replace.newWithConst', 50, "Replace 'new' with 'const'");
static const REPLACE_NULL_WITH_CLOSURE = FixKind(
- 'dart.fix.replace.nullWithClosure', 50, "Replace 'null' with a closure");
+ 'dart.fix.replace.nullWithClosure', 50, "Replace 'null' with a closure",
+ appliedTogetherMessage:
+ "Replace 'null's with closures where possible in file");
static const REPLACE_RETURN_TYPE_FUTURE = FixKind(
'dart.fix.replace.returnTypeFuture',
50,
"Return 'Future' from 'async' function");
static const REPLACE_VAR_WITH_DYNAMIC = FixKind(
'dart.fix.replace.varWithDynamic', 50, "Replace 'var' with 'dynamic'");
- static const REPLACE_WITH_EIGHT_DIGIT_HEX =
- FixKind('dart.fix.replace.withEightDigitHex', 50, "Replace with '{0}'");
- static const REPLACE_WITH_BRACKETS =
- FixKind('dart.fix.replace.withBrackets', 50, 'Replace with { }');
+ static const REPLACE_WITH_EIGHT_DIGIT_HEX = FixKind(
+ 'dart.fix.replace.withEightDigitHex', 50, "Replace with '{0}'",
+ appliedTogetherMessage: 'Replace with hex digits everywhere in file');
+ static const REPLACE_WITH_BRACKETS = FixKind(
+ 'dart.fix.replace.withBrackets', 50, 'Replace with { }',
+ appliedTogetherMessage: 'Replace with { } everywhere in file');
static const REPLACE_WITH_CONDITIONAL_ASSIGNMENT = FixKind(
- 'dart.fix.replace.withConditionalAssignment', 50, 'Replace with ??=');
+ 'dart.fix.replace.withConditionalAssignment', 50, 'Replace with ??=',
+ appliedTogetherMessage: 'Replace with ??= everywhere in file');
static const REPLACE_WITH_EXTENSION_NAME =
FixKind('dart.fix.replace.withExtensionName', 50, "Replace with '{0}'");
- static const REPLACE_WITH_IDENTIFIER =
- FixKind('dart.fix.replace.withIdentifier', 50, 'Replace with identifier');
+ static const REPLACE_WITH_IDENTIFIER = FixKind(
+ 'dart.fix.replace.withIdentifier', 50, 'Replace with identifier',
+ // todo (pq): parameterize message (used by LintNames.avoid_types_on_closure_parameters)
+ appliedTogetherMessage: 'Replace with identifier everywhere in file');
static const REPLACE_WITH_INTERPOLATION = FixKind(
- 'dart.fix.replace.withInterpolation', 50, 'Replace with interpolation');
- static const REPLACE_WITH_IS_EMPTY =
- FixKind('dart.fix.replace.withIsEmpty', 50, "Replace with 'isEmpty'");
+ 'dart.fix.replace.withInterpolation', 50, 'Replace with interpolation',
+ appliedTogetherMessage: 'Replace with interpolations everywhere in file');
+ static const REPLACE_WITH_IS_EMPTY = FixKind(
+ 'dart.fix.replace.withIsEmpty', 50, "Replace with 'isEmpty'",
+ appliedTogetherMessage: "Replace with 'isEmpty' everywhere in file");
static const REPLACE_WITH_IS_NOT_EMPTY = FixKind(
- 'dart.fix.replace.withIsNotEmpty', 50, "Replace with 'isNotEmpty'");
+ 'dart.fix.replace.withIsNotEmpty', 50, "Replace with 'isNotEmpty'",
+ appliedTogetherMessage: "Replace with 'isNotEmpty' everywhere in file");
static const REPLACE_WITH_NOT_NULL_AWARE =
FixKind('dart.fix.replace.withNotNullAware', 50, "Replace with '{0}'");
static const REPLACE_WITH_NULL_AWARE = FixKind(
@@ -480,13 +563,19 @@
50,
"Replace the '.' with a '?.' in the invocation");
static const REPLACE_WITH_TEAR_OFF = FixKind('dart.fix.replace.withTearOff',
- 50, 'Replace function literal with tear-off');
+ 50, 'Replace function literal with tear-off',
+ appliedTogetherMessage:
+ 'Replace function literals with tear-offs everywhere in file');
static const REPLACE_WITH_VAR = FixKind(
- 'dart.fix.replace.withVar', 50, "Replace type annotation with 'var'");
+ 'dart.fix.replace.withVar', 50, "Replace type annotation with 'var'",
+ appliedTogetherMessage:
+ "Replace unnecessary type annotations with 'var' in file");
static const SORT_CHILD_PROPERTY_LAST = FixKind(
'dart.fix.sort.childPropertyLast',
50,
- 'Move child property to end of arguments');
+ 'Move child property to end of arguments',
+ appliedTogetherMessage:
+ 'Move child properties to ends of arguments everywhere in file');
static const UPDATE_SDK_CONSTRAINTS = FixKind(
'dart.fix.updateSdkConstraints', 50, 'Update the SDK constraints');
static const USE_CONST =
@@ -499,14 +588,18 @@
'dart.fix.use.eqEqNull', 50, "Use == null instead of 'is Null'",
appliedTogetherMessage:
"Use == null instead of 'is Null' everywhere in file");
- static const USE_IS_NOT_EMPTY = FixKind('dart.fix.use.isNotEmpty', 50,
- "Use x.isNotEmpty instead of '!x.isEmpty'");
+ static const USE_IS_NOT_EMPTY = FixKind(
+ 'dart.fix.use.isNotEmpty', 50, "Use x.isNotEmpty instead of '!x.isEmpty'",
+ appliedTogetherMessage:
+ "Use x.isNotEmpty instead of '!x.isEmpty' everywhere in file");
static const USE_NOT_EQ_NULL = FixKind(
'dart.fix.use.notEqNull', 50, "Use != null instead of 'is! Null'",
appliedTogetherMessage:
"Use != null instead of 'is! Null' everywhere in file");
- static const USE_RETHROW =
- FixKind('dart.fix.use.rethrow', 50, 'Replace throw with rethrow');
+ static const USE_RETHROW = FixKind(
+ 'dart.fix.use.rethrow', 50, 'Replace throw with rethrow',
+ appliedTogetherMessage:
+ 'Replace throw with rethrow where possible in file');
static const WRAP_IN_FUTURE =
FixKind('dart.fix.wrap.future', 50, "Wrap in 'Future.value'");
static const WRAP_IN_TEXT =
diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_set_manager.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_set_manager.dart
index 9841ec8..6a765b1 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_set_manager.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_set_manager.dart
@@ -59,7 +59,7 @@
var parser = TransformSetParser(
ErrorReporter(
AnalysisErrorListener.NULL_LISTENER, file.createSource()),
- file.parent.parent.shortName);
+ file.parent2.parent2.shortName);
return parser.parse(content);
} on FileSystemException {
// Fall through to return `null`.
diff --git a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
index 0c2b4ba..a04b49b 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
@@ -398,7 +398,8 @@
static const Map<String, List<FixInfo>> lintProducerMap2 = {
LintNames.always_declare_return_types: [
FixInfo(
- canBeAppliedToFile: true,
+ // todo (pq): enable when tested
+ canBeAppliedToFile: false,
// not currently supported; TODO(pq): consider adding
canBeBulkApplied: false,
generators: [
@@ -417,7 +418,8 @@
],
LintNames.always_specify_types: [
FixInfo(
- canBeAppliedToFile: true,
+ // todo (pq): enable when tested
+ canBeAppliedToFile: false,
// not currently supported; TODO(pq): consider adding
canBeBulkApplied: false,
generators: [
@@ -540,7 +542,8 @@
],
LintNames.avoid_unused_constructor_parameters: [
FixInfo(
- canBeAppliedToFile: true,
+ // todo (pq): enable when tested
+ canBeAppliedToFile: false,
canBeBulkApplied: false,
generators: [
RemoveUnusedParameter.newInstance,
@@ -734,7 +737,8 @@
],
LintNames.prefer_expression_function_bodies: [
FixInfo(
- canBeAppliedToFile: true,
+ // todo (pq): enable when tested
+ canBeAppliedToFile: false,
// not currently supported; TODO(pq): consider adding
canBeBulkApplied: false,
generators: [
@@ -844,7 +848,8 @@
],
LintNames.prefer_interpolation_to_compose_strings: [
FixInfo(
- canBeAppliedToFile: true,
+ // todo (pq): enable when tested
+ canBeAppliedToFile: false,
// not currently supported; TODO(pq): consider adding
canBeBulkApplied: false,
generators: [
@@ -927,7 +932,8 @@
],
LintNames.type_annotate_public_apis: [
FixInfo(
- canBeAppliedToFile: true,
+ // todo (pq): enable when tested
+ canBeAppliedToFile: false,
// not currently supported; TODO(pq): consider adding
canBeBulkApplied: false,
generators: [
@@ -1009,7 +1015,8 @@
],
LintNames.unnecessary_parenthesis: [
FixInfo(
- canBeAppliedToFile: true,
+ // todo (pq): enable when tested
+ canBeAppliedToFile: false,
// not currently supported; TODO(pq): consider adding
canBeBulkApplied: false,
generators: [
@@ -1037,7 +1044,8 @@
],
LintNames.use_full_hex_values_for_flutter_colors: [
FixInfo(
- canBeAppliedToFile: true,
+ // todo (pq): enable when tested
+ canBeAppliedToFile: false,
// not currently supported; TODO(pq): consider adding
canBeBulkApplied: false,
generators: [
diff --git a/pkg/analysis_server/lib/src/services/refactoring/extract_method.dart b/pkg/analysis_server/lib/src/services/refactoring/extract_method.dart
index 1201756..81e08f1 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/extract_method.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/extract_method.dart
@@ -762,7 +762,7 @@
} else if (_returnType == null) {
variableType = null;
if (_hasAwait) {
- var futureVoid = typeProvider.futureType2(typeProvider.voidType);
+ var futureVoid = typeProvider.futureType(typeProvider.voidType);
returnType = _getTypeCode(futureVoid);
} else {
returnType = 'void';
@@ -778,7 +778,7 @@
variableType = _getTypeCode(_returnType);
if (_hasAwait) {
if (_returnType.element != typeProvider.futureElement) {
- returnType = _getTypeCode(typeProvider.futureType2(_returnType));
+ returnType = _getTypeCode(typeProvider.futureType(_returnType));
}
} else {
returnType = variableType;
diff --git a/pkg/analysis_server/test/abstract_context.dart b/pkg/analysis_server/test/abstract_context.dart
index f6cf3a5..2fa703a1f 100644
--- a/pkg/analysis_server/test/abstract_context.dart
+++ b/pkg/analysis_server/test/abstract_context.dart
@@ -236,23 +236,23 @@
if (meta || flutter) {
var libFolder = MockPackages.instance.addMeta(resourceProvider);
- config.add(name: 'meta', rootPath: libFolder.parent.path);
+ config.add(name: 'meta', rootPath: libFolder.parent2.path);
}
if (flutter) {
{
var libFolder = MockPackages.instance.addUI(resourceProvider);
- config.add(name: 'ui', rootPath: libFolder.parent.path);
+ config.add(name: 'ui', rootPath: libFolder.parent2.path);
}
{
var libFolder = MockPackages.instance.addFlutter(resourceProvider);
- config.add(name: 'flutter', rootPath: libFolder.parent.path);
+ config.add(name: 'flutter', rootPath: libFolder.parent2.path);
}
}
if (vector_math) {
var libFolder = MockPackages.instance.addVectorMath(resourceProvider);
- config.add(name: 'vector_math', rootPath: libFolder.parent.path);
+ config.add(name: 'vector_math', rootPath: libFolder.parent2.path);
}
var path = '$testPackageRootPath/.dart_tool/package_config.json';
diff --git a/pkg/analysis_server/test/context_manager_test.dart b/pkg/analysis_server/test/context_manager_test.dart
index 73c0cf4..186c249 100644
--- a/pkg/analysis_server/test/context_manager_test.dart
+++ b/pkg/analysis_server/test/context_manager_test.dart
@@ -1274,7 +1274,7 @@
var filePath = join(projPath, 'foo.dart');
// add root with a file
var file = newFile(filePath, content: 'contents');
- var projFolder = file.parent;
+ var projFolder = file.parent2;
manager.setRoots(<String>[projPath], <String>[]);
// the file was added
var filePaths = callbacks.currentFilePaths;
@@ -1295,7 +1295,7 @@
var filePath = join(projPath, 'foo.dart');
// add root with a file
var file = newFile(filePath, content: 'contents');
- var projFolder = file.parent;
+ var projFolder = file.parent2;
manager.setRoots(<String>[projPath], <String>[]);
// the file was added
var filePaths = callbacks.currentFilePaths;
diff --git a/pkg/analysis_server/test/lsp/code_actions_fixes_test.dart b/pkg/analysis_server/test/lsp/code_actions_fixes_test.dart
index 0996e9d..a0c3f5b 100644
--- a/pkg/analysis_server/test/lsp/code_actions_fixes_test.dart
+++ b/pkg/analysis_server/test/lsp/code_actions_fixes_test.dart
@@ -239,6 +239,8 @@
@override
String get testPackageLanguageVersion => latestLanguageVersion;
+ /// todo (pq): prefer_is_empty newly produces fix-all-fixes; update this test appropriately
+ @failingTest
Future<void> test_fixAll_notForAmbigiousProducers() async {
// The ReplaceWithIsEmpty producer does not provide a FixKind up-front, as
// it may produce `REPLACE_WITH_IS_EMPTY` or `REPLACE_WITH_IS_NOT_EMPTY`
diff --git a/pkg/analysis_server/test/lsp/server_abstract.dart b/pkg/analysis_server/test/lsp/server_abstract.dart
index dc653fe..ce6fb8b 100644
--- a/pkg/analysis_server/test/lsp/server_abstract.dart
+++ b/pkg/analysis_server/test/lsp/server_abstract.dart
@@ -460,28 +460,28 @@
if (meta || flutter) {
var libFolder = MockPackages.instance.addMeta(resourceProvider);
- config.add(name: 'meta', rootPath: libFolder.parent.path);
+ config.add(name: 'meta', rootPath: libFolder.parent2.path);
}
if (flutter) {
{
var libFolder = MockPackages.instance.addUI(resourceProvider);
- config.add(name: 'ui', rootPath: libFolder.parent.path);
+ config.add(name: 'ui', rootPath: libFolder.parent2.path);
}
{
var libFolder = MockPackages.instance.addFlutter(resourceProvider);
- config.add(name: 'flutter', rootPath: libFolder.parent.path);
+ config.add(name: 'flutter', rootPath: libFolder.parent2.path);
}
}
if (pedantic) {
var libFolder = MockPackages.instance.addPedantic(resourceProvider);
- config.add(name: 'pedantic', rootPath: libFolder.parent.path);
+ config.add(name: 'pedantic', rootPath: libFolder.parent2.path);
}
if (vector_math) {
var libFolder = MockPackages.instance.addVectorMath(resourceProvider);
- config.add(name: 'vector_math', rootPath: libFolder.parent.path);
+ config.add(name: 'vector_math', rootPath: libFolder.parent2.path);
}
var path = '$projectFolderPath/.dart_tool/package_config.json';
diff --git a/pkg/analysis_server/test/src/domains/flutter/base.dart b/pkg/analysis_server/test/src/domains/flutter/base.dart
index 168bacb..cab39fd 100644
--- a/pkg/analysis_server/test/src/domains/flutter/base.dart
+++ b/pkg/analysis_server/test/src/domains/flutter/base.dart
@@ -57,12 +57,12 @@
void _addFlutterPackage() {
_addMetaPackage();
var libFolder = MockPackages.instance.addFlutter(resourceProvider);
- _addPackageDependency('flutter', libFolder.parent.path);
+ _addPackageDependency('flutter', libFolder.parent2.path);
}
void _addMetaPackage() {
var libFolder = MockPackages.instance.addMeta(resourceProvider);
- _addPackageDependency('meta', libFolder.parent.path);
+ _addPackageDependency('meta', libFolder.parent2.path);
}
void _addPackageDependency(String name, String rootPath) {
diff --git a/pkg/analysis_server/test/src/services/correction/fix/fix_in_file_test.dart b/pkg/analysis_server/test/src/services/correction/fix/fix_in_file_test.dart
index b25ccc5..14e8d76 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/fix_in_file_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/fix_in_file_test.dart
@@ -2,6 +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:analysis_server/src/services/correction/fix_internal.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -12,6 +13,8 @@
// defineReflectiveTests(MultiFixInFileTest);
defineReflectiveTests(SingleFixInFileTest);
});
+
+ VerificationTests.defineTests();
}
//// todo (pq): update w/ a FixKind that we're sure we want to support as a file fix
@@ -82,4 +85,67 @@
}
}
+@reflectiveTest
+class VerificationTest extends FixInFileProcessorTest {
+ Future<void> test_fixInFileTestsHaveApplyTogetherMessages() async {
+ for (var fixInfos in FixProcessor.lintProducerMap2.values) {
+ for (var fixInfo in fixInfos) {
+ if (fixInfo.canBeBulkApplied) {
+ for (var generator in fixInfo.generators) {
+ test('', () {
+ expect(generator().fixKind.canBeAppliedTogether(), isTrue);
+ });
+ }
+ }
+ }
+ }
+ }
+}
+
+class VerificationTests {
+ static void defineTests() {
+ verify_fixInFileFixesHaveBulkFixTests();
+ verify_fixInFileFixKindsHaveApplyTogetherMessages();
+ }
+
+ static void verify_fixInFileFixesHaveBulkFixTests() {
+ group('VerificationTests | fixInFileFixesHaveBulkFixTests |', () {
+ for (var fixEntry in FixProcessor.lintProducerMap2.entries) {
+ var errorCode = fixEntry.key;
+ for (var fixInfo in fixEntry.value) {
+ if (fixInfo.canBeAppliedToFile) {
+ test(errorCode, () {
+ expect(fixInfo.canBeBulkApplied, isTrue);
+ });
+ }
+ }
+ }
+ });
+ }
+
+ static void verify_fixInFileFixKindsHaveApplyTogetherMessages() {
+ group('VerificationTests | fixInFileFixKindsHaveApplyTogetherMessages |',
+ () {
+ for (var fixEntry in FixProcessor.lintProducerMap2.entries) {
+ var errorCode = fixEntry.key;
+ for (var fixInfo in fixEntry.value) {
+ if (fixInfo.canBeAppliedToFile) {
+ var generators = fixInfo.generators;
+ for (var i = 0; i < generators.length; ++i) {
+ var generator = generators[i];
+ var fixKind = generator().fixKind;
+ // Cases where fix kinds are determined by context are not verified here.
+ if (fixKind != null) {
+ test('$errorCode | generator ($i) | ${fixKind.id}', () {
+ expect(fixKind.canBeAppliedTogether(), isTrue);
+ });
+ }
+ }
+ }
+ }
+ }
+ });
+ }
+}
+
/// todo (pq): add negative tests
diff --git a/pkg/analysis_server/test/src/services/correction/fix/fix_processor.dart b/pkg/analysis_server/test/src/services/correction/fix/fix_processor.dart
index 1fd5da2..bcc8d35 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/fix_processor.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/fix_processor.dart
@@ -198,14 +198,16 @@
int length,
String target,
int expectedNumberOfFixesForKind,
- String matchFixMessage}) async {
+ String matchFixMessage,
+ bool allowFixAllFixes = false}) async {
if (useLineEndingsForPlatform) {
expected = normalizeNewlinesForPlatform(expected);
}
var error = await _findErrorToFix(errorFilter, length: length);
var fix = await _assertHasFix(error,
expectedNumberOfFixesForKind: expectedNumberOfFixesForKind,
- matchFixMessage: matchFixMessage);
+ matchFixMessage: matchFixMessage,
+ allowFixAllFixes: allowFixAllFixes);
change = fix.change;
// apply to "file"
@@ -295,7 +297,9 @@
/// Optionally, if a [matchFixMessage] is passed, then the kind as well as the fix message must
/// match to be returned.
Future<Fix> _assertHasFix(AnalysisError error,
- {int expectedNumberOfFixesForKind, String matchFixMessage}) async {
+ {int expectedNumberOfFixesForKind,
+ String matchFixMessage,
+ bool allowFixAllFixes = false}) async {
// Compute the fixes for this AnalysisError
var fixes = await _computeFixes(error);
@@ -331,7 +335,7 @@
// Assert that none of the fixes are a fix-all fix.
Fix foundFix;
for (var fix in fixes) {
- if (fix.isFixAllFix()) {
+ if (!allowFixAllFixes && fix.isFixAllFix()) {
fail('A fix-all fix was found for the error: $error '
'in the computed set of fixes:\n${fixes.join('\n')}');
} else if (fix.kind == kind) {
diff --git a/pkg/analysis_server/test/src/services/correction/fix/remove_unused_parameter_test.dart b/pkg/analysis_server/test/src/services/correction/fix/remove_unused_parameter_test.dart
index fc174a5..d32eb88 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/remove_unused_parameter_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/remove_unused_parameter_test.dart
@@ -63,7 +63,9 @@
class C {
C(int b = 1,);
}
-''', errorFilter: (e) => e.offset == testCode.indexOf('int a'));
+''',
+ errorFilter: (e) => e.offset == testCode.indexOf('int a'),
+ allowFixAllFixes: true);
}
Future<void> test_first_requiredPositional_second_optionalNamed() async {
diff --git a/pkg/analyzer/CHANGELOG.md b/pkg/analyzer/CHANGELOG.md
index 875fc6a..9a7f74d 100644
--- a/pkg/analyzer/CHANGELOG.md
+++ b/pkg/analyzer/CHANGELOG.md
@@ -1,3 +1,11 @@
+## 1.1.0-dev
+* Deprecated `TypeProvider.futureType2()`, `iterableType2()`, etc.
+ Use corresponding `TypeProvider.futureType()`, `iterableType()`, etc.
+* Remove experimental markers from Null Safety APIs.
+* Added `Resource.parent2` and deprecated `Resource.parent`.
+* Added `Folder.isRoot`.
+* Added `FolderExtension` with `withAncestors`.
+
## 1.0.0
* Stable null safety release.
* Updated dependencies to null safe releases.
diff --git a/pkg/analyzer/lib/dart/element/element.dart b/pkg/analyzer/lib/dart/element/element.dart
index 7de7f78..336473b 100644
--- a/pkg/analyzer/lib/dart/element/element.dart
+++ b/pkg/analyzer/lib/dart/element/element.dart
@@ -50,7 +50,6 @@
import 'package:analyzer/src/generated/source.dart';
import 'package:analyzer/src/generated/utilities_dart.dart';
import 'package:analyzer/src/task/api/model.dart' show AnalysisTarget;
-import 'package:meta/meta.dart';
import 'package:pub_semver/pub_semver.dart';
/// An element that represents a class or a mixin. The class can be defined by
@@ -1857,7 +1856,6 @@
///
/// This will always return `false` unless the experiment 'non-nullable' is
/// enabled.
- @experimental
bool get isLate;
/// Return `true` if this element is a static variable, as per section 8 of
diff --git a/pkg/analyzer/lib/dart/element/type_provider.dart b/pkg/analyzer/lib/dart/element/type_provider.dart
index 17b4101..75bcf74 100644
--- a/pkg/analyzer/lib/dart/element/type_provider.dart
+++ b/pkg/analyzer/lib/dart/element/type_provider.dart
@@ -127,40 +127,76 @@
/// Return the instantiation of the built-in class `FutureOr` with the
/// given [valueType]. The type has the nullability suffix of this provider.
+ InterfaceType futureOrType(DartType valueType);
+
+ /// Return the instantiation of the built-in class `FutureOr` with the
+ /// given [valueType]. The type has the nullability suffix of this provider.
+ @Deprecated('Use futureOrType instead')
InterfaceType futureOrType2(DartType valueType);
/// Return the instantiation of the built-in class `Future` with the
/// given [valueType]. The type has the nullability suffix of this provider.
+ InterfaceType futureType(DartType valueType);
+
+ /// Return the instantiation of the built-in class `Future` with the
+ /// given [valueType]. The type has the nullability suffix of this provider.
+ @Deprecated('Use futureType instead')
InterfaceType futureType2(DartType valueType);
- /// Return 'true' if [id] is the name of a getter on the Object type.
+ /// Return 'true' if [id] is the name of a getter on the `Object` type.
bool isObjectGetter(String id);
- /// Return 'true' if [id] is the name of a method or getter on the Object
+ /// Return 'true' if [id] is the name of a method or getter on the `Object`
/// type.
bool isObjectMember(String id);
- /// Return 'true' if [id] is the name of a method on the Object type.
+ /// Return 'true' if [id] is the name of a method on the `Object` type.
bool isObjectMethod(String id);
/// Return the instantiation of the built-in class `Iterable` with the
/// given [elementType]. The type has the nullability suffix of this provider.
+ InterfaceType iterableType(DartType elementType);
+
+ /// Return the instantiation of the built-in class `Iterable` with the
+ /// given [elementType]. The type has the nullability suffix of this provider.
+ @Deprecated('Use iterableType instead')
InterfaceType iterableType2(DartType elementType);
/// Return the instantiation of the built-in class `List` with the
/// given [elementType]. The type has the nullability suffix of this provider.
+ InterfaceType listType(DartType elementType);
+
+ /// Return the instantiation of the built-in class `List` with the
+ /// given [elementType]. The type has the nullability suffix of this provider.
+ @Deprecated('Use listType instead')
InterfaceType listType2(DartType elementType);
/// Return the instantiation of the built-in class `List` with the
/// given [keyType] and [valueType]. The type has the nullability suffix of
/// this provider.
+ InterfaceType mapType(DartType keyType, DartType valueType);
+
+ /// Return the instantiation of the built-in class `List` with the
+ /// given [keyType] and [valueType]. The type has the nullability suffix of
+ /// this provider.
+ @Deprecated('Use mapType instead')
InterfaceType mapType2(DartType keyType, DartType valueType);
/// Return the instantiation of the built-in class `Set` with the
/// given [elementType]. The type has the nullability suffix of this provider.
+ InterfaceType setType(DartType elementType);
+
+ /// Return the instantiation of the built-in class `Set` with the
+ /// given [elementType]. The type has the nullability suffix of this provider.
+ @Deprecated('Use setType instead')
InterfaceType setType2(DartType elementType);
/// Return the instantiation of the built-in class `Stream` with the
/// given [elementType]. The type has the nullability suffix of this provider.
+ InterfaceType streamType(DartType elementType);
+
+ /// Return the instantiation of the built-in class `Stream` with the
+ /// given [elementType]. The type has the nullability suffix of this provider.
+ @Deprecated('Use streamType instead')
InterfaceType streamType2(DartType elementType);
}
diff --git a/pkg/analyzer/lib/dart/element/type_system.dart b/pkg/analyzer/lib/dart/element/type_system.dart
index e8c7158..09352ca 100644
--- a/pkg/analyzer/lib/dart/element/type_system.dart
+++ b/pkg/analyzer/lib/dart/element/type_system.dart
@@ -5,7 +5,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:meta/meta.dart';
/// A representation of the operations defined for the type system.
///
@@ -77,7 +76,6 @@
///
/// The result of this method is undefined when the experiment 'non-nullable'
/// is not enabled.
- @experimental
bool isNonNullable(DartType type);
/// Return `true` if the [type] is a nullable type.
@@ -92,7 +90,6 @@
///
/// The result of this method is undefined when the experiment 'non-nullable'
/// is not enabled.
- @experimental
bool isNullable(DartType type);
/// Return `true` if the [type] is a potentially non-nullable type.
@@ -104,7 +101,6 @@
///
/// The result of this method is undefined when the experiment 'non-nullable'
/// is not enabled.
- @experimental
bool isPotentiallyNonNullable(DartType type);
/// Return `true` if the [type] is a potentially nullable type.
@@ -116,7 +112,6 @@
///
/// The result of this method is undefined when the experiment 'non-nullable'
/// is not enabled.
- @experimental
bool isPotentiallyNullable(DartType type);
/// Return `true` if the [type] is a strictly non-nullable type.
@@ -133,7 +128,6 @@
///
/// The result of this method is undefined when the experiment 'non-nullable'
/// is not enabled.
- @experimental
bool isStrictlyNonNullable(DartType type);
/// Return `true` if the [leftType] is a subtype of the [rightType].
diff --git a/pkg/analyzer/lib/dart/sdk/build_sdk_summary.dart b/pkg/analyzer/lib/dart/sdk/build_sdk_summary.dart
index c3c27aa..486a073 100644
--- a/pkg/analyzer/lib/dart/sdk/build_sdk_summary.dart
+++ b/pkg/analyzer/lib/dart/sdk/build_sdk_summary.dart
@@ -46,7 +46,7 @@
var map = loadYaml(content) as YamlMap;
var embedderSdk = EmbedderSdk(
resourceProvider,
- {file.parent!: map},
+ {file.parent2: map},
languageVersion: sdk.languageVersion,
);
for (var library in embedderSdk.sdkLibraries) {
diff --git a/pkg/analyzer/lib/error/error.dart b/pkg/analyzer/lib/error/error.dart
index 9d84c71..54cd975 100644
--- a/pkg/analyzer/lib/error/error.dart
+++ b/pkg/analyzer/lib/error/error.dart
@@ -459,7 +459,6 @@
CompileTimeErrorCode.YIELD_OF_INVALID_TYPE,
FfiCode.ANNOTATION_ON_POINTER_FIELD,
FfiCode.EMPTY_STRUCT,
- FfiCode.EMPTY_STRUCT_WARNING,
FfiCode.EXTRA_ANNOTATION_ON_STRUCT_FIELD,
FfiCode.EXTRA_SIZE_ANNOTATION_CARRAY,
FfiCode.FIELD_IN_STRUCT_WITH_INITIALIZER,
diff --git a/pkg/analyzer/lib/file_system/file_system.dart b/pkg/analyzer/lib/file_system/file_system.dart
index f68ca16..b8a27f6 100644
--- a/pkg/analyzer/lib/file_system/file_system.dart
+++ b/pkg/analyzer/lib/file_system/file_system.dart
@@ -75,6 +75,9 @@
/// folders, including folders reachable via links).
Stream<WatchEvent> get changes;
+ /// Return `true` if this folder is a file system root.
+ bool get isRoot;
+
/// If the path [path] is a relative path, convert it to an absolute path
/// by interpreting it relative to this folder. If it is already an absolute
/// path, then don't change it.
@@ -124,8 +127,13 @@
/// Return the [Folder] that contains this resource, or `null` if this
/// resource is a root folder.
+ @Deprecated('Use parent2 instead')
Folder? get parent;
+ /// Return the [Folder] that contains this resource, possibly itself if this
+ /// resource is a root folder.
+ Folder get parent2;
+
/// Return the full path to this resource.
String get path;
@@ -205,3 +213,17 @@
/// folder names.
Folder? getStateLocation(String pluginId);
}
+
+extension FolderExtension on Folder {
+ /// Return this folder and all its ancestors.
+ Iterable<Folder> get withAncestors sync* {
+ var current = this;
+ while (true) {
+ yield current;
+ if (current.isRoot) {
+ break;
+ }
+ current = current.parent2;
+ }
+ }
+}
diff --git a/pkg/analyzer/lib/file_system/memory_file_system.dart b/pkg/analyzer/lib/file_system/memory_file_system.dart
index 38f3a43..e18d6aa 100644
--- a/pkg/analyzer/lib/file_system/memory_file_system.dart
+++ b/pkg/analyzer/lib/file_system/memory_file_system.dart
@@ -513,6 +513,12 @@
bool get exists => provider._pathToResource[path] is _MemoryFolder;
@override
+ bool get isRoot {
+ var parentPath = provider.pathContext.dirname(path);
+ return parentPath == path;
+ }
+
+ @override
String canonicalizePath(String relPath) {
relPath = provider.pathContext.normalize(relPath);
String childPath = provider.pathContext.join(path, relPath);
@@ -633,6 +639,7 @@
@override
int get hashCode => path.hashCode;
+ @Deprecated('Use parent2 instead')
@override
Folder? get parent {
String parentPath = provider.pathContext.dirname(path);
@@ -643,6 +650,12 @@
}
@override
+ Folder get parent2 {
+ String parentPath = provider.pathContext.dirname(path);
+ return provider.getFolder(parentPath);
+ }
+
+ @override
String get shortName => provider.pathContext.basename(path);
@override
diff --git a/pkg/analyzer/lib/file_system/overlay_file_system.dart b/pkg/analyzer/lib/file_system/overlay_file_system.dart
index 3e09dc3..dfe0af7 100644
--- a/pkg/analyzer/lib/file_system/overlay_file_system.dart
+++ b/pkg/analyzer/lib/file_system/overlay_file_system.dart
@@ -249,6 +249,12 @@
@override
bool get exists => provider._hasOverlayIn(path) || _resource.exists;
+ @override
+ bool get isRoot {
+ var parentPath = provider.pathContext.dirname(path);
+ return parentPath == path;
+ }
+
/// Return the folder from the base resource provider that corresponds to this
/// folder.
Folder get _folder => _resource as Folder;
@@ -348,6 +354,7 @@
@override
int get hashCode => path.hashCode;
+ @Deprecated('Use parent2 instead')
@override
Folder? get parent {
Folder? parent = _resource.parent;
@@ -358,6 +365,12 @@
}
@override
+ Folder get parent2 {
+ var parent = _resource.parent2;
+ return _OverlayFolder(provider, parent);
+ }
+
+ @override
String get path => _resource.path;
@override
diff --git a/pkg/analyzer/lib/file_system/physical_file_system.dart b/pkg/analyzer/lib/file_system/physical_file_system.dart
index 4483f48c..909e8f6 100644
--- a/pkg/analyzer/lib/file_system/physical_file_system.dart
+++ b/pkg/analyzer/lib/file_system/physical_file_system.dart
@@ -239,6 +239,12 @@
!error.message
.startsWith("Directory watcher closed unexpectedly"));
+ @override
+ bool get isRoot {
+ var parentPath = provider.pathContext.dirname(path);
+ return parentPath == path;
+ }
+
/// Return the underlying file being represented by this wrapper.
io.Directory get _directory => _entry as io.Directory;
@@ -349,6 +355,7 @@
@override
int get hashCode => path.hashCode;
+ @Deprecated('Use parent2 instead')
@override
Folder? get parent {
String parentPath = pathContext.dirname(path);
@@ -359,6 +366,12 @@
}
@override
+ Folder get parent2 {
+ String parentPath = pathContext.dirname(path);
+ return _PhysicalFolder(io.Directory(parentPath));
+ }
+
+ @override
String get path => _entry.path;
/// Return the path context used by this resource provider.
diff --git a/pkg/analyzer/lib/src/analysis_options/analysis_options_provider.dart b/pkg/analyzer/lib/src/analysis_options/analysis_options_provider.dart
index 0609ec6..9e9cb06 100644
--- a/pkg/analyzer/lib/src/analysis_options/analysis_options_provider.dart
+++ b/pkg/analyzer/lib/src/analysis_options/analysis_options_provider.dart
@@ -40,17 +40,13 @@
/// The given [root] directory will be searched first. If no file is found ,
/// then enclosing directories will be searched.
File? getOptionsFile(Folder root) {
- Resource? resource;
- for (Folder? folder = root; folder != null; folder = folder.parent) {
- resource = folder.getChild(AnalysisEngine.ANALYSIS_OPTIONS_YAML_FILE);
- if (resource.exists) {
- break;
+ for (var current in root.withAncestors) {
+ var name = AnalysisEngine.ANALYSIS_OPTIONS_YAML_FILE;
+ var file = current.getChildAssumingFile(name);
+ if (file.exists) {
+ return file;
}
}
- if (resource is File && resource.exists) {
- return resource;
- }
- return null;
}
/// Provide the options found in [file].
diff --git a/pkg/analyzer/lib/src/context/builder.dart b/pkg/analyzer/lib/src/context/builder.dart
index 6d79372..d879615 100644
--- a/pkg/analyzer/lib/src/context/builder.dart
+++ b/pkg/analyzer/lib/src/context/builder.dart
@@ -267,7 +267,7 @@
);
if (embedderYamlSource != null) {
var embedderYamlPath = embedderYamlSource.fullName;
- var libFolder = resourceProvider.getFile(embedderYamlPath).parent!;
+ var libFolder = resourceProvider.getFile(embedderYamlPath).parent2;
EmbedderYamlLocator locator =
EmbedderYamlLocator.forLibFolder(libFolder);
Map<Folder, YamlMap> embedderMap = locator.embedderYamls;
@@ -381,31 +381,27 @@
return resourceProvider.getFile(filePath);
}
}
- Folder root = resourceProvider.getFolder(path);
- for (Folder? folder = root; folder != null; folder = folder.parent) {
- File file = folder
- .getChildAssumingFile(AnalysisEngine.ANALYSIS_OPTIONS_YAML_FILE);
+
+ var folder = resourceProvider.getFolder(path);
+ for (var current in folder.withAncestors) {
+ var name = AnalysisEngine.ANALYSIS_OPTIONS_YAML_FILE;
+ var file = current.getChildAssumingFile(name);
if (file.exists) {
return file;
}
}
- return null;
}
/// Return the `pubspec.yaml` file that should be used when analyzing code in
/// the directory with the given [path], possibly `null`.
File? _findPubspecFile(String path) {
- Resource? resource = resourceProvider.getResource(path);
- while (resource != null) {
- if (resource is Folder) {
- File pubspecFile = resource.getChildAssumingFile('pubspec.yaml');
- if (pubspecFile.exists) {
- return pubspecFile;
- }
+ var folder = resourceProvider.getFolder(path);
+ for (var current in folder.withAncestors) {
+ var file = current.getChildAssumingFile('pubspec.yaml');
+ if (file.exists) {
+ return file;
}
- resource = resource.parent;
}
- return null;
}
/// Return [Packages] to analyze a resource with the [rootPath].
@@ -463,15 +459,10 @@
/// directory contains a `.packages` file.
static bool _hasPackageFileInPath(
ResourceProvider resourceProvider, String rootPath) {
- Folder? folder = resourceProvider.getFolder(rootPath);
- while (folder != null) {
- File file = folder.getChildAssumingFile('.packages');
- if (file.exists) {
- return true;
- }
- folder = folder.parent;
- }
- return false;
+ var folder = resourceProvider.getFolder(rootPath);
+ return folder.withAncestors.any((current) {
+ return current.getChildAssumingFile('.packages').exists;
+ });
}
}
diff --git a/pkg/analyzer/lib/src/context/packages.dart b/pkg/analyzer/lib/src/context/packages.dart
index fd7c7e5..94b1686 100644
--- a/pkg/analyzer/lib/src/context/packages.dart
+++ b/pkg/analyzer/lib/src/context/packages.dart
@@ -15,27 +15,26 @@
/// Looks for `.dart_tool/package_config.json` or `.packages` in the given
/// and parent directories.
Packages findPackagesFrom(ResourceProvider provider, Resource start) {
- for (Resource? current = start; current != null; current = current.parent) {
- if (current is Folder) {
- try {
- var jsonFile = current
- .getChildAssumingFolder('.dart_tool')
- .getChildAssumingFile('package_config.json');
- if (jsonFile.exists) {
- return parsePackageConfigJsonFile(provider, jsonFile);
- }
- } catch (e) {
- return Packages.empty;
+ var startFolder = start is Folder ? start : start.parent2;
+ for (var current in startFolder.withAncestors) {
+ try {
+ var jsonFile = current
+ .getChildAssumingFolder('.dart_tool')
+ .getChildAssumingFile('package_config.json');
+ if (jsonFile.exists) {
+ return parsePackageConfigJsonFile(provider, jsonFile);
}
+ } catch (e) {
+ return Packages.empty;
+ }
- try {
- var dotFile = current.getChildAssumingFile('.packages');
- if (dotFile.exists) {
- return parseDotPackagesFile(provider, dotFile);
- }
- } catch (e) {
- return Packages.empty;
+ try {
+ var dotFile = current.getChildAssumingFile('.packages');
+ if (dotFile.exists) {
+ return parseDotPackagesFile(provider, dotFile);
}
+ } catch (e) {
+ return Packages.empty;
}
}
return Packages.empty;
@@ -129,7 +128,7 @@
if (isJson) {
return parsePackageConfigJsonFile(provider, file);
} else {
- var relativePackageConfigFile = file.parent!
+ var relativePackageConfigFile = file.parent2
.getChildAssumingFolder('.dart_tool')
.getChildAssumingFile('package_config.json');
if (relativePackageConfigFile.exists) {
diff --git a/pkg/analyzer/lib/src/dart/analysis/context_locator.dart b/pkg/analyzer/lib/src/dart/analysis/context_locator.dart
index 24bd476..0f9f928 100644
--- a/pkg/analyzer/lib/src/dart/analysis/context_locator.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/context_locator.dart
@@ -106,7 +106,7 @@
}
Map<Folder, ContextRoot> rootMap = <Folder, ContextRoot>{};
for (File file in includedFiles) {
- Folder parent = file.parent!;
+ Folder parent = file.parent2;
ContextRoot root = rootMap.putIfAbsent(parent, () {
ContextRootImpl root = ContextRootImpl(resourceProvider, parent);
root.packagesFile = defaultPackagesFile ?? _findPackagesFile(parent);
@@ -232,29 +232,25 @@
/// Return the analysis options file to be used to analyze files in the given
/// [folder], or `null` if there is no analysis options file in the given
/// folder or any parent folder.
- File? _findOptionsFile(Folder? folder) {
- for (Folder? current = folder; current != null;) {
- File? optionsFile = _getOptionsFile(current);
- if (optionsFile != null) {
- return optionsFile;
+ File? _findOptionsFile(Folder folder) {
+ for (var current in folder.withAncestors) {
+ var file = _getOptionsFile(current);
+ if (file != null) {
+ return file;
}
- current = current.parent;
}
- return null;
}
/// Return the packages file to be used to analyze files in the given
/// [folder], or `null` if there is no packages file in the given folder or
/// any parent folder.
File? _findPackagesFile(Folder folder) {
- for (Folder? current = folder; current != null;) {
- File? packagesFile = _getPackagesFile(current);
- if (packagesFile != null) {
- return packagesFile;
+ for (var current in folder.withAncestors) {
+ var file = _getPackagesFile(current);
+ if (file != null) {
+ return file;
}
- current = current.parent;
}
- return null;
}
/// Return a list containing the glob patterns used to exclude files from the
@@ -281,7 +277,7 @@
Context context = resourceProvider.pathContext;
if (context.isRelative(excludedPath)) {
excludedPath = posix.joinAll([
- ...context.split(optionsFile.parent!.path),
+ ...context.split(optionsFile.parent2.path),
...posix.split(excludedPath),
]);
}
@@ -302,11 +298,8 @@
/// If the given [directory] contains a file with the given [name], then
/// return the file. Otherwise, return `null`.
File? _getFile(Folder directory, String name) {
- Resource resource = directory.getChild(name);
- if (resource is File && resource.exists) {
- return resource;
- }
- return null;
+ var file = directory.getChildAssumingFile(name);
+ return file.exists ? file : null;
}
/// Return the analysis options file in the given [folder], or `null` if the
diff --git a/pkg/analyzer/lib/src/dart/constant/evaluation.dart b/pkg/analyzer/lib/src/dart/constant/evaluation.dart
index 73b1748..ce9b3b7 100644
--- a/pkg/analyzer/lib/src/dart/constant/evaluation.dart
+++ b/pkg/analyzer/lib/src/dart/constant/evaluation.dart
@@ -1160,7 +1160,7 @@
nodeType is InterfaceType && nodeType.typeArguments.isNotEmpty
? nodeType.typeArguments[0]
: _typeProvider.dynamicType;
- InterfaceType listType = _typeProvider.listType2(elementType);
+ InterfaceType listType = _typeProvider.listType(elementType);
return DartObjectImpl(typeSystem, listType, ListState(list));
}
@@ -1301,7 +1301,7 @@
valueType = typeArguments[1];
}
}
- InterfaceType mapType = _typeProvider.mapType2(keyType, valueType);
+ InterfaceType mapType = _typeProvider.mapType(keyType, valueType);
return DartObjectImpl(typeSystem, mapType, MapState(map));
} else {
if (!node.isConst) {
@@ -1322,7 +1322,7 @@
nodeType is InterfaceType && nodeType.typeArguments.isNotEmpty
? nodeType.typeArguments[0]
: _typeProvider.dynamicType;
- InterfaceType setType = _typeProvider.setType2(elementType);
+ InterfaceType setType = _typeProvider.setType(elementType);
return DartObjectImpl(typeSystem, setType, SetState(set));
}
}
diff --git a/pkg/analyzer/lib/src/dart/element/element.dart b/pkg/analyzer/lib/src/dart/element/element.dart
index 2233c50..f8ef12c 100644
--- a/pkg/analyzer/lib/src/dart/element/element.dart
+++ b/pkg/analyzer/lib/src/dart/element/element.dart
@@ -1781,7 +1781,7 @@
@override
InterfaceType get typeInternal {
if (_type == null) {
- return _type = library.typeProvider.listType2(_enum.thisType);
+ return _type = library.typeProvider.listType(_enum.thisType);
}
return _type as InterfaceType;
}
diff --git a/pkg/analyzer/lib/src/dart/element/generic_inferrer.dart b/pkg/analyzer/lib/src/dart/element/generic_inferrer.dart
index d7da75d..f218476 100644
--- a/pkg/analyzer/lib/src/dart/element/generic_inferrer.dart
+++ b/pkg/analyzer/lib/src/dart/element/generic_inferrer.dart
@@ -140,6 +140,7 @@
if (considerExtendsClause && bound != null) {
extendsClause = _TypeConstraint.fromExtends(
typeParam,
+ bound,
Substitution.fromPairs(typeFormals, inferredTypes)
.substituteType(bound),
isNonNullableByDefault: isNonNullableByDefault,
@@ -164,30 +165,30 @@
// Check the inferred types against all of the constraints.
var knownTypes = <TypeParameterElement, DartType>{};
for (int i = 0; i < typeFormals.length; i++) {
- TypeParameterElement typeParam = typeFormals[i];
- var constraints = _constraints[typeParam]!;
-
- var typeParamBound = typeParam.bound;
- if (typeParamBound != null) {
- typeParamBound = Substitution.fromPairs(typeFormals, inferredTypes)
- .substituteType(typeParamBound);
- typeParamBound = _toLegacyElementIfOptOut(typeParamBound);
- } else {
- typeParamBound = typeProvider.dynamicType;
- }
+ TypeParameterElement parameter = typeFormals[i];
+ var constraints = _constraints[parameter]!;
var inferred = inferredTypes[i];
bool success =
constraints.every((c) => c.isSatisfiedBy(_typeSystem, inferred));
- if (success && !typeParamBound.isDynamic) {
- // If everything else succeeded, check the `extends` constraint.
- var extendsConstraint = _TypeConstraint.fromExtends(
- typeParam,
- typeParamBound,
- isNonNullableByDefault: isNonNullableByDefault,
- );
- constraints.add(extendsConstraint);
- success = extendsConstraint.isSatisfiedBy(_typeSystem, inferred);
+
+ // If everything else succeeded, check the `extends` constraint.
+ if (success) {
+ var parameterBoundRaw = parameter.bound;
+ if (parameterBoundRaw != null) {
+ var parameterBound =
+ Substitution.fromPairs(typeFormals, inferredTypes)
+ .substituteType(parameterBoundRaw);
+ parameterBound = _toLegacyElementIfOptOut(parameterBound);
+ var extendsConstraint = _TypeConstraint.fromExtends(
+ parameter,
+ parameterBoundRaw,
+ parameterBound,
+ isNonNullableByDefault: isNonNullableByDefault,
+ );
+ constraints.add(extendsConstraint);
+ success = extendsConstraint.isSatisfiedBy(_typeSystem, inferred);
+ }
}
if (!success) {
@@ -195,7 +196,7 @@
errorReporter?.reportErrorForNode(
CompileTimeErrorCode.COULD_NOT_INFER,
errorNode!,
- [typeParam.name, _formatError(typeParam, inferred, constraints)]);
+ [parameter.name, _formatError(parameter, inferred, constraints)]);
// Heuristic: even if we failed, keep the erroneous type.
// It should satisfy at least some of the constraints (e.g. the return
@@ -209,7 +210,7 @@
var typeFormalsStr = typeFormals.map(_elementStr).join(', ');
errorReporter?.reportErrorForNode(
CompileTimeErrorCode.COULD_NOT_INFER, errorNode!, [
- typeParam.name,
+ parameter.name,
' Inferred candidate type ${_typeStr(inferred)} has type parameters'
' [$typeFormalsStr], but a function with'
' type parameters cannot be used as a type argument.'
@@ -223,7 +224,7 @@
}
if (UnknownInferredType.isKnown(inferred)) {
- knownTypes[typeParam] = inferred;
+ knownTypes[parameter] = inferred;
} else if (_typeSystem.strictInference) {
// [typeParam] could not be inferred. A result will still be returned
// by [infer], with [typeParam] filled in as its bounds. This is
@@ -538,11 +539,12 @@
: super(upper: upper, lower: lower);
_TypeConstraint.fromExtends(
- TypeParameterElement element, DartType extendsType,
+ TypeParameterElement element, DartType boundType, DartType extendsType,
{required bool isNonNullableByDefault})
: this(
_TypeConstraintFromExtendsClause(
element,
+ boundType,
extendsType,
isNonNullableByDefault: isNonNullableByDefault,
),
@@ -601,17 +603,31 @@
class _TypeConstraintFromExtendsClause extends _TypeConstraintOrigin {
final TypeParameterElement typeParam;
+
+ /// The declared bound of [typeParam], not `null`, because we create
+ /// this clause only when it is not `null`.
+ ///
+ /// For example `Iterable<T>` for `<T, E extends Iterable<T>>`.
+ final DartType boundType;
+
+ /// [boundType] in which type parameters are substituted with inferred
+ /// type arguments.
+ ///
+ /// For example `Iterable<int>` if `T` inferred to `int`.
final DartType extendsType;
- _TypeConstraintFromExtendsClause(this.typeParam, this.extendsType,
+ _TypeConstraintFromExtendsClause(
+ this.typeParam, this.boundType, this.extendsType,
{required bool isNonNullableByDefault})
: super(isNonNullableByDefault: isNonNullableByDefault);
@override
List<String> formatError() {
+ var boundStr = _typeStr(boundType);
+ var extendsStr = _typeStr(extendsType);
return [
"Type parameter '${typeParam.name}'",
- "declared to extend '${_typeStr(extendsType)}'."
+ "is declared to extend '$boundStr' producing '$extendsStr'."
];
}
}
diff --git a/pkg/analyzer/lib/src/dart/element/greatest_lower_bound.dart b/pkg/analyzer/lib/src/dart/element/greatest_lower_bound.dart
index 86df48a..fdabfea 100644
--- a/pkg/analyzer/lib/src/dart/element/greatest_lower_bound.dart
+++ b/pkg/analyzer/lib/src/dart/element/greatest_lower_bound.dart
@@ -226,14 +226,14 @@
if (T2 is InterfaceTypeImpl && T2.isDartAsyncFutureOr) {
var S2 = T2.typeArguments[0];
var S = getGreatestLowerBound(S1, S2);
- return _typeProvider.futureOrType2(S);
+ return _typeProvider.futureOrType(S);
}
// DOWN(FutureOr<S1>, Future<S2>) = Future(S)
// S = DOWN(S1, S2)
if (T2 is InterfaceTypeImpl && T2.isDartAsyncFuture) {
var S2 = T2.typeArguments[0];
var S = getGreatestLowerBound(S1, S2);
- return _typeProvider.futureType2(S);
+ return _typeProvider.futureType(S);
}
// DOWN(FutureOr<S1>, T2) = DOWN(S1, T2)
return getGreatestLowerBound(S1, T2);
@@ -247,7 +247,7 @@
if (T1 is InterfaceTypeImpl && T1.isDartAsyncFuture) {
var S1 = T1.typeArguments[0];
var S = getGreatestLowerBound(S1, S2);
- return _typeProvider.futureType2(S);
+ return _typeProvider.futureType(S);
}
// DOWN(T1, FutureOr<S2>) = DOWN(T1, S2)
return getGreatestLowerBound(T1, S2);
diff --git a/pkg/analyzer/lib/src/dart/element/least_upper_bound.dart b/pkg/analyzer/lib/src/dart/element/least_upper_bound.dart
index 764d9ef..2b9d8a0 100644
--- a/pkg/analyzer/lib/src/dart/element/least_upper_bound.dart
+++ b/pkg/analyzer/lib/src/dart/element/least_upper_bound.dart
@@ -853,31 +853,31 @@
// UP(FutureOr<T1>, FutureOr<T2>) = FutureOr<T3> where T3 = UP(T1, T2)
if (T1_futureOr != null && T2_futureOr != null) {
var T3 = getLeastUpperBound(T1_futureOr, T2_futureOr);
- return _typeSystem.typeProvider.futureOrType2(T3);
+ return _typeSystem.typeProvider.futureOrType(T3);
}
// UP(Future<T1>, FutureOr<T2>) = FutureOr<T3> where T3 = UP(T1, T2)
if (T1_future != null && T2_futureOr != null) {
var T3 = getLeastUpperBound(T1_future, T2_futureOr);
- return _typeSystem.typeProvider.futureOrType2(T3);
+ return _typeSystem.typeProvider.futureOrType(T3);
}
// UP(FutureOr<T1>, Future<T2>) = FutureOr<T3> where T3 = UP(T1, T2)
if (T1_futureOr != null && T2_future != null) {
var T3 = getLeastUpperBound(T1_futureOr, T2_future);
- return _typeSystem.typeProvider.futureOrType2(T3);
+ return _typeSystem.typeProvider.futureOrType(T3);
}
// UP(T1, FutureOr<T2>) = FutureOr<T3> where T3 = UP(T1, T2)
if (T2_futureOr != null) {
var T3 = getLeastUpperBound(T1, T2_futureOr);
- return _typeSystem.typeProvider.futureOrType2(T3);
+ return _typeSystem.typeProvider.futureOrType(T3);
}
// UP(FutureOr<T1>, T2) = FutureOr<T3> where T3 = UP(T1, T2)
if (T1_futureOr != null) {
var T3 = getLeastUpperBound(T1_futureOr, T2);
- return _typeSystem.typeProvider.futureOrType2(T3);
+ return _typeSystem.typeProvider.futureOrType(T3);
}
return null;
diff --git a/pkg/analyzer/lib/src/dart/element/type_provider.dart b/pkg/analyzer/lib/src/dart/element/type_provider.dart
index 332009e..19def0f 100644
--- a/pkg/analyzer/lib/src/dart/element/type_provider.dart
+++ b/pkg/analyzer/lib/src/dart/element/type_provider.dart
@@ -369,61 +369,103 @@
}
@override
- InterfaceType futureOrType2(DartType valueType) {
+ InterfaceType futureOrType(DartType valueType) {
return futureOrElement.instantiate(
typeArguments: [valueType],
nullabilitySuffix: _nullabilitySuffix,
);
}
+ @Deprecated('Use futureOrType instead')
@override
- InterfaceType futureType2(DartType valueType) {
+ InterfaceType futureOrType2(DartType valueType) {
+ return futureOrType(valueType);
+ }
+
+ @override
+ InterfaceType futureType(DartType valueType) {
return futureElement.instantiate(
typeArguments: [valueType],
nullabilitySuffix: _nullabilitySuffix,
);
}
+ @Deprecated('Use futureType instead')
@override
- InterfaceType iterableType2(DartType elementType) {
+ InterfaceType futureType2(DartType valueType) {
+ return futureType(valueType);
+ }
+
+ @override
+ InterfaceType iterableType(DartType elementType) {
return iterableElement.instantiate(
typeArguments: [elementType],
nullabilitySuffix: _nullabilitySuffix,
);
}
+ @Deprecated('Use iterableType instead')
@override
- InterfaceType listType2(DartType elementType) {
+ InterfaceType iterableType2(DartType elementType) {
+ return iterableType(elementType);
+ }
+
+ @override
+ InterfaceType listType(DartType elementType) {
return listElement.instantiate(
typeArguments: [elementType],
nullabilitySuffix: _nullabilitySuffix,
);
}
+ @Deprecated('Use listType instead')
@override
- InterfaceType mapType2(DartType keyType, DartType valueType) {
+ InterfaceType listType2(DartType elementType) {
+ return listType(elementType);
+ }
+
+ @override
+ InterfaceType mapType(DartType keyType, DartType valueType) {
return mapElement.instantiate(
typeArguments: [keyType, valueType],
nullabilitySuffix: _nullabilitySuffix,
);
}
+ @Deprecated('Use mapType instead')
@override
- InterfaceType setType2(DartType elementType) {
+ InterfaceType mapType2(DartType keyType, DartType valueType) {
+ return mapType(keyType, valueType);
+ }
+
+ @override
+ InterfaceType setType(DartType elementType) {
return setElement.instantiate(
typeArguments: [elementType],
nullabilitySuffix: _nullabilitySuffix,
);
}
+ @Deprecated('Use setType instead')
@override
- InterfaceType streamType2(DartType elementType) {
+ InterfaceType setType2(DartType elementType) {
+ return setType(elementType);
+ }
+
+ @override
+ InterfaceType streamType(DartType elementType) {
return streamElement.instantiate(
typeArguments: [elementType],
nullabilitySuffix: _nullabilitySuffix,
);
}
+ @Deprecated('Use streamType instead')
+ @override
+ InterfaceType streamType2(DartType elementType) {
+ return streamType(elementType);
+ }
+
/// Return the class with the given [name] from the given [library], or
/// throw a [StateError] if there is no class with the given name.
ClassElement _getClassElement(LibraryElement library, String name) {
diff --git a/pkg/analyzer/lib/src/dart/element/type_system.dart b/pkg/analyzer/lib/src/dart/element/type_system.dart
index 086fa9c..01d2255 100644
--- a/pkg/analyzer/lib/src/dart/element/type_system.dart
+++ b/pkg/analyzer/lib/src/dart/element/type_system.dart
@@ -202,7 +202,7 @@
// * Else if T is FutureOr<R> and R <: S then factor(Future<R>, S)
if (T is InterfaceType && T.isDartAsyncFutureOr) {
var R = T.typeArguments[0];
- var future_R = typeProvider.futureType2(R);
+ var future_R = typeProvider.futureType(R);
if (isSubtypeOf(future_R, S)) {
return factor(R, S);
}
diff --git a/pkg/analyzer/lib/src/dart/error/ffi_code.dart b/pkg/analyzer/lib/src/dart/error/ffi_code.dart
index b44213b..1e71193 100644
--- a/pkg/analyzer/lib/src/dart/error/ffi_code.dart
+++ b/pkg/analyzer/lib/src/dart/error/ffi_code.dart
@@ -31,17 +31,6 @@
correction: "Try adding a field to '{0}' or use a different Struct.");
/**
- * Parameters:
- * 0: the name of the struct class
- */
- static const FfiCode EMPTY_STRUCT_WARNING = FfiCode(
- name: 'EMPTY_STRUCT_WARNING',
- message:
- "Struct '{0}' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead.",
- correction: "Try adding a field to '{0}' or use a different Struct.",
- type: ErrorType.HINT);
-
- /**
* No parameters.
*/
static const FfiCode EXTRA_ANNOTATION_ON_STRUCT_FIELD = FfiCode(
diff --git a/pkg/analyzer/lib/src/dart/micro/resolve_file.dart b/pkg/analyzer/lib/src/dart/micro/resolve_file.dart
index 48bf382..9655636 100644
--- a/pkg/analyzer/lib/src/dart/micro/resolve_file.dart
+++ b/pkg/analyzer/lib/src/dart/micro/resolve_file.dart
@@ -486,16 +486,14 @@
}
}
- File? _findOptionsFile(Folder? folder) {
- while (folder != null) {
- var packagesFile =
- _getFile(folder, AnalysisEngine.ANALYSIS_OPTIONS_YAML_FILE);
- if (packagesFile != null) {
- return packagesFile;
+ File? _findOptionsFile(Folder folder) {
+ for (var current in folder.withAncestors) {
+ var name = AnalysisEngine.ANALYSIS_OPTIONS_YAML_FILE;
+ var file = _getFile(current, name);
+ if (file != null) {
+ return file;
}
- folder = folder.parent;
}
- return null;
}
/// Return the analysis options.
@@ -520,7 +518,7 @@
File? optionsFile;
if (!isThirdParty) {
optionsFile = performance.run('findOptionsFile', (_) {
- var folder = resourceProvider.getFile(path).parent;
+ var folder = resourceProvider.getFile(path).parent2;
return _findOptionsFile(folder);
});
}
@@ -599,11 +597,8 @@
}
static File? _getFile(Folder directory, String name) {
- Resource resource = directory.getChild(name);
- if (resource is File && resource.exists) {
- return resource;
- }
- return null;
+ var file = directory.getChildAssumingFile(name);
+ return file.exists ? file : null;
}
}
diff --git a/pkg/analyzer/lib/src/dart/resolver/body_inference_context.dart b/pkg/analyzer/lib/src/dart/resolver/body_inference_context.dart
index b9f8ce4..e74356b 100644
--- a/pkg/analyzer/lib/src/dart/resolver/body_inference_context.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/body_inference_context.dart
@@ -95,13 +95,13 @@
if (_isGenerator) {
if (_isAsynchronous) {
- return _typeProvider.streamType2(clampedReturnedType);
+ return _typeProvider.streamType(clampedReturnedType);
} else {
- return _typeProvider.iterableType2(clampedReturnedType);
+ return _typeProvider.iterableType(clampedReturnedType);
}
} else {
if (_isAsynchronous) {
- return _typeProvider.futureType2(
+ return _typeProvider.futureType(
_typeSystem.flatten(clampedReturnedType),
);
} else {
@@ -210,7 +210,7 @@
// Otherwise the context type is `FutureOr<futureValueTypeSchema(S)>`,
// where `S` is the imposed return type.
- return typeSystem.typeProvider.futureOrType2(
+ return typeSystem.typeProvider.futureOrType(
typeSystem.futureValueType(imposedType),
);
}
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 89fbdad..03c7351 100644
--- a/pkg/analyzer/lib/src/dart/resolver/extension_member_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/extension_member_resolver.dart
@@ -223,15 +223,16 @@
) {
if (typeArgumentList != null) {
for (var i = 0; i < typeArgumentTypes.length; i++) {
- var argType = typeArgumentTypes[i];
- var boundType = typeParameters[i].bound;
- if (boundType != null) {
- boundType = substitution.substituteType(boundType);
- if (!_typeSystem.isSubtypeOf(argType, boundType)) {
+ var argument = typeArgumentTypes[i];
+ var parameter = typeParameters[i];
+ var parameterBound = parameter.bound;
+ if (parameterBound != null) {
+ parameterBound = substitution.substituteType(parameterBound);
+ if (!_typeSystem.isSubtypeOf(argument, parameterBound)) {
_errorReporter.reportErrorForNode(
CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS,
typeArgumentList.arguments[i],
- [argType, boundType],
+ [argument, parameter.name, parameterBound],
);
}
}
diff --git a/pkg/analyzer/lib/src/dart/resolver/for_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/for_resolver.dart
index d074408..824e166 100644
--- a/pkg/analyzer/lib/src/dart/resolver/for_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/for_resolver.dart
@@ -105,8 +105,8 @@
}
if (valueType != null) {
InterfaceType targetType = isAsync
- ? _resolver.typeProvider.streamType2(valueType)
- : _resolver.typeProvider.iterableType2(valueType);
+ ? _resolver.typeProvider.streamType(valueType)
+ : _resolver.typeProvider.iterableType(valueType);
InferenceContext.setType(iterable, targetType);
}
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 7dcd3b4..e873a1b 100644
--- a/pkg/analyzer/lib/src/dart/resolver/typed_literal_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/typed_literal_resolver.dart
@@ -78,7 +78,7 @@
if (typeArguments.length == 1) {
DartType elementType = typeArguments[0].type!;
if (!elementType.isDynamic) {
- listType = _typeProvider.listType2(elementType);
+ listType = _typeProvider.listType(elementType);
}
}
} else {
@@ -86,7 +86,7 @@
}
if (listType != null) {
DartType elementType = listType.typeArguments[0];
- DartType iterableType = _typeProvider.iterableType2(elementType);
+ DartType iterableType = _typeProvider.iterableType(elementType);
_pushCollectionTypesDownToAll(_getListElements(node),
elementType: elementType, iterableType: iterableType);
InferenceContext.setType(node, listType);
@@ -107,7 +107,7 @@
if (literalResolution.kind == _LiteralResolutionKind.set) {
if (typeArguments != null && typeArguments.length == 1) {
var elementType = typeArguments[0].type!;
- literalType = _typeProvider.setType2(elementType);
+ literalType = _typeProvider.setType(elementType);
} else {
literalType =
_inferSetTypeDownwards(node, literalResolution.contextType);
@@ -116,7 +116,7 @@
if (typeArguments != null && typeArguments.length == 2) {
var keyType = typeArguments[0].type!;
var valueType = typeArguments[1].type!;
- literalType = _typeProvider.mapType2(keyType, valueType);
+ literalType = _typeProvider.mapType(keyType, valueType);
} else {
literalType =
_inferMapTypeDownwards(node, literalResolution.contextType);
@@ -129,7 +129,7 @@
List<DartType> typeArguments = literalType.typeArguments;
if (typeArguments.length == 1) {
DartType elementType = literalType.typeArguments[0];
- DartType iterableType = _typeProvider.iterableType2(elementType);
+ DartType iterableType = _typeProvider.iterableType(elementType);
_pushCollectionTypesDownToAll(_getSetOrMapElements(node),
elementType: elementType, iterableType: iterableType);
if (!_uiAsCodeEnabled &&
@@ -261,7 +261,7 @@
return unambiguousResolutions[0];
} else if (_getSetOrMapElements(literal).isEmpty) {
return _LiteralResolution(_LiteralResolutionKind.map,
- _typeProvider.mapType2(_dynamicType, _dynamicType));
+ _typeProvider.mapType(_dynamicType, _dynamicType));
}
return _LiteralResolution(_LiteralResolutionKind.ambiguous, null);
}
@@ -310,10 +310,10 @@
if (arguments != null) {
if (arguments.length == 1) {
return _LiteralResolution(_LiteralResolutionKind.set,
- _typeProvider.setType2(arguments[0].type!));
+ _typeProvider.setType(arguments[0].type!));
} else if (arguments.length == 2) {
return _LiteralResolution(_LiteralResolutionKind.map,
- _typeProvider.mapType2(arguments[0].type!, arguments[1].type!));
+ _typeProvider.mapType(arguments[0].type!, arguments[1].type!));
}
}
return _LiteralResolution(_LiteralResolutionKind.ambiguous, null);
@@ -545,7 +545,7 @@
// When `e` is of the form `{}` and `S` is undefined, `e` is a map literal.
if (elements.isEmpty && contextType == null) {
- return _typeProvider.mapType2(
+ return _typeProvider.mapType(
DynamicTypeImpl.instance,
DynamicTypeImpl.instance,
);
@@ -675,7 +675,7 @@
return;
}
- DartType listDynamicType = _typeProvider.listType2(_dynamicType);
+ DartType listDynamicType = _typeProvider.listType(_dynamicType);
// If there are no type arguments, try to infer some arguments.
var inferred = _inferListType(node);
diff --git a/pkg/analyzer/lib/src/dart/resolver/yield_statement_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/yield_statement_resolver.dart
index aa7a684..c241eb0 100644
--- a/pkg/analyzer/lib/src/dart/resolver/yield_statement_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/yield_statement_resolver.dart
@@ -79,9 +79,9 @@
if (isYieldEach) {
impliedReturnType = expressionType;
} else if (_enclosingFunction.isSynchronous) {
- impliedReturnType = _typeProvider.iterableType2(expressionType);
+ impliedReturnType = _typeProvider.iterableType(expressionType);
} else {
- impliedReturnType = _typeProvider.streamType2(expressionType);
+ impliedReturnType = _typeProvider.streamType(expressionType);
}
if (!_typeSystem.isAssignableTo(impliedReturnType, declaredReturnType)) {
@@ -120,8 +120,8 @@
var contextType = elementType;
if (node.star != null) {
contextType = _enclosingFunction.isSynchronous
- ? _typeProvider.iterableType2(elementType)
- : _typeProvider.streamType2(elementType);
+ ? _typeProvider.iterableType(elementType)
+ : _typeProvider.streamType(elementType);
}
InferenceContext.setType(node.expression, contextType);
}
diff --git a/pkg/analyzer/lib/src/dart/sdk/sdk.dart b/pkg/analyzer/lib/src/dart/sdk/sdk.dart
index 2a1a0ec..35fb194 100644
--- a/pkg/analyzer/lib/src/dart/sdk/sdk.dart
+++ b/pkg/analyzer/lib/src/dart/sdk/sdk.dart
@@ -200,7 +200,7 @@
var coreSource = mapDartUri('dart:core');
if (coreSource != null) {
var coreFile = resourceProvider.getFile(coreSource.fullName);
- var embeddedFolder = coreFile.parent!.parent!;
+ var embeddedFolder = coreFile.parent2.parent2;
try {
return embeddedFolder
.getChildAssumingFolder('_internal')
@@ -509,7 +509,7 @@
try {
File file = libraryDirectory.getChildAssumingFile(library.path);
if (relativePath.isNotEmpty) {
- File relativeFile = file.parent!.getChildAssumingFile(relativePath);
+ File relativeFile = file.parent2.getChildAssumingFile(relativePath);
if (relativeFile.path == file.path) {
// The relative file is the library, so return a Source for the
// library rather than the part format.
diff --git a/pkg/analyzer/lib/src/error/catch_error_verifier.dart b/pkg/analyzer/lib/src/error/catch_error_verifier.dart
index 42a6dc4..00d227d 100644
--- a/pkg/analyzer/lib/src/error/catch_error_verifier.dart
+++ b/pkg/analyzer/lib/src/error/catch_error_verifier.dart
@@ -50,7 +50,7 @@
}
var targetType = target.staticType as InterfaceType;
var targetFutureType = targetType.typeArguments.first;
- var expectedReturnType = _typeProvider.futureOrType2(targetFutureType);
+ var expectedReturnType = _typeProvider.futureOrType(targetFutureType);
if (callback is FunctionExpression) {
// TODO(migration): should be FunctionType, not nullable
var callbackType = callback.staticType as FunctionType;
diff --git a/pkg/analyzer/lib/src/error/codes.dart b/pkg/analyzer/lib/src/error/codes.dart
index 4a053ab..3044797 100644
--- a/pkg/analyzer/lib/src/error/codes.dart
+++ b/pkg/analyzer/lib/src/error/codes.dart
@@ -10801,7 +10801,8 @@
* Parameters:
* 0: the name of the type used in the instance creation that should be
* limited by the bound as specified in the class declaration
- * 1: the name of the bounding type
+ * 1: the name of the type parameter
+ * 2: the substituted bound of the type parameter
*/
// #### Description
//
@@ -10830,9 +10831,11 @@
// ```
static const CompileTimeErrorCode TYPE_ARGUMENT_NOT_MATCHING_BOUNDS =
CompileTimeErrorCode(
- 'TYPE_ARGUMENT_NOT_MATCHING_BOUNDS', "'{0}' doesn't extend '{1}'.",
- correction: "Try using a type that is or is a subclass of '{1}'.",
- hasPublishedDocs: true);
+ 'TYPE_ARGUMENT_NOT_MATCHING_BOUNDS',
+ "'{0}' doesn't conform to the bound '{2}' of the type parameter '{1}'.",
+ correction: "Try using a type that is or is a subclass of '{2}'.",
+ hasPublishedDocs: true,
+ );
/**
* No parameters.
diff --git a/pkg/analyzer/lib/src/error/return_type_verifier.dart b/pkg/analyzer/lib/src/error/return_type_verifier.dart
index fcb2f6f..f2a619b 100644
--- a/pkg/analyzer/lib/src/error/return_type_verifier.dart
+++ b/pkg/analyzer/lib/src/error/return_type_verifier.dart
@@ -244,7 +244,7 @@
// It is a compile-time error if `flatten(S)` is not `void`,
// and `Future<flatten(S)>` is not assignable to `T`.
if (!flatten_S.isVoid) {
- var future_flatten_S = _typeProvider.futureType2(flatten_S);
+ var future_flatten_S = _typeProvider.futureType(flatten_S);
if (!_typeSystem.isAssignableTo(future_flatten_S, T)) {
reportTypeError();
return;
diff --git a/pkg/analyzer/lib/src/error/type_arguments_verifier.dart b/pkg/analyzer/lib/src/error/type_arguments_verifier.dart
index 568f81a..2da84df 100644
--- a/pkg/analyzer/lib/src/error/type_arguments_verifier.dart
+++ b/pkg/analyzer/lib/src/error/type_arguments_verifier.dart
@@ -234,7 +234,7 @@
if (!_typeSystem.isSubtypeOf(typeArgument, bound)) {
issues ??= <_TypeArgumentIssue>[];
issues.add(
- _TypeArgumentIssue(i, typeParameter, typeArgument),
+ _TypeArgumentIssue(i, typeParameter, bound, typeArgument),
);
}
}
@@ -250,7 +250,7 @@
_errorReporter.reportErrorForNode(
CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS,
_typeArgumentErrorNode(typeName, issue.index),
- [issue.argument, issue.parameter],
+ [issue.argument, issue.parameter.name, issue.parameterBound],
);
}
return;
@@ -284,7 +284,7 @@
_errorReporter.reportErrorForNode(
CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS,
_typeArgumentErrorNode(typeName, i),
- [typeArgument, bound],
+ [typeArgument, typeParameter.name, bound],
);
}
}
@@ -361,7 +361,8 @@
continue;
}
- var rawBound = fnTypeParams[i].bound;
+ var fnTypeParam = fnTypeParams[i];
+ var rawBound = fnTypeParam.bound;
if (rawBound == null) {
continue;
}
@@ -372,7 +373,7 @@
_errorReporter.reportErrorForNode(
CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS,
typeArgumentList[i],
- [argType, bound]);
+ [argType, fnTypeParam.name, bound]);
}
}
}
@@ -457,14 +458,22 @@
/// The type parameter with the bound that was violated.
final TypeParameterElement parameter;
- /// The type argument that violated the bound.
+ /// The substituted bound of the [parameter].
+ final DartType parameterBound;
+
+ /// The type argument that violated the [parameterBound].
final DartType argument;
- _TypeArgumentIssue(this.index, this.parameter, this.argument);
+ _TypeArgumentIssue(
+ this.index,
+ this.parameter,
+ this.parameterBound,
+ this.argument,
+ );
@override
String toString() {
return 'TypeArgumentIssue(index=$index, parameter=$parameter, '
- 'argument=$argument)';
+ 'parameterBound=$parameterBound, argument=$argument)';
}
}
diff --git a/pkg/analyzer/lib/src/generated/error_verifier.dart b/pkg/analyzer/lib/src/generated/error_verifier.dart
index a90f3ab..a38bd45 100644
--- a/pkg/analyzer/lib/src/generated/error_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/error_verifier.dart
@@ -3123,7 +3123,7 @@
if (positional.isNotEmpty) {
var first = positional.first;
var type = first.declaredElement!.type;
- var listOfString = _typeProvider.listType2(_typeProvider.stringType);
+ var listOfString = _typeProvider.listType(_typeProvider.stringType);
if (!_typeSystem.isSubtypeOf(listOfString, type)) {
_errorReporter.reportErrorForNode(
CompileTimeErrorCode.MAIN_FIRST_POSITIONAL_PARAMETER_TYPE,
diff --git a/pkg/analyzer/lib/src/generated/ffi_verifier.dart b/pkg/analyzer/lib/src/generated/ffi_verifier.dart
index 9b71259..bf59990 100644
--- a/pkg/analyzer/lib/src/generated/ffi_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/ffi_verifier.dart
@@ -67,8 +67,8 @@
if (className == _structClassName) {
inStruct = true;
if (node.declaredElement!.isEmptyStruct) {
- _errorReporter.reportErrorForNode(
- FfiCode.EMPTY_STRUCT_WARNING, node, [node.name]);
+ _errorReporter
+ .reportErrorForNode(FfiCode.EMPTY_STRUCT, node, [node.name]);
}
} else if (className != _allocatorClassName &&
className != _opaqueClassName) {
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index b648902..1e34cb0 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -2100,7 +2100,7 @@
if (type.isDartAsyncFutureOr) {
return type;
}
- return typeProvider.futureOrType2(type);
+ return typeProvider.futureOrType(type);
}
/// Return `true` if the given [parameter] element of the AST being resolved
diff --git a/pkg/analyzer/lib/src/pubspec/pubspec_validator.dart b/pkg/analyzer/lib/src/pubspec/pubspec_validator.dart
index 0fbbd70..ecdfffd 100644
--- a/pkg/analyzer/lib/src/pubspec/pubspec_validator.dart
+++ b/pkg/analyzer/lib/src/pubspec/pubspec_validator.dart
@@ -84,7 +84,7 @@
return true;
}
String fileName = assetFile.shortName;
- Folder assetFolder = assetFile.parent!;
+ Folder assetFolder = assetFile.parent2;
if (!assetFolder.exists) {
return false;
}
diff --git a/pkg/analyzer/lib/src/task/strong/checker.dart b/pkg/analyzer/lib/src/task/strong/checker.dart
index 257f912..0c4053d 100644
--- a/pkg/analyzer/lib/src/task/strong/checker.dart
+++ b/pkg/analyzer/lib/src/task/strong/checker.dart
@@ -155,7 +155,7 @@
} else if (element is SpreadElement) {
// Spread expression may be dynamic in which case it's implicitly downcast
// to Map<dynamic, dynamic>
- DartType expressionCastType = typeProvider.mapType2(
+ DartType expressionCastType = typeProvider.mapType(
DynamicTypeImpl.instance, DynamicTypeImpl.instance);
checkAssignment(element.expression, expressionCastType);
@@ -727,7 +727,7 @@
var typeArg = (type.element == typeProvider.futureElement)
? (type as InterfaceType).typeArguments[0]
: typeProvider.dynamicType;
- return typeProvider.futureOrType2(typeArg);
+ return typeProvider.futureOrType(typeArg);
}
} else {
if (body.isGenerator) {
@@ -815,7 +815,7 @@
// In this case, we're more permissive than assignability.
if (to.isDartAsyncFutureOr) {
var to1 = (to as InterfaceType).typeArguments[0];
- var to2 = typeProvider.futureType2(to1);
+ var to2 = typeProvider.futureType(to1);
return _needsImplicitCast(expr, to: to1, from: from) == true ||
_needsImplicitCast(expr, to: to2, from: from) == true;
}
diff --git a/pkg/analyzer/lib/src/util/either.dart b/pkg/analyzer/lib/src/util/either.dart
new file mode 100644
index 0000000..9ff9bc4
--- /dev/null
+++ b/pkg/analyzer/lib/src/util/either.dart
@@ -0,0 +1,28 @@
+// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/// A container that is either [T1] or [T2].
+class Either2<T1 extends Object, T2 extends Object> {
+ final T1? _t1;
+ final T2? _t2;
+
+ Either2.t1(T1 t1)
+ : _t1 = t1,
+ _t2 = null;
+
+ Either2.t2(T2 t2)
+ : _t1 = null,
+ _t2 = t2;
+
+ T map<T>(T Function(T1) f1, T Function(T2) f2) {
+ if (_t1 != null) {
+ return f1(_t1!);
+ } else {
+ return f2(_t2!);
+ }
+ }
+
+ @override
+ String toString() => map((t) => t.toString(), (t) => t.toString());
+}
diff --git a/pkg/analyzer/lib/src/util/glob.dart b/pkg/analyzer/lib/src/util/glob.dart
index 2fc88cd..e4298a1 100644
--- a/pkg/analyzer/lib/src/util/glob.dart
+++ b/pkg/analyzer/lib/src/util/glob.dart
@@ -2,6 +2,8 @@
// 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/util/either.dart';
+
/// A pattern that matches against filesystem path-like strings with wildcards.
///
/// The pattern matches strings as follows:
@@ -22,18 +24,10 @@
/// The pattern string.
final String _pattern;
- String? _suffix;
- RegExp? _regex;
+ /// The parsed [_pattern].
+ final Either2<String, RegExp> _matcher;
- Glob(this._separator, this._pattern) {
- if (_hasJustPrefix(_pattern, '**/*')) {
- _suffix = _pattern.substring(4).toLowerCase();
- } else if (_hasJustPrefix(_pattern, '**')) {
- _suffix = _pattern.substring(2).toLowerCase();
- } else {
- _regex = _regexpFromGlobPattern(_pattern);
- }
- }
+ Glob(this._separator, this._pattern) : _matcher = _parse(_pattern);
@override
int get hashCode => _pattern.hashCode;
@@ -45,10 +39,10 @@
/// The given [path] must use the same [_separator] as the glob.
bool matches(String path) {
String posixPath = _toPosixPath(path);
- if (_suffix != null) {
- return posixPath.toLowerCase().endsWith(_suffix!);
- }
- return _regex!.matchAsPrefix(posixPath) != null;
+ return _matcher.map(
+ (suffix) => posixPath.toLowerCase().endsWith(suffix),
+ (regexp) => regexp.matchAsPrefix(posixPath) != null,
+ );
}
@override
@@ -73,6 +67,19 @@
return false;
}
+ static Either2<String, RegExp> _parse(String pattern) {
+ if (_hasJustPrefix(pattern, '**/*')) {
+ var suffix = pattern.substring(4).toLowerCase();
+ return Either2.t1(suffix);
+ } else if (_hasJustPrefix(pattern, '**')) {
+ var suffix = pattern.substring(2).toLowerCase();
+ return Either2.t1(suffix);
+ } else {
+ var regexp = _regexpFromGlobPattern(pattern);
+ return Either2.t2(regexp);
+ }
+ }
+
static RegExp _regexpFromGlobPattern(String pattern) {
StringBuffer sb = StringBuffer();
sb.write('^');
diff --git a/pkg/analyzer/lib/src/workspace/basic.dart b/pkg/analyzer/lib/src/workspace/basic.dart
index bf505d2..eb412f9 100644
--- a/pkg/analyzer/lib/src/workspace/basic.dart
+++ b/pkg/analyzer/lib/src/workspace/basic.dart
@@ -47,7 +47,7 @@
) {
Resource resource = provider.getResource(path);
if (resource is File) {
- path = resource.parent!.path;
+ path = resource.parent2.path;
}
return BasicWorkspace._(provider, packageMap, path);
}
diff --git a/pkg/analyzer/lib/src/workspace/bazel.dart b/pkg/analyzer/lib/src/workspace/bazel.dart
index 3d6a1e8..8627efe 100644
--- a/pkg/analyzer/lib/src/workspace/bazel.dart
+++ b/pkg/analyzer/lib/src/workspace/bazel.dart
@@ -473,8 +473,7 @@
return cachedPackage;
}
- Folder folder = provider.getFolder(directoryPath);
- if (!context.isWithin(root, folder.path)) {
+ if (!context.isWithin(root, directoryPath)) {
return null;
}
@@ -482,14 +481,14 @@
// This does not typically happen during usual analysis, but it still could,
// and it can come up in tests.
for (var binPath in [genfiles, ...binPaths]) {
- if (context.isWithin(binPath, folder.path)) {
+ if (context.isWithin(binPath, directoryPath)) {
return findPackageFor(
context.join(root, context.relative(filePath, from: binPath)));
}
}
- // Return a Package rooted at [folder].
- BazelWorkspacePackage? packageRootedHere() {
+ /// Return the package rooted at [folder].
+ BazelWorkspacePackage? packageRootedAt(Folder folder) {
var uriParts = (packageUriResolver as BazelPackageUriResolver)
._restoreUriParts(root, '${folder.path}/lib/__fake__.dart');
String? packageName;
@@ -506,12 +505,9 @@
return package;
}
- while (true) {
- var parent = folder.parent;
- if (parent == null) {
- return null;
- }
- if (parent.path.length < root.length) {
+ var startFolder = provider.getFolder(directoryPath);
+ for (var folder in startFolder.withAncestors) {
+ if (folder.path.length < root.length) {
// We've walked up outside of [root], so [path] is definitely not
// defined in any package in this workspace.
return null;
@@ -519,15 +515,12 @@
if (folder.getChildAssumingFile(_buildFileName).exists) {
// Found the BUILD file, denoting a Dart package.
- return packageRootedHere();
+ return packageRootedAt(folder);
}
if (_hasBuildFileSubstitute(folder)) {
- return packageRootedHere();
+ return packageRootedAt(folder);
}
-
- // Go up a folder.
- folder = parent;
}
}
@@ -612,17 +605,10 @@
String filePath, {
bool lookForBuildFileSubstitutes = true,
}) {
- Resource resource = provider.getResource(filePath);
- if (resource is File && resource.parent != null) {
- filePath = resource.parent!.path;
- }
- path.Context context = provider.pathContext;
- Folder folder = provider.getFolder(filePath);
- while (true) {
- var parent = folder.parent;
- if (parent == null) {
- return null;
- }
+ var context = provider.pathContext;
+ var startFolder = provider.getFolder(filePath);
+ for (var folder in startFolder.withAncestors) {
+ var parent = folder.parent2;
// Found the READONLY folder, might be a git-based workspace.
Folder readonlyFolder = parent.getChildAssumingFolder(_READONLY);
@@ -665,8 +651,8 @@
lookForBuildFileSubstitutes: lookForBuildFileSubstitutes);
}
- // Go up the folder.
- folder = parent;
+ // // Go up the folder.
+ // folder = parent;
}
}
diff --git a/pkg/analyzer/lib/src/workspace/gn.dart b/pkg/analyzer/lib/src/workspace/gn.dart
index b1accc8..1746ddd 100644
--- a/pkg/analyzer/lib/src/workspace/gn.dart
+++ b/pkg/analyzer/lib/src/workspace/gn.dart
@@ -79,14 +79,9 @@
@override
WorkspacePackage? findPackageFor(String path) {
- Folder folder = provider.getFolder(provider.pathContext.dirname(path));
-
- while (true) {
- var parent = folder.parent;
- if (parent == null) {
- return null;
- }
- if (parent.path.length < root.length) {
+ var startFolder = provider.getFolder(path);
+ for (var folder in startFolder.withAncestors) {
+ if (folder.path.length < root.length) {
// We've walked up outside of [root], so [path] is definitely not
// defined in any package in this workspace.
return null;
@@ -95,9 +90,6 @@
if (folder.getChildAssumingFile(_buildFileName).exists) {
return GnWorkspacePackage(folder.path, this);
}
-
- // Go up a folder.
- folder = parent;
}
}
@@ -109,15 +101,11 @@
static GnWorkspace? find(ResourceProvider provider, String filePath) {
Resource resource = provider.getResource(filePath);
if (resource is File) {
- filePath = resource.parent!.path;
+ filePath = resource.parent2.path;
}
- Folder folder = provider.getFolder(filePath);
- while (true) {
- var parent = folder.parent;
- if (parent == null) {
- return null;
- }
+ var startFolder = provider.getFolder(filePath);
+ for (var folder in startFolder.withAncestors) {
if (folder.getChildAssumingFolder(_jiriRootName).exists) {
// Found the .jiri_root file, must be a non-git workspace.
String root = folder.path;
@@ -137,9 +125,6 @@
return GnWorkspace._(provider, root, packageMap);
}
-
- // Go up a folder.
- folder = parent;
}
}
diff --git a/pkg/analyzer/lib/src/workspace/package_build.dart b/pkg/analyzer/lib/src/workspace/package_build.dart
index 298ab1b..09a3446 100644
--- a/pkg/analyzer/lib/src/workspace/package_build.dart
+++ b/pkg/analyzer/lib/src/workspace/package_build.dart
@@ -275,13 +275,8 @@
/// Return `null` if the filePath is not in a package:build workspace.
static PackageBuildWorkspace? find(ResourceProvider provider,
Map<String, List<Folder>> packageMap, String filePath) {
- Folder folder = provider.getFolder(filePath);
- while (true) {
- var parent = folder.parent;
- if (parent == null) {
- return null;
- }
-
+ var startFolder = provider.getFolder(filePath);
+ for (var folder in startFolder.withAncestors) {
final File pubspec = folder.getChildAssumingFile(_pubspecName);
final Folder dartToolDir =
folder.getChildAssumingFolder(_dartToolRootName);
@@ -311,9 +306,6 @@
if (pubspec.exists) {
return null;
}
-
- // Go up the folder.
- folder = parent;
}
}
}
diff --git a/pkg/analyzer/lib/src/workspace/pub.dart b/pkg/analyzer/lib/src/workspace/pub.dart
index ce2351c..9ec1ee7 100644
--- a/pkg/analyzer/lib/src/workspace/pub.dart
+++ b/pkg/analyzer/lib/src/workspace/pub.dart
@@ -41,32 +41,19 @@
}
}
- /// Find the pub workspace that contains the given [path].
+ /// Find the pub workspace that contains the given [filePath].
static PubWorkspace? find(
ResourceProvider provider,
Map<String, List<Folder>> packageMap,
String filePath,
) {
- Resource resource = provider.getResource(filePath);
- if (resource is File) {
- filePath = resource.parent!.path;
- }
- Folder folder = provider.getFolder(filePath);
- while (true) {
- var parent = folder.parent;
- if (parent == null) {
- return null;
- }
-
- var pubspec = folder.getChildAssumingFile(_pubspecName);
+ var start = provider.getFolder(filePath);
+ for (var current in start.withAncestors) {
+ var pubspec = current.getChildAssumingFile(_pubspecName);
if (pubspec.exists) {
- // Found the pubspec.yaml file; this is our root.
- String root = folder.path;
+ var root = current.path;
return PubWorkspace._(provider, packageMap, root, pubspec);
}
-
- // Go up a folder.
- folder = parent;
}
}
}
diff --git a/pkg/analyzer/pubspec.yaml b/pkg/analyzer/pubspec.yaml
index 28d4f3f..6e789a4 100644
--- a/pkg/analyzer/pubspec.yaml
+++ b/pkg/analyzer/pubspec.yaml
@@ -1,5 +1,5 @@
name: analyzer
-version: 1.0.0
+version: 1.1.0-dev
description: This package provides a library that performs static analysis of Dart code.
homepage: https://github.com/dart-lang/sdk/tree/master/pkg/analyzer
diff --git a/pkg/analyzer/test/file_system/file_system_test_support.dart b/pkg/analyzer/test/file_system/file_system_test_support.dart
index e432f4d..7947b4b 100644
--- a/pkg/analyzer/test/file_system/file_system_test_support.dart
+++ b/pkg/analyzer/test/file_system/file_system_test_support.dart
@@ -72,7 +72,7 @@
Folder destination = provider.getFolder(join(tempPath, 'destination'));
File copy = file.copyTo(destination);
- expect(copy.parent, destination);
+ expect(copy.parent2, destination);
expect(copy.shortName, file.shortName);
expect(copy.exists, isTrue);
expect(copy.readAsStringSync(), 'contents');
@@ -185,6 +185,7 @@
expect(() => file.modificationStamp, throwsA(isFileSystemException));
}
+ @deprecated
test_parent() {
File file = getFile(exists: true);
@@ -193,6 +194,14 @@
expect(parent.path, defaultFolderPath);
}
+ test_parent2() {
+ File file = getFile(exists: true);
+
+ var parent = file.parent2;
+ expect(parent.exists, isTrue);
+ expect(parent.path, defaultFolderPath);
+ }
+
test_path() {
File file = getFile(exists: false);
@@ -409,7 +418,7 @@
getFolder(exists: true, folderPath: join(tempPath, 'destination'));
Folder copy = source.copyTo(destination);
- expect(copy.parent, destination);
+ expect(copy.parent2, destination);
_verifyStructure(copy, source);
}
@@ -424,7 +433,7 @@
test_delete() {
File file =
getFile(exists: true, filePath: join(defaultFolderPath, 'myFile'));
- var folder = file.parent!;
+ var folder = file.parent2;
expect(folder.exists, isTrue);
expect(file.exists, isTrue);
@@ -594,7 +603,7 @@
test_parent() {
Folder folder = getFolder(exists: true);
- var parent = folder.parent!;
+ var parent = folder.parent2;
expect(parent.path, equals(tempPath));
//
// Since the OS is in control of where tempPath is, we don't know how far it
@@ -602,8 +611,8 @@
// in a folder with a shorter path, and that we reach the root eventually.
//
while (true) {
- var grandParent = parent.parent;
- if (grandParent == null) {
+ var grandParent = parent.parent2;
+ if (grandParent.isRoot) {
break;
}
expect(grandParent.path.length, lessThan(parent.path.length));
diff --git a/pkg/analyzer/test/file_system/memory_file_system_test.dart b/pkg/analyzer/test/file_system/memory_file_system_test.dart
index ff2ae8c..6c925f4 100644
--- a/pkg/analyzer/test/file_system/memory_file_system_test.dart
+++ b/pkg/analyzer/test/file_system/memory_file_system_test.dart
@@ -304,6 +304,16 @@
@reflectiveTest
class MemoryFolderTest extends BaseTest with FolderTestMixin {
+ test_isRoot_false() {
+ var path = provider.convertPath('/foo');
+ expect(provider.getFolder(path).isRoot, isFalse);
+ }
+
+ test_isRoot_true() {
+ var path = provider.convertPath('/');
+ expect(provider.getFolder(path).isRoot, isTrue);
+ }
+
test_resolveSymbolicLinksSync() {
var lib = provider.convertPath('/test/lib');
var foo = provider.convertPath('/test/lib/foo');
diff --git a/pkg/analyzer/test/file_system/overlay_file_system_test.dart b/pkg/analyzer/test/file_system/overlay_file_system_test.dart
index 2513ebb..0cb1c68 100644
--- a/pkg/analyzer/test/file_system/overlay_file_system_test.dart
+++ b/pkg/analyzer/test/file_system/overlay_file_system_test.dart
@@ -36,7 +36,7 @@
File targetFile =
provider.getFile(baseProvider.convertPath('/foo/test.dart'));
expect(targetFile.exists, isFalse);
- file.copyTo(file.parent!.parent!);
+ file.copyTo(file.parent2.parent2);
expect(targetFile.exists, isTrue);
}
@@ -46,7 +46,7 @@
File targetFile =
provider.getFile(baseProvider.convertPath('/foo/test.dart'));
expect(targetFile.exists, isFalse);
- file.copyTo(file.parent!.parent!);
+ file.copyTo(file.parent2.parent2);
expect(targetFile.exists, isTrue);
expect(targetFile.readAsStringSync(), 'overlay');
provider.removeOverlay(targetFile.path);
@@ -59,7 +59,7 @@
File targetFile =
provider.getFile(baseProvider.convertPath('/foo/test.dart'));
expect(targetFile.exists, isFalse);
- file.copyTo(file.parent!.parent!);
+ file.copyTo(file.parent2.parent2);
expect(targetFile.exists, isTrue);
expect(targetFile.readAsStringSync(), 'overlay');
provider.removeOverlay(targetFile.path);
@@ -164,7 +164,7 @@
}
test_parent() {
- var parent = _file(exists: true).parent!;
+ var parent = _file(exists: true).parent2;
expect(parent.exists, isTrue);
expect(parent.path, defaultFolderPath);
}
@@ -461,7 +461,7 @@
provider.getFolder(baseProvider.convertPath('/destination'));
Folder copy = source.copyTo(destination);
- expect(copy.parent, destination);
+ expect(copy.parent2, destination);
_verifyStructure(copy, source);
}
@@ -577,7 +577,7 @@
test_getChildren_nonExisting_withOverlay() {
File file = _file(exists: false, withOverlay: true);
- List<Resource> children = file.parent!.parent!.getChildren();
+ List<Resource> children = file.parent2.parent2.getChildren();
expect(children, hasLength(1));
expect(children[0], _isFolder);
}
@@ -598,14 +598,15 @@
}
test_parent_ofNonRoot() {
- Folder parent = _folder(exists: true).parent!;
+ Folder parent = _folder(exists: true).parent2;
expect(parent.exists, isTrue);
expect(parent.path, baseProvider.convertPath('/foo'));
}
test_parent_ofRoot() {
- var parent = _folder(exists: true, path: '/').parent;
- expect(parent, isNull);
+ var parent = _folder(exists: true, path: '/').parent2;
+ expect(parent.exists, isTrue);
+ expect(parent.path, baseProvider.convertPath('/'));
}
@failingTest
@@ -734,7 +735,7 @@
test_getFolder_notExisting_withOverlay() {
File file = _file(exists: false, withOverlay: true);
- Folder folder = file.parent!;
+ Folder folder = file.parent2;
expect(folder, isNotNull);
expect(folder.path, defaultFolderPath);
expect(folder.exists, isTrue);
diff --git a/pkg/analyzer/test/file_system/physical_file_system_test.dart b/pkg/analyzer/test/file_system/physical_file_system_test.dart
index c1c70a5..63a4e5a 100644
--- a/pkg/analyzer/test/file_system/physical_file_system_test.dart
+++ b/pkg/analyzer/test/file_system/physical_file_system_test.dart
@@ -61,7 +61,7 @@
File getFile({required bool exists, String? content, String? filePath}) {
File file = provider.getFile(filePath ?? defaultFilePath);
if (exists) {
- file.parent!.create();
+ file.parent2.create();
file.writeAsStringSync(content ?? defaultFileContent);
}
return file;
diff --git a/pkg/analyzer/test/generated/constant_test.dart b/pkg/analyzer/test/generated/constant_test.dart
index f350ad7..0114748 100644
--- a/pkg/analyzer/test/generated/constant_test.dart
+++ b/pkg/analyzer/test/generated/constant_test.dart
@@ -5,6 +5,7 @@
@deprecated
library analyzer.test.constant_test;
+import 'package:analyzer/src/dart/analysis/experiments.dart';
import 'package:analyzer/src/dart/element/element.dart';
import 'package:analyzer/src/generated/constant.dart';
import 'package:test/test.dart';
@@ -20,6 +21,18 @@
@reflectiveTest
class ConstantEvaluatorTest extends PubPackageResolutionTest {
+ @override
+ void setUp() {
+ super.setUp();
+ writeTestPackageAnalysisOptionsFile(
+ AnalysisOptionsFileConfig(
+ experiments: [
+ EnableString.triple_shift,
+ ],
+ ),
+ );
+ }
+
test_bitAnd_int_int() async {
await _assertValueInt(74 & 42, "74 & 42");
}
@@ -446,6 +459,10 @@
await _assertValueInt(6, "2 * 3");
}
+ test_tripleShift() async {
+ await _assertValueInt(16, "64 >>> 2");
+ }
+
test_truncatingDivide_double_double() async {
await _assertValueInt(1, "3.2 ~/ 2.3");
}
diff --git a/pkg/analyzer/test/generated/static_type_analyzer_test.dart b/pkg/analyzer/test/generated/static_type_analyzer_test.dart
index 2144347..8c50eca 100644
--- a/pkg/analyzer/test/generated/static_type_analyzer_test.dart
+++ b/pkg/analyzer/test/generated/static_type_analyzer_test.dart
@@ -163,12 +163,12 @@
InterfaceType numType = _typeProvider.numType;
// class A extends Future<int> implements Future<num> { ... }
ClassElementImpl classA =
- ElementFactory.classElement('A', _typeProvider.futureType2(intType));
- classA.interfaces = <InterfaceType>[_typeProvider.futureType2(numType)];
+ ElementFactory.classElement('A', _typeProvider.futureType(intType));
+ classA.interfaces = <InterfaceType>[_typeProvider.futureType(numType)];
// class B extends Future<num> implements Future<int> { ... }
ClassElementImpl classB =
- ElementFactory.classElement('B', _typeProvider.futureType2(numType));
- classB.interfaces = <InterfaceType>[_typeProvider.futureType2(intType)];
+ ElementFactory.classElement('B', _typeProvider.futureType(numType));
+ classB.interfaces = <InterfaceType>[_typeProvider.futureType(intType)];
// flatten(A) = flatten(B) = int, since int is more specific than num.
expect(_flatten(interfaceTypeStar(classA)), intType);
expect(_flatten(interfaceTypeStar(classB)), intType);
@@ -178,11 +178,10 @@
InterfaceType intType = _typeProvider.intType;
DartType dynamicType = _typeProvider.dynamicType;
InterfaceType futureDynamicType = _typeProvider.futureDynamicType;
- InterfaceType futureIntType = _typeProvider.futureType2(intType);
+ InterfaceType futureIntType = _typeProvider.futureType(intType);
InterfaceType futureFutureDynamicType =
- _typeProvider.futureType2(futureDynamicType);
- InterfaceType futureFutureIntType =
- _typeProvider.futureType2(futureIntType);
+ _typeProvider.futureType(futureDynamicType);
+ InterfaceType futureFutureIntType = _typeProvider.futureType(futureIntType);
// flatten(int) = int
expect(_flatten(intType), intType);
// flatten(dynamic) = dynamic
@@ -203,12 +202,12 @@
InterfaceType stringType = _typeProvider.stringType;
// class A extends Future<int> implements Future<String> { ... }
ClassElementImpl classA =
- ElementFactory.classElement('A', _typeProvider.futureType2(intType));
- classA.interfaces = <InterfaceType>[_typeProvider.futureType2(stringType)];
+ ElementFactory.classElement('A', _typeProvider.futureType(intType));
+ classA.interfaces = <InterfaceType>[_typeProvider.futureType(stringType)];
// class B extends Future<String> implements Future<int> { ... }
ClassElementImpl classB =
- ElementFactory.classElement('B', _typeProvider.futureType2(stringType));
- classB.interfaces = <InterfaceType>[_typeProvider.futureType2(intType)];
+ ElementFactory.classElement('B', _typeProvider.futureType(stringType));
+ classB.interfaces = <InterfaceType>[_typeProvider.futureType(intType)];
// flatten(A) = A and flatten(B) = B, since neither string nor int is more
// specific than the other.
expect(_flatten(interfaceTypeStar(classA)), interfaceTypeStar(classA));
@@ -238,9 +237,8 @@
void test_visitAwaitExpression_flattened() {
// await e, where e has type Future<Future<int>>
InterfaceType intType = _typeProvider.intType;
- InterfaceType futureIntType = _typeProvider.futureType2(intType);
- InterfaceType futureFutureIntType =
- _typeProvider.futureType2(futureIntType);
+ InterfaceType futureIntType = _typeProvider.futureType(intType);
+ InterfaceType futureFutureIntType = _typeProvider.futureType(futureIntType);
Expression node = AstTestFactory.awaitExpression(
_resolvedVariable(futureFutureIntType, 'e'));
expect(_analyze(node), same(futureIntType));
@@ -250,7 +248,7 @@
void test_visitAwaitExpression_simple() {
// await e, where e has type Future<int>
InterfaceType intType = _typeProvider.intType;
- InterfaceType futureIntType = _typeProvider.futureType2(intType);
+ InterfaceType futureIntType = _typeProvider.futureType(intType);
Expression node =
AstTestFactory.awaitExpression(_resolvedVariable(futureIntType, 'e'));
expect(_analyze(node), same(intType));
diff --git a/pkg/analyzer/test/generated/strong_mode_test.dart b/pkg/analyzer/test/generated/strong_mode_test.dart
index ded3bea..9a88a32 100644
--- a/pkg/analyzer/test/generated/strong_mode_test.dart
+++ b/pkg/analyzer/test/generated/strong_mode_test.dart
@@ -1252,7 +1252,7 @@
Couldn't infer type parameter 'T'.
Tried to infer 'String' for 'T' which doesn't work:
- Type parameter 'T' declared to extend 'num'.
+ Type parameter 'T' is declared to extend 'num' producing 'num'.
The type 'String' was inferred from:
Return type declared as 'T Function(T)'
used where 'String Function(String)' is required.
@@ -2810,7 +2810,7 @@
assertType(ft, 'List<int> Function(String)');
var x = findElement.localVar('x');
- expect(x.type, typeProvider.listType2(typeProvider.intType));
+ expect(x.type, typeProvider.listType(typeProvider.intType));
}
test_genericMethod_functionExpressionInvocation_explicit() async {
diff --git a/pkg/analyzer/test/source/package_map_resolver_test.dart b/pkg/analyzer/test/source/package_map_resolver_test.dart
index faa7e02..19aee6d 100644
--- a/pkg/analyzer/test/source/package_map_resolver_test.dart
+++ b/pkg/analyzer/test/source/package_map_resolver_test.dart
@@ -44,7 +44,7 @@
var b = provider.newFile(provider.convertPath('/bbb/b.dart'), '');
expect(() {
PackageMapUriResolver(provider, <String, List<Folder>>{
- 'pkg': <Folder>[a.parent!, b.parent!]
+ 'pkg': <Folder>[a.parent2, b.parent2]
});
}, throwsArgumentError);
}
diff --git a/pkg/analyzer/test/src/dart/analysis/context_locator_test.dart b/pkg/analyzer/test/src/dart/analysis/context_locator_test.dart
index 560bb58..aecd4cc 100644
--- a/pkg/analyzer/test/src/dart/analysis/context_locator_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/context_locator_test.dart
@@ -120,7 +120,7 @@
expect(outer1Root.optionsFile, outer1OptionsFile);
expect(outer1Root.packagesFile, outer1PackagesFile);
- ContextRoot outer2Root = findRoot(roots, testFile.parent!);
+ ContextRoot outer2Root = findRoot(roots, testFile.parent2);
expect(outer2Root.includedPaths, unorderedEquals([testFile.path]));
expect(outer2Root.excludedPaths, isEmpty);
expect(outer2Root.optionsFile, outer2OptionsFile);
@@ -369,7 +369,7 @@
expect(
outerRoot.excludedPaths,
unorderedEquals([
- outerPackagesFile.parent!.path,
+ outerPackagesFile.parent2.path,
innerRootFolder.path,
]),
);
@@ -381,7 +381,7 @@
expect(
innerRoot.excludedPaths,
unorderedEquals([
- innerPackagesFile.parent!.path,
+ innerPackagesFile.parent2.path,
]),
);
expect(innerRoot.optionsFile, outerOptionsFile);
@@ -471,7 +471,7 @@
ContextRoot outerRoot = findRoot(roots, outerRootFolder);
expect(outerRoot.includedPaths, unorderedEquals([outerRootFolder.path]));
expect(outerRoot.excludedPaths,
- unorderedEquals([innerOptionsFile.parent!.path]));
+ unorderedEquals([innerOptionsFile.parent2.path]));
expect(outerRoot.optionsFile, outerOptionsFile);
expect(outerRoot.packagesFile, outerPackagesFile);
}
@@ -577,7 +577,7 @@
expect(
contentRoot.excludedPaths,
unorderedEquals(
- [packageConfigJsonFile.parent!.path],
+ [packageConfigJsonFile.parent2.path],
),
);
expect(contentRoot.optionsFile, optionsFile);
@@ -593,7 +593,7 @@
contextLocator.locateRoots(includedPaths: [testFile.path]);
expect(roots, hasLength(1));
- ContextRoot package1Root = findRoot(roots, testFile.parent!);
+ ContextRoot package1Root = findRoot(roots, testFile.parent2);
expect(package1Root.includedPaths, unorderedEquals([testFile.path]));
expect(package1Root.excludedPaths, isEmpty);
expect(package1Root.optionsFile, optionsFile);
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 e6d0d18..a11c045 100644
--- a/pkg/analyzer/test/src/dart/analysis/driver_resolution_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/driver_resolution_test.dart
@@ -1767,7 +1767,7 @@
VariableDeclaration fNode = fDeclaration.fields.variables[0];
var fElement = fNode.declaredElement as FieldElement;
expect(
- fElement.type, typeProvider.listType2(typeParameterTypeStar(tElement)));
+ fElement.type, typeProvider.listType(typeParameterTypeStar(tElement)));
}
test_field_generic() async {
@@ -2044,7 +2044,7 @@
await resolveTestFile();
InterfaceType intType = typeProvider.intType;
- InterfaceType listIntType = typeProvider.listType2(intType);
+ InterfaceType listIntType = typeProvider.listType(intType);
List<Statement> mainStatements = _getMainStatements(result);
@@ -5075,16 +5075,14 @@
var statement = statements[0] as ExpressionStatement;
var mapLiteral = statement.expression as SetOrMapLiteral;
expect(mapLiteral.staticType,
- typeProvider.mapType2(typeProvider.intType, typeProvider.doubleType));
+ typeProvider.mapType(typeProvider.intType, typeProvider.doubleType));
}
{
var statement = statements[1] as ExpressionStatement;
var mapLiteral = statement.expression as SetOrMapLiteral;
- expect(
- mapLiteral.staticType,
- typeProvider.mapType2(
- typeProvider.boolType, typeProvider.stringType));
+ expect(mapLiteral.staticType,
+ typeProvider.mapType(typeProvider.boolType, typeProvider.stringType));
}
}
diff --git a/pkg/analyzer/test/src/dart/constant/evaluation_test.dart b/pkg/analyzer/test/src/dart/constant/evaluation_test.dart
index 86367f8..c835e16 100644
--- a/pkg/analyzer/test/src/dart/constant/evaluation_test.dart
+++ b/pkg/analyzer/test/src/dart/constant/evaluation_test.dart
@@ -33,7 +33,7 @@
const c = [1, if (1 < 0) 2 else 3, 4];
''');
DartObjectImpl result = _evaluateConstant('c');
- expect(result.type, typeProvider.listType2(typeProvider.intType));
+ expect(result.type, typeProvider.listType(typeProvider.intType));
expect(result.toListValue()!.map((e) => e.toIntValue()), [1, 3, 4]);
}
@@ -42,7 +42,7 @@
const c = [1, if (1 < 0) 2, 3];
''');
DartObjectImpl result = _evaluateConstant('c');
- expect(result.type, typeProvider.listType2(typeProvider.intType));
+ expect(result.type, typeProvider.listType(typeProvider.intType));
expect(result.toListValue()!.map((e) => e.toIntValue()), [1, 3]);
}
@@ -51,7 +51,7 @@
const c = [1, if (1 > 0) 2 else 3, 4];
''');
DartObjectImpl result = _evaluateConstant('c');
- expect(result.type, typeProvider.listType2(typeProvider.intType));
+ expect(result.type, typeProvider.listType(typeProvider.intType));
expect(result.toListValue()!.map((e) => e.toIntValue()), [1, 2, 4]);
}
@@ -60,7 +60,7 @@
const c = [1, if (1 > 0) 2, 3];
''');
DartObjectImpl result = _evaluateConstant('c');
- expect(result.type, typeProvider.listType2(typeProvider.intType));
+ expect(result.type, typeProvider.listType(typeProvider.intType));
expect(result.toListValue()!.map((e) => e.toIntValue()), [1, 2, 3]);
}
@@ -71,7 +71,7 @@
DartObjectImpl result = _evaluateConstant('c');
// The expected type ought to be `List<int>`, but type inference isn't yet
// implemented.
- expect(result.type, typeProvider.listType2(typeProvider.intType));
+ expect(result.type, typeProvider.listType(typeProvider.intType));
expect(result.toListValue()!.map((e) => e.toIntValue()), [1, 2, 3]);
}
@@ -80,7 +80,7 @@
const c = [1, ...[2, 3], 4];
''');
DartObjectImpl result = _evaluateConstant('c');
- expect(result.type, typeProvider.listType2(typeProvider.intType));
+ expect(result.type, typeProvider.listType(typeProvider.intType));
expect(result.toListValue()!.map((e) => e.toIntValue()), [1, 2, 3, 4]);
}
@@ -90,7 +90,7 @@
''');
DartObjectImpl result = _evaluateConstant('c');
expect(result.type,
- typeProvider.mapType2(typeProvider.stringType, typeProvider.intType));
+ typeProvider.mapType(typeProvider.stringType, typeProvider.intType));
Map<DartObject, DartObject> value = result.toMapValue()!;
expect(value.keys.map((e) => e.toStringValue()),
unorderedEquals(['a', 'c', 'd']));
@@ -103,7 +103,7 @@
''');
DartObjectImpl result = _evaluateConstant('c');
expect(result.type,
- typeProvider.mapType2(typeProvider.stringType, typeProvider.intType));
+ typeProvider.mapType(typeProvider.stringType, typeProvider.intType));
Map<DartObject, DartObject> value = result.toMapValue()!;
expect(
value.keys.map((e) => e.toStringValue()), unorderedEquals(['a', 'c']));
@@ -116,7 +116,7 @@
''');
DartObjectImpl result = _evaluateConstant('c');
expect(result.type,
- typeProvider.mapType2(typeProvider.stringType, typeProvider.intType));
+ typeProvider.mapType(typeProvider.stringType, typeProvider.intType));
Map<DartObject, DartObject> value = result.toMapValue()!;
expect(value.keys.map((e) => e.toStringValue()),
unorderedEquals(['a', 'b', 'd']));
@@ -129,7 +129,7 @@
''');
DartObjectImpl result = _evaluateConstant('c');
expect(result.type,
- typeProvider.mapType2(typeProvider.stringType, typeProvider.intType));
+ typeProvider.mapType(typeProvider.stringType, typeProvider.intType));
Map<DartObject, DartObject> value = result.toMapValue()!;
expect(value.keys.map((e) => e.toStringValue()),
unorderedEquals(['a', 'b', 'c']));
@@ -144,7 +144,7 @@
''');
DartObjectImpl result = _evaluateConstant('c');
expect(result.type,
- typeProvider.mapType2(typeProvider.intType, typeProvider.intType));
+ typeProvider.mapType(typeProvider.intType, typeProvider.intType));
Map<DartObject, DartObject> value = result.toMapValue()!;
expect(value.keys.map((e) => e.toStringValue()),
unorderedEquals(['a', 'b', 'c']));
@@ -157,7 +157,7 @@
''');
DartObjectImpl result = _evaluateConstant('c');
expect(result.type,
- typeProvider.mapType2(typeProvider.stringType, typeProvider.intType));
+ typeProvider.mapType(typeProvider.stringType, typeProvider.intType));
Map<DartObject, DartObject> value = result.toMapValue()!;
expect(value.keys.map((e) => e.toStringValue()),
unorderedEquals(['a', 'b', 'c', 'd']));
@@ -170,7 +170,7 @@
const c = {1, if (1 < 0) 2 else 3, 4};
''');
DartObjectImpl result = _evaluateConstant('c');
- expect(result.type, typeProvider.setType2(typeProvider.intType));
+ expect(result.type, typeProvider.setType(typeProvider.intType));
expect(result.toSetValue()!.map((e) => e.toIntValue()), [1, 3, 4]);
}
@@ -179,7 +179,7 @@
const c = {1, if (1 < 0) 2, 3};
''');
DartObjectImpl result = _evaluateConstant('c');
- expect(result.type, typeProvider.setType2(typeProvider.intType));
+ expect(result.type, typeProvider.setType(typeProvider.intType));
expect(result.toSetValue()!.map((e) => e.toIntValue()), [1, 3]);
}
@@ -188,7 +188,7 @@
const c = {1, if (1 > 0) 2 else 3, 4};
''');
DartObjectImpl result = _evaluateConstant('c');
- expect(result.type, typeProvider.setType2(typeProvider.intType));
+ expect(result.type, typeProvider.setType(typeProvider.intType));
expect(result.toSetValue()!.map((e) => e.toIntValue()), [1, 2, 4]);
}
@@ -197,7 +197,7 @@
const c = {1, if (1 > 0) 2, 3};
''');
DartObjectImpl result = _evaluateConstant('c');
- expect(result.type, typeProvider.setType2(typeProvider.intType));
+ expect(result.type, typeProvider.setType(typeProvider.intType));
expect(result.toSetValue()!.map((e) => e.toIntValue()), [1, 2, 3]);
}
@@ -206,7 +206,7 @@
const c = {1, if (1 > 0) if (2 > 1) 2, 3};
''');
DartObjectImpl result = _evaluateConstant('c');
- expect(result.type, typeProvider.setType2(typeProvider.intType));
+ expect(result.type, typeProvider.setType(typeProvider.intType));
expect(result.toSetValue()!.map((e) => e.toIntValue()), [1, 2, 3]);
}
@@ -215,7 +215,7 @@
const c = {1, ...{2, 3}, 4};
''');
DartObjectImpl result = _evaluateConstant('c');
- expect(result.type, typeProvider.setType2(typeProvider.intType));
+ expect(result.type, typeProvider.setType(typeProvider.intType));
expect(result.toSetValue()!.map((e) => e.toIntValue()), [1, 2, 3, 4]);
}
diff --git a/pkg/analyzer/test/src/dart/constant/value_test.dart b/pkg/analyzer/test/src/dart/constant/value_test.dart
index 160770d..aad7d69 100644
--- a/pkg/analyzer/test/src/dart/constant/value_test.dart
+++ b/pkg/analyzer/test/src/dart/constant/value_test.dart
@@ -930,7 +930,7 @@
_assertIdentical(
_boolValue(true),
- _typeValue(_typeProvider.futureOrType2(_typeProvider.objectType)),
+ _typeValue(_typeProvider.futureOrType(_typeProvider.objectType)),
_typeValue(_typeProvider.objectType),
);
}
@@ -2193,7 +2193,7 @@
) {
return DartObjectImpl(
_typeSystem,
- _typeProvider.listType2(elementType),
+ _typeProvider.listType(elementType),
ListState(elements),
);
}
@@ -2208,7 +2208,7 @@
}
return DartObjectImpl(
_typeSystem,
- _typeProvider.mapType2(keyType, valueType),
+ _typeProvider.mapType(keyType, valueType),
MapState(map),
);
}
diff --git a/pkg/analyzer/test/src/dart/element/type_visitor_test.dart b/pkg/analyzer/test/src/dart/element/type_visitor_test.dart
index b0bed4f..e17064f 100644
--- a/pkg/analyzer/test/src/dart/element/type_visitor_test.dart
+++ b/pkg/analyzer/test/src/dart/element/type_visitor_test.dart
@@ -99,20 +99,20 @@
}
void test_interfaceType_typeParameter() {
- final type = typeProvider.listType2(intNone);
+ final type = typeProvider.listType(intNone);
expect(type.accept(visitor), true);
visitor.assertVisitedType(intNone);
}
void test_interfaceType_typeParameters() {
- final type = typeProvider.mapType2(intNone, stringNone);
+ final type = typeProvider.mapType(intNone, stringNone);
expect(type.accept(visitor), true);
visitor.assertVisitedTypes([intNone, stringNone]);
}
void test_interfaceType_typeParameters_nested() {
- final innerList = typeProvider.listType2(intNone);
- final outerList = typeProvider.listType2(innerList);
+ final innerList = typeProvider.listType(intNone);
+ final outerList = typeProvider.listType(innerList);
expect(outerList.accept(visitor), true);
visitor.assertVisitedType(intNone);
}
@@ -153,24 +153,24 @@
}
void test_stopVisiting_nested() {
- final innerType = typeProvider.mapType2(intNone, stringNone);
- final outerList = typeProvider.listType2(innerType);
+ final innerType = typeProvider.mapType(intNone, stringNone);
+ final outerList = typeProvider.listType(innerType);
visitor.stopOnType = intNone;
expect(outerList.accept(visitor), false);
visitor.assertNotVisitedType(stringNone);
}
void test_stopVisiting_nested_parent() {
- final innerTypeStop = typeProvider.listType2(intNone);
- final innerTypeSkipped = typeProvider.listType2(stringNone);
- final outerType = typeProvider.mapType2(innerTypeStop, innerTypeSkipped);
+ final innerTypeStop = typeProvider.listType(intNone);
+ final innerTypeSkipped = typeProvider.listType(stringNone);
+ final outerType = typeProvider.mapType(innerTypeStop, innerTypeSkipped);
visitor.stopOnType = intNone;
expect(outerType.accept(visitor), false);
visitor.assertNotVisitedType(stringNone);
}
void test_stopVisiting_typeParameters() {
- final type = typeProvider.mapType2(intNone, stringNone);
+ final type = typeProvider.mapType(intNone, stringNone);
visitor.stopOnType = intNone;
expect(type.accept(visitor), false);
visitor.assertVisitedType(intNone);
diff --git a/pkg/analyzer/test/src/dart/resolver/legacy_type_asserter_test.dart b/pkg/analyzer/test/src/dart/resolver/legacy_type_asserter_test.dart
index 3f1f84e..c78f9a4 100644
--- a/pkg/analyzer/test/src/dart/resolver/legacy_type_asserter_test.dart
+++ b/pkg/analyzer/test/src/dart/resolver/legacy_type_asserter_test.dart
@@ -67,7 +67,7 @@
test_nullableUnit_expressionStaticType_nonNullTypeArgument() async {
var identifier = AstTestFactory.identifier3('foo');
var unit = _wrapExpression(identifier);
- identifier.staticType = typeProvider.listType2(
+ identifier.staticType = typeProvider.listType(
(typeProvider.intType as TypeImpl)
.withNullability(NullabilitySuffix.question));
diff --git a/pkg/analyzer/test/src/diagnostics/implements_deferred_class_test.dart b/pkg/analyzer/test/src/diagnostics/implements_deferred_class_test.dart
index aaa6cf5..56e199e 100644
--- a/pkg/analyzer/test/src/diagnostics/implements_deferred_class_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/implements_deferred_class_test.dart
@@ -29,6 +29,21 @@
]);
}
+ test_implements_interfaceTypeTypedef() async {
+ newFile('$testPackageLibPath/lib1.dart', content: '''
+library lib1;
+class A {}
+typedef B = A;
+''');
+ await assertErrorsInCode('''
+library root;
+import 'lib1.dart' deferred as a;
+class C implements a.B {}
+''', [
+ error(CompileTimeErrorCode.IMPLEMENTS_DEFERRED_CLASS, 67, 3),
+ ]);
+ }
+
test_mixinApplication() async {
newFile('$testPackageLibPath/lib1.dart', content: '''
library lib1;
diff --git a/pkg/analyzer/test/src/diagnostics/inference_failure_on_instance_creation_test.dart b/pkg/analyzer/test/src/diagnostics/inference_failure_on_instance_creation_test.dart
index 6e39da6..89c6db9 100644
--- a/pkg/analyzer/test/src/diagnostics/inference_failure_on_instance_creation_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/inference_failure_on_instance_creation_test.dart
@@ -2,6 +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:analyzer/src/dart/analysis/experiments.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -21,6 +22,7 @@
super.setUp();
writeTestPackageAnalysisOptionsFile(
AnalysisOptionsFileConfig(
+ experiments: [EnableString.nonfunction_type_aliases],
strictInference: true,
),
);
@@ -68,6 +70,18 @@
''');
}
+ test_missingTypeArgument_interfaceTypeTypedef_noInference() async {
+ await assertErrorsInCode(r'''
+import 'dart:collection';
+typedef A = HashMap;
+void f() {
+ A();
+}
+''', [
+ error(HintCode.INFERENCE_FAILURE_ON_INSTANCE_CREATION, 60, 1),
+ ]);
+ }
+
test_missingTypeArgument_noInference() async {
await assertErrorsInCode(r'''
import 'dart:collection';
diff --git a/pkg/analyzer/test/src/diagnostics/instantiate_abstract_class_test.dart b/pkg/analyzer/test/src/diagnostics/instantiate_abstract_class_test.dart
index 6c1e237..c49f88c 100644
--- a/pkg/analyzer/test/src/diagnostics/instantiate_abstract_class_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/instantiate_abstract_class_test.dart
@@ -56,6 +56,18 @@
assertType(findNode.instanceCreation('new A<int>'), 'A<int>');
}
+ test_new_interfaceTypeTypedef() async {
+ await assertErrorsInCode('''
+abstract class A {}
+typedef B = A;
+void f() {
+ new B();
+}
+''', [
+ error(CompileTimeErrorCode.INSTANTIATE_ABSTRACT_CLASS, 52, 1),
+ ]);
+ }
+
test_new_nonGeneric() async {
await assertErrorsInCode('''
abstract class A {}
@@ -80,6 +92,18 @@
assertType(findNode.instanceCreation('A<int>'), 'A<int>');
}
+ test_noKeyword_interfaceTypeTypedef() async {
+ await assertErrorsInCode('''
+abstract class A {}
+typedef B = A;
+void f() {
+ B();
+}
+''', [
+ error(CompileTimeErrorCode.INSTANTIATE_ABSTRACT_CLASS, 48, 1),
+ ]);
+ }
+
test_noKeyword_nonGeneric() async {
await assertErrorsInCode('''
abstract class A {}
diff --git a/pkg/analyzer/test/src/diagnostics/non_type_in_catch_clause_test.dart b/pkg/analyzer/test/src/diagnostics/non_type_in_catch_clause_test.dart
index 530ff4b..67139b2 100644
--- a/pkg/analyzer/test/src/diagnostics/non_type_in_catch_clause_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/non_type_in_catch_clause_test.dart
@@ -16,42 +16,63 @@
@reflectiveTest
class NonTypeInCatchClauseTest extends PubPackageResolutionTest {
test_isClass() async {
- await assertErrorsInCode(r'''
+ await assertNoErrorsInCode(r'''
f() {
try {
} on String catch (e) {
+ e;
}
}
-''', [
- error(HintCode.UNUSED_CATCH_CLAUSE, 35, 1),
- ]);
+''');
}
test_isFunctionTypeAlias() async {
- await assertErrorsInCode(r'''
+ await assertNoErrorsInCode(r'''
typedef F();
f() {
try {
} on F catch (e) {
+ e;
}
}
-''', [
- error(HintCode.UNUSED_CATCH_CLAUSE, 43, 1),
- ]);
+''');
+ }
+
+ test_isGenericFunctionTypeAlias() async {
+ await assertNoErrorsInCode(r'''
+typedef F<T> = void Function(T);
+f() {
+ try {
+ } on F catch (e) {
+ e;
+ }
+}
+''');
+ }
+
+ test_isInterfaceTypeTypeAlias() async {
+ await assertNoErrorsInCode(r'''
+typedef F = String;
+f() {
+ try {
+ } on F catch (e) {
+ e;
+ }
+}
+''');
}
test_isTypeParameter() async {
- await assertErrorsInCode(r'''
+ await assertNoErrorsInCode(r'''
class A<T extends Object> {
f() {
try {
} on T catch (e) {
+ e;
}
}
}
-''', [
- error(HintCode.UNUSED_CATCH_CLAUSE, 64, 1),
- ]);
+''');
}
test_notDefined() async {
@@ -59,13 +80,13 @@
f() {
try {
} on T catch (e) {
+ e;
}
}
''', [
// TODO(srawlins): Ideally the first error should not be reported.
error(HintCode.NULLABLE_TYPE_IN_CATCH_CLAUSE, 21, 1),
error(CompileTimeErrorCode.NON_TYPE_IN_CATCH_CLAUSE, 21, 1),
- error(HintCode.UNUSED_CATCH_CLAUSE, 30, 1),
]);
}
@@ -75,13 +96,13 @@
f() {
try {
} on T catch (e) {
+ e;
}
}
''', [
// TODO(srawlins): Ideally the first error should not be reported.
error(HintCode.NULLABLE_TYPE_IN_CATCH_CLAUSE, 32, 1),
error(CompileTimeErrorCode.NON_TYPE_IN_CATCH_CLAUSE, 32, 1),
- error(HintCode.UNUSED_CATCH_CLAUSE, 41, 1),
]);
}
diff --git a/pkg/analyzer/test/src/diagnostics/not_iterable_spread_test.dart b/pkg/analyzer/test/src/diagnostics/not_iterable_spread_test.dart
index a8b606c..d81a21a 100644
--- a/pkg/analyzer/test/src/diagnostics/not_iterable_spread_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/not_iterable_spread_test.dart
@@ -10,13 +10,23 @@
main() {
defineReflectiveSuite(() {
defineReflectiveTests(NotIterableSpreadTest);
- defineReflectiveTests(NotIterableSpreadNullSafetyTest);
+ defineReflectiveTests(NotIterableSpreadWithoutNullSafetyTest);
});
}
@reflectiveTest
-class NotIterableSpreadNullSafetyTest extends NotIterableSpreadTest
- with WithNullSafetyMixin {
+class NotIterableSpreadTest extends PubPackageResolutionTest
+ with NotIterableSpreadTestCases {
+ test_iterable_interfaceTypeTypedef() async {
+ await assertNoErrorsInCode('''
+typedef A = List<int>;
+f(A a) {
+ var v = [...a];
+ v;
+}
+''');
+ }
+
test_iterable_typeParameter_bound_listQuestion() async {
await assertNoErrorsInCode('''
void f<T extends List<int>?>(T a) {
@@ -27,9 +37,7 @@
}
}
-@reflectiveTest
-class NotIterableSpreadTest extends PubPackageResolutionTest
- with WithoutNullSafetyMixin {
+mixin NotIterableSpreadTestCases on PubPackageResolutionTest {
test_iterable_list() async {
await assertNoErrorsInCode('''
var a = [0];
@@ -100,3 +108,7 @@
]);
}
}
+
+@reflectiveTest
+class NotIterableSpreadWithoutNullSafetyTest extends PubPackageResolutionTest
+ with WithoutNullSafetyMixin, NotIterableSpreadTestCases {}
diff --git a/pkg/analyzer/test/src/diagnostics/redirect_to_abstract_class_constructor_test.dart b/pkg/analyzer/test/src/diagnostics/redirect_to_abstract_class_constructor_test.dart
index 57aabd4..f9272cd 100644
--- a/pkg/analyzer/test/src/diagnostics/redirect_to_abstract_class_constructor_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/redirect_to_abstract_class_constructor_test.dart
@@ -49,4 +49,16 @@
class B extends A {}
''');
}
+
+ test_redirectsToSubclass_asTypedef() async {
+ await assertNoErrorsInCode(r'''
+class A {
+ factory A.named() = C;
+ A();
+}
+
+class B extends A {}
+typedef C = B;
+''');
+ }
}
diff --git a/pkg/analyzer/test/src/diagnostics/subtype_of_struct_class_test.dart b/pkg/analyzer/test/src/diagnostics/subtype_of_struct_class_test.dart
index e52db81..00380d1 100644
--- a/pkg/analyzer/test/src/diagnostics/subtype_of_struct_class_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/subtype_of_struct_class_test.dart
@@ -39,7 +39,7 @@
class S extends Struct {}
class C implements S {}
''', [
- error(FfiCode.EMPTY_STRUCT_WARNING, 19, 25),
+ error(FfiCode.EMPTY_STRUCT, 19, 25),
error(FfiCode.SUBTYPE_OF_STRUCT_CLASS_IN_IMPLEMENTS, 64, 1),
]);
}
@@ -53,7 +53,7 @@
class S extends Struct {}
class C with S {}
''', [
- error(FfiCode.EMPTY_STRUCT_WARNING, 19, 25),
+ error(FfiCode.EMPTY_STRUCT, 19, 25),
error(CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT, 58, 1),
error(FfiCode.SUBTYPE_OF_STRUCT_CLASS_IN_WITH, 58, 1),
]);
diff --git a/pkg/analyzer/test/src/diagnostics/unnecessary_cast_test.dart b/pkg/analyzer/test/src/diagnostics/unnecessary_cast_test.dart
index e0e6397..0735628 100644
--- a/pkg/analyzer/test/src/diagnostics/unnecessary_cast_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/unnecessary_cast_test.dart
@@ -16,7 +16,9 @@
@reflectiveTest
class UnnecessaryCastTest extends PubPackageResolutionTest
- with WithoutNullSafetyMixin {
+ with UnnecessaryCastTestCases, WithoutNullSafetyMixin {}
+
+mixin UnnecessaryCastTestCases on PubPackageResolutionTest {
test_conditionalExpression_changesResultType_left() async {
await assertNoErrorsInCode(r'''
class A {}
@@ -216,8 +218,8 @@
}
@reflectiveTest
-class UnnecessaryCastTestWithNullSafety extends UnnecessaryCastTest
- with WithNullSafetyMixin {
+class UnnecessaryCastTestWithNullSafety extends PubPackageResolutionTest
+ with UnnecessaryCastTestCases {
test_interfaceType_star_toNone() async {
newFile('$testPackageLibPath/a.dart', content: r'''
// @dart = 2.7
@@ -254,4 +256,15 @@
error(HintCode.IMPORT_OF_LEGACY_LIBRARY_INTO_NULL_SAFE, 7, 8),
]);
}
+
+ test_type_type_asInterfaceTypeTypedef() async {
+ await assertErrorsInCode(r'''
+typedef N = num;
+void f(num a) {
+ a as N;
+}
+''', [
+ error(HintCode.UNNECESSARY_CAST, 35, 6),
+ ]);
+ }
}
diff --git a/pkg/analyzer/test/src/util/either_test.dart b/pkg/analyzer/test/src/util/either_test.dart
new file mode 100644
index 0000000..52f4799
--- /dev/null
+++ b/pkg/analyzer/test/src/util/either_test.dart
@@ -0,0 +1,26 @@
+// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analyzer/src/util/either.dart';
+import 'package:test/test.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+main() {
+ defineReflectiveSuite(() {
+ defineReflectiveTests(Either2Test);
+ });
+}
+
+@reflectiveTest
+class Either2Test {
+ void test_map_t1() {
+ var either = Either2<int, String>.t1(1);
+ expect(either.map((x) => x + 2, (_) => throw 'unexpected'), 3);
+ }
+
+ void test_map_t2() {
+ var either = Either2<int, String>.t2('hello');
+ expect(either.map((_) => throw 'unexpected', (x) => x.length), 5);
+ }
+}
diff --git a/pkg/analyzer/test/src/util/test_all.dart b/pkg/analyzer/test/src/util/test_all.dart
index 4e0f8dd..33a0f03 100644
--- a/pkg/analyzer/test/src/util/test_all.dart
+++ b/pkg/analyzer/test/src/util/test_all.dart
@@ -5,6 +5,7 @@
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'asserts_test.dart' as asserts_test;
+import 'either_test.dart' as either_test;
import 'glob_test.dart' as glob_test;
import 'lru_map_test.dart' as lru_map_test;
import 'yaml_test.dart' as yaml_test;
@@ -13,6 +14,7 @@
main() {
defineReflectiveSuite(() {
asserts_test.main();
+ either_test.main();
glob_test.main();
lru_map_test.main();
yaml_test.main();
diff --git a/pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart b/pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart
index 362f6ac..83c5b04 100644
--- a/pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart
+++ b/pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart
@@ -1450,7 +1450,7 @@
}
addReplacement(range.node(typeAnnotation), (EditBuilder builder) {
- var futureType = typeProvider.futureType2(type);
+ var futureType = typeProvider.futureType(type);
if (!(builder as DartEditBuilder).writeType(futureType)) {
builder.write('void');
}
diff --git a/pkg/compiler/test/codegen/codegen_test_helper.dart b/pkg/compiler/test/codegen/codegen_test_helper.dart
index b07f28a..f28f670 100644
--- a/pkg/compiler/test/codegen/codegen_test_helper.dart
+++ b/pkg/compiler/test/codegen/codegen_test_helper.dart
@@ -33,7 +33,7 @@
shards: 2,
directory: 'data',
skip: skip,
- options: ['--enable-experiment=non-nullable', Flags.soundNullSafety]);
+ options: [Flags.soundNullSafety]);
}
runTests2(List<String> args, [int shardIndex]) {
diff --git a/pkg/compiler/tool/modular_test_suite.dart b/pkg/compiler/tool/modular_test_suite.dart
index 2809f33..0aa6ebe 100644
--- a/pkg/compiler/tool/modular_test_suite.dart
+++ b/pkg/compiler/tool/modular_test_suite.dart
@@ -219,7 +219,6 @@
.expand((m) => ['--input-linked', '${toUri(m, dillId)}'])),
...(sources.expand((String uri) => ['--source', uri])),
...(flags.expand((String flag) => ['--enable-experiment', flag])),
- '--enable-experiment=non-nullable',
];
var result =
diff --git a/pkg/dartdev/test/commands/pub_test.dart b/pkg/dartdev/test/commands/pub_test.dart
index e164858..ab5b715 100644
--- a/pkg/dartdev/test/commands/pub_test.dart
+++ b/pkg/dartdev/test/commands/pub_test.dart
@@ -71,26 +71,6 @@
expect(result.stderr, result2.stderr);
});
- test('run --enable-experiment', () {
- p = project();
- p.file('bin/main.dart',
- "void main() { int? a; a = null; print('a is \$a.'); }");
-
- // run 'pub get'
- p.runSync(['pub', 'get']);
-
- var result = p.runSync(
- ['pub', 'run', '--enable-experiment=no-non-nullable', 'main.dart']);
-
- expect(result.exitCode, 254);
- expect(result.stdout, isEmpty);
- expect(
- result.stderr,
- contains('bin/main.dart:1:18: Error: This requires the null safety '
- 'language feature, which requires language version of 2.12 or '
- 'higher.\n'));
- });
-
test('failure', () {
p = project(mainSrc: 'int get foo => 1;\n');
var result = p.runSync(['pub', 'deps']);
diff --git a/pkg/dartdev/test/utils.dart b/pkg/dartdev/test/utils.dart
index de507c1..b6b7032 100644
--- a/pkg/dartdev/test/utils.dart
+++ b/pkg/dartdev/test/utils.dart
@@ -2,6 +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 'dart:convert';
import 'dart:io';
import 'package:path/path.dart' as path;
@@ -91,7 +92,8 @@
...arguments,
],
workingDirectory: workingDir ?? dir.path,
- environment: {if (logAnalytics) '_DARTDEV_LOG_ANALYTICS': 'true'});
+ environment: {if (logAnalytics) '_DARTDEV_LOG_ANALYTICS': 'true'},
+ stdoutEncoding: utf8);
}
Future<Process> start(
diff --git a/pkg/dev_compiler/tool/check_nnbd_sdk.dart b/pkg/dev_compiler/tool/check_nnbd_sdk.dart
index c329e26..e4b9028 100644
--- a/pkg/dev_compiler/tool/check_nnbd_sdk.dart
+++ b/pkg/dev_compiler/tool/check_nnbd_sdk.dart
@@ -117,15 +117,12 @@
var result = Process.runSync(dart.toFilePath(), [
// The NNBD dart binaries / snapshots require this flag to be enabled at
// VM level.
- if (analyzerSnapshot.contains('NNBD')) '--enable-experiment=non-nullable',
analyzerSnapshot,
'--dart-sdk=${sdkDir}',
'--format',
'machine',
'--sdk-warnings',
'--no-hints',
- '--enable-experiment',
- 'non-nullable',
emptyProgramUri.toFilePath()
]);
diff --git a/pkg/front_end/lib/src/api_prototype/standard_file_system.dart b/pkg/front_end/lib/src/api_prototype/standard_file_system.dart
index be0584e..bc1a4bc 100644
--- a/pkg/front_end/lib/src/api_prototype/standard_file_system.dart
+++ b/pkg/front_end/lib/src/api_prototype/standard_file_system.dart
@@ -8,9 +8,10 @@
import 'dart:io' as io;
-import '../fasta/compiler_context.dart' show CompilerContext;
import 'file_system.dart';
+import '../fasta/compiler_context.dart' show CompilerContext;
+
/// Concrete implementation of [FileSystem] handling standard URI schemes.
///
/// file: URIs are handled using file I/O.
@@ -63,7 +64,7 @@
Future<List<int>> readAsBytes() async {
try {
CompilerContext.recordDependency(uri);
- return await new io.File.fromUri(uri).readAsBytes();
+ return new io.File.fromUri(uri).readAsBytesSync();
} on io.FileSystemException catch (exception) {
throw _toFileSystemException(exception);
}
diff --git a/pkg/front_end/lib/src/api_unstable/vm.dart b/pkg/front_end/lib/src/api_unstable/vm.dart
index 9bfeea8..78acbcf 100644
--- a/pkg/front_end/lib/src/api_unstable/vm.dart
+++ b/pkg/front_end/lib/src/api_unstable/vm.dart
@@ -55,7 +55,6 @@
noLength,
templateFfiDartTypeMismatch,
templateFfiEmptyStruct,
- templateFfiEmptyStructWarning,
templateFfiExpectedExceptionalReturn,
templateFfiExpectedNoExceptionalReturn,
templateFfiExtendsOrImplementsSealedClass,
diff --git a/pkg/front_end/messages.yaml b/pkg/front_end/messages.yaml
index 44544f2..5d8cdd8 100644
--- a/pkg/front_end/messages.yaml
+++ b/pkg/front_end/messages.yaml
@@ -4249,13 +4249,6 @@
template: "Struct '#name' is empty. Empty structs are undefined behavior."
external: test/ffi_test.dart
-FfiEmptyStructWarning:
- # Used by dart:ffi
- template: "Struct '#name' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead."
- analyzerCode: EMPTY_STRUCT_WARNING
- severity: INFO
- external: test/ffi_test.dart
-
FfiTypeInvalid:
# Used by dart:ffi
template: "Expected type '#type' to be a valid and instantiated subtype of 'NativeType'."
diff --git a/pkg/front_end/test/fasta/testing/suite.dart b/pkg/front_end/test/fasta/testing/suite.dart
index 62858c6..6743621 100644
--- a/pkg/front_end/test/fasta/testing/suite.dart
+++ b/pkg/front_end/test/fasta/testing/suite.dart
@@ -788,7 +788,6 @@
try {
var args = <String>[];
if (experimentalFlags[ExperimentalFlag.nonNullable] == true) {
- args.add("--enable-experiment=non-nullable");
if (!context.weak) {
args.add("--sound-null-safety");
}
diff --git a/pkg/frontend_server/test/frontend_server_test.dart b/pkg/frontend_server/test/frontend_server_test.dart
index ea7932f..ee69ecb 100644
--- a/pkg/frontend_server/test/frontend_server_test.dart
+++ b/pkg/frontend_server/test/frontend_server_test.dart
@@ -1761,7 +1761,6 @@
'--output-dill=${dillFile.path}',
'--packages=${package_config.path}',
'--target=dartdevc',
- '--enable-experiment=non-nullable',
file.path,
];
@@ -1915,7 +1914,6 @@
'--output-dill=${dillFile.path}',
'--target=dartdevc',
'--packages=${package_config.path}',
- '--enable-experiment=non-nullable',
];
final StreamController<List<int>> streamController =
@@ -1996,7 +1994,6 @@
'--target=dartdevc',
'--packages=${package_config.path}',
'--experimental-emit-debug-metadata',
- '--enable-experiment=non-nullable',
];
final StreamController<List<int>> streamController =
@@ -2243,7 +2240,6 @@
'--output-dill=${dillFile.path}',
'--target=dartdevc',
'--packages=${package_config.path}',
- '--enable-experiment=non-nullable',
];
final StreamController<List<int>> streamController =
@@ -2362,7 +2358,6 @@
'--output-dill=${dillFile.path}',
'--target=dartdevc',
'--packages=${package_config.path}',
- '--enable-experiment=non-nullable'
];
final StreamController<List<int>> streamController =
diff --git a/pkg/nnbd_migration/lib/src/already_migrated_code_decorator.dart b/pkg/nnbd_migration/lib/src/already_migrated_code_decorator.dart
index b8c1649..7bc800c 100644
--- a/pkg/nnbd_migration/lib/src/already_migrated_code_decorator.dart
+++ b/pkg/nnbd_migration/lib/src/already_migrated_code_decorator.dart
@@ -114,7 +114,7 @@
var type = class_.thisType;
if (type.isDartAsyncFuture) {
// Add FutureOr<T> as a supertype of Future<T>.
- allSupertypes.add(_typeProvider.futureOrType2(type.typeArguments.single));
+ allSupertypes.add(_typeProvider.futureOrType(type.typeArguments.single));
}
return [
for (var t in allSupertypes)
diff --git a/pkg/nnbd_migration/lib/src/edge_builder.dart b/pkg/nnbd_migration/lib/src/edge_builder.dart
index 8138239..850669e 100644
--- a/pkg/nnbd_migration/lib/src/edge_builder.dart
+++ b/pkg/nnbd_migration/lib/src/edge_builder.dart
@@ -1639,7 +1639,7 @@
NullabilityNodeTarget.text('spread element type').withCodeRef(node);
if (_typeSystem.isSubtypeOf(spreadType, typeProvider.mapObjectObjectType)) {
assert(_currentMapKeyType != null && _currentMapValueType != null);
- final expectedType = typeProvider.mapType2(
+ final expectedType = typeProvider.mapType(
_currentMapKeyType.type, _currentMapValueType.type);
final expectedDecoratedType = DecoratedType.forImplicitType(
typeProvider, expectedType, _graph, target,
@@ -1651,7 +1651,7 @@
spreadType, typeProvider.iterableDynamicType)) {
assert(_currentLiteralElementType != null);
final expectedType =
- typeProvider.iterableType2(_currentLiteralElementType.type);
+ typeProvider.iterableType(_currentLiteralElementType.type);
final expectedDecoratedType = DecoratedType.forImplicitType(
typeProvider, expectedType, _graph, target,
typeArguments: [_currentLiteralElementType]);
@@ -2245,7 +2245,7 @@
DecoratedType _futureOf(DecoratedType type, AstNode node) =>
DecoratedType.forImplicitType(
typeProvider,
- typeProvider.futureType2(type.type),
+ typeProvider.futureType(type.type),
_graph,
NullabilityNodeTarget.text('implicit future').withCodeRef(node),
typeArguments: [type]);
@@ -3434,7 +3434,7 @@
// if T1 is FutureOr<S1> then T0 <: T1 iff any of the following hold:
// - either T0 <: Future<S1>
if (_typeSystem.isSubtypeOf(
- sourceType, typeProvider.futureType2(s1.type))) {
+ sourceType, typeProvider.futureType(s1.type))) {
// E.g. FutureOr<int> = (... as Future<int>)
// This is handled by the InterfaceType logic below, since we treat
// FutureOr as a supertype of Future.
diff --git a/pkg/nnbd_migration/test/already_migrated_code_decorator_test.dart b/pkg/nnbd_migration/test/already_migrated_code_decorator_test.dart
index b4d8508..57d6a9e 100644
--- a/pkg/nnbd_migration/test/already_migrated_code_decorator_test.dart
+++ b/pkg/nnbd_migration/test/already_migrated_code_decorator_test.dart
@@ -418,7 +418,7 @@
var class_ = element = ElementFactory.classElement3(
name: 'C',
typeParameters: [t],
- supertype: typeProvider.iterableType2(
+ supertype: typeProvider.iterableType(
t.instantiate(nullabilitySuffix: suffix),
),
);
diff --git a/pkg/nnbd_migration/test/fix_aggregator_test.dart b/pkg/nnbd_migration/test/fix_aggregator_test.dart
index c3eb5f2..de9e76a 100644
--- a/pkg/nnbd_migration/test/fix_aggregator_test.dart
+++ b/pkg/nnbd_migration/test/fix_aggregator_test.dart
@@ -1075,7 +1075,7 @@
var previewInfo = run({
expr: NodeChangeForExpression()
..introduceAs(
- nnbdTypeProvider.mapType2(
+ nnbdTypeProvider.mapType(
nnbdTypeProvider.intType, nnbdTypeProvider.boolType),
_MockInfo())
});
diff --git a/pkg/nnbd_migration/test/migration_visitor_test_base.dart b/pkg/nnbd_migration/test/migration_visitor_test_base.dart
index 5ed5feb..f65f280 100644
--- a/pkg/nnbd_migration/test/migration_visitor_test_base.dart
+++ b/pkg/nnbd_migration/test/migration_visitor_test_base.dart
@@ -80,13 +80,13 @@
DecoratedType future(DecoratedType parameter, {NullabilityNode node}) {
return DecoratedType(
- typeProvider.futureType2(parameter.type), node ?? newNode(),
+ typeProvider.futureType(parameter.type), node ?? newNode(),
typeArguments: [parameter]);
}
DecoratedType futureOr(DecoratedType parameter, {NullabilityNode node}) {
return DecoratedType(
- typeProvider.futureOrType2(parameter.type), node ?? newNode(),
+ typeProvider.futureOrType(parameter.type), node ?? newNode(),
typeArguments: [parameter]);
}
@@ -95,11 +95,11 @@
DecoratedType iterable(DecoratedType elementType, {NullabilityNode node}) =>
DecoratedType(
- typeProvider.iterableType2(elementType.type), node ?? newNode(),
+ typeProvider.iterableType(elementType.type), node ?? newNode(),
typeArguments: [elementType]);
DecoratedType list(DecoratedType elementType, {NullabilityNode node}) =>
- DecoratedType(typeProvider.listType2(elementType.type), node ?? newNode(),
+ DecoratedType(typeProvider.listType(elementType.type), node ?? newNode(),
typeArguments: [elementType]);
NullabilityNode newNode() => NullabilityNode.forTypeAnnotation(
diff --git a/pkg/vm/lib/transformations/ffi_definitions.dart b/pkg/vm/lib/transformations/ffi_definitions.dart
index 5c114c2..10cfe47 100644
--- a/pkg/vm/lib/transformations/ffi_definitions.dart
+++ b/pkg/vm/lib/transformations/ffi_definitions.dart
@@ -9,7 +9,6 @@
import 'package:front_end/src/api_unstable/vm.dart'
show
templateFfiEmptyStruct,
- templateFfiEmptyStructWarning,
templateFfiFieldAnnotation,
templateFfiFieldCyclic,
templateFfiFieldNoAnnotation,
@@ -427,11 +426,8 @@
_annoteStructWithFields(node, types);
if (types.isEmpty) {
- diagnosticReporter.report(
- templateFfiEmptyStructWarning.withArguments(node.name),
- node.fileOffset,
- node.name.length,
- node.location.file);
+ diagnosticReporter.report(templateFfiEmptyStruct.withArguments(node.name),
+ node.fileOffset, node.name.length, node.location.file);
emptyStructs.add(node);
}
diff --git a/runtime/bin/BUILD.gn b/runtime/bin/BUILD.gn
index 40ff303..5eae1d9 100644
--- a/runtime/bin/BUILD.gn
+++ b/runtime/bin/BUILD.gn
@@ -496,7 +496,6 @@
isolate_snapshot_instructions,
]
args = [
- "--enable-experiment=non-nullable",
"--sound-null-safety",
"--deterministic",
"--snapshot_kind=" + dart_core_snapshot_kind,
diff --git a/runtime/observatory/tests/service/get_vm_timeline_rpc_test.dart b/runtime/observatory/tests/service/get_vm_timeline_rpc_test.dart
index 80f8741..d0bfa3e 100644
--- a/runtime/observatory/tests/service/get_vm_timeline_rpc_test.dart
+++ b/runtime/observatory/tests/service/get_vm_timeline_rpc_test.dart
@@ -111,7 +111,9 @@
Map arguments = event['args'];
expect(arguments, isA<Map>());
expect(arguments['isolateGroupId'], isA<String>());
- if (!const ['GC', 'Compiler', 'CompilerVerbose'].contains(event['cat'])) {
+ if (!const ['GC', 'Compiler', 'CompilerVerbose'].contains(event['cat']) &&
+ !const ['FinishTopLevelClassLoading', 'FinishClassLoading']
+ .contains(event['name'])) {
expect(arguments['isolateId'], isA<String>());
}
}
diff --git a/runtime/observatory/tests/service/service_kernel.status b/runtime/observatory/tests/service/service_kernel.status
index aa164a1..dab0b31 100644
--- a/runtime/observatory/tests/service/service_kernel.status
+++ b/runtime/observatory/tests/service/service_kernel.status
@@ -2,6 +2,8 @@
# 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.
+valid_source_locations_test: Pass, Slow
+
[ $compiler == app_jitk ]
add_breakpoint_rpc_kernel_test: SkipByDesign # No incremental compiler available.
async_generator_breakpoint_test: SkipByDesign # No incremental compiler available.
diff --git a/runtime/observatory_2/tests/service_2/get_vm_timeline_rpc_test.dart b/runtime/observatory_2/tests/service_2/get_vm_timeline_rpc_test.dart
index 1be667e..94e2654 100644
--- a/runtime/observatory_2/tests/service_2/get_vm_timeline_rpc_test.dart
+++ b/runtime/observatory_2/tests/service_2/get_vm_timeline_rpc_test.dart
@@ -111,7 +111,9 @@
Map arguments = event['args'];
expect(arguments, isA<Map>());
expect(arguments['isolateGroupId'], isA<String>());
- if (!const ['GC', 'Compiler', 'CompilerVerbose'].contains(event['cat'])) {
+ if (!const ['GC', 'Compiler', 'CompilerVerbose'].contains(event['cat']) &&
+ !const ['FinishTopLevelClassLoading', 'FinishClassLoading']
+ .contains(event['name'])) {
expect(arguments['isolateId'], isA<String>());
}
}
diff --git a/runtime/observatory_2/tests/service_2/service_2_kernel.status b/runtime/observatory_2/tests/service_2/service_2_kernel.status
index 092bab9..472d995 100644
--- a/runtime/observatory_2/tests/service_2/service_2_kernel.status
+++ b/runtime/observatory_2/tests/service_2/service_2_kernel.status
@@ -2,6 +2,8 @@
# 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.
+valid_source_locations_test: Pass, Slow
+
[ $compiler == app_jitk ]
add_breakpoint_rpc_kernel_test: SkipByDesign # No incremental compiler available.
async_generator_breakpoint_test: SkipByDesign # No incremental compiler available.
diff --git a/runtime/tests/vm/dart/null_safety_autodetection_in_kernel_compiler_test.dart b/runtime/tests/vm/dart/null_safety_autodetection_in_kernel_compiler_test.dart
index 4244601..1c13f65 100644
--- a/runtime/tests/vm/dart/null_safety_autodetection_in_kernel_compiler_test.dart
+++ b/runtime/tests/vm/dart/null_safety_autodetection_in_kernel_compiler_test.dart
@@ -29,7 +29,6 @@
await runGenKernelWithoutStandardOptions('BUILD DILL FILE', [
"--platform",
platformDill,
- '--enable-experiment=non-nullable',
'--output=$testDillPath',
testScriptPath,
]);
diff --git a/runtime/tests/vm/dart/type_casts_with_null_safety_autodetection_test.dart b/runtime/tests/vm/dart/type_casts_with_null_safety_autodetection_test.dart
index 4b38663..67c7d85 100644
--- a/runtime/tests/vm/dart/type_casts_with_null_safety_autodetection_test.dart
+++ b/runtime/tests/vm/dart/type_casts_with_null_safety_autodetection_test.dart
@@ -22,7 +22,6 @@
// Do not add Platform.executableArguments into arguments to avoid passing
// --sound-null-safety / --no-sound-null-safety arguments.
final result = await runBinary("RUN $script", Platform.executable, [
- '--enable-experiment=non-nullable',
'--deterministic',
'--optimization-counter-threshold=10',
'--packages=${Platform.packageConfig}',
diff --git a/runtime/tests/vm/dart_2/null_safety_autodetection_in_kernel_compiler_test.dart b/runtime/tests/vm/dart_2/null_safety_autodetection_in_kernel_compiler_test.dart
index 4244601..1c13f65 100644
--- a/runtime/tests/vm/dart_2/null_safety_autodetection_in_kernel_compiler_test.dart
+++ b/runtime/tests/vm/dart_2/null_safety_autodetection_in_kernel_compiler_test.dart
@@ -29,7 +29,6 @@
await runGenKernelWithoutStandardOptions('BUILD DILL FILE', [
"--platform",
platformDill,
- '--enable-experiment=non-nullable',
'--output=$testDillPath',
testScriptPath,
]);
diff --git a/runtime/vm/BUILD.gn b/runtime/vm/BUILD.gn
index 6fca249..93534de 100644
--- a/runtime/vm/BUILD.gn
+++ b/runtime/vm/BUILD.gn
@@ -183,7 +183,6 @@
args += [
"-Ddart.vm.product=$is_product_flag",
"-Ddart.isVM=true",
- "--enable-experiment=non-nullable",
"--nnbd-agnostic",
]
if (defined(invoker.exclude_source) && invoker.exclude_source) {
diff --git a/runtime/vm/isolate.h b/runtime/vm/isolate.h
index d3a0ba6..65c9a17 100644
--- a/runtime/vm/isolate.h
+++ b/runtime/vm/isolate.h
@@ -187,11 +187,11 @@
V(NONPRODUCT, asserts, EnableAsserts, enable_asserts, FLAG_enable_asserts) \
V(NONPRODUCT, use_field_guards, UseFieldGuards, use_field_guards, \
FLAG_use_field_guards) \
+ V(PRODUCT, should_load_vmservice_library, ShouldLoadVmService, \
+ load_vmservice_library, false) \
V(NONPRODUCT, use_osr, UseOsr, use_osr, FLAG_use_osr)
#define BOOL_ISOLATE_FLAG_LIST_DEFAULT_GETTER(V) \
- V(PRODUCT, should_load_vmservice_library, ShouldLoadVmService, \
- load_vmservice_library, false) \
V(PRODUCT, copy_parent_code, CopyParentCode, copy_parent_code, false) \
V(PRODUCT, is_system_isolate, IsSystemIsolate, is_system_isolate, false)
@@ -512,6 +512,14 @@
return null_safety() || FLAG_strict_null_safety_checks;
}
+ bool should_load_vmservice() const {
+ return ShouldLoadVmServiceBit::decode(isolate_group_flags_);
+ }
+ void set_should_load_vmservice(bool value) {
+ isolate_group_flags_ =
+ ShouldLoadVmServiceBit::update(value, isolate_group_flags_);
+ }
+
#if !defined(PRODUCT)
#if !defined(DART_PRECOMPILED_RUNTIME)
bool HasAttemptedReload() const {
@@ -820,6 +828,7 @@
V(HasAttemptedReload) \
V(NullSafety) \
V(RemappingCids) \
+ V(ShouldLoadVmService) \
V(NullSafetySet) \
V(Obfuscate) \
V(UseFieldGuards) \
@@ -1360,13 +1369,6 @@
FLAG_randomize_optimization_counter;
}
- bool should_load_vmservice() const {
- return ShouldLoadVmServiceBit::decode(isolate_flags_);
- }
- void set_should_load_vmservice(bool value) {
- isolate_flags_ = ShouldLoadVmServiceBit::update(value, isolate_flags_);
- }
-
const DispatchTable* dispatch_table() const {
return group()->dispatch_table();
}
@@ -1556,7 +1558,6 @@
V(HasAttemptedStepping) \
V(ShouldPausePostServiceRequest) \
V(CopyParentCode) \
- V(ShouldLoadVmService) \
V(IsSystemIsolate)
// Isolate specific flags.
@@ -1764,9 +1765,11 @@
//
// This can be used in code (e.g. GC, Kernel Loader) that should not operate on
// an individual isolate.
-class NoActiveIsolateScope {
+class NoActiveIsolateScope : public StackResource {
public:
- NoActiveIsolateScope() : thread_(Thread::Current()) {
+ NoActiveIsolateScope()
+ : StackResource(Thread::Current()),
+ thread_(static_cast<Thread*>(thread())) {
saved_isolate_ = thread_->isolate_;
thread_->isolate_ = nullptr;
}
diff --git a/runtime/vm/kernel_loader.cc b/runtime/vm/kernel_loader.cc
index 04b3b430..977686f 100644
--- a/runtime/vm/kernel_loader.cc
+++ b/runtime/vm/kernel_loader.cc
@@ -238,6 +238,7 @@
Object& KernelLoader::LoadEntireProgram(Program* program,
bool process_pending_classes) {
Thread* thread = Thread::Current();
+
TIMELINE_DURATION(thread, Isolate, "LoadKernel");
if (program->is_single_program()) {
@@ -772,6 +773,8 @@
}
void KernelLoader::LoadLibrary(const Library& library) {
+ NoActiveIsolateScope no_active_isolate_scope;
+
// This will be invoked by VM bootstrapping code.
SafepointWriteRwLocker ml(thread_, thread_->isolate_group()->program_lock());
@@ -986,6 +989,8 @@
"not allowed");
}
+ NoActiveIsolateScope no_active_isolate_scope;
+
// Read library index.
library_kernel_offset_ = library_offset(index);
correction_offset_ = library_kernel_offset_;
@@ -1001,7 +1006,7 @@
LibraryHelper library_helper(&helper_, kernel_binary_version_);
library_helper.ReadUntilIncluding(LibraryHelper::kCanonicalName);
- if (!FLAG_precompiled_mode && !I->should_load_vmservice()) {
+ if (!FLAG_precompiled_mode && !IG->should_load_vmservice()) {
StringIndex lib_name_index =
H.CanonicalNameString(library_helper.canonical_name_);
if (H.StringEquals(lib_name_index, kVMServiceIOLibraryUri)) {
@@ -1791,6 +1796,8 @@
}
void KernelLoader::FinishLoading(const Class& klass) {
+ NoActiveIsolateScope no_active_isolate_scope;
+
ASSERT(klass.IsTopLevel() || (klass.kernel_offset() > 0));
Zone* zone = Thread::Current()->zone();
diff --git a/runtime/vm/kernel_loader.h b/runtime/vm/kernel_loader.h
index 6245e6f..dec4c98 100644
--- a/runtime/vm/kernel_loader.h
+++ b/runtime/vm/kernel_loader.h
@@ -214,16 +214,16 @@
intptr_t kernel_buffer_length,
const String& url);
- void FinishTopLevelClassLoading(const Class& toplevel_class,
- const Library& library,
- const LibraryIndex& library_index);
-
static void FinishLoading(const Class& klass);
void ReadObfuscationProhibitions();
void ReadLoadingUnits();
private:
+ void FinishTopLevelClassLoading(const Class& toplevel_class,
+ const Library& library,
+ const LibraryIndex& library_index);
+
// Check for the presence of a (possibly const) constructor for the
// 'ExternalName' class. If found, returns the name parameter to the
// constructor.
diff --git a/samples/ffi/resource_management/utf8_helpers.dart b/samples/ffi/resource_management/utf8_helpers.dart
index ed7b4a1..a27ccd6 100644
--- a/samples/ffi/resource_management/utf8_helpers.dart
+++ b/samples/ffi/resource_management/utf8_helpers.dart
@@ -30,8 +30,11 @@
/// characters before the first null byte.
int get strlen {
final Pointer<Uint8> array = this.cast<Uint8>();
- final Uint8List nativeString = array.asTypedList(_maxSize);
- return nativeString.indexWhere((char) => char == 0);
+ int length = 0;
+ while (array[length] != 0) {
+ length++;
+ }
+ return length;
}
/// Creates a [String] containing the characters UTF-8 encoded in [this].
@@ -47,7 +50,3 @@
this.cast<Uint8>().asTypedList(length).buffer, 0, length));
}
}
-
-const int _kMaxSmi64 = (1 << 62) - 1;
-const int _kMaxSmi32 = (1 << 30) - 1;
-final int _maxSize = sizeOf<IntPtr>() == 8 ? _kMaxSmi64 : _kMaxSmi32;
diff --git a/samples_2/ffi/resource_management/utf8_helpers.dart b/samples_2/ffi/resource_management/utf8_helpers.dart
index e1d555b..f3d574d 100644
--- a/samples_2/ffi/resource_management/utf8_helpers.dart
+++ b/samples_2/ffi/resource_management/utf8_helpers.dart
@@ -34,8 +34,11 @@
/// characters before the first null byte.
int get strlen {
final Pointer<Uint8> array = this.cast<Uint8>();
- final Uint8List nativeString = array.asTypedList(_maxSize);
- return nativeString.indexWhere((char) => char == 0);
+ int length = 0;
+ while (array[length] != 0) {
+ length++;
+ }
+ return length;
}
/// Creates a [String] containing the characters UTF-8 encoded in [this].
@@ -51,7 +54,3 @@
this.cast<Uint8>().asTypedList(length).buffer, 0, length));
}
}
-
-const int _kMaxSmi64 = (1 << 62) - 1;
-const int _kMaxSmi32 = (1 << 30) - 1;
-final int _maxSize = sizeOf<IntPtr>() == 8 ? _kMaxSmi64 : _kMaxSmi32;
diff --git a/sdk/bin/dart2js b/sdk/bin/dart2js
index 9c562ec..cfc91b1 100755
--- a/sdk/bin/dart2js
+++ b/sdk/bin/dart2js
@@ -52,4 +52,4 @@
DART2JS="package:compiler/src/dart2js.dart"
-exec "$DART" "--packages=$DART_ROOT/.packages" --enable-experiment=non-nullable "${EXTRA_VM_OPTIONS[@]}" "$DART2JS" "${EXTRA_OPTIONS[@]}" "$@"
+exec "$DART" "--packages=$DART_ROOT/.packages" "${EXTRA_VM_OPTIONS[@]}" "$DART2JS" "${EXTRA_OPTIONS[@]}" "$@"
diff --git a/sdk/bin/dart2js_sdk b/sdk/bin/dart2js_sdk
index 03999f9..e7999b4 100755
--- a/sdk/bin/dart2js_sdk
+++ b/sdk/bin/dart2js_sdk
@@ -55,4 +55,4 @@
EXTRA_VM_OPTIONS+=("${OPTIONS[@]}")
fi
-exec "$DART" --enable-experiment=non-nullable "${EXTRA_VM_OPTIONS[@]}" "$SNAPSHOT" "${EXTRA_OPTIONS[@]}" "$@"
+exec "$DART" "${EXTRA_VM_OPTIONS[@]}" "$SNAPSHOT" "${EXTRA_OPTIONS[@]}" "$@"
diff --git a/tests/ffi/vmspecific_static_checks_test.dart b/tests/ffi/vmspecific_static_checks_test.dart
index d0ee2a5..832d1ad 100644
--- a/tests/ffi/vmspecific_static_checks_test.dart
+++ b/tests/ffi/vmspecific_static_checks_test.dart
@@ -528,7 +528,7 @@
external Pointer notEmpty;
}
-class EmptyStruct extends Struct {} //# 1099: ok
+class EmptyStruct extends Struct {} //# 1099: compile-time error
class EmptyStruct extends Struct {} //# 1100: compile-time error
diff --git a/tests/ffi_2/vmspecific_static_checks_test.dart b/tests/ffi_2/vmspecific_static_checks_test.dart
index ac72dd9..b6a0451 100644
--- a/tests/ffi_2/vmspecific_static_checks_test.dart
+++ b/tests/ffi_2/vmspecific_static_checks_test.dart
@@ -526,7 +526,7 @@
Pointer notEmpty;
}
-class EmptyStruct extends Struct {} //# 1099: ok
+class EmptyStruct extends Struct {} //# 1099: compile-time error
class EmptyStruct extends Struct {} //# 1100: compile-time error
diff --git a/tests/language/nnbd/flow_analysis/issue41981_error_test.dart b/tests/language/nnbd/flow_analysis/issue41981_error_test.dart
index 6fc5ceb..905982a 100644
--- a/tests/language/nnbd/flow_analysis/issue41981_error_test.dart
+++ b/tests/language/nnbd/flow_analysis/issue41981_error_test.dart
@@ -7,7 +7,6 @@
// variable, because promotion to `Never` causes the code to be considered
// unreachable.
-// SharedOptions=--enable-experiment=non-nullable
main() {
late int i;
diff --git a/tests/language/nnbd/flow_analysis/issue43093_test.dart b/tests/language/nnbd/flow_analysis/issue43093_test.dart
index a0b9586..ce30ab6 100644
--- a/tests/language/nnbd/flow_analysis/issue43093_test.dart
+++ b/tests/language/nnbd/flow_analysis/issue43093_test.dart
@@ -6,7 +6,6 @@
// expression would corrupt the state of flow analysis, causing a crash when
// trying to finish analyzing an enclosing `if` statement.
-// SharedOptions=--enable-experiment=non-nullable
import 'package:expect/expect.dart';
class C {
diff --git a/tests/language/nnbd/flow_analysis/late_var_assigned_in_try_test.dart b/tests/language/nnbd/flow_analysis/late_var_assigned_in_try_test.dart
index f0fca1a..9b71ca5 100644
--- a/tests/language/nnbd/flow_analysis/late_var_assigned_in_try_test.dart
+++ b/tests/language/nnbd/flow_analysis/late_var_assigned_in_try_test.dart
@@ -6,7 +6,6 @@
// read in a catch or finally block, that there is no compile-time error,
// because the assignment might happen prior to the exception occurring.
-// SharedOptions=--enable-experiment=non-nullable
import 'package:expect/expect.dart';
void tryCatch() {
diff --git a/tests/language/nnbd/flow_analysis/late_var_used_before_assignment_in_local_function_ok_test.dart b/tests/language/nnbd/flow_analysis/late_var_used_before_assignment_in_local_function_ok_test.dart
index aaf6a87..cee3a10 100644
--- a/tests/language/nnbd/flow_analysis/late_var_used_before_assignment_in_local_function_ok_test.dart
+++ b/tests/language/nnbd/flow_analysis/late_var_used_before_assignment_in_local_function_ok_test.dart
@@ -7,7 +7,6 @@
// that the assignment might occur before the read, that there is no
// compile-time error.
-// SharedOptions=--enable-experiment=non-nullable
import 'package:expect/expect.dart';
// First scenario: the variable is written inside the function, and the read
diff --git a/tests/language/nnbd/flow_analysis/late_var_used_before_assignment_in_loop_test.dart b/tests/language/nnbd/flow_analysis/late_var_used_before_assignment_in_loop_test.dart
index 09eef1c..46f549c 100644
--- a/tests/language/nnbd/flow_analysis/late_var_used_before_assignment_in_loop_test.dart
+++ b/tests/language/nnbd/flow_analysis/late_var_used_before_assignment_in_loop_test.dart
@@ -7,7 +7,6 @@
// that there is no compile-time error, because the assignment may happen in an
// earlier iteration than the read.
-// SharedOptions=--enable-experiment=non-nullable
import 'package:expect/expect.dart';
void forLoop() {
diff --git a/tests/language/nnbd/flow_analysis/late_var_used_before_assignment_in_switch_error_test.dart b/tests/language/nnbd/flow_analysis/late_var_used_before_assignment_in_switch_error_test.dart
index b8f5e63..5c50785 100644
--- a/tests/language/nnbd/flow_analysis/late_var_used_before_assignment_in_switch_error_test.dart
+++ b/tests/language/nnbd/flow_analysis/late_var_used_before_assignment_in_switch_error_test.dart
@@ -8,7 +8,6 @@
// compile-time error, because the variable is unassigned on all possible
// control flow paths to the read.
-// SharedOptions=--enable-experiment=non-nullable
import 'package:expect/expect.dart';
void switchBad(int value) {
diff --git a/tests/language/nnbd/flow_analysis/late_var_used_before_assignment_in_switch_test.dart b/tests/language/nnbd/flow_analysis/late_var_used_before_assignment_in_switch_test.dart
index edb6b6e..8d2b6df 100644
--- a/tests/language/nnbd/flow_analysis/late_var_used_before_assignment_in_switch_test.dart
+++ b/tests/language/nnbd/flow_analysis/late_var_used_before_assignment_in_switch_test.dart
@@ -7,7 +7,6 @@
// the assignment occurs somewhere in the switch, that there is no compile-time
// error, because the assignment may happen prior to a branch to the label.
-// SharedOptions=--enable-experiment=non-nullable
import 'package:expect/expect.dart';
void switchOk(int one) {
diff --git a/tests/language/nnbd/flow_analysis/unreachable_via_getter_get_error_test.dart b/tests/language/nnbd/flow_analysis/unreachable_via_getter_get_error_test.dart
index c7aaf26..f6135fb 100644
--- a/tests/language/nnbd/flow_analysis/unreachable_via_getter_get_error_test.dart
+++ b/tests/language/nnbd/flow_analysis/unreachable_via_getter_get_error_test.dart
@@ -5,7 +5,6 @@
// This test verifies that if a read is performed on a getter whose type is
// `Never?`, the resulting code block is considered reachable by flow analysis.
-// SharedOptions=--enable-experiment=non-nullable
Never? get neverQuestionGetter => null;
diff --git a/tests/language/nnbd/flow_analysis/unreachable_via_getter_get_test.dart b/tests/language/nnbd/flow_analysis/unreachable_via_getter_get_test.dart
index af54180..26d5011 100644
--- a/tests/language/nnbd/flow_analysis/unreachable_via_getter_get_test.dart
+++ b/tests/language/nnbd/flow_analysis/unreachable_via_getter_get_test.dart
@@ -5,7 +5,6 @@
// This test verifies that if a read is performed on a getter whose type is
// `Never`, the resulting code block is considered unreachable by flow analysis.
-// SharedOptions=--enable-experiment=non-nullable
import 'package:expect/expect.dart';
Never get neverGetter => throw 'x';
diff --git a/tests/language/nnbd/flow_analysis/unreachable_via_invocation_error_test.dart b/tests/language/nnbd/flow_analysis/unreachable_via_invocation_error_test.dart
index 8cd5ce7..d836304 100644
--- a/tests/language/nnbd/flow_analysis/unreachable_via_invocation_error_test.dart
+++ b/tests/language/nnbd/flow_analysis/unreachable_via_invocation_error_test.dart
@@ -5,7 +5,6 @@
// This test verifies that if a method is invoked whose return type is `Never?`,
// the resulting code block is considered reachable by flow analysis.
-// SharedOptions=--enable-experiment=non-nullable
Never? neverQuestionFunction() => null;
diff --git a/tests/language/nnbd/flow_analysis/unreachable_via_invocation_test.dart b/tests/language/nnbd/flow_analysis/unreachable_via_invocation_test.dart
index d059c4d..657cc09 100644
--- a/tests/language/nnbd/flow_analysis/unreachable_via_invocation_test.dart
+++ b/tests/language/nnbd/flow_analysis/unreachable_via_invocation_test.dart
@@ -5,7 +5,6 @@
// This test verifies that if a method is invoked whose return type is `Never`,
// the resulting code block is considered unreachable by flow analysis.
-// SharedOptions=--enable-experiment=non-nullable
import 'package:expect/expect.dart';
Never neverFunction() => throw 'x';
diff --git a/tests/language/nnbd/flow_analysis/unreachable_via_promotion_error_test.dart b/tests/language/nnbd/flow_analysis/unreachable_via_promotion_error_test.dart
index 4687597..0e12a22 100644
--- a/tests/language/nnbd/flow_analysis/unreachable_via_promotion_error_test.dart
+++ b/tests/language/nnbd/flow_analysis/unreachable_via_promotion_error_test.dart
@@ -6,7 +6,6 @@
// resulting code block is considered reachable by flow analysis. This is in
// contrast to promotion to `Never`, which is considered unreachable.
-// SharedOptions=--enable-experiment=non-nullable
void promoteViaIsCheck(Object x, Object? y) {
if (x is! int) {
if (y is Never?) {
diff --git a/tests/language/nnbd/flow_analysis/unreachable_via_promotion_test.dart b/tests/language/nnbd/flow_analysis/unreachable_via_promotion_test.dart
index 3bcc228..ef4df3b 100644
--- a/tests/language/nnbd/flow_analysis/unreachable_via_promotion_test.dart
+++ b/tests/language/nnbd/flow_analysis/unreachable_via_promotion_test.dart
@@ -6,7 +6,6 @@
// via an explicit `is` check or a comparison to `null`), the resulting code
// block is considered unreachable by flow analysis.
-// SharedOptions=--enable-experiment=non-nullable
import 'package:expect/expect.dart';
void promoteViaIsCheck(Object x, Object? y) {
diff --git a/tests/language/nnbd/flow_analysis/unreachable_via_variable_get_error_test.dart b/tests/language/nnbd/flow_analysis/unreachable_via_variable_get_error_test.dart
index aa97c73..5c7634e 100644
--- a/tests/language/nnbd/flow_analysis/unreachable_via_variable_get_error_test.dart
+++ b/tests/language/nnbd/flow_analysis/unreachable_via_variable_get_error_test.dart
@@ -5,7 +5,6 @@
// This test verifies that if a read is performed on a variable whose type is
// `Never?`, the resulting code block is considered reachable by flow analysis.
-// SharedOptions=--enable-experiment=non-nullable
void explicitNeverQuestionType(Object x, bool b) {
Never? y = null;
diff --git a/tests/language/nnbd/flow_analysis/unreachable_via_variable_get_test.dart b/tests/language/nnbd/flow_analysis/unreachable_via_variable_get_test.dart
index 3330292..27b7d40 100644
--- a/tests/language/nnbd/flow_analysis/unreachable_via_variable_get_test.dart
+++ b/tests/language/nnbd/flow_analysis/unreachable_via_variable_get_test.dart
@@ -5,7 +5,6 @@
// This test verifies that if a read is performed on a variable whose type is
// `Never`, the resulting code block is considered unreachable by flow analysis.
-// SharedOptions=--enable-experiment=non-nullable
import 'package:expect/expect.dart';
void explicitNeverType(Never Function() f, Object x, bool b1, bool b2) {
diff --git a/tests/language/nnbd/operator_type_test.dart b/tests/language/nnbd/operator_type_test.dart
index 436ddda..497f0bb 100644
--- a/tests/language/nnbd/operator_type_test.dart
+++ b/tests/language/nnbd/operator_type_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
// Tests that language operators and constructrs requiring non-nullable values
// will not accept an operand with a nullable static type.
diff --git a/tests/language/nnbd/resolution/issue40931_test.dart b/tests/language/nnbd/resolution/issue40931_test.dart
index 0ea944d..6579324 100644
--- a/tests/language/nnbd/resolution/issue40931_test.dart
+++ b/tests/language/nnbd/resolution/issue40931_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
main() {}
diff --git a/tests/language/nnbd/resolution/issue41479_test.dart b/tests/language/nnbd/resolution/issue41479_test.dart
index bf6f6cd..f818072 100644
--- a/tests/language/nnbd/resolution/issue41479_test.dart
+++ b/tests/language/nnbd/resolution/issue41479_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
main() {
A a = A()..foo?.isEven;
diff --git a/tests/language/nnbd/resolution/null_assertion_null_type_test.dart b/tests/language/nnbd/resolution/null_assertion_null_type_test.dart
index 159731d..14f2060 100644
--- a/tests/language/nnbd/resolution/null_assertion_null_type_test.dart
+++ b/tests/language/nnbd/resolution/null_assertion_null_type_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
// Test that the trailing "!" properly promotes the type `Null` to `Never`, by
// verifying that it's statically ok to pass it to a function expecting a
diff --git a/tests/language/nnbd/resolution/question_dot_produces_nullable_type_test.dart b/tests/language/nnbd/resolution/question_dot_produces_nullable_type_test.dart
index bfb9388..1df74a7 100644
--- a/tests/language/nnbd/resolution/question_dot_produces_nullable_type_test.dart
+++ b/tests/language/nnbd/resolution/question_dot_produces_nullable_type_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
bool c = false;
diff --git a/tests/language/nnbd/resolution/question_question_lub_test.dart b/tests/language/nnbd/resolution/question_question_lub_test.dart
index beae0f8..12bafae 100644
--- a/tests/language/nnbd/resolution/question_question_lub_test.dart
+++ b/tests/language/nnbd/resolution/question_question_lub_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
// Test that `x ?? y` results in type LUB(x!, y)
void main() {
diff --git a/tests/language/nnbd/static_errors/await_in_late_local_variable_initializer_test.dart b/tests/language/nnbd/static_errors/await_in_late_local_variable_initializer_test.dart
index 4f39726..910106a 100644
--- a/tests/language/nnbd/static_errors/await_in_late_local_variable_initializer_test.dart
+++ b/tests/language/nnbd/static_errors/await_in_late_local_variable_initializer_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
// Test that it is a compile time error for a `late` variable initializer
// to use the `await` expression.
diff --git a/tests/language/nnbd/static_errors/default_value_on_required_parameter_test.dart b/tests/language/nnbd/static_errors/default_value_on_required_parameter_test.dart
index 7303897..f5a4532 100644
--- a/tests/language/nnbd/static_errors/default_value_on_required_parameter_test.dart
+++ b/tests/language/nnbd/static_errors/default_value_on_required_parameter_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
// Test that it is an error if a required named parameter has a default value.
main() {}
diff --git a/tests/language/nnbd/static_errors/equals_parameter_made_nullable_at_invoke_test.dart b/tests/language/nnbd/static_errors/equals_parameter_made_nullable_at_invoke_test.dart
index 2d6c7a6..f0d1441 100644
--- a/tests/language/nnbd/static_errors/equals_parameter_made_nullable_at_invoke_test.dart
+++ b/tests/language/nnbd/static_errors/equals_parameter_made_nullable_at_invoke_test.dart
@@ -3,7 +3,6 @@
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
-// SharedOptions=--enable-experiment=non-nullable
// Test that Object.operator==(Object o) is the signature of ==, but that we can
// still compare nullable values to Object.
diff --git a/tests/language/nnbd/static_errors/export_legacy_symbol_test.dart b/tests/language/nnbd/static_errors/export_legacy_symbol_test.dart
index 25ea45c..18d3483 100644
--- a/tests/language/nnbd/static_errors/export_legacy_symbol_test.dart
+++ b/tests/language/nnbd/static_errors/export_legacy_symbol_test.dart
@@ -5,7 +5,6 @@
// Can't run in strong mode since it contains a legacy library.
// Requirements=nnbd-weak
-// SharedOptions=--enable-experiment=non-nullable
import 'export_legacy_symbol_opted_out_library.dart';
diff --git a/tests/language/nnbd/static_errors/implicit_downcasts.dart b/tests/language/nnbd/static_errors/implicit_downcasts.dart
index 6d8b7b4..b19ce47 100644
--- a/tests/language/nnbd/static_errors/implicit_downcasts.dart
+++ b/tests/language/nnbd/static_errors/implicit_downcasts.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
// Test that it is an error to do what was once allowed as an "implicit
// downcast."
diff --git a/tests/language/nnbd/static_errors/late_final_field_with_const_constructor_test.dart b/tests/language/nnbd/static_errors/late_final_field_with_const_constructor_test.dart
index 30a931e..d7b3898 100644
--- a/tests/language/nnbd/static_errors/late_final_field_with_const_constructor_test.dart
+++ b/tests/language/nnbd/static_errors/late_final_field_with_const_constructor_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
// Test that it is not a compile time error for a `final` variable to not have
// an initializer if that variable is declared as `late`.
diff --git a/tests/language/nnbd/static_errors/late_final_without_initializer.dart b/tests/language/nnbd/static_errors/late_final_without_initializer.dart
index 8386210..9938078 100644
--- a/tests/language/nnbd/static_errors/late_final_without_initializer.dart
+++ b/tests/language/nnbd/static_errors/late_final_without_initializer.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
// Test that it is not a compile time error for a `final` variable to not have
// an initializer if that variable is declared as `late`.
diff --git a/tests/language/nnbd/static_errors/missing_default_value_for_parameter_test.dart b/tests/language/nnbd/static_errors/missing_default_value_for_parameter_test.dart
index ade2f39..08b7053 100644
--- a/tests/language/nnbd/static_errors/missing_default_value_for_parameter_test.dart
+++ b/tests/language/nnbd/static_errors/missing_default_value_for_parameter_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
// Test that it is an error if an optional parameter (named or otherwise) with
// no default value has a potentially non-nullable type.
diff --git a/tests/language/nnbd/static_errors/missing_required_argument_test.dart b/tests/language/nnbd/static_errors/missing_required_argument_test.dart
index 630c53d..f1201b5 100644
--- a/tests/language/nnbd/static_errors/missing_required_argument_test.dart
+++ b/tests/language/nnbd/static_errors/missing_required_argument_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
// Test that it is an error if a named parameter that is part of a required
// group is not bound to an argument at a call site.
diff --git a/tests/language/nnbd/static_errors/non_null_assertion_test.dart b/tests/language/nnbd/static_errors/non_null_assertion_test.dart
index 670a5b0..b014da2 100644
--- a/tests/language/nnbd/static_errors/non_null_assertion_test.dart
+++ b/tests/language/nnbd/static_errors/non_null_assertion_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
void main() {
void x;
int i;
diff --git a/tests/language/nnbd/static_errors/not_assigned_local_if_then_else_else_test.dart b/tests/language/nnbd/static_errors/not_assigned_local_if_then_else_else_test.dart
index 2043828..74c16a1 100644
--- a/tests/language/nnbd/static_errors/not_assigned_local_if_then_else_else_test.dart
+++ b/tests/language/nnbd/static_errors/not_assigned_local_if_then_else_else_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
// It is an error if a potentially non-nullable local variable which has no
// initializer expression and is not marked `late` is used before it is
diff --git a/tests/language/nnbd/static_errors/not_assigned_local_if_then_else_test.dart b/tests/language/nnbd/static_errors/not_assigned_local_if_then_else_test.dart
index 5eb19ce..3748a9e 100644
--- a/tests/language/nnbd/static_errors/not_assigned_local_if_then_else_test.dart
+++ b/tests/language/nnbd/static_errors/not_assigned_local_if_then_else_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
// It is an error if a potentially non-nullable local variable which has no
// initializer expression and is not marked `late` is used before it is
diff --git a/tests/language/nnbd/static_errors/not_assigned_local_if_then_else_then_test.dart b/tests/language/nnbd/static_errors/not_assigned_local_if_then_else_then_test.dart
index 2b9496c..8a959fb 100644
--- a/tests/language/nnbd/static_errors/not_assigned_local_if_then_else_then_test.dart
+++ b/tests/language/nnbd/static_errors/not_assigned_local_if_then_else_then_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
// It is an error if a potentially non-nullable local variable which has no
// initializer expression and is not marked `late` is used before it is
diff --git a/tests/language/nnbd/static_errors/not_assigned_local_if_then_test.dart b/tests/language/nnbd/static_errors/not_assigned_local_if_then_test.dart
index 7c65fb5..986b661 100644
--- a/tests/language/nnbd/static_errors/not_assigned_local_if_then_test.dart
+++ b/tests/language/nnbd/static_errors/not_assigned_local_if_then_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
// It is an error if a potentially non-nullable local variable which has no
// initializer expression and is not marked `late` is used before it is
diff --git a/tests/language/nnbd/static_errors/not_assigned_local_initializer_test.dart b/tests/language/nnbd/static_errors/not_assigned_local_initializer_test.dart
index 099f328..1edcb9c 100644
--- a/tests/language/nnbd/static_errors/not_assigned_local_initializer_test.dart
+++ b/tests/language/nnbd/static_errors/not_assigned_local_initializer_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
// It is an error if a potentially non-nullable local variable which has no
// initializer expression and is not marked `late` is used before it is
diff --git a/tests/language/nnbd/static_errors/not_assigned_local_try_catch_body_catch_test.dart b/tests/language/nnbd/static_errors/not_assigned_local_try_catch_body_catch_test.dart
index 94968d3..a08dd1d 100644
--- a/tests/language/nnbd/static_errors/not_assigned_local_try_catch_body_catch_test.dart
+++ b/tests/language/nnbd/static_errors/not_assigned_local_try_catch_body_catch_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
// It is an error if a potentially non-nullable local variable which has no
// initializer expression and is not marked `late` is used before it is
diff --git a/tests/language/nnbd/static_errors/not_assigned_local_try_catch_body_test.dart b/tests/language/nnbd/static_errors/not_assigned_local_try_catch_body_test.dart
index 05a8676..e5ddbcf 100644
--- a/tests/language/nnbd/static_errors/not_assigned_local_try_catch_body_test.dart
+++ b/tests/language/nnbd/static_errors/not_assigned_local_try_catch_body_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
// It is an error if a potentially non-nullable local variable which has no
// initializer expression and is not marked `late` is used before it is
diff --git a/tests/language/nnbd/static_errors/not_assigned_local_while_true_break_after_test.dart b/tests/language/nnbd/static_errors/not_assigned_local_while_true_break_after_test.dart
index 8c9a408..49dc8a8 100644
--- a/tests/language/nnbd/static_errors/not_assigned_local_while_true_break_after_test.dart
+++ b/tests/language/nnbd/static_errors/not_assigned_local_while_true_break_after_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
// It is an error if a potentially non-nullable local variable which has no
// initializer expression and is not marked `late` is used before it is
diff --git a/tests/language/nnbd/static_errors/not_assigned_local_while_true_break_before_test.dart b/tests/language/nnbd/static_errors/not_assigned_local_while_true_break_before_test.dart
index d0443ad..1e0bbe8 100644
--- a/tests/language/nnbd/static_errors/not_assigned_local_while_true_break_before_test.dart
+++ b/tests/language/nnbd/static_errors/not_assigned_local_while_true_break_before_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
// It is an error if a potentially non-nullable local variable which has no
// initializer expression and is not marked `late` is used before it is
diff --git a/tests/language/nnbd/static_errors/not_initialized_non_nullable_instance_field_test.dart b/tests/language/nnbd/static_errors/not_initialized_non_nullable_instance_field_test.dart
index e48202d..6ce0735 100644
--- a/tests/language/nnbd/static_errors/not_initialized_non_nullable_instance_field_test.dart
+++ b/tests/language/nnbd/static_errors/not_initialized_non_nullable_instance_field_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
// Test that it is an error if an instance field with potentially non-nullable
// type has no initializer expression and is not initialized in a constructor
diff --git a/tests/language/nnbd/static_errors/not_initialized_non_nullable_static_field_test.dart b/tests/language/nnbd/static_errors/not_initialized_non_nullable_static_field_test.dart
index a70142e..4a5d076 100644
--- a/tests/language/nnbd/static_errors/not_initialized_non_nullable_static_field_test.dart
+++ b/tests/language/nnbd/static_errors/not_initialized_non_nullable_static_field_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
// Test that it is an error if a static field non-nullable type has no
// initializer expression.
diff --git a/tests/language/nnbd/static_errors/not_initialized_non_nullable_top_test.dart b/tests/language/nnbd/static_errors/not_initialized_non_nullable_top_test.dart
index 28e55e4..57c92c0 100644
--- a/tests/language/nnbd/static_errors/not_initialized_non_nullable_top_test.dart
+++ b/tests/language/nnbd/static_errors/not_initialized_non_nullable_top_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
// Test that it is an error if a top level variable with non-nullable type has
// no initializer expression.
diff --git a/tests/language/nnbd/static_errors/nullable_function_types_test.dart b/tests/language/nnbd/static_errors/nullable_function_types_test.dart
index dd994cd..12f2fc9 100644
--- a/tests/language/nnbd/static_errors/nullable_function_types_test.dart
+++ b/tests/language/nnbd/static_errors/nullable_function_types_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
class C {
call() {}
diff --git a/tests/language/nnbd/static_errors/nullable_supertype_test.dart b/tests/language/nnbd/static_errors/nullable_supertype_test.dart
index 711fefd..44cd58a 100644
--- a/tests/language/nnbd/static_errors/nullable_supertype_test.dart
+++ b/tests/language/nnbd/static_errors/nullable_supertype_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
// Test that it is an error to use a nullable type as a supertype.
import 'package:expect/expect.dart';
diff --git a/tests/language/nnbd/static_errors/subtype_of_never_test.dart b/tests/language/nnbd/static_errors/subtype_of_never_test.dart
index a19197c..6361562 100644
--- a/tests/language/nnbd/static_errors/subtype_of_never_test.dart
+++ b/tests/language/nnbd/static_errors/subtype_of_never_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
// Test that it is an error for a class to extend, implement, or mixin the type
// Never.
diff --git a/tests/language/nnbd/static_errors/super_equals_allows_null_test.dart b/tests/language/nnbd/static_errors/super_equals_allows_null_test.dart
index 507a146..4a7f98a 100644
--- a/tests/language/nnbd/static_errors/super_equals_allows_null_test.dart
+++ b/tests/language/nnbd/static_errors/super_equals_allows_null_test.dart
@@ -3,7 +3,6 @@
// BSD-style license that can be found in the LICENSE file.
import "package:expect/expect.dart";
-// SharedOptions=--enable-experiment=non-nullable
// Test that `super == x` is allowed when `x` has a nullable type, even if the
// targeted definition of `operator==` has a parameter with a non-nullable type,
diff --git a/tests/language/nnbd/static_errors/super_equals_disallows_non_matching_type_error_test.dart b/tests/language/nnbd/static_errors/super_equals_disallows_non_matching_type_error_test.dart
index a2a8182..9f0c53c 100644
--- a/tests/language/nnbd/static_errors/super_equals_disallows_non_matching_type_error_test.dart
+++ b/tests/language/nnbd/static_errors/super_equals_disallows_non_matching_type_error_test.dart
@@ -3,7 +3,6 @@
// BSD-style license that can be found in the LICENSE file.
import "package:expect/expect.dart";
-// SharedOptions=--enable-experiment=non-nullable
// Test that `super == x` is properly type checked against the target
// `operator==` method. That is, the special allowance in the following spec
diff --git a/tests/language/nnbd/static_errors/this_reference_in_late_field_test.dart b/tests/language/nnbd/static_errors/this_reference_in_late_field_test.dart
index 0493a27..3c3efd1 100644
--- a/tests/language/nnbd/static_errors/this_reference_in_late_field_test.dart
+++ b/tests/language/nnbd/static_errors/this_reference_in_late_field_test.dart
@@ -3,7 +3,6 @@
// BSD-style license that can be found in the LICENSE file.
import "package:expect/expect.dart";
-// SharedOptions=--enable-experiment=non-nullable
void main() {
final c = C();
Expect.identical(c, c);
diff --git a/tests/language/nnbd/static_errors/throw_of_invalid_type_test.dart b/tests/language/nnbd/static_errors/throw_of_invalid_type_test.dart
index 564a7b4..9a20a36 100644
--- a/tests/language/nnbd/static_errors/throw_of_invalid_type_test.dart
+++ b/tests/language/nnbd/static_errors/throw_of_invalid_type_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
// Test that it is an error if the static type of `e` in the expression
// `throw e` is not assignable to `Object`.
diff --git a/tests/language/nnbd/static_errors/unchecked_use_of_nullable_cascaded_test.dart b/tests/language/nnbd/static_errors/unchecked_use_of_nullable_cascaded_test.dart
index 9678ea9..5773c43 100644
--- a/tests/language/nnbd/static_errors/unchecked_use_of_nullable_cascaded_test.dart
+++ b/tests/language/nnbd/static_errors/unchecked_use_of_nullable_cascaded_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
// Test that it is an error to use nullable types in unsound ways.
void main() {
diff --git a/tests/language/nnbd/static_errors/unchecked_use_of_nullable_test.dart b/tests/language/nnbd/static_errors/unchecked_use_of_nullable_test.dart
index 4e23e5f..e4bbab6 100644
--- a/tests/language/nnbd/static_errors/unchecked_use_of_nullable_test.dart
+++ b/tests/language/nnbd/static_errors/unchecked_use_of_nullable_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
// Test that it is an error to use nullable types in unsound ways.
void main() async {
diff --git a/tests/language/nnbd/static_errors/use_nnbd_sdk_test.dart b/tests/language/nnbd/static_errors/use_nnbd_sdk_test.dart
index e43cb63..1f65c6a 100644
--- a/tests/language/nnbd/static_errors/use_nnbd_sdk_test.dart
+++ b/tests/language/nnbd/static_errors/use_nnbd_sdk_test.dart
@@ -3,7 +3,6 @@
// BSD-style license that can be found in the LICENSE file.
import "package:expect/expect.dart";
-// SharedOptions=--enable-experiment=non-nullable
void main() {
}
diff --git a/tests/language/nnbd/syntax/cascade_nullcheck_test.dart b/tests/language/nnbd/syntax/cascade_nullcheck_test.dart
index 7391fc0..f54a5d0 100644
--- a/tests/language/nnbd/syntax/cascade_nullcheck_test.dart
+++ b/tests/language/nnbd/syntax/cascade_nullcheck_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
import "package:expect/expect.dart";
diff --git a/tests/language/nnbd/syntax/class_member_declarations_error_test.dart b/tests/language/nnbd/syntax/class_member_declarations_error_test.dart
index e78643e..40e2c44 100644
--- a/tests/language/nnbd/syntax/class_member_declarations_error_test.dart
+++ b/tests/language/nnbd/syntax/class_member_declarations_error_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
class A {
static late x1;
diff --git a/tests/language/nnbd/syntax/class_member_declarations_test.dart b/tests/language/nnbd/syntax/class_member_declarations_test.dart
index a6c8efd..f53b467 100644
--- a/tests/language/nnbd/syntax/class_member_declarations_test.dart
+++ b/tests/language/nnbd/syntax/class_member_declarations_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
class A {
static late final x2;
diff --git a/tests/language/nnbd/syntax/late_modifier_bug_39658.dart b/tests/language/nnbd/syntax/late_modifier_bug_39658.dart
index 3b8307a..745e8f7 100644
--- a/tests/language/nnbd/syntax/late_modifier_bug_39658.dart
+++ b/tests/language/nnbd/syntax/late_modifier_bug_39658.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
import 'package:expect/expect.dart';
int initCalls = 0;
diff --git a/tests/language/nnbd/syntax/late_modifier_edge_cases_test.dart b/tests/language/nnbd/syntax/late_modifier_edge_cases_test.dart
index fddd83c..fbaf0e2 100644
--- a/tests/language/nnbd/syntax/late_modifier_edge_cases_test.dart
+++ b/tests/language/nnbd/syntax/late_modifier_edge_cases_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
import 'package:expect/expect.dart';
class A {
diff --git a/tests/language/nnbd/syntax/late_modifier_error_test.dart b/tests/language/nnbd/syntax/late_modifier_error_test.dart
index a21deb7..05ce870 100644
--- a/tests/language/nnbd/syntax/late_modifier_error_test.dart
+++ b/tests/language/nnbd/syntax/late_modifier_error_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
// Invalid uses of "late" modifier
diff --git a/tests/language/nnbd/syntax/late_modifier_final_field_test.dart b/tests/language/nnbd/syntax/late_modifier_final_field_test.dart
index bfa9d7f..05df345 100644
--- a/tests/language/nnbd/syntax/late_modifier_final_field_test.dart
+++ b/tests/language/nnbd/syntax/late_modifier_final_field_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
// VMOptions=--optimization_counter_threshold=10
import 'package:expect/expect.dart';
diff --git a/tests/language/nnbd/syntax/late_modifier_final_local_var_test.dart b/tests/language/nnbd/syntax/late_modifier_final_local_var_test.dart
index cca2eaa..14739b6 100644
--- a/tests/language/nnbd/syntax/late_modifier_final_local_var_test.dart
+++ b/tests/language/nnbd/syntax/late_modifier_final_local_var_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
// VMOptions=--optimization_counter_threshold=10
import 'package:expect/expect.dart';
diff --git a/tests/language/nnbd/syntax/late_modifier_global_var_test.dart b/tests/language/nnbd/syntax/late_modifier_global_var_test.dart
index b084f02..95cb47f 100644
--- a/tests/language/nnbd/syntax/late_modifier_global_var_test.dart
+++ b/tests/language/nnbd/syntax/late_modifier_global_var_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
import 'package:expect/expect.dart';
int initCalls = 0;
diff --git a/tests/language/nnbd/syntax/late_modifier_local_var_test.dart b/tests/language/nnbd/syntax/late_modifier_local_var_test.dart
index 88878bb..825d96e 100644
--- a/tests/language/nnbd/syntax/late_modifier_local_var_test.dart
+++ b/tests/language/nnbd/syntax/late_modifier_local_var_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
// VMOptions=--optimization_counter_threshold=10
import 'package:expect/expect.dart';
diff --git a/tests/language/nnbd/syntax/late_modifier_non_final_field_test.dart b/tests/language/nnbd/syntax/late_modifier_non_final_field_test.dart
index 1ebb8ee..cdd0979 100644
--- a/tests/language/nnbd/syntax/late_modifier_non_final_field_test.dart
+++ b/tests/language/nnbd/syntax/late_modifier_non_final_field_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
// VMOptions=--optimization_counter_threshold=10
import 'package:expect/expect.dart';
diff --git a/tests/language/nnbd/syntax/late_modifier_static_field_test.dart b/tests/language/nnbd/syntax/late_modifier_static_field_test.dart
index d536db6..64adb33 100644
--- a/tests/language/nnbd/syntax/late_modifier_static_field_test.dart
+++ b/tests/language/nnbd/syntax/late_modifier_static_field_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
import 'package:expect/expect.dart';
int initCalls = 0;
diff --git a/tests/language/nnbd/syntax/late_modifier_static_final_field_test.dart b/tests/language/nnbd/syntax/late_modifier_static_final_field_test.dart
index 66fd9bb..35920ea 100644
--- a/tests/language/nnbd/syntax/late_modifier_static_final_field_test.dart
+++ b/tests/language/nnbd/syntax/late_modifier_static_final_field_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
import 'package:expect/expect.dart';
int initCalls = 0;
diff --git a/tests/language/nnbd/syntax/late_modifier_test.dart b/tests/language/nnbd/syntax/late_modifier_test.dart
index bcd4385..3f2e3f0 100644
--- a/tests/language/nnbd/syntax/late_modifier_test.dart
+++ b/tests/language/nnbd/syntax/late_modifier_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
import 'package:expect/expect.dart';
late final int d = d_init();
diff --git a/tests/language/nnbd/syntax/non_null_assertion_test.dart b/tests/language/nnbd/syntax/non_null_assertion_test.dart
index 265dfed..9d7a3e9 100644
--- a/tests/language/nnbd/syntax/non_null_assertion_test.dart
+++ b/tests/language/nnbd/syntax/non_null_assertion_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
// Test that the trailing "!" is accepted after a sampling of expression
// syntaxes. Verify that the compiler understands the resulting type to be
diff --git a/tests/language/nnbd/syntax/null_assertion_ambiguous_test.dart b/tests/language/nnbd/syntax/null_assertion_ambiguous_test.dart
index 131631e..8cb6e4a 100644
--- a/tests/language/nnbd/syntax/null_assertion_ambiguous_test.dart
+++ b/tests/language/nnbd/syntax/null_assertion_ambiguous_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
import 'package:expect/expect.dart';
import 'dart:async';
diff --git a/tests/language/nnbd/syntax/nullable_type_ambiguous_test.dart b/tests/language/nnbd/syntax/nullable_type_ambiguous_test.dart
index 23565da..b00c18d 100644
--- a/tests/language/nnbd/syntax/nullable_type_ambiguous_test.dart
+++ b/tests/language/nnbd/syntax/nullable_type_ambiguous_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
import 'package:expect/expect.dart';
class C {
diff --git a/tests/language/nnbd/syntax/nullable_type_error_test.dart b/tests/language/nnbd/syntax/nullable_type_error_test.dart
index 106cf2d..01112ab 100644
--- a/tests/language/nnbd/syntax/nullable_type_error_test.dart
+++ b/tests/language/nnbd/syntax/nullable_type_error_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
import 'dart:core';
import 'dart:core' as core;
diff --git a/tests/language/nnbd/syntax/opt_out_nnbd_modifiers_test.dart b/tests/language/nnbd/syntax/opt_out_nnbd_modifiers_test.dart
index 59d55da..d7d60cb 100644
--- a/tests/language/nnbd/syntax/opt_out_nnbd_modifiers_test.dart
+++ b/tests/language/nnbd/syntax/opt_out_nnbd_modifiers_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
// @dart = 2.2
import 'package:expect/expect.dart';
diff --git a/tests/language/nnbd/syntax/required_modifier_error_test.dart b/tests/language/nnbd/syntax/required_modifier_error_test.dart
index 3312580..24ac35d 100644
--- a/tests/language/nnbd/syntax/required_modifier_error_test.dart
+++ b/tests/language/nnbd/syntax/required_modifier_error_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
// Invalid uses of "required" modifier
diff --git a/tests/language/nnbd/syntax/required_modifier_test.dart b/tests/language/nnbd/syntax/required_modifier_test.dart
index 423f22e..a5640c6 100644
--- a/tests/language/nnbd/syntax/required_modifier_test.dart
+++ b/tests/language/nnbd/syntax/required_modifier_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
import 'package:expect/expect.dart';
int f({required int i}) => i + 1;
diff --git a/tests/language/nnbd/type_promotion/assignment_inference_after_null_check_test.dart b/tests/language/nnbd/type_promotion/assignment_inference_after_null_check_test.dart
index 220bfbe..fbeb0be 100644
--- a/tests/language/nnbd/type_promotion/assignment_inference_after_null_check_test.dart
+++ b/tests/language/nnbd/type_promotion/assignment_inference_after_null_check_test.dart
@@ -7,7 +7,6 @@
// inference. This test makes sure that the type argument information is
// appropriately preserved.
-// SharedOptions=--enable-experiment=non-nullable
void f(List<int>? x) {
if (x == null) {
diff --git a/tests/language/nnbd/type_promotion/assignment_test.dart b/tests/language/nnbd/type_promotion/assignment_test.dart
index ab93abb..1c085e0 100644
--- a/tests/language/nnbd/type_promotion/assignment_test.dart
+++ b/tests/language/nnbd/type_promotion/assignment_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
void f(Object x) {
if (x is String) {
diff --git a/tests/language/nnbd/type_promotion/conditional_both_test.dart b/tests/language/nnbd/type_promotion/conditional_both_test.dart
index a663af58..65dccbc 100644
--- a/tests/language/nnbd/type_promotion/conditional_both_test.dart
+++ b/tests/language/nnbd/type_promotion/conditional_both_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
void f(bool b, Object x) {
b ? ((x is String) || (throw 1)) : ((x is String) || (throw 2));
diff --git a/tests/language/nnbd/type_promotion/do_condition_is_not_type_test.dart b/tests/language/nnbd/type_promotion/do_condition_is_not_type_test.dart
index c5b7420..f011765 100644
--- a/tests/language/nnbd/type_promotion/do_condition_is_not_type_test.dart
+++ b/tests/language/nnbd/type_promotion/do_condition_is_not_type_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
void f(Object x) {
do {
diff --git a/tests/language/nnbd/type_promotion/do_condition_is_type_test.dart b/tests/language/nnbd/type_promotion/do_condition_is_type_test.dart
index 83572cd..db7988c 100644
--- a/tests/language/nnbd/type_promotion/do_condition_is_type_test.dart
+++ b/tests/language/nnbd/type_promotion/do_condition_is_type_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
void f(Object x) {
do {
diff --git a/tests/language/nnbd/type_promotion/do_outer_is_type_test.dart b/tests/language/nnbd/type_promotion/do_outer_is_type_test.dart
index 06f0653..31c13e8 100644
--- a/tests/language/nnbd/type_promotion/do_outer_is_type_test.dart
+++ b/tests/language/nnbd/type_promotion/do_outer_is_type_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
void f(bool b, Object x) {
if (x is String) {
diff --git a/tests/language/nnbd/type_promotion/for_outer_is_type_test.dart b/tests/language/nnbd/type_promotion/for_outer_is_type_test.dart
index 3aaed04..3226b28 100644
--- a/tests/language/nnbd/type_promotion/for_outer_is_type_test.dart
+++ b/tests/language/nnbd/type_promotion/for_outer_is_type_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
void f(bool b, Object x) {
if (x is String) {
diff --git a/tests/language/nnbd/type_promotion/function_expression_is_type_mutated_in_closure_test.dart b/tests/language/nnbd/type_promotion/function_expression_is_type_mutated_in_closure_test.dart
index 058855e..c527f6f 100644
--- a/tests/language/nnbd/type_promotion/function_expression_is_type_mutated_in_closure_test.dart
+++ b/tests/language/nnbd/type_promotion/function_expression_is_type_mutated_in_closure_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
void f() {
void g(Object x) {
diff --git a/tests/language/nnbd/type_promotion/function_expression_is_type_test.dart b/tests/language/nnbd/type_promotion/function_expression_is_type_test.dart
index 83200a7..8209961 100644
--- a/tests/language/nnbd/type_promotion/function_expression_is_type_test.dart
+++ b/tests/language/nnbd/type_promotion/function_expression_is_type_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
void f() {
void g(Object x) {
diff --git a/tests/language/nnbd/type_promotion/function_expression_outer_is_type_assigned_outside_test.dart b/tests/language/nnbd/type_promotion/function_expression_outer_is_type_assigned_outside_test.dart
index dd1df88..aeaa801 100644
--- a/tests/language/nnbd/type_promotion/function_expression_outer_is_type_assigned_outside_test.dart
+++ b/tests/language/nnbd/type_promotion/function_expression_outer_is_type_assigned_outside_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
void f(Object x) {
late void Function() g;
diff --git a/tests/language/nnbd/type_promotion/if_is_not_type_test.dart b/tests/language/nnbd/type_promotion/if_is_not_type_test.dart
index 4fb31b7..16b109a 100644
--- a/tests/language/nnbd/type_promotion/if_is_not_type_test.dart
+++ b/tests/language/nnbd/type_promotion/if_is_not_type_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
void f(Object x) {
if (x is! String) {
diff --git a/tests/language/nnbd/type_promotion/if_is_type_test.dart b/tests/language/nnbd/type_promotion/if_is_type_test.dart
index dc97344..6285019 100644
--- a/tests/language/nnbd/type_promotion/if_is_type_test.dart
+++ b/tests/language/nnbd/type_promotion/if_is_type_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
void f(Object x) {
if (x is String) {
diff --git a/tests/language/nnbd/type_promotion/logical_or_throw_test.dart b/tests/language/nnbd/type_promotion/logical_or_throw_test.dart
index e8c7e8b..55dbc0b 100644
--- a/tests/language/nnbd/type_promotion/logical_or_throw_test.dart
+++ b/tests/language/nnbd/type_promotion/logical_or_throw_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
void f(Object x) {
x is String || (throw 42);
diff --git a/tests/language/nnbd/type_promotion/null_type_insufficient_for_equals_null_check_error_test.dart b/tests/language/nnbd/type_promotion/null_type_insufficient_for_equals_null_check_error_test.dart
index 30e882f..55d529b 100644
--- a/tests/language/nnbd/type_promotion/null_type_insufficient_for_equals_null_check_error_test.dart
+++ b/tests/language/nnbd/type_promotion/null_type_insufficient_for_equals_null_check_error_test.dart
@@ -8,7 +8,6 @@
// expression `(x = null)`). This test demonstrates the problem with `(x =
// null)` and checks a few other cases.
-// SharedOptions=--enable-experiment=non-nullable
void assignNullRhs(int? x) {
if (x != (x = null)) {
diff --git a/tests/language/nnbd/type_promotion/promoted_lhs_used_as_assignment_context_test.dart b/tests/language/nnbd/type_promotion/promoted_lhs_used_as_assignment_context_test.dart
index 245ec8b..149afdd 100644
--- a/tests/language/nnbd/type_promotion/promoted_lhs_used_as_assignment_context_test.dart
+++ b/tests/language/nnbd/type_promotion/promoted_lhs_used_as_assignment_context_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
import 'package:expect/expect.dart';
diff --git a/tests/language/nnbd/type_promotion/try_catch_assigned_body_test.dart b/tests/language/nnbd/type_promotion/try_catch_assigned_body_test.dart
index 4a3bef4..baf4866 100644
--- a/tests/language/nnbd/type_promotion/try_catch_assigned_body_test.dart
+++ b/tests/language/nnbd/type_promotion/try_catch_assigned_body_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
void f(Object x) {
if (x is! String) return;
diff --git a/tests/language/nnbd/type_promotion/try_catch_catch_finally_outer_is_type_test.dart b/tests/language/nnbd/type_promotion/try_catch_catch_finally_outer_is_type_test.dart
index 41449de..5e0bb57 100644
--- a/tests/language/nnbd/type_promotion/try_catch_catch_finally_outer_is_type_test.dart
+++ b/tests/language/nnbd/type_promotion/try_catch_catch_finally_outer_is_type_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
void f(Object x) {
if (x is String) {
diff --git a/tests/language/nnbd/type_promotion/try_catch_is_not_type_exit_body_catch_test.dart b/tests/language/nnbd/type_promotion/try_catch_is_not_type_exit_body_catch_test.dart
index 9b2462c..af75aaf 100644
--- a/tests/language/nnbd/type_promotion/try_catch_is_not_type_exit_body_catch_test.dart
+++ b/tests/language/nnbd/type_promotion/try_catch_is_not_type_exit_body_catch_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
void f(Object x) {
try {
diff --git a/tests/language/nnbd/type_promotion/try_catch_is_not_type_exit_body_test.dart b/tests/language/nnbd/type_promotion/try_catch_is_not_type_exit_body_test.dart
index 3d8ca81..7e9066a 100644
--- a/tests/language/nnbd/type_promotion/try_catch_is_not_type_exit_body_test.dart
+++ b/tests/language/nnbd/type_promotion/try_catch_is_not_type_exit_body_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
void f(Object x) {
try {
diff --git a/tests/language/nnbd/type_promotion/try_finally_outer_is_type_assigned_body_test.dart b/tests/language/nnbd/type_promotion/try_finally_outer_is_type_assigned_body_test.dart
index eeabbe7..3ce4f78 100644
--- a/tests/language/nnbd/type_promotion/try_finally_outer_is_type_assigned_body_test.dart
+++ b/tests/language/nnbd/type_promotion/try_finally_outer_is_type_assigned_body_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
void f(Object x) {
if (x is String) {
diff --git a/tests/language/nnbd/type_promotion/try_finally_outer_is_type_assigned_finally_test.dart b/tests/language/nnbd/type_promotion/try_finally_outer_is_type_assigned_finally_test.dart
index bca9b42..9722738 100644
--- a/tests/language/nnbd/type_promotion/try_finally_outer_is_type_assigned_finally_test.dart
+++ b/tests/language/nnbd/type_promotion/try_finally_outer_is_type_assigned_finally_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
void f(Object x) {
if (x is String) {
diff --git a/tests/language/nnbd/type_promotion/while_condition_false_test.dart b/tests/language/nnbd/type_promotion/while_condition_false_test.dart
index 8301ac9..1d76b9d 100644
--- a/tests/language/nnbd/type_promotion/while_condition_false_test.dart
+++ b/tests/language/nnbd/type_promotion/while_condition_false_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
void f(Object x) {
while (x is! String) {
diff --git a/tests/language/nnbd/type_promotion/while_condition_true_test.dart b/tests/language/nnbd/type_promotion/while_condition_true_test.dart
index 468b14e..b29dfc3 100644
--- a/tests/language/nnbd/type_promotion/while_condition_true_test.dart
+++ b/tests/language/nnbd/type_promotion/while_condition_true_test.dart
@@ -2,7 +2,6 @@
// 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.
-// SharedOptions=--enable-experiment=non-nullable
void f(Object x) {
while (x is String) {
diff --git a/tests/lib/isolate/detect_nullsafety_helper.dart b/tests/lib/isolate/detect_nullsafety_helper.dart
index 7f66ab8..3171ef4 100644
--- a/tests/lib/isolate/detect_nullsafety_helper.dart
+++ b/tests/lib/isolate/detect_nullsafety_helper.dart
@@ -25,7 +25,6 @@
var args = <String>[];
args.add("--snapshot-kind=$type");
args.add("--snapshot=$outPath");
- args.add("--enable-experiment=non-nullable");
args.add(sourcePath);
var result = Process.runSync(exec, args);
print('snapshot $type stdout: ${result.stdout}');
@@ -43,7 +42,6 @@
void testNullSafetyMode(String filePath, String expected) {
var exec = Platform.resolvedExecutable;
var args = <String>[];
- args.add("--enable-experiment=non-nullable");
args.add(filePath);
var result = Process.runSync(exec, args);
print('test stdout: ${result.stdout}');
diff --git a/tests/lib/isolate/nnbd_spawn_autodetect_helper.dart b/tests/lib/isolate/nnbd_spawn_autodetect_helper.dart
index d0eaeac..cfa4a30 100644
--- a/tests/lib/isolate/nnbd_spawn_autodetect_helper.dart
+++ b/tests/lib/isolate/nnbd_spawn_autodetect_helper.dart
@@ -51,7 +51,6 @@
var args = <String>[];
args.add("--snapshot-kind=$type");
args.add("--snapshot=$outPath");
- args.add("--enable-experiment=non-nullable");
args.add(sourcePath);
var result = Process.runSync(exec, args);
print('snapshot $type stdout: ${result.stdout}');
@@ -69,7 +68,6 @@
void testNullSafetyMode(String filePath, String expected) {
var exec = Platform.resolvedExecutable;
var args = <String>[];
- args.add("--enable-experiment=non-nullable");
args.add(filePath);
var result = Process.runSync(exec, args);
print('test stdout: ${result.stdout}');
diff --git a/tests/lib/isolate/nnbd_spawnuri_autodetect_helper.dart b/tests/lib/isolate/nnbd_spawnuri_autodetect_helper.dart
index 4cca7e9..18d58fb 100644
--- a/tests/lib/isolate/nnbd_spawnuri_autodetect_helper.dart
+++ b/tests/lib/isolate/nnbd_spawnuri_autodetect_helper.dart
@@ -27,7 +27,6 @@
var args = <String>[];
args.add("--snapshot-kind=$type");
args.add("--snapshot=$outPath");
- args.add("--enable-experiment=non-nullable");
args.add(sourcePath);
var result = Process.runSync(exec, args);
}
@@ -74,7 +73,6 @@
''');
var exec = Platform.resolvedExecutable;
var args = <String>[];
- args.add("--enable-experiment=non-nullable");
args.add(mainIsolate.path);
var result = Process.runSync(exec, args);
expect(result.stdout.contains('$expected'), true);
diff --git a/tests/lib_2/isolate/issue_6610_test.dart b/tests/lib_2/isolate/issue_6610_test.dart
deleted file mode 100644
index ca701681..0000000
--- a/tests/lib_2/isolate/issue_6610_test.dart
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright (c) 2018, 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.
-
-// VMOptions=--enable-experiment=no-non-nullable --enable-isolate-groups --experimental-enable-isolate-groups-jit
-// VMOptions=--enable-experiment=no-non-nullable --no-enable-isolate-groups
-
-// Testing that Isolate.spawn copies the source code of the parent isolate,
-// rather than rereading the parent's source URI.
-// https://github.com/dart-lang/sdk/issues/6610
-
-// Isolate structure:
-// Root 1 -> Branch 1 -> Leaf 1
-// /
-// main
-// \
-// Root 2 -> Branch 2 -> Leaf 2
-
-library spawn_tests;
-
-import "dart:io";
-import 'dart:isolate';
-import 'package:expect/expect.dart';
-
-void main() {
- HttpServer.bind("127.0.0.1", 0).then((server) {
- var count = 0;
- server.listen((HttpRequest request) {
- ++count;
- request.response.write("""
- // @dart = 2.9
- import 'dart:isolate';
-
- void main(_, SendPort port) {
- root(port);
- }
-
- void root(SendPort port) {
- port.send("Root ${count}");
- Isolate.spawn(branch, port);
- }
-
- void branch(SendPort port) {
- port.send("Branch ${count}");
- Isolate.spawn(leaf, port);
- }
-
- void leaf(SendPort port) {
- port.send("Leaf ${count}");
- }
- """);
- request.response.close();
- });
-
- ReceivePort port = new ReceivePort();
- var messageSet = Set();
- port.listen((message) {
- messageSet.add(message);
- if (messageSet.length >= 6) {
- server.close();
- port.close();
- Expect.setEquals([
- "Root 1",
- "Root 2",
- "Branch 1",
- "Branch 2",
- "Leaf 1",
- "Leaf 2",
- ], messageSet);
- }
- });
-
- Isolate.spawnUri(
- Uri.parse("http://127.0.0.1:${server.port}"), [], port.sendPort);
- Isolate.spawnUri(
- Uri.parse("http://127.0.0.1:${server.port}"), [], port.sendPort);
- });
-}
diff --git a/tests/standalone_2/io/named_pipe_script_test.dart b/tests/standalone_2/io/named_pipe_script_test.dart
deleted file mode 100644
index 50e74b0..0000000
--- a/tests/standalone_2/io/named_pipe_script_test.dart
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright (c) 2016, 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.
-// Testing file input stream, VM-only, standalone test.
-
-// VMOptions=--enable-experiment=no-non-nullable
-
-import "dart:convert";
-import "dart:io";
-
-import "package:async_helper/async_helper.dart";
-import "package:expect/expect.dart";
-
-main() async {
- asyncStart();
- // Reading a script from a named pipe is only supported on Linux and MacOS.
- if (!Platform.isLinux && !Platform.isMacOS) {
- print("This test is only supported on Linux and MacOS.");
- asyncEnd();
- return;
- }
-
- final String script = 'main() { print("Hello, World!"); }';
- final String stdinPipePath = '/dev/fd/0';
-
- // If there's no file system access to the pipe, then we can't do a meaningful
- // test.
- if (!await (new File(stdinPipePath).exists())) {
- print("Couldn't find $stdinPipePath.");
- asyncEnd();
- return;
- }
-
- StringBuffer output = new StringBuffer();
- Process process = await Process.start(
- Platform.executable,
- []
- ..addAll(Platform.executableArguments)
- ..add('--verbosity=warning')
- ..add(stdinPipePath));
- bool stdinWriteFailed = false;
- process.stdout.transform(utf8.decoder).listen(output.write);
- process.stderr.transform(utf8.decoder).listen((data) {
- if (!stdinWriteFailed) {
- Expect.fail(data);
- process.kill();
- }
- });
- process.stdin.done.catchError((e) {
- // If the write to stdin fails, then give up. We can't test the thing we
- // wanted to test.
- stdinWriteFailed = true;
- process.kill();
- });
- process.stdin.writeln(script);
- await process.stdin.flush();
- await process.stdin.close();
-
- int status = await process.exitCode;
- if (!stdinWriteFailed) {
- Expect.equals(0, status);
- Expect.equals("Hello, World!\n", output.toString());
- }
- asyncEnd();
-}
diff --git a/tools/VERSION b/tools/VERSION
index 12c6833..8e7da84 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 13
PATCH 0
-PRERELEASE 31
+PRERELEASE 32
PRERELEASE_PATCH 0
\ No newline at end of file
diff --git a/tools/bots/flutter/compile_flutter.sh b/tools/bots/flutter/compile_flutter.sh
index 8f4f2d6..194beb2 100755
--- a/tools/bots/flutter/compile_flutter.sh
+++ b/tools/bots/flutter/compile_flutter.sh
@@ -83,7 +83,6 @@
dart:core \
-Ddart.vm.product=false \
-Ddart.isVM=true \
- --enable-experiment=non-nullable \
--nnbd-agnostic \
--single-root-scheme=org-dartlang-sdk \
--single-root-base=$checkout/ \
@@ -95,7 +94,6 @@
$checkout/tools/sdks/dart-sdk/bin/dart \
--packages=$checkout/.packages \
$checkout/pkg/front_end/tool/_fasta/compile_platform.dart \
- --enable-experiment=non-nullable \
--nnbd-agnostic \
--target=flutter \
dart:core \
diff --git a/tools/bots/try_benchmarks.sh b/tools/bots/try_benchmarks.sh
index ea827b4..7d4d5c8 100755
--- a/tools/bots/try_benchmarks.sh
+++ b/tools/bots/try_benchmarks.sh
@@ -171,27 +171,27 @@
}
EOF
out/ReleaseIA32/dart --profile-period=10000 --packages=.packages hello.dart
- out/ReleaseIA32/dart --sound-null-safety --enable-experiment=non-nullable --profile-period=10000 --packages=.packages hello.dart
+ out/ReleaseIA32/dart --sound-null-safety --profile-period=10000 --packages=.packages hello.dart
out/ReleaseIA32/dart pkg/front_end/tool/perf.dart parse hello.dart
out/ReleaseIA32/dart pkg/front_end/tool/perf.dart scan hello.dart
out/ReleaseIA32/dart pkg/front_end/tool/fasta_perf.dart kernel_gen_e2e hello.dart
out/ReleaseIA32/dart pkg/front_end/tool/fasta_perf.dart scan hello.dart
out/ReleaseIA32/run_vm_tests --dfe=out/ReleaseIA32/kernel-service.dart.snapshot InitialRSS
- out/ReleaseIA32/run_vm_tests --dfe=out/ReleaseIA32/kernel-service.dart.snapshot --sound-null-safety --enable-experiment=non-nullable InitialRSS
+ out/ReleaseIA32/run_vm_tests --dfe=out/ReleaseIA32/kernel-service.dart.snapshot --sound-null-safety InitialRSS
out/ReleaseIA32/run_vm_tests --dfe=out/ReleaseIA32/kernel-service.dart.snapshot KernelServiceCompileAll
- out/ReleaseIA32/run_vm_tests --dfe=out/ReleaseIA32/kernel-service.dart.snapshot --sound-null-safety --enable-experiment=non-nullable KernelServiceCompileAll
+ out/ReleaseIA32/run_vm_tests --dfe=out/ReleaseIA32/kernel-service.dart.snapshot --sound-null-safety KernelServiceCompileAll
out/ReleaseIA32/run_vm_tests --dfe=out/ReleaseIA32/kernel-service.dart.snapshot UseDartApi
- out/ReleaseIA32/run_vm_tests --dfe=out/ReleaseIA32/kernel-service.dart.snapshot --sound-null-safety --enable-experiment=non-nullable UseDartApi
+ out/ReleaseIA32/run_vm_tests --dfe=out/ReleaseIA32/kernel-service.dart.snapshot --sound-null-safety UseDartApi
out/ReleaseIA32/dart --profile-period=10000 --packages=.packages benchmarks/Example/dart2/Example.dart
- out/ReleaseIA32/dart --sound-null-safety --enable-experiment=non-nullable --profile-period=10000 --packages=.packages benchmarks/Example/dart/Example.dart
+ out/ReleaseIA32/dart --sound-null-safety --profile-period=10000 --packages=.packages benchmarks/Example/dart/Example.dart
out/ReleaseIA32/dart benchmarks/FfiBoringssl/dart2/FfiBoringssl.dart
- out/ReleaseIA32/dart --sound-null-safety --enable-experiment=non-nullable benchmarks/FfiBoringssl/dart/FfiBoringssl.dart
+ out/ReleaseIA32/dart --sound-null-safety benchmarks/FfiBoringssl/dart/FfiBoringssl.dart
out/ReleaseIA32/dart benchmarks/FfiCall/dart2/FfiCall.dart
- out/ReleaseIA32/dart --sound-null-safety --enable-experiment=non-nullable benchmarks/FfiCall/dart/FfiCall.dart
+ out/ReleaseIA32/dart --sound-null-safety benchmarks/FfiCall/dart/FfiCall.dart
out/ReleaseIA32/dart benchmarks/FfiMemory/dart2/FfiMemory.dart
- out/ReleaseIA32/dart --sound-null-safety --enable-experiment=non-nullable benchmarks/FfiMemory/dart/FfiMemory.dart
+ out/ReleaseIA32/dart --sound-null-safety benchmarks/FfiMemory/dart/FfiMemory.dart
out/ReleaseIA32/dart benchmarks/FfiStruct/dart2/FfiStruct.dart
- out/ReleaseIA32/dart --sound-null-safety --enable-experiment=non-nullable benchmarks/FfiStruct/dart/FfiStruct.dart
+ out/ReleaseIA32/dart --sound-null-safety benchmarks/FfiStruct/dart/FfiStruct.dart
cd ..
rm -rf tmp
elif [ "$command" = linux-x64-build ]; then
@@ -318,30 +318,30 @@
}
EOF
out/ReleaseX64/dart --profile-period=10000 --packages=.packages hello.dart
- out/ReleaseX64/dart --sound-null-safety --enable-experiment=non-nullable --profile-period=10000 --packages=.packages hello.dart
+ out/ReleaseX64/dart --sound-null-safety --profile-period=10000 --packages=.packages hello.dart
DART_CONFIGURATION=ReleaseX64 pkg/vm/tool/precompiler2 --packages=.packages hello.dart blob.bin
DART_CONFIGURATION=ReleaseX64 pkg/vm/tool/dart_precompiled_runtime2 --profile-period=10000 blob.bin
- DART_CONFIGURATION=ReleaseX64 pkg/vm/tool/precompiler2 --sound-null-safety --enable-experiment=non-nullable --packages=.packages hello.dart blob.bin
+ DART_CONFIGURATION=ReleaseX64 pkg/vm/tool/precompiler2 --sound-null-safety --packages=.packages hello.dart blob.bin
DART_CONFIGURATION=ReleaseX64 pkg/vm/tool/dart_precompiled_runtime2 --profile-period=10000 blob.bin
out/ReleaseX64/dart --profile-period=10000 --packages=.packages --optimization-counter-threshold=-1 hello.dart
out/ReleaseX64/dart-sdk/bin/dart2js --packages=.packages --out=out.js -m hello.dart
third_party/d8/linux/x64/d8 --stack_size=1024 sdk/lib/_internal/js_runtime/lib/preambles/d8.js out.js
- out/ReleaseX64/dart-sdk/bin/dart2js --enable-experiment=non-nullable --sound-null-safety --packages=.packages --out=out.js -m hello.dart
+ out/ReleaseX64/dart-sdk/bin/dart2js --sound-null-safety --packages=.packages --out=out.js -m hello.dart
third_party/d8/linux/x64/d8 --stack_size=1024 sdk/lib/_internal/js_runtime/lib/preambles/d8.js out.js
out/ReleaseX64/dart-sdk/bin/dart2js --packages=.packages --out=out.js -m hello.dart
LD_LIBRARY_PATH=third_party/firefox_jsshell/linux/jsshell/ third_party/firefox_jsshell/linux/jsshell/js -f sdk/lib/_internal/js_runtime/lib/preambles/jsshell.js -f out.js
- out/ReleaseX64/dart-sdk/bin/dart2js --enable-experiment=non-nullable --sound-null-safety --packages=.packages --out=out.js -m hello.dart
+ out/ReleaseX64/dart-sdk/bin/dart2js --sound-null-safety --packages=.packages --out=out.js -m hello.dart
LD_LIBRARY_PATH=third_party/firefox_jsshell/linux/jsshell/ third_party/firefox_jsshell/linux/jsshell/js -f sdk/lib/_internal/js_runtime/lib/preambles/jsshell.js -f out.js
out/ReleaseX64/dart-sdk/bin/dart2js --benchmarking-production --packages=.packages --out=out.js -m hello.dart
third_party/d8/linux/x64/d8 --stack_size=1024 sdk/lib/_internal/js_runtime/lib/preambles/d8.js out.js
- out/ReleaseX64/dart-sdk/bin/dart2js --enable-experiment=non-nullable --sound-null-safety --benchmarking-production --packages=.packages --out=out.js -m hello.dart
+ out/ReleaseX64/dart-sdk/bin/dart2js --sound-null-safety --benchmarking-production --packages=.packages --out=out.js -m hello.dart
third_party/d8/linux/x64/d8 --stack_size=1024 sdk/lib/_internal/js_runtime/lib/preambles/d8.js out.js
out/ReleaseX64/dart-sdk/bin/dart2js --benchmarking-x --packages=.packages --out=out.js -m hello.dart
third_party/d8/linux/x64/d8 --stack_size=1024 sdk/lib/_internal/js_runtime/lib/preambles/d8.js out.js
out/ReleaseX64/dart-sdk/bin/dart pkg/dev_compiler/tool/ddb -r d8 -b third_party/d8/linux/x64/d8 hello.dart
out/ReleaseX64/dart-sdk/bin/dart pkg/dev_compiler/tool/ddb -r d8 -b third_party/d8/linux/x64/d8 --mode=compile --compile-vm-options=--print-metrics --packages=.packages --out out.js hello.dart
- out/ReleaseX64/dart-sdk/bin/dart pkg/dev_compiler/tool/ddb -r d8 -b third_party/d8/linux/x64/d8 --enable-experiment=non-nullable --sound-null-safety hello.dart
- out/ReleaseX64/dart-sdk/bin/dart pkg/dev_compiler/tool/ddb -r d8 -b third_party/d8/linux/x64/d8 --enable-experiment=non-nullable --sound-null-safety --mode=compile --compile-vm-options=--print-metrics --packages=.packages --out out.js hello.dart
+ out/ReleaseX64/dart-sdk/bin/dart pkg/dev_compiler/tool/ddb -r d8 -b third_party/d8/linux/x64/d8 --sound-null-safety hello.dart
+ out/ReleaseX64/dart-sdk/bin/dart pkg/dev_compiler/tool/ddb -r d8 -b third_party/d8/linux/x64/d8 --sound-null-safety --mode=compile --compile-vm-options=--print-metrics --packages=.packages --out out.js hello.dart
out/ReleaseX64/dart pkg/front_end/tool/perf.dart parse hello.dart
out/ReleaseX64/dart pkg/front_end/tool/perf.dart scan hello.dart
out/ReleaseX64/dart pkg/front_end/tool/fasta_perf.dart kernel_gen_e2e hello.dart
@@ -352,13 +352,13 @@
out/ReleaseX64/dart --background-compilation=false pkg/front_end/tool/incremental_perf.dart.appjit --target=vm --sdk-summary=out/ReleaseX64/vm_platform_strong.dill --sdk-library-specification=sdk/lib/libraries.json pkg/front_end/benchmarks/ikg/hello.dart pkg/front_end/benchmarks/ikg/hello.edits.json
out/ReleaseX64/dart --packages=.packages pkg/kernel/test/binary_bench.dart --golem AstFromBinaryLazy out/ReleaseX64/vm_platform_strong.dill
out/ReleaseX64/run_vm_tests --dfe=out/ReleaseX64/kernel-service.dart.snapshot InitialRSS
- out/ReleaseX64/run_vm_tests --dfe=out/ReleaseX64/kernel-service.dart.snapshot --sound-null-safety --enable-experiment=non-nullable InitialRSS
+ out/ReleaseX64/run_vm_tests --dfe=out/ReleaseX64/kernel-service.dart.snapshot --sound-null-safety InitialRSS
out/ReleaseX64/run_vm_tests --dfe=out/ReleaseX64/kernel-service.dart.snapshot KernelServiceCompileAll
- out/ReleaseX64/run_vm_tests --dfe=out/ReleaseX64/kernel-service.dart.snapshot --sound-null-safety --enable-experiment=non-nullable KernelServiceCompileAll
+ out/ReleaseX64/run_vm_tests --dfe=out/ReleaseX64/kernel-service.dart.snapshot --sound-null-safety KernelServiceCompileAll
out/ReleaseX64/run_vm_tests --dfe=out/ReleaseX64/kernel-service.dart.snapshot UseDartApi
- out/ReleaseX64/run_vm_tests --dfe=out/ReleaseX64/kernel-service.dart.snapshot --sound-null-safety --enable-experiment=non-nullable UseDartApi
+ out/ReleaseX64/run_vm_tests --dfe=out/ReleaseX64/kernel-service.dart.snapshot --sound-null-safety UseDartApi
out/ReleaseX64/dart --profile-period=10000 --packages=.packages benchmarks/Example/dart2/Example.dart
- out/ReleaseX64/dart --sound-null-safety --enable-experiment=non-nullable --profile-period=10000 --packages=.packages benchmarks/Example/dart/Example.dart
+ out/ReleaseX64/dart --sound-null-safety --profile-period=10000 --packages=.packages benchmarks/Example/dart/Example.dart
out/ReleaseX64/dart --profile-period=10000 --packages=.packages benchmarks/IsolateSpawn/dart2/IsolateSpawn.dart
cd ..
rm -rf tmp
diff --git a/utils/compiler/BUILD.gn b/utils/compiler/BUILD.gn
index f8b41bd..e724494 100644
--- a/utils/compiler/BUILD.gn
+++ b/utils/compiler/BUILD.gn
@@ -87,7 +87,6 @@
"--target=dart2js",
"--no-defines",
"dart:core",
- "--enable-experiment=non-nullable",
]
}
compile_platform("compile_dart2js_nnbd_strong_platform") {
@@ -104,7 +103,6 @@
"--target=dart2js",
"--no-defines",
"dart:core",
- "--enable-experiment=non-nullable",
"--nnbd-strong",
]
}
@@ -122,7 +120,6 @@
"--target=dart2js_server",
"--no-defines",
"dart:core",
- "--enable-experiment=non-nullable",
]
}
compile_platform("compile_dart2js_server_nnbd_strong_platform") {
@@ -139,7 +136,6 @@
"--target=dart2js_server",
"--no-defines",
"dart:core",
- "--enable-experiment=non-nullable",
"--nnbd-strong",
]
}
diff --git a/utils/dartdevc/BUILD.gn b/utils/dartdevc/BUILD.gn
index 254af29..9b9f07c 100644
--- a/utils/dartdevc/BUILD.gn
+++ b/utils/dartdevc/BUILD.gn
@@ -223,8 +223,6 @@
args += invoker.args
}
- args += [ "--enable-experiment=non-nullable" ]
-
if (invoker.sound_null_safety) {
args += [ "--sound-null-safety" ]
}
@@ -287,7 +285,6 @@
args = [
"--target=dartdevc",
"dart:core",
- "--enable-experiment=non-nullable",
]
if (invoker.sound_null_safety) {
@@ -379,7 +376,6 @@
"-o",
rebase_path("$js_gen_dir/legacy/dart_sdk.js"),
rebase_path("$platform_input"),
- "--enable-experiment=non-nullable",
]
if (invoker.sound_null_safety) {