import { Expression, FieldAccessExpression, FunctionCallExpression, FunctionDefinition, MatchExpression, NamedExpression, StructDefinition, StructDefinitionField, StructExpression, StructExpressionField, VariableDefinition } from './expression'; import { IntrinsicFunctionDefinition, Scope } from './scope'; import { Type } from './types'; export declare type ErrorDetails = { type: 'Unknown struct field'; expression: StructExpression; definition: StructDefinition; field: StructExpressionField; message: string; } | { type: 'Unknown type definition'; expression: NamedExpression; message: string; } | { type: 'Unknown function'; expression: FunctionCallExpression; similarNames: string[]; message: string; } | { type: 'Not a function'; expression: FunctionCallExpression; message: string; } | { type: 'Not a struct'; expression: StructExpression; message: string; } | { type: 'Unknown named'; expression: NamedExpression; similarNames: string[]; message: string; } | { type: 'Unknown struct'; expression: StructExpression; similarNames: string[]; message: string; } | { type: 'Cannot reference function'; expression: NamedExpression | StructExpression; message: string; } | { type: 'Incompatible field type'; expression: StructExpression; definition: StructDefinition; field: { name: string; expression: Type; definition: Type; }; message: string; } | { type: 'Invalid structure definition'; definition: StructDefinition; details: ErrorDetails; message: string; } | { type: 'Invalid structure definition field'; definition: StructDefinition; field: StructDefinitionField; message: string; } | { type: 'Invalid field access'; expression: FieldAccessExpression; fullExpressionType: Type; offendingType: Type; message: string; } | { type: 'Incorrect function argument count'; expression: FunctionCallExpression; definition: IntrinsicFunctionDefinition | FunctionDefinition; message: string; } | { type: 'Incompatible argument type'; expression: FunctionCallExpression; definition: IntrinsicFunctionDefinition | FunctionDefinition; argument: { index: number; expression: Type; definition: Type; }; message: string; } | { type: 'Incompatible return type'; definition: FunctionDefinition; value: Type; assert: Type; message: string; } | { type: 'Incompatible variable type'; definition: VariableDefinition; value: Type; assert: Type; message: string; } | { type: 'Non-exhaustive match'; expression: MatchExpression; of: Type; remaining: Type; message: string; } | { type: 'Invalid struct spread'; expression: StructExpression; spreadExpression: Expression; spread: Type; message: string; }; export declare class EvaluationError extends Error { details: ErrorDetails; constructor(details: ErrorDetails); } /** * Evaluates the given expression. If a type is given, then the type will be returned as is. * * @throws {@link EvaluationError} */ export declare const evaluate: (expression: Expression, scope: Scope) => Type;