While here, fix an ugliness:
auto foo()->auto { return 42; }
This (silly) code gains a "-> int" hint. While correct and useful, it renders as
auto foo()->int->auto { return 42; }
which is confusing enough to do more harm than good I think.
Paths
| Differential D120416
[clangd] Function return type hints: support lambdas, don't duplicate "->" ClosedPublic Authored by sammccall on Feb 23 2022, 7:59 AM.
Details Summary While here, fix an ugliness: auto foo()->auto { return 42; } This (silly) code gains a "-> int" hint. While correct and useful, it renders as auto foo()->int->auto { return 42; } which is confusing enough to do more harm than good I think.
Diff Detail
Event TimelineHerald added subscribers: usaxena95, kadircet, arphaman, kristof.beyls. · View Herald TranscriptFeb 23 2022, 7:59 AM Comment Actions Nice!
This revision is now accepted and ready to land.Feb 23 2022, 11:50 AM
Closed by commit rG257559ed9ab7: [clangd] Function return type hints: support lambdas, don't duplicate "->" (authored by sammccall). · Explain WhyFeb 26 2022, 12:36 PM This revision was automatically updated to reflect the committed changes. sammccall marked an inline comment as done.
Revision Contents
Diff 411637 clang-tools-extra/clangd/InlayHints.cpp
clang-tools-extra/clangd/unittests/InlayHintTests.cpp
|
Maybe add a comment like "use digraphs to place a literal ] in an annotation range"