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

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

Issue 1685273002: fixes #25740, substitute type parameter bound taking into account outer scope type params (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: merge 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/dart/element/type.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 663ee78c3cde942090a4776e3015e8d81a952595..17a67faca35ce2bfaeb8200f497da6a4ffd72238 100644
--- a/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
+++ b/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
@@ -1722,34 +1722,10 @@ void takeIIO(Object fn(int a, int b)) {}
void takeDDO(Object fn(double a, double b)) {}
''');
});
- });
-
- // Regression test for https://github.com/dart-lang/dev_compiler/issues/47
- test('null literal should not infer as bottom', () {
- checkFile('''
- var h = null;
- void foo(int f(Object _)) {}
-
- main() {
- var f = (x) => null;
- f = (x) => 'hello';
-
- var g = null;
- g = 'hello';
- (/*info:DYNAMIC_INVOKE*/g.foo());
-
- h = 'hello';
- (/*info:DYNAMIC_INVOKE*/h.foo());
-
- foo(/*info:INFERRED_TYPE_CLOSURE,info:INFERRED_TYPE_CLOSURE*/(x) => null);
- foo(/*info:INFERRED_TYPE_CLOSURE,info:INFERRED_TYPE_CLOSURE*/(x) => throw "not implemented");
- }
- ''');
- });
- // Regression test for https://github.com/dart-lang/sdk/issues/25668
- test('infer generic method type', () {
- checkFile('''
+ // Regression test for https://github.com/dart-lang/sdk/issues/25668
+ test('infer generic method type', () {
+ checkFile('''
class C {
/*=T*/ m/*<T>*/(/*=T*/ x) => x;
}
@@ -1761,10 +1737,10 @@ main() {
print(y);
}
''');
- });
+ });
- test('do not infer invalid override of generic method', () {
- checkFile('''
+ test('do not infer invalid override of generic method', () {
+ checkFile('''
class C {
/*=T*/ m/*<T>*/(/*=T*/ x) => x;
}
@@ -1776,5 +1752,48 @@ main() {
print(y);
}
''');
+ });
+
+ test('correctly recognize generic upper bound', () {
+ // Regression test for https://github.com/dart-lang/sdk/issues/25740.
+ checkFile('''
+class Foo<T extends Pattern> {
+ void method/*<U extends T>*/(dynamic/*=U*/ u) {}
+}
+main() {
+ new Foo().method/*<String>*/("str");
+ new Foo();
+
+ new Foo<String>().method("str");
+ new Foo().method("str");
+
+ new Foo<String>().method(/*severe:STATIC_TYPE_ERROR*/42);
+}
+ ''');
+ });
+ });
+
+ // Regression test for https://github.com/dart-lang/dev_compiler/issues/47
+ test('null literal should not infer as bottom', () {
+ checkFile('''
+ var h = null;
+ void foo(int f(Object _)) {}
+
+ main() {
+ var f = (x) => null;
+ f = (x) => 'hello';
+
+ var g = null;
+ g = 'hello';
+ (/*info:DYNAMIC_INVOKE*/g.foo());
+
+ h = 'hello';
+ (/*info:DYNAMIC_INVOKE*/h.foo());
+
+ foo(/*info:INFERRED_TYPE_CLOSURE,info:INFERRED_TYPE_CLOSURE*/(x) => null);
+ foo(/*info:INFERRED_TYPE_CLOSURE,info:INFERRED_TYPE_CLOSURE*/(x) => throw "not implemented");
+ }
+ ''');
});
+
}
« no previous file with comments | « pkg/analyzer/lib/src/dart/element/type.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698