Infer correct type from 'and' / 'or' expressions

Authored by nalvarez on May 20 2017, 12:56 AM.

Description

Infer correct type from 'and' / 'or' expressions

kdev-python was assuming boolean operator expressions like 'foo or bar'
always returned 'bool', but Python defines them to always return the value
of either variable depending on whether the first one is false-like. Thus,
'someString or "bar"' should be interpreted as a string, not a boolean.

This commit makes such boolean operator expressions have a type of
unsure(type(foo), type(bar)) instead. I also added new tests for this new
behavior, and to ensure the good old "True or False" is still interpreted
as a bool.

BUG:379961

Differential Revision: https://phabricator.kde.org/D5915

Details

Committed
nalvarezMay 20 2017, 12:56 AM
Differential Revision
D5915: Infer correct type from 'and' / 'or' expressions
Parents
R53:064969dc06a4: Install a categories file for KDebugSettings
Branches
Unknown
Tags
Unknown