Skip to content

Dead code detection and tree-shaking #45

Description

@brianp

Two related features:

Dead code warnings (typechecker)
The typechecker already knows which symbols are referenced. Add a pass that walks from main(), builds a reachability graph, and warns on unreferenced top-level functions, classes, and imports. This includes methods on DynamicReceiver classes where match arms in method_missing align to known methods, those branches can be statically resolved and included in the call graph.

Tree-shaking (codegen)
Once the typechecker marks unreachable code, the FIR lowerer can skip emitting it entirely. For AOT builds this reduces binary size. For JIT it reduces compile time.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    codegenJIT, AOT, FIR lowering, runtimeenhancementNew feature or requestmediumShould get done, not urgenttype-systemType checker, inference, generics, traits

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions