Skip to content

conformance: fix TypeIs case#2298

Open
JelleZijlstra wants to merge 1 commit into
python:mainfrom
JelleZijlstra:typeis-tuple
Open

conformance: fix TypeIs case#2298
JelleZijlstra wants to merge 1 commit into
python:mainfrom
JelleZijlstra:typeis-tuple

Conversation

@JelleZijlstra
Copy link
Copy Markdown
Member

@JelleZijlstra JelleZijlstra commented Jun 1, 2026

Strictly, the inferred type in the old code should be tuple[str, ...] & ~tuple[str, str]: that is,
a tuple full of strs of any length that is not 2. Currently no type checker actually infers this
type, but I'm working on a change to pycroscope (JelleZijlstra/pycroscope#505) that will make it fail this test.

ty also infers the negation type, but passes the test because the conformance suite turns off
the specific "assert-type-unspellable-subtype" error code.

The new code in the test case does not rely on ambiguous negation type behavior.

Strictly, the inferred type in the old code should be `tuple[str, ...] & ~tuple[str, str]`: that is,
a tuple full of strs of any length that is not 2. Currently no type checker actually infers this
type, but I'm working on a change to pycroscope that will make it fail this test.

ty also infers the negation type, but passes the test because the conformance suite turns off
the specific "assert-type-unspellable-subtype" error code.
@AlexWaygood AlexWaygood added the topic: conformance tests Issues with the conformance test suite label Jun 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic: conformance tests Issues with the conformance test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants