Files
sdk/tests/language_2/operator/invalid_operators_test.dart
T
Sam Rawlins ff6ddd2972 Analyzer: deduplicate errors when operator defined with bad parameters
If an operator declaration has both too many parameters, and one or more
optional parameters, just report the former error.

This is better UX, and is closer aligned to what the CFE reports.

Change-Id: I1f30ab9564f4bcdc49c1f3317add6c55cca29597
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185201
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-02-16 22:39:04 +00:00

601 lines
24 KiB
Dart

// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
class Operators1 {
operator ==() => true;
// ^^
// [analyzer] COMPILE_TIME_ERROR.INVALID_OVERRIDE
// [cfe] Operator '==' should have exactly one parameter.
// ^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] The method 'Operators1.==' has fewer positional arguments than those of overridden method 'Object.=='.
operator <() => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '<' should have exactly one parameter.
operator >() => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '>' should have exactly one parameter.
operator <=() => true;
// ^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '<=' should have exactly one parameter.
operator >=() => true;
// ^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '>=' should have exactly one parameter.
operator +() => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '+' should have exactly one parameter.
operator /() => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '/' should have exactly one parameter.
operator ~/() => true;
// ^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '~/' should have exactly one parameter.
operator *() => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '*' should have exactly one parameter.
operator %() => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '%' should have exactly one parameter.
operator |() => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '|' should have exactly one parameter.
operator ^() => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '^' should have exactly one parameter.
operator &() => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '&' should have exactly one parameter.
operator <<() => true;
// ^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '<<' should have exactly one parameter.
operator >>() => true;
// ^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '>>' should have exactly one parameter.
operator []=(a, b, c) => true;
// ^^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '[]=' should have exactly two parameters.
operator []() => true;
// ^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '[]' should have exactly one parameter.
operator ~(a) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '~' shouldn't have any parameters.
}
class Operators2 {
operator ==(a, b) => true;
// ^^
// [analyzer] COMPILE_TIME_ERROR.INVALID_OVERRIDE
// [cfe] Operator '==' should have exactly one parameter.
// ^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] The method 'Operators2.==' has more required arguments than those of overridden method 'Object.=='.
operator <(a, b) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '<' should have exactly one parameter.
operator >(a, b) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '>' should have exactly one parameter.
operator <=(a, b) => true;
// ^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '<=' should have exactly one parameter.
operator >=(a, b) => true;
// ^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '>=' should have exactly one parameter.
operator -(a, b) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '-' should have zero or one parameter.
operator +(a, b) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '+' should have exactly one parameter.
operator /(a, b) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '/' should have exactly one parameter.
operator ~/(a, b) => true;
// ^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '~/' should have exactly one parameter.
operator *(a, b) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '*' should have exactly one parameter.
operator %(a, b) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '%' should have exactly one parameter.
operator |(a, b) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '|' should have exactly one parameter.
operator ^(a, b) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '^' should have exactly one parameter.
operator &(a, b) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '&' should have exactly one parameter.
operator <<(a, b) => true;
// ^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '<<' should have exactly one parameter.
operator >>(a, b) => true;
// ^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '>>' should have exactly one parameter.
operator []=(a, b, c) => true;
// ^^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '[]=' should have exactly two parameters.
operator [](a, b) => true;
// ^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '[]' should have exactly one parameter.
operator ~(a, b) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '~' shouldn't have any parameters.
}
class Operators3 {
operator ==([a]) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.OPTIONAL_PARAMETER_IN_OPERATOR
// [cfe] An operator can't have optional parameters.
operator <([a]) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.OPTIONAL_PARAMETER_IN_OPERATOR
// [cfe] An operator can't have optional parameters.
operator >([a]) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.OPTIONAL_PARAMETER_IN_OPERATOR
// [cfe] An operator can't have optional parameters.
operator <=([a]) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.OPTIONAL_PARAMETER_IN_OPERATOR
// [cfe] An operator can't have optional parameters.
operator >=([a]) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.OPTIONAL_PARAMETER_IN_OPERATOR
// [cfe] An operator can't have optional parameters.
operator -([a]) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.OPTIONAL_PARAMETER_IN_OPERATOR
// [cfe] An operator can't have optional parameters.
operator +([a]) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.OPTIONAL_PARAMETER_IN_OPERATOR
// [cfe] An operator can't have optional parameters.
operator /([a]) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.OPTIONAL_PARAMETER_IN_OPERATOR
// [cfe] An operator can't have optional parameters.
operator ~/([a]) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.OPTIONAL_PARAMETER_IN_OPERATOR
// [cfe] An operator can't have optional parameters.
operator *([a]) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.OPTIONAL_PARAMETER_IN_OPERATOR
// [cfe] An operator can't have optional parameters.
operator %([a]) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.OPTIONAL_PARAMETER_IN_OPERATOR
// [cfe] An operator can't have optional parameters.
operator |([a]) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.OPTIONAL_PARAMETER_IN_OPERATOR
// [cfe] An operator can't have optional parameters.
operator ^([a]) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.OPTIONAL_PARAMETER_IN_OPERATOR
// [cfe] An operator can't have optional parameters.
operator &([a]) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.OPTIONAL_PARAMETER_IN_OPERATOR
// [cfe] An operator can't have optional parameters.
operator <<([a]) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.OPTIONAL_PARAMETER_IN_OPERATOR
// [cfe] An operator can't have optional parameters.
operator >>([a]) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.OPTIONAL_PARAMETER_IN_OPERATOR
// [cfe] An operator can't have optional parameters.
operator []=([a, b]) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.OPTIONAL_PARAMETER_IN_OPERATOR
// [cfe] An operator can't have optional parameters.
// ^
// [analyzer] COMPILE_TIME_ERROR.OPTIONAL_PARAMETER_IN_OPERATOR
// [cfe] An operator can't have optional parameters.
operator []([a]) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.OPTIONAL_PARAMETER_IN_OPERATOR
// [cfe] An operator can't have optional parameters.
operator ~([a]) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '~' shouldn't have any parameters.
}
class Operators4 {
operator ==({a}) => true;
// ^^
// [analyzer] COMPILE_TIME_ERROR.INVALID_OVERRIDE
// [cfe] The method 'Operators4.==' has fewer positional arguments than those of overridden method 'Object.=='.
// ^
// [analyzer] COMPILE_TIME_ERROR.OPTIONAL_PARAMETER_IN_OPERATOR
// [cfe] An operator can't have optional parameters.
operator <({a}) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.OPTIONAL_PARAMETER_IN_OPERATOR
// [cfe] An operator can't have optional parameters.
operator >({a}) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.OPTIONAL_PARAMETER_IN_OPERATOR
// [cfe] An operator can't have optional parameters.
operator <=({a}) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.OPTIONAL_PARAMETER_IN_OPERATOR
// [cfe] An operator can't have optional parameters.
operator >=({a}) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.OPTIONAL_PARAMETER_IN_OPERATOR
// [cfe] An operator can't have optional parameters.
operator -({a}) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.OPTIONAL_PARAMETER_IN_OPERATOR
// [cfe] An operator can't have optional parameters.
operator +({a}) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.OPTIONAL_PARAMETER_IN_OPERATOR
// [cfe] An operator can't have optional parameters.
operator /({a}) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.OPTIONAL_PARAMETER_IN_OPERATOR
// [cfe] An operator can't have optional parameters.
operator ~/({a}) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.OPTIONAL_PARAMETER_IN_OPERATOR
// [cfe] An operator can't have optional parameters.
operator *({a}) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.OPTIONAL_PARAMETER_IN_OPERATOR
// [cfe] An operator can't have optional parameters.
operator %({a}) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.OPTIONAL_PARAMETER_IN_OPERATOR
// [cfe] An operator can't have optional parameters.
operator |({a}) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.OPTIONAL_PARAMETER_IN_OPERATOR
// [cfe] An operator can't have optional parameters.
operator ^({a}) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.OPTIONAL_PARAMETER_IN_OPERATOR
// [cfe] An operator can't have optional parameters.
operator &({a}) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.OPTIONAL_PARAMETER_IN_OPERATOR
// [cfe] An operator can't have optional parameters.
operator <<({a}) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.OPTIONAL_PARAMETER_IN_OPERATOR
// [cfe] An operator can't have optional parameters.
operator >>({a}) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.OPTIONAL_PARAMETER_IN_OPERATOR
// [cfe] An operator can't have optional parameters.
operator []=({a, b}) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.OPTIONAL_PARAMETER_IN_OPERATOR
// [cfe] An operator can't have optional parameters.
// ^
// [analyzer] COMPILE_TIME_ERROR.OPTIONAL_PARAMETER_IN_OPERATOR
// [cfe] An operator can't have optional parameters.
operator []({a}) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.OPTIONAL_PARAMETER_IN_OPERATOR
// [cfe] An operator can't have optional parameters.
operator ~({a}) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '~' shouldn't have any parameters.
}
class Operators5 {
operator ==(a, [b]) => true;
// ^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '==' should have exactly one parameter.
operator <(a, [b]) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '<' should have exactly one parameter.
operator >(a, [b]) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '>' should have exactly one parameter.
operator <=(a, [b]) => true;
// ^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '<=' should have exactly one parameter.
operator >=(a, [b]) => true;
// ^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '>=' should have exactly one parameter.
operator -(a, [b]) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '-' should have zero or one parameter.
operator +(a, [b]) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '+' should have exactly one parameter.
operator /(a, [b]) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '/' should have exactly one parameter.
operator ~/(a, [b]) => true;
// ^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '~/' should have exactly one parameter.
operator *(a, [b]) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '*' should have exactly one parameter.
operator %(a, [b]) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '%' should have exactly one parameter.
operator |(a, [b]) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '|' should have exactly one parameter.
operator ^(a, [b]) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '^' should have exactly one parameter.
operator &(a, [b]) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '&' should have exactly one parameter.
operator <<(a, [b]) => true;
// ^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '<<' should have exactly one parameter.
operator >>(a, [b]) => true;
// ^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '>>' should have exactly one parameter.
operator []=(a, b, [c]) => true;
// ^^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '[]=' should have exactly two parameters.
operator [](a, [b]) => true;
// ^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '[]' should have exactly one parameter.
operator ~(a, [b]) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '~' shouldn't have any parameters.
}
class Operators6 {
operator ==(a, {b}) => true;
// ^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '==' should have exactly one parameter.
operator <(a, {b}) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '<' should have exactly one parameter.
operator >(a, {b}) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '>' should have exactly one parameter.
operator <=(a, {b}) => true;
// ^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '<=' should have exactly one parameter.
operator >=(a, {b}) => true;
// ^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '>=' should have exactly one parameter.
operator -(a, {b}) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '-' should have zero or one parameter.
operator +(a, {b}) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '+' should have exactly one parameter.
operator /(a, {b}) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '/' should have exactly one parameter.
operator ~/(a, {b}) => true;
// ^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '~/' should have exactly one parameter.
operator *(a, {b}) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '*' should have exactly one parameter.
operator %(a, {b}) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '%' should have exactly one parameter.
operator |(a, {b}) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '|' should have exactly one parameter.
operator ^(a, {b}) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '^' should have exactly one parameter.
operator &(a, {b}) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '&' should have exactly one parameter.
operator <<(a, {b}) => true;
// ^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '<<' should have exactly one parameter.
operator >>(a, {b}) => true;
// ^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '>>' should have exactly one parameter.
operator []=(a, b, {c}) => true;
// ^^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '[]=' should have exactly two parameters.
operator [](a, {b}) => true;
// ^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '[]' should have exactly one parameter.
operator ~(a, {b}) => true;
// ^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR
// [cfe] Operator '~' shouldn't have any parameters.
}
class Operators7 {
operator ==<T>(a) => true;
// ^^
// [analyzer] COMPILE_TIME_ERROR.INVALID_OVERRIDE
// [cfe] Can't infer types for '==' as the overridden members don't have a combined signature.
// ^
// [cfe] Declared type variables of 'Operators7.==' doesn't match those on overridden method 'Object.=='.
// ^^^
// [analyzer] SYNTACTIC_ERROR.TYPE_PARAMETERS_ON_OPERATOR
// ^
// [cfe] Types parameters aren't allowed when defining an operator.
operator ><T>(a) => true;
// ^^^
// [analyzer] SYNTACTIC_ERROR.TYPE_PARAMETERS_ON_OPERATOR
// ^
// [cfe] Types parameters aren't allowed when defining an operator.
operator <=<T>(a) => true;
// ^^^
// [analyzer] SYNTACTIC_ERROR.TYPE_PARAMETERS_ON_OPERATOR
// ^
// [cfe] Types parameters aren't allowed when defining an operator.
operator >=<T>(a) => true;
// ^^^
// [analyzer] SYNTACTIC_ERROR.TYPE_PARAMETERS_ON_OPERATOR
// ^
// [cfe] Types parameters aren't allowed when defining an operator.
operator -<T>() => true;
// ^^^
// [analyzer] SYNTACTIC_ERROR.TYPE_PARAMETERS_ON_OPERATOR
// ^
// [cfe] Types parameters aren't allowed when defining an operator.
operator -<T>(a) => true;
// ^^^
// [analyzer] SYNTACTIC_ERROR.TYPE_PARAMETERS_ON_OPERATOR
// ^
// [cfe] Types parameters aren't allowed when defining an operator.
operator +<T>(a) => true;
// ^^^
// [analyzer] SYNTACTIC_ERROR.TYPE_PARAMETERS_ON_OPERATOR
// ^
// [cfe] Types parameters aren't allowed when defining an operator.
operator /<T>(a) => true;
// ^^^
// [analyzer] SYNTACTIC_ERROR.TYPE_PARAMETERS_ON_OPERATOR
// ^
// [cfe] Types parameters aren't allowed when defining an operator.
operator ~/<T>(a) => true;
// ^^^
// [analyzer] SYNTACTIC_ERROR.TYPE_PARAMETERS_ON_OPERATOR
// ^
// [cfe] Types parameters aren't allowed when defining an operator.
operator *<T>(a) => true;
// ^^^
// [analyzer] SYNTACTIC_ERROR.TYPE_PARAMETERS_ON_OPERATOR
// ^
// [cfe] Types parameters aren't allowed when defining an operator.
operator %<T>(a) => true;
// ^^^
// [analyzer] SYNTACTIC_ERROR.TYPE_PARAMETERS_ON_OPERATOR
// ^
// [cfe] Types parameters aren't allowed when defining an operator.
operator |<T>(a) => true;
// ^^^
// [analyzer] SYNTACTIC_ERROR.TYPE_PARAMETERS_ON_OPERATOR
// ^
// [cfe] Types parameters aren't allowed when defining an operator.
operator ^<T>(a) => true;
// ^^^
// [analyzer] SYNTACTIC_ERROR.TYPE_PARAMETERS_ON_OPERATOR
// ^
// [cfe] Types parameters aren't allowed when defining an operator.
operator &<T>(a) => true;
// ^^^
// [analyzer] SYNTACTIC_ERROR.TYPE_PARAMETERS_ON_OPERATOR
// ^
// [cfe] Types parameters aren't allowed when defining an operator.
operator <<<T>(a) => true;
// ^^^
// [analyzer] SYNTACTIC_ERROR.TYPE_PARAMETERS_ON_OPERATOR
// ^
// [cfe] Types parameters aren't allowed when defining an operator.
operator >><T>(a) => true;
// ^^^
// [analyzer] SYNTACTIC_ERROR.TYPE_PARAMETERS_ON_OPERATOR
// ^
// [cfe] Types parameters aren't allowed when defining an operator.
operator []=<T>(a, b) => true;
// ^^^
// [analyzer] SYNTACTIC_ERROR.TYPE_PARAMETERS_ON_OPERATOR
// ^
// [cfe] Types parameters aren't allowed when defining an operator.
operator []<T>(a) => true;
// ^^^
// [analyzer] SYNTACTIC_ERROR.TYPE_PARAMETERS_ON_OPERATOR
// ^
// [cfe] Types parameters aren't allowed when defining an operator.
operator ~<T, S>() => true;
// ^^^^^^
// [analyzer] SYNTACTIC_ERROR.TYPE_PARAMETERS_ON_OPERATOR
// ^
// [cfe] Types parameters aren't allowed when defining an operator.
}
class Operators8 {
/*space*/ int operator []=(a, b) {}
// ^^^
// [analyzer] COMPILE_TIME_ERROR.NON_VOID_RETURN_FOR_OPERATOR
// [cfe] The return type of the operator []= must be 'void'.
}
main() {}