import { type Expression } from "../../ast.ts"; import { type Diagnostic, 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 Binding, type MutableCellTarget } from "../scopes.ts"; /** What the record projections asks of the analyzer that hosts it, and nothing more. */ export interface RecordProjectionsHost { /** CO-I5: the author's own spelling of a value, for the ritual the refusal teaches. */ boundaryReceiverText(expression: Expression): string | null; readonly callExpressionCallees: Set; concreteCallableFor(actual: ValueType, expected: ValueType, errorSpan?: Span): ValueType; readonly diagnostics: Diagnostic[]; expandAliases(type: ValueType, seen?: ReadonlySet): ValueType; fieldsOf(identity: string): ReadonlyMap | null; inferExpression(expression: Expression, contextualType?: ValueType): ValueType; isAssignableHere(actual: ValueType, expected: ValueType): boolean; lookup(name: string): Binding | null; readonly lowering: LoweringRecorder; planNamedArguments(arguments_: readonly Expression[], argumentNames: readonly (string | null)[] | undefined, parameters: readonly ValueType[], parameterNames: readonly string[] | undefined, requiredParameters: number, callSpan: Span, rest?: ValueType): { readonly ordered: readonly Expression[]; readonly targets: readonly (number | null)[]; readonly valid: boolean; } | null; readonlyDataViewOf(type: ValueType): ValueType; readonlyFieldsOf(identity: string): ReadonlySet | null; recordSemanticExpression(expression: Expression, type: ValueType): void; requireAssignable(actual: ValueType, expected: ValueType, valueSpan: Span, mutableCell?: MutableCellTarget | null): void; runtimeTypeObjectValue(type: Extract): ValueType; readonly semanticExpressionOwners: Map; typeError(message: string, errorSpan: Span, fix?: DiagnosticFix): void; } export declare class RecordProjections { private readonly host; constructor(host: RecordProjectionsHost); /** * CO-I5: `'User.parse(raw)'` rather than `'Type.parse'`. Both halves come * from the site — the target names the type the author declared, and the * source expression is spelled as it was written — so the remedy compiles * where it is pasted. A target that is not a declared name has no `.parse` * to offer, so the placeholder stands. */ private validationSpelling; /** * A concrete record Type owns one compiler-only constructor: * * Response.from(source, {worldId}) * * The source is already typed; this is not validation and therefore never * accepts unknown/any. The target field table is the authority. Overrides * must be a literal so every exception to same-name projection is visible * to the analyzer, and lowering can copy only declared target fields without * exposing an open source record's surplus runtime data. */ inferRecordFromCall(member: Extract, sourceArguments: readonly Expression[], argumentNames: readonly (string | null)[] | undefined, callSpan: Span): ValueType | null; /** * A mapped projection keeps the target record's field table as the sole * authority while converting every same-name source value with one * callback: * * RuntimePalette.mapFrom(identityPalette, resolve) * * This is intentionally a concrete-record operation rather than * `Record.map`: the analyzer can prove that every required target field is * present, the emitter can preserve target declaration order, and callers * retain named-field completion on the returned value. */ inferRecordMapFromCall(member: Extract, sourceArguments: readonly Expression[], argumentNames: readonly (string | null)[] | undefined, callSpan: Span): ValueType | null; /** * The fields an explicit overrides literal replaces, and the four refusals a * literal that cannot be read as one earns. D115 §三 split this out of * `inferRecordFromCall`; the checks and their order are unchanged. */ private projectionOverrides; /** * Every target field the source has to fill, and what it is refused for. * D115 §三 split this out of `inferRecordFromCall`; the checks and their * order are unchanged. */ private checkProjectedFields; /** * The source-side types a mapped projection's transform has to accept, and * the refusals a field the source cannot supply earns. D115 §三 split this * out of `inferRecordMapFromCall`; the checks and their order are unchanged. */ private mappedSourceFieldTypes; /** * The transform itself: the contract it is judged against, and the target * field types its result has to satisfy. D115 §三 split this out of * `inferRecordMapFromCall`; the checks and their order are unchanged. */ private checkMappedTransform; recordProjectionShape(type: ValueType): { readonly fields: ReadonlyMap; readonly optionalFields: ReadonlySet; readonly readonlyFields: ReadonlySet; readonly readonlyView: boolean; } | null; } //# sourceMappingURL=projections.d.ts.map