This PR gives a simpler semantics to `noncomputable`, improving predictability as well as preparing codegen to be moved into a separate build step without breaking immediate generation of error messages. Specifically, `noncomputable` is now needed whenever an axiom or another `noncomputable` def is used by a def except for the following special cases: * uses inside proofs, types, type formers, and constructor arguments corresponding to (fixed) inductive parameters are ignored * uses of functions marked `@[extern]/@[implemented_by]/@[csimp]` are ignored * for applications of a function marked `@[macro_inline]`, noncomputability of the inlining is instead inspected # Breaking change After this change, more `noncomputable` annotations than before may be required in exchange for improved future stability.
21 lines
288 B
Text
21 lines
288 B
Text
@[macro_inline]
|
|
noncomputable def noncomp (a : Nat) : Nat := a
|
|
|
|
@[macro_inline]
|
|
def f (_ b : Nat) : Nat := b
|
|
|
|
def g (b : Nat) := f (noncomp 0) b
|
|
|
|
def h (b : Nat) := f (Classical.choice inferInstance) b
|
|
|
|
/--
|
|
info: 37
|
|
-/
|
|
#guard_msgs in
|
|
#eval g 37
|
|
|
|
/--
|
|
info: 42
|
|
-/
|
|
#guard_msgs in
|
|
#eval h 42
|