Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HB tries to redeclare existing mixin #512

Open
Tragicus opened this issue Feb 7, 2025 · 2 comments
Open

HB tries to redeclare existing mixin #512

Tragicus opened this issue Feb 7, 2025 · 2 comments

Comments

@Tragicus
Copy link

Tragicus commented Feb 7, 2025

As reported by @mkerjean on Zulip, we have an issue when some key has an instance for some mixin which is valid for any value of some parameter and we try to use a factory that builds this mixin. HB finds that the mixin is already instantiated and tries to reinstantiate the same mixin (whith the canonical value that is already declared). However, since the instance is valid for any value of the parameter, this produces an evar which makes the declaration fail, see below.

From HB Require Import structures.

HB.mixin Record isA (p n : nat) := {}.

HB.structure Definition A (p : nat) := {n of isA p n}.

HB.factory Record isB (p n : nat) := {}.

HB.builders Context p n of isB p n.
HB.instance Definition _ := isA.Build p n.
HB.end.

HB.instance Definition _ (p : nat) := isA.Build p 0.
HB.instance Definition _ (p : nat) := isB.Build p 0.
@CohenCyril
Copy link
Member

So this error occurs solely when trying to reinstantiate an already instantiated mixin?

@Tragicus
Copy link
Author

Tragicus commented Feb 7, 2025

Yes, if you remove the last but one line, it works. We also only observe a failure when there is a parameter involved, which is not instantiated by the instance.

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

No branches or pull requests

2 participants