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

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

Issue 1668683002: fixes #25668, correctly infer generic method override (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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/strong_mode.dart ('k') | no next file » | 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 eccb4f28fc5079f4d3a8f3e4a597806aa535ab6e..ca8197cce779c09e175637c584a950deded65d5d 100644
--- a/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
+++ b/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
@@ -1692,4 +1692,35 @@ void takeDDO(Object fn(double a, double b)) {}
}
'''
});
+
+ // Regression test for https://github.com/dart-lang/sdk/issues/25668
+ testChecker('infer generic method type', {
+ '/main.dart': '''
+class C {
+ /*=T*/ m/*<T>*/(/*=T*/ x) => x;
+}
+class D extends C {
+ m/*<S>*/(x) => x;
+}
+main() {
+ int y = new D().m/*<int>*/(42);
+ print(y);
+}
+ '''
+ });
+
+ testChecker('do not infer invalid override of generic method', {
+ '/main.dart': '''
+class C {
+ /*=T*/ m/*<T>*/(/*=T*/ x) => x;
+}
+class D extends C {
+ /*severe:INVALID_METHOD_OVERRIDE*/m(x) => x;
+}
+main() {
+ int y = /*info:DYNAMIC_CAST*/new D().m/*<int>*/(42);
+ print(y);
+}
+ '''
+ });
}
« no previous file with comments | « pkg/analyzer/lib/src/task/strong_mode.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698