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

Subclassing a final class should give a type error #54

Closed
bennn opened this issue Oct 23, 2021 · 0 comments
Closed

Subclassing a final class should give a type error #54

bennn opened this issue Oct 23, 2021 · 0 comments
Assignees
Labels
sp-correctness static python correctness staticpython static python issues

Comments

@bennn
Copy link
Contributor

bennn commented Oct 23, 2021

What program did you run?

from __static__ import int64
class D(int64): pass

What happened?

No error

What should have happened?

Type error because int64 is final.

Currently D(1) gives a compiler assertion error. That's good, but it'd be more helpful to reject the class definition in the first place.

@carljm carljm added sp-correctness static python correctness staticpython static python issues labels Oct 23, 2021
facebook-github-bot pushed a commit that referenced this issue Dec 20, 2021
Summary:
Raise a `TypedSyntaxError` in `CType.make_subclass`,
ensuring that primitive types are final.

This solves [Issue #54](#54).

Reviewed By: DinoV

Differential Revision: D33238732

fbshipit-source-id: 02467ab
@wmeehan wmeehan self-assigned this Dec 21, 2021
@wmeehan wmeehan closed this as completed Dec 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sp-correctness static python correctness staticpython static python issues
Projects
None yet
Development

No branches or pull requests

3 participants