Interface LangiumTypeInferenceCollector<Specifics>

Collects an arbitrary number of inference rules and allows to infer a type for a given language node. In case of multiple inference rules, later rules are not evaluated anymore, if an earlier rule already returned a type. Listeners could be registered in order to get informed about added and removed inference rules.

interface LangiumTypeInferenceCollector<Specifics extends TypirLangiumSpecifics> {
    addInferenceRule<InputType extends AstNode = Specifics["LanguageType"]>(
        rule: TypeInferenceRule<Specifics, InputType>,
        options?: Partial<TypeInferenceRuleOptions>,
    ): void;
    addInferenceRulesForAstNodes(
        rules: LangiumTypeInferenceRules<Specifics>,
    ): void;
    addListener(listener: TypeInferenceCollectorListener<Specifics>): void;
    inferType(
        languageNode: Specifics["LanguageType"],
    ): Type | InferenceProblem<Specifics>[];
    removeInferenceRule<InputType extends AstNode = Specifics["LanguageType"]>(
        rule: TypeInferenceRule<Specifics, InputType>,
        options?: Partial<TypeInferenceRuleOptions>,
    ): void;
    removeListener(listener: TypeInferenceCollectorListener<Specifics>): void;
}

Type Parameters

Hierarchy (View Summary)

Implemented by

Methods