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

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

Issue 1966783003: First steps toward AST-based type inference involving closures. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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
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 3dd8e602aedc9ac2756af2a56ba7ca7253490312..83d6485eeeac394f93aef3144c924509eb752ecb 100644
--- a/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
+++ b/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
@@ -2287,6 +2287,24 @@ class Foo {
}''');
}
+ void test_inferredType_blockBodiedClosure_noArguments() {
+ var mainUnit = checkFile('''
+class C {
+ static final v = () {};
+}
+''');
+ var v = mainUnit.getType('C').fields[0];
+ expect(v.type.toString(), '() → dynamic');
+ }
+
+ void test_inferredType_blockClosure_noArgs_noReturn() {
+ var mainUnit = checkFile('''
+var f = () {};
+''');
+ var f = mainUnit.topLevelVariables[0];
+ expect(f.type.toString(), '() → dynamic');
+ }
+
void test_inferredType_isEnum() {
var mainUnit = checkFile('''
enum E { v1 }

Powered by Google App Engine
This is Rietveld 408576698