File: .lake/packages/batteries/Batteries/Linter/UnreachableTactic.lean

full_name: Batteries.Linter.initFn._@..lake.packages.batteries.Batteries.Linter.UnreachableTactic._hyg.7
code: /--
Enables the 'unreachable tactic' linter. This will warn on any tactics that are never executed.
For example, in `example : True := by trivial <;> done`, the tactic `done` is never executed
because `trivial` produces no subgoals; you could put `sorry` or `apply I_don't_exist`
or anything else there and no error would result.

A common source of such things is `simp <;> tac` in the case that `simp` improves and
closes a subgoal that was previously being closed by `tac`.
-/
register_option linter.unreachableTactic : Bool := {
  defValue := true
  descr := "enable the 'unreachable tactic' linter"
}
goal: IO (Lean.Option Bool)

full_name: Batteries.Linter.linter.unreachableTactic
code: /--
Enables the 'unreachable tactic' linter. This will warn on any tactics that are never executed.
For example, in `example : True := by trivial <;> done`, the tactic `done` is never executed
because `trivial` produces no subgoals; you could put `sorry` or `apply I_don't_exist`
or anything else there and no error would result.

A common source of such things is `simp <;> tac` in the case that `simp` improves and
closes a subgoal that was previously being closed by `tac`.
-/
register_option linter.unreachableTactic : Bool := {
  defValue := true
  descr := "enable the 'unreachable tactic' linter"
}
goal: Lean.Option Bool

full_name: Batteries.Linter.UnreachableTactic.getLinterUnreachableTactic
code: /-- Gets the value of the `linter.unreachableTactic` option. -/
def getLinterUnreachableTactic (o : Options) : Bool 
goal: Bool

full_name: Batteries.Linter.UnreachableTactic.M
code: /-- The monad for collecting used tactic syntaxes. -/
abbrev M 
goal: Type

full_name: Batteries.Linter.UnreachableTactic.ignoreTacticKindsRef
code: /--
A list of blacklisted syntax kinds, which are expected to have subterms that contain
unevaluated tactics.
-/
initialize ignoreTacticKindsRef : IO.Ref NameHashSet ←
  IO.mkRef <| HashSet.empty
    |>.insert ``Parser.Term.binderTactic
    |>.insert ``Lean.Parser.Term.dynamicQuot
    |>.insert ``Lean.Parser.Tactic.quotSeq
    |>.insert ``Lean.Parser.Tactic.tacticStop_
    |>.insert ``Lean.Parser.Command.notation
    |>.insert ``Lean.Parser.Command.mixfix
    |>.insert ``Lean.Parser.Tactic.discharger
goal: IO.Ref Lean.NameHashSet

full_name: Batteries.Linter.UnreachableTactic.initFn._@..lake.packages.batteries.Batteries.Linter.UnreachableTactic._hyg.65
code: /--
A list of blacklisted syntax kinds, which are expected to have subterms that contain
unevaluated tactics.
-/
initialize ignoreTacticKindsRef : IO.Ref NameHashSet ←
  IO.mkRef <| HashSet.empty
    |>.insert ``Parser.Term.binderTactic
    |>.insert ``Lean.Parser.Term.dynamicQuot
    |>.insert ``Lean.Parser.Tactic.quotSeq
    |>.insert ``Lean.Parser.Tactic.tacticStop_
    |>.insert ``Lean.Parser.Command.notation
    |>.insert ``Lean.Parser.Command.mixfix
    |>.insert ``Lean.Parser.Tactic.discharger
goal: IO (IO.Ref Lean.NameHashSet)

full_name: Batteries.Linter.UnreachableTactic.isIgnoreTacticKind
code: /-- Is this a syntax kind that contains intentionally unevaluated tactic subterms? -/
def isIgnoreTacticKind (ignoreTacticKinds : NameHashSet) (k : SyntaxNodeKind) : Bool 
goal: Bool

full_name: Batteries.Linter.UnreachableTactic.addIgnoreTacticKind
code: /--
Adds a new syntax kind whose children will be ignored by the `unreachableTactic` linter.
This should be called from an `initialize` block.
-/
def addIgnoreTacticKind (kind : SyntaxNodeKind) : IO Unit 
goal: IO Unit

full_name: Batteries.Linter.UnreachableTactic.getTactics
code: /-- Accumulates the set of tactic syntaxes that should be evaluated at least once. -/
@[specialize] partial def getTactics (stx : Syntax) : M Unit 
goal: Batteries.Linter.UnreachableTactic.M Unit

full_name: Batteries.Linter.UnreachableTactic.unreachableTacticLinter
code: @[inherit_doc Batteries.Linter.linter.unreachableTactic]
def unreachableTacticLinter : Linter 
goal: Lean.Linter

full_name: Batteries.Linter.UnreachableTactic.initFn._@..lake.packages.batteries.Batteries.Linter.UnreachableTactic._hyg.1182
code: initialize addLinter unreachableTacticLinter
goal: IO Unit