Fix the placement of late in two tests
Change-Id: I94e978a453441aeceac72e14873c9e7e895e5c32
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/100466
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
diff --git a/pkg/analyzer/test/src/summary/resynthesize_common.dart b/pkg/analyzer/test/src/summary/resynthesize_common.dart
index 07d58d9..52a0867d 100644
--- a/pkg/analyzer/test/src/summary/resynthesize_common.dart
+++ b/pkg/analyzer/test/src/summary/resynthesize_common.dart
@@ -1005,7 +1005,7 @@
experimentStatus = FeatureSet.forTesting(
sdkVersion: '2.2.2', additionalFeatures: [Feature.non_nullable]);
var library =
- await checkLibrary('class C { late static const int i = 0; }');
+ await checkLibrary('class C { static late const int i = 0; }');
checkElementText(library, r'''
class C {
static late const int i = 0;
@@ -1045,7 +1045,7 @@
test_class_field_static_late() async {
experimentStatus = FeatureSet.forTesting(
sdkVersion: '2.2.2', additionalFeatures: [Feature.non_nullable]);
- var library = await checkLibrary('class C { late static int i; }');
+ var library = await checkLibrary('class C { static late int i; }');
checkElementText(library, r'''
class C {
static late int i;
diff --git a/pkg/analyzer/test/src/summary/summary_common.dart b/pkg/analyzer/test/src/summary/summary_common.dart
index 1e762b5..f52bea5 100644
--- a/pkg/analyzer/test/src/summary/summary_common.dart
+++ b/pkg/analyzer/test/src/summary/summary_common.dart
@@ -8867,6 +8867,25 @@
expect(variable.inheritsCovariantSlot, isNot(0));
}
+ test_field_late() {
+ experimentStatus = FeatureSet.forTesting(
+ sdkVersion: '2.2.2', additionalFeatures: [Feature.non_nullable]);
+ UnlinkedClass cls = serializeClassText('class C { late int i; }');
+ UnlinkedVariable variable = findVariable('i', variables: cls.fields);
+ expect(variable, isNotNull);
+ expect(variable.isConst, isFalse);
+ expect(variable.isLate, isTrue);
+ expect(variable.isStatic, isFalse);
+ expect(variable.isFinal, isFalse);
+ expect(variable.initializer, isNull);
+ expect(variable.inheritsCovariantSlot, isNot(0));
+ expect(findExecutable('i', executables: cls.executables), isNull);
+ expect(findExecutable('i=', executables: cls.executables), isNull);
+ expect(unlinkedUnits[0].publicNamespace.names, hasLength(1));
+ expect(unlinkedUnits[0].publicNamespace.names[0].name, 'C');
+ expect(unlinkedUnits[0].publicNamespace.names[0].members, isEmpty);
+ }
+
test_field_static() {
UnlinkedVariable variable =
serializeClassText('class C { static int i; }').fields[0];
@@ -8897,6 +8916,19 @@
expect(variable.inheritsCovariantSlot, 0);
}
+ test_field_static_final_late() {
+ experimentStatus = FeatureSet.forTesting(
+ sdkVersion: '2.2.2', additionalFeatures: [Feature.non_nullable]);
+ UnlinkedVariable variable =
+ serializeClassText('class C { static late final int i = 0; }')
+ .fields[0];
+ expect(variable.isLate, isTrue);
+ expect(variable.isStatic, isTrue);
+ expect(variable.isFinal, isTrue);
+ expect(variable.initializer.bodyExpr, isNull);
+ expect(variable.inheritsCovariantSlot, 0);
+ }
+
test_field_static_final_untyped() {
UnlinkedVariable variable =
serializeClassText('class C { static final x = 0; }').fields[0];
@@ -8908,6 +8940,28 @@
expect(variable.inheritsCovariantSlot, 0);
}
+ test_field_static_late() {
+ experimentStatus = FeatureSet.forTesting(
+ sdkVersion: '2.2.2', additionalFeatures: [Feature.non_nullable]);
+ UnlinkedVariable variable =
+ serializeClassText('class C { static late int i; }').fields[0];
+ expect(variable.isLate, isTrue);
+ expect(variable.isStatic, isTrue);
+ expect(variable.initializer, isNull);
+ expect(variable.inheritsCovariantSlot, 0);
+ expect(unlinkedUnits[0].publicNamespace.names, hasLength(1));
+ expect(unlinkedUnits[0].publicNamespace.names[0].name, 'C');
+ expect(unlinkedUnits[0].publicNamespace.names[0].members, hasLength(1));
+ expect(unlinkedUnits[0].publicNamespace.names[0].members[0].name, 'i');
+ expect(unlinkedUnits[0].publicNamespace.names[0].members[0].kind,
+ ReferenceKind.propertyAccessor);
+ expect(
+ unlinkedUnits[0].publicNamespace.names[0].members[0].numTypeParameters,
+ 0);
+ expect(
+ unlinkedUnits[0].publicNamespace.names[0].members[0].members, isEmpty);
+ }
+
test_fully_linked_references_follow_other_references() {
if (skipFullyLinkedData) {
return;
@@ -11731,6 +11785,17 @@
}
}
+ test_variable_late() {
+ experimentStatus = FeatureSet.forTesting(
+ sdkVersion: '2.2.2', additionalFeatures: [Feature.non_nullable]);
+ UnlinkedVariable variable =
+ serializeVariableText('late int i;', variableName: 'i');
+ expect(variable.isLate, isTrue);
+ expect(variable.isStatic, isFalse);
+ expect(variable.isConst, isFalse);
+ expect(variable.isFinal, isFalse);
+ }
+
test_variable_name() {
UnlinkedVariable variable =
serializeVariableText('int i;', variableName: 'i');
@@ -11891,71 +11956,6 @@
var expression = body.expression;
return tokensToString(expression.beginToken, expression.endToken);
}
-
- test_field_late() {
- experimentStatus = FeatureSet.forTesting(
- sdkVersion: '2.2.2', additionalFeatures: [Feature.non_nullable]);
- UnlinkedClass cls = serializeClassText('class C { late int i; }');
- UnlinkedVariable variable = findVariable('i', variables: cls.fields);
- expect(variable, isNotNull);
- expect(variable.isConst, isFalse);
- expect(variable.isLate, isTrue);
- expect(variable.isStatic, isFalse);
- expect(variable.isFinal, isFalse);
- expect(variable.initializer, isNull);
- expect(variable.inheritsCovariantSlot, isNot(0));
- expect(findExecutable('i', executables: cls.executables), isNull);
- expect(findExecutable('i=', executables: cls.executables), isNull);
- expect(unlinkedUnits[0].publicNamespace.names, hasLength(1));
- expect(unlinkedUnits[0].publicNamespace.names[0].name, 'C');
- expect(unlinkedUnits[0].publicNamespace.names[0].members, isEmpty);
- }
-
- test_field_static_final_late() {
- experimentStatus = FeatureSet.forTesting(
- sdkVersion: '2.2.2', additionalFeatures: [Feature.non_nullable]);
- UnlinkedVariable variable =
- serializeClassText('class C { static late final int i = 0; }')
- .fields[0];
- expect(variable.isLate, isTrue);
- expect(variable.isStatic, isTrue);
- expect(variable.isFinal, isTrue);
- expect(variable.initializer.bodyExpr, isNull);
- expect(variable.inheritsCovariantSlot, 0);
- }
-
- test_field_static_late() {
- experimentStatus = FeatureSet.forTesting(
- sdkVersion: '2.2.2', additionalFeatures: [Feature.non_nullable]);
- UnlinkedVariable variable =
- serializeClassText('class C { late static int i; }').fields[0];
- expect(variable.isLate, isTrue);
- expect(variable.isStatic, isTrue);
- expect(variable.initializer, isNull);
- expect(variable.inheritsCovariantSlot, 0);
- expect(unlinkedUnits[0].publicNamespace.names, hasLength(1));
- expect(unlinkedUnits[0].publicNamespace.names[0].name, 'C');
- expect(unlinkedUnits[0].publicNamespace.names[0].members, hasLength(1));
- expect(unlinkedUnits[0].publicNamespace.names[0].members[0].name, 'i');
- expect(unlinkedUnits[0].publicNamespace.names[0].members[0].kind,
- ReferenceKind.propertyAccessor);
- expect(
- unlinkedUnits[0].publicNamespace.names[0].members[0].numTypeParameters,
- 0);
- expect(
- unlinkedUnits[0].publicNamespace.names[0].members[0].members, isEmpty);
- }
-
- test_variable_late() {
- experimentStatus = FeatureSet.forTesting(
- sdkVersion: '2.2.2', additionalFeatures: [Feature.non_nullable]);
- UnlinkedVariable variable =
- serializeVariableText('late int i;', variableName: 'i');
- expect(variable.isLate, isTrue);
- expect(variable.isStatic, isFalse);
- expect(variable.isConst, isFalse);
- expect(variable.isFinal, isFalse);
- }
}
/**