Skip to content

Commit d16bedc

Browse files
authored
Bump analyzer to 6.5.0 (#3763)
* Bump analyzer to 6.5.0
1 parent 6e10024 commit d16bedc

16 files changed

+62
-75
lines changed

.github/workflows/test.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ jobs:
2222
fail-fast: false
2323
matrix:
2424
os: [ubuntu-latest]
25-
sdk: [dev, stable]
25+
# TODO(srawlins): Re-enable stable after 3.4.0 ships.
26+
# sdk: [dev, stable]
27+
sdk: [dev]
2628
job: [main, flutter, packages, sdk-docs]
2729
include:
2830
- os: macos-latest

lib/src/generator/templates.runtime_renderers.dart

+14-9
Original file line numberDiff line numberDiff line change
@@ -2668,7 +2668,7 @@ class _Renderer_Container extends RendererBase<Container> {
26682668
renderVariable: (CT_ c, Property<CT_> self,
26692669
List<String> remainingNames) =>
26702670
self.renderSimpleVariable(
2671-
c, remainingNames, 'Set<Element>'),
2671+
c, remainingNames, 'Set<Element?>'),
26722672
renderIterable: (CT_ c, RendererBase<CT_> r,
26732673
List<MustachioNode> ast, StringSink sink) {
26742674
return c.allElements.map((e) => renderSimple(
@@ -10203,7 +10203,7 @@ class _Renderer_ModelElement extends RendererBase<ModelElement> {
1020310203
renderVariable: (CT_ c, Property<CT_> self,
1020410204
List<String> remainingNames) =>
1020510205
self.renderSimpleVariable(
10206-
c, remainingNames, 'Iterable<Category>'),
10206+
c, remainingNames, 'Iterable<Category?>'),
1020710207
renderIterable: (CT_ c, RendererBase<CT_> r,
1020810208
List<MustachioNode> ast, StringSink sink) {
1020910209
return c.displayedCategories.map((e) =>
@@ -12036,7 +12036,7 @@ class _Renderer_Package extends RendererBase<Package> {
1203612036
renderVariable: (CT_ c, Property<CT_> self,
1203712037
List<String> remainingNames) =>
1203812038
self.renderSimpleVariable(
12039-
c, remainingNames, 'Map<String, Category>'),
12039+
c, remainingNames, 'Map<String?, Category>'),
1204012040
isNullValue: (CT_ c) => false,
1204112041
renderValue: (CT_ c, RendererBase<CT_> r,
1204212042
List<MustachioNode> ast, StringSink sink) {
@@ -12202,7 +12202,7 @@ class _Renderer_Package extends RendererBase<Package> {
1220212202
renderVariable: (CT_ c, Property<CT_> self,
1220312203
List<String> remainingNames) =>
1220412204
self.renderSimpleVariable(
12205-
c, remainingNames, 'Map<String, Set<String>>'),
12205+
c, remainingNames, 'Map<String?, Set<String>>'),
1220612206
isNullValue: (CT_ c) => false,
1220712207
renderValue: (CT_ c, RendererBase<CT_> r,
1220812208
List<MustachioNode> ast, StringSink sink) {
@@ -15762,7 +15762,6 @@ const _invisibleGetters = {
1576215762
'isDartCoreObject',
1576315763
'isExhaustive',
1576415764
'isFinal',
15765-
'isInline',
1576615765
'isInterface',
1576715766
'isMixinApplication',
1576815767
'isMixinClass',
@@ -15926,13 +15925,15 @@ const _invisibleGetters = {
1592615925
'hasAlwaysThrows',
1592715926
'hasDeprecated',
1592815927
'hasDoNotStore',
15928+
'hasDoNotSubmit',
1592915929
'hasFactory',
1593015930
'hasImmutable',
1593115931
'hasInternal',
1593215932
'hasIsTest',
1593315933
'hasIsTestGroup',
1593415934
'hasJS',
1593515935
'hasLiteral',
15936+
'hasMustBeConst',
1593615937
'hasMustBeOverridden',
1593715938
'hasMustCallSuper',
1593815939
'hasNonVirtual',
@@ -15984,6 +15985,7 @@ const _invisibleGetters = {
1598415985
'hasAlwaysThrows',
1598515986
'hasDeprecated',
1598615987
'hasDoNotStore',
15988+
'hasDoNotSubmit',
1598715989
'hasFactory',
1598815990
'hasImmutable',
1598915991
'hasImplicitReturnType',
@@ -15992,6 +15994,7 @@ const _invisibleGetters = {
1599215994
'hasIsTestGroup',
1599315995
'hasJS',
1599415996
'hasLiteral',
15997+
'hasMustBeConst',
1599515998
'hasMustBeOverridden',
1599615999
'hasMustCallSuper',
1599716000
'hasNonVirtual',
@@ -16015,7 +16018,6 @@ const _invisibleGetters = {
1601516018
'isExtensionTypeMember',
1601616019
'isExternal',
1601716020
'isGenerator',
16018-
'isLegacy',
1601916021
'isOperator',
1602016022
'isPrivate',
1602116023
'isPublic',
@@ -16247,13 +16249,15 @@ const _invisibleGetters = {
1624716249
'hasAlwaysThrows',
1624816250
'hasDeprecated',
1624916251
'hasDoNotStore',
16252+
'hasDoNotSubmit',
1625016253
'hasFactory',
1625116254
'hasImmutable',
1625216255
'hasInternal',
1625316256
'hasIsTest',
1625416257
'hasIsTestGroup',
1625516258
'hasJS',
1625616259
'hasLiteral',
16260+
'hasMustBeConst',
1625716261
'hasMustBeOverridden',
1625816262
'hasMustCallSuper',
1625916263
'hasNonVirtual',
@@ -16271,7 +16275,6 @@ const _invisibleGetters = {
1627116275
'hasVisibleOutsideTemplate',
1627216276
'hashCode',
1627316277
'id',
16274-
'isLegacy',
1627516278
'isPrivate',
1627616279
'isPublic',
1627716280
'isSynthetic',
@@ -16399,6 +16402,7 @@ const _invisibleGetters = {
1639916402
'hasDefaultValue',
1640016403
'hasDeprecated',
1640116404
'hasDoNotStore',
16405+
'hasDoNotSubmit',
1640216406
'hasFactory',
1640316407
'hasImmutable',
1640416408
'hasImplicitType',
@@ -16407,6 +16411,7 @@ const _invisibleGetters = {
1640716411
'hasIsTestGroup',
1640816412
'hasJS',
1640916413
'hasLiteral',
16414+
'hasMustBeConst',
1641016415
'hasMustBeOverridden',
1641116416
'hasMustCallSuper',
1641216417
'hasNonVirtual',
@@ -16430,7 +16435,6 @@ const _invisibleGetters = {
1643016435
'isFinal',
1643116436
'isInitializingFormal',
1643216437
'isLate',
16433-
'isLegacy',
1643416438
'isPrivate',
1643516439
'isPublic',
1643616440
'isStatic',
@@ -16467,7 +16471,8 @@ const _invisibleGetters = {
1646716471
'isGetter',
1646816472
'isSetter',
1646916473
'runtimeType',
16470-
'variable'
16474+
'variable',
16475+
'variable2'
1647116476
},
1647216477
'Scope': {'hashCode', 'runtimeType'},
1647316478
'TemplateOptions': {

lib/src/model/accessor.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ class Accessor extends ModelElement {
4545

4646
bool get isSynthetic => element.isSynthetic;
4747

48-
// The [enclosingCombo] where this element was defined.
48+
/// The [enclosingCombo] where this element was defined.
4949
late final GetterSetterCombo definingCombo =
50-
getModelForElement(element.variable) as GetterSetterCombo;
50+
getModelForElement(element.variable2!) as GetterSetterCombo;
5151

5252
String get _sourceCode {
5353
if (!isSynthetic) {

lib/src/model/annotation.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ final class Annotation extends Attribute {
4848
late final ElementType _modelType = switch (_annotation.element) {
4949
ConstructorElement(:var returnType) =>
5050
_packageGraph.getTypeFor(returnType, _library),
51-
PropertyAccessorElement(:var variable) =>
52-
(_packageGraph.getModelForElement(variable) as GetterSetterCombo)
51+
PropertyAccessorElement(:var variable2?) =>
52+
(_packageGraph.getModelForElement(variable2) as GetterSetterCombo)
5353
.modelType,
5454
_ => throw StateError(
5555
'non-callable element used as annotation?: ${_annotation.element}')

lib/src/model/comment_referable.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ mixin CommentReferable implements Nameable {
105105
if (resultElement == null) return null;
106106
ModelElement result;
107107
if (resultElement is PropertyAccessorElement) {
108-
final variable = resultElement.variable;
108+
final variable = resultElement.variable2!;
109109
if (variable.isSynthetic) {
110110
result = packageGraph.getModelForElement(resultElement);
111111
} else {

lib/src/model/inheriting_container.dart

+12-30
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,9 @@ import 'package:meta/meta.dart';
1919
/// Note that [Constructor]s are not considered to be modifiers so a
2020
/// [hasModifiers] override is not necessary for this mixin.
2121
mixin Constructable implements InheritingContainer {
22-
late final List<Constructor> constructors =
23-
// TODO(srawlins): Remove this and deal with the follow-on effects, when
24-
// `.augmented` becomes non-nullable.
25-
// ignore: invalid_null_aware_operator
26-
(element.augmented?.constructors ?? element.constructors)
27-
.map((e) => getModelFor(e, library) as Constructor)
28-
.toList(growable: false);
22+
late final List<Constructor> constructors = element.augmented.constructors
23+
.map((e) => getModelFor(e, library) as Constructor)
24+
.toList(growable: false);
2925

3026
@override
3127
late final List<Constructor> publicConstructorsSorted =
@@ -157,11 +153,11 @@ abstract class InheritingContainer extends Container {
157153
// The mapping of all of the inherited element names to their _concrete_
158154
// implementation element.
159155
var concreteInheritanceMap = packageGraph.inheritanceManager
160-
.getInheritedConcreteMap2(element.augmentedDeclarationOrSelf);
156+
.getInheritedConcreteMap2(element.augmented.declaration);
161157
// The mapping of all inherited element names to the nearest inherited
162158
// element that they resolve to.
163159
var inheritanceMap = packageGraph.inheritanceManager
164-
.getInheritedMap2(element.augmentedDeclarationOrSelf);
160+
.getInheritedMap2(element.augmented.declaration);
165161

166162
var inheritanceChainElements =
167163
inheritanceChain.map((c) => c.element).toList(growable: false);
@@ -259,13 +255,9 @@ abstract class InheritingContainer extends Container {
259255
}();
260256

261257
@override
262-
late final List<Method> declaredMethods =
263-
// TODO(srawlins): Remove this and deal with the follow-on effects, when
264-
// `.augmented` becomes non-nullable.
265-
// ignore: invalid_null_aware_operator
266-
(element.augmented?.methods ?? element.methods)
267-
.map((e) => getModelFor(e, library) as Method)
268-
.toList(growable: false);
258+
late final List<Method> declaredMethods = element.augmented.methods
259+
.map((e) => getModelFor(e, library) as Method)
260+
.toList(growable: false);
269261

270262
@override
271263
late final List<TypeParameter> typeParameters = element.typeParameters
@@ -538,9 +530,9 @@ abstract class InheritingContainer extends Container {
538530
// Pick an appropriate [FieldElement] to represent this element.
539531
// Only hard when dealing with a synthetic [Field].
540532
if (getter != null && setter == null) {
541-
field = getterElement!.variable as FieldElement;
533+
field = getterElement!.variable2 as FieldElement;
542534
} else if (getter == null && setter != null) {
543-
field = setterElement!.variable as FieldElement;
535+
field = setterElement!.variable2 as FieldElement;
544536
} else {
545537
// In this case: `getter != null && setter != null`.
546538
getter!;
@@ -553,9 +545,9 @@ abstract class InheritingContainer extends Container {
553545
if (setterEnclosingElement is Class &&
554546
setterEnclosingElement._isInheritingFrom(
555547
getter.enclosingElement as InheritingContainer)) {
556-
field = setterElement!.variable as FieldElement;
548+
field = setterElement!.variable2 as FieldElement;
557549
} else {
558-
field = getterElement!.variable as FieldElement;
550+
field = getterElement!.variable2 as FieldElement;
559551
}
560552
}
561553
}
@@ -601,16 +593,6 @@ mixin MixedInTypes on InheritingContainer {
601593
mixedInTypes.wherePublic;
602594
}
603595

604-
extension on InterfaceElement {
605-
/// This element's augmented declaration, or, if there is none, then just this
606-
/// element itself.
607-
InterfaceElement get augmentedDeclarationOrSelf =>
608-
// TODO(srawlins): Remove this and deal with the follow-on effects, when
609-
// `.augmented` becomes non-nullable.
610-
// ignore: invalid_null_aware_operator
611-
augmented?.declaration ?? this;
612-
}
613-
614596
extension on InterfaceElement {
615597
bool get isDartCoreObject => name == 'Object' && library.name == 'dart.core';
616598
}

lib/src/model/library.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ class Library extends ModelElement
340340
..._exportedAndLocalElements.whereType<TopLevelVariableElement>(),
341341
..._exportedAndLocalElements
342342
.whereType<PropertyAccessorElement>()
343-
.map((a) => a.variable as TopLevelVariableElement)
343+
.map((a) => a.variable2! as TopLevelVariableElement)
344344
};
345345
var variables = <TopLevelVariable>[];
346346
for (var element in elements) {

lib/src/model/method.dart

+1-5
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,7 @@ class Method extends ModelElement
112112
return null;
113113
}
114114
var parent = element.enclosingElement as InterfaceElement;
115-
// TODO(srawlins): Remove this and deal with the follow-on effects, when
116-
// `.augmented` becomes non-nullable.
117-
// ignore: invalid_null_aware_operator
118-
var parentDeclaration = parent.augmented?.declaration ?? parent;
119-
for (var t in parentDeclaration.allSupertypes) {
115+
for (var t in parent.augmented.declaration.allSupertypes) {
120116
Element? e = t.getMethod(element.name);
121117
if (e != null) {
122118
assert(

lib/src/model/model_element.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ abstract class ModelElement
502502
var lookup =
503503
l.element.exportNamespace.definedNames[topLevelElement.name!];
504504
return switch (lookup) {
505-
PropertyAccessorElement() => topLevelElement == lookup.variable,
505+
PropertyAccessorElement() => topLevelElement == lookup.variable2,
506506
_ => topLevelElement == lookup,
507507
};
508508
}).toList(growable: true);

lib/src/model/package_graph.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,7 @@ class PackageGraph with CommentReferable, Nameable {
706706
_canonicalLibraryFor[e] = null;
707707

708708
var searchElement = switch (e) {
709-
PropertyAccessorElement() => e.variable,
709+
PropertyAccessorElement() => e.variable2,
710710
GenericFunctionTypeElement() => e.enclosingElement,
711711
_ => e,
712712
};

lib/src/mustachio/renderer_base.dart

+6-6
Original file line numberDiff line numberDiff line change
@@ -165,15 +165,15 @@ abstract class RendererBase<T extends Object?> {
165165
String get contextChainString =>
166166
parent == null ? '$T' : '${parent!.contextChainString} > $T';
167167

168-
/// Returns the [Property] on this renderer named [name].
168+
/// Returns the [Property] on this renderer named [key].
169169
///
170-
/// If no property named [name] exists for this renderer, `null` is returned.
170+
/// If no property named [key] exists for this renderer, `null` is returned.
171171
Property<T>? getProperty(String key);
172172

173-
/// Resolves [names] into one or more field accesses, returning the result as
173+
/// Resolves [node] into one or more field accesses, returning the result as
174174
/// a String.
175175
///
176-
/// [names] may have multiple dot-separate names, and [names] may not be a
176+
/// [node]'s `key` may have multiple dot-separate names, and it may not be a
177177
/// valid property of _this_ context type, in which the [parent] renderer is
178178
/// referenced.
179179
String getFields(Variable node) {
@@ -347,13 +347,13 @@ class SimpleRenderer extends RendererBase<Object?> {
347347
/// rendering various types of Mustache nodes.
348348
@immutable
349349
class Property<T extends Object?> {
350-
/// Gets the value of this property on the object [context].
350+
/// Gets the value of this property on the object `context`.
351351
final Object? Function(T context) getValue;
352352

353353
final String Function(T, Property<T>, List<String>) renderVariable;
354354

355355
/// Gets the bool value (true or false, never null) of this property on the
356-
/// object [context].
356+
/// object `context`.
357357
final bool Function(T context)? getBool;
358358

359359
final Iterable<void> Function(

pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ environment:
77
sdk: ^3.2.0
88

99
dependencies:
10-
analyzer: ^6.4.1
10+
analyzer: ^6.5.0
1111
args: ^2.4.1
1212
collection: ^1.17.0
1313
crypto: ^3.0.3

test/mustachio/aot_compiler_builder_test.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ class Baz {}
109109
var fooRenderFunction = renderersLibrary.getTopLevelFunction('renderFoo')!;
110110
expect(fooRenderFunction.typeParameters, hasLength(1));
111111
var fBound = fooRenderFunction.typeParameters.single.bound!;
112-
expect(fBound.getDisplayString(withNullability: false), equals('num'));
112+
expect(fBound.getDisplayString(), equals('num'));
113113
});
114114

115115
test('deduplicates partials which share context type LUB', () async {

test/mustachio/runtime_renderer_builder_test.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -234,12 +234,12 @@ class Baz {}
234234
var fooRenderFunction = renderersLibrary.getTopLevelFunction('renderFoo')!;
235235
expect(fooRenderFunction.typeParameters, hasLength(1));
236236
var fBound = fooRenderFunction.typeParameters.single.bound!;
237-
expect(fBound.getDisplayString(withNullability: false), equals('num'));
237+
expect(fBound.getDisplayString(), equals('num'));
238238

239239
var fooRendererClass = renderersLibrary.getClass('_Renderer_Foo')!;
240240
expect(fooRendererClass.typeParameters, hasLength(1));
241241
var cBound = fooRenderFunction.typeParameters.single.bound!;
242-
expect(cBound.getDisplayString(withNullability: false), equals('num'));
242+
expect(cBound.getDisplayString(), equals('num'));
243243
});
244244

245245
group('does not generate a renderer', () {

0 commit comments

Comments
 (0)