Skip to content

Commit

Permalink
Disable support for the old super mixins
Browse files Browse the repository at this point in the history
Change-Id: I8f8074b67ea43249fcc10deddd2325938996d529
Reviewed-on: https://dart-review.googlesource.com/c/79469
Reviewed-by: Devon Carew <[email protected]>
Reviewed-by: Konstantin Shcheglov <[email protected]>
Commit-Queue: Brian Wilkerson <[email protected]>
  • Loading branch information
bwilkerson authored and [email protected] committed Oct 22, 2018
1 parent cddc2d4 commit a342cec
Show file tree
Hide file tree
Showing 37 changed files with 233 additions and 1,122 deletions.
5 changes: 0 additions & 5 deletions pkg/analysis_server/lib/src/domain_analysis.dart
Original file line number Diff line number Diff line change
Expand Up @@ -518,11 +518,6 @@ class AnalysisDomainHandler extends AbstractRequestHandler {
options.lint = newOptions.generateLints;
});
}
if (newOptions.enableSuperMixins != null) {
updaters.add((engine.AnalysisOptionsImpl options) {
options.enableSuperMixins = newOptions.enableSuperMixins;
});
}
server.updateOptions(updaters);
return new AnalysisUpdateOptionsResult().toResponse(request.id);
}
Expand Down
1 change: 0 additions & 1 deletion pkg/analysis_server/lib/src/status/diagnostics.dart
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,6 @@ class ContextsPage extends DiagnosticPageWithNav {

b.write(
writeOption('Analyze function bodies', options.analyzeFunctionBodies));
b.write(writeOption('Enable super mixins', options.enableSuperMixins));
b.write(writeOption('Generate dart2js hints', options.dart2jsHint));
b.write(writeOption(
'Generate errors in implicit files', options.generateImplicitErrors));
Expand Down
28 changes: 3 additions & 25 deletions pkg/analysis_server/test/context_manager_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ import 'package:analyzer/instrumentation/instrumentation.dart';
import 'package:analyzer/source/error_processor.dart';
import 'package:analyzer/src/context/builder.dart';
import 'package:analyzer/src/context/context_root.dart';
import 'package:analyzer/src/dart/analysis/byte_store.dart';
import 'package:analyzer/src/dart/analysis/driver.dart';
import 'package:analyzer/src/dart/analysis/file_state.dart';
import 'package:analyzer/src/dart/analysis/performance_logger.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart' hide AnalysisResult;
import 'package:analyzer/src/generated/sdk.dart';
Expand All @@ -24,8 +26,6 @@ import 'package:analyzer/src/services/lint.dart';
import 'package:analyzer/src/summary/summary_file_builder.dart';
import 'package:analyzer/src/test_utilities/resource_provider_mixin.dart';
import 'package:analyzer/src/util/glob.dart';
import 'package:analyzer/src/dart/analysis/byte_store.dart';
import 'package:analyzer/src/dart/analysis/performance_logger.dart';
import 'package:linter/src/rules.dart';
import 'package:linter/src/rules/avoid_as.dart';
import 'package:path/path.dart' as path;
Expand Down Expand Up @@ -1807,8 +1807,6 @@ abstract class ContextManagerWithOptionsTest extends ContextManagerTest {
embedded_libs:
"dart:foobar": "../sdk_ext/entry.dart"
analyzer:
language:
enableSuperMixins: true
errors:
unused_local_variable: false
linter:
Expand All @@ -1823,7 +1821,6 @@ linter:
// Verify options were set.
expect(errorProcessors, hasLength(1));
expect(lints, hasLength(1));
expect(analysisOptions.enableSuperMixins, isTrue);

// Remove options.
deleteOptionsFile();
Expand All @@ -1832,7 +1829,6 @@ linter:
// Verify defaults restored.
expect(errorProcessors, isEmpty);
expect(lints, isEmpty);
expect(analysisOptions.enableSuperMixins, isFalse);
}

@failingTest
Expand All @@ -1859,8 +1855,6 @@ test_pack:lib/''');
// Setup analysis options
newFile('$projPath/$optionsFileName', content: r'''
analyzer:
language:
enableSuperMixins: true
errors:
unused_local_variable: false
linter:
Expand All @@ -1873,7 +1867,6 @@ linter:
await pumpEventQueue();

// Verify options were set.
expect(analysisOptions.enableSuperMixins, isTrue);
expect(errorProcessors, hasLength(2));
expect(lints, hasLength(2));

Expand All @@ -1882,7 +1875,6 @@ linter:
await pumpEventQueue();

// Verify defaults restored.
expect(analysisOptions.enableSuperMixins, isFalse);
expect(lints, hasLength(1));
expect(lints.first, const TypeMatcher<AvoidAs>());
expect(errorProcessors, hasLength(1));
Expand All @@ -1903,8 +1895,6 @@ include: other_options.yaml
''');
newFile('$projPath/other_options.yaml', content: r'''
analyzer:
language:
enableSuperMixins: true
errors:
unused_local_variable: false
linter:
Expand All @@ -1915,7 +1905,6 @@ linter:
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
await pumpEventQueue();
// Verify options were set.
expect(analysisOptions.enableSuperMixins, isTrue);
expect(errorProcessors, hasLength(1));
expect(lints, hasLength(1));
expect(lints[0].name, 'camel_case_types');
Expand All @@ -1933,8 +1922,6 @@ linter:
String booLibPosixPath = '/my/pkg/boo/lib';
newFile('$booLibPosixPath/other_options.yaml', content: r'''
analyzer:
language:
enableSuperMixins: true
errors:
unused_local_variable: false
linter:
Expand All @@ -1951,7 +1938,6 @@ include: package:boo/other_options.yaml
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
await pumpEventQueue();
// Verify options were set.
expect(analysisOptions.enableSuperMixins, isTrue);
expect(errorProcessors, hasLength(1));
expect(lints, hasLength(1));
expect(lints[0].name, 'camel_case_types');
Expand Down Expand Up @@ -2009,8 +1995,6 @@ embedded_libs:
"dart:foobar": "../sdk_ext/entry.dart"
analyzer:
strong-mode: true
language:
enableSuperMixins: true
errors:
missing_return: false
linter:
Expand All @@ -2026,8 +2010,6 @@ test_pack:lib/''');
analyzer:
exclude:
- 'test/**'
language:
enableSuperMixins: true
errors:
unused_local_variable: false
linter:
Expand All @@ -2046,12 +2028,8 @@ linter:

// Verify options.
// * from `_embedder.yaml`:
// TODO(brianwilkerson) Figure out what to use in place of 'strongMode' and
// why 'enableSuperMixins' is assumed to come from two different sources.
// TODO(brianwilkerson) Figure out what to use in place of 'strongMode'.
// expect(analysisOptions.strongMode, isTrue);
expect(analysisOptions.enableSuperMixins, isTrue);
// * from analysis options:
expect(analysisOptions.enableSuperMixins, isTrue);

// * verify tests are excluded
expect(
Expand Down
2 changes: 2 additions & 0 deletions pkg/analyzer/lib/error/error.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,13 @@ const List<ErrorCode> errorCodeValues = const [
AnalysisOptionsWarningCode.UNRECOGNIZED_ERROR_CODE,
AnalysisOptionsWarningCode.UNSUPPORTED_OPTION_WITH_LEGAL_VALUE,
AnalysisOptionsWarningCode.UNSUPPORTED_OPTION_WITH_LEGAL_VALUES,
AnalysisOptionsWarningCode.UNSUPPORTED_OPTION_WITHOUT_VALUES,
AnalysisOptionsWarningCode.UNSUPPORTED_VALUE,
AnalysisOptionsWarningCode.SPEC_MODE_REMOVED,
AnalysisOptionsHintCode.DEPRECATED_ANALYSIS_OPTIONS_FILE_NAME,
AnalysisOptionsHintCode.PREVIEW_DART_2_SETTING_DEPRECATED,
AnalysisOptionsHintCode.STRONG_MODE_SETTING_DEPRECATED,
AnalysisOptionsHintCode.SUPER_MIXINS_SETTING_DEPRECATED,
CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_FIELD_TYPE_MISMATCH,
CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH,
CheckedModeCompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION,
Expand Down
153 changes: 88 additions & 65 deletions pkg/analyzer/lib/src/analysis_options/error/option_codes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,60 @@ class AnalysisOptionsErrorCode extends ErrorCode {
ErrorType get type => ErrorType.COMPILE_TIME_ERROR;
}

class AnalysisOptionsHintCode extends ErrorCode {
/**
* An error code indicating the analysis options file name is deprecated and
* the file should be renamed.
*
* Parameters:
* 0: the uri of the file which should be renamed
*/
static const AnalysisOptionsHintCode DEPRECATED_ANALYSIS_OPTIONS_FILE_NAME =
const AnalysisOptionsHintCode(
'DEPRECATED_ANALYSIS_OPTIONS_FILE_NAME',
"The name of the analysis options file {0} is deprecated;"
" consider renaming it to analysis_options.yaml.");

/**
* An error code indicating that the enablePreviewDart2 setting is deprecated.
*/
static const AnalysisOptionsHintCode PREVIEW_DART_2_SETTING_DEPRECATED =
const AnalysisOptionsHintCode('PREVIEW_DART_2_SETTING_DEPRECATED',
"The 'enablePreviewDart2' setting is deprecated.",
correction: "It is no longer necessary to explicitly enable Dart 2.");

/**
* An error code indicating that strong-mode: true is deprecated.
*/
static const AnalysisOptionsHintCode STRONG_MODE_SETTING_DEPRECATED =
const AnalysisOptionsHintCode('STRONG_MODE_SETTING_DEPRECATED',
"The 'strong-mode: true' setting is deprecated.",
correction:
"It is no longer necessary to explicitly enable strong mode.");

/**
* An error code indicating that the enablePreviewDart2 setting is deprecated.
*/
static const AnalysisOptionsHintCode SUPER_MIXINS_SETTING_DEPRECATED =
const AnalysisOptionsHintCode('SUPER_MIXINS_SETTING_DEPRECATED',
"The 'enableSuperMixins' setting is deprecated.",
correction:
"Support has been added to the language for 'mixin' based mixins.");

/**
* Initialize a newly created hint code to have the given [name].
*/
const AnalysisOptionsHintCode(String name, String message,
{String correction})
: super.temporary(name, message, correction: correction);

@override
ErrorSeverity get errorSeverity => ErrorSeverity.INFO;

@override
ErrorType get type => ErrorType.HINT;
}

/**
* The error codes used for warnings in analysis options files. The convention
* for this class is for the name of the error code to indicate the problem that
Expand Down Expand Up @@ -86,6 +140,26 @@ class AnalysisOptionsWarningCode extends ErrorCode {
const AnalysisOptionsWarningCode('INCLUDED_FILE_WARNING',
"Warning in the included options file {0}({1}..{2}): {3}");

/**
* An error code indicating an invalid format for an options file section.
*
* Parameters:
* 0: the section name
*/
static const AnalysisOptionsWarningCode INVALID_SECTION_FORMAT =
const AnalysisOptionsWarningCode(
'INVALID_SECTION_FORMAT', "Invalid format for the '{0}' section.");

/**
* An error code indicating that strong-mode: false is has been removed.
*/
static const AnalysisOptionsWarningCode SPEC_MODE_REMOVED =
const AnalysisOptionsWarningCode('SPEC_MODE_REMOVED',
"The option 'strong-mode: false' is no longer supported.",
correction:
"It's recommended to remove the 'strong-mode:' setting (and make "
"your code Dart 2 compliant).");

/**
* An error code indicating that an unrecognized error code is being used to
* specify an error filter.
Expand Down Expand Up @@ -126,6 +200,20 @@ class AnalysisOptionsWarningCode extends ErrorCode {
"The option '{1}' isn't supported by '{0}'.",
correction: "Try using one of the supported options: {2}.");

/**
* An error code indicating that a plugin is being configured with an
* unsupported option and legal options are provided.
*
* Parameters:
* 0: the plugin name
* 1: the unsupported option key
*/
static const AnalysisOptionsWarningCode UNSUPPORTED_OPTION_WITHOUT_VALUES =
const AnalysisOptionsWarningCode(
'UNSUPPORTED_OPTION_WITHOUT_VALUES',
"The option '{1}' isn't supported by '{0}'.",
);

/**
* An error code indicating that an option entry is being configured with an
* unsupported value.
Expand All @@ -140,26 +228,6 @@ class AnalysisOptionsWarningCode extends ErrorCode {
'UNSUPPORTED_VALUE', "The value '{1}' isn't supported by '{0}'.",
correction: "Try using one of the supported options: {2}.");

/**
* An error code indicating an invalid format for an options file section.
*
* Parameters:
* 0: the section name
*/
static const AnalysisOptionsWarningCode INVALID_SECTION_FORMAT =
const AnalysisOptionsWarningCode(
'INVALID_SECTION_FORMAT', "Invalid format for the '{0}' section.");

/**
* An error code indicating that strong-mode: false is has been removed.
*/
static const AnalysisOptionsWarningCode SPEC_MODE_REMOVED =
const AnalysisOptionsWarningCode('SPEC_MODE_REMOVED',
"The option 'strong-mode: false' is no longer supported.",
correction:
"It's recommended to remove the 'strong-mode:' setting (and make "
"your code Dart 2 compliant).");

/**
* Initialize a newly created warning code to have the given [name].
*/
Expand All @@ -173,48 +241,3 @@ class AnalysisOptionsWarningCode extends ErrorCode {
@override
ErrorType get type => ErrorType.STATIC_WARNING;
}

class AnalysisOptionsHintCode extends ErrorCode {
/**
* An error code indicating the analysis options file name is deprecated and
* the file should be renamed.
*
* Parameters:
* 0: the uri of the file which should be renamed
*/
static const AnalysisOptionsHintCode DEPRECATED_ANALYSIS_OPTIONS_FILE_NAME =
const AnalysisOptionsHintCode(
'DEPRECATED_ANALYSIS_OPTIONS_FILE_NAME',
"The name of the analysis options file {0} is deprecated;"
" consider renaming it to analysis_options.yaml.");

/**
* An error code indicating that the enablePreviewDart2 setting is deprecated.
*/
static const AnalysisOptionsHintCode PREVIEW_DART_2_SETTING_DEPRECATED =
const AnalysisOptionsHintCode('PREVIEW_DART_2_SETTING_DEPRECATED',
"The 'enablePreviewDart2' setting is deprecated.",
correction: "It is no longer necessary to explicitly enable Dart 2.");

/**
* An error code indicating that strong-mode: true is deprecated.
*/
static const AnalysisOptionsHintCode STRONG_MODE_SETTING_DEPRECATED =
const AnalysisOptionsHintCode('STRONG_MODE_SETTING_DEPRECATED',
"The 'strong-mode: true' setting is deprecated.",
correction:
"It is no longer necessary to explicitly enable strong mode.");

/**
* Initialize a newly created hint code to have the given [name].
*/
const AnalysisOptionsHintCode(String name, String message,
{String correction})
: super.temporary(name, message, correction: correction);

@override
ErrorSeverity get errorSeverity => ErrorSeverity.INFO;

@override
ErrorType get type => ErrorType.HINT;
}
10 changes: 1 addition & 9 deletions pkg/analyzer/lib/src/command_line/arguments.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const String bazelAnalysisOptionsPath =
const String declarationCastsFlag = 'declaration-casts';
const String defineVariableOption = 'D';
const String enableInitializingFormalAccessFlag = 'initializing-formal-access';
@deprecated
const String enableSuperMixinFlag = 'supermixin';
const String flutterAnalysisOptionsPath =
'package:flutter/analysis_options_user.yaml';
Expand All @@ -42,10 +43,6 @@ void applyAnalysisOptionFlags(AnalysisOptionsImpl options, ArgResults args,
}
}

if (args.wasParsed(enableSuperMixinFlag)) {
options.enableSuperMixins = args[enableSuperMixinFlag];
verbose('$enableSuperMixinFlag = ${options.enableSuperMixins}');
}
if (args.wasParsed(implicitCastsFlag)) {
options.implicitCasts = args[implicitCastsFlag];
verbose('$implicitCastsFlag = ${options.implicitCasts}');
Expand Down Expand Up @@ -201,11 +198,6 @@ void defineAnalysisArguments(ArgParser parser, {bool hide: true, ddc: false}) {
defaultsTo: false,
negatable: false,
hide: hide || ddc);
parser.addFlag(enableSuperMixinFlag,
help: 'Relax restrictions on mixins (DEP 34).',
defaultsTo: false,
negatable: false,
hide: hide);
if (!ddc) {
parser.addFlag(lintsFlag,
help: 'Show lint results.', defaultsTo: false, negatable: true);
Expand Down
Loading

0 comments on commit a342cec

Please sign in to comment.