Skip to content

Design Meeting Notes, 7/26/2024 #59432

@andrewbranch

Description

@andrewbranch

PR: error on variables that are used but never initialized

#55887

  • new error on variable declaration when a use occurs inside a block scope
  • the reason we don't previously error is we can't see the whole control flow graph—we only error in cases where a control flow walk produces certainty that there's no initialization
  • the strategy in the PR is to walk the whole AST and error if there are no assignments anywhere
  • implementation isn't quite right
    • leverages the unused variable code, but maybe should be in control flow instead,
    • errors would occur on use sites instead of declaration
      • counterpoint: the fix is going to be at the declaration
      • countercounterpoint: sure, but then you just go-to-def. It's a little harder to go to the references that are causing the error
    • introduces an extra property on symbols, memory hit, 0.5% time increase as-is, possibly unavoidable but maybe some is due to the extra property
  • next steps: pass on feedback
    • add some code in checkIdentifier
    • do some stuff with isPastLastAssignment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Design NotesNotes from our design meetings

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions