From db01c82b08bf20e5260810dccdec7ff4936934eb Mon Sep 17 00:00:00 2001 From: Stephan Seitz Date: Sun, 28 Nov 2021 18:05:18 +0100 Subject: highlights(cpp): add support for concepts Requires https://github.com/tree-sitter/tree-sitter-cpp/pull/138 --- tests/query/highlights/cpp/concepts.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tests/query/highlights/cpp/concepts.cpp (limited to 'tests/query/highlights/cpp/concepts.cpp') diff --git a/tests/query/highlights/cpp/concepts.cpp b/tests/query/highlights/cpp/concepts.cpp new file mode 100644 index 000000000..07e2313ea --- /dev/null +++ b/tests/query/highlights/cpp/concepts.cpp @@ -0,0 +1,22 @@ + +template +concept Derived = std::is_base_of::value; +// ^ keyword +// ^ type + +template +concept Hashable = requires(T a) { +// ^ keyword +// ^ parameter +// ^ type + { std::hash{}(a) } -> std::convertible_to; + typename CommonType; // CommonType is valid and names a type + { CommonType{std::forward(t)} }; + { CommonType{std::forward(u)} }; +}; + + +template + requires requires (T x) { x + x; } // ad-hoc constraint, note keyword used twice +// ^ keyword +T add(T a, T b) { return a + b; } -- cgit v1.2.3-70-g09d2