E07660: operator name cannot be used as a method
What went wrong
You're using an operator symbol as a method name, which is invalid. Operators must use the 'operator' keyword.
Worked examples
Compilable examples demonstrating this error and the correct fix:
- ek9 -q 137 (How do I manage resources with try-with-resources in EK9?)
See also
How to fix it
- Use 'operator' keyword for operators
Common causes
- Missing 'operator' keyword
- Trying to use symbol as method name
Examples
Every example is compiled by the EK9 compiler: the first fails exactly as captioned, the others fix it.
Fails with E07660: operator name cannot be used as a method
#!ek9 defines module error.e07660.bad defines text for "en" ButtonLabels close() "Close" contains() -> item as String `Contains ${item}` length() "Length" openLabel() "Open"
Fixed: Name the method for what it gives
#!ek9 defines module error.e07660.good defines text for "en" ButtonLabels closeLabel() "Close" containsLabel() -> item as String `Contains ${item}` lengthLabel() "Length"
Questions and answers
These Q&A entries show E07660 and its fix: