Skip to content

Conversation

@yangdanny97
Copy link
Contributor

Summary:

  • populate display name when untyping a union
  • keep name when simplifying
  • display the expanded type when the top level type being printed is the alias (only use the display name for nested types)

Differential Revision: D87558543

@meta-codesync
Copy link

meta-codesync bot commented Nov 20, 2025

@yangdanny97 has exported this pull request. If you are a Meta employee, you can view the originating Diff in D87558543.

yangdanny97 added a commit to yangdanny97/pyrefly that referenced this pull request Nov 21, 2025
Summary:
Pull Request resolved: facebook#1641

- populate display name when untyping a union
- keep name when simplifying
- display the expanded type when the top level type being printed is the alias (only use the display name for nested types)

Differential Revision: D87558543
yangdanny97 added a commit to yangdanny97/pyrefly that referenced this pull request Nov 21, 2025
Summary:
Pull Request resolved: facebook#1641

- populate display name when untyping a union
- keep name when simplifying
- display the expanded type when the top level type being printed is the alias (only use the display name for nested types)

Differential Revision: D87558543
yangdanny97 added a commit to yangdanny97/pyrefly that referenced this pull request Nov 21, 2025
Summary:
Pull Request resolved: facebook#1641

- populate display name when untyping a union
- keep name when simplifying
- display the expanded type when the top level type being printed is the alias (only use the display name for nested types)

Differential Revision: D87558543
yangdanny97 added a commit to yangdanny97/pyrefly that referenced this pull request Nov 24, 2025
Summary:
Pull Request resolved: facebook#1641

- populate display name when untyping a union
- keep name when simplifying
- display the expanded type when the top level type being printed is the alias (only use the display name for nested types)

Differential Revision: D87558543
Copy link
Contributor

@rchen152 rchen152 left a comment

Choose a reason for hiding this comment

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

Review automatically exported from Phabricator review in Meta.

yangdanny97 added a commit to yangdanny97/pyrefly that referenced this pull request Nov 24, 2025
Summary:
Pull Request resolved: facebook#1641

- populate display name when untyping a union
- keep name when simplifying
- display the expanded type when the top level type being printed is the alias (only use the display name for nested types)

Reviewed By: rchen152

Differential Revision: D87558543
yangdanny97 added a commit to yangdanny97/pyrefly that referenced this pull request Nov 25, 2025
Summary:
Pull Request resolved: facebook#1641

- populate display name when untyping a union
- keep name when simplifying
- display the expanded type when the top level type being printed is the alias (only use the display name for nested types)

Reviewed By: rchen152

Differential Revision: D87558543
yangdanny97 added a commit to yangdanny97/pyrefly that referenced this pull request Nov 25, 2025
Summary:
Pull Request resolved: facebook#1641

- populate display name when untyping a union
- keep name when simplifying
- display the expanded type when the top level type being printed is the alias (only use the display name for nested types)

Reviewed By: rchen152

Differential Revision: D87558543
@yangdanny97 yangdanny97 force-pushed the export-D87558543 branch 2 times, most recently from 6be69cb to b177923 Compare November 25, 2025 15:50
yangdanny97 added a commit to yangdanny97/pyrefly that referenced this pull request Nov 25, 2025
Summary:
Pull Request resolved: facebook#1641

- populate display name when untyping a union
- keep name when simplifying
- display the expanded type when the top level type being printed is the alias (only use the display name for nested types)

Reviewed By: rchen152

Differential Revision: D87558543
yangdanny97 added a commit to yangdanny97/pyrefly that referenced this pull request Nov 25, 2025
Summary:
Pull Request resolved: facebook#1641

- populate display name when untyping a union
- keep name when simplifying
- display the expanded type when the top level type being printed is the alias (only use the display name for nested types)

Reviewed By: rchen152

Differential Revision: D87558543
Summary:
This is an alternative to D84849556, which aims to solve facebook#1219

Instead of introducing a new type variant, this diff introduces a new field in Type::Union to hold an optional display name. It will be populated when resolving a type alias.

Compared to the other approach:

benefits
- less plumbing
- type checking behavior unaffected

drawbacks
- only applies to type aliases of unions (though arguably this is where readability matters most)
- name information is not preserved during union flattening (so if we union a type alias with something else, the result is the full expanded type)

Differential Revision: D87558541

Reviewed By: rchen152
yangdanny97 added a commit to yangdanny97/pyrefly that referenced this pull request Nov 25, 2025
Summary:
Pull Request resolved: facebook#1641

- populate display name when untyping a union
- keep name when simplifying
- display the expanded type when the top level type being printed is the alias (only use the display name for nested types)

Reviewed By: rchen152

Differential Revision: D87558543
Summary:
Pull Request resolved: facebook#1641

- populate display name when untyping a union
- keep name when simplifying
- display the expanded type when the top level type being printed is the alias (only use the display name for nested types)

Reviewed By: rchen152

Differential Revision: D87558543
@meta-codesync
Copy link

meta-codesync bot commented Nov 25, 2025

This pull request has been merged in ffc61b7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants