From d87493a46c00be37b820a473c0827bbb865eb222 Mon Sep 17 00:00:00 2001 From: Yong He Date: Mon, 2 Oct 2023 15:39:34 -0700 Subject: More direct-SPIRV fixes. (#3257) * More direct-SPIRV fixes. * Fix array-reg-to-mem. --------- Co-authored-by: Yong He --- source/slang/slang-check-decl.cpp | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) (limited to 'source/slang/slang-check-decl.cpp') diff --git a/source/slang/slang-check-decl.cpp b/source/slang/slang-check-decl.cpp index 351d5a9cc..1e3c6a361 100644 --- a/source/slang/slang-check-decl.cpp +++ b/source/slang/slang-check-decl.cpp @@ -1836,18 +1836,20 @@ namespace Slang RefPtr witnessTable) { if(satisfyingMemberDeclRef.getDecl()->hasModifier() - && !requiredMemberDeclRef.getDecl()->hasModifier()) + != requiredMemberDeclRef.getDecl()->hasModifier()) { - // A `[mutating]` method can't satisfy a non-`[mutating]` requirement, - // but vice-versa is okay. + // A `[mutating]` method can't satisfy a non-`[mutating]` requirement. + // The opposite direction is okay, but we will need to synthesize a wrapper + // to ensure type matches, so we will return false here either way. return false; } if (satisfyingMemberDeclRef.getDecl()->hasModifier() - && !requiredMemberDeclRef.getDecl()->hasModifier()) + != requiredMemberDeclRef.getDecl()->hasModifier()) { - // A `[constref]` method can't satisfy a non-`[constref]` requirement, - // but vice-versa is okay. + // A `[constref]` method can't satisfy a non-`[constref]` requirement. + // The opposite direction is okay, but we will need to synthesize a wrapper + // to ensure type matches, so we will return false here either way. return false; } @@ -2677,11 +2679,21 @@ namespace Slang synArg->type = paramType; synArgs.add(synArg); - if (paramDeclRef.getDecl()->findModifier()) + // Add modifiers + for (auto modifier : paramDeclRef.getDecl()->modifiers) { - auto noDiffModifier = m_astBuilder->create(); - noDiffModifier->keywordName = getSession()->getNameObj("no_diff"); - addModifier(synParamDecl, noDiffModifier); + if (as(modifier)) + { + auto noDiffModifier = m_astBuilder->create(); + noDiffModifier->keywordName = getSession()->getNameObj("no_diff"); + addModifier(synParamDecl, noDiffModifier); + } + else if (as(modifier) || as(modifier) || as(modifier) || as(modifier)) + { + auto clonedModifier = (Modifier*)m_astBuilder->createByNodeType(modifier->astNodeType); + clonedModifier->keywordName = modifier->keywordName; + addModifier(synParamDecl, clonedModifier); + } } } -- cgit v1.2.3