Skip to content

Conversation

@hmc-cs-mdrissi
Copy link
Contributor

@hmc-cs-mdrissi hmc-cs-mdrissi commented Feb 29, 2024

Resolves this issue. The main goal was to permit ClassVar[Final[int]] and Final[ClassVar[int]]. This drops validation check that Final/ClassVar argument is not a special form.

This does allow some silly cases like ClassVar[ClassVar[int]] but I think it's simpler to allow them then have more complex validation rules at runtime. I did not remove special form check for other forms so Union[ClassVar[int], int] remains forbidden and list[ClassVar[int]] is also forbidden. There already was a test case that list[ClassVar[int]] fails.

I also added couple tests for Annotated to ensure it can nest freely with ClassVar/Final.

@ghost
Copy link

ghost commented Feb 29, 2024

The following commit authors need to sign the Contributor License Agreement:

Click the button to sign:
CLA not signed

@hmc-cs-mdrissi
Copy link
Contributor Author

Hmm, for CLA it's probably easier if I close and remake the PR with email of this account. That's my work email, which has a github account, but it's github enterprise account and unsure how to sign with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant