Change packages analyzer and _fe_analyzer_shared to use language version 3.2.

This will allow these packages to take advantage of private field
promotion.

Change-Id: I35dc57ecd7a0c3afde4713cd60aca86b479393a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/351162
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
Paul Berry 2024-02-09 14:19:30 +00:00 committed by Commit Queue
parent 14f7622ef4
commit 9d39c79471
13 changed files with 20 additions and 20 deletions

View file

@ -4,7 +4,7 @@ description: Logic that is shared between the front_end and analyzer packages.
repository: https://github.com/dart-lang/sdk/tree/main/pkg/_fe_analyzer_shared
environment:
sdk: ^3.0.0
sdk: ^3.2.0
dependencies:
meta: ^1.9.0

View file

@ -77,7 +77,7 @@ class PhysicalResourceProvider implements ResourceProvider {
@override
Folder? getStateLocation(String pluginId) {
if (_stateLocation != null) {
io.Directory directory = io.Directory(join(_stateLocation!, pluginId));
io.Directory directory = io.Directory(join(_stateLocation, pluginId));
directory.createSync(recursive: true);
return _PhysicalFolder(directory);
}

View file

@ -2366,9 +2366,9 @@ class NodeReplacer extends ThrowingAstVisitor<bool> {
node.defaultValue = _newNode as ExpressionImpl;
var parameterElement = node.declaredElement;
if (parameterElement is DefaultParameterElementImpl) {
parameterElement.constantInitializer = _newNode as ExpressionImpl;
parameterElement.constantInitializer = _newNode;
} else if (parameterElement is DefaultFieldFormalParameterElementImpl) {
parameterElement.constantInitializer = _newNode as ExpressionImpl;
parameterElement.constantInitializer = _newNode;
}
return true;
}

View file

@ -1075,7 +1075,7 @@ class ConstantVisitor extends UnifyingAstVisitor<Constant> {
}
if (_substitution != null) {
type = _substitution!.substituteType(type);
type = _substitution.substituteType(type);
}
return _getConstantValue(

View file

@ -3130,7 +3130,7 @@ class TypeState extends InstanceState {
if (_type == null) {
return StringState.UNKNOWN_VALUE;
}
return StringState(_type!.getDisplayString());
return StringState(_type.getDisplayString());
}
@override
@ -3153,7 +3153,7 @@ class TypeState extends InstanceState {
}
return BoolState.from(
typeSystem.runtimeTypesEqual(_type!, rightType),
typeSystem.runtimeTypesEqual(_type, rightType),
);
}
return BoolState.FALSE_STATE;

View file

@ -24,7 +24,7 @@ class AnnotationVerifier {
/// Whether [_currentLibrary] is part of its containing package's public API.
late final bool _inPackagePublicApi = _workspacePackage != null &&
_workspacePackage!.sourceIsInPublicApi(_currentLibrary.source);
_workspacePackage.sourceIsInPublicApi(_currentLibrary.source);
AnnotationVerifier(
this._errorReporter,

View file

@ -91,7 +91,7 @@ class BestPracticesVerifier extends RecursiveAstVisitor<void> {
/// Whether [_currentLibrary] is part of its containing package's public API.
late final bool _inPackagePublicApi = _workspacePackage != null &&
_workspacePackage!.sourceIsInPublicApi(_currentLibrary.source);
_workspacePackage.sourceIsInPublicApi(_currentLibrary.source);
BestPracticesVerifier(
this._errorReporter,
@ -1541,7 +1541,7 @@ class BestPracticesVerifier extends RecursiveAstVisitor<void> {
// if we were unable to determine what package [_currentLibrary] is in.
return false;
}
return _workspacePackage!.contains(library.source);
return _workspacePackage.contains(library.source);
}
/// Checks for the passed as expression for the [WarningCode.UNNECESSARY_CAST]
@ -2017,7 +2017,7 @@ class _InvalidAccessVerifier {
// if we were unable to determine what package [_currentLibrary] is in.
return false;
}
return _workspacePackage!.contains(library.source);
return _workspacePackage.contains(library.source);
}
/// Check if @visibleForTemplate is applied to the given [Element].

View file

@ -376,6 +376,6 @@ class DeprecatedMemberUseVerifier extends BaseDeprecatedMemberUseVerifier {
if (_workspacePackage == null || library == null) {
return false;
}
return _workspacePackage!.contains(library.source);
return _workspacePackage.contains(library.source);
}
}

View file

@ -5158,7 +5158,7 @@ class _WhyNotPromotedVisitor
node = node.identifier;
}
if (_dataForTesting != null) {
_dataForTesting!.nonPromotionReasonTargets[node] = reason.shortName;
_dataForTesting.nonPromotionReasonTargets[node] = reason.shortName;
}
var variableName = reason.variable.name;
return [_contextMessageForWrite(variableName, node, reason)];

View file

@ -779,7 +779,7 @@ class PluginsOptionValidator extends OptionsValidator {
reporter.reportErrorForSpan(
AnalysisOptionsWarningCode.MULTIPLE_PLUGINS,
plugins.span,
[_firstIncludedPluginName!],
[_firstIncludedPluginName],
);
}
} else if (plugins is YamlList) {
@ -791,7 +791,7 @@ class PluginsOptionValidator extends OptionsValidator {
reporter.reportErrorForSpan(
AnalysisOptionsWarningCode.MULTIPLE_PLUGINS,
plugin.span,
[_firstIncludedPluginName!],
[_firstIncludedPluginName],
);
}
}
@ -825,7 +825,7 @@ class PluginsOptionValidator extends OptionsValidator {
reporter.reportErrorForSpan(
AnalysisOptionsWarningCode.MULTIPLE_PLUGINS,
plugin.span,
[_firstIncludedPluginName!],
[_firstIncludedPluginName],
);
}
}

View file

@ -39,7 +39,7 @@ class LRUMap<K, V> {
K evictedKey = _map.keys.first;
V evictedValue = _map.remove(evictedKey) as V;
if (_handler != null) {
_handler!.call(evictedKey, evictedValue);
_handler.call(evictedKey, evictedValue);
}
}
}

View file

@ -5,7 +5,7 @@ description: >-
repository: https://github.com/dart-lang/sdk/tree/main/pkg/analyzer
environment:
sdk: '>=3.0.0 <4.0.0'
sdk: '>=3.2.0 <4.0.0'
dependencies:
_fe_analyzer_shared: ^67.0.0

View file

@ -56,7 +56,7 @@ class ResolutionVerifier extends RecursiveAstVisitor<void> {
node.visitChildren(this);
var elementAnnotation = node.elementAnnotation;
if (elementAnnotation == null) {
if (_knownExceptions == null || !_knownExceptions!.contains(node)) {
if (_knownExceptions == null || !_knownExceptions.contains(node)) {
_unresolvedNodes.add(node);
}
}
@ -244,7 +244,7 @@ class ResolutionVerifier extends RecursiveAstVisitor<void> {
bool Function(Element)? predicate,
) {
if (element == null) {
if (_knownExceptions == null || !_knownExceptions!.contains(node)) {
if (_knownExceptions == null || !_knownExceptions.contains(node)) {
_unresolvedNodes.add(node);
}
} else if (predicate != null) {