summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-reflection-api.cpp
diff options
context:
space:
mode:
authorSai Praveen Bangaru <31557731+saipraveenb25@users.noreply.github.com>2024-10-23 20:28:49 -0400
committerGitHub <noreply@github.com>2024-10-23 17:28:49 -0700
commita0bea07503c68160ad2e88986ba98cfc2161bdff (patch)
tree4afbd4009607a5b44e2bc72d13a27627a3501acb /source/slang/slang-reflection-api.cpp
parent5a161dd799cfc62dcfee281bfaff9819a8be43ad (diff)
Fix several bugs with `specializeWithArgTypes()` (#5365)
* Fix several bugs with `specializeWithArgTypes()` * Make all types L-values for the purposes of reflection API resolution
Diffstat (limited to 'source/slang/slang-reflection-api.cpp')
-rw-r--r--source/slang/slang-reflection-api.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/source/slang/slang-reflection-api.cpp b/source/slang/slang-reflection-api.cpp
index 45bbd400c..ae351aee9 100644
--- a/source/slang/slang-reflection-api.cpp
+++ b/source/slang/slang-reflection-api.cpp
@@ -808,9 +808,9 @@ SlangReflectionFunction* tryConvertExprToFunctionReflection(ASTBuilder* astBuild
auto declRef = declRefExpr->declRef;
if (auto genericDeclRef = declRef.as<GenericDecl>())
{
- auto innerDeclRef = substituteDeclRef(
- SubstitutionSet(genericDeclRef), astBuilder, genericDeclRef.getDecl()->inner);
- declRef = createDefaultSubstitutionsIfNeeded(astBuilder, nullptr, innerDeclRef);
+ auto innerDeclRef = createDefaultSubstitutionsIfNeeded(astBuilder, nullptr, genericDeclRef.getDecl()->inner);
+ declRef = substituteDeclRef(
+ SubstitutionSet(genericDeclRef), astBuilder, innerDeclRef);
}
if (auto funcDeclRef = declRef.as<FunctionDeclBase>())
@@ -3194,7 +3194,12 @@ SLANG_API SlangReflectionFunction* spReflectionFunction_specializeWithArgTypes(
try
{
DiagnosticSink sink(linkage->getSourceManager(), Lexer::sourceLocationLexer);
- return convert(linkage->specializeWithArgTypes(funcExpr, argTypeList, &sink).as<FunctionDeclBase>());
+ auto resultFunc = linkage->specializeWithArgTypes(funcExpr, argTypeList, &sink).as<FunctionDeclBase>();
+
+ if (sink.getErrorCount() != 0)
+ return nullptr; // Failed coercion.
+
+ return convert(resultFunc);
}
catch (...)
{