Class FieldlessIsSet

java.lang.Object
org.ek9lang.compiler.support.FieldlessIsSet
All Implemented Interfaces:
Predicate<IAggregateSymbol>

public final class FieldlessIsSet extends Object implements Predicate<IAggregateSymbol>
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. Hold one and ask it whether a type qualifies.
  • "Fields" is THE shared predicate, HasFieldsIncludingInherited.
  • A '?' the type already has - its own (hand-written, default operator ? or the bare default 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 write default 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: the test of one operator is IsSynthesisedIsSet; the questions about a type that has one are HasAuthoredIsSet and AlwaysSetWhenPresent.

  • Constructor Details

    • FieldlessIsSet

      public FieldlessIsSet()
  • Method Details

    • test

      public boolean test(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 than Any's).
      Specified by:
      test in interface Predicate<IAggregateSymbol>