File: Mathlib/Tactic/Says.lean

full_name: Mathlib.Tactic.Says.says.verify
code: register_option says.verify : Bool :=
  { defValue := false
    group := "says"
    descr := "For every appearance of the `X says Y` combinator, \
      re-verify that running `X` produces `Try this: Y`." }
goal: Lean.Option Bool

full_name: Mathlib.Tactic.Says.initFn._@.Mathlib.Tactic.Says._hyg.9
code: register_option says.verify : Bool :=
  { defValue := false
    group := "says"
    descr := "For every appearance of the `X says Y` combinator, \
      re-verify that running `X` produces `Try this: Y`." }
goal: IO (Lean.Option Bool)

full_name: Mathlib.Tactic.Says.initFn._@.Mathlib.Tactic.Says._hyg.51
code: register_option says.no_verify_in_CI : Bool :=
  { defValue := false
    group := "says"
    descr := "Disable reverification, even if `the `CI` environment variable is set." }
goal: IO (Lean.Option Bool)

full_name: Mathlib.Tactic.Says.says.no_verify_in_CI
code: register_option says.no_verify_in_CI : Bool :=
  { defValue := false
    group := "says"
    descr := "Disable reverification, even if `the `CI` environment variable is set." }
goal: Lean.Option Bool

full_name: Mathlib.Tactic.Says.parseAsTacticSeq
code: /-- This is a slight modification of `Parser.runParserCategory`. -/
def parseAsTacticSeq (env : Environment) (input : String) (fileName := "<input>") :
    Except String (TSyntax ``tacticSeq) 
goal: Except String (Lean.TSyntax `Lean.Parser.Tactic.tacticSeq)

full_name: Mathlib.Tactic.Says.evalTacticCapturingMessages
code: /--
Run `evalTactic`, capturing any new messages.
The optional `only` argument allows selecting which messages should be captured,
or left in the message log.
-/
def evalTacticCapturingMessages (tac : TSyntax `tactic) (only : Message → Bool := fun _ => true) :
    TacticM (List Message) 
goal: Lean.Elab.Tactic.TacticM (List Lean.Message)

full_name: Mathlib.Tactic.Says.evalTacticCapturingInfo
code: /--
Run `evalTactic`, capturing any new info messages.
-/
def evalTacticCapturingInfo (tac : TSyntax `tactic) : TacticM (List Message) 
goal: Lean.Elab.Tactic.TacticM (List Lean.Message)

full_name: Mathlib.Tactic.Says.evalTacticCapturingTryThis
code: /--
Run `evalTactic`, capturing a "Try this:" message and converting it back to syntax.
-/
def evalTacticCapturingTryThis (tac : TSyntax `tactic) : TacticM (TSyntax ``tacticSeq) 
goal: Lean.Elab.Tactic.TacticM (Lean.TSyntax `Lean.Parser.Tactic.tacticSeq)

full_name: Mathlib.Tactic.Says.says
code: /--
If you write `X says`, where `X` is a tactic that produces a "Try this: Y" message,
then you will get a message "Try this: X says Y".
Once you've clicked to replace `X says` with `X says Y`,
afterwards `X says Y` will only run `Y`.

The typical usage case is:
```
simp? [X] says simp only [X, Y, Z]
```

If you use `set_option says.verify true` (set automatically during CI) then `X says Y`
runs `X` and verifies that it still prints "Try this: Y".
-/
syntax (name := says) tactic " says" (colGt tacticSeq)? : tactic
goal: Lean.TrailingParserDescr

full_name: Mathlib.Tactic.Says._aux_Mathlib_Tactic_Says___elabRules_Mathlib_Tactic_Says_says_1
code: elab_rules : tactic
  | `(tactic| $tac:tactic says%$tk $[$result:tacticSeq]?) => do
  let verify := says.verify.get (← getOptions) ||
    !says.no_verify_in_CI.get (← getOptions) && (← IO.getEnv "CI").isSome
  match result, verify with
  | some _, true
  | none, _ =>
    let stx ← evalTacticCapturingTryThis tac
    match result with
    | some r =>
        let stx' := (← Lean.PrettyPrinter.ppTactic ⟨Syntax.stripPos stx⟩).pretty
        let r' := (← Lean.PrettyPrinter.ppTactic ⟨Syntax.stripPos r⟩).pretty
        if stx' != r' then
          throwError m!"Tactic `{tac}` produced `{stx'}`,\nbut was expecting it to produce `{r'}`!"
            ++ m!"\n\nYou can reproduce this error locally using `set_option says.verify true`."
    | none =>
    addSuggestion tk (← `(tactic| $tac says $stx)) (origSpan? := (← `(tactic| $tac says)))
  | some result, false =>
    evalTactic result
goal: Lean.Elab.Tactic.Tactic

full_name: Mathlib.Tactic.Says.initFn._@.Mathlib.Tactic.Says._hyg.1716
code: initialize Batteries.Linter.UnreachableTactic.addIgnoreTacticKind `Mathlib.Tactic.Says.says
goal: IO Unit