| // Copyright (c) 2011, 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. |
| |
| /// @assertion |
| /// ⟨operatorSignature⟩ ::= |
| /// ⟨type⟩? operator ⟨operator⟩ ⟨formalParameterList⟩ |
| /// ⟨operator⟩ ::= ‘~’ |
| /// | ⟨binaryOperator⟩ |
| /// | ‘[]’ |
| /// | ‘[]=’ |
| /// ⟨binaryOperator⟩ ::= ⟨multiplicativeOperator⟩ |
| /// | ⟨additiveOperator⟩ |
| /// | ⟨shiftOperator⟩ |
| /// | ⟨relationalOperator⟩ |
| /// | ‘==’ |
| /// | ⟨bitwiseOperator⟩ |
| /// |
| /// @description Checks that it is not a compile-time error if a class attempts |
| /// to define an operator without a name because an instance method named |
| /// 'operator' is allowed by the spec. |
| /// @author iefremov |
| |
| import "../../../../Utils/expect.dart"; |
| |
| class C { |
| int operator(int v) => 42; |
| } |
| |
| main() { |
| C c = new C(); |
| Expect.equals(42, c.operator(3)); |
| } |