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"); |
+ } |
+ '''); |
}); |
+ |
} |