@Kha This one required a bunch of manual fixes. The main issue is that
before we added the string interpolation feature, we created
`MessageData`s using `++` and coercions. For example, given
`(e : Expr)`, we would write
```
let msg : MessageData := "type: " ++ e
```
and rely on the coercions `String -> MessageData` and
`Expr -> MessageData`, and the instance `Append MessageData`.
However, heterogeneous operators "block" the expected type propagation downwards.
This kind of code is obsolete now since we can write a more compact
version using string interpolation
```
let msg := m!"type: {e}"
```
27 lines
671 B
Text
27 lines
671 B
Text
import Lean
|
|
|
|
|
|
open Lean
|
|
open Lean.Elab
|
|
open Lean.Elab.Term
|
|
|
|
def tst1 : TermElabM Unit := do
|
|
let opt ← getOptions;
|
|
let stx ← `(forall (a b : Nat), Nat);
|
|
IO.println "message 1"; -- This message goes direct to stdio. It will be displayed before trace messages.
|
|
let e ← elabTermAndSynthesize stx none;
|
|
logDbgTrace m!">>> {e}"; -- display message when `trace.Elab.debug` is true
|
|
IO.println "message 2"
|
|
|
|
#eval tst1
|
|
|
|
def tst2 : TermElabM Unit := do
|
|
let opt ← getOptions;
|
|
let a := mkIdent `a;
|
|
let b := mkIdent `b;
|
|
let stx ← `((fun ($a : Type) (x : $a) => @id $a x) _ 1);
|
|
let e ← elabTermAndSynthesize stx none;
|
|
logDbgTrace m!">>> {e}";
|
|
throwErrorIfErrors
|
|
|
|
#eval tst2
|