From 332f60c19336252d907b83882aa70665ca93a9d2 Mon Sep 17 00:00:00 2001 From: Ellie Hermaszewska Date: Fri, 12 May 2023 04:33:21 +0800 Subject: MVP for higher order functions (#2849) * MVP for higher order functions * Add shader subgroup partitioned glsl intrinsics * Implement parsing and checking for tuple types Currently there is no way to do anything useful with them from the source language however * neaten * Correct precedence of function type parsing * neaten * higher order function tests * function types of any arity * Inference for higher order functions * Add second test for unsynchronized params * regenerate vs projects * dx11 -> dx12 for saturated cooperations tests * Disable saturated cooperation tests on vulkan They fail on release builds in CI, not essential for the higher order function work however * remove saturated-cooperation tests * Remove unnecessary assert and clarify control flow in AddDeclRefOverloadCandidates * Add Tuple type name mangling * Use functype keyword to introduce function types * Add more inference tests for hof --------- Co-authored-by: Yong He --- source/slang/slang-check-impl.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (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 2a78fa999..efc3989e2 100644 --- a/source/slang/slang-check-impl.h +++ b/source/slang/slang-check-impl.h @@ -1528,7 +1528,7 @@ namespace Slang SourceLoc loc; // The original expression (if any) that triggered things - Expr* originalExpr = nullptr; + AppExprBase* originalExpr = nullptr; // Source location of the "function" part of the expression, if any SourceLoc funcLoc; @@ -1695,6 +1695,11 @@ namespace Slang FuncType* /*funcType*/, OverloadResolveContext& /*context*/); + void AddFuncExprOverloadCandidate( + FuncType* funcType, + OverloadResolveContext& context, + Expr* expr); + // Add a candidate callee for overload resolution, based on // calling a particular `ConstructorDecl`. void AddCtorOverloadCandidate( @@ -1966,6 +1971,8 @@ namespace Slang Expr* visitAndTypeExpr(AndTypeExpr* expr); Expr* visitPointerTypeExpr(PointerTypeExpr* expr); Expr* visitModifiedTypeExpr(ModifiedTypeExpr* expr); + Expr* visitFuncTypeExpr(FuncTypeExpr* expr); + Expr* visitTupleTypeExpr(TupleTypeExpr* expr); Expr* visitForwardDifferentiateExpr(ForwardDifferentiateExpr* expr); Expr* visitBackwardDifferentiateExpr(BackwardDifferentiateExpr* expr); -- cgit v1.2.3