Skip to content

Commit 2920033

Browse files
committed
fix: meta should trump noncomputable section
1 parent 6077154 commit 2920033

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/Lean/Elab/PreDefinition/Basic.lean

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,10 @@ private def shouldGenCodeFor (preDef : PreDefinition) : Bool :=
135135
!preDef.kind.isTheorem && !preDef.modifiers.isNoncomputable
136136

137137
private def compileDecl (decl : Declaration) : TermElabM Unit := do
138-
Lean.compileDecl (logErrors := !(← read).isNoncomputableSection) decl
138+
Lean.compileDecl
139+
-- `meta` should disregard `noncomputable section`
140+
(logErrors := !(← read).isNoncomputableSection || decl.getTopLevelNames.any (isMeta (← getEnv)))
141+
decl
139142

140143
register_builtin_option diagnostics.threshold.proofSize : Nat := {
141144
defValue := 16384

tests/pkg/module/Module/Basic.lean

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,3 +496,7 @@ Note: A private declaration `S.s` (from the current module) exists but would nee
496496
-/
497497
#guard_msgs in
498498
@[expose] public def useS (s : S) := s.s
499+
500+
noncomputable section
501+
meta def m := S.s
502+
end

0 commit comments

Comments
 (0)