Interface TypeInferenceRuleWithInferringChildren<Specifics, InputType>

Inference rule which requires for the type inference of the given parent to take the types of its children into account. Therefore, the types of the children need to be inferred first.

interface TypeInferenceRuleWithInferringChildren<
    Specifics extends TypirSpecifics,
    InputType extends Specifics["LanguageType"] = Specifics["LanguageType"],
> {
    inferTypeWithChildrensTypes(
        languageNode: InputType,
        childrenTypes: (undefined | Type)[],
        typir: TypirServices<Specifics>,
    ): Type | InferenceProblem<Specifics>;
    inferTypeWithoutChildren(
        languageNode: InputType,
        typir: TypirServices<Specifics>,
    ): TypeInferenceResultWithInferringChildren<Specifics>;
}

Type Parameters

Implemented by

Methods

  • 2nd step is to finally decide about the inferred type. When the 1st step returned a list of language nodes to resolve their types, this function is called in order to complete this inference rule, otherwise, this step is not called. Advantage of this step is to split it to allow a postponed inferrence of the additional language nodes by Typir. Disadvantage of this step is, that already checked TS types of languageNode cannot be reused.

    Parameters

    • languageNode: InputType

      the language node whose type shall be inferred

    • childrenTypes: (undefined | Type)[]

      the types which are inferred from the language nodes of the 1st step (in the same order!)

    • typir: TypirServices<Specifics>

      the current Typir instance

    Returns Type | InferenceProblem<Specifics>

    the finally inferred type or a problem, why this inference rule is finally not applicable