E07100: defined as default/abstract but an implementation has been provided
What went wrong
You've marked a method 'abstract' but also provided an implementation body. Abstract methods declare signatures without implementation.
Worked examples
Compilable examples demonstrating this error and the correct fix:
- ek9 -q 768 (Why can't an abstract method have a body in EK9?)
How to fix it
- Remove body to make truly abstract
- Or remove 'abstract' to keep implementation
- Choose one: abstract signature OR concrete implementation
Common causes
- Forgot to remove 'abstract' after adding implementation
- Confusion about what abstract means
- Incomplete refactoring
See also
Examples
Every example is compiled by the EK9 compiler: the first fails exactly as captioned, the others fix it.
Fails with E07100: defined as default/abstract but an implementation has been provided
#!ek9 defines module error.e07100.bad defines class Shape as abstract //'abstract' says there is no body, yet a value is given area() as abstract <- rtn as Float: 0.0
Fixed: An abstract method has no body: leave the returning variable without a value
#!ek9 defines module error.e07100.good.fix defines class Shape as abstract //'abstract' says there is no body, yet a value is given area() as abstract <- rtn as Float?
Fixed: Remove either 'abstract' or the body
#!ek9 defines module error.e07100.good defines class Shape as abstract //Option 1: keep it abstract, with no body area() as abstract <- rtn as Float? //Option 2: drop 'abstract', and keep the body name() <- rtn as String: "shape"
Questions and answers
These Q&A entries show E07100 and its fix:
Found a problem?
If EK9 reported E07100 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.