summaryrefslogtreecommitdiff
path: root/source/slang/slang-check-decl.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2025-06-30 14:32:50 -0700
committerGitHub <noreply@github.com>2025-06-30 21:32:50 +0000
commitf28f67d988158d6c46f7ffe967152f98d32a37b2 (patch)
tree2aa620986a87ec69cf1f210c714312e42b62ac9e /source/slang/slang-check-decl.cpp
parenta55ff722cae338a8fcf5402858c47cf0650a8e5e (diff)
Add MLP training examples. (#7550)
* Add MLP training examples. * Formatting fix. * Fix. * Improve documentation on coopvector. * Improve doc. * Update doc. * Fix typo. * Cleanup shader. * Cleanup. * Fix test. * Fix type check recursion. * Fix. * Fix. * Fix override check.
Diffstat (limited to 'source/slang/slang-check-decl.cpp')
-rw-r--r--source/slang/slang-check-decl.cpp28
1 files changed, 15 insertions, 13 deletions
diff --git a/source/slang/slang-check-decl.cpp b/source/slang/slang-check-decl.cpp
index 1a70e25d7..0dd859bb2 100644
--- a/source/slang/slang-check-decl.cpp
+++ b/source/slang/slang-check-decl.cpp
@@ -2914,9 +2914,9 @@ bool SemanticsVisitor::trySynthesizeDifferentialAssociatedTypeRequirementWitness
context->parentDecl->findLastDirectMemberDeclOfName(requirementDeclRef.getName()))
{
// Remove the `ToBeSynthesizedModifier`.
- if (as<ToBeSynthesizedModifier>(existingDecl->modifiers.first))
+ if (auto mod = existingDecl->modifiers.findModifier<ToBeSynthesizedModifier>())
{
- existingDecl->modifiers.first = existingDecl->modifiers.first->next;
+ removeModifier(existingDecl, mod);
}
else
{
@@ -3133,14 +3133,9 @@ bool SemanticsVisitor::trySynthesizeDifferentialAssociatedTypeRequirementWitness
addModifier(aggTypeDecl, m_astBuilder->create<SynthesizedModifier>());
- // The visibility of synthesized decl should be the min of the parent decl and the requirement.
- if (requirementDeclRef.getDecl()->findModifier<VisibilityModifier>())
- {
- auto requirementVisibility = getDeclVisibility(requirementDeclRef.getDecl());
- auto thisVisibility = getDeclVisibility(context->parentDecl);
- auto visibility = Math::Min(thisVisibility, requirementVisibility);
- addVisibilityModifier(aggTypeDecl, visibility);
- }
+ // The visibility of synthesized decl should be the same of the parent decl.
+ auto thisVisibility = getDeclVisibility(context->parentDecl);
+ addVisibilityModifier(aggTypeDecl, thisVisibility);
// Synthesize the rest of IDifferential method conformances by recursively checking
// conformance on the synthesized decl.
@@ -4149,8 +4144,12 @@ bool SemanticsVisitor::doesVarMatchRequirement(
return false;
}
- auto satisfyingVal =
- tryConstantFoldDeclRef(satisfyingMemberDeclRef, ConstantFoldingKind::LinkTime, nullptr);
+ IntVal* satisfyingVal = nullptr;
+ if (isValidCompileTimeConstantType(satisfyingType))
+ {
+ satisfyingVal =
+ tryConstantFoldDeclRef(satisfyingMemberDeclRef, ConstantFoldingKind::LinkTime, nullptr);
+ }
if (satisfyingVal)
{
witnessTable->add(requiredMemberDeclRef.getDecl(), RequirementWitness(satisfyingVal));
@@ -5125,9 +5124,9 @@ void SemanticsVisitor::markOverridingDecl(
return;
}
+ memberDecl = maybeGetInner(memberDecl);
if (hasDefaultImpl(requiredMemberDeclRef))
{
- memberDecl = maybeGetInner(memberDecl);
// If the required member has a default implementation,
// we need to make sure the member we found is marked as 'override'.
if (!memberDecl->hasModifier<OverrideModifier>())
@@ -14290,6 +14289,9 @@ void SemanticsDeclCapabilityVisitor::visitFunctionDeclBase(FunctionDeclBase* fun
}
else
{
+ auto declaredCapModifier = m_astBuilder->create<ExplicitlyDeclaredCapabilityModifier>();
+ declaredCapModifier->declaredCapabilityRequirements = declaredCaps;
+ addModifier(funcDecl, declaredCapModifier);
if (vis == DeclVisibility::Public)
{
// For public decls, we need to enforce that the function