lean4-htt/tests/elab/trace_synth.lean
Garmelon 08eb78a5b2
chore: switch to new test/bench suite (#12590)
This PR sets up the new integrated test/bench suite. It then migrates
all benchmarks and some related tests to the new suite. There's also
some documentation and some linting.

For now, a lot of the old tests are left alone so this PR doesn't become
even larger than it already is. Eventually, all tests should be migrated
to the new suite though so there isn't a confusing mix of two systems.
2026-02-25 13:51:53 +00:00

52 lines
1.5 KiB
Text

class Foo (s : String) : Type where
instance : Foo "one" where
instance [Foo "three"] : Foo "two" where
def f (s : String) [Foo s] := ()
/-- info: () -/
#guard_msgs in
#eval f "one"
/--
error: failed to synthesize instance of type class
Foo "two"
Hint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.
-/
#guard_msgs in
#eval f "two"
/--
error: failed to synthesize instance of type class
Foo "two"
---
trace: [Meta.synthInstance] ❌️ Foo "two"
[Meta.synthInstance] new goal Foo "two"
[Meta.synthInstance.instances] #[@instFoo_1]
[Meta.synthInstance] ✅️ apply @instFoo_1 to Foo "two"
[Meta.synthInstance.tryResolve] ✅️ Foo "two" ≟ Foo "two"
[Meta.synthInstance] no instances for Foo "three"
[Meta.synthInstance.instances] #[]
[Meta.synthInstance] result <not-available>
[Meta.synthInstance] ❌️ Foo "two"
[Meta.synthInstance] result <not-available> (cached)
-/
#guard_msgs in
set_option trace.Meta.synthInstance true in
#eval f "two"
/--
error: failed to synthesize instance of type class
Foo "three"
---
trace: [Meta.synthInstance] ❌️ Foo "three"
[Meta.synthInstance] no instances for Foo "three"
[Meta.synthInstance.instances] #[]
[Meta.synthInstance] result <not-available>
[Meta.synthInstance] ❌️ Foo "three"
[Meta.synthInstance] result <not-available> (cached)
-/
#guard_msgs in
set_option trace.Meta.synthInstance true in
#eval f "three"