Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix:
checkTargets
check for duplicate target (#3171)
The `checkTargets` function introduced in 4a0f8bf as ``` checkTargets (targets : Array Expr) : MetaM Unit := do let mut foundFVars : FVarIdSet := {} for target in targets do unless target.isFVar do throwError "index in target's type is not a variable (consider using the `cases` tactic instead){indentExpr target}" if foundFVars.contains target.fvarId! then throwError "target (or one of its indices) occurs more than once{indentExpr target}" ``` looks like it tries to check for duplicate indices, but it doesn’t actually, as `foundFVars` is never written to. This adds ``` foundFVars := foundFVars.insert target.fvarId! ``` and a test case. Maybe a linter that warns about `let mut` that are never writen to would be useful?
- Loading branch information