[clangd] Test fixes missing from 257559ed9

This commit is contained in:
Sam McCall 2022-02-26 21:38:25 +01:00
parent 257559ed9a
commit 42cb812da7

View file

@ -536,6 +536,7 @@ TEST(TypeHints, Lambda) {
ExpectedHint{": int", "init"}, ExpectedHint{"-> int", "ret"}); ExpectedHint{": int", "init"}, ExpectedHint{"-> int", "ret"});
// Lambda return hint shown even if no param list. // Lambda return hint shown even if no param list.
// (The digraph :> is just a ] that doesn't conflict with the annotations).
assertTypeHints("auto $L[[x]] = <:$ret[[:>]]{return 42;};", assertTypeHints("auto $L[[x]] = <:$ret[[:>]]{return 42;};",
ExpectedHint{": (lambda)", "L"}, ExpectedHint{": (lambda)", "L"},
ExpectedHint{"-> int", "ret"}); ExpectedHint{"-> int", "ret"});
@ -624,6 +625,8 @@ TEST(TypeHints, ReturnTypeDeduction) {
// Do not hint when a trailing return type is specified. // Do not hint when a trailing return type is specified.
auto f4() -> auto* { return "foo"; } auto f4() -> auto* { return "foo"; }
auto f5($noreturn[[)]] {}
// `auto` conversion operator // `auto` conversion operator
struct A { struct A {
operator auto($retConv[[)]] { return 42; } operator auto($retConv[[)]] { return 42; }
@ -636,7 +639,8 @@ TEST(TypeHints, ReturnTypeDeduction) {
}; };
)cpp", )cpp",
ExpectedHint{"-> int", "ret1a"}, ExpectedHint{"-> int", "ret1b"}, ExpectedHint{"-> int", "ret1a"}, ExpectedHint{"-> int", "ret1b"},
ExpectedHint{"-> int &", "ret2"}, ExpectedHint{"-> int", "retConv"}); ExpectedHint{"-> int &", "ret2"}, ExpectedHint{"-> void", "noreturn"},
ExpectedHint{"-> int", "retConv"});
} }
TEST(TypeHints, DependentType) { TEST(TypeHints, DependentType) {