Skip to content

Conversation

@yangdanny97
Copy link
Contributor

See inline comments for why

# > constructor. Instead, the call performs a value-based lookup of an
# > enum member.

assert_type(Color["RED"], Color) # 'Literal[Color.RED]' is also acceptable
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

felt odd to assert_type here and say that another type is also acceptable. I tried to put both versions down, so that type checkers have discretion on which one to implement w/o the test failing.

I assume that if a checker emits an error on both lines the test will fail - could the maintainers please confirm this assumption?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's right; this is documented in the "Test case syntax" section in conformance/README.


@overload # E[method4]
def method4(self, x: int) -> int:
def method4(self, x: int) -> int: # E[method4]
Copy link
Contributor Author

@yangdanny97 yangdanny97 Jul 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pyrefly emits diagnostics on the line of the def, not the line with the @overload

This is similar to what I did in #1980

@rchen152 rchen152 merged commit d4f39b2 into python:main Jul 22, 2025
4 checks passed
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 this pull request may close these issues.

3 participants