Have the package:analyzer strong mode option hard coded to on. Delete several spec mode only tests.

Change-Id: I5dffec68d9845fe75936d55100c03306b6eda363
Reviewed-on: https://dart-review.googlesource.com/64060
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
Devon Carew 2018-07-10 05:30:10 +00:00 committed by commit-bot@chromium.org
parent 94ca9b35af
commit 2dd33c2a6c
45 changed files with 87 additions and 333 deletions

View file

@ -140,7 +140,7 @@ class _IsTestGroup {
new ContextRoot(resourceProvider.convertPath('/project'), [],
pathContext: resourceProvider.pathContext),
sourceFactory,
new AnalysisOptionsImpl()..strongMode = true);
new AnalysisOptionsImpl());
scheduler.start();
AnalysisEngine.instance.logger = PrintLogger.instance;
}

View file

@ -468,6 +468,6 @@ class B extends A {}
contentOverlay,
null,
new SourceFactory(resolvers, null, resourceProvider),
new AnalysisOptionsImpl()..strongMode = true);
new AnalysisOptionsImpl());
}
}

View file

@ -1,3 +1,7 @@
## unreleased
* Deprecate the `AnalysisOptions.strongMode` flag. This is now hard-coded to
always return true.
## 0.32.3
* Pull fix in kernel package where non-executable util.dart was moved out of bin/.

View file

@ -34,7 +34,6 @@ void main(List<String> args) {
AnalysisEngine.instance.clearCaches();
AnalysisOptionsImpl options = new AnalysisOptionsImpl();
options.strongMode = true;
options.strongModeHints = true;
PhysicalResourceProvider resourceProvider =

View file

@ -32,7 +32,6 @@ const String packagesOption = 'packages';
const String sdkPathOption = 'dart-sdk';
const String sdkSummaryPathOption = 'dart-sdk-summary';
const String strongModeFlag = 'strong';
/**
* Update [options] with the value of each analysis option command line flag.
@ -64,8 +63,6 @@ void applyAnalysisOptionFlags(AnalysisOptionsImpl options, ArgResults args,
options.implicitDynamic = !args[noImplicitDynamicFlag];
verbose('$noImplicitDynamicFlag = ${options.implicitDynamic}');
}
options.strongMode = args[strongModeFlag];
verbose('$strongModeFlag = ${options.strongMode}');
try {
if (args.wasParsed(lintsFlag)) {
options.lint = args[lintsFlag];
@ -81,7 +78,7 @@ void applyAnalysisOptionFlags(AnalysisOptionsImpl options, ArgResults args,
* create a context builder.
*/
ContextBuilderOptions createContextBuilderOptions(ArgResults args,
{bool strongMode, bool trackCacheDependencies}) {
{bool trackCacheDependencies}) {
ContextBuilderOptions builderOptions = new ContextBuilderOptions();
builderOptions.argResults = args;
//
@ -97,9 +94,6 @@ ContextBuilderOptions createContextBuilderOptions(ArgResults args,
//
AnalysisOptionsImpl defaultOptions = new AnalysisOptionsImpl();
applyAnalysisOptionFlags(defaultOptions, args);
if (strongMode != null) {
defaultOptions.strongMode = strongMode;
}
if (trackCacheDependencies != null) {
defaultOptions.trackCacheDependencies = trackCacheDependencies;
}
@ -168,7 +162,7 @@ void defineAnalysisArguments(ArgParser parser, {bool hide: true, ddc: false}) {
help: 'The path to a package root directory (deprecated). '
'This option cannot be used with --packages.',
hide: ddc && hide);
parser.addFlag(strongModeFlag,
parser.addFlag('strong',
help: 'Enable strong mode (deprecated); this option is now ignored.',
defaultsTo: true,
hide: true,

View file

@ -316,7 +316,6 @@ class AnalysisContextImpl implements InternalAnalysisContext {
if (this._options.strongMode != options.strongMode) {
_typeSystem = null;
}
this._options.strongMode = options.strongMode;
this._options.useFastaParser = options.useFastaParser;
this._options.previewDart2 = options.previewDart2;
this._options.trackCacheDependencies = options.trackCacheDependencies;

View file

@ -1303,7 +1303,11 @@ abstract class AnalysisOptions {
/**
* Return `true` if strong mode analysis should be used.
*
* This field is deprecated, and is hard-coded to always return true.
*/
@Deprecated(
'This field is deprecated and is hard-coded to always return true.')
bool get strongMode;
/**
@ -1440,7 +1444,12 @@ class AnalysisOptionsImpl implements AnalysisOptions {
@override
bool preserveComments = true;
bool _strongMode = true;
@override
bool get strongMode => true;
@Deprecated(
"The strongMode field is deprecated, and shouldn't be assigned to")
set strongMode(bool value) {}
/**
* A flag indicating whether strong-mode inference hints should be
@ -1513,7 +1522,6 @@ class AnalysisOptionsImpl implements AnalysisOptions {
lint = options.lint;
lintRules = options.lintRules;
preserveComments = options.preserveComments;
strongMode = options.strongMode;
useFastaParser = options.useFastaParser;
previewDart2 = options.previewDart2;
if (options is AnalysisOptionsImpl) {
@ -1653,9 +1661,9 @@ class AnalysisOptionsImpl implements AnalysisOptions {
buffer.addBool(enableSuperMixins);
buffer.addBool(implicitCasts);
buffer.addBool(implicitDynamic);
buffer.addBool(strongMode);
buffer.addBool(strongModeHints);
buffer.addBool(useFastaParser);
buffer.addBool(previewDart2);
// Append error processors.
buffer.addInt(errorProcessors.length);
@ -1682,13 +1690,6 @@ class AnalysisOptionsImpl implements AnalysisOptions {
return _signature;
}
@override
bool get strongMode => _strongMode || previewDart2;
void set strongMode(bool value) {
_strongMode = value;
}
@override
void resetToDefaults() {
declarationCasts = true;
@ -1710,7 +1711,6 @@ class AnalysisOptionsImpl implements AnalysisOptions {
nonnullableTypes = NONNULLABLE_TYPES;
patchPaths = {};
preserveComments = true;
strongMode = false;
strongModeHints = false;
trackCacheDependencies = true;
useFastaParser = false;
@ -1720,7 +1720,6 @@ class AnalysisOptionsImpl implements AnalysisOptions {
void setCrossContextOptionsFrom(AnalysisOptions options) {
enableLazyAssignmentOperators = options.enableLazyAssignmentOperators;
enableSuperMixins = options.enableSuperMixins;
strongMode = options.strongMode;
if (options is AnalysisOptionsImpl) {
strongModeHints = options.strongModeHints;
}
@ -2568,9 +2567,8 @@ class ObsoleteSourceAnalysisException extends AnalysisException {
* Initialize a newly created exception to represent the removal of the given
* [source].
*/
ObsoleteSourceAnalysisException(Source source)
: super(
"The source '${source.fullName}' was removed while it was being analyzed") {
ObsoleteSourceAnalysisException(Source source) : super("The source '${source
.fullName}' was removed while it was being analyzed") {
this._source = source;
}

View file

@ -48,7 +48,6 @@ void printAndFail(String message, {int exitCode: 15}) {
AnalysisOptions _buildAnalyzerOptions(LinterOptions options) {
AnalysisOptionsImpl analysisOptions = new AnalysisOptionsImpl();
analysisOptions.strongMode = options.strongMode;
analysisOptions.hint = false;
analysisOptions.previewDart2 = options.previewDart2;
analysisOptions.lint = options.enableLints;

View file

@ -45,7 +45,7 @@ class SummaryBuilder {
FolderBasedDartSdk sdk = new FolderBasedDartSdk(
resourceProvider, resourceProvider.getFolder(sdkPath), strong);
sdk.useSummary = false;
sdk.analysisOptions = new AnalysisOptionsImpl()..strongMode = strong;
sdk.analysisOptions = new AnalysisOptionsImpl();
//
// Prepare 'dart:' URIs to serialize.

View file

@ -60,8 +60,7 @@ class SummaryBasedDartSdk implements DartSdk {
@override
AnalysisContext get context {
if (_analysisContext == null) {
AnalysisOptionsImpl analysisOptions = new AnalysisOptionsImpl()
..strongMode = strongMode;
AnalysisOptionsImpl analysisOptions = new AnalysisOptionsImpl();
_analysisContext = new SdkAnalysisContext(analysisOptions);
SourceFactory factory = new SourceFactory(
[new DartUriResolver(this)], null, resourceProvider);

View file

@ -665,7 +665,6 @@ class _OptionsProcessor {
void _applyStrongOptions(AnalysisOptionsImpl options, YamlNode config) {
if (config is YamlMap) {
options.strongMode = true;
config.nodes.forEach((k, v) {
if (k is YamlScalar && v is YamlScalar) {
_applyStrongModeOption(options, k.value?.toString(), v.value);

View file

@ -99,8 +99,6 @@ class AnalysisContextFactory {
SourceFactory sourceFactory = new SourceFactory(resolvers);
context.sourceFactory = sourceFactory;
AnalysisContext coreContext = sdk.context;
(coreContext.analysisOptions as AnalysisOptionsImpl).strongMode =
context.analysisOptions.strongMode;
//
// dart:core
//

View file

@ -20,8 +20,7 @@ main() {
@reflectiveTest
class CheckedModeCompileTimeErrorCodeTest extends ResolverTestCase {
@override
AnalysisOptions get defaultAnalysisOptions =>
new AnalysisOptionsImpl()..strongMode = true;
AnalysisOptions get defaultAnalysisOptions => new AnalysisOptionsImpl();
test_assertion_throws() async {
Source source = addSource(r'''
@ -493,7 +492,6 @@ var v = const A(null);''');
}
test_listLiteral_inferredElementType() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
Source source = addSource('''
const Object x = [1];
const List<String> y = x;
@ -515,7 +513,6 @@ const List<String> y = x;
}
test_mapLiteral_inferredKeyType() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
Source source = addSource('''
const Object x = {1: 1};
const Map<String, dynamic> y = x;
@ -527,7 +524,6 @@ const Map<String, dynamic> y = x;
}
test_mapLiteral_inferredValueType() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
Source source = addSource('''
const Object x = {1: 1};
const Map<dynamic, String> y = x;

View file

@ -110,8 +110,7 @@ class C = A with String, num;''');
@reflectiveTest
class CompileTimeErrorCodeTest extends ResolverTestCase {
@override
AnalysisOptions get defaultAnalysisOptions =>
new AnalysisOptionsImpl()..strongMode = true;
AnalysisOptions get defaultAnalysisOptions => new AnalysisOptionsImpl();
disabled_test_conflictingGenericInterfaces_hierarchyLoop_infinite() async {
// There is an interface conflict here due to a loop in the class
@ -4380,7 +4379,6 @@ class C extends B with M {
test_mixinInference_conflictingSubstitution() async {
AnalysisOptionsImpl options = new AnalysisOptionsImpl();
options.enableSuperMixins = true;
options.strongMode = true;
resetWith(options: options);
Source source = addSource('''
abstract class A<T> {}
@ -4398,7 +4396,6 @@ class C extends A<Map<int, String>> with M {}
test_mixinInference_doNotIgnorePreviousExplicitMixins() async {
AnalysisOptionsImpl options = new AnalysisOptionsImpl();
options.enableSuperMixins = true;
options.strongMode = true;
resetWith(options: options);
Source source = addSource('''
class A extends Object with B<String>, C {}
@ -4415,7 +4412,6 @@ class C<T> extends B<T> {}
test_mixinInference_impossibleSubstitution() async {
AnalysisOptionsImpl options = new AnalysisOptionsImpl();
options.enableSuperMixins = true;
options.strongMode = true;
resetWith(options: options);
Source source = addSource('''
abstract class A<T> {}
@ -4432,7 +4428,6 @@ class C extends A<List<int>> with M {}
test_mixinInference_matchingClass() async {
AnalysisOptionsImpl options = new AnalysisOptionsImpl();
options.enableSuperMixins = true;
options.strongMode = true;
resetWith(options: options);
Source source = addSource('''
abstract class A<T> {}
@ -4447,7 +4442,6 @@ class C extends A<int> with M {}
test_mixinInference_matchingClass_inPreviousMixin() async {
AnalysisOptionsImpl options = new AnalysisOptionsImpl();
options.enableSuperMixins = true;
options.strongMode = true;
resetWith(options: options);
Source source = addSource('''
abstract class A<T> {}
@ -4463,7 +4457,6 @@ class C extends Object with M1, M2 {}
test_mixinInference_noMatchingClass() async {
AnalysisOptionsImpl options = new AnalysisOptionsImpl();
options.enableSuperMixins = true;
options.strongMode = true;
resetWith(options: options);
Source source = addSource('''
abstract class A<T> {}
@ -4480,7 +4473,6 @@ class C extends Object with M {}
test_mixinInference_noMatchingClass_constraintSatisfiedByImplementsClause() async {
AnalysisOptionsImpl options = new AnalysisOptionsImpl();
options.enableSuperMixins = true;
options.strongMode = true;
resetWith(options: options);
Source source = addSource('''
abstract class A<T> {}
@ -4498,7 +4490,6 @@ class C extends Object with M implements A<B> {}
test_mixinInference_noMatchingClass_namedMixinApplication() async {
AnalysisOptionsImpl options = new AnalysisOptionsImpl();
options.enableSuperMixins = true;
options.strongMode = true;
resetWith(options: options);
Source source = addSource('''
abstract class A<T> {}
@ -4514,7 +4505,6 @@ class C = Object with M;
test_mixinInference_noMatchingClass_noSuperclassConstraint() async {
AnalysisOptionsImpl options = new AnalysisOptionsImpl();
options.enableSuperMixins = true;
options.strongMode = true;
resetWith(options: options);
Source source = addSource('''
abstract class A<T> {}
@ -4529,7 +4519,6 @@ class C extends Object with M {}
test_mixinInference_noMatchingClass_typeParametersSupplied() async {
AnalysisOptionsImpl options = new AnalysisOptionsImpl();
options.enableSuperMixins = true;
options.strongMode = true;
resetWith(options: options);
Source source = addSource('''
abstract class A<T> {}
@ -4546,7 +4535,6 @@ class C extends Object with M<int> {}
// See dartbug.com/32353 for a detailed explanation.
AnalysisOptionsImpl options = new AnalysisOptionsImpl();
options.enableSuperMixins = true;
options.strongMode = true;
resetWith(options: options);
Source source = addSource('''
class ioDirectory implements ioFileSystemEntity {}
@ -5634,7 +5622,6 @@ var b = const B();''');
}
test_nonConstValueInInitializer_instanceCreation_inDifferentFile() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
Source sourceA = addNamedSource('/a.dart', r'''
import 'b.dart';
const v = const MyClass();
@ -7384,7 +7371,6 @@ class A {
assertErrors(source,
[CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR_MINUS]);
verify([source]);
reset();
}
test_wrongNumberOfParametersForOperator_tilde() async {
@ -7565,7 +7551,6 @@ f() {
assertErrors(source, [CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION]);
// no verify(), 'null x' is not resolved
}
reset();
}
Future<Null> _check_constEvalTypeBool_withParameter_binary(
@ -7581,7 +7566,6 @@ class A {
StaticTypeWarningCode.NON_BOOL_OPERAND
]);
verify([source]);
reset();
}
Future<Null> _check_constEvalTypeInt_withParameter_binary(String expr) async {
@ -7596,7 +7580,6 @@ class A {
StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE
]);
verify([source]);
reset();
}
Future<Null> _check_constEvalTypeNum_withParameter_binary(String expr) async {
@ -7611,7 +7594,6 @@ class A {
StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE
]);
verify([source]);
reset();
}
Future<Null> _check_wrongNumberOfParametersForOperator(
@ -7624,7 +7606,6 @@ class A {
assertErrors(
source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR]);
verify([source]);
reset();
}
Future<Null> _check_wrongNumberOfParametersForOperator1(String name) async {
@ -7633,7 +7614,6 @@ class A {
}
Future<Null> _privateCollisionInMixinApplicationTest(String testCode) async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
addNamedSource('/lib1.dart', '''
class A {
int _x;

View file

@ -815,7 +815,7 @@ part 'foo.bar';
class StrongModeDeclarationResolverTest extends ResolverTestCase {
@override
void setUp() {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
reset();
}
test_genericFunction_typeParameter() async {

View file

@ -53,7 +53,6 @@ class AnalysisOptionsImplTest {
'dart:core': ['/dart_core.patch.dart']
};
modifiedOptions.preserveComments = false;
modifiedOptions.strongMode = true;
modifiedOptions.trackCacheDependencies = false;
modifiedOptions.resetToDefaults();
@ -76,7 +75,6 @@ class AnalysisOptionsImplTest {
expect(modifiedOptions.lintRules, defaultOptions.lintRules);
expect(modifiedOptions.patchPaths, defaultOptions.patchPaths);
expect(modifiedOptions.preserveComments, defaultOptions.preserveComments);
expect(modifiedOptions.strongMode, defaultOptions.strongMode);
expect(modifiedOptions.trackCacheDependencies,
defaultOptions.trackCacheDependencies);
}

View file

@ -3050,7 +3050,6 @@ class C {
test_strongMode_downCastCompositeHint() async {
AnalysisOptionsImpl options = new AnalysisOptionsImpl();
options.strongMode = true;
options.strongModeHints = true;
resetWith(options: options);
Source source = addSource(r'''
@ -3066,7 +3065,6 @@ main() {
test_strongMode_downCastCompositeNoHint() async {
AnalysisOptionsImpl options = new AnalysisOptionsImpl();
options.strongMode = true;
options.strongModeHints = false;
resetWith(options: options);
Source source = addSource(r'''
@ -3091,7 +3089,6 @@ main() {
},
}
}));
options.strongMode = true;
options.strongModeHints = false;
resetWith(options: options);
Source source = addSource(r'''
@ -3106,7 +3103,6 @@ main() {
}
test_strongMode_topLevelInstanceGetter() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
Source source = addSource('''
class A {
int get g => 0;
@ -3121,7 +3117,6 @@ var b = new A().g;
}
test_strongMode_topLevelInstanceGetter_call() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
Source source = addSource('''
class A {
int Function() get g => () => 0;
@ -3137,7 +3132,6 @@ var b = a.g();
}
test_strongMode_topLevelInstanceGetter_field() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
Source source = addSource('''
class A {
int g;
@ -3152,7 +3146,6 @@ var b = new A().g;
}
test_strongMode_topLevelInstanceGetter_field_call() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
Source source = addSource('''
class A {
int Function() g;
@ -3168,7 +3161,6 @@ var b = a.g();
}
test_strongMode_topLevelInstanceGetter_field_prefixedIdentifier() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
Source source = addSource('''
class A {
int g;
@ -3184,7 +3176,6 @@ var b = a.g;
}
test_strongMode_topLevelInstanceGetter_implicitlyTyped() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
Source source = addSource('''
class A {
get g => 0;
@ -3201,7 +3192,6 @@ var b = new A().g;
}
test_strongMode_topLevelInstanceGetter_implicitlyTyped_call() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
Source source = addSource('''
class A {
get g => () => 0;
@ -3219,7 +3209,6 @@ var b = a.g();
}
test_strongMode_topLevelInstanceGetter_implicitlyTyped_field() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
Source source = addSource('''
class A {
var g = 0;
@ -3236,7 +3225,6 @@ var b = new A().g;
}
test_strongMode_topLevelInstanceGetter_implicitlyTyped_field_call() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
Source source = addSource('''
class A {
var g = () => 0;
@ -3254,7 +3242,6 @@ var b = a.g();
}
test_strongMode_topLevelInstanceGetter_implicitlyTyped_field_prefixedIdentifier() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
Source source = addSource('''
class A {
var g = 0;
@ -3272,7 +3259,6 @@ var b = a.g;
}
test_strongMode_topLevelInstanceGetter_implicitlyTyped_fn() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
Source source = addSource('''
class A {
var x = 0;
@ -3293,7 +3279,6 @@ var b = f(a.x);
}
test_strongMode_topLevelInstanceGetter_implicitlyTyped_fn_explicit_type_params() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
Source source = addSource('''
class A {
var x = 0;
@ -3310,7 +3295,6 @@ var b = f<int>(a.x);
}
test_strongMode_topLevelInstanceGetter_implicitlyTyped_fn_not_generic() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
Source source = addSource('''
class A {
var x = 0;
@ -3327,7 +3311,6 @@ var b = f(a.x);
}
test_strongMode_topLevelInstanceGetter_implicitlyTyped_indexExpression() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
Source source = addSource('''
class A {
var x = 0;
@ -3344,7 +3327,6 @@ var b = a[a.x];
}
test_strongMode_topLevelInstanceGetter_implicitlyTyped_invoke() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
Source source = addSource('''
class A {
var x = 0;
@ -3364,7 +3346,6 @@ var b = (<T>(y) => 0)(a.x);
}
test_strongMode_topLevelInstanceGetter_implicitlyTyped_invoke_explicit_type_params() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
Source source = addSource('''
class A {
var x = 0;
@ -3380,7 +3361,6 @@ var b = (<T>(y) => 0)<int>(a.x);
}
test_strongMode_topLevelInstanceGetter_implicitlyTyped_invoke_not_generic() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
Source source = addSource('''
class A {
var x = 0;
@ -3396,7 +3376,6 @@ var b = ((y) => 0)(a.x);
}
test_strongMode_topLevelInstanceGetter_implicitlyTyped_method() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
Source source = addSource('''
class A {
var x = 0;
@ -3417,7 +3396,6 @@ var b = a.f(a.x);
}
test_strongMode_topLevelInstanceGetter_implicitlyTyped_method_explicit_type_params() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
Source source = addSource('''
class A {
var x = 0;
@ -3434,7 +3412,6 @@ var b = a.f<int>(a.x);
}
test_strongMode_topLevelInstanceGetter_implicitlyTyped_method_not_generic() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
Source source = addSource('''
class A {
var x = 0;
@ -3451,7 +3428,6 @@ var b = a.f(a.x);
}
test_strongMode_topLevelInstanceGetter_implicitlyTyped_new() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
Source source = addSource('''
class A {
var x = 0;
@ -3474,7 +3450,6 @@ var b = new B(a.x);
}
test_strongMode_topLevelInstanceGetter_implicitlyTyped_new_explicit_type_params() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
Source source = addSource('''
class A {
var x = 0;
@ -3493,7 +3468,6 @@ var b = new B<int>(a.x);
}
test_strongMode_topLevelInstanceGetter_implicitlyTyped_new_explicit_type_params_named() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
Source source = addSource('''
class A {
var x = 0;
@ -3512,7 +3486,6 @@ var b = new B<int>.named(a.x);
}
test_strongMode_topLevelInstanceGetter_implicitlyTyped_new_explicit_type_params_prefixed() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
addNamedSource('/lib1.dart', '''
class B<T> {
B(x);
@ -3534,7 +3507,6 @@ var b = new foo.B<int>(a.x);
}
test_strongMode_topLevelInstanceGetter_implicitlyTyped_new_named() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
Source source = addSource('''
class A {
var x = 0;
@ -3557,7 +3529,6 @@ var b = new B.named(a.x);
}
test_strongMode_topLevelInstanceGetter_implicitlyTyped_new_not_generic() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
Source source = addSource('''
class A {
var x = 0;
@ -3576,7 +3547,6 @@ var b = new B(a.x);
}
test_strongMode_topLevelInstanceGetter_implicitlyTyped_new_not_generic_named() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
Source source = addSource('''
class A {
var x = 0;
@ -3595,7 +3565,6 @@ var b = new B.named(a.x);
}
test_strongMode_topLevelInstanceGetter_implicitlyTyped_new_not_generic_prefixed() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
addNamedSource('/lib1.dart', '''
class B {
B(x);
@ -3617,7 +3586,6 @@ var b = new foo.B(a.x);
}
test_strongMode_topLevelInstanceGetter_implicitlyTyped_new_prefixed() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
addNamedSource('/lib1.dart', '''
class B<T> {
B(x);
@ -3643,7 +3611,6 @@ var b = new foo.B(a.x);
}
test_strongMode_topLevelInstanceGetter_implicitlyTyped_prefixedIdentifier() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
Source source = addSource('''
class A {
get g => 0;
@ -3661,7 +3628,6 @@ var b = a.g;
}
test_strongMode_topLevelInstanceGetter_implicitlyTyped_propertyAccessLhs() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
Source source = addSource('''
class A {
var x = new B();
@ -3685,7 +3651,6 @@ var b = (a.x).y;
}
test_strongMode_topLevelInstanceGetter_prefixedIdentifier() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
Source source = addSource('''
class A {
int get g => 0;
@ -3701,7 +3666,6 @@ var b = a.g;
}
test_strongMode_topLevelInstanceMethod() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
Source source = addSource('''
class A {
f() => 0;
@ -3718,7 +3682,6 @@ var x = new A().f();
}
test_strongMode_topLevelInstanceMethod_parameter() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
Source source = addSource('''
class A {
int f(v) => 0;
@ -3731,7 +3694,6 @@ var x = new A().f(0);
}
test_strongMode_topLevelInstanceMethod_parameter_generic() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
Source source = addSource('''
class A {
int f<T>(v) => 0;
@ -3748,7 +3710,6 @@ var x = new A().f(0);
}
test_strongMode_topLevelInstanceMethod_parameter_generic_explicit() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
Source source = addSource('''
class A {
int f<T>(v) => 0;
@ -3761,7 +3722,6 @@ var x = new A().f<int>(0);
}
test_strongMode_topLevelInstanceMethod_static() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
Source source = addSource('''
class A {
static f() => 0;
@ -3774,7 +3734,6 @@ var x = A.f();
}
test_strongMode_topLevelInstanceMethod_tearoff() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
Source source = addSource('''
class A {
f() => 0;
@ -3791,7 +3750,6 @@ var x = new A().f;
}
test_strongMode_topLevelInstanceMethod_tearoff_parameter() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
Source source = addSource('''
class A {
int f(v) => 0;
@ -3808,7 +3766,6 @@ var x = new A().f;
}
test_strongMode_topLevelInstanceMethod_tearoff_static() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
Source source = addSource('''
class A {
static f() => 0;

View file

@ -26,8 +26,7 @@ main() {
@reflectiveTest
class InvalidCodeTest extends ResolverTestCase {
@override
AnalysisOptions get defaultAnalysisOptions =>
new AnalysisOptionsImpl()..strongMode = true;
AnalysisOptions get defaultAnalysisOptions => new AnalysisOptionsImpl();
/**
* This code results in a method with the empty name, and the default

View file

@ -29,8 +29,7 @@ main() {
@reflectiveTest
class NonErrorResolverTest extends ResolverTestCase {
@override
AnalysisOptions get defaultAnalysisOptions =>
new AnalysisOptionsImpl()..strongMode = true;
AnalysisOptions get defaultAnalysisOptions => new AnalysisOptionsImpl();
fail_undefinedEnumConstant() async {
Source source = addSource(r'''
@ -315,10 +314,7 @@ process(Object x) {}''');
}
test_argumentTypeNotAssignable_optionalNew() async {
resetWith(
options: new AnalysisOptionsImpl()
..previewDart2 = true
..strongMode = true);
resetWith(options: new AnalysisOptionsImpl()..previewDart2 = true);
Source source = addSource(r'''
class Widget { }
@ -1100,8 +1096,7 @@ typedef Foo<T> = Function<S>(int p);
CompilationUnit unit = analysisResult.unit;
Element getElement(String search) {
return EngineTestCase
.findSimpleIdentifier(unit, code, search)
return EngineTestCase.findSimpleIdentifier(unit, code, search)
.staticElement;
}
@ -1295,7 +1290,6 @@ const Type d = dynamic;
}
test_const_imported_defaultParameterValue_withImportPrefix() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
Source source = addNamedSource("/a.dart", r'''
import 'b.dart';
const b = const B();
@ -2702,7 +2696,6 @@ class C implements A, B {
test_infer_mixin() async {
AnalysisOptionsImpl options = new AnalysisOptionsImpl();
options.enableSuperMixins = true;
options.strongMode = true;
resetWith(options: options);
Source source = addSource('''
abstract class A<T> {}
@ -2727,7 +2720,6 @@ class C extends A<B> with M {}
test_infer_mixin_multiplyConstrained() async {
AnalysisOptionsImpl options = new AnalysisOptionsImpl();
options.enableSuperMixins = true;
options.strongMode = true;
resetWith(options: options);
Source source = addSource('''
abstract class A<T> {}
@ -2758,7 +2750,6 @@ class F extends E with M {}
test_infer_mixin_with_substitution() async {
AnalysisOptionsImpl options = new AnalysisOptionsImpl();
options.enableSuperMixins = true;
options.strongMode = true;
resetWith(options: options);
Source source = addSource('''
abstract class A<T> {}
@ -2783,7 +2774,6 @@ class C extends A<List<B>> with M {}
test_infer_mixin_with_substitution_functionType() async {
AnalysisOptionsImpl options = new AnalysisOptionsImpl();
options.enableSuperMixins = true;
options.strongMode = true;
resetWith(options: options);
Source source = addSource('''
abstract class A<T> {}
@ -4777,10 +4767,7 @@ main() {
}
test_optionalNew_rewrite() async {
resetWith(
options: new AnalysisOptionsImpl()
..previewDart2 = true
..strongMode = true);
resetWith(options: new AnalysisOptionsImpl()..previewDart2 = true);
Source source = addSource(r'''
import 'b.dart';
main() {
@ -4820,10 +4807,7 @@ class B {
}
test_optionalNew_rewrite_instantiatesToBounds() async {
resetWith(
options: new AnalysisOptionsImpl()
..previewDart2 = true
..strongMode = true);
resetWith(options: new AnalysisOptionsImpl()..previewDart2 = true);
Source source = addSource(r'''
import 'b.dart';
@ -6429,7 +6413,6 @@ class A {
await computeAnalysisResult(source);
assertNoErrors(source);
verify([source]);
reset();
}
Future<Null> _check_wrongNumberOfParametersForOperator1(String name) async {

View file

@ -674,9 +674,7 @@ class ResolverTestCase extends EngineTestCase {
options ??= defaultAnalysisOptions;
if (enableNewAnalysisDriver) {
if (useCFE) {
(options as AnalysisOptionsImpl)
..strongMode = true
..useFastaParser = true;
(options as AnalysisOptionsImpl)..useFastaParser = true;
}
DartSdk sdk = new MockSdk(resourceProvider: resourceProvider)
..context.analysisOptions = options;
@ -958,5 +956,6 @@ class TestAnalysisResult {
final Source source;
final CompilationUnit unit;
final List<AnalysisError> errors;
TestAnalysisResult(this.source, this.unit, this.errors);
}

View file

@ -89,11 +89,9 @@ class SdkDescriptionTest extends EngineTestCase {
void test_equals_samePaths_differentOptions() {
String path = '/a/b/c';
AnalysisOptionsImpl leftOptions = new AnalysisOptionsImpl()
..previewDart2 = false
..strongMode = false;
..previewDart2 = false;
AnalysisOptionsImpl rightOptions = new AnalysisOptionsImpl()
..previewDart2 = true
..strongMode = true;
..previewDart2 = true;
SdkDescription left = new SdkDescription(<String>[path], leftOptions);
SdkDescription right = new SdkDescription(<String>[path], rightOptions);
expect(left == right, isFalse);

View file

@ -1624,7 +1624,6 @@ class StaticTypeAnalyzerTest extends EngineTestCase {
InternalAnalysisContext context;
if (strongMode) {
AnalysisOptionsImpl options = new AnalysisOptionsImpl();
options.strongMode = true;
context = AnalysisContextFactory.contextWithCoreAndOptions(options,
resourceProvider: resourceProvider);
} else {

View file

@ -436,7 +436,6 @@ int f() async* {}
}
test_illegalAsyncGeneratorReturnType_function_subtypeOfStream() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
await assertErrorsInCode('''
import 'dart:async';
abstract class SubStream<T> implements Stream<T> {}
@ -453,7 +452,6 @@ class C {
}
test_illegalAsyncGeneratorReturnType_method_subtypeOfStream() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
await assertErrorsInCode('''
import 'dart:async';
abstract class SubStream<T> implements Stream<T> {}
@ -473,7 +471,6 @@ int f() async {}
}
test_illegalAsyncReturnType_function_subtypeOfFuture() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
await assertErrorsInCode('''
import 'dart:async';
abstract class SubFuture<T> implements Future<T> {}
@ -495,7 +492,6 @@ class C {
}
test_illegalAsyncReturnType_method_subtypeOfFuture() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
await assertErrorsInCode('''
import 'dart:async';
abstract class SubFuture<T> implements Future<T> {}
@ -514,7 +510,6 @@ int f() sync* {}
}
test_illegalSyncGeneratorReturnType_function_subclassOfIterator() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
await assertErrorsInCode('''
abstract class SubIterator<T> implements Iterator<T> {}
SubIterator<int> f() sync* {}
@ -530,7 +525,6 @@ class C {
}
test_illegalSyncGeneratorReturnType_method_subclassOfIterator() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
await assertErrorsInCode('''
abstract class SubIterator<T> implements Iterator<T> {}
class C {
@ -1114,7 +1108,6 @@ var b = 1 is G<B>;
}
test_typeArgumentNotMatchingBounds_methodInvocation_localFunction() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
await assertErrorsInCode(r'''
class Point<T extends num> {
Point(T x, T y);
@ -1130,7 +1123,6 @@ main() {
}
test_typeArgumentNotMatchingBounds_methodInvocation_method() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
await assertErrorsInCode(r'''
class Point<T extends num> {
Point(T x, T y);
@ -1149,7 +1141,6 @@ f(PointFactory factory) {
}
test_typeArgumentNotMatchingBounds_methodInvocation_topLevelFunction() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
await assertErrorsInCode(r'''
class Point<T extends num> {
Point(T x, T y);
@ -2044,7 +2035,6 @@ class StrongModeStaticTypeWarningCodeTest extends ResolverTestCase {
void setUp() {
super.setUp();
AnalysisOptionsImpl options = new AnalysisOptionsImpl();
options.strongMode = true;
resetWith(options: options);
}

View file

@ -370,7 +370,6 @@ f(A a) {
}
test_argumentTypeNotAssignable_call() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
Source source = addSource(r'''
typedef bool Predicate<T>(T object);
@ -3243,7 +3242,6 @@ class C implements I {
}
test_nonAbstractClassInheritsAbstractMemberOne_method_fromInterface_abstractNSM() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
Source source = addSource(r'''
class I {
m(p) {}
@ -3258,7 +3256,6 @@ class C implements I {
}
test_nonAbstractClassInheritsAbstractMemberOne_method_fromInterface_abstractOverrideNSM() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
Source source = addSource(r'''
class I {
m(p) {}
@ -3275,7 +3272,6 @@ class C extends B implements I {
}
test_nonAbstractClassInheritsAbstractMemberOne_method_fromInterface_ifcNSM() async {
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
Source source = addSource(r'''
class I {
m(p) {}

View file

@ -95,7 +95,6 @@ class StrongModeLocalInferenceTest extends ResolverTestCase {
void setUp() {
super.setUp();
AnalysisOptionsImpl options = new AnalysisOptionsImpl();
options.strongMode = true;
resetWith(options: options);
}
@ -2810,7 +2809,6 @@ class StrongModeStaticTypeAnalyzer2Test extends StaticTypeAnalyzer2TestShared {
void setUp() {
super.setUp();
AnalysisOptionsImpl options = new AnalysisOptionsImpl();
options.strongMode = true;
resetWith(options: options);
}
@ -4357,7 +4355,6 @@ class StrongModeTypePropagationTest extends ResolverTestCase {
void setUp() {
super.setUp();
AnalysisOptionsImpl options = new AnalysisOptionsImpl();
options.strongMode = true;
resetWith(options: options);
}

View file

@ -629,24 +629,8 @@ b:${pathContext.toUri(packageB)}
expect(sdk, isNotNull);
}
void test_findSdk_noPackageMap_html_spec() {
DartSdk sdk = builder.findSdk(
null,
new AnalysisOptionsImpl()
..previewDart2 = false
..strongMode = false);
expect(sdk, isNotNull);
Source htmlSource = sdk.mapDartUri('dart:html');
expect(
htmlSource.fullName,
resourceProvider
.convertPath('/sdk/lib/html/dartium/html_dartium.dart'));
expect(htmlSource.exists(), isTrue);
}
void test_findSdk_noPackageMap_html_strong() {
DartSdk sdk =
builder.findSdk(null, new AnalysisOptionsImpl()..strongMode = true);
DartSdk sdk = builder.findSdk(null, new AnalysisOptionsImpl());
expect(sdk, isNotNull);
Source htmlSource = sdk.mapDartUri('dart:html');
expect(

View file

@ -148,8 +148,7 @@ class AnalysisContextImplTest extends AbstractContextTest {
void test_applyChanges_addNewImport_invalidateLibraryCycle() {
context.analysisOptions =
new AnalysisOptionsImpl.from(context.analysisOptions)
..strongMode = true;
new AnalysisOptionsImpl.from(context.analysisOptions);
Source embedder = addSource('/a.dart', r'''
library a;
import 'b.dart';
@ -2386,7 +2385,7 @@ import 'package:crypto/crypto.dart';
@failingTest // TODO(paulberry): Remove the annotation when dartbug.com/28515 is fixed.
void test_resolveCompilationUnit_existingElementModel() {
prepareAnalysisContext(new AnalysisOptionsImpl()..strongMode = true);
prepareAnalysisContext(new AnalysisOptionsImpl());
Source source = addSource('/test.dart', r'''
library test;
@ -2793,7 +2792,7 @@ int aa = 0;''';
void _checkFlushSingleResolvedUnit(String code,
void validate(CompilationUnitElement unitElement, String reason)) {
prepareAnalysisContext(new AnalysisOptionsImpl()..strongMode = true);
prepareAnalysisContext(new AnalysisOptionsImpl());
String path = resourceProvider.convertPath('/test.dart');
Source source = resourceProvider.newFile(path, code).createSource();
context.applyChanges(new ChangeSet()..addedSource(source));

View file

@ -109,9 +109,8 @@ class BaseAnalysisDriverTest {
enableKernelDriver: useCFE);
}
AnalysisOptionsImpl createAnalysisOptions() => new AnalysisOptionsImpl()
..strongMode = true
..useFastaParser = useCFE;
AnalysisOptionsImpl createAnalysisOptions() =>
new AnalysisOptionsImpl()..useFastaParser = useCFE;
int findOffset(String search) {
int offset = testCode.indexOf(search);

View file

@ -82,7 +82,7 @@ class AnalysisDriverSchedulerTest {
[new DartUriResolver(sdk), new ResourceUriResolver(provider)],
null,
provider),
new AnalysisOptionsImpl()..strongMode = true);
new AnalysisOptionsImpl());
driver.results.forEach(allResults.add);
return driver;
}

View file

@ -57,8 +57,7 @@ class FileSystemStateTest {
}),
new ResourceUriResolver(provider)
], null, provider);
AnalysisOptions analysisOptions = new AnalysisOptionsImpl()
..strongMode = true;
AnalysisOptions analysisOptions = new AnalysisOptionsImpl();
fileSystemState = new FileSystemState(logger, byteStore, contentOverlay,
provider, sourceFactory, analysisOptions, new Uint32List(0));
}

View file

@ -2,7 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
library analyzer.test.constant_test;
library analyzer.test.evaluation_test;
import 'dart:async';
@ -1705,6 +1705,6 @@ const b = 3;''');
class StrongConstantValueComputerTest extends ConstantValueComputerTest {
void setUp() {
super.setUp();
resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
reset();
}
}

View file

@ -1054,7 +1054,7 @@ int _bar;
void _createSdk() {
sdk = new FolderBasedDartSdk(provider, sdkFolder);
sdk.analysisOptions = new AnalysisOptionsImpl()..strongMode = true;
sdk.analysisOptions = new AnalysisOptionsImpl();
}
CompilationUnit _doTopLevelPatching(String baseCode, String patchCode) {

View file

@ -67,22 +67,6 @@ class EmbedderSdkTest extends EmbedderRelatedTest {
expect(sdk.getLinkedBundle(), isNull);
}
void test_getLinkedBundle_spec() {
pathTranslator.newFileWithBytes('$foxPath/spec.sum',
new PackageBundleAssembler().assemble().toBuffer());
EmbedderYamlLocator locator = new EmbedderYamlLocator({
'fox': <Folder>[pathTranslator.getResource(foxLib)]
});
EmbedderSdk sdk = new EmbedderSdk(resourceProvider, locator.embedderYamls);
sdk.analysisOptions = new AnalysisOptionsImpl()..strongMode = false;
sdk.useSummary = true;
if (sdk.analysisOptions.previewDart2) {
expect(sdk.getLinkedBundle(), isNull);
} else {
expect(sdk.getLinkedBundle(), isNotNull);
}
}
void test_getLinkedBundle_strong() {
pathTranslator.newFileWithBytes('$foxPath/strong.sum',
new PackageBundleAssembler().assemble().toBuffer());
@ -90,7 +74,7 @@ class EmbedderSdkTest extends EmbedderRelatedTest {
'fox': <Folder>[pathTranslator.getResource(foxLib)]
});
EmbedderSdk sdk = new EmbedderSdk(resourceProvider, locator.embedderYamls);
sdk.analysisOptions = new AnalysisOptionsImpl()..strongMode = true;
sdk.analysisOptions = new AnalysisOptionsImpl();
sdk.useSummary = true;
expect(sdk.getLinkedBundle(), isNotNull);
}

View file

@ -446,10 +446,12 @@ class C {
checkSimpleExpression('({x}) => 0');
}
@failingTest
void test_pushLocalFunctionReference_nested() {
prepareAnalysisContext(new AnalysisOptionsImpl()
..previewDart2 = false
..strongMode = false);
// TODO(devoncarew): This test fails when run in strong mode.
// Failed assertion: line 5116 pos 16:
// 'Linker._initializerTypeInferenceCycle == null': is not true.
prepareAnalysisContext(new AnalysisOptionsImpl()..previewDart2 = false);
var expr =
checkSimpleExpression('(x) => (y) => x + y') as FunctionExpression;
var outerFunctionElement = expr.element;
@ -470,10 +472,10 @@ class C {
expect(yRef.staticElement, same(yElement));
}
@failingTest
void test_pushLocalFunctionReference_paramReference() {
prepareAnalysisContext(new AnalysisOptionsImpl()
..previewDart2 = false
..strongMode = false);
// TODO(devoncarew): This test fails when run in strong mode.
prepareAnalysisContext(new AnalysisOptionsImpl()..previewDart2 = false);
var expr = checkSimpleExpression('(x, y) => x + y') as FunctionExpression;
var localFunctionElement = expr.element;
var xElement = localFunctionElement.parameters[0];

View file

@ -32,7 +32,6 @@ import 'summary_common.dart';
main() {
defineReflectiveSuite(() {
defineReflectiveTests(ResynthesizeAstSpecTest);
defineReflectiveTests(ResynthesizeAstStrongTest);
defineReflectiveTests(ApplyCheckElementTextReplacements);
});
@ -170,17 +169,8 @@ abstract class AstSerializeTestMixin
}
}
@reflectiveTest
class ResynthesizeAstSpecTest extends _ResynthesizeAstTest {
@override
bool get isStrongMode => false;
}
@reflectiveTest
class ResynthesizeAstStrongTest extends _ResynthesizeAstTest {
@override
bool get isStrongMode => true;
@failingTest // See dartbug.com/32290
test_const_constructor_inferred_args() =>
super.test_const_constructor_inferred_args();
@ -273,13 +263,9 @@ abstract class _ResynthesizeAstTest extends ResynthesizeTest
@override
AnalysisOptionsImpl createOptions() {
if (isStrongMode) {
return super.createOptions()
..previewDart2 = true
..strongMode = true;
return super.createOptions()..previewDart2 = true;
} else {
return super.createOptions()
..previewDart2 = false
..strongMode = false;
return super.createOptions()..previewDart2 = false;
}
}

View file

@ -73,8 +73,10 @@ abstract class AbstractResynthesizeTest extends AbstractSingleUnitTest {
/**
* Return `true` if resynthesizing should be done in strong mode.
*
* Deprecated - remove this getter.
*/
bool get isStrongMode;
bool get isStrongMode => true;
void addLibrary(String uri) {
otherLibrarySources.add(context.sourceFactory.forUri(uri));

View file

@ -277,7 +277,7 @@ class C {
Future<KernelResynthesizer> _createResynthesizer(Uri testUri) async {
var logger = new PerformanceLog(null);
var byteStore = new MemoryByteStore();
var analysisOptions = new AnalysisOptionsImpl()..strongMode = true;
var analysisOptions = new AnalysisOptionsImpl();
var fsState = new FileSystemState(
logger,

View file

@ -83,24 +83,18 @@ final isBuildDirectiveElementsTask =
new TypeMatcher<BuildDirectiveElementsTask>();
final isBuildEnumMemberElementsTask =
new TypeMatcher<BuildEnumMemberElementsTask>();
final isBuildExportNamespaceTask =
new TypeMatcher<BuildExportNamespaceTask>();
final isBuildLibraryElementTask =
new TypeMatcher<BuildLibraryElementTask>();
final isBuildPublicNamespaceTask =
new TypeMatcher<BuildPublicNamespaceTask>();
final isBuildExportNamespaceTask = new TypeMatcher<BuildExportNamespaceTask>();
final isBuildLibraryElementTask = new TypeMatcher<BuildLibraryElementTask>();
final isBuildPublicNamespaceTask = new TypeMatcher<BuildPublicNamespaceTask>();
final isBuildSourceExportClosureTask =
new TypeMatcher<BuildSourceExportClosureTask>();
final isBuildTypeProviderTask =
new TypeMatcher<BuildTypeProviderTask>();
final isBuildTypeProviderTask = new TypeMatcher<BuildTypeProviderTask>();
final isComputeConstantDependenciesTask =
new TypeMatcher<ComputeConstantDependenciesTask>();
final isComputeConstantValueTask =
new TypeMatcher<ComputeConstantValueTask>();
final isComputeConstantValueTask = new TypeMatcher<ComputeConstantValueTask>();
final isComputeInferableStaticVariableDependenciesTask =
new TypeMatcher<ComputeInferableStaticVariableDependenciesTask>();
final isContainingLibrariesTask =
new TypeMatcher<ContainingLibrariesTask>();
final isContainingLibrariesTask = new TypeMatcher<ContainingLibrariesTask>();
final isDartErrorsTask = new TypeMatcher<DartErrorsTask>();
final isEvaluateUnitConstantsTask =
new TypeMatcher<EvaluateUnitConstantsTask>();
@ -116,10 +110,8 @@ final isInferStaticVariableTypesInUnitTask =
new TypeMatcher<InferStaticVariableTypesInUnitTask>();
final isInferStaticVariableTypeTask =
new TypeMatcher<InferStaticVariableTypeTask>();
final isLibraryErrorsReadyTask =
new TypeMatcher<LibraryErrorsReadyTask>();
final isLibraryUnitErrorsTask =
new TypeMatcher<LibraryUnitErrorsTask>();
final isLibraryErrorsReadyTask = new TypeMatcher<LibraryErrorsReadyTask>();
final isLibraryUnitErrorsTask = new TypeMatcher<LibraryUnitErrorsTask>();
final isParseDartTask = new TypeMatcher<ParseDartTask>();
final isPartiallyResolveUnitReferencesTask =
new TypeMatcher<PartiallyResolveUnitReferencesTask>();
@ -133,13 +125,11 @@ final isResolveLibraryTypeNamesTask =
final isResolveTopLevelUnitTypeBoundsTask =
new TypeMatcher<ResolveTopLevelUnitTypeBoundsTask>();
final isResolveUnitTask = new TypeMatcher<ResolveUnitTask>();
final isResolveUnitTypeNamesTask =
new TypeMatcher<ResolveUnitTypeNamesTask>();
final isResolveUnitTypeNamesTask = new TypeMatcher<ResolveUnitTypeNamesTask>();
final isResolveVariableReferencesTask =
new TypeMatcher<ResolveVariableReferencesTask>();
final isScanDartTask = new TypeMatcher<ScanDartTask>();
final isStrongModeVerifyUnitTask =
new TypeMatcher<StrongModeVerifyUnitTask>();
final isStrongModeVerifyUnitTask = new TypeMatcher<StrongModeVerifyUnitTask>();
final isVerifyUnitTask = new TypeMatcher<VerifyUnitTask>();
final LintCode _testLintCode = new LintCode('test lint', 'test lint code');
@ -1455,7 +1445,6 @@ class ComputeInferableStaticVariableDependenciesTaskTest
void setUp() {
super.setUp();
// Variable dependencies are only available in strong mode.
enableStrongMode();
}
test_created_resolved_unit() {
@ -1510,14 +1499,7 @@ class ComputeLibraryCycleTaskTest extends _AbstractDartTaskTest {
return outputs[LIBRARY_CYCLE_UNITS] as List<LibrarySpecificUnit>;
}
@override
void setUp() {
super.setUp();
enableStrongMode();
}
void test_library_cycle_incremental() {
enableStrongMode();
Source a = newSource('/a.dart', '''
library a;
''');
@ -1561,7 +1543,6 @@ library a;
}
void test_library_cycle_incremental_partial() {
enableStrongMode();
Source a = newSource('/a.dart', r'''
library a;
''');
@ -1595,7 +1576,6 @@ import 'c.dart';
}
void test_library_cycle_incremental_partial2() {
enableStrongMode();
Source a = newSource('/a.dart', r'''
library a;
import 'b.dart';
@ -1695,7 +1675,6 @@ import 'a.dart';
}
void test_library_cycle_override_inference_incremental() {
enableStrongMode();
Source lib1Source = newSource('/my_lib1.dart', '''
library my_lib1;
import 'my_lib3.dart';
@ -2465,6 +2444,7 @@ class a { }
class GenerateLintsTaskTest_AstVisitor extends SimpleAstVisitor {
Linter linter;
GenerateLintsTaskTest_AstVisitor(this.linter);
@override
@ -2498,7 +2478,6 @@ class A {}
}
void test_perform() {
enableStrongMode();
AnalysisTarget source = newSource('/test.dart', '''
class A {
X f;
@ -2540,7 +2519,6 @@ class Z {}
}
void test_perform_cross_library_const() {
enableStrongMode();
AnalysisTarget firstSource = newSource('/first.dart', '''
library first;
@ -2581,7 +2559,6 @@ class M {
}
void test_perform_reresolution() {
enableStrongMode();
AnalysisTarget source = newSource('/test.dart', '''
const topLevel = '';
class C {
@ -2606,12 +2583,6 @@ class C {
@reflectiveTest
class InferStaticVariableTypesInUnitTaskTest extends _AbstractDartTaskTest {
@override
void setUp() {
super.setUp();
enableStrongMode();
}
test_created_resolved_unit() {
Source source = newSource('/test.dart', r'''
library lib;
@ -2624,7 +2595,6 @@ class A {}
}
void test_perform_const_field() {
enableStrongMode();
AnalysisTarget source = newSource('/test.dart', '''
class M {
static const X = "";
@ -2650,7 +2620,6 @@ class M {
}
void test_perform_nestedDeclarations() {
enableStrongMode();
AnalysisTarget source = newSource('/test.dart', '''
var f = (int x) {
int squared(int value) => value * value;
@ -2663,7 +2632,6 @@ var f = (int x) {
}
void test_perform_recursive() {
enableStrongMode();
AnalysisTarget firstSource = newSource('/first.dart', '''
import 'second.dart';
@ -2705,7 +2673,6 @@ class M {}
}
void test_perform_simple() {
enableStrongMode();
AnalysisTarget source = newSource('/test.dart', '''
var X = 1;
var Y = () => 1 + X;
@ -2775,7 +2742,6 @@ var topLevel = '';
}
void test_perform() {
enableStrongMode();
AnalysisTarget source = newSource('/test3.dart', '''
var topLevel3 = '';
class C {
@ -2800,7 +2766,6 @@ class C {
}
void test_perform_const() {
enableStrongMode();
AnalysisTarget source = newSource('/test.dart', '''
const topLevel = "hello";
class C {
@ -2822,7 +2787,6 @@ class C {
}
void test_perform_cycle() {
enableStrongMode();
AnalysisTarget source = newSource('/test.dart', '''
var piFirst = true;
var pi = piFirst ? 3.14 : tau / 2;
@ -2845,7 +2809,6 @@ var tau = piFirst ? pi * 2 : 6.28;
}
void test_perform_error() {
enableStrongMode();
AnalysisTarget source = newSource('/test.dart', '''
var a = '' / null;
''');
@ -2860,7 +2823,6 @@ var a = '' / null;
}
void test_perform_null() {
enableStrongMode();
AnalysisTarget source = newSource('/test.dart', '''
var a = null;
''');
@ -3251,7 +3213,6 @@ main() {
}
test_perform_strong_inferable() {
enableStrongMode();
Source source = newSource('/test.dart', '''
int a = b;
int b = c;
@ -3282,7 +3243,6 @@ class C {
}
test_perform_strong_notResolved() {
enableStrongMode();
Source source = newSource('/test.dart', '''
int A;
f1() {
@ -3399,12 +3359,6 @@ library libC;
@reflectiveTest
class ResolveInstanceFieldsInUnitTaskTest extends _AbstractDartTaskTest {
@override
void setUp() {
super.setUp();
enableStrongMode();
}
test_created_resolved_unit() {
Source source = newSource('/test.dart', r'''
library lib;
@ -4179,12 +4133,6 @@ class A {''');
@reflectiveTest
class StrongModeInferenceTest extends _AbstractDartTaskTest {
@override
void setUp() {
super.setUp();
enableStrongMode();
}
// Check that even within a static variable cycle, inferred
// types get propagated to the members of the cycle.
void test_perform_cycle() {
@ -4201,8 +4149,7 @@ var tau = piFirst ? pi * 2 : 6.28;
AstFinder.getTopLevelVariable(unit, 'pi').name.staticElement;
VariableElement tau =
AstFinder.getTopLevelVariable(unit, 'tau').name.staticElement;
Expression piFirstUse = (AstFinder
.getTopLevelVariable(unit, 'tau')
Expression piFirstUse = (AstFinder.getTopLevelVariable(unit, 'tau')
.initializer as ConditionalExpression)
.condition;
@ -4653,12 +4600,6 @@ var tau = piFirst ? pi * 2 : 6.28;
@reflectiveTest
class StrongModeVerifyUnitTaskTest extends _AbstractDartTaskTest {
@override
void setUp() {
super.setUp();
enableStrongMode();
}
test_created_resolved_unit() {
Source source = newSource('/test.dart', r'''
library lib;
@ -4671,7 +4612,6 @@ class A {}
}
void test_perform_recordDynamicInvoke() {
enableStrongMode();
AnalysisTarget source = newSource('/test.dart', '''
void main() {
dynamic a = [];
@ -4693,7 +4633,6 @@ void main() {
}
void test_perform_verifyError() {
enableStrongMode();
AnalysisTarget source = newSource('/test.dart', '''
class A {}
class B extends A {}
@ -4831,7 +4770,6 @@ import 'no-such-file.dart';
}
void test_perform_reresolution() {
enableStrongMode();
AnalysisTarget source = newSource('/test.dart', '''
const topLevel = 3;
class C {
@ -4951,15 +4889,6 @@ class _AbstractDartTaskTest extends AbstractContextTest {
source, [new ScriptFragment(97, 5, 36, scriptContent)]);
}
/**
* Enable strong mode in the current analysis context.
*/
void enableStrongMode() {
AnalysisOptionsImpl options = context.analysisOptions;
options.strongMode = true;
context.analysisOptions = options;
}
void setUp() {
super.setUp();
emptySource = newSource('/test.dart');

View file

@ -52,14 +52,12 @@ class ContextConfigurationTest extends AbstractContextTest {
optionsProvider.getOptionsFromString(source);
test_configure_bad_options_contents() {
(analysisOptions as AnalysisOptionsImpl)
..previewDart2 = false
..strongMode = false;
configureContext('''
analyzer:
strong-mode:true # misformatted
language:
enableSuperMixins true; # misformatted
''');
expect(analysisOptions.strongMode, false);
expect(analysisOptions.enableSuperMixins, false);
}
test_configure_enableSuperMixins() {
@ -158,14 +156,12 @@ analyzer:
}
test_configure_strong_mode_bad_value() {
(analysisOptions as AnalysisOptionsImpl)
..previewDart2 = false
..strongMode = false;
configureContext('''
analyzer:
strong-mode: foo
language:
enableSuperMixins: true;
''');
expect(analysisOptions.strongMode, false);
expect(analysisOptions.enableSuperMixins, false);
}
}
@ -292,9 +288,8 @@ class ErrorProcessorMatcher extends Matcher {
ErrorProcessorMatcher(this.required);
@override
Description describe(Description desc) =>
desc..add("an ErrorProcessor setting ${required.code} to ${required
.severity}");
Description describe(Description desc) => desc
..add("an ErrorProcessor setting ${required.code} to ${required.severity}");
@override
bool matches(dynamic o, Map<dynamic, dynamic> options) {

View file

@ -27,8 +27,7 @@ void main() {
@reflectiveTest
class Dart2InferenceTest extends ResolverTestCase {
@override
AnalysisOptions get defaultAnalysisOptions =>
new AnalysisOptionsImpl()..strongMode = true;
AnalysisOptions get defaultAnalysisOptions => new AnalysisOptionsImpl();
@override
bool get enableNewAnalysisDriver => true;

View file

@ -289,7 +289,6 @@ class AbstractStrongTest {
expect(mainFile.exists, true, reason: '`/main.dart` is missing');
AnalysisOptionsImpl analysisOptions = new AnalysisOptionsImpl();
analysisOptions.strongMode = true;
analysisOptions.strongModeHints = true;
analysisOptions.declarationCasts = declarationCasts;
analysisOptions.implicitCasts = implicitCasts;

View file

@ -97,7 +97,6 @@ class ContextCacheEntry {
contextOptions.generateSdkErrors = clOptions.showSdkWarnings;
contextOptions.previewDart2 = clOptions.previewDart2;
contextOptions.useFastaParser = clOptions.useFastaParser;
contextOptions.strongMode = clOptions.strongMode;
if (clOptions.useCFE) {
contextOptions.useFastaParser = true;
}

View file

@ -586,7 +586,7 @@ class CommandLineOptions {
}
}
if (results.wasParsed(strongModeFlag)) {
if (results.wasParsed('strong')) {
errorSink.writeln(
'Note: the --strong flag is deprecated and will be removed in an '
'future release.\n');

View file

@ -137,7 +137,6 @@ class Required {
PerformanceLog log = new PerformanceLog(_logBuffer);
AnalysisDriverScheduler scheduler = new AnalysisDriverScheduler(log);
AnalysisOptionsImpl options = new AnalysisOptionsImpl()
..strongMode = enableStrongMode
..previewDart2 = enablePreviewDart2;
_driver = new AnalysisDriver(
scheduler,

View file

@ -63,9 +63,7 @@ class AnalyzerOptions {
String dartSdkSummaryPath,
List<String> summaryPaths}) {
var contextBuilderOptions = ContextBuilderOptions()
..defaultOptions = (AnalysisOptionsImpl()
..strongMode = true
..previewDart2 = true)
..defaultOptions = (AnalysisOptionsImpl()..previewDart2 = true)
..dartSdkSummaryPath = dartSdkSummaryPath;
return AnalyzerOptions._(
@ -76,8 +74,8 @@ class AnalyzerOptions {
factory AnalyzerOptions.fromArguments(ArgResults args,
{String dartSdkSummaryPath, List<String> summaryPaths}) {
var contextBuilderOptions = createContextBuilderOptions(args,
strongMode: true, trackCacheDependencies: false);
var contextBuilderOptions =
createContextBuilderOptions(args, trackCacheDependencies: false);
(contextBuilderOptions.defaultOptions as AnalysisOptionsImpl).previewDart2 =
true;