[ty] don't eagerly unpack aliases in user-authored unions by carljm · Pull Request #20055 · astral-sh/ruff (original) (raw)

@carljm added the ty

Multi-file analysis & type inference

label

Aug 23, 2025

AlexWaygood

AlexWaygood

@carljm carljm marked this pull request as draft

August 23, 2025 23:48

@carljm carljm changed the title[ty] fix a recursive alias case via less eager union simplification [ty] don't eagerly unpack aliases in user-authored unions

Aug 26, 2025

@carljm carljm marked this pull request as ready for review

August 26, 2025 23:28

@carljm carljm deleted the cjm/aliasinunion branch

August 26, 2025 23:29

carljm added a commit to leandrobbraga/ruff that referenced this pull request

Aug 27, 2025

@carljm

second-ed pushed a commit to second-ed/ruff that referenced this pull request

Sep 9, 2025

@carljm @second-ed

…20055)

Summary

Add a subtly different test case for recursive PEP 695 type aliases, which does require that we relax our union simplification, so we don't eagerly unpack aliases from user-provided union annotations.

Test Plan

Added mdtest.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})