Skip to content

fix(clone): theory overrides of nested or overlapping theories - #1207

Merged
strub merged 1 commit into
mainfrom
fix/clone-theory-override
Oct 14, 2026
Merged

strub merged 1 commit into
mainfrom
fix/clone-theory-override

Conversation

@strub

@strub strub commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

Two problems with theory overrides theory X <- T in clones.

An override of a nested theory, theory B.A <- T, was recorded under
its last component, at the top level: an unrelated theory A of the
cloned theory lost its import, and a second override theory A <- T'
failed with an assertion failure. Theory overrides are now recorded
under their full path, and a duplicate one is reported as such.

A theory override together with a more specific override, as in:

clone Leaf as L with theory B.A <- Arr, theory B <- B0.

failed with an assertion failure, or reported a duplicate override
when given in the other order. Theory overrides are now processed
after the other overrides, the most specific first, and leave alone
the items that already have an override: the more specific override
wins, whatever the order.

In particular, a theory B produced by a clone that overrode its
sub-theory A with theory A <- U can now be threaded through
further clones with <-. That sub-theory was cleared, so that
theory B <- B alone fails, as B.A has no target; the clones give:

theory B <- B, theory B.A <- U

where <= was needed so far, at the cost of a copy of the threaded
theory in every clone.

Also, a clone now replays a theory alias with its substituted target,
instead of the original one.

Two problems with theory overrides `theory X <- T` in clones.

An override of a nested theory, `theory B.A <- T`, was recorded under
its last component, at the top level: an unrelated theory `A` of the
cloned theory lost its import, and a second override `theory A <- T'`
failed with an assertion failure. Theory overrides are now recorded
under their full path, and a duplicate one is reported as such.

A theory override together with a more specific override, as in:

    clone Leaf as L with theory B.A <- Arr, theory B <- B0.

failed with an assertion failure, or reported a duplicate override
when given in the other order. Theory overrides are now processed
after the other overrides, the most specific first, and leave alone
the items that already have an override: the more specific override
wins, whatever the order.

In particular, a theory `B` produced by a clone that overrode its
sub-theory `A` with `theory A <- U` can now be threaded through
further clones with `<-`. That sub-theory was cleared, so that
`theory B <- B` alone fails, as `B.A` has no target; the clones give:

    theory B <- B, theory B.A <- U

where `<=` was needed so far, at the cost of a copy of the threaded
theory in every clone.

Also, a clone now replays a theory alias with its substituted target,
instead of the original one.
@strub
strub force-pushed the fix/clone-theory-override branch from 81f0825 to 5c7b39a Compare October 14, 2026 13:02
@strub strub changed the title fix(clone): theory overrides of nested, overlapping or cleared theories fix(clone): theory overrides of nested or overlapping theories Oct 14, 2026
@strub strub self-assigned this Oct 14, 2026
@strub strub added the yolo-pr Don't bother reviewing, I will merge label Oct 14, 2026
@strub
strub merged commit 420c259 into main Oct 14, 2026
20 checks passed
@strub
strub deleted the fix/clone-theory-override branch October 14, 2026 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

yolo-pr Don't bother reviewing, I will merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant