Type hints from keyword arguments to named parameters.
ClosedPublic

Authored by flherne on Dec 28 2016, 9:28 PM.

Details

Reviewers
brauch
Summary

Type hints from keyword arguments to named parameters.

Before, all types of keyword arguments were rolled into the **kwargs parameter, if present, or ignored.

When a keyword argument's name matches that of a normal parameter, its type should be used as a hint for that and not for **kwargs.

See tests for examples.

Test Plan

No changes in existing tests. Four new tests that previously failed and now pass.

duchainify stress-testing currently

Diff Detail

Repository
R53 KDevelop: Python Support
Lint
Lint Skipped
Unit
Unit Tests Skipped
flherne updated this revision to Diff 9425.Dec 28 2016, 9:28 PM
flherne retitled this revision from to Type hints from keyword arguments to named parameters..
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 28 2016, 9:28 PM
brauch accepted this revision.Dec 28 2016, 9:53 PM
brauch edited edge metadata.

Looks ok and makes sense except for the two remarks. Thanks!

duchain/declarationbuilder.cpp
965 ↗(On Diff #9425)

!= instead of > ?

1061 ↗(On Diff #9425)

remove

This revision is now accepted and ready to land.Dec 28 2016, 9:53 PM
flherne updated this revision to Diff 9426.Dec 28 2016, 10:26 PM
flherne edited edge metadata.
flherne marked 2 inline comments as done.

Address review comments.

keyword->argumentName can be null, because in foo(**{'a': 2}) the unpacked dict counts as a keyword node. Don't segfault on that.