Class NaturalOrderQueue
PriorityQueue ordered by its elements' natural order needs an orderable element type
(D63, Steve 2026-10-21, option B). PriorityQueue of T sorts by T's <=> unless it is given a
comparator, and PriorityQueue of Foo is ONE type whether or not it will carry one, so the requirement cannot
sit on the parameterisation. It sits on the CONSTRUCTION instead: a construction of PriorityQueue of X
(PriorityQueue() of X, PriorityQueue(item), a target-typed PriorityQueue(),
collect as PriorityQueue of X) that is not directly the receiver of .withComparator(...) needs
X to be orderable (Sameness.isOrderable(IAggregateSymbol, ISymbol)) - else E07620, the verdict a comparator-less stream
sort over X gets (phase 3 ComparatorPresentOrError, then Sameness.withdrawnOrdering(IAggregateSymbol, ISymbol)):
the two can differ only below an ordered super, where E07186 already refuses the sub-type.
No flow analysis: a queue built first and given its comparator in a later statement is the same error.
Inside a generic body X may be the conceptual T: the queue then uses T's <=> exactly
as a comparator-less sort over T does, and takes the sort's own steps - phase 3 notes T's
<=> as used (phase3/ComparatorPresentOrError, so phase4/ParameterisedTypeOrError judges the
type argument where T is substituted) and phase 5 asks Sameness.withdrawnOrdering(IAggregateSymbol, ISymbol) for a constrained
T. Any other X that is a concrete type or a function type is judged here by problemWith(ISymbol, ISymbol) in
phase 5 (phase5/RetractedComparatorUseOrError), where the bare default operator's retraction is
known. A type BUILT ON T (OrderedBox of T, DictEntry of (K, Integer)) is judged as declared
there too, and is also recorded in phase 3 (ConceptualAccess.noteNaturalOrderQueue) so that phase 4
(ParameterisedTypeOrError) asks problemWith(ISymbol, ISymbol) of the type with its parameters replaced (D63 residual).
This class holds the detection and the wording so the places cannot disagree; the queue is recognised
through the symbol (Ek9Types.ek9PriorityQueue()), never by name.
-
Method Summary
Modifier and TypeMethodDescriptionelementTypeNeedingOrder(EK9Parser.CallContext ctx, CallSymbol callSymbol, Ek9Types ek9Types) The element type of the queue this written call constructs, when the construction needs a natural order: the call resolved to a constructor of a parameterisation ofPriorityQueue, and it is not directly the receiver of.withComparator(...).elementTypeOfQueue(ISymbol queueType, Ek9Types ek9Types) The element type whenqueueTypeis a parameterisation ofPriorityQueue.static booleanTrue when the call is, as written, the receiver of.withComparator(...):(Q() of X).withComparator(c)orQ() of X .withComparator(c)- the queue is born with its comparator, in the one expression.problemWith(ISymbol elementType, ISymbol ek9Any) E07620's wording for an element type that cannot be ordered, or empty when it can.
-
Method Details
-
elementTypeNeedingOrder
public static Optional<ISymbol> elementTypeNeedingOrder(EK9Parser.CallContext ctx, CallSymbol callSymbol, Ek9Types ek9Types) The element type of the queue this written call constructs, when the construction needs a natural order: the call resolved to a constructor of a parameterisation ofPriorityQueue, and it is not directly the receiver of.withComparator(...). -
elementTypeOfQueue
-
isReceiverOfWithComparator
True when the call is, as written, the receiver of.withComparator(...):(Q() of X).withComparator(c)orQ() of X .withComparator(c)- the queue is born with its comparator, in the one expression. -
problemWith
-