Skip to content

EZC: "Did you mean?" suggestions for typos #1177

@SchoolyB

Description

@SchoolyB

Typo Suggestions

When the compiler encounters an undefined identifier, suggest the closest match from the current scope.

error[E3001]: undefined variable 'countr'
  --> main.ez:15:5
   |
15 |     countr++
   |     ^^^^^^
   |
   = help: did you mean 'counter'?

Checklist

  • Implement Levenshtein distance (or similar edit distance) function
  • On undefined variable/function/type, search scope for names within edit distance ≤ 2
  • Suggest the closest match in the help text
  • Apply to: variable names, function names, struct/enum type names, module names, enum member names
  • Suggest EZ keywords when identifier is close to a keyword (e.g. `retrun` → `return`)

Dependencies

  • Requires type checker / symbol table to know what's in scope

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesterror-messagesRelated to improving error messagesezcEZC compiler tool (EZ → C → native binary)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions