From 9dfd5244ad2953753535e82acd05e72e5ab2bc5f Mon Sep 17 00:00:00 2001 From: Yong He Date: Fri, 16 May 2025 10:42:11 -0700 Subject: Allow lambda exprs without captures to coerce to `functype`. (#7129) --- source/slang/slang-check-impl.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'source/slang/slang-check-impl.h') diff --git a/source/slang/slang-check-impl.h b/source/slang/slang-check-impl.h index f0884503f..87f2df53d 100644 --- a/source/slang/slang-check-impl.h +++ b/source/slang/slang-check-impl.h @@ -1451,6 +1451,15 @@ public: /// void ensureDeclBase(DeclBase* decl, DeclCheckState state, SemanticsContext* baseContext); + // Check if `lambdaStruct` can be coerced to `funcType`, if so returns the coerced + // expression in `outExpr`. The coercion is only valid if the lambda struct + // does not contain any captures. + bool tryCoerceLambdaToFuncType( + DeclRef lambdaStruct, + FuncType* funcType, + Expr* fromExpr, + Expr** outExpr); + // A "proper" type is one that can be used as the type of an expression. // Put simply, it can be a concrete type like `int`, or a generic // type that is applied to arguments, like `Texture2D`. -- cgit v1.2.3