Skip to content

conformance: fix TypeIs case#2298

Merged
JelleZijlstra merged 1 commit into
python:mainfrom
JelleZijlstra:typeis-tuple
Jun 6, 2026
Merged

conformance: fix TypeIs case#2298
JelleZijlstra merged 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
@JelleZijlstra JelleZijlstra merged commit ecfd695 into python:main Jun 6, 2026
5 checks passed
@JelleZijlstra JelleZijlstra deleted the typeis-tuple branch June 6, 2026 05:32
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.

4 participants