Skip to content

Conversation

@joscoh
Copy link
Contributor

@joscoh joscoh commented Jan 22, 2026

Description of changes:
Changes the syntax so that datatype declarations automatically produce destructors of the form Name..destructor (e.g. List..head as opposed to head). This enables one to reuse destructor names across different datatypes (as in CorePrelude.lean). Most of this PR fixes tests, the only (small) changes are in TypeFactory.lean, Core/Parse.lean, Core/DDMTransform/Translate.lean, and Core/SMTEncoder.lean. This PR also updates the documentation.

@thanhnguyen-aws

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@joscoh joscoh requested a review from a team as a code owner January 22, 2026 19:02
@shigoel shigoel enabled auto-merge January 23, 2026 16:21
shigoel
shigoel previously approved these changes Jan 23, 2026
def destructorFuncs {T} [BEq T.Identifier] [Inhabited T.IDMeta] (d: LDatatype T.IDMeta) (c: LConstr T.IDMeta) : List (LFunc T) :=
c.args.mapIdx (fun i (name, ty) =>
let arg := genArgName
let destructorName : Identifier T.IDMeta := d.name ++ ".." ++ name.name
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Perhaps makes sense to define a separate function to create these scoped names to make sure it's easy to be consistent across files and that if we change naming later (unlikely, but still...), the delta will be small

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants