From 9d47a352960efd71494c7dfa0918debd5b405077 Mon Sep 17 00:00:00 2001 From: Yong He Date: Mon, 21 Jul 2025 21:35:44 -0700 Subject: Fix Conditioanl fields with a semantic. (#7855) * Fix Conditioanl fields with a semantic. * Add unit test. * Fix test. --- source/slang/slang-check-type.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'source/slang/slang-check-type.cpp') 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) -- cgit v1.2.3