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

Unified Diff: tests/compiler/dart2js/field_type_simple_inferer_test.dart

Issue 12811010: - Introduce the notion of setter constraints in the type inferrer, where we record things like: fie… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 9 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: tests/compiler/dart2js/field_type_simple_inferer_test.dart
===================================================================
--- tests/compiler/dart2js/field_type_simple_inferer_test.dart (revision 20142)
+++ tests/compiler/dart2js/field_type_simple_inferer_test.dart (working copy)
@@ -398,6 +398,32 @@
}
""";
+const String TEST_24 = r"""
+ class A {
+ var f1 = 42;
+ var f2 = 42;
+ var f3 = 42;
+ final f4;
+ var f5;
+ A() : f4 = 42 {
+ f1++;
+ f2 += 42;
+ }
+ A.foo(other) : f3 = other.f3, f4 = other.f4, f5 = other.bar();
+ operator+(other) => 'foo';
+ bar() => 42.5;
+ }
+ class B extends A {
+ bar() => 42;
+ }
+ main() {
+ new A();
+ new A.foo(new A());
+ new A.foo(new B());
+
+ }
+""";
+
void doTest(String test, bool disableInlining, Map<String, Function> fields) {
fields.forEach((String name, Function f) {
compileAndFind(
@@ -471,6 +497,12 @@
'f2': (inferrer) => inferrer.intType.nullable(),
'f3': (inferrer) => inferrer.intType.nullable(),
'f4': (inferrer) => inferrer.intType.nullable()});
+
+ runTest(TEST_24, {'f1': (inferrer) => inferrer.numType,
+ 'f2': (inferrer) => inferrer.numType,
+ 'f3': (inferrer) => inferrer.intType,
+ 'f4': (inferrer) => inferrer.intType,
+ 'f5': (inferrer) => inferrer.numType.nullable()});
}
void main() {

Powered by Google App Engine
This is Rietveld 408576698