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

Redefinition bug for structs #498

Closed
mark-koch opened this issue Sep 13, 2024 · 0 comments · Fixed by #499
Closed

Redefinition bug for structs #498

mark-koch opened this issue Sep 13, 2024 · 0 comments · Fixed by #499
Assignees
Labels
bug Something isn't working

Comments

@mark-koch
Copy link
Collaborator

mark-koch commented Sep 13, 2024

The following raises a KeyError:

module = GuppyModule("test")

@guppy.struct(module)
class Foo:
    x: int

@guppy(module)
def foo() -> int:
    return y  # Deliberate error

try:
    module.compile()
except:
    pass

@guppy.struct(module)
class Foo:
    x: int

module.compile()
@mark-koch mark-koch added the bug Something isn't working label Sep 13, 2024
@mark-koch mark-koch changed the title Redefinition bug Redefinition bug for structs Sep 13, 2024
@mark-koch mark-koch self-assigned this Sep 13, 2024
github-merge-queue bot pushed a commit that referenced this issue Sep 16, 2024
Closes #498.

The problem was that the autogenerated `__new__` method of structs
wasn't added to `globals.defs`, yielding a `KeyError` when trying to
unregister it before overriding.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant