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

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

Issue 2482573002: fix #27764, split STATIC_TYPE_ERROR into more detailed ones (Closed)
Patch Set: format Created 4 years, 1 month 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 48e6539e12d23711f644fad2fb9dfa5886c9dc1b..53d1bea19e005a09c98f7b263dddf14533484df9 100644
--- a/pkg/analyzer/test/src/task/strong/checker_test.dart
+++ b/pkg/analyzer/test/src/task/strong/checker_test.dart
@@ -723,7 +723,7 @@ class Cat extends Animal {}
void main() {
Cat c = /*info:ASSIGNMENT_CAST*/new Animal.cat();
- c = /*error:STATIC_TYPE_ERROR*/new Animal();
+ c = /*error:INVALID_CAST_NEW_EXPR*/new Animal();
}''');
}
@@ -1042,23 +1042,23 @@ void main() {
}
{
Left f;
- f = /*error:STATIC_TYPE_ERROR*/top;
+ f = /*error:INVALID_CAST_FUNCTION*/top;
f = left;
f = /*error:INVALID_ASSIGNMENT*/right;
f = bot;
}
{
Right f;
- f = /*error:STATIC_TYPE_ERROR*/top;
+ f = /*error:INVALID_CAST_FUNCTION*/top;
f = /*error:INVALID_ASSIGNMENT*/left;
f = right;
f = bot;
}
{
Bot f;
- f = /*error:STATIC_TYPE_ERROR*/top;
- f = /*error:STATIC_TYPE_ERROR*/left;
- f = /*error:STATIC_TYPE_ERROR*/right;
+ f = /*error:INVALID_CAST_FUNCTION*/top;
+ f = /*error:INVALID_CAST_FUNCTION*/left;
+ f = /*error:INVALID_CAST_FUNCTION*/right;
f = bot;
}
}
@@ -1226,14 +1226,14 @@ void main() {
f = topA;
f = /*error:INVALID_ASSIGNMENT*/topTop;
f = aa;
- f = /*error:STATIC_TYPE_ERROR*/aTop; // known function
+ f = /*error:INVALID_CAST_FUNCTION*/aTop; // known function
f = /*warning:DOWN_CAST_COMPOSITE*/botA;
f = /*warning:DOWN_CAST_COMPOSITE*/botTop;
apply/*<AA>*/(
topA,
/*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/topTop,
aa,
- /*error:STATIC_TYPE_ERROR*/aTop, // known function
+ /*error:INVALID_CAST_FUNCTION*/aTop, // known function
/*warning:DOWN_CAST_COMPOSITE*/botA,
/*warning:DOWN_CAST_COMPOSITE*/botTop
);
@@ -1241,7 +1241,7 @@ void main() {
(dynamic x) => new A(),
/*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/(dynamic x) => (x as Object),
(A x) => x,
- /*error:STATIC_TYPE_ERROR*/(A x) => (/*info:UNNECESSARY_CAST*/x as Object), // known function
+ /*error:INVALID_CAST_FUNCTION_EXPR*/(A x) => (/*info:UNNECESSARY_CAST*/x as Object), // known function
/*warning:DOWN_CAST_COMPOSITE*/botA,
/*warning:DOWN_CAST_COMPOSITE*/botTop
);
@@ -1251,14 +1251,14 @@ void main() {
f = topA;
f = topTop;
f = /*error:INVALID_ASSIGNMENT*/aa;
- f = /*error:STATIC_TYPE_ERROR*/aTop; // known function
+ f = /*error:INVALID_CAST_FUNCTION*/aTop; // known function
f = /*error:INVALID_ASSIGNMENT*/botA;
f = /*warning:DOWN_CAST_COMPOSITE*/botTop;
apply/*<TopTop>*/(
topA,
topTop,
/*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/aa,
- /*error:STATIC_TYPE_ERROR*/aTop, // known function
+ /*error:INVALID_CAST_FUNCTION*/aTop, // known function
/*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/botA,
/*warning:DOWN_CAST_COMPOSITE*/botTop
);
@@ -1266,7 +1266,7 @@ void main() {
(dynamic x) => new A(),
(dynamic x) => (x as Object),
/*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/(A x) => x,
- /*error:STATIC_TYPE_ERROR*/(A x) => (/*info:UNNECESSARY_CAST*/x as Object), // known function
+ /*error:INVALID_CAST_FUNCTION_EXPR*/(A x) => (/*info:UNNECESSARY_CAST*/x as Object), // known function
/*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/botA,
/*warning:DOWN_CAST_COMPOSITE*/botTop
);
@@ -1274,24 +1274,24 @@ void main() {
{
TopA f;
f = topA;
- f = /*error:STATIC_TYPE_ERROR*/topTop; // known function
- f = /*error:STATIC_TYPE_ERROR*/aa; // known function
- f = /*error:STATIC_TYPE_ERROR*/aTop; // known function
+ f = /*error:INVALID_CAST_FUNCTION*/topTop; // known function
+ f = /*error:INVALID_CAST_FUNCTION*/aa; // known function
+ f = /*error:INVALID_CAST_FUNCTION*/aTop; // known function
f = /*warning:DOWN_CAST_COMPOSITE*/botA;
f = /*warning:DOWN_CAST_COMPOSITE*/botTop;
apply/*<TopA>*/(
topA,
- /*error:STATIC_TYPE_ERROR*/topTop, // known function
- /*error:STATIC_TYPE_ERROR*/aa, // known function
- /*error:STATIC_TYPE_ERROR*/aTop, // known function
+ /*error:INVALID_CAST_FUNCTION*/topTop, // known function
+ /*error:INVALID_CAST_FUNCTION*/aa, // known function
+ /*error:INVALID_CAST_FUNCTION*/aTop, // known function
/*warning:DOWN_CAST_COMPOSITE*/botA,
/*warning:DOWN_CAST_COMPOSITE*/botTop
);
apply/*<TopA>*/(
(dynamic x) => new A(),
- /*error:STATIC_TYPE_ERROR*/(dynamic x) => (x as Object), // known function
- /*error:STATIC_TYPE_ERROR*/(A x) => x, // known function
- /*error:STATIC_TYPE_ERROR*/(A x) => (/*info:UNNECESSARY_CAST*/x as Object), // known function
+ /*error:INVALID_CAST_FUNCTION_EXPR*/(dynamic x) => (x as Object), // known function
+ /*error:INVALID_CAST_FUNCTION_EXPR*/(A x) => x, // known function
+ /*error:INVALID_CAST_FUNCTION_EXPR*/(A x) => (/*info:UNNECESSARY_CAST*/x as Object), // known function
/*warning:DOWN_CAST_COMPOSITE*/botA,
/*warning:DOWN_CAST_COMPOSITE*/botTop
);
@@ -1300,7 +1300,7 @@ void main() {
''');
}
- void test_functionTypingAndSubtyping_dynamicFunctions_clasuresAreNotFuzzy() {
+ void test_functionTypingAndSubtyping_dynamicFunctions_closuresAreNotFuzzy() {
// Regression test for
// https://github.com/dart-lang/sdk/issues/26118
// https://github.com/dart-lang/sdk/issues/26156
@@ -1379,23 +1379,23 @@ void main() {
}
{
Function2<B, B> f; // left
- f = /*error:STATIC_TYPE_ERROR*/top;
+ f = /*error:INVALID_CAST_FUNCTION*/top;
f = left;
f = /*error:INVALID_ASSIGNMENT*/right;
f = bot;
}
{
Function2<A, A> f; // right
- f = /*error:STATIC_TYPE_ERROR*/top;
+ f = /*error:INVALID_CAST_FUNCTION*/top;
f = /*error:INVALID_ASSIGNMENT*/left;
f = right;
f = bot;
}
{
Function2<A, B> f;
- f = /*error:STATIC_TYPE_ERROR*/top;
- f = /*error:STATIC_TYPE_ERROR*/left;
- f = /*error:STATIC_TYPE_ERROR*/right;
+ f = /*error:INVALID_CAST_FUNCTION*/top;
+ f = /*error:INVALID_CAST_FUNCTION*/left;
+ f = /*error:INVALID_CAST_FUNCTION*/right;
f = bot;
}
}
@@ -1466,14 +1466,14 @@ void main() {
}
{
Function2<AToB, AToB> f; // Left
- f = /*error:STATIC_TYPE_ERROR*/top;
+ f = /*error:INVALID_CAST_FUNCTION*/top;
f = left;
f = /*error:INVALID_ASSIGNMENT*/right;
f = bot;
}
{
Function2<BToA, BToA> f; // Right
- f = /*error:STATIC_TYPE_ERROR*/top;
+ f = /*error:INVALID_CAST_FUNCTION*/top;
f = /*error:INVALID_ASSIGNMENT*/left;
f = right;
f = bot;
@@ -1481,9 +1481,9 @@ void main() {
{
Function2<BToA, AToB> f; // Bot
f = bot;
- f = /*error:STATIC_TYPE_ERROR*/left;
- f = /*error:STATIC_TYPE_ERROR*/top;
- f = /*error:STATIC_TYPE_ERROR*/right;
+ f = /*error:INVALID_CAST_FUNCTION*/left;
+ f = /*error:INVALID_CAST_FUNCTION*/top;
+ f = /*error:INVALID_CAST_FUNCTION*/right;
}
}
''');
@@ -1515,14 +1515,14 @@ void main() {
}
{
Function2<AToB, AToB> f; // Left
- f = /*error:STATIC_TYPE_ERROR*/top;
+ f = /*error:INVALID_CAST_FUNCTION*/top;
f = left;
f = /*error:INVALID_ASSIGNMENT*/right;
f = bot;
}
{
Function2<BToA, BToA> f; // Right
- f = /*error:STATIC_TYPE_ERROR*/top;
+ f = /*error:INVALID_CAST_FUNCTION*/top;
f = /*error:INVALID_ASSIGNMENT*/left;
f = right;
f = bot;
@@ -1530,9 +1530,9 @@ void main() {
{
Function2<BToA, AToB> f; // Bot
f = bot;
- f = /*error:STATIC_TYPE_ERROR*/left;
- f = /*error:STATIC_TYPE_ERROR*/top;
- f = /*error:STATIC_TYPE_ERROR*/right;
+ f = /*error:INVALID_CAST_FUNCTION*/left;
+ f = /*error:INVALID_CAST_FUNCTION*/top;
+ f = /*error:INVALID_CAST_FUNCTION*/right;
}
}
''');
@@ -1564,14 +1564,14 @@ void main() {
}
{
Function2<AToB, AToB> f; // Left
- f = /*error:STATIC_TYPE_ERROR*/top;
+ f = /*error:INVALID_CAST_FUNCTION*/top;
f = left;
f = /*error:INVALID_ASSIGNMENT*/right;
f = bot;
}
{
Function2<BToA, BToA> f; // Right
- f = /*error:STATIC_TYPE_ERROR*/top;
+ f = /*error:INVALID_CAST_FUNCTION*/top;
f = /*error:INVALID_ASSIGNMENT*/left;
f = right;
f = bot;
@@ -1579,9 +1579,9 @@ void main() {
{
Function2<BToA, AToB> f; // Bot
f = bot;
- f = /*error:STATIC_TYPE_ERROR*/left;
- f = /*error:STATIC_TYPE_ERROR*/top;
- f = /*error:STATIC_TYPE_ERROR*/right;
+ f = /*error:INVALID_CAST_FUNCTION*/left;
+ f = /*error:INVALID_CAST_FUNCTION*/top;
+ f = /*error:INVALID_CAST_FUNCTION*/right;
}
}
''');
@@ -1937,23 +1937,23 @@ void main() {
}
{
Function2<B, B> f;
- f = /*error:STATIC_TYPE_ERROR*/C.top;
+ f = /*error:INVALID_CAST_METHOD*/C.top;
f = C.left;
f = /*error:INVALID_ASSIGNMENT*/C.right;
f = C.bot;
}
{
Function2<A, A> f;
- f = /*error:STATIC_TYPE_ERROR*/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 = /*error:STATIC_TYPE_ERROR*/C.top;
- f = /*error:STATIC_TYPE_ERROR*/C.left;
- f = /*error:STATIC_TYPE_ERROR*/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;
}
}
@@ -1984,7 +1984,7 @@ void main() {
var local2 = g;
local = local2;
- local2 = /*error:STATIC_TYPE_ERROR*/f;
+ local2 = /*error:INVALID_CAST_FUNCTION*/f;
local2 = /*warning:DOWN_CAST_COMPOSITE*/local;
// Non-generic function cannot subtype a generic one.
« no previous file with comments | « pkg/analyzer/test/src/task/dart_test.dart ('k') | pkg/analyzer/test/src/task/strong/inferred_type_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698