Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(915)

Unified Diff: pkg/analyzer/test/src/context/context_test.dart

Issue 2189783002: Record names of classes which unnamed constructor are used in SuperConstructorInvocation. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/task/dart.dart ('k') | pkg/analyzer/test/src/task/dart_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/src/context/context_test.dart
diff --git a/pkg/analyzer/test/src/context/context_test.dart b/pkg/analyzer/test/src/context/context_test.dart
index 45122e660fe70f5e1ff9a5ed1d636b687adc3999..ef3e793aaa1e948d73b97030816c1cec8501b586 100644
--- a/pkg/analyzer/test/src/context/context_test.dart
+++ b/pkg/analyzer/test/src/context/context_test.dart
@@ -2850,6 +2850,28 @@ main() {
''');
}
+ void test_class_constructor_named_parameters_change_usedSuper() {
+ // Update a.dart: change A.named().
+ // b.dart is invalid, because it references A.named().
+ _verifyTwoLibrariesInvalidatesResolution(
+ r'''
+class A {
+ A.named(int a);
+}
+''',
+ r'''
+class A {
+ A.named(String a);
+}
+''',
+ r'''
+import 'a.dart';
+class B extends A {
+ B() : super.named(42);
+}
+''');
+ }
+
void test_class_constructor_named_parameters_remove() {
// Update a.dart: remove a new parameter of A.named().
// b.dart is invalid, because it references A.named().
@@ -2916,6 +2938,56 @@ main() {
''');
}
+ void test_class_constructor_unnamed_parameters_change_notUsedSuper() {
+ // Update a.dart: change A().
+ // Resolution of b.dart is valid, because it does not reference A().
+ // Hints and verify errors are invalid, because it extends A.
+ // TODO(scheglov) we could keep valid hints and verify errors,
+ // because only constructor is changed - this cannot add/remove
+ // inherited unimplemented members.
Brian Wilkerson 2016/07/27 22:09:33 This seems like the wrong place for this TODO comm
+ _verifyTwoLibrariesInvalidHintsVerifyErrors(
+ r'''
+class A {
+ A(int a);
+ A.named(int a);
+}
+''',
+ r'''
+class A {
+ A(String a);
+ A.named(int a);
+}
+''',
+ r'''
+import 'a.dart';
+class B extends A {
+ B() : super.named(42);
+}
+''');
+ }
+
+ void test_class_constructor_unnamed_parameters_change_usedSuper() {
+ // Update a.dart: change A().
+ // b.dart is invalid, because it references A().
+ _verifyTwoLibrariesInvalidatesResolution(
+ r'''
+class A {
+ A(int a);
+}
+''',
+ r'''
+class A {
+ A(String a);
+}
+''',
+ r'''
+import 'a.dart';
+class B extends A {
+ B() : super(42);
+}
+''');
+ }
+
void test_class_constructor_unnamed_parameters_remove() {
// Update a.dart: change A().
// b.dart is invalid, because it references A().
@@ -2962,8 +3034,8 @@ main() {
}
void test_class_constructor_unnamed_remove_used() {
- // Update a.dart: remove A.named().
- // b.dart is invalid, because it references A.named().
+ // Update a.dart: remove A().
+ // b.dart is invalid, because it references A().
_verifyTwoLibrariesInvalidatesResolution(
r'''
class A {
@@ -4679,6 +4751,20 @@ class A {
_assertInvalid(b, LIBRARY_ERRORS_READY);
_assertInvalidUnits(b, RESOLVED_UNIT4);
}
+
+ void _verifyTwoLibrariesInvalidHintsVerifyErrors(
+ String firstCodeA, String secondCodeA, String codeB) {
+ Source a = addSource('/a.dart', firstCodeA);
+ Source b = addSource('/b.dart', codeB);
+ _performPendingAnalysisTasks();
+ context.setContents(a, secondCodeA);
+ _assertValidForChangedLibrary(a);
+ _assertInvalid(a, LIBRARY_ERRORS_READY);
+ _assertValidForDependentLibrary(b);
+ _assertValidAllResolution(b);
+ _assertUnitValid(b, RESOLVE_UNIT_ERRORS);
+ _assertInvalidHintsVerifyErrors(b);
+ }
}
class _AnalysisContextImplTest_Source_exists_true extends TestSource {
« no previous file with comments | « pkg/analyzer/lib/src/task/dart.dart ('k') | pkg/analyzer/test/src/task/dart_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698