Package org.ek9lang.compiler.phase5.callgraph


package org.ek9lang.compiler.phase5.callgraph
Call graph infrastructure for EK9 compiler static analysis.

This package provides call graph construction and analysis capabilities used for:

  • Test validation: Detecting empty @Test programs (E81007)
  • Orphan assertion detection: Assertions not reachable from @Test
  • Production assertion detection: Assertions reachable from non-test programs
  • Dead code detection: Functions not reachable from any entry point
  • Purity validation: Detecting pure functions calling impure functions

Algorithm

Uses RTA (Rapid Type Analysis) which filters polymorphic call targets based on allocated types. EK9's closed-world semantics (no reflection, no dynamic loading) makes this analysis 100% sound.

Key Classes

See Also:
  • Class
    Description
    Functional interface to get the appropriate ErrorListener for a callable.
    Metadata about a callable entity (function, method, operator, constructor, program).
    Builder for CallableInfo to support incremental construction during AST traversal.
    Represents an edge in the call graph from caller to callee.
    Call graph for EK9 programs with bidirectional edges.
    Collects call graph information during AST traversal in Phase 5 (PRE_IR_CHECKS).
    Classification of call site types for call graph analysis.
    Detects @Test programs that have no validation - neither assertions nor expected output files.
    Detects assertion statements that are not reachable from any @Test program.
    Detects assertion statements that are reachable from non-test program entry points.