CQ. Trim diagnostic messages in expectations.

See
https://dart-review.googlesource.com/c/sdk/+/501764/comment/6a88eca8_ab5cf6e4/

Change-Id: Ic7752669660b88003460167f9d9e3926e0d19c3e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/503541
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
Konstantin Shcheglov
2026-05-14 09:40:43 -07:00
committed by dart-scoped@luci-project-accounts.iam.gserviceaccount.com
parent 54d25a757e
commit 5723f42f69
9 changed files with 93 additions and 90 deletions
@@ -30,7 +30,7 @@ class _A {}
f() {
g((_A a) {});
// ^^^^^^^^^
// [diag.argumentTypeNotAssignable] The argument type 'Null Function(_A)' can't be assigned to the parameter type 'dynamic Function(_A)'.
// [diag.argumentTypeNotAssignable] The argument type 'Null Function(_A)' can't be assigned to the parameter type 'dynamic Function(_A)'.
}''');
// The name _A is private to the library it's defined in, so this is a type
// mismatch. Furthermore, the error message should mention both _A and the
@@ -45,7 +45,7 @@ extension type const A(String _) {}
@A(0)
// ^
// [diag.argumentTypeNotAssignable] The argument type 'int' can't be assigned to the parameter type 'String'.
// [diag.argumentTypeNotAssignable] The argument type 'int' can't be assigned to the parameter type 'String'.
void f() {}
''');
}
@@ -57,7 +57,7 @@ class A {
}
@A.fromInt('0')
// ^^^
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
main() {}
''');
}
@@ -69,7 +69,7 @@ class A<T> {
}
@A<int>.fromInt('0')
// ^^^
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
main() {
}''');
}
@@ -92,7 +92,7 @@ class A {
}
@A('0')
// ^^^
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
main() {
}''');
}
@@ -105,7 +105,7 @@ class A {
f(A a) {
a + '0';
// ^^^
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
}''');
}
@@ -118,10 +118,10 @@ class A {
void f(A a, A? aq) {
a == 0;
// ^
// [diag.argumentTypeNotAssignable] The argument type 'int' can't be assigned to the parameter type 'A?'.
// [diag.argumentTypeNotAssignable] The argument type 'int' can't be assigned to the parameter type 'A?'.
aq == 1;
// ^
// [diag.argumentTypeNotAssignable] The argument type 'int' can't be assigned to the parameter type 'A?'.
// [diag.argumentTypeNotAssignable] The argument type 'int' can't be assigned to the parameter type 'A?'.
aq == aq;
aq == null;
}
@@ -137,7 +137,7 @@ Predicate<String> f() => (String s) => false;
void main() {
f().call(3);
// ^
// [diag.argumentTypeNotAssignable] The argument type 'int' can't be assigned to the parameter type 'String'.
// [diag.argumentTypeNotAssignable] The argument type 'int' can't be assigned to the parameter type 'String'.
}''');
}
@@ -155,7 +155,7 @@ main() {
A a = new A();
a.. ma().mb(0);
// ^
// [diag.argumentTypeNotAssignable] The argument type 'int' can't be assigned to the parameter type 'String'.
// [diag.argumentTypeNotAssignable] The argument type 'int' can't be assigned to the parameter type 'String'.
}''');
}
@@ -167,7 +167,7 @@ class A {
main() {
const A(42);
// ^^
// [diag.argumentTypeNotAssignable] The argument type 'int' can't be assigned to the parameter type 'String'.
// [diag.argumentTypeNotAssignable] The argument type 'int' can't be assigned to the parameter type 'String'.
// [diag.constConstructorParamTypeMismatch] A value of type 'int' can't be assigned to a parameter of type 'String' in a const constructor.
}''');
}
@@ -180,7 +180,7 @@ class A {
class B extends A {
const B() : super(42);
// ^^
// [diag.argumentTypeNotAssignable] The argument type 'int' can't be assigned to the parameter type 'String'.
// [diag.argumentTypeNotAssignable] The argument type 'int' can't be assigned to the parameter type 'String'.
}''');
}
@@ -190,7 +190,7 @@ m() {
num y = 1;
n(y);
// ^
// [diag.argumentTypeNotAssignable] The argument type 'num' can't be assigned to the parameter type 'int'.
// [diag.argumentTypeNotAssignable] The argument type 'num' can't be assigned to the parameter type 'int'.
}
n(int x) {}
''');
@@ -202,7 +202,7 @@ m() {
int? y;
n(y);
// ^
// [diag.argumentTypeNotAssignable] The argument type 'int?' can't be assigned to the parameter type 'int'.
// [diag.argumentTypeNotAssignable] The argument type 'int?' can't be assigned to the parameter type 'int'.
}
n(int x) {}
''');
@@ -223,7 +223,7 @@ n(int i) {}
enum E {
v(0);
// ^
// [diag.argumentTypeNotAssignable] The argument type 'int' can't be assigned to the parameter type 'String'.
// [diag.argumentTypeNotAssignable] The argument type 'int' can't be assigned to the parameter type 'String'.
// [diag.constConstructorParamTypeMismatch] A value of type 'int' can't be assigned to a parameter of type 'String' in a const constructor.
const E(String a);
}
@@ -270,7 +270,7 @@ class C<T> {
var g = C<int>.new;
var x = g('Hello');
// ^^^^^^^
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
''');
}
@@ -299,7 +299,7 @@ void f<T>(T a) {}
var g = f<int>;
var x = g('Hello');
// ^^^^^^^
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
''');
}
@@ -330,7 +330,7 @@ void f<T>(Iterable<T> Function() g, void Function(T) h) {
main() {
(int x) {} ('');
// ^^
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
}''');
}
@@ -340,7 +340,7 @@ m() {
var a = new A();
a.n(() => 0);
// ^^^^^^^
// [diag.argumentTypeNotAssignable] The argument type 'void Function()' can't be assigned to the parameter type 'void Function(int)'.
// [diag.argumentTypeNotAssignable] The argument type 'void Function()' can't be assigned to the parameter type 'void Function(int)'.
}
class A {
n(void f(int i)) {}
@@ -406,7 +406,7 @@ class A {
f(A a) {
a['0'];
// ^^^
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
}''');
}
@@ -419,13 +419,13 @@ class A {
f(A a) {
a['0'] += 0;
// ^^^
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
++a['0'];
// ^^^
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
a['0']++;
// ^^^
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
}''');
}
@@ -437,7 +437,7 @@ class A {
f(A a) {
a['0'] = 0;
// ^^^
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
}''');
}
@@ -450,13 +450,13 @@ class A {
f(A a) {
a['0'] += 0;
// ^^^
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
++a['0'];
// ^^^
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
a['0']++;
// ^^^
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
}''');
}
@@ -466,7 +466,7 @@ m() {
var i = '';
n(i);
// ^
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
}
n(int i) {}
''');
@@ -480,7 +480,7 @@ class A {
f(A a) {
a('0');
// ^^^
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
}''');
}
@@ -493,7 +493,7 @@ main() {
A a = new A();
a('0');
// ^^^
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
}''');
}
@@ -502,7 +502,7 @@ main() {
a(b(int p)) {
b('0');
// ^^^
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
}''');
}
@@ -512,7 +512,7 @@ class A<K, V> {
m(f(K k), V v) {
f(v);
// ^
// [diag.argumentTypeNotAssignable] The argument type 'V' can't be assigned to the parameter type 'K'.
// [diag.argumentTypeNotAssignable] The argument type 'V' can't be assigned to the parameter type 'K'.
}
}''');
}
@@ -524,7 +524,7 @@ void funBool(bool b) {}
main() {
acceptFunOptBool(funBool);
// ^^^^^^^
// [diag.argumentTypeNotAssignable] The argument type 'void Function(bool)' can't be assigned to the parameter type 'void Function([bool])'.
// [diag.argumentTypeNotAssignable] The argument type 'void Function(bool)' can't be assigned to the parameter type 'void Function([bool])'.
}''');
}
@@ -537,7 +537,7 @@ class C {
main() {
acceptFunOptBool(C.funBool);
// ^^^^^^^^^
// [diag.argumentTypeNotAssignable] The argument type 'void Function(bool)' can't be assigned to the parameter type 'void Function([bool])'.
// [diag.argumentTypeNotAssignable] The argument type 'void Function(bool)' can't be assigned to the parameter type 'void Function([bool])'.
}''');
}
@@ -549,7 +549,7 @@ class A<T> {
f(A<String> a) {
a.m(1);
// ^
// [diag.argumentTypeNotAssignable] The argument type 'int' can't be assigned to the parameter type 'String'.
// [diag.argumentTypeNotAssignable] The argument type 'int' can't be assigned to the parameter type 'String'.
}''');
}
@@ -559,7 +559,7 @@ f({String p = ''}) {}
main() {
f(p: 42);
// ^^
// [diag.argumentTypeNotAssignable] The argument type 'int' can't be assigned to the parameter type 'String'.
// [diag.argumentTypeNotAssignable] The argument type 'int' can't be assigned to the parameter type 'String'.
}''');
}
@@ -569,7 +569,7 @@ f([String p = '']) {}
main() {
f(42);
// ^^
// [diag.argumentTypeNotAssignable] The argument type 'int' can't be assigned to the parameter type 'String'.
// [diag.argumentTypeNotAssignable] The argument type 'int' can't be assigned to the parameter type 'String'.
}''');
}
@@ -579,7 +579,7 @@ f(String p) {}
main() {
f(42);
// ^^
// [diag.argumentTypeNotAssignable] The argument type 'int' can't be assigned to the parameter type 'String'.
// [diag.argumentTypeNotAssignable] The argument type 'int' can't be assigned to the parameter type 'String'.
}''');
}
@@ -589,7 +589,7 @@ typedef A<T>(T p);
f(A<int> a) {
a('1');
// ^^^
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
}''');
}
@@ -601,7 +601,7 @@ main() {
A a = getA();
a('1');
// ^^^
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
}''');
}
@@ -611,7 +611,7 @@ typedef A(int p);
f(A a) {
a('1');
// ^^^
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
}''');
}
@@ -632,7 +632,7 @@ main() {
Map<int, int> m = <int, int>{};
m['x'] = 0;
// ^^^
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
}
''');
}
@@ -644,7 +644,7 @@ main() {
Map<int, int> m = <int, int>{};
m['x'] ??= 0;
// ^^^
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
}
''');
}
@@ -657,7 +657,7 @@ class A<T> {
main() {
new A<String>(42);
// ^^
// [diag.argumentTypeNotAssignable] The argument type 'int' can't be assigned to the parameter type 'String'.
// [diag.argumentTypeNotAssignable] The argument type 'int' can't be assigned to the parameter type 'String'.
}''');
}
@@ -669,7 +669,7 @@ class A {
main() {
new A(42);
// ^^
// [diag.argumentTypeNotAssignable] The argument type 'int' can't be assigned to the parameter type 'String'.
// [diag.argumentTypeNotAssignable] The argument type 'int' can't be assigned to the parameter type 'String'.
}''');
}
@@ -681,7 +681,7 @@ class A {
main() {
new A(42);
// ^^
// [diag.argumentTypeNotAssignable] The argument type 'int' can't be assigned to the parameter type 'String'.
// [diag.argumentTypeNotAssignable] The argument type 'int' can't be assigned to the parameter type 'String'.
}''');
}
@@ -54,7 +54,7 @@ class A {
foo(x) => 1;
var v = const A(foo);
// ^^^
// [diag.argumentTypeNotAssignable] The argument type 'dynamic Function(dynamic)' can't be assigned to the parameter type 'Int2String'.
// [diag.argumentTypeNotAssignable] The argument type 'dynamic Function(dynamic)' can't be assigned to the parameter type 'Int2String'.
// [diag.constConstructorParamTypeMismatch] A value of type 'dynamic Function(dynamic)' can't be assigned to a parameter of type 'String Function(int)' in a const constructor.
''');
}
@@ -212,7 +212,7 @@ class C {
const A u = const A();
var v = const C(u);
// ^
// [diag.argumentTypeNotAssignable] The argument type 'A' can't be assigned to the parameter type 'B'.
// [diag.argumentTypeNotAssignable] The argument type 'A' can't be assigned to the parameter type 'B'.
// [diag.constConstructorParamTypeMismatch] A value of type 'A' can't be assigned to a parameter of type 'B' in a const constructor.
''');
}
@@ -229,7 +229,7 @@ class A {
int foo(String x) => 1;
var v = const A(foo);
// ^^^
// [diag.argumentTypeNotAssignable] The argument type 'int Function(String)' can't be assigned to the parameter type 'Int2String'.
// [diag.argumentTypeNotAssignable] The argument type 'int Function(String)' can't be assigned to the parameter type 'Int2String'.
// [diag.constConstructorParamTypeMismatch] A value of type 'int Function(String)' can't be assigned to a parameter of type 'String Function(int)' in a const constructor.
''');
}
@@ -242,7 +242,7 @@ class A {
}
var v = const A('foo');
// ^^^^^
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
// [diag.constConstructorParamTypeMismatch] A value of type 'String' can't be assigned to a parameter of type 'int' in a const constructor.
''');
}
@@ -266,7 +266,7 @@ class A<T> {
}
var v = const A<int>('foo');
// ^^^^^
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
// [diag.constConstructorParamTypeMismatch] A value of type 'String' can't be assigned to a parameter of type 'int' in a const constructor.
''');
}
@@ -278,7 +278,7 @@ class A {
}
var v = const A('foo');
// ^^^^^
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
// [diag.constConstructorParamTypeMismatch] A value of type 'String' can't be assigned to a parameter of type 'int' in a const constructor.
''');
}
@@ -376,12 +376,12 @@ var b1 = const bool.fromEnvironment(1);
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// [diag.constEvalThrowsException] Evaluation of this constant expression throws an exception.
// ^
// [diag.argumentTypeNotAssignable] The argument type 'int' can't be assigned to the parameter type 'String'.
// [diag.argumentTypeNotAssignable] The argument type 'int' can't be assigned to the parameter type 'String'.
var b2 = const bool.fromEnvironment('x', defaultValue: 1);
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// [diag.constEvalThrowsException] Evaluation of this constant expression throws an exception.
// ^
// [diag.argumentTypeNotAssignable] The argument type 'int' can't be assigned to the parameter type 'bool'.
// [diag.argumentTypeNotAssignable] The argument type 'int' can't be assigned to the parameter type 'bool'.
''');
}
@@ -394,7 +394,7 @@ var b = const bool.fromEnvironment('x', defaultValue: 1);
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// [diag.constEvalThrowsException] Evaluation of this constant expression throws an exception.
// ^
// [diag.argumentTypeNotAssignable] The argument type 'int' can't be assigned to the parameter type 'bool'.
// [diag.argumentTypeNotAssignable] The argument type 'int' can't be assigned to the parameter type 'bool'.
''');
}
@@ -463,7 +463,7 @@ var s2 = const Symbol(3);
// ^^^^^^^^^^^^^^^
// [diag.constEvalThrowsException] Evaluation of this constant expression throws an exception.
// ^
// [diag.argumentTypeNotAssignable] The argument type 'int' can't be assigned to the parameter type 'String'.
// [diag.argumentTypeNotAssignable] The argument type 'int' can't be assigned to the parameter type 'String'.
''');
}
@@ -21,7 +21,7 @@ const b = a & '';
// ^^^^^^
// [diag.constEvalTypeBoolInt] In constant expressions, operands of this operator must be of type 'bool' or 'int'.
// ^^
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
''');
}
@@ -32,7 +32,7 @@ const b = a | '';
// ^^^^^^
// [diag.constEvalTypeBoolInt] In constant expressions, operands of this operator must be of type 'bool' or 'int'.
// ^^
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
''');
}
@@ -43,7 +43,7 @@ const b = a ^ '';
// ^^^^^^
// [diag.constEvalTypeBoolInt] In constant expressions, operands of this operator must be of type 'bool' or 'int'.
// ^^
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
''');
}
@@ -54,7 +54,7 @@ const b = a << '';
// ^^^^^^^
// [diag.constEvalTypeInt] In constant expressions, operands of this operator must be of type 'int'.
// ^^
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
''');
}
@@ -65,7 +65,7 @@ const b = a >> '';
// ^^^^^^^
// [diag.constEvalTypeInt] In constant expressions, operands of this operator must be of type 'int'.
// ^^
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'int'.
''');
}
}
@@ -21,7 +21,7 @@ const b = a + '';
// ^^^^^^
// [diag.constEvalTypeNum] In constant expressions, operands of this operator must be of type 'num'.
// ^^
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'num'.
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'num'.
''');
}
@@ -32,7 +32,7 @@ const b = a / '';
// ^^^^^^
// [diag.constEvalTypeNum] In constant expressions, operands of this operator must be of type 'num'.
// ^^
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'num'.
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'num'.
''');
}
@@ -43,7 +43,7 @@ const b = a >= '';
// ^^^^^^^
// [diag.constEvalTypeNum] In constant expressions, operands of this operator must be of type 'num'.
// ^^
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'num'.
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'num'.
''');
}
@@ -54,7 +54,7 @@ const b = a > '';
// ^^^^^^
// [diag.constEvalTypeNum] In constant expressions, operands of this operator must be of type 'num'.
// ^^
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'num'.
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'num'.
''');
}
@@ -65,7 +65,7 @@ const b = a <= '';
// ^^^^^^^
// [diag.constEvalTypeNum] In constant expressions, operands of this operator must be of type 'num'.
// ^^
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'num'.
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'num'.
''');
}
@@ -76,7 +76,7 @@ const b = a < '';
// ^^^^^^
// [diag.constEvalTypeNum] In constant expressions, operands of this operator must be of type 'num'.
// ^^
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'num'.
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'num'.
''');
}
@@ -87,7 +87,7 @@ const b = a % '';
// ^^^^^^
// [diag.constEvalTypeNum] In constant expressions, operands of this operator must be of type 'num'.
// ^^
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'num'.
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'num'.
''');
}
@@ -98,7 +98,7 @@ const b = a * '';
// ^^^^^^
// [diag.constEvalTypeNum] In constant expressions, operands of this operator must be of type 'num'.
// ^^
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'num'.
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'num'.
''');
}
@@ -109,7 +109,7 @@ const b = a - '';
// ^^^^^^
// [diag.constEvalTypeNum] In constant expressions, operands of this operator must be of type 'num'.
// ^^
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'num'.
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'num'.
''');
}
@@ -120,7 +120,7 @@ const b = a ~/ '';
// ^^^^^^^
// [diag.constEvalTypeNum] In constant expressions, operands of this operator must be of type 'num'.
// ^^
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'num'.
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type 'num'.
''');
}
}
@@ -77,7 +77,7 @@ main() {
// ^
// [diag.unusedLocalVariable] The value of the local variable 'x' isn't used.
// ^^^
// [diag.argumentTypeNotAssignable] The argument type 'NotA Function()' can't be assigned to the parameter type 'F<A>'.
// [diag.argumentTypeNotAssignable] The argument type 'NotA Function()' can't be assigned to the parameter type 'F<A>'.
}
''');
}
@@ -207,7 +207,7 @@ void g(num cb(Object a, Object b)) {}
void main() {
g(f);
// ^
// [diag.argumentTypeNotAssignable] The argument type 'num Function(num, num)' can't be assigned to the parameter type 'num Function(Object, Object)'.
// [diag.argumentTypeNotAssignable] The argument type 'num Function(num, num)' can't be assigned to the parameter type 'num Function(Object, Object)'.
}
''');
}
@@ -222,7 +222,7 @@ void g(num cb(Object a, Object b)) {}
void main() {
g(a.f);
// ^^^
// [diag.argumentTypeNotAssignable] The argument type 'num Function(num, num)' can't be assigned to the parameter type 'num Function(Object, Object)'.
// [diag.argumentTypeNotAssignable] The argument type 'num Function(num, num)' can't be assigned to the parameter type 'num Function(Object, Object)'.
}
''');
}
@@ -234,7 +234,7 @@ void g(int cb(Object a, Object b)) {}
void main() {
g(f);
// ^
// [diag.argumentTypeNotAssignable] The argument type 'num Function(num, num)' can't be assigned to the parameter type 'int Function(Object, Object)'.
// [diag.argumentTypeNotAssignable] The argument type 'num Function(num, num)' can't be assigned to the parameter type 'int Function(Object, Object)'.
}
''');
}
@@ -250,7 +250,7 @@ void g(int cb(Object a, Object b)) {}
void main() {
g(C().m);
// ^^^^^
// [diag.argumentTypeNotAssignable] The argument type 'num Function(num, num)' can't be assigned to the parameter type 'int Function(Object, Object)'.
// [diag.argumentTypeNotAssignable] The argument type 'num Function(num, num)' can't be assigned to the parameter type 'int Function(Object, Object)'.
}
''');
}
@@ -312,7 +312,7 @@ class Foo<T extends Pattern> {
main() {
new Foo<String>().method(42);
// ^^
// [diag.argumentTypeNotAssignable] The argument type 'int' can't be assigned to the parameter type 'String'.
// [diag.argumentTypeNotAssignable] The argument type 'int' can't be assigned to the parameter type 'String'.
}
''');
}
@@ -364,7 +364,7 @@ class C<P extends num> {
var c = C([]);
// ^^
// [diag.argumentTypeNotAssignable] The argument type 'List<dynamic>' can't be assigned to the parameter type 'Iterable<num>'.
// [diag.argumentTypeNotAssignable] The argument type 'List<dynamic>' can't be assigned to the parameter type 'Iterable<num>'.
''');
}
}
@@ -19,7 +19,7 @@ class DuplicateFieldName_RecordLiteralTest extends PubPackageResolutionTest {
await resolveTestCodeWithDiagnostics(r'''
var r = (a: 1, a: 2);
// ^
// [context 1] The first
// [context 1] The first
// ^
// [diag.duplicateFieldName][context 1] The field name 'a' is already used in this record.
''');
@@ -39,7 +39,7 @@ class DuplicateFieldName_RecordTypeAnnotationTest
await resolveTestCodeWithDiagnostics(r'''
void f(({int a, int a}) r) {}
// ^
// [context 1] The first
// [context 1] The first
// ^
// [diag.duplicateFieldName][context 1] The field name 'a' is already used in this record.
''');
@@ -49,7 +49,7 @@ void f(({int a, int a}) r) {}
await resolveTestCodeWithDiagnostics(r'''
void f((int a, int a) r) {}
// ^
// [context 1] The first
// [context 1] The first
// ^
// [diag.duplicateFieldName][context 1] The field name 'a' is already used in this record.
''');
@@ -59,7 +59,7 @@ void f((int a, int a) r) {}
await resolveTestCodeWithDiagnostics(r'''
void f((int a, {int a}) r) {}
// ^
// [context 1] The first
// [context 1] The first
// ^
// [diag.duplicateFieldName][context 1] The field name 'a' is already used in this record.
''');
@@ -69,7 +69,7 @@ void f((int a, {int a}) r) {}
await resolveTestCodeWithDiagnostics(r'''
void f(({int _, int _}) r) {}
// ^
// [context 1] The first
// [context 1] The first
// [diag.invalidFieldNamePrivate] Record field names can't be private.
// ^
// [diag.duplicateFieldName][context 1] The field name '_' is already used in this record.
@@ -90,7 +90,7 @@ void f((int _, int _) r) {}
void f((int _, int _) r) {}
// ^
// [context 1] The first
// [context 1] The first
// [diag.invalidFieldNamePrivate] Record field names can't be private.
// ^
// [diag.duplicateFieldName][context 1] The field name '_' is already used in this record.
@@ -22,7 +22,7 @@ class RecordLiteralOnePositionalNoTrailingCommaTest
void f((int,) i) {
f((''));
// ^^
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type '(int,)'.
// [diag.argumentTypeNotAssignable] The argument type 'String' can't be assigned to the parameter type '(int,)'.
}
''');
}
@@ -32,7 +32,7 @@ void f((int,) i) {
void f((int,) i) {
f(1);
// ^
// [diag.argumentTypeNotAssignable] The argument type 'int' can't be assigned to the parameter type '(int,)'.
// [diag.argumentTypeNotAssignable] The argument type 'int' can't be assigned to the parameter type '(int,)'.
}
''');
}
@@ -77,7 +77,7 @@ final class _ExpectedDiagnosticsUpdater {
length: contextMessage.length,
caretLength: presentation.caretLength,
includeExplicitLocation: presentation.includeExplicitLocation,
message: _toPosixPaths(contextMessage.messageText(includeUrl: false)),
message: _messageText(contextMessage),
),
);
}
@@ -103,9 +103,7 @@ final class _ExpectedDiagnosticsUpdater {
caretLength: presentation.caretLength,
includeExplicitLocation: presentation.includeExplicitLocation,
contextRefs: contextRefs,
message: _toPosixPaths(
diagnostic.problemMessage.messageText(includeUrl: false),
),
message: _messageText(diagnostic.problemMessage),
),
);
}
@@ -254,6 +252,11 @@ final class _ExpectedDiagnosticsUpdater {
return buffer.toString();
}
static String _messageText(DiagnosticMessage message) {
var text = message.messageText(includeUrl: false);
return _toPosixPaths(text).trim();
}
static String _toPosixPaths(String message) {
return message.replaceAllMapped(RegExp(r'C:\\([a-zA-Z0-9_.\\]+)'), (match) {
var path = match.group(1)!;