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

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

Issue 1649523002: fixes inferring () -> <bottom> in strong mode (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: merged Created 4 years, 11 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/generated/static_type_analyzer.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 a397c9e9a609d6e85aaa3b9c4ba2374220d6658a..58161c61ce7acc4ef53b7cf6c6b74eeb6ebf82d9 100644
--- a/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
+++ b/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
@@ -1584,10 +1584,32 @@ main() {
'''
});
+ // Regression test for https://github.com/dart-lang/dev_compiler/issues/47
+ testChecker('null literal should not infer as bottom', {
+ '/main.dart': '''
+ 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");
+ }
+ '''
+ });
+
// TODO(jmesserly): we should change how this inference works.
// For now this test will cover what we use.
- testChecker(
- 'infer from RHS only if it wont conflict with overridden fields 2', {
+ testChecker('infer JS builtin', {
'/main.dart': '''
import 'dart:_foreign_helper' show JS;
main() {
@@ -1598,6 +1620,5 @@ main() {
}
'''
});
-
});
}
« no previous file with comments | « pkg/analyzer/lib/src/generated/static_type_analyzer.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698