fix: default values for structure fields can be noncomputable (#5531)
Closes #2710
This commit is contained in:
parent
a4dfa83af5
commit
cf14178929
2 changed files with 10 additions and 1 deletions
|
|
@ -733,7 +733,8 @@ private def addDefaults (lctx : LocalContext) (defaultAuxDecls : Array (Name ×
|
|||
throwError "invalid default value for field, it contains metavariables{indentExpr value}"
|
||||
/- The identity function is used as "marker". -/
|
||||
let value ← mkId value
|
||||
discard <| mkAuxDefinition declName type value (zetaDelta := true)
|
||||
-- No need to compile the definition, since it is only used during elaboration.
|
||||
discard <| mkAuxDefinition declName type value (zetaDelta := true) (compile := false)
|
||||
setReducibleAttribute declName
|
||||
|
||||
/--
|
||||
|
|
|
|||
8
tests/lean/run/2710.lean
Normal file
8
tests/lean/run/2710.lean
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
/-!
|
||||
# Structure field default values can be noncomputable
|
||||
-/
|
||||
|
||||
noncomputable def ohno := 1
|
||||
|
||||
structure OhNo where
|
||||
x := ohno
|
||||
Loading…
Add table
Reference in a new issue