Skip to content

shorthand: rebuild the importance-stripped declaration - #298

Open
samoht wants to merge 2 commits into
diff-container-positionfrom
importance-rebuild-hash
Open

shorthand: rebuild the importance-stripped declaration#298
samoht wants to merge 2 commits into
diff-container-positionfrom
importance-rebuild-hash

Conversation

@samoht

@samoht samoht commented Aug 3, 2026

Copy link
Copy Markdown
Owner

Stacked on #297 (chain: #295#297#298#299). Review the last two commits; the rest is the base.

without_importance built Declaration { r with important = false }, copying the cached hash field that was computed over (property, value, important) — so the copy carried a fingerprint of the importance it had just cleared. same_value compares with polymorphic =, which walks that field, so legacy_vendor_fallback's not (same_value ...) guard read two equal values as different:

a{display:-webkit-box;display:-webkit-box!important}
  before: a{display:-webkit-box;display:-webkit-box!important}
  after:  a{display:-webkit-box!important}

The equal-importance pair collapsed correctly all along; only the pair differing in importance leaked through.

Impact is output size — the wrong answer keeps a redundant declaration, and no mis-hashed declaration escapes the module — but a record update on a type whose smart constructor is meant to be the sole path is a landmine. Both arms now rebuild through Declaration.v and Declaration.theme_guarded, which recompute the hash; that is the shape Declaration.important already used two lines away.

samoht added 2 commits August 3, 2026 21:25
Pins that [same_value] ignores importance, so a value repeated with
!important collapses instead of surviving as a legacy fallback.
A record update kept the hash the smart constructor had computed over the
importance being cleared, so a value repeated with !important compared
unequal and read as a legacy vendor fallback.
@samoht
samoht force-pushed the importance-rebuild-hash branch from 906b72e to c241b77 Compare August 4, 2026 04:25
@samoht
samoht changed the base branch from main to diff-container-position August 4, 2026 04:27
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.

1 participant