| Index: pkg/analyzer/test/src/summary/summary_common.dart
|
| diff --git a/pkg/analyzer/test/src/summary/summary_common.dart b/pkg/analyzer/test/src/summary/summary_common.dart
|
| index 69a1d295c424971e0a872a0f8b9155fe95318228..b0bc3f104de20dc83e642337c660f27035b2bacb 100644
|
| --- a/pkg/analyzer/test/src/summary/summary_common.dart
|
| +++ b/pkg/analyzer/test/src/summary/summary_common.dart
|
| @@ -3945,6 +3945,27 @@ class D {
|
| expect(findClass('D').executables[0].constCycleSlot, 0);
|
| }
|
|
|
| + test_constructorCycle_referenceToClass() {
|
| + serializeLibraryText('''
|
| +class C {
|
| + final x;
|
| + const C() : x = C;
|
| +}
|
| +''');
|
| + checkConstCycle('C', hasCycle: false);
|
| + }
|
| +
|
| + test_constructorCycle_referenceToEnum() {
|
| + serializeLibraryText('''
|
| +enum E { v }
|
| +class C {
|
| + final x;
|
| + const C() : x = E;
|
| +}
|
| +''');
|
| + checkConstCycle('C', hasCycle: false);
|
| + }
|
| +
|
| test_constructorCycle_referenceToEnumValue() {
|
| serializeLibraryText('''
|
| enum E { v }
|
| @@ -3967,6 +3988,110 @@ class C {
|
| checkConstCycle('C', hasCycle: false);
|
| }
|
|
|
| + test_constructorCycle_referenceToGenericParameter() {
|
| + // It's not valid Dart but we need to make sure it doesn't crash
|
| + // summary generation.
|
| + serializeLibraryText(
|
| + '''
|
| +class C<T> {
|
| + final x;
|
| + const C() : x = T;
|
| +}
|
| +''',
|
| + allowErrors: true);
|
| + checkConstCycle('C', hasCycle: false);
|
| + }
|
| +
|
| + test_constructorCycle_referenceToStaticMethod_inOtherClass() {
|
| + serializeLibraryText('''
|
| +class C {
|
| + final x;
|
| + const C() : x = D.f;
|
| +}
|
| +class D {
|
| + static void f() {}
|
| +}
|
| +''');
|
| + checkConstCycle('C', hasCycle: false);
|
| + }
|
| +
|
| + test_constructorCycle_referenceToStaticMethod_inSameClass() {
|
| + serializeLibraryText('''
|
| +class C {
|
| + final x;
|
| + static void f() {}
|
| + const C() : x = f;
|
| +}
|
| +''');
|
| + checkConstCycle('C', hasCycle: false);
|
| + }
|
| +
|
| + test_constructorCycle_referenceToTopLevelFunction() {
|
| + serializeLibraryText('''
|
| +void f() {}
|
| +class C {
|
| + final x;
|
| + const C() : x = f;
|
| +}
|
| +''');
|
| + checkConstCycle('C', hasCycle: false);
|
| + }
|
| +
|
| + test_constructorCycle_referenceToTypedef() {
|
| + serializeLibraryText('''
|
| +typedef F();
|
| +class C {
|
| + final x;
|
| + const C() : x = F;
|
| +}
|
| +''');
|
| + checkConstCycle('C', hasCycle: false);
|
| + }
|
| +
|
| + test_constructorCycle_referenceToUndefinedName() {
|
| + // It's not valid Dart but we need to make sure it doesn't crash
|
| + // summary generation.
|
| + serializeLibraryText(
|
| + '''
|
| +class C {
|
| + final x;
|
| + const C() : x = foo;
|
| +}
|
| +''',
|
| + allowErrors: true);
|
| + checkConstCycle('C', hasCycle: false);
|
| + }
|
| +
|
| + test_constructorCycle_referenceToUndefinedName_viaPrefix() {
|
| + // It's not valid Dart but we need to make sure it doesn't crash
|
| + // summary generation.
|
| + addNamedSource('/a.dart', '');
|
| + serializeLibraryText(
|
| + '''
|
| +import 'a.dart' as a;
|
| +class C {
|
| + final x;
|
| + const C() : x = a.foo;
|
| +}
|
| +''',
|
| + allowErrors: true);
|
| + }
|
| +
|
| + test_constructorCycle_referenceToUndefinedName_viaPrefix_nonExistentFile() {
|
| + // It's not valid Dart but we need to make sure it doesn't crash
|
| + // summary generation.
|
| + allowMissingFiles = true;
|
| + serializeLibraryText(
|
| + '''
|
| +import 'a.dart' as a;
|
| +class C {
|
| + final x;
|
| + const C() : x = a.foo;
|
| +}
|
| +''',
|
| + allowErrors: true);
|
| + }
|
| +
|
| test_constructorCycle_viaFinalField() {
|
| serializeLibraryText(
|
| '''
|
| @@ -4127,6 +4252,44 @@ const y = const C();
|
| checkConstCycle('C');
|
| }
|
|
|
| + test_constructorCycle_viaTopLevelVariable_imported() {
|
| + addNamedSource(
|
| + '/a.dart',
|
| + '''
|
| +import 'test.dart';
|
| +const y = const C();
|
| + ''');
|
| + serializeLibraryText(
|
| + '''
|
| +import 'a.dart';
|
| +class C {
|
| + final x;
|
| + const C() : x = y;
|
| +}
|
| +''',
|
| + allowErrors: true);
|
| + checkConstCycle('C');
|
| + }
|
| +
|
| + test_constructorCycle_viaTopLevelVariable_importedViaPrefix() {
|
| + addNamedSource(
|
| + '/a.dart',
|
| + '''
|
| +import 'test.dart';
|
| +const y = const C();
|
| + ''');
|
| + serializeLibraryText(
|
| + '''
|
| +import 'a.dart' as a;
|
| +class C {
|
| + final x;
|
| + const C() : x = a.y;
|
| +}
|
| +''',
|
| + allowErrors: true);
|
| + checkConstCycle('C');
|
| + }
|
| +
|
| test_dependencies_export_to_export_unused() {
|
| addNamedSource('/a.dart', 'export "b.dart";');
|
| addNamedSource('/b.dart', '');
|
|
|