Skip to content

PEP 661 sentinel support #3589

@inducer

Description

@inducer

Describe the Bug

When running pyrefly on this snippet:

from __future__ import annotations

from typing import TypeAlias

from typing_extensions import Sentinel


AUTO = Sentinel("AUTO")


ToLoopyTypeConvertible: TypeAlias = AUTO

configured with preset = "strict", I get the following error:

ERROR Expected `ToLoopyTypeConvertible` to be a type alias, got `Sentinel` [invalid-type-alias]
  --> sent.py:11:37
   |
11 | ToLoopyTypeConvertible: TypeAlias = AUTO
   |                                     ^^^^
   |
 INFO 1 error

basedpyright (and pyright configured with experimental features) accepts this code.

This is with pyrefly 1.0.0. The sandbox link reproduces the issue for me.

Sandbox Link

https://pyrefly.org/sandbox/?project=N4IgZglgNgpgziAXKOBDAdgEwEYHsAeAdAA4CeS4ATrgLYAEA%2Bg2AK4AuLlMTdENxuSmzoZ0uNqjYRc6OAB10CsNXptSxCOgDmvfoOEAVdTACCUCKnmL0y2nTUbtDGPjYxZ02boFC6AZXcpdBgoBTD0EwBVAwB5OgBef0DNEIAKORAo2IyASnCFA1wAGVxcMiNiGABhGQA3GCEIbFhEOgrTc0sEuiyYhRAAGhAyLjAoUkI2WigKYi44GGFEjLg2SggAYzYMkABfIdQtiHqAMWgYCjQsPCIyPaA

(Only applicable for extension issues) IDE Information

No response

Metadata

Metadata

Assignees

No one assigned
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions