/** * The generic solver: three-phase call-site unification for a generic `def`, * the same solver run for a generic construction, and the bound check both * report through. * * D115 §三: this was four private methods of `CallInference` plus the solver * record their phases thread. They are one subject — what a call does with type * parameters — and nothing else in this directory reads their internals, so * only `inferGenericCall` and `inferGenericConstruction` leave the file. * * The one sentence each bound is explained with is not this file's: it belongs * to the bound vocabulary in `../vocabulary.ts`, which every site that refuses * a bound reads. This file re-exports it because `../../analyzer.ts` still * imports the name from here (D115 §四: the facade keeps import paths). */ import { type Expression } from "../../ast.ts"; import { type ClassInfo } from "../../contracts.ts"; import { type Diagnostic, type DiagnosticFix } from "../../diagnostic.ts"; import { type Span } from "../../source.ts"; import { type TypeParameterBound, type ValueType } from "../../types.ts"; import { type NamedArguments } from "./named-arguments.ts"; /** One argument of a generic call, with the parameter it was planned onto. */ export interface PlannedArgument { readonly value: Expression; readonly declared: ValueType | null; readonly errorSpan: Span; readonly spreadList: boolean; } /** What the generic solver asks of the analyzer that hosts it, and nothing more. */ export interface GenericCallsHost { readonly classes: Map; readonly diagnostics: Diagnostic[]; expandAliases(type: ValueType, seen?: ReadonlySet): ValueType; fieldsOf(identity: string): ReadonlyMap | null; /** * D114 0.28.0 B-I2: whether the call sits in a statement head that has no * annotation slot — a `using` binding (VEL2036 refuses `using r: T = ...`) * or a `for … in` head. A remedy that says "annotate the position" is not * one an author at either head can carry out. */ inAnnotationFreeHead(): boolean; inferExpression(expression: Expression, contextualType?: ValueType): ValueType; iterationGuidance(type: ValueType): string; iterationSource(expression: Expression, type: ValueType): ValueType; noteGenericApplications(type: ValueType, seen?: Set): void; requireAssignable(actual: ValueType, expected: ValueType, valueSpan: Span): void; satisfiesBound(type: ValueType, bound: TypeParameterBound): boolean; typeError(message: string, errorSpan: Span, fix?: DiagnosticFix): void; } export declare class GenericCalls { private readonly host; private readonly namedArguments; constructor(host: GenericCallsHost, namedArguments: NamedArguments); /** * D114 定案: a class type parameter still unsolved at the construction is an * error at the construction — the same stance section 8 takes for an empty * collection, and reported with the same code, because it is the same * sentence: nothing at this position says what the value holds. The report * names both ways out, an annotation on the position and an argument that * fixes the parameter, because those are the only two there are. */ inferGenericConstruction(callee: Extract, info: ClassInfo, arguments_: readonly Expression[], argumentNames: readonly (string | null)[] | undefined, callSpan: Span, contextualType: ValueType, suppressUnsolvedReport?: boolean): ValueType; inferGenericCall(callee: Extract, arguments_: readonly Expression[], argumentNames: readonly (string | null)[] | undefined, callSpan: Span, contextualType?: ValueType, unsolved?: Set): ValueType; /** * The arguments of a generic call, paired with the parameter each one was * planned onto. A named plan that did not resolve answers the whole call, * because there is no position left to solve a type parameter from. */ private planGenericArguments; /** * Phases 1 and 2: every non-arrow argument is inferred and unified into the * bindings, then each arrow is inferred against the substitution the first * phase produced and unified in turn. */ private unifyPlannedArguments; /** * D41 item 61 check site 1: once the two-phase inference has solved the * bindings, every bound is verified before the ordinary assignability loop * runs, so a rejected type argument is reported once, at its cause. */ private reportGenericBoundViolations; } //# sourceMappingURL=generic-calls.d.ts.map