Skip to content
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

InlayHint for operator() #1742

Closed
zyn0217 opened this issue Aug 22, 2023 · 2 comments
Closed

InlayHint for operator() #1742

zyn0217 opened this issue Aug 22, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@zyn0217
Copy link

zyn0217 commented Aug 22, 2023

We don't show parameter hints for a user-defined function call operator() nor a call to lambda, for example:

struct S {
  void operator()(int x, int y) const;
};

void foo() {
  auto lambda = [](auto x) {};
  S()(1, 2); // nothing here.
  lambda("abcd") // nothing here.
}

This seems to be intended, as per the comment from InlayHints.cpp:

// Do not show parameter hints for operator calls written using operator
// syntax or user-defined literals. (Among other reasons, the resulting
// hints can look awkard, e.g. the expression can itself be a function
// argument and then we'd get two hints side by side).

However, I think it'd be fine to be lenient on function call to operator(): They are formed in a normal function call syntax, and I didn't find a case where they are inappropriate.

Nathan, what do you think? @HighCommander4

@zyn0217 zyn0217 added the enhancement New feature or request label Aug 22, 2023
@zyn0217 zyn0217 changed the title InlayHint for function call expression InlayHint for operator() Aug 22, 2023
@zyn0217
Copy link
Author

zyn0217 commented Aug 26, 2023

@HighCommander4
Copy link

However, I think it'd be fine to be lenient on function call to operator(): They are formed in a normal function call syntax, and I didn't find a case where they are inappropriate.

Nathan, what do you think? @HighCommander4

+1, that seems like an oversight

zyn0217 added a commit to llvm/llvm-project that referenced this issue Sep 10, 2023
@zyn0217 zyn0217 closed this as completed Sep 10, 2023
ZijunZhaoCCK pushed a commit to ZijunZhaoCCK/llvm-project that referenced this issue Sep 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants