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

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

Issue 1957973002: Fix AST-based type inference of enum types. (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
« no previous file with comments | « pkg/analyzer/lib/src/summary/link.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 810c05239cd8bad3c6b5438b7e345012fbaa7ddb..2465bfd65aae2d82459ec5b4cd27eb0a3afce15a 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_isEnum() {
+ var mainUnit = checkFile('''
+enum E { v1 }
+final x = E.v1;
+''');
+ var x = mainUnit.topLevelVariables[0];
+ expect(x.type.toString(), 'E');
+ }
+
+ void test_inferredType_isEnumValues() {
+ var mainUnit = checkFile('''
+enum E { v1 }
+final x = E.values;
+''');
+ var x = mainUnit.topLevelVariables[0];
+ expect(x.type.toString(), 'List<E>');
+ }
+
void test_inferredType_isTypedef() {
var mainUnit = checkFile('''
typedef void F();
« no previous file with comments | « pkg/analyzer/lib/src/summary/link.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698