[PATCH] D73649: [CodeComplete] Member completion for concept-constrained types.

Nathan Ridge via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 18 15:34:29 PST 2020


nridge added a comment.

Thanks for looking at this! Sorry for the late response, I was travelling for a few weeks.

So far I've only had a chance to look at the tests.



================
Comment at: clang/test/CodeCompletion/concepts.cpp:34
+  // RUN: | FileCheck %s -check-prefix=DOT -implicit-check-not=xxx_t
+  // DOT: Pattern : [#convertible_to<double>#]aaa()
+  // DOT: Pattern : bb() (requires fix-it: {{.*}} to "->")
----------------
Doesn't the presence of the `x` mean we should only get results that start with `x`?

(Or, if "column 5" actually means we're completing right after the dot, why is the `x` present in the testcase at all -- just so that the line is syntactically well formed?)


================
Comment at: clang/test/CodeCompletion/concepts.cpp:35
+  // DOT: Pattern : [#convertible_to<double>#]aaa()
+  // DOT: Pattern : bb() (requires fix-it: {{.*}} to "->")
+  // DOT: Pattern : bbb()
----------------
Should we be taking completions from just one branch of a logical-or in a requirement?

To simplify the scenario a bit:

```
template <typename T>
  requires (requires(T t) { t.foo(); } || requires(T t) { t.bar(); })
void f(T t) {
  t.^
}
```

Do we want to be offering both `foo()` and `bar()` as completions here? Logically, it seems we only ought to offer completions from expressions that appear in _both_ branches of the logical-or (so, if `t.foo()` appeared as a requirement in both branches, we could offer `foo()`).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73649/new/

https://reviews.llvm.org/D73649





More information about the cfe-commits mailing list