summaryrefslogtreecommitdiff
path: root/source/slang/slang-check-type.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2025-07-21 21:35:44 -0700
committerGitHub <noreply@github.com>2025-07-22 04:35:44 +0000
commit9d47a352960efd71494c7dfa0918debd5b405077 (patch)
treef0acf898cb5c4de8a1951ac8010168b119bf94ff /source/slang/slang-check-type.cpp
parent9adac4069fbcc7ce5bea2c42d19c61eb1dcd7f25 (diff)
Fix Conditioanl<T, false> fields with a semantic. (#7855)
* Fix Conditioanl<T, false> fields with a semantic. * Add unit test. * Fix test.
Diffstat (limited to 'source/slang/slang-check-type.cpp')
-rw-r--r--source/slang/slang-check-type.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/source/slang/slang-check-type.cpp b/source/slang/slang-check-type.cpp
index bdf9c829a..82f9596e6 100644
--- a/source/slang/slang-check-type.cpp
+++ b/source/slang/slang-check-type.cpp
@@ -146,6 +146,7 @@ Type* SemanticsVisitor::ExtractGenericArgType(Expr* exp)
IntVal* SemanticsVisitor::ExtractGenericArgInteger(
Expr* exp,
Type* genericParamType,
+ ConstantFoldingKind kind,
DiagnosticSink* sink)
{
IntVal* val = CheckIntegerConstantExpression(
@@ -153,7 +154,7 @@ IntVal* SemanticsVisitor::ExtractGenericArgInteger(
genericParamType ? IntegerConstantExpressionCoercionType::SpecificType
: IntegerConstantExpressionCoercionType::AnyInteger,
genericParamType,
- ConstantFoldingKind::SpecializationConstant,
+ kind,
sink);
if (val)
return val;
@@ -168,7 +169,11 @@ IntVal* SemanticsVisitor::ExtractGenericArgInteger(
IntVal* SemanticsVisitor::ExtractGenericArgInteger(Expr* exp, Type* genericParamType)
{
- return ExtractGenericArgInteger(exp, genericParamType, getSink());
+ return ExtractGenericArgInteger(
+ exp,
+ genericParamType,
+ ConstantFoldingKind::LinkTime,
+ getSink());
}
Val* SemanticsVisitor::ExtractGenericArgVal(Expr* exp)