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

Unified Diff: pkg/analyzer/test/src/task/strong/inferred_type_test.dart

Issue 1927323002: Implement stable resolution of generic types without type arguments to their bounds. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Merge and regenerate the task graph. Created 4 years, 8 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/test/src/task/dart_test.dart ('k') | pkg/analyzer/tool/task_dependency_graph/tasks.dot » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/src/task/strong/inferred_type_test.dart
diff --git a/pkg/analyzer/test/src/task/strong/inferred_type_test.dart b/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
index 8114c01e0c360aecf596c1b2884a17d4294499f7..b6311e66cd94e09b53a367c60c830995c9a54bc3 100644
--- a/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
+++ b/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
@@ -1086,7 +1086,7 @@ main() {
// Regression test for https://github.com/dart-lang/sdk/issues/25740.
checkFile(r'''
class Foo<T extends Pattern> {
-void method/*<U extends T>*/(dynamic/*=U*/ u) {}
+ void method/*<U extends T>*/(dynamic/*=U*/ u) {}
}
main() {
new Foo().method/*<String>*/("str");
@@ -2439,6 +2439,58 @@ main() {
''');
}
+ void test_instantiateToBounds_generic2_hasBound_definedAfter() {
+ var unit = checkFile(r'''
+class B<T extends A> {}
+class A<T extends int> {}
+B v = null;
+''');
+ expect(unit.topLevelVariables[0].type.toString(), 'B<A<dynamic>>');
+ }
+
+ void test_instantiateToBounds_generic2_hasBound_definedBefore() {
+ var unit = checkFile(r'''
+class A<T extends int> {}
+class B<T extends A> {}
+B v = null;
+''');
+ expect(unit.topLevelVariables[0].type.toString(), 'B<A<dynamic>>');
+ }
+
+ void test_instantiateToBounds_generic2_noBound() {
+ var unit = checkFile(r'''
+class A<T> {}
+class B<T extends A> {}
+B v = null;
+''');
+ expect(unit.topLevelVariables[0].type.toString(), 'B<A<dynamic>>');
+ }
+
+ void test_instantiateToBounds_generic_hasBound_definedAfter() {
+ var unit = checkFile(r'''
+A v = null;
+class A<T extends int> {}
+''');
+ expect(unit.topLevelVariables[0].type.toString(), 'A<int>');
+ }
+
+ void test_instantiateToBounds_generic_hasBound_definedBefore() {
+ var unit = checkFile(r'''
+class A<T extends int> {}
+A v = null;
+''');
+ expect(unit.topLevelVariables[0].type.toString(), 'A<int>');
+ }
+
+ void test_instantiateToBounds_notGeneric() {
+ var unit = checkFile(r'''
+class A {}
+class B<T extends A> {}
+B v = null;
+''');
+ expect(unit.topLevelVariables[0].type.toString(), 'B<A>');
+ }
+
void test_listLiterals() {
checkFile(r'''
test1() {
« no previous file with comments | « pkg/analyzer/test/src/task/dart_test.dart ('k') | pkg/analyzer/tool/task_dependency_graph/tasks.dot » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698