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

Francis Herne noreply at phabricator.kde.org
Fri May 19 13:24:45 UTC 2017


flherne accepted this revision.
flherne added a comment.
This revision is now accepted and ready to land.


  This makes sense, I only have trivial things to mention. Compiling to test it now. Thanks!

INLINE COMMENTS

> expressionvisitor.cpp:736
>  {
> -    AstDefaultVisitor::visitBooleanOperation(node);
> -    encounter(AbstractType::Ptr(new IntegralType(IntegralType::TypeBoolean)));
> +    ExpressionVisitor visitor(this);
> +    AbstractType::Ptr result;

Nitpick - convention for these is either just `v` or `operandVisitor` (the latter usually when then there's more than one). I don't have a strong opinion.

> pyduchaintest.cpp:510
> +    QTest::newRow("check_unsure_type_4") << "checkme = True or False" << "bool";
> +    QTest::newRow("check_unsure_type_5") << "a = \"foo\"; checkme = a or \"bar\";" << "str";
> +    QTest::newRow("check_unsure_type_6") << "class A(): pass\nclass B(): pass;\ncheckme = A() or B() or 42;" << "unsure (A, B, int)";

Nitpick - you can use single quotes for the Python strings, instead of backslashed double-quotes. They're semantically identical.

REPOSITORY
  R53 KDevelop: Python Support

BRANCH
  master

REVISION DETAIL
  https://phabricator.kde.org/D5915

To: nalvarez, brauch, flherne
Cc: flherne, kdevelop-devel, geetamc, Pilzschaf, akshaydeo, surgenight, arrowdodger
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20170519/e90f129c/attachment.html>


More information about the KDevelop-devel mailing list