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

Fix inheritance bug that doesn't reset state correctly #49

Merged
merged 1 commit into from
Aug 30, 2023

Conversation

joshuaclayton
Copy link
Owner

What?

This addresses a bug with a very specific set of criteria for
reproduction:

  • a page object (A) inheriting from PageEz::Page with a macro declaring
    a block (nothing needs to be declared in the block)
  • a page object (B) inheriting from PageEz::Page that declares a top-level
    macro named (X)
  • a page object (C) inheriting from (A) that also declares a top-level
    macro named (X)

The bug that triggered this failure (a duplicate element declaration
error, which would be on (X) in the example above) was related to a
state change (setting nested_macro to true) when a block is provided to
a macro that wasn't reset after the block was complete.

When a class inherits from PageEz or its subclasses, if it's not nested,
it resets all its visitors. This key behavior wasn't being triggered on
(C), resulting in it finding the same macro (X) from (B) and determining
that it was a collision.

What?
=====

This addresses a bug with a very specific set of criteria for
reproduction:

* a page object (A) inheriting from PageEz::Page with a macro declaring
  a block (nothing needs to be declared in the block)
* a page object (B) inheriting from PageEz::Page that declares a top-level
  macro named (X)
* a page object (C) inheriting from (A) that also declares a top-level
  macro named (X)

The bug that triggered this failure (a duplicate element declaration
error, which would be on (X) in the example above) was related to a
state change (setting nested_macro to true) when a block is provided to
a macro that wasn't reset after the block was complete.

When a class inherits from PageEz or its subclasses, if it's not nested,
it resets all its visitors. This key behavior wasn't being triggered on
(C), resulting in it finding the same macro (X) from (B) and determining
that it was a collision.
@joshuaclayton joshuaclayton merged commit 07c9de7 into main Aug 30, 2023
3 checks passed
@joshuaclayton joshuaclayton deleted the fix-inheritance-bug-not-resetting-state branch August 30, 2023 00:01
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