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

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

Issue 2675963004: fix #28630, instance method tear-offs are treated as strict arrows (Closed)
Patch Set: fix Created 3 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
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 73fc16c5d48b058ac12fa345a192ac27da6a7e59..1d6d5db274190f3e404bd31803ea7b5f1d09edc7 100644
--- a/pkg/analyzer/test/src/task/strong/checker_test.dart
+++ b/pkg/analyzer/test/src/task/strong/checker_test.dart
@@ -1674,23 +1674,23 @@ void main() {
}
{
Function2<B, B> f;
- f = /*warning:DOWN_CAST_COMPOSITE*/c.top;
+ f = /*error:INVALID_CAST_METHOD*/c.top;
Leaf 2017/02/03 20:28:41 This isn't right. This error is only for casts
Jennifer Messerly 2017/02/03 21:02:50 yeah, that's why I'd split out like that initially
f = c.left;
f = /*error:INVALID_ASSIGNMENT*/c.right;
f = c.bot;
}
{
Function2<A, A> f;
- f = /*warning:DOWN_CAST_COMPOSITE*/c.top;
+ f = /*error:INVALID_CAST_METHOD*/c.top;
f = /*error:INVALID_ASSIGNMENT*/c.left;
f = c.right;
f = c.bot;
}
{
Function2<A, B> f;
- f = /*warning:DOWN_CAST_COMPOSITE*/c.top;
- f = /*warning:DOWN_CAST_COMPOSITE*/c.left;
- f = /*warning:DOWN_CAST_COMPOSITE*/c.right;
+ f = /*error:INVALID_CAST_METHOD*/c.top;
+ f = /*error:INVALID_CAST_METHOD*/c.left;
+ f = /*error:INVALID_CAST_METHOD*/c.right;
f = c.bot;
}
}
@@ -3678,6 +3678,33 @@ class B extends A {
''');
}
+ void test_tearOffTreatedConsistentlyAsStrictArrow() {
+ checkFile(r'''
+void foo(void f(String x)) {}
+
+class A {
+ Null bar1(dynamic x) => null;
+ void bar2(dynamic x) => null;
+ Null bar3(String x) => null;
+ void test() {
+ foo(bar1);
+ foo(bar2);
+ foo(bar3);
+ }
+}
+
+
+Null baz1(dynamic x) => null;
+void baz2(dynamic x) => null;
+Null baz3(String x) => null;
+void test() {
+ foo(baz1);
+ foo(baz2);
+ foo(baz3);
+}
+ ''');
+ }
+
void test_ternaryOperator() {
checkFile('''
abstract class Comparable<T> {

Powered by Google App Engine
This is Rietveld 408576698