import { ActualType, GlobalEnv } from "./globalenv"; import * as ast from "../ast"; export declare type Env = Map; /** * Valid types for synthesis */ export declare type Synthed = ast.Type | { tag: "AmbiguousNullPointer"; } | { tag: "NamedFunctionType"; definition: ast.FunctionDeclaration; } | { tag: "AnonymousFunctionTypePointer"; definition: ast.FunctionDeclaration; }; /** * Valid non-Identifier types for synthesis. */ export declare type ActualSynthed = ActualType | ast.VoidType | { tag: "AmbiguousNullPointer"; } | { tag: "NamedFunctionType"; definition: ast.FunctionDeclaration; } | { tag: "AnonymousFunctionTypePointer"; definition: ast.FunctionDeclaration; }; /** * Resove Identifiers in a synthesized type. */ export declare function actualSynthed(genv: GlobalEnv, t1: Synthed): ActualSynthed; /** * Check whether two types are equal. */ export declare function equalTypes(genv: GlobalEnv, t1: ast.Type, t2: ast.Type): boolean; export declare function equalFunctionTypes(genv: GlobalEnv, decl1: ast.FunctionDeclaration, decl2: ast.FunctionDeclaration): boolean; /** * Almost entirely here to deal with the mess that is functions, and only (seemingly) because of conditionals. * (Perhaps this function can be reused for equality comparisions?) */ export declare function leastUpperBoundSynthedType(genv: GlobalEnv, t1: Synthed, t2: Synthed): Synthed | null; /** * Checks that a value of the abstract type is usable in a hole requiring the concrete type: * in other words, checks that abstract <: concrete, where "<:" is the usual subtyping relationship. */ export declare function isSubtype(genv: GlobalEnv, abstract: Synthed, concrete: ast.Type): boolean; /** * Ensures that a type is not void or (recursively) void[] */ export declare function typeIsNotVoid(genv: GlobalEnv, tp: ast.Type): boolean; /** * Asserts type mentioned in variable declaration or function argument has small type * TODO: use in other places as a "NOT SMALL" check? * TODO: Make sure this does the right things */ export declare function checkTypeInDeclaration(genv: GlobalEnv, tp: ast.Type, isFunctionArg?: boolean): void; /** * Checks that a function return type is valid (void or small) */ export declare function checkFunctionReturnType(genv: GlobalEnv, t: ast.Type): void;