Skip to content

New Syntax: type alias / type A[T] = X (Python 3.12) #852

Open
1 of 2 issues completed
Open

Description

@lieryan

Is your feature request related to a problem? Please describe.

Look into what's needed to handle type keyword.

Activity

  1. changed the title [-]New Syntax: `type` keyword[/-] [+]New Syntax: `type` keyword (Python 3.12)[/+] on Aug 12, 2026
  2. changed the title [-]New Syntax: `type` keyword (Python 3.12)[/-] [+]New Syntax: type alias / `type A[T] = X` (Python 3.12)[/+] on Aug 20, 2026
  3. mcepl commented on Nov 2, 2026

    @mcepl
    Contributor

    @lieryan The patchedast part is done and released in 1.15.0. #854 added TypeAlias, and #845 added type parameters on aliases. get_patched_ast() handles both type Alias = int and type ListOf[T] = list[T], and write_ast() reproduces the source exactly.

    What's left is name resolution. Rename refuses Alias with "should be performed on resolvable python identifiers". That's #862, which PR #874 fixes. #874 deliberately leaves out renaming the alias's own type parameter, because that needs a scope for the alias. Should that become a separate sub-issue here, so this can be closed once #874 is merged?

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions