@informalsystems/quint
Version:
Core tool for the Quint specification language
28 lines (27 loc) • 1.15 kB
TypeScript
/**
* Inference for types. Uses constraint generation and solving to infer types
* for each expression inside a module
*
* @author Gabriela Moreira
*
* @module
*/
import { ErrorTree } from '../errorTree';
import { LookupTable } from '../names/base';
import { QuintDeclaration } from '../ir/quintIr';
import { TypeScheme } from './base';
import { ConstraintGeneratorVisitor } from './constraintGenerator';
export type TypeInferenceResult = [Map<bigint, ErrorTree>, Map<bigint, TypeScheme>];
export declare class TypeInferrer extends ConstraintGeneratorVisitor {
constructor(table: LookupTable, types?: Map<bigint, TypeScheme>);
/**
* Infers a type for each expression in a list of QuintDeclarations. If there
* are missing types in the type map, there will be at least one error.
*
* @param declarations: the list of QuintDeclarations to infer types for
*
* @returns a map from expression ids to their type schemes and a map from expression
* ids to the corresponding error for any problematic expressions.
*/
inferTypes(declarations: QuintDeclaration[]): TypeInferenceResult;
}