Skip to content

Doesn't allow list["A|B"] #3193

Closed
Closed

Description

@MarcoGorelli

Describe the Bug

from __future__ import annotations
from typing import reveal_type

class Tomato:
    ...

class Cucumber:
    ...

def main(t: Tomato) -> None:
    a = list["Tomato | Cucumber"]([t])
    reveal_type(a)
ERROR sandbox.py:11:14-33: Expected a type form, got instance of `Literal['Tomato | Cucumber']` [[not-a-type](https://pyrefly.org/en/docs/error-kinds/#not-a-type)]

all other type checkers are fine with this

Sandbox Link

https://pyrefly.org/sandbox/?project=N4IgZglgNgpgziAXKOBDAdgEwEYHsAeAdAA4CeS4ATrgLYAEA%2Bg2AK4AuLlMTdENxuSmzoZ0uNqjYRc6OAB10YavTaliEdAHNe-QcK4A3GKigNVxGAoUBjKKjhw6AFVqTciBXS91Cvq%2Blt7RwBhFmsWGmwYSg90bx8-dAVMGDA6GlQNAAo2RGdXNlwASjoAWgA%2BOgA5GRhY%2BNQ6AF46KAg4NgBtORAXDMK6AB86UPDI6J6AXSzOtkmiz29DY1NzGCzUIpAAGhAyLjAoUkJCmigKAGI6AAVSA6O6NCw8fDprGUhNTklpdEIFK4AZRgMDoAAs2GxiHBEAB6WH7VJHQiCTSwmDoWGYXDWOCw96KCBfSg-GSwuhgQQiAyZOzYWBvD5E75SGR0XDEVmyf7oMhsMEyUpGShwX7NOg9ADMhAAjAAmHoKTrRagiyYKFjoPgCIQwTClTAQLjWKRGcUAciJYi45oUYjYpS4AEcWEa9aUANYwUilVDWazwRwtc0Ad1QlHQtvQIAAvrs-aaYAAxaAwChPHAEEjkGNAA

(Only applicable for extension issues) IDE Information

No response

Activity

  1. asukaminato0721 commented on Apr 21, 2026

    @asukaminato0721
    Collaborator

    claim

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

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions