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

🐛 False positive 'Return annotation not ending with ]' on union retun type #44

Closed
s-weigand opened this issue Jul 13, 2023 · 1 comment · Fixed by #45
Closed

🐛 False positive 'Return annotation not ending with ]' on union retun type #44

s-weigand opened this issue Jul 13, 2023 · 1 comment · Fixed by #45

Comments

@s-weigand
Copy link
Contributor

s-weigand commented Jul 13, 2023

For union return types that start with tuple[ (e.g. my use case tuple[Figure, Axis] | None) InternalError is raised false positively.
This is because _isTuple returns True for union types

def _isTuple(self) -> bool:
return (
self.annotation is not None
and self.annotation.lower().startswith('tuple[')
)

And consecutive checks are meant to work with pure tuples.

@jsh9
Copy link
Owner

jsh9 commented Jul 14, 2023

Hi @s-weigand , thank you for finding out this edge case! I'm still using the old-school Union[..., ...] so I didn't think of this edge case.

I've submitted a PR to fix this bug. Would you mind taking a look and see whether I've missed any other edge cases?

Thanks again!

@jsh9 jsh9 closed this as completed in #45 Jul 15, 2023
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 a pull request may close this issue.

2 participants