Created attachment 109431 [details] Acual result of hightlighting When declaring a global lambda, or sending a lambda into a function inside the global scope, all parameters of the lambda and variables in the body of the lambda are hightlighed light pink, as of they were all in the global scope. Expected result: All variables and parameter to be hightlighted in different colors.
Created attachment 109432 [details] Expected result of hightlighting
Created attachment 109433 [details] Expected result of hightlighting (fixed) Please refer to this one, the previous edited screenshot contained errors
how did you "fix" it? Anyway, easy to reproduce. Here's an MWE: int sum(int foo, int bar) { return foo + bar; } auto sum_lambda = [](int foo, int bar) { return foo + bar; }; int sum_lambda_wrapped(int bla, int blub) { return [](int foo, int bar) { return foo + bar; }(bla, blub); }
The fixed version of my screenshot simply removed the colored highlighting for the lambda names, since they are global themselves.
I mean: how did you get the correct highlighting? Do you have a patch available?
Ah! I simply enclosed all lambda in a function, took a screenshot and edited out the function in gimp. I didn't found a magic workaround for that unfortunately :)
Git commit 335786a16731b093bf6b027c8c51ef653425b73a by Milian Wolff, on behalf of Guillaume Racicot. Committed on 14/03/2018 at 22:51. Pushed by mwolff into branch 'master'. Make lambda introduce a context in DU chain Summary: Lambda in clang completion were not introducing a context. This had the effect of making all local variable in a global lambda highlighted as a global Reviewers: #kdevelop, mwolff Reviewed By: #kdevelop, mwolff Subscribers: kfunk, mwolff, kdevelop-devel Differential Revision: https://phabricator.kde.org/D11303 M +8 -3 plugins/clang/duchain/builder.cpp M +21 -0 plugins/clang/tests/test_duchain.cpp M +1 -0 plugins/clang/tests/test_duchain.h https://commits.kde.org/kdevelop/335786a16731b093bf6b027c8c51ef653425b73a
Git commit dd038eb1a8fb4d663fe03eb6bd6ebf16d8ace3d0 by Kevin Funk, on behalf of Guillaume Racicot. Committed on 15/03/2018 at 18:39. Pushed by kfunk into branch '5.2'. Make lambda introduce a context in DU chain Summary: Lambda in clang completion were not introducing a context. This had the effect of making all local variable in a global lambda highlighted as a global Reviewers: #kdevelop, mwolff Reviewed By: #kdevelop, mwolff Subscribers: kfunk, mwolff, kdevelop-devel Differential Revision: https://phabricator.kde.org/D11303 (cherry picked from commit 335786a16731b093bf6b027c8c51ef653425b73a) M +8 -3 plugins/clang/duchain/builder.cpp M +21 -0 plugins/clang/tests/test_duchain.cpp M +1 -0 plugins/clang/tests/test_duchain.h https://commits.kde.org/kdevelop/dd038eb1a8fb4d663fe03eb6bd6ebf16d8ace3d0