diff --git a/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml b/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml index 0305cbb1017..b360ea99146 100644 --- a/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml +++ b/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml @@ -40,9 +40,6 @@ AnalysisOptionsErrorCode.PARSE_ERROR: notes: |- Because of the way the YAML parser works, there isn't enough information to be able to provide a fix. -AnalysisOptionsHintCode.PREVIEW_DART_2_SETTING_DEPRECATED: - status: needsFix - notes: Fixed. AnalysisOptionsWarningCode.INCLUDE_FILE_NOT_FOUND: status: noFix notes: |- diff --git a/pkg/analysis_server/lib/src/services/correction/fix/analysis_options/fix_generator.dart b/pkg/analysis_server/lib/src/services/correction/fix/analysis_options/fix_generator.dart index 3620fe8c706..4fae1c015f7 100644 --- a/pkg/analysis_server/lib/src/services/correction/fix/analysis_options/fix_generator.dart +++ b/pkg/analysis_server/lib/src/services/correction/fix/analysis_options/fix_generator.dart @@ -62,10 +62,7 @@ class AnalysisOptionsFixGenerator { // if (errorCode == AnalysisOptionsErrorCode.INCLUDED_FILE_PARSE_ERROR) { // } else if (errorCode == AnalysisOptionsErrorCode.PARSE_ERROR) { // } else - if (errorCode == - AnalysisOptionsHintCode.PREVIEW_DART_2_SETTING_DEPRECATED) { - await _addFix_removeSetting(coveringNodePath); - } else if (errorCode == DEPRECATED_LINT_HINT) { + if (errorCode == DEPRECATED_LINT_HINT) { await _addFix_removeLint(coveringNodePath); // } else if (errorCode == AnalysisOptionsWarningCode.INCLUDED_FILE_WARNING) { // } else if (errorCode == AnalysisOptionsWarningCode.INCLUDE_FILE_NOT_FOUND) { diff --git a/pkg/analysis_server/test/src/services/correction/fix/analysis_options/remove_setting_test.dart b/pkg/analysis_server/test/src/services/correction/fix/analysis_options/remove_setting_test.dart index 13450a2059f..f7b02e54505 100644 --- a/pkg/analysis_server/test/src/services/correction/fix/analysis_options/remove_setting_test.dart +++ b/pkg/analysis_server/test/src/services/correction/fix/analysis_options/remove_setting_test.dart @@ -14,20 +14,6 @@ void main() { @reflectiveTest class RemoveSettingTest extends AnalysisOptionsFixTest { - Future test_enablePreviewDart2() async { - await assertHasFix(''' -analyzer: - enable-experiment: - - test-experiment - language: - enablePreviewDart2: true -''', ''' -analyzer: - enable-experiment: - - test-experiment -'''); - } - Future test_invalidExperiment_first() async { await assertHasFix(''' analyzer: diff --git a/pkg/analyzer/lib/src/analysis_options/error/option_codes.dart b/pkg/analyzer/lib/src/analysis_options/error/option_codes.dart index 56ca27bddf0..b0f7634c8a0 100644 --- a/pkg/analyzer/lib/src/analysis_options/error/option_codes.dart +++ b/pkg/analyzer/lib/src/analysis_options/error/option_codes.dart @@ -2,4 +2,28 @@ // 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/error/error.dart'; + export 'package:analyzer/src/analysis_options/error/option_codes.g.dart'; + +class AnalysisOptionsHintCode extends ErrorCode { + /// Initialize a newly created error code to have the given [name]. + const AnalysisOptionsHintCode( + String name, + String problemMessage, { + super.correctionMessage, + super.hasPublishedDocs = false, + super.isUnresolvedIdentifier = false, + String? uniqueName, + }) : super( + name: name, + problemMessage: problemMessage, + uniqueName: 'AnalysisOptionsHintCode.${uniqueName ?? name}', + ); + + @override + ErrorSeverity get errorSeverity => ErrorSeverity.INFO; + + @override + ErrorType get type => ErrorType.HINT; +} diff --git a/pkg/analyzer/lib/src/analysis_options/error/option_codes.g.dart b/pkg/analyzer/lib/src/analysis_options/error/option_codes.g.dart index 46e25fae8dd..fba9d5854b8 100644 --- a/pkg/analyzer/lib/src/analysis_options/error/option_codes.g.dart +++ b/pkg/analyzer/lib/src/analysis_options/error/option_codes.g.dart @@ -58,37 +58,6 @@ class AnalysisOptionsErrorCode extends ErrorCode { ErrorType get type => ErrorType.COMPILE_TIME_ERROR; } -class AnalysisOptionsHintCode extends ErrorCode { - /// An error code indicating that the enablePreviewDart2 setting is - /// deprecated. - static const AnalysisOptionsHintCode PREVIEW_DART_2_SETTING_DEPRECATED = - AnalysisOptionsHintCode( - 'PREVIEW_DART_2_SETTING_DEPRECATED', - "The 'enablePreviewDart2' setting is deprecated.", - correctionMessage: "It is no longer necessary to explicitly enable Dart 2.", - ); - - /// Initialize a newly created error code to have the given [name]. - const AnalysisOptionsHintCode( - String name, - String problemMessage, { - super.correctionMessage, - super.hasPublishedDocs = false, - super.isUnresolvedIdentifier = false, - String? uniqueName, - }) : super( - name: name, - problemMessage: problemMessage, - uniqueName: 'AnalysisOptionsHintCode.${uniqueName ?? name}', - ); - - @override - ErrorSeverity get errorSeverity => ErrorSeverity.INFO; - - @override - ErrorType get type => ErrorType.HINT; -} - class AnalysisOptionsWarningCode extends ErrorCode { /// An error code indicating a specified include file has a warning. /// diff --git a/pkg/analyzer/lib/src/error/error_code_values.g.dart b/pkg/analyzer/lib/src/error/error_code_values.g.dart index 87ec09ffbb2..76d527c13a8 100644 --- a/pkg/analyzer/lib/src/error/error_code_values.g.dart +++ b/pkg/analyzer/lib/src/error/error_code_values.g.dart @@ -22,7 +22,6 @@ import 'package:analyzer/src/pubspec/pubspec_warning_code.dart'; const List errorCodeValues = [ AnalysisOptionsErrorCode.INCLUDED_FILE_PARSE_ERROR, AnalysisOptionsErrorCode.PARSE_ERROR, - AnalysisOptionsHintCode.PREVIEW_DART_2_SETTING_DEPRECATED, AnalysisOptionsWarningCode.INCLUDED_FILE_WARNING, AnalysisOptionsWarningCode.INCLUDE_FILE_NOT_FOUND, AnalysisOptionsWarningCode.INVALID_OPTION, diff --git a/pkg/analyzer/lib/src/lint/analysis.dart b/pkg/analyzer/lib/src/lint/analysis.dart index 2827708e706..5e5e85afb66 100644 --- a/pkg/analyzer/lib/src/lint/analysis.dart +++ b/pkg/analyzer/lib/src/lint/analysis.dart @@ -82,13 +82,6 @@ class DriverOptions { set enableAssertInitializer(bool enable) { // Ignored because the option is now always enabled. } - - /// Whether to use Dart 2.0 features. - @deprecated - bool get previewDart2 => true; - - @deprecated - set previewDart2(bool value) {} } class LintDriver { diff --git a/pkg/analyzer/lib/src/task/options.dart b/pkg/analyzer/lib/src/task/options.dart index 0e080f195b0..8a650195556 100644 --- a/pkg/analyzer/lib/src/task/options.dart +++ b/pkg/analyzer/lib/src/task/options.dart @@ -118,7 +118,6 @@ void applyToAnalysisOptions(AnalysisOptionsImpl options, YamlMap optionMap) { /// `analyzer` analysis options constants. class AnalyzerOptions { static const String analyzer = 'analyzer'; - static const String enablePreviewDart2 = 'enablePreviewDart2'; static const String cannotIgnore = 'cannot-ignore'; static const String codeStyle = 'code-style'; @@ -490,11 +489,7 @@ class LanguageOptionValidator extends OptionsValidator { bool validKey = false; if (k is YamlScalar) { key = k.value?.toString(); - if (AnalyzerOptions.enablePreviewDart2 == key) { - reporter.reportErrorForSpan( - AnalysisOptionsHintCode.PREVIEW_DART_2_SETTING_DEPRECATED, - k.span); - } else if (!AnalyzerOptions.languageOptions.contains(key)) { + if (!AnalyzerOptions.languageOptions.contains(key)) { _builder.reportError(reporter, AnalyzerOptions.language, k); } else { // If we have a valid key, go on and check the value. diff --git a/pkg/analyzer/messages.yaml b/pkg/analyzer/messages.yaml index 1fe45cc3243..93e9cfec89b 100644 --- a/pkg/analyzer/messages.yaml +++ b/pkg/analyzer/messages.yaml @@ -53,13 +53,6 @@ AnalysisOptionsErrorCode: Parameters: 0: the error message from the parse error -AnalysisOptionsHintCode: - PREVIEW_DART_2_SETTING_DEPRECATED: - problemMessage: "The 'enablePreviewDart2' setting is deprecated." - correctionMessage: It is no longer necessary to explicitly enable Dart 2. - comment: |- - An error code indicating that the enablePreviewDart2 setting is - deprecated. AnalysisOptionsWarningCode: INCLUDED_FILE_WARNING: problemMessage: "Warning in the included options file {0}({1}..{2}): {3}" diff --git a/pkg/analyzer/tool/messages/error_code_info.dart b/pkg/analyzer/tool/messages/error_code_info.dart index f0bb4f55d3f..e60d2037d88 100644 --- a/pkg/analyzer/tool/messages/error_code_info.dart +++ b/pkg/analyzer/tool/messages/error_code_info.dart @@ -18,11 +18,6 @@ const List errorClasses = [ name: 'AnalysisOptionsErrorCode', type: 'COMPILE_TIME_ERROR', severity: 'ERROR'), - ErrorClassInfo( - filePath: 'lib/src/analysis_options/error/option_codes.g.dart', - name: 'AnalysisOptionsHintCode', - type: 'HINT', - severity: 'INFO'), ErrorClassInfo( filePath: 'lib/src/analysis_options/error/option_codes.g.dart', name: 'AnalysisOptionsWarningCode',