/**
 * Phase 2a: Ownership Analysis
 *
 * Detects cycles in share<T> ownership graphs to enforce DAG requirement.
 * See docs/DAG-ANALYSIS.md for complete algorithm specification.
 */
import { IRModule } from '../ir/types.js';
/** Node in the ownership graph */
interface OwnershipNode {
    className: string;
    fields: Map<string, OwnershipEdge>;
}
/** Edge in the ownership graph (field with share<T> ownership) */
interface OwnershipEdge {
    fieldName: string;
    targetClass: string;
    source: 'direct' | 'container' | 'generic' | 'cross-module';
}
/** Strongly Connected Component (cycle) */
interface SCC {
    nodes: string[];
}
/** Diagnostic error for ownership violations */
export interface OwnershipDiagnostic {
    code: string;
    message: string;
    file?: string;
    line?: number;
    column?: number;
}
/** Result of ownership analysis */
export interface OwnershipAnalysisResult {
    errors: OwnershipDiagnostic[];
    warnings: OwnershipDiagnostic[];
    graph: Map<string, OwnershipNode>;
    sccs: SCC[];
}
/**
 * Ownership Analyzer
 *
 * Builds ownership graph and detects cycles using Tarjan's algorithm.
 */
export declare class OwnershipAnalyzer {
    private graph;
    private typeAliases;
    private errors;
    private warnings;
    private memoryMode;
    private index;
    private stack;
    private indices;
    private lowlinks;
    private onStack;
    private sccs;
    private readonly MAX_RECURSION_DEPTH;
    private currentDepth;
    constructor(memoryMode?: 'gc' | 'ownership');
    /**
     * Analyze ownership semantics for all modules
     *
     * In GC mode: Cycles produce warnings (informational)
     * In ownership mode: Cycles produce errors (DAG requirement enforced)
     */
    analyze(modules: IRModule[]): OwnershipAnalysisResult;
    /**
     * Build ownership graph for a single module
     */
    private buildGraphForModule;
    /**
     * Build ownership graph node for a class (Rules 1.1-1.7)
     */
    private buildGraphForClass;
    /**
     * Build ownership graph node for an interface (Rules 1.1-1.7)
     */
    private buildGraphForInterface;
    /**
     * Build ownership graph node for a type (class or interface)
     */
    private buildGraphForType;
    /**
     * Analyze struct fields recursively for share<T> references
     */
    private analyzeStructFields;
    /**
     * Tarjan's strongly connected components algorithm
     * Time complexity: O(V + E)
     *
     * Protected against infinite recursion:
     * - Each node visited exactly once (indices map prevents re-visiting)
     * - Maximum depth = O(V) for graph with V nodes
     * - Explicit depth limit as safety net
     */
    private strongConnect;
    /**
     * Check if a class has a self-loop (share<T> field pointing to itself)
     */
    private hasSelfLoop;
    /**
     * Get the current recursion depth (for testing/diagnostics)
     */
    getMaxDepthReached(): number;
    /**
     * Report detected cycles as errors (ownership mode) or warnings (GC mode)
     */
    private reportCycles;
    /**
     * Find the edges that form the cycle in an SCC
     */
    private findCycleEdges;
    /**
     * Check if a type has share<T> ownership
     */
    private hasShareOwnership;
    /**
     * Extract class/interface name from share<T> type
     */
    private extractClassName;
    /**
     * Extract target class from container types (Rule 1.2)
     * Handles all collection types:
     * - Array<share<T>> → T
     * - Map<K, share<V>> → V
     * - Set<share<T>> → T (future)
     * - Tuple<share<T>, ...> → T (future)
     *
     * Also handles collections of structs:
     * - Array<struct { field: share<T> }> → T
     * - Map<K, struct { field: share<T> }> → T
     */
    private extractContainerShareTarget;
    /**
     * Extract share<T> target from struct (if any field has share<T>)
     */
    private extractStructShareTarget;
    /**
     * Extract deep share<T> targets (Rule 1.3)
     * share<T> inside share<U>
     */
    private extractDeepShareTargets;
    /**
     * Extract share<T> from generic type parameters (Rule 1.4)
     */
    private extractGenericShareTargets;
    /**
     * Resolve type alias to its underlying type
     * Returns the original type if not a type alias
     */
    private resolveTypeAlias;
}
/**
 * Analyze ownership for a program
 */
export declare function analyzeOwnership(modules: IRModule[], memoryMode?: 'gc' | 'ownership'): OwnershipAnalysisResult;
export {};
//# sourceMappingURL=ownership.d.ts.map