Skip to content

Commit 9b2d1b7

Browse files
scheglovCommit Queue
authored andcommitted
Fine. Print unnamed constructors in a few tests.
Add test_dependency_class_unnamedConstructor_change_notUsed() to cover the case when an unnamed constructor changes, but because it is not used, we don't reanalyze. Change-Id: I0c0f41c3f6e6ae515ade5c219f821dc39b78237b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/444381 Commit-Queue: Konstantin Shcheglov <[email protected]> Reviewed-by: Paul Berry <[email protected]>
1 parent e9c56bf commit 9b2d1b7

File tree

1 file changed

+146
-35
lines changed

1 file changed

+146
-35
lines changed

pkg/analyzer/test/src/dart/analysis/driver_test.dart

Lines changed: 146 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -14101,6 +14101,103 @@ class A {
1410114101
);
1410214102
}
1410314103

14104+
test_dependency_class_unnamedConstructor_change_notUsed() async {
14105+
configuration
14106+
..includeDefaultConstructors()
14107+
..withStreamResolvedUnitResults = false;
14108+
await _runChangeScenarioTA(
14109+
initialA: r'''
14110+
class A {
14111+
A(int _);
14112+
A.named(int _);
14113+
}
14114+
''',
14115+
testCode: r'''
14116+
import 'a.dart';
14117+
void f() {
14118+
A.named(0);
14119+
}
14120+
''',
14121+
operation: _FineOperationTestFileGetErrors(),
14122+
expectedInitialEvents: r'''
14123+
[status] working
14124+
[operation] linkLibraryCycle SDK
14125+
[future] getErrors T1
14126+
ErrorsResult #0
14127+
path: /home/test/lib/test.dart
14128+
uri: package:test/test.dart
14129+
flags: isLibrary
14130+
[operation] linkLibraryCycle
14131+
package:test/a.dart
14132+
declaredClasses
14133+
A: #M0
14134+
declaredConstructors
14135+
named: #M1
14136+
new: #M2
14137+
interface: #M3
14138+
requirements
14139+
topLevels
14140+
dart:core
14141+
int: #M4
14142+
[operation] linkLibraryCycle
14143+
package:test/test.dart
14144+
declaredFunctions
14145+
f: #M5
14146+
requirements
14147+
[operation] analyzeFile
14148+
file: /home/test/lib/test.dart
14149+
library: /home/test/lib/test.dart
14150+
[operation] analyzedLibrary
14151+
file: /home/test/lib/test.dart
14152+
requirements
14153+
topLevels
14154+
dart:core
14155+
A: <null>
14156+
package:test/a.dart
14157+
A: #M0
14158+
interfaces
14159+
package:test/a.dart
14160+
A
14161+
constructors
14162+
named: #M1
14163+
[status] idle
14164+
''',
14165+
updatedA: r'''
14166+
class A {
14167+
A(double _);
14168+
A.named(int _);
14169+
}
14170+
''',
14171+
expectedUpdatedEvents: r'''
14172+
[status] working
14173+
[operation] linkLibraryCycle
14174+
package:test/a.dart
14175+
declaredClasses
14176+
A: #M0
14177+
declaredConstructors
14178+
named: #M1
14179+
new: #M6
14180+
interface: #M3
14181+
requirements
14182+
topLevels
14183+
dart:core
14184+
double: #M7
14185+
int: #M4
14186+
[future] getErrors T2
14187+
ErrorsResult #1
14188+
path: /home/test/lib/test.dart
14189+
uri: package:test/test.dart
14190+
flags: isLibrary
14191+
[operation] readLibraryCycleBundle
14192+
package:test/test.dart
14193+
[operation] getErrorsFromBytes
14194+
file: /home/test/lib/test.dart
14195+
library: /home/test/lib/test.dart
14196+
[status] idle
14197+
''',
14198+
);
14199+
}
14200+
1410414201
test_dependency_classTypaAlias_namedConstructor_change_invoked() async {
1410514202
configuration.withStreamResolvedUnitResults = false;
1410614203
await _runChangeScenarioTA(
@@ -19403,6 +19500,7 @@ extension type A(int it) {
1940319500
}
1940419501

1940519502
test_dependency_extensionType_namedConstructor_change_invoked() async {
19503+
configuration.includeDefaultConstructors();
1940619504
await _runChangeScenarioTA(
1940719505
initialA: r'''
1940819506
extension type A(int it) {
@@ -19434,17 +19532,18 @@ void f() {
1943419532
it: #M2
1943519533
declaredConstructors
1943619534
named: #M3
19437-
interface: #M4
19535+
new: #M4
19536+
interface: #M5
1943819537
map
1943919538
it: #M2
1944019539
requirements
1944119540
topLevels
1944219541
dart:core
19443-
int: #M5
19542+
int: #M6
1944419543
[operation] linkLibraryCycle
1944519544
package:test/test.dart
1944619545
declaredFunctions
19447-
f: #M6
19546+
f: #M7
1944819547
requirements
1944919548
[operation] analyzeFile
1945019549
file: /home/test/lib/test.dart
@@ -19485,15 +19584,16 @@ extension type A(int it) {
1948519584
declaredGetters
1948619585
it: #M2
1948719586
declaredConstructors
19488-
named: #M7
19489-
interface: #M4
19587+
named: #M8
19588+
new: #M4
19589+
interface: #M5
1949019590
map
1949119591
it: #M2
1949219592
requirements
1949319593
topLevels
1949419594
dart:core
19495-
double: #M8
19496-
int: #M5
19595+
double: #M9
19596+
int: #M6
1949719597
[future] getErrors T2
1949819598
ErrorsResult #2
1949919599
path: /home/test/lib/test.dart
@@ -19507,7 +19607,7 @@ extension type A(int it) {
1950719607
interfaceName: A
1950819608
constructorName: named
1950919609
expectedId: #M3
19510-
actualId: #M7
19610+
actualId: #M8
1951119611
[operation] analyzeFile
1951219612
file: /home/test/lib/test.dart
1951319613
library: /home/test/lib/test.dart
@@ -19528,13 +19628,14 @@ extension type A(int it) {
1952819628
package:test/a.dart
1952919629
A
1953019630
constructors
19531-
named: #M7
19631+
named: #M8
1953219632
[status] idle
1953319633
''',
1953419634
);
1953519635
}
1953619636

1953719637
test_dependency_extensionType_namedConstructor_change_notUsed() async {
19638+
configuration.includeDefaultConstructors();
1953819639
await _runChangeScenarioTA(
1953919640
initialA: r'''
1954019641
extension type A(int it) {
@@ -19566,17 +19667,18 @@ void f() {
1956619667
it: #M2
1956719668
declaredConstructors
1956819669
named: #M3
19569-
interface: #M4
19670+
new: #M4
19671+
interface: #M5
1957019672
map
1957119673
it: #M2
1957219674
requirements
1957319675
topLevels
1957419676
dart:core
19575-
int: #M5
19677+
int: #M6
1957619678
[operation] linkLibraryCycle
1957719679
package:test/test.dart
1957819680
declaredFunctions
19579-
f: #M6
19681+
f: #M7
1958019682
requirements
1958119683
[operation] analyzeFile
1958219684
file: /home/test/lib/test.dart
@@ -19598,7 +19700,7 @@ void f() {
1959819700
package:test/a.dart
1959919701
A
1960019702
constructors
19601-
new: #M7
19703+
new: #M4
1960219704
[status] idle
1960319705
''',
1960419706
updatedA: r'''
@@ -19618,14 +19720,15 @@ extension type A(int it) {
1961819720
it: #M2
1961919721
declaredConstructors
1962019722
named: #M8
19621-
interface: #M4
19723+
new: #M4
19724+
interface: #M5
1962219725
map
1962319726
it: #M2
1962419727
requirements
1962519728
topLevels
1962619729
dart:core
1962719730
double: #M9
19628-
int: #M5
19731+
int: #M6
1962919732
[future] getErrors T2
1963019733
ErrorsResult #2
1963119734
path: /home/test/lib/test.dart
@@ -20427,6 +20530,7 @@ extension type A(int it) {
2042720530
}
2042820531

2042920532
test_dependency_extensionType_unnamedConstructor_change_invoked() async {
20533+
configuration.includeDefaultConstructors();
2043020534
await _runChangeScenarioTA(
2043120535
initialA: r'''
2043220536
extension type A(int it) {}
@@ -20454,17 +20558,19 @@ void f() {
2045420558
it: #M1
2045520559
declaredGetters
2045620560
it: #M2
20457-
interface: #M3
20561+
declaredConstructors
20562+
new: #M3
20563+
interface: #M4
2045820564
map
2045920565
it: #M2
2046020566
requirements
2046120567
topLevels
2046220568
dart:core
20463-
int: #M4
20569+
int: #M5
2046420570
[operation] linkLibraryCycle
2046520571
package:test/test.dart
2046620572
declaredFunctions
20467-
f: #M5
20573+
f: #M6
2046820574
requirements
2046920575
[operation] analyzeFile
2047020576
file: /home/test/lib/test.dart
@@ -20486,7 +20592,7 @@ void f() {
2048620592
package:test/a.dart
2048720593
A
2048820594
constructors
20489-
new: #M6
20595+
new: #M3
2049020596
[status] idle
2049120597
''',
2049220598
updatedA: r'''
@@ -20502,13 +20608,15 @@ extension type A(double it) {}
2050220608
it: #M7
2050320609
declaredGetters
2050420610
it: #M8
20505-
interface: #M9
20611+
declaredConstructors
20612+
new: #M9
20613+
interface: #M10
2050620614
map
2050720615
it: #M8
2050820616
requirements
2050920617
topLevels
2051020618
dart:core
20511-
double: #M10
20619+
double: #M11
2051220620
[future] getErrors T2
2051320621
ErrorsResult #2
2051420622
path: /home/test/lib/test.dart
@@ -20521,8 +20629,8 @@ extension type A(double it) {}
2052120629
libraryUri: package:test/a.dart
2052220630
interfaceName: A
2052320631
constructorName: new
20524-
expectedId: #M6
20525-
actualId: #M11
20632+
expectedId: #M3
20633+
actualId: #M9
2052620634
[operation] analyzeFile
2052720635
file: /home/test/lib/test.dart
2052820636
library: /home/test/lib/test.dart
@@ -20543,13 +20651,14 @@ extension type A(double it) {}
2054320651
package:test/a.dart
2054420652
A
2054520653
constructors
20546-
new: #M11
20654+
new: #M9
2054720655
[status] idle
2054820656
''',
2054920657
);
2055020658
}
2055120659

2055220660
test_dependency_extensionType_unnamedConstructor_change_notUsed() async {
20661+
configuration.includeDefaultConstructors();
2055320662
await _runChangeScenarioTA(
2055420663
initialA: r'''
2055520664
extension type A(int it) {
@@ -20581,17 +20690,18 @@ void f() {
2058120690
it: #M2
2058220691
declaredConstructors
2058320692
named: #M3
20584-
interface: #M4
20693+
new: #M4
20694+
interface: #M5
2058520695
map
2058620696
it: #M2
2058720697
requirements
2058820698
topLevels
2058920699
dart:core
20590-
int: #M5
20700+
int: #M6
2059120701
[operation] linkLibraryCycle
2059220702
package:test/test.dart
2059320703
declaredFunctions
20594-
f: #M6
20704+
f: #M7
2059520705
requirements
2059620706
[operation] analyzeFile
2059720707
file: /home/test/lib/test.dart
@@ -20628,19 +20738,20 @@ extension type A(double it) {
2062820738
declaredExtensionTypes
2062920739
A: #M0
2063020740
declaredFields
20631-
it: #M7
20632-
declaredGetters
2063320741
it: #M8
20742+
declaredGetters
20743+
it: #M9
2063420744
declaredConstructors
2063520745
named: #M3
20636-
interface: #M9
20746+
new: #M10
20747+
interface: #M11
2063720748
map
20638-
it: #M8
20749+
it: #M9
2063920750
requirements
2064020751
topLevels
2064120752
dart:core
20642-
double: #M10
20643-
int: #M5
20753+
double: #M12
20754+
int: #M6
2064420755
[future] getErrors T2
2064520756
ErrorsResult #2
2064620757
path: /home/test/lib/test.dart
@@ -42983,7 +43094,7 @@ const a = A.named();
4298343094
}
4298443095

4298543096
test_manifest_constInitializer_constructorName_unnamed() async {
42986-
configuration.ignoredManifestInstanceMemberNames.remove('new');
43097+
configuration.includeDefaultConstructors();
4298743098
await _runLibraryManifestScenario(
4298843099
initialCode: r'''
4298943100
class A {
@@ -43028,7 +43139,7 @@ const a = A();
4302843139
}
4302943140

4303043141
test_manifest_constInitializer_constructorName_unnamed_notAffected() async {
43031-
configuration.ignoredManifestInstanceMemberNames.remove('new');
43142+
configuration.includeDefaultConstructors();
4303243143
await _runLibraryManifestScenario(
4303343144
initialCode: r'''
4303443145
class A {

0 commit comments

Comments
 (0)