From 6aca3813c4ccc496c0f9b2db293acb546aa11d2d Mon Sep 17 00:00:00 2001 From: Yong He Date: Wed, 1 Nov 2023 21:42:12 -0700 Subject: Parameter binding and gfx fixes. (#3302) * Parameter binding and gfx fixes. * Add diagnostics on entry point parameters. * Fix. --------- Co-authored-by: Yong He --- source/slang/slang-ast-type.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'source/slang/slang-ast-type.cpp') diff --git a/source/slang/slang-ast-type.cpp b/source/slang/slang-ast-type.cpp index 840aa4a67..af4f6d124 100644 --- a/source/slang/slang-ast-type.cpp +++ b/source/slang/slang-ast-type.cpp @@ -19,7 +19,14 @@ Type* Type::_createCanonicalTypeOverride() Val* Type::_substituteImplOverride(ASTBuilder* astBuilder, SubstitutionSet subst, int* ioDiff) { int diff = 0; - auto canSubst = getCanonicalType()->substituteImpl(astBuilder, subst, &diff); + auto canonicalType = getCanonicalType(); + + // If canonicalType is identical to this, then we shouldn't try to call + // canonicalType->substituteImpl because that would lead to infinite recursion. + if (canonicalType == this) + return this; + + auto canSubst = canonicalType->substituteImpl(astBuilder, subst, &diff); // If nothing changed, then don't drop any sugar that is applied if (!diff) -- cgit v1.2.3