Skip to content

Commit

Permalink
Prepare for publishing analyzer 0.33.1, with front_end and kernel.
Browse files Browse the repository at this point in the history
This is essentially head, with commit
a342cec reverted to avoid a breaking
change for analyzer.

Revert "Disable support for the old super mixins"

This reverts commit a342cec.

Change-Id: I09db415e80fff9353d24cc7636d4a2187ebcd532
Reviewed-on: https://dart-review.googlesource.com/c/81333
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Janice Collins <jcollins@google.com>
  • Loading branch information
jcollins-g authored and commit-bot@chromium.org committed Oct 24, 2018
1 parent b3055a1 commit 905e731
Show file tree
Hide file tree
Showing 41 changed files with 1,140 additions and 241 deletions.
5 changes: 5 additions & 0 deletions pkg/analysis_server/lib/src/domain_analysis.dart
Expand Up @@ -518,6 +518,11 @@ 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: 1 addition & 0 deletions pkg/analysis_server/lib/src/status/diagnostics.dart
Expand Up @@ -389,6 +389,7 @@ 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: 25 additions & 3 deletions pkg/analysis_server/test/context_manager_test.dart
Expand Up @@ -13,10 +13,8 @@ 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 @@ -26,6 +24,8 @@ 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,6 +1807,8 @@ 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 @@ -1821,6 +1823,7 @@ linter:
// Verify options were set.
expect(errorProcessors, hasLength(1));
expect(lints, hasLength(1));
expect(analysisOptions.enableSuperMixins, isTrue);

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

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

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

Expand All @@ -1875,6 +1882,7 @@ 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 @@ -1895,6 +1903,8 @@ include: other_options.yaml
''');
newFile('$projPath/other_options.yaml', content: r'''
analyzer:
language:
enableSuperMixins: true
errors:
unused_local_variable: false
linter:
Expand All @@ -1905,6 +1915,7 @@ 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 @@ -1922,6 +1933,8 @@ 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 @@ -1938,6 +1951,7 @@ 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 @@ -1995,6 +2009,8 @@ embedded_libs:
"dart:foobar": "../sdk_ext/entry.dart"
analyzer:
strong-mode: true
language:
enableSuperMixins: true
errors:
missing_return: false
linter:
Expand All @@ -2010,6 +2026,8 @@ test_pack:lib/''');
analyzer:
exclude:
- 'test/**'
language:
enableSuperMixins: true
errors:
unused_local_variable: false
linter:
Expand All @@ -2028,8 +2046,12 @@ linter:

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

// * verify tests are excluded
expect(
Expand Down
10 changes: 10 additions & 0 deletions pkg/analyzer/CHANGELOG.md
@@ -1,3 +1,13 @@
## 0.33.1
* Fix circular typedef stack overflow. (#33599)
* Check that the implemented member is a valid override of the member from
the super constraint. (#34693)
* Begin replacing InheritanceManager with InheritanceManager2 and
deprecate older members.
* Performance fixups with Analysis Driver.
* Verify the superconstraint signature invoked by a mixin. (#34896)
* In_matchInterfaceSubtypeOf, account for mixins having null. (#34907)

## 0.33.0
* Support handling 'class C with M', with extends missing.
* Report ABSTRACT_SUPER_MEMBER_REFERENCE as an error.
Expand Down
2 changes: 0 additions & 2 deletions pkg/analyzer/lib/error/error.dart
Expand Up @@ -48,13 +48,11 @@ 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: 65 additions & 88 deletions pkg/analyzer/lib/src/analysis_options/error/option_codes.dart
Expand Up @@ -48,60 +48,6 @@ 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 @@ -140,26 +86,6 @@ 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 @@ -200,20 +126,6 @@ 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 @@ -228,6 +140,26 @@ 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 @@ -241,3 +173,48 @@ 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: 9 additions & 1 deletion pkg/analyzer/lib/src/command_line/arguments.dart
Expand Up @@ -18,7 +18,6 @@ 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 @@ -43,6 +42,10 @@ 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 @@ -198,6 +201,11 @@ 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

0 comments on commit 905e731

Please sign in to comment.