Bug 292170 - Type collection from ternary operation broken
Summary: Type collection from ternary operation broken
Status: RESOLVED FIXED
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
URL:
Keywords:
Depends on:
Blocks:
 
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:


Attachments

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
Given:

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

http://commits.kde.org/kdev-python/d3f52a0d60a39470b18caa0c2c7d8bb482fd058d
Comment 2 Eike Hein 2012-01-22 10:53:47 UTC
Thanks, fix confirmed :).