mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:57:35 +00:00
AK: Check the return type in IsCallableWithArguments
Template argument are checked to ensure that the `Out` type is equal or convertible to the type returned by the invokee. Compilation now fails on: `Function<void()> f = []() -> int { return 0; };` But this is allowed: `Function<ErrorOr<int>()> f = []() -> int { return 0; };`
This commit is contained in:
parent
d9f632fee7
commit
79006c03b4
4 changed files with 21 additions and 15 deletions
|
@ -139,9 +139,9 @@ private:
|
|||
|
||||
ErrorOr<void, ParseError> expect(StringView);
|
||||
template<typename Pred>
|
||||
requires(IsCallableWithArguments<Pred, char>) ErrorOr<StringView, ParseError> expect(Pred, StringView description);
|
||||
requires(IsCallableWithArguments<Pred, bool, char>) ErrorOr<StringView, ParseError> expect(Pred, StringView description);
|
||||
template<typename Pred>
|
||||
requires(IsCallableWithArguments<Pred, char>) ErrorOr<StringView, ParseError> expect_many(Pred, StringView description);
|
||||
requires(IsCallableWithArguments<Pred, bool, char>) ErrorOr<StringView, ParseError> expect_many(Pred, StringView description);
|
||||
|
||||
static size_t s_debug_indent_level;
|
||||
[[nodiscard]] auto rollback_point(SourceLocation location = SourceLocation::current())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue