/**
 * Compiler Error Handling
 *
 * Compiler errors with source location information
 */
export class CompilerError extends Error {
    file;
    line;
    column;
    errorType;
    context;
    hints;
    code;
    constructor(message, file, line, column, errorType = 'COMPILER_ERROR', context, hints = [], code) {
        super(`${file}:${line}:${column} ${message}`);
        this.name = 'CompilerError';
        this.file = file;
        this.line = line;
        this.column = column;
        this.errorType = errorType;
        this.context = context;
        this.hints = hints;
        this.code = code;
    }
    toString() {
        return `${this.file}:${this.line}:${this.column} [${this.errorType}] ${this.message}`;
    }
}
/**
 * Invariant Error
 *
 * Thrown when a Zenith compiler invariant is violated.
 * Invariants are non-negotiable rules that guarantee correct behavior.
 *
 * If an invariant fails, the compiler is at fault — not the user.
 * The user receives a clear explanation of what is forbidden and why.
 */
export class InvariantError extends CompilerError {
    invariantId;
    guarantee;
    constructor(invariantId, message, guarantee, file, line, column, context, hints = []) {
        super(`[${invariantId}] ${message}\n\n  Zenith Guarantee: ${guarantee}`, file, line, column, 'COMPILER_INVARIANT_VIOLATION', context, hints, invariantId);
        this.name = 'InvariantError';
        this.invariantId = invariantId;
        this.guarantee = guarantee;
        this.code = invariantId;
    }
    toString() {
        return `${this.file}:${this.line}:${this.column} [${this.invariantId}] ${this.message}`;
    }
}
