Skip to content

Commit a0e7ee2

Browse files
committed
feat(lean): associated types with equality constraints
1 parent 4019185 commit a0e7ee2

File tree

6 files changed

+863
-122
lines changed

6 files changed

+863
-122
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ Changes to the Lean backend:
3636
- Add support for pattern matching on constant literals (#1789)
3737
- Add support for binding subpatterns in match constructs (#1790)
3838
- Add error when using patterns in function parameters (#1792)
39+
- Add support for associated types with equality constraints (#1806)
3940

4041
Miscellaneous:
4142
- Reserve extraction folder for auto-generated files in Lean examples (#1754)

rust-engine/src/backends/lean.rs

Lines changed: 340 additions & 81 deletions
Large diffs are not rendered by default.

test-harness/src/snapshots/toolchain__lean-core-models into-lean.snap

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,14 @@ inductive Lean_core_models.Result.E1 : Type
4646
| C2 : u32 -> Lean_core_models.Result.E1
4747

4848

49+
instance Lean_core_models.Result.Impl.AssociatedTypes :
50+
Core.Clone.Clone.AssociatedTypes Lean_core_models.Result.E1
51+
where
52+
4953
instance Lean_core_models.Result.Impl :
5054
Core.Clone.Clone Lean_core_models.Result.E1
5155
where
5256

53-
5457
inductive Lean_core_models.Result.E2 : Type
5558
| C1 : Lean_core_models.Result.E2
5659
| C2 : u32 -> Lean_core_models.Result.E2
@@ -142,6 +145,10 @@ inductive Lean_core_models.Option.E : Type
142145
| C : u32 -> Lean_core_models.Option.E
143146

144147

148+
instance Lean_core_models.Option.Impl.AssociatedTypes :
149+
Core.Default.Default.AssociatedTypes Lean_core_models.Option.S
150+
where
151+
145152
instance Lean_core_models.Option.Impl :
146153
Core.Default.Default Lean_core_models.Option.S
147154
where
@@ -235,6 +242,10 @@ def Lean_core_models.Option.test
235242
structure Lean_core_models.Default.Structs.S where
236243
f1 : usize
237244

245+
instance Lean_core_models.Default.Structs.Impl.AssociatedTypes :
246+
Core.Default.Default.AssociatedTypes Lean_core_models.Default.Structs.S
247+
where
248+
238249
instance Lean_core_models.Default.Structs.Impl :
239250
Core.Default.Default Lean_core_models.Default.Structs.S
240251
where
@@ -252,8 +263,17 @@ inductive Lean_core_models.Default.Enums.E (T : Type) : Type
252263
| C2 : T -> Lean_core_models.Default.Enums.E (T : Type)
253264

254265

266+
instance Lean_core_models.Default.Enums.Impl.AssociatedTypes
267+
(T : Type)
268+
[Core.Default.Default.AssociatedTypes T] [Core.Default.Default T ]
269+
:
270+
Core.Default.Default.AssociatedTypes (Lean_core_models.Default.Enums.E T)
271+
where
272+
255273
instance Lean_core_models.Default.Enums.Impl
256-
(T : Type) [(Core.Default.Default T)] :
274+
(T : Type)
275+
[Core.Default.Default.AssociatedTypes T] [Core.Default.Default T ]
276+
:
257277
Core.Default.Default (Lean_core_models.Default.Enums.E T)
258278
where
259279
default (_ : Rust_primitives.Hax.Tuple0) := do

0 commit comments

Comments
 (0)