================
@@ -1637,6 +1678,144 @@ TEST(TypeHints, SubstTemplateParameterAliases) {
                         ExpectedHint{": static_vector<int>", "vector_name"});
 }
 
+template <typename... Labels>
+void assertTypeLinkHints(StringRef Code, StringRef HintRange,
+                         Labels... ExpectedLabels) {
+  Annotations Source(Code);
+  auto HintAt = [&](llvm::ArrayRef<InlayHint> InlayHints,
+                    llvm::StringRef Range) {
----------------
HighCommander4 wrote:

This lambda doesn't seem to give us much, it's only called once.

Suggestion: inline its contents, so below we have:

```c++
  auto Hints = hintsOfKind(AST, InlayHintKind::Type);
  auto Hint = llvm::find_if(Hints, [&](const InlayHint &InlayHint) {
    return InlayHint.range == Source.range(HintRange);
  });
```

Now we can use gtest facilities to issue a more informative assert message:

```c++
  ASSERT_TRUE(Hint != Hints.end()) << "No hint was found at " << HintRange;
```

(Last line then becomes `EXPECT_THAT(Hint->label, ElementsAre(...));`)

https://github.com/llvm/llvm-project/pull/86629
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to