summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2025-02-13 03:29:36 -0800
committerGitHub <noreply@github.com>2025-02-13 19:29:36 +0800
commitccc75cdd9508a4e19efa22e7c911cc2013f514fa (patch)
tree6cc198fcb0d5a58b58f56705ef134bbd5f584587 /tools
parent8406b5647a61fb70be4e041a76c1b64b05a70452 (diff)
Reflection Fixes. (#6346)
* Fix 6317. * Fixes #6316. * Fix cmake preset. --------- Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/slang-unit-test/unit-test-function-reflection.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/slang-unit-test/unit-test-function-reflection.cpp b/tools/slang-unit-test/unit-test-function-reflection.cpp
index 3ce6ab7a5..2f57d4151 100644
--- a/tools/slang-unit-test/unit-test-function-reflection.cpp
+++ b/tools/slang-unit-test/unit-test-function-reflection.cpp
@@ -42,6 +42,9 @@ SLANG_UNIT_TEST(functionReflection)
int bar1(IFloat a, IFloat b) { return 0; }
int bar2<T>(T a, float3 b) { return 0; }
int bar3(float3 b) { return 0; }
+ int bar4<T:IFloat>(T a){return 0;}
+
+ struct Foo { __init() {} }
)";
auto moduleName = "moduleG" + String(Process::getId());
@@ -205,4 +208,12 @@ SLANG_UNIT_TEST(functionReflection)
resolvedFunctionReflection = bar3Reflection->specializeWithArgTypes(1, argTypes);
SLANG_CHECK(resolvedFunctionReflection != nullptr);
SLANG_CHECK(resolvedFunctionReflection == bar3Reflection);
+
+ // GitHub issue #6317: bar2 is a function, not a type, so it should not be found.
+ SLANG_CHECK(module->getLayout()->findTypeByName("bar4") == nullptr);
+
+ auto fooType = module->getLayout()->findTypeByName("Foo");
+ SLANG_CHECK_ABORT(fooType != nullptr);
+ auto ctor = module->getLayout()->findFunctionByNameInType(fooType, "$init");
+ SLANG_CHECK(ctor != nullptr);
}