[ty] Fix subtyping of intersections containing newtypes of unions vs unions by AlexWaygood · Pull Request #24087 · astral-sh/ruff (original) (raw)

Summary

We recognise a newtype as a subtype of its concrete base type, and we even recognise newtypes of unions as a subtype of their concrete base type, but we do not currently recognise intersections of newtypes of unions as subtypes of the newtype's concrete base type. This PR fixes that.

Fixes astral-sh/ty#2940

Co-authored-by: Brent Westbrook brentrwestbrook@gmail.com

Test Plan

added mdtests that fail on main