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

bug: error when parameter with type hint Any has a default value of None #21

Open
rmshaffer opened this issue Apr 2, 2024 · 0 comments · May be fixed by #22
Open

bug: error when parameter with type hint Any has a default value of None #21

rmshaffer opened this issue Apr 2, 2024 · 0 comments · May be fixed by #22
Labels
bug Something isn't working

Comments

@rmshaffer
Copy link
Contributor

Describe the bug
A parameter with type hint of Any and a default value of None results in linter error BCS023. (This is related to the new functionality from #17.) However, None is a valid value for a type hint of Any and therefore this should be allowed.

To reproduce
Define a function parameter with a type hint of Any and a default value of None, e.g. previous_value here:

def assign_stmt(target_name: str, value: Any, previous_value: Any = None) -> Any:

results in this error:

BCS023 - Argument 'previous_value' defaults to None but type hint doesn't end with '| None'.

Expected behavior
No error.

Screenshots or logs
If applicable, add screenshots or logs to help explain your problem.

System information
A description of your system. Please provide:

  • Python version: 3.9

Additional context
Add any other context about the problem here.

@rmshaffer rmshaffer added the bug Something isn't working label Apr 2, 2024
@rmshaffer rmshaffer linked a pull request Apr 2, 2024 that will close this issue
5 tasks
@rmshaffer rmshaffer linked a pull request Apr 2, 2024 that will close this issue
5 tasks
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