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

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

Issue 1700523002: fixes #24507, allow known functions to be treated as strict arrows (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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/task/strong/info.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/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;
}
}
« no previous file with comments | « pkg/analyzer/lib/src/task/strong/info.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698