Index: pkg/analyzer/test/src/task/strong/checker_test.dart |
diff --git a/pkg/analyzer/test/src/task/strong/checker_test.dart b/pkg/analyzer/test/src/task/strong/checker_test.dart |
index cc7047e425acd22909232c83024986f4099dbd7c..1861e77e6858424aaab574e60378bac686dd02b0 100644 |
--- a/pkg/analyzer/test/src/task/strong/checker_test.dart |
+++ b/pkg/analyzer/test/src/task/strong/checker_test.dart |
@@ -556,6 +556,53 @@ void main() { |
typedef A Right(dynamic x); // Right branch |
typedef A Bottom(A x); // Bottom of the lattice |
+ void main() { |
+ Top top; |
+ Left left; |
+ Right right; |
+ Bottom bot; |
+ { |
+ Top f; |
+ f = top; |
+ f = left; |
+ f = right; |
+ f = bot; |
+ } |
+ { |
+ Left f; |
+ f = /*warning:DOWN_CAST_COMPOSITE*/top; |
+ f = left; |
+ f = /*warning:DOWN_CAST_COMPOSITE*/right; |
+ f = bot; |
+ } |
+ { |
+ Right f; |
+ f = /*warning:DOWN_CAST_COMPOSITE*/top; |
+ f = /*warning:DOWN_CAST_COMPOSITE*/left; |
+ f = right; |
+ f = bot; |
+ } |
+ { |
+ Bottom f; |
+ f = /*warning:DOWN_CAST_COMPOSITE*/top; |
+ f = /*warning:DOWN_CAST_COMPOSITE*/left; |
+ f = /*warning:DOWN_CAST_COMPOSITE*/right; |
+ f = bot; |
+ } |
+ } |
+ '''); |
+ }); |
+ |
+ test('dynamic - known functions', () { |
+ checkFile(''' |
+ |
+ class A {} |
Leaf
2016/02/16 20:30:43
A little pedantic, but I think it's worth getting
Jennifer Messerly
2016/02/17 20:13:23
Done!
* used that picture in a comment. Thanks :)
|
+ |
+ typedef dynamic Top(dynamic x); // Top of the lattice |
+ typedef dynamic Left(A x); // Left branch |
+ typedef A Right(dynamic x); // Right branch |
+ typedef A Bottom(A x); // Bottom of the lattice |
Leaf
2016/02/16 20:30:43
This is not the bottom type in this lattice.
Jennifer Messerly
2016/02/17 20:13:23
Fixed. See above.
|
+ |
dynamic left(A x) => x; |
A bot(A x) => x; |
Leaf
2016/02/16 20:30:43
This is not the bottom type in this lattice.
Jennifer Messerly
2016/02/17 20:13:23
Fixed. See above.
|
dynamic top(dynamic x) => x; |
Leaf
2016/02/16 20:30:43
This is not the top type in this lattice.
Jennifer Messerly
2016/02/17 20:13:23
Fixed. See above.
|
@@ -571,9 +618,9 @@ void main() { |
} |
{ |
Left f; |
- f = /*severe:STATIC_TYPE_ERROR*/top; |
+ f = top; |
f = left; |
- f = /*severe:STATIC_TYPE_ERROR*/right; |
+ f = right; |
f = bot; |
} |
{ |
@@ -587,7 +634,7 @@ void main() { |
Bottom f; |
f = /*severe:STATIC_TYPE_ERROR*/top; |
f = /*severe:STATIC_TYPE_ERROR*/left; |
- f = /*severe:STATIC_TYPE_ERROR*/right; |
+ f = right; |
f = bot; |
} |
} |