Skip to content

Literal promotion for callables results in missing attributes #1344

@sharkdp

Description

@sharkdp

Consider:

def f(): ...
def g(): ...

for func in [f, g]:
    # Attribute `__name__` on type `Unknown | (() -> Unknown)` may be missing
    print(func.__name__)

https://play.ty.dev/f7296c98-e1f9-4fc1-a4af-338f40f485cf

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions