test: add test for mixed autoParam/optParam for structure field defaults (#7815)
This PR adds tests and closes #6769. This was likely fixed as of #7717.
This commit is contained in:
parent
407a59d697
commit
11d21af15e
1 changed files with 58 additions and 0 deletions
|
|
@ -318,3 +318,61 @@ example : A where
|
||||||
m := by trace "b"; exact 0
|
m := by trace "b"; exact 0
|
||||||
|
|
||||||
end Ex9
|
end Ex9
|
||||||
|
|
||||||
|
/-!
|
||||||
|
Issues with mixing optParams and autoParams.
|
||||||
|
https://github.com/leanprover/lean4/issues/6769
|
||||||
|
-/
|
||||||
|
namespace Ex6769_1
|
||||||
|
class Foo where
|
||||||
|
x : Nat := by fail
|
||||||
|
|
||||||
|
class Bar extends Foo where
|
||||||
|
x := 0
|
||||||
|
|
||||||
|
instance instBar : Bar where
|
||||||
|
|
||||||
|
/--
|
||||||
|
info: def Ex6769_1.instBar : Bar :=
|
||||||
|
{ x := 0 }
|
||||||
|
-/
|
||||||
|
#guard_msgs in #print instBar
|
||||||
|
end Ex6769_1
|
||||||
|
|
||||||
|
namespace Ex6769_2
|
||||||
|
class Foo where
|
||||||
|
x : Nat
|
||||||
|
hx : x = x
|
||||||
|
|
||||||
|
class Bar extends Foo where
|
||||||
|
hx' : x = x := by rfl
|
||||||
|
hx := hx'
|
||||||
|
|
||||||
|
instance instBar : Bar where
|
||||||
|
x := 0
|
||||||
|
|
||||||
|
/--
|
||||||
|
info: def Ex6769_2.instBar : Bar :=
|
||||||
|
{ x := 0, hx := Mathlib12129.bar._proof_3, hx' := Mathlib12129.bar._proof_3 }
|
||||||
|
-/
|
||||||
|
#guard_msgs in #print instBar
|
||||||
|
end Ex6769_2
|
||||||
|
|
||||||
|
namespace Ex6769_3
|
||||||
|
class Foo where
|
||||||
|
x : Nat
|
||||||
|
hx : x = x
|
||||||
|
|
||||||
|
class Bar extends Foo where
|
||||||
|
hx' : x = x := rfl
|
||||||
|
hx := hx'
|
||||||
|
|
||||||
|
instance instBar : Bar where
|
||||||
|
x := 0
|
||||||
|
|
||||||
|
/--
|
||||||
|
info: def Ex6769_3.instBar : Bar :=
|
||||||
|
{ x := 0, hx := Mathlib12129.bar._proof_3, hx' := Mathlib12129.bar._proof_3 }
|
||||||
|
-/
|
||||||
|
#guard_msgs in #print instBar
|
||||||
|
end Ex6769_3
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue