Improve doc-hints `returnContentEqualsContentOf` and `addsTypeOfArgContent`
ClosedPublic

Authored by flherne on Jan 2 2017, 6:36 PM.

Details

Summary

These only worked when the source type was a ListType-based container.
Most notably, this excluded tuples, so list((1, 2, 3)) didn't work.

This was also wrong when the source was a dict - it uses the key type, so list({'a': 1}) should be list of str rather than list of int. Custom iterable types weren't supported.

Regression for dict({'a': 1}) - before, it got type dict of int` - the key type was lost, but at least the value type was correct.
Now it gets type dict of str, which is just plain wrong.
The sequence-of-tuples case was never handled; we really just need a new hint for this method.

Test Plan

One test (dict_of_int_call) goes from passing (but partially incorrect) to failing.
One new XFAIL test (dict_from_tuples).

Improved two tests; still pass (dict_of_int, dict_access)
Six new tests fail->pass.

Not duchainified yet.

Diff Detail

Repository
R53 KDevelop: Python Support
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
flherne updated this revision to Diff 9611.Jan 2 2017, 6:36 PM
flherne retitled this revision from to Improve doc-hints `returnContentEqualsContentOf` and `addsTypeOfArgContent`.
flherne updated this object.
flherne edited the test plan for this revision. (Show Details)
flherne added a reviewer: brauch.
flherne set the repository for this revision to R53 KDevelop: Python Support.
Restricted Application added a subscriber: kdevelop-devel. · View Herald TranscriptJan 2 2017, 6:36 PM
brauch accepted this revision.Jan 2 2017, 7:15 PM
brauch edited edge metadata.

The regression is ok for me, the case is strange anyways and it's not much worse than before. Otherwise LGTM. Thanks!

This revision is now accepted and ready to land.Jan 2 2017, 7:15 PM
This revision was automatically updated to reflect the committed changes.