This PR modifies the `structure` syntax so that parents can be named, like in ```lean structure S extends toParent : P ``` **Breaking change:** The syntax is also modified so that the resultant type comes *before* the `extends` clause, for example `structure S : Prop extends P`. This is necessary to prevent a parsing ambiguity, but also this is the natural place for the resultant type. Implements RFC #7099. Will need followup PRs for cleanup after a stage0 update.
21 lines
415 B
Text
21 lines
415 B
Text
class A (α : Type) where
|
||
one : α
|
||
zero : α
|
||
|
||
class B (α : Type) extends A α where
|
||
add : α → α → α
|
||
|
||
class C (α : Type) extends A α where
|
||
mul : α → α → α
|
||
|
||
set_option structureDiamondWarning false
|
||
|
||
def D.toC (x : Nat) := x
|
||
|
||
/-- error: 'D.toC' has already been declared -/
|
||
#guard_msgs in
|
||
class D (α : Type) extends B α, C α
|
||
|
||
class D (α : Type) extends B α, toC_1 : C α
|
||
|
||
#check D.toC_1
|