Class FieldlessIsSet
java.lang.Object
org.ek9lang.compiler.support.FieldlessIsSet
THE rule of Q-COMPONENT-? (Steve, 2026-10-07): a type with NO fields, counting inherited ones, is set whenever it
is present. Such a class, component, service or dynamic class gets a SYNTHESISED
operator ? - generated as
any defaulted '?' is (IsSetGenerator: no fields, so it returns true) - and needs no
default operator ?. Before, it inherited Any's '?', which is always false, so an injected
component answered false to '?' while being present.
- "Fields" is THE shared predicate,
GeneratedOperatorFields.anyIncludingInherited(IAggregateSymbol). - A '?' the type already has - its own (hand-written,
default operator ?or the baredefault operator), or one it inherits from a super or a trait - always wins: nothing is synthesised. So a field-less sub-type of a fielded super keeps the super's '?', and a field-less sub-type of a type with a hand-written '?' keeps that answer. The one exception is an inherited '?' that is itself this synthesised one: every field-less type in a field-less chain gets its own (the answer is the same, true), so a sub-type below it that adds fields may writedefault operator ?- phase 3 (E07190) requires the DIRECT super to declare the '?' a generated one calls. - A type that adds fields still defines its own '?' (E07235, unchanged).
- Traits are never given one (the object answers), a concrete record always has a field (E07237, phase3
RecordCarriesDataOrError) and an abstract one is never constructed, and enumerations, constrained types, texts, built-in and Java-backed types define their own.
Decided at the end of EXPLICIT_TYPE_SYMBOL_DEFINITION (phase2 FieldlessIsSetCompleter: supers are linked
only then, supers first), so FULL_RESOLUTION's checks and every call resolve against it. A dynamic class is
decided where FULL_RESOLUTION declares it (phase3 ResolveDefineInferredTypeListener), because its captures
- fields - are defined only there; that is still before its E07236 check and before any use of it. The operator
carries DEFAULTED (it is generated) and FIELDLESS_IS_SET.
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanalwaysSetWhenPresent(IAggregateSymbol aggregate) Is a value of EXACTLY this type always set - its '?' the one synthesised by this rule, answering true? Read by phase 5's value tracker (F3, Steve 2026-10-07):s <- FieldlessType()thenif s?is provably true (E08088), asInteger()is provably unset.static booleanhasAuthoredIsSet(IAggregateSymbol aggregate) THE "does the author's source give this type its OWN '?'" - hand-written,default operator ?or the baredefault operator- for tools that edit source (adding a type's first field must also add a '?', E07235).static booleanisSynthesised(MethodSymbol method) Is this '?' the one synthesised by this rule (FIELDLESS_IS_SET)?static booleanqualifies(IAggregateSymbol aggregate) Is this a type that gets the synthesised '?': a class (dynamic classes included), component or service with no fields, counting inherited ones, and no '?' of its own or from any super or trait (other thanAny's).
-
Method Details
-
qualifies
Is this a type that gets the synthesised '?': a class (dynamic classes included), component or service with no fields, counting inherited ones, and no '?' of its own or from any super or trait (other thanAny's). -
hasAuthoredIsSet
THE "does the author's source give this type its OWN '?'" - hand-written,default operator ?or the baredefault operator- for tools that edit source (adding a type's first field must also add a '?', E07235). The synthesised '?' does not count: nobody wrote it, and it is gone once the type has a field. -
alwaysSetWhenPresent
Is a value of EXACTLY this type always set - its '?' the one synthesised by this rule, answering true? Read by phase 5's value tracker (F3, Steve 2026-10-07):s <- FieldlessType()thenif s?is provably true (E08088), asInteger()is provably unset. Only the type's OWN '?' counts: a type that inherits a '?' from a super or trait was never given one, and that '?' is the author's to define. -
isSynthesised
Is this '?' the one synthesised by this rule (FIELDLESS_IS_SET)?
-