E07200: 'default' of operators requires property/field to have appropriate operator
What went wrong
You're using 'default operator' but one of your PROPERTY TYPES doesn't have the required operator. Default operators call operators on each property.
An EXPLICIT 'default operator <=>' (or '<', '<=', '>', '>=') needs every property's '<=>' to order every two SET values. Money orders only within one currency and Dimension only within one unit suffix (it is unset between them), so a generated '<=>' over either would not: write '<=>' by hand over the currency ('#>') and then the amount ('#<') (E07188 explains the rule). The BARE 'default operator' is not an error: it gives the type '==' and withdraws the ordering, so a use of it is E07620.
Worked examples
Compilable examples demonstrating this error and the correct fix:
- ek9 -q 1315 (Why does 'default operator' fail when a property's typ...)
[BUILT-IN TYPES WITH OPERATORS] Integer, Float, String, Boolean, Date, Time, DateTime, Duration, Money
Types that may lack operators
- Custom classes/records without 'default operator'
- Abstract types
- Types from external modules
How to fix it
- Add default operators to property's type
- Or implement operators manually
The [EXAMPLE] section below shows a generated '$' over a property whose type has none, and the fix: give the property's type the operator too.
See also
Examples
Every example is compiled by the EK9 compiler: the first fails exactly as captioned, the others fix it.
Fails with E07200: 'default' of operators requires property/field to have appropriate operator
#!ek9 defines module error.e07200.bad defines class Sensor reading <- Time() default operator ? Station sensor <- Sensor() //Sensor has no '$', so a generated '$' cannot convert the sensor field default operator ? default operator $
Fixed: Give the property type the operator
#!ek9 defines module error.e07200.good defines class Sensor reading <- Time() default operator ? default operator $ Station sensor <- Sensor() //Sensor now has '$', so this can be generated default operator ? default operator $
Questions and answers
These Q&A entries show E07200 and its fix: