@@ -3271,10 +3271,13 @@ TEST(SignatureHelpTest, SkipExplicitObjectParameter) {
32713271 Annotations Code (R"cpp(
32723272 struct A {
32733273 void foo(this auto&& self, int arg);
3274+ void bar(this A self, int arg);
32743275 };
32753276 int main() {
32763277 A a {};
3277- a.foo(^);
3278+ a.foo($c1^);
3279+ (&A::bar)($c2^);
3280+ // TODO: (&A::foo)(^c3)
32783281 }
32793282 )cpp" );
32803283
@@ -3287,12 +3290,22 @@ TEST(SignatureHelpTest, SkipExplicitObjectParameter) {
32873290 auto Preamble = TU.preamble ();
32883291 ASSERT_TRUE (Preamble);
32893292
3290- const auto Result = signatureHelp (testPath (TU.Filename ), Code.point (),
3291- *Preamble, Inputs, MarkupKind::PlainText);
3293+ {
3294+ const auto Result = signatureHelp (testPath (TU.Filename ), Code.point (" c1" ),
3295+ *Preamble, Inputs, MarkupKind::PlainText);
3296+
3297+ EXPECT_EQ (1 , Result.signatures .size ());
3298+
3299+ EXPECT_THAT (Result.signatures [0 ], AllOf (sig (" foo([[int arg]]) -> void" )));
3300+ }
3301+ {
3302+ const auto Result = signatureHelp (testPath (TU.Filename ), Code.point (" c2" ),
3303+ *Preamble, Inputs, MarkupKind::PlainText);
32923304
3293- EXPECT_EQ (1 , Result.signatures .size ());
3305+ EXPECT_EQ (1 , Result.signatures .size ());
32943306
3295- EXPECT_THAT (Result.signatures [0 ], AllOf (sig (" foo([[int arg]]) -> void" )));
3307+ EXPECT_THAT (Result.signatures [0 ], AllOf (sig (" ([[A]], [[int]]) -> void" )));
3308+ }
32963309}
32973310
32983311TEST (CompletionTest, IncludedCompletionKinds) {
@@ -4397,11 +4410,14 @@ TEST(CompletionTest, SkipExplicitObjectParameter) {
43974410 Annotations Code (R"cpp(
43984411 struct A {
43994412 void foo(this auto&& self, int arg);
4413+ void bar(this A self, int arg);
44004414 };
44014415
44024416 int main() {
44034417 A a {};
4404- a.^
4418+ a.$c1^s
4419+ (&A::ba$c2^;
4420+ // TODO: (&A::fo$c3^
44054421 }
44064422 )cpp" );
44074423
@@ -4415,12 +4431,24 @@ TEST(CompletionTest, SkipExplicitObjectParameter) {
44154431
44164432 MockFS FS;
44174433 auto Inputs = TU.inputs (FS);
4418- auto Result = codeComplete (testPath (TU.Filename ), Code.point (),
4419- Preamble.get (), Inputs, Opts);
4420-
4421- EXPECT_THAT (Result.Completions ,
4422- ElementsAre (AllOf (named (" foo" ), signature (" (int arg)" ),
4423- snippetSuffix (" (${1:int arg})" ))));
4434+ {
4435+ auto Result = codeComplete (testPath (TU.Filename ), Code.point (" c1" ),
4436+ Preamble.get (), Inputs, Opts);
4437+
4438+ EXPECT_THAT (Result.Completions ,
4439+ UnorderedElementsAre (AllOf (named (" foo" ), signature (" (int arg)" ),
4440+ snippetSuffix (" (${1:int arg})" )),
4441+ AllOf (named (" bar" ), signature (" (int arg)" ),
4442+ snippetSuffix (" (${1:int arg})" ))));
4443+ }
4444+ {
4445+ auto Result = codeComplete (testPath (TU.Filename ), Code.point (" c2" ),
4446+ Preamble.get (), Inputs, Opts);
4447+ // TODO: snippet suffix is empty for c2
4448+ EXPECT_THAT (Result.Completions ,
4449+ ElementsAre (AllOf (named (" bar" ), signature (" (int arg)" ),
4450+ snippetSuffix (" " ))));
4451+ }
44244452}
44254453} // namespace
44264454} // namespace clangd
0 commit comments