/** * D114 item ①: solving a call's remaining type parameters from the position the * call is written in. * * D115 §三 names `calls/seeding.ts`, and this is it: the seed is asked once, * after the arguments have had their say, and it reads only the expected type * and the class table. Nothing here touches the analyzer, so it is written as * two functions rather than as methods of the call inference. */ import { type ValueType } from "../../types.ts"; import type { ClassInfo } from "../../contracts.ts"; /** * D114 item ①, the ruling D77 rule 194 left open: a type parameter the * arguments leave open is solved from the position the call is written in. * The position is the one `contextualType` already carries — the same * channel section 8 reads to settle an empty `[]`, `Set()`, or `Map()` — so * "what is a contextual type" has one definition and cannot drift into * `const names: List = []` passing while `= empty()` does not. * * Two disciplines make this seeding and never a guess: * * - It never overrides. Candidates are unified into a separate table and * copied back only where the arguments solved nothing, so a disagreement * between an argument and the annotation stays the ordinary mismatch the * position already reported (D114 item ①), not a new diagnostic. A * parameter only an `unknown` argument reached counts as reached: its * bound violation is the argument's, and seeding over it would move that * report to the position and change its words. * - It matches structurally, through `unifyTypeParameters` — the same walk * an argument takes, so the shapes a type argument can be read out of are * one list rather than two: a container's element, a Map's key and value, * a Record's or a Promise's value, an optional's inner type, a callable's * parameters and result, one generic record application's arguments * against the same declaration, and so on down. A shape that walk does not * pair leaves the parameter open, and phase 4 substitutes `unknown` as * before. * * The `readonly` qualifier belongs to the position rather than to the type * argument: `readonly List` seeds `T = string`, and a bare `T` in * result position takes the mutable spelling of the expected type, which is * the only one a type argument can be written with. An optional annotation * is read through for the same reason section 8 reads it through * (`contextualCollectionType` recurses on `optional`, so `const tags: * Set? = Set()` keeps its element contract): a result that is itself * optional pairs with it directly, and any other result shape matches the * type the annotation holds. */ export declare function seedTypeParametersFromPosition(result: ValueType, bindings: (ValueType | null)[], unknownParameters: ReadonlySet, contextualType: ValueType, fieldsOf: (identity: string) => ReadonlyMap | null, expandAliases: (type: ValueType) => ValueType, classes: ReadonlyMap): ReadonlySet; //# sourceMappingURL=seeding.d.ts.map