Skip explicit `self` argument when calling via class.
ClosedPublic

Authored by flherne on Dec 10 2016, 10:58 PM.

Details

Reviewers
brauch
Summary

Instance methods can be called via the class:
Class.method(instance, arg)

Self arguments are handled separately. With an explicit instance argument as in the example, its type was wrongly used for the next argument with all subsequent argtypes offset by one.

BUG: 369364

Simply skip such arguments where they exist.

Test Plan

Test method_explicit_self previously failed, now passes.
Test parent_constructor_arg_type previously failed.
Now it fails on the first run, but gets the correct type if reloading the document.
Probably related to https://bugs.kde.org/show_bug.cgi?id=306213

Other new tests passed already.
No test regressions.

Diff Detail

Repository
R53 KDevelop: Python Support
Lint
Lint Skipped
Unit
Unit Tests Skipped
flherne updated this revision to Diff 8917.Dec 10 2016, 10:58 PM
flherne retitled this revision from to Skip explicit `self` argument when calling via class..
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 TranscriptDec 10 2016, 10:58 PM

This is sort of a temporary patch-up.

To solve https://bugs.kde.org/show_bug.cgi?id=288089, we need to do almost the opposite, and determine the self argument type from calls.
Such a solution would do more harm than good right now, because unsure class-types produce useless or incomplete results in most operations, so I think this makes sense for the moment.

Hm, this gets stuck in some sort of recursion in some cases...

flherne updated this revision to Diff 8991.Dec 13 2016, 10:02 PM

Held a readlock while calling visitNode(), which caused a repeat-locking failure in some unusual cases.

Release the lock earlier, and add a test that triggered that bug.

brauch accepted this revision.Dec 13 2016, 11:38 PM
brauch edited edge metadata.

Looks good to me, another thing I wanted to look into for ages. Thanks! Let's see if anything breaks :)

This revision is now accepted and ready to land.Dec 13 2016, 11:38 PM