Class ConstrainedBase

java.lang.Object
org.ek9lang.compiler.support.ConstrainedBase

public final class ConstrainedBase extends Object
THE recovery of the base type a CONSTRAINED type narrows — call this, do not re-derive it.

🔑 The base is not reachable up the hierarchy. A constrained type's super is deliberately Any (PopulateConstrainedTypeOrError.setSuperAggregate) — constraining is a one-level concept. What IS true is that the base's methods and constructors are CLONED onto the constrained type, so it carries a single-argument validating constructor whose parameter is the base. The only other single-argument constructor is the copy constructor, whose parameter is the constrained type ITSELF, so recovering the base means taking the single-argument constructor that is not that one.

🔑 The distinction is drawn on SYMBOL IDENTITY, never on a name. Two types can share a simple name across modules, and getName() and getFriendlyName() are different functions that only happen to agree for a plain aggregate — comparing them is a join on a display name, which fails GREEN: the base constructor is skipped, no exception is raised, and the caller simply reports no base at all. isExactSameType asks the question that is actually meant.

Extracted 2026-09-04 from three copies that had drifted: two in agreement (EquivalenceClassModel, SymbolHarvester) and one comparing names (ConstructQueryEngine). Two siblings disagreeing is the point at which the shared function has to exist rather than a fourth variant being written.

  • Method Details

    • of

      public static ISymbol of(IAggregateSymbol aggregate)
      The base type aggregate constrains, or null when it has no such constructor (so it is not a constrained type, or the compiler did not synthesise one).
      Parameters:
      aggregate - the candidate constrained type
      Returns:
      the base type's symbol, or null