lean4-htt/tests/lean/run/345.lean
Kyle Miller 44c8b0df85
feat: warn.sorry option (#8662)
This PR adds a `warn.sorry` option (default true) that logs the
"declaration uses 'sorry'" warning when declarations contain `sorryAx`.
When false, the warning is not logged.

Closes #8611 (assuming that one would set `warn.sorry` as an extra flag
when building).

Other change: Uses `warn.sorry` when creating auxiliary declarations in
`structure` elaborator, to suppress irrelevant 'sorry' warnings.

We could include the sorries themselves in the message if they are
labeled, letting users "go to definition" to see where the sorries are
coming from.

In an earlier version, added additional information to the warning when
it is a synthetic sorry, since these can be caused by elaboration bugs
and they can also be caused by elaboration failures in previous
declarations. This idea needs some more work, so it's not included.
2025-06-29 19:31:17 +00:00

38 lines
1.1 KiB
Text

set_option pp.mvars false
/--
error: failed to synthesize
OfNat (Sort _) 1
numerals are polymorphic in Lean, but the numeral `1` cannot be used in a context where the expected type is
Sort _
due to the absence of the instance above
Hint: Additional diagnostic information may be available using the `set_option diagnostics true` command.
-/
#guard_msgs in
axiom bla : 1
/--
error: failed to synthesize
OfNat (Sort _) 1
numerals are polymorphic in Lean, but the numeral `1` cannot be used in a context where the expected type is
Sort _
due to the absence of the instance above
Hint: Additional diagnostic information may be available using the `set_option diagnostics true` command.
-/
#guard_msgs in
structure Foo where
foo : 1
/--
error: failed to synthesize
OfNat (Sort _) 1
numerals are polymorphic in Lean, but the numeral `1` cannot be used in a context where the expected type is
Sort _
due to the absence of the instance above
Hint: Additional diagnostic information may be available using the `set_option diagnostics true` command.
-/
#guard_msgs in
inductive Bla (x : 1) : Type