Skip to content

refactor: semantic analyzer modules exceed 1000-line hard limit #1923

@krystophny

Description

@krystophny

Summary

Two modules exceed the hard limit of 1000 lines per module (CLAUDE.md policy):

  1. src/semantic/analyzers/semantic_analyzer.f90: 1360 lines (exceeds by 360 lines)
  2. src/semantic/analyzers/semantic_function_analysis.f90: 1104 lines (exceeds by 104 lines)

Context

These files were already over the limit before recent PRs. PR #1922 added functionality but immediately extracted new code into semantic_call_signature_collector.f90 to minimize impact.

Proposed Solution

Refactor both modules by extracting cohesive functionality into separate modules:

For semantic_analyzer.f90:

  • Extract statement inference logic (~300 lines)
  • Extract context management utilities (~100 lines)
  • Extract type finalization helpers (~50 lines)

For semantic_function_analysis.f90:

  • Extract parameter analysis (~250 lines)
  • Extract return type determination (~150 lines)
  • Extract scope creation logic (~100 lines)

Acceptance Criteria

  • Both modules under 1000 lines (preferably under 500)
  • All tests pass
  • No functionality changes
  • Clear module boundaries and minimal coupling

Priority

polish - Technical debt cleanup, does not block functionality

Metadata

Metadata

Assignees

No one assigned

    Labels

    polishCode quality and style improvements

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions