typir
Version:
General purpose type checking library
58 lines • 3.55 kB
TypeScript
/******************************************************************************
* Copyright 2024 TypeFox GmbH
* This program and the accompanying materials are made available under the
* terms of the MIT License, which is available in the project root.
******************************************************************************/
import { Type } from '../graph/type-node.js';
import { TypirSpecifics } from '../typir.js';
import { TypirProblem } from '../utils/utils-definitions.js';
import { IndexedTypeConflict, ValueConflict } from '../utils/utils-type-comparison.js';
import { AssignabilityProblem } from './assignability.js';
import { TypeEqualityProblem } from './equality.js';
import { InferenceProblem } from './inference.js';
import { SubTypeProblem } from './subtype.js';
import { ValidationProblem } from './validation.js';
export interface ProblemPrinter<Specifics extends TypirSpecifics> {
printValueConflict(problem: ValueConflict): string;
printIndexedTypeConflict(problem: IndexedTypeConflict): string;
printAssignabilityProblem(problem: AssignabilityProblem): string;
printSubTypeProblem(problem: SubTypeProblem): string;
printTypeEqualityProblem(problem: TypeEqualityProblem): string;
printInferenceProblem(problem: InferenceProblem<Specifics>): string;
printValidationProblem(problem: ValidationProblem<Specifics>): string;
printTypirProblem(problem: TypirProblem): string;
printTypirProblems(problems: TypirProblem[]): string;
printLanguageNode(languageNode: Specifics['LanguageType'], sentenceBegin: boolean): string;
/**
* This function should be used by other services, instead of using type.getName().
* This enables to customize the printing of type names by overriding only this implementation.
* @param type the type to print
* @returns the name of the given type
*/
printTypeName(type: Type): string;
/**
* This function should be used by other services, instead of using type.getUserRepresentation().
* This enables to customize the printing of type names by overriding only this implementation.
* @param type the type to print
* @returns the user representation of the given type
*/
printTypeUserRepresentation(type: Type): string;
}
export declare class DefaultTypeConflictPrinter<Specifics extends TypirSpecifics> implements ProblemPrinter<Specifics> {
constructor();
printValueConflict(problem: ValueConflict, level?: number): string;
printIndexedTypeConflict(problem: IndexedTypeConflict, level?: number): string;
printAssignabilityProblem(problem: AssignabilityProblem, level?: number): string;
printSubTypeProblem(problem: SubTypeProblem, level?: number): string;
printTypeEqualityProblem(problem: TypeEqualityProblem, level?: number): string;
printInferenceProblem(problem: InferenceProblem<Specifics>, level?: number): string;
printValidationProblem(problem: ValidationProblem<Specifics>, level?: number): string;
printTypirProblem(problem: TypirProblem, level?: number): string;
printTypirProblems(problems: TypirProblem[], level?: number): string;
printLanguageNode(languageNode: Specifics['LanguageType'], sentenceBegin?: boolean): string;
printTypeName(type: Type): string;
printTypeUserRepresentation(type: Type): string;
protected printSubProblems(result: string, subProblems: undefined | TypirProblem[], level?: number): string;
protected printIndentation(result: string, level: number): string;
}
//# sourceMappingURL=printing.d.ts.map