Skip to content

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

@MarcoGorelli

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions