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 a text method for what it says, never as an operator's name
#!ek9 defines module error.e07660.good.fix defines text for "en" ButtonLabels closeLabel() "Close" containsLabel() -> item as String `Contains ${item}` lengthLabel() "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:
Found a problem?
If EK9 reported E07660 for a program you think is valid, or did not report it where it should have, use the compiler form with the smallest program that shows it. If this page is wrong or unclear, use the documentation form. Both are at github.com/ek9lang/ek9-issues.