hierarchy-builder icon indicating copy to clipboard operation
hierarchy-builder copied to clipboard

HB tries to redeclare existing mixin

Open Tragicus opened this issue 10 months ago • 2 comments

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.

Tragicus avatar Feb 07 '25 09:02 Tragicus