starpls icon indicating copy to clipboard operation
starpls copied to clipboard

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

Open jschear opened this issue 3 months ago • 0 comments

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.

jschear avatar Sep 04 '25 21:09 jschear