Utilities for creating and recognizing sorry
#
This module develops material for creating and recognizing sorryAx
terms that encode originating source positions.
There are three orthogonal configurations for sorries:
The sorry could be synthetic. When elaboration fails on some subterm, then we can use a sorry to fill in the missing subterm. In this case elaboration marks the sorry as being "synthetic" while logging an error. The presence of synthetic sorries tends to suppress further errors. For example, the "this declaration contains sorry" error is not triggered for synthetic sorries as we assume there is already an error message logged.
The sorry could be unique. A unique sorry is not definitionally equal to any other sorry, even if they have the same type. Normally
sorryAx α s = sorryAx α s
is a definitional equality. Unique sorries insert a unique tagt
using the encodingsorryAx (τ → α) s t
.The sorry could be labeled. A labeled sorry contains source position information, supporting the LSP "go to definition" feature in the Infoview, and also supporting pretty printing the sorry with an indication of source position when the option
pp.sorrySource
is true.
Returns sorryAx type synthetic
. Recall that synthetic
is true if this sorry is from an error.
See also Lean.Meta.mkLabeledSorry
, for creating a sorry
that is labeled or unique.
Equations
- Lean.Meta.mkSorry type synthetic = do let u ← Lean.Meta.getLevel type pure (Lean.mkApp2 (Lean.mkConst `sorryAx [u]) type (Lean.toExpr synthetic))
Instances For
- module? : Option Lean.DeclarationLocation
Records the origin module name, logical source position, and LSP range for the
sorry
. The logical source position is used when displaying the sorry when thepp.sorrySource
option is true, and the LSP range is used for "go to definition" in the Infoview.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Constructs a sorryAx
.
- If the current ref has a source position, then creates a labeled sorry.
This supports "go to definition" in the InfoView and pretty printing a source position when the
pp.sorrySource
option is true. - If
synthetic
is true, then thesorry
is regarded as being generated by the elaborator. The caller should ensure that there is an associated error logged. - If
unique
is true, thesorry
is unique, in the sense that it is not defeq to any othersorry
created bymkLabeledSorry
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Returns a SorryLabelView
if e
is an application of an expression returned by mkLabeledSorry
.
If it is, then the sorry
takes the first three arguments, and the tag is at argument 3.
Equations
- One or more equations did not get rendered due to their size.