Skip to content

Code quality improvements driven by JETLS diagnostics - #166

Merged
aviatesk merged 5 commits into
masterfrom
avi/jetls
Sep 16, 2026
Merged

aviatesk merged 5 commits into
masterfrom
avi/jetls

Conversation

@aviatesk

Copy link
Copy Markdown
Member

This PR bundles a series of small cleanups prompted by running JETLS over the codebase.
None of the exported API changes; all signature changes are to internal (non-exported) helpers.

  • Remove unused variables and dead code (db0a6cc)
  • Separate expr and Frame method-query overloads (8881ea6):
    ismethod(::Frame) / ismethod3(::Frame) are renamed to is_frame_at_method / is_frame_at_method3.
    They answer a different question from ismethod(stmt) (which inspects a statement), and sharing the name introduced unnecessary union splits due to callsite argument type refinements.
    Revise only calls ismethod on statements, so it is unaffected.
  • Use === for symbol comparison (1f3895f)
  • Add restrictive argument type declarations to internal subroutines (fe53c94)
    • Annotate isrequired::AbstractVector{Bool}, objs::Set{GlobalRef}, idx::Int, etc. on the
      lines_required! worker and its helpers (add_requests!, add_ssa_preds!, add_named_dependencies!,
      add_preds!, add_obj!, add_typedefs!). This improves JETLS diagnostics and documents intent.
    • Note: the 5-positional-arg lines_required!(isrequired, objs, src, edges, controller) now requires objs::Set{GlobalRef}. This overload is not covered by the docstring and every public entry point already passes a Set{GlobalRef}; only one test needed updating.
    • Add @nospecialize to ismethod/ismethod1/ismethod3 and type ismethod_with_name's src::CodeInfo.
  • Minor cosmetic changes (d05aa78)
    • Guard the "no method found" @warn in methoddef! with loc !== nothing, so a missing line-table entry no longer raises instead of warning.
    • Rename unused arguments to _-prefixed names, tidy using order in tests.

`ismethod[3](expr)` and `ismethod[3](::Frame)` are distinct queries.
Avoiding an unnecessary overload prevents unwanted type instability.
Add restrictive argument type declarations to internal utilities. This
improves JETLS diagnostics and makes the intent of the codebase clearer.
@aviatesk
aviatesk merged commit 2cc77f3 into master Sep 16, 2026
10 checks passed
@aviatesk
aviatesk deleted the avi/jetls branch September 16, 2026 04:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant