Bug 292170 - Type collection from ternary operation broken
Summary: Type collection from ternary operation broken
Alias: None
Product: kdev-python
Classification: Developer tools
Component: general (show other bugs)
Version: git master
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
Depends on:
Reported: 2012-01-22 09:20 UTC by Eike Hein
Modified: 2012-01-22 10:53 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Note You need to log in before you can comment on or make changes to this bug.
Description Eike Hein 2012-01-22 09:20:52 UTC

def foo(bar):
    x = 1 if bar else 2.0
    return x

... kdev-python will show the type of x as float, and accordingly the return type of foo as well. Yet it should be unsure(int, float).
Comment 1 Sven Brauch 2012-01-22 10:43:52 UTC
Git commit d3f52a0d60a39470b18caa0c2c7d8bb482fd058d by Sven Brauch.
Committed on 22/01/2012 at 11:42.
Pushed by brauch into branch 'master'.

implement type support for ternary operators

foo = 3 if False else "str" # <- foo:unsure(int,str)

M  +1    -0    documentation_files/builtindocumentation.py
M  +16   -0    duchain/expressionvisitor.cpp
M  +1    -0    duchain/expressionvisitor.h

Comment 2 Eike Hein 2012-01-22 10:53:47 UTC
Thanks, fix confirmed :).