lean4-htt/tests/lean/run/issue10678.lean
Joachim Breitner 30f41fe542
fix: instance name for deriving ToExpr (#10682)
This PR changes the instance name for `deriving ToExpr` to be consistent
with other derived instance since #10271. Fixes #10678.
2025-10-06 11:46:46 +00:00

65 lines
1.8 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import Lean
namespace A
structure A (α : Type u) where
a : α
deriving Lean.ToExpr, Inhabited
-- same namespace for instance and aux decls
/--
info: def A.instToExprA.{u} : {α : Type u} → [Lean.ToExpr α] → [Lean.ToLevel] → Lean.ToExpr (A α) :=
fun {α} [Lean.ToExpr α] [inst_1 : Lean.ToLevel] =>
{ toExpr := instToExprA.toExpr inst_1, toTypeExpr := (Lean.Expr.const `A.A [Lean.toLevel]).app (Lean.toTypeExpr α) }
-/
#guard_msgs in #print A.instToExprA
/--
info: def A.instInhabitedA.{u_1} : {a : Type u_1} → [Inhabited a] → Inhabited (A a) :=
fun {a} [Inhabited a] => { default := instInhabitedA.default }
-/
#guard_msgs in #print A.instInhabitedA
end A
mutual
inductive B (α : Type u) : Type _ where
| leaf
| mk (a : C α)
deriving Lean.ToExpr, Inhabited
inductive C (α : Type u) : Type _ where
| mk (b : B α)
deriving Lean.ToExpr, Inhabited
end
/--
info: def instToExprB.{u} : {α : Type u} → [Lean.ToExpr α] → [Lean.ToLevel] → Lean.ToExpr (B α) :=
fun {α} [Lean.ToExpr α] [inst_1 : Lean.ToLevel] =>
{ toExpr := instToExprB.toExpr_1 inst_1, toTypeExpr := (Lean.Expr.const `B [Lean.toLevel]).app (Lean.toTypeExpr α) }
-/
#guard_msgs in
#print instToExprB
/--
info: def instToExprC.{u} : {α : Type u} → [Lean.ToExpr α] → [Lean.ToLevel] → Lean.ToExpr (C α) :=
fun {α} [Lean.ToExpr α] [inst_1 : Lean.ToLevel] =>
{ toExpr := instToExprB.toExpr_2 inst_1, toTypeExpr := (Lean.Expr.const `C [Lean.toLevel]).app (Lean.toTypeExpr α) }
-/
#guard_msgs in
#print instToExprC
/--
info: def instInhabitedB.{u_1} : {a : Type u_1} → Inhabited (B a) :=
fun {a} => { default := instInhabitedB.default_1 }
-/
#guard_msgs in
#print instInhabitedB
/--
info: def instInhabitedC.{u_1} : {a : Type u_1} → Inhabited (C a) :=
fun {a} => { default := instInhabitedC.default_1 }
-/
#guard_msgs in
#print instInhabitedC