Skip to content

Type "def func1() -> Unknown | def func2() -> Unknown" is not callable #406

@jschear

Description

@jschear

I'm using a feature flag to migrate from usage of one macro to another in a Bazel codebase, using roughly this structure:

def func1():
    pass

def func2():
    pass

my_func = func1 if True else func2

my_func()

starpls emits a warning on my_func():

Type "def func1() -> Unknown | def func2() -> Unknown" is not callable

Ideally the type checker could see that both branches of the optional type are themselves callable, and avoid a warning here.

This is using starpls v0.1.21, along with --experimental_infer_ctx_attributes, --experimental_use_code_flow_analysis, and --experimental_enable_label_completions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions