Skip to content

Commit edce31d

Browse files
committed
fix tests
1 parent 4c86d0c commit edce31d

File tree

7 files changed

+21
-13
lines changed

7 files changed

+21
-13
lines changed

src/Lean/Elab/Command.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ def wrapAsyncAsSnapshot {α : Type} (act : α → CommandElabM Unit) (cancelTk?
303303
withTraceNode `Elab.async (fun _ => return desc) do
304304
act a
305305
catch e =>
306-
logError e.toMessageData
306+
logException e
307307
finally
308308
addTraceAsMessages
309309
get

src/Lean/Elab/Exception.lean

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ def isAbortTacticException (ex : Exception) : Bool :=
6464
def isAbortExceptionId (id : InternalExceptionId) : Bool :=
6565
id == abortCommandExceptionId || id == abortTermExceptionId || id == abortTacticExceptionId
6666

67+
def isAbortException (ex : Exception) : Bool :=
68+
match ex with
69+
| Exception.internal id .. => isAbortExceptionId id
70+
| _ => false
71+
6772
def mkMessageCore (fileName : String) (fileMap : FileMap) (data : MessageData) (severity : MessageSeverity) (pos : String.Pos.Raw) (endPos : String.Pos.Raw) : Message :=
6873
let pos := fileMap.toPosition pos
6974
let endPos := fileMap.toPosition endPos

src/Lean/Elab/Tactic/ElabTerm.lean

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,14 @@ private unsafe def elabNativeDecideCoreUnsafe (tacticName : Name) (expectedType
412412
hints := .abbrev
413413
safety := .safe
414414
}
415-
addAndCompile decl
415+
try
416+
-- disable async codegen so we can catch its exceptions; we don't want to report `evalConst`
417+
-- failures below when the actual reason was a codegen failure
418+
withOptions (Elab.async.set · false) do
419+
addAndCompile decl
420+
catch ex =>
421+
throwError m!"Tactic `{tacticName}` failed. Error: {ex.toMessageData}"
422+
416423
-- get instance from `d`
417424
let s := d.appArg!
418425
let rflPrf ← mkEqRefl (toExpr true)

src/Lean/Linter/MissingDocs.lean

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,9 @@ def checkSyntax : SimpleHandler := fun stx => do
209209
if stx[5].isNone then lint stx[3] "syntax"
210210
else lintNamed stx[5][0][3] "syntax"
211211

212-
def mkSimpleHandler (name : String) : SimpleHandler := fun stx => do
212+
def mkSimpleHandler (name : String) (declNameStxIdx := 2) : SimpleHandler := fun stx => do
213213
if stx[0].isNone then
214-
lintNamed stx[2] name
214+
lintNamed stx[declNameStxIdx] name
215215

216216
@[builtin_missing_docs_handler syntaxAbbrev]
217217
def checkSyntaxAbbrev : SimpleHandler := mkSimpleHandler "syntax"
@@ -240,10 +240,10 @@ def checkClassAbbrev : SimpleHandler := fun stx => do
240240
def checkSimpLike : SimpleHandler := mkSimpleHandler "simp-like tactic"
241241

242242
@[builtin_missing_docs_handler Option.registerBuiltinOption]
243-
def checkRegisterBuiltinOption : SimpleHandler := mkSimpleHandler "option"
243+
def checkRegisterBuiltinOption : SimpleHandler := mkSimpleHandler (declNameStxIdx := 3) "option"
244244

245245
@[builtin_missing_docs_handler Option.registerOption]
246-
def checkRegisterOption : SimpleHandler := mkSimpleHandler "option"
246+
def checkRegisterOption : SimpleHandler := mkSimpleHandler (declNameStxIdx := 3) "option"
247247

248248
@[builtin_missing_docs_handler registerSimpAttr]
249249
def checkRegisterSimpAttr : SimpleHandler := mkSimpleHandler "simp attr"

tests/lean/run/10213.lean

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ error: invalid 'csimp' theorem, only constant replacement theorems (e.g., `@f =
1212
theorem bad_csimp : @funnyChoice.{0} = @id.{0} := rfl
1313

1414
/--
15-
error: Tactic `native_decide` failed: Could not evaluate decidable instance. Error: (interpreter) unknown declaration '_example._nativeDecide_1'
16-
---
17-
error: failed to compile definition, compiler IR check failed at `_example._nativeDecide_1._closed_0`. Error: depends on declaration 'funnyChoice', which has no executable code; consider marking definition as 'noncomputable'
15+
error: Tactic `native_decide` failed. Error: failed to compile definition, compiler IR check failed at `_example._nativeDecide_1._closed_0`. Error: depends on declaration 'funnyChoice', which has no executable code; consider marking definition as 'noncomputable'
1816
-/
1917
#guard_msgs in
2018
example : False := by

tests/lean/run/grind_bintree.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ where
6262
: toListTR.go t acc = t.toList ++ acc := by
6363
induction t generalizing acc <;> grind [toListTR.go, toList]
6464

65-
@[csimp] theorem Tree.toList_eq_toListTR_csimp
65+
@[local csimp] theorem Tree.toList_eq_toListTR_csimp
6666
: @Tree.toList = @Tree.toListTR := by
6767
grind [toList_eq_toListTR]
6868

tests/lean/run/noncomputable_decide.lean

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
open scoped Classical
22

33
/--
4-
error: Tactic `native_decide` failed: Could not evaluate decidable instance. Error: (interpreter) unknown declaration 'ohno._nativeDecide_1_1'
5-
---
6-
error: failed to compile definition, consider marking it as 'noncomputable' because it depends on 'Classical.propDecidable', which is 'noncomputable'
4+
error: Tactic `native_decide` failed. Error: failed to compile definition, consider marking it as 'noncomputable' because it depends on 'Classical.propDecidable', which is 'noncomputable'
75
-/
86
#guard_msgs in
97
theorem ohno : False := by

0 commit comments

Comments
 (0)