-
Notifications
You must be signed in to change notification settings - Fork 15.6k
[clang][CodeComplete] skip explicit obj param in SignatureHelp #146649
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,48 @@ | ||
| struct A { | ||
| void foo(this A self, int arg); | ||
| void foo(this auto&& self, int arg); | ||
| void bar(this A self, int arg); | ||
| }; | ||
|
|
||
| int main() { | ||
| int func1() { | ||
| A a {}; | ||
| a. | ||
| } | ||
| // RUN: %clang_cc1 -cc1 -fsyntax-only -code-completion-at=%s:%(line-2):5 -std=c++23 %s | FileCheck %s | ||
| // CHECK: COMPLETION: A : A:: | ||
| // CHECK-NEXT: COMPLETION: foo : [#void#]foo(<#int arg#>) | ||
| // CHECK-NEXT: COMPLETION: operator= : [#A &#]operator=(<#const A &#>) | ||
| // CHECK-NEXT: COMPLETION: operator= : [#A &#]operator=(<#A &&#>) | ||
| // CHECK-NEXT: COMPLETION: ~A : [#void#]~A() | ||
| // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-2):5 -std=c++23 %s | FileCheck -check-prefix=CHECK-CC1 %s | ||
| // CHECK-CC1: COMPLETION: A : A:: | ||
| // CHECK-NEXT-CC1: COMPLETION: bar : [#void#]bar(<#int arg#>) | ||
| // CHECK-NEXT-CC1: COMPLETION: foo : [#void#]foo(<#int arg#>) | ||
| // CHECK-NEXT-CC1: COMPLETION: operator= : [#A &#]operator=(<#const A &#>) | ||
| // CHECK-NEXT-CC1: COMPLETION: operator= : [#A &#]operator=(<#A &&#>) | ||
| // CHECK-NEXT-CC1: COMPLETION: ~A : [#void#]~A() | ||
|
|
||
| struct B { | ||
| template <typename T> | ||
| void foo(this T&& self, int arg); | ||
| }; | ||
|
|
||
| int func2() { | ||
| B b {}; | ||
| b.foo(); | ||
| } | ||
| // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-2):9 -std=c++23 %s | FileCheck -check-prefix=CHECK-CC2 %s | ||
| // CHECK-CC2: OVERLOAD: [#void#]foo(int arg) | ||
|
||
|
|
||
| // TODO: llvm/llvm-project/146649 | ||
| // This is incorrect behavior. Correct Result should be a variant of, | ||
| // CC3: should be something like [#void#]foo(<#A self#>, <#int arg#>) | ||
| // CC4: should be something like [#void#]bar(<#A self#>, <#int arg#>) | ||
| int func3() { | ||
| (&A::foo) | ||
| (&A::bar) | ||
| } | ||
| // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-3):10 -std=c++23 %s | FileCheck -check-prefix=CHECK-CC3 %s | ||
| // CHECK-CC3: COMPLETION: foo : [#void#]foo<<#class self:auto#>>(<#int arg#>) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (As discussed in the unit test, this signature is not what we want and we should add a comment saying so.) |
||
| // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-4):10 -std=c++23 %s | FileCheck -check-prefix=CHECK-CC4 %s | ||
| // CHECK-CC4: COMPLETION: bar : [#void#]bar(<#int arg#>) | ||
|
|
||
| int func4() { | ||
| // TODO (&A::foo)( | ||
| (&A::bar)( | ||
| } | ||
| // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-2):13 -std=c++23 %s | FileCheck -check-prefix=CHECK-CC5 %s | ||
| // CHECK-CC5: OVERLOAD: [#void#](<#A#>, int) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Multiple things about this seem to be wrong:
(&A::foo)(a, 42);most of the time, not(&A::foo<A>)(a, 42);).It's fine to assert the current (buggy) behaviour, but please add a comment describing why it's wrong, and what we should get instead.