/** * `a + b`, `a and b`, `a ?? b`, `a == b`, `a < b` — one binary operator's * result type and the checks its operands earn — plus the comparison chain * `a < b < c` and the Core duration literals arithmetic reads. * * D115 §三: this was `inferBinary`, the chain rule, and the three duration * helpers. The equality, ordering and enum-domain rules the operators consult * live in `./equality.ts`; what is here is which rule an operator asks for. */ import { type Expression } from "../../ast.ts"; import { type DiagnosticFix } from "../../diagnostic.ts"; import { type Span } from "../../source.ts"; import { type ValueType } from "../../types.ts"; import { LoweringRecorder } from "../lowering-recorder.ts"; import { type MutableCellTarget } from "../scopes.ts"; /** What the binary operators asks of the analyzer that hosts it, and nothing more. */ export interface BinaryExpressionsHost { adviseNegativeLiteralModulo(leftExpression: Expression, rightExpression: Expression, operationSpan: Span): void; applyNarrowings(narrowed: ReadonlyMap, narrowingSpan: Span): void; assignedFactDomain(expression: Expression, inferred: ValueType): ValueType; coalescingFallbackContext(left: ValueType, contextualType: ValueType): ValueType; coalescingSubjectContext(operator: string, contextualType: ValueType): ValueType; combineNarrowings(first: ReadonlyMap, second: ReadonlyMap): ReadonlyMap; enterScope(): void; equalityOperandMayBeNaN(expression: Expression, type: ValueType): boolean; exitScope(): void; expandAliases(type: ValueType, seen?: ReadonlySet): ValueType; readonly extensionCalls: Map; inferConditionWithNarrowings(expression: Expression, narrowed: ReadonlyMap): { readonly type: ValueType; readonly truthy: ReadonlyMap; readonly falsy: ReadonlyMap; readonly surviving: ReadonlyMap; }; inferExpression(expression: Expression, contextualType?: ValueType): ValueType; inferNarrowedExpression(expression: Expression, narrowed: ReadonlyMap, contextualType: ValueType): ValueType; isAssignableHere(actual: ValueType, expected: ValueType): boolean; iterationGuidance(type: ValueType): string; iterationSource(expression: Expression, type: ValueType): ValueType; readonly logicalConditionNarrowings: Map; readonly falsy: ReadonlyMap; }>; readonly lowering: LoweringRecorder; narrowingFor(expression: Expression, knownType?: ValueType): ReadonlyMap; negativeNarrowingFor(expression: Expression, knownType?: ValueType): ReadonlyMap; readonlyDataViewOf(type: ValueType): ValueType; rejectFreshCollectionEquality(left: Expression, right: Expression, operator: string): boolean; rejectFreshCollectionProbe(probe: Expression, operation: string, probes: "element" | "key"): boolean; requireAssignable(actual: ValueType, expected: ValueType, valueSpan: Span, mutableCell?: MutableCellTarget | null): void; requireCondition(type: ValueType, condition: Expression): void; requireIntersectingEquality(leftType: ValueType, rightType: ValueType, operator: string, leftExpression: Expression, rightExpression: Expression, operationSpan: Span): void; requireMembershipIntersection(probe: ValueType, domain: ValueType, span: Span, operation: string): boolean; requireOrderedComparison(leftType: ValueType, rightType: ValueType, leftExpression: Expression, rightExpression: Expression, operationSpan: Span): void; survivingNarrowings(narrowed: ReadonlyMap): ReadonlyMap; typeError(message: string, errorSpan: Span, fix?: DiagnosticFix): void; } export declare class BinaryExpressions { private readonly host; constructor(host: BinaryExpressionsHost); /** * CO-I8 / CO-I14: whether the `??` right arm is a record literal the expected * type refuses — already, or here — in which case that report is the whole * mistake and the merged union is never built. * * Merging the shape it settled on added a second report about a union nobody * wrote and nobody can keep — `Cannot assign Config | { } to Config`, whose * right half stops existing the moment the first report is answered. The * context has to be a record shape for that to hold: only there is the * literal closed and judged field by field. A `Map` or `List` context reads * `{}` as the wrong *kind* of value and reports nothing of its own, so there * the assignment report is the only one there is. */ private coalescingLiteralRefused; inferBinary(leftExpression: Expression, operator: string, rightExpression: Expression, operationSpan: Span, contextualType: ValueType): ValueType; inferComparisonChain(expression: Extract, contextualType: ValueType): ValueType; private isCoreDurationLiteral; private containsCoreDuration; inferCoreDurationExpression(expression: Expression): ValueType | null; } //# sourceMappingURL=binary.d.ts.map