From bedc3421c9e1e0837fa69e30396a27a60f0fee53 Mon Sep 17 00:00:00 2001 From: Yong He Date: Thu, 16 Oct 2025 11:23:13 -0700 Subject: Fix use of variadic generics with [Differentiable]. (#8736) There was a bug that causes the compiler failing to treat a `no_diff TypePack` as a type pack, and thus diagnose an error when resolving the following call. The fix is to unwrap any ModifiedType wrappers in `IsTypePack()` check. --- source/slang/slang-ast-type.cpp | 3 +++ source/slang/slang-ast-val.h | 4 ++++ 2 files changed, 7 insertions(+) (limited to 'source') diff --git a/source/slang/slang-ast-type.cpp b/source/slang/slang-ast-type.cpp index e3f75cb2f..bfa347df3 100644 --- a/source/slang/slang-ast-type.cpp +++ b/source/slang/slang-ast-type.cpp @@ -4,6 +4,7 @@ #include "slang-ast-builder.h" #include "slang-ast-dispatch.h" #include "slang-ast-modifier.h" +#include "slang-check.h" #include "slang-syntax.h" #include @@ -13,6 +14,7 @@ namespace Slang bool isAbstractTypePack(Type* type) { + type = unwrapModifiedType(type); if (as(type)) return true; if (isDeclRefTypeOf(type)) @@ -22,6 +24,7 @@ bool isAbstractTypePack(Type* type) bool isTypePack(Type* type) { + type = unwrapModifiedType(type); if (as(type)) return true; return isAbstractTypePack(type); diff --git a/source/slang/slang-ast-val.h b/source/slang/slang-ast-val.h index 7b9462f2f..d4edaae08 100644 --- a/source/slang/slang-ast-val.h +++ b/source/slang/slang-ast-val.h @@ -1014,6 +1014,10 @@ inline bool isTypeEqualityWitness(Val* witness) } return true; } + else if (auto expandWitness = as(witness)) + { + return isTypeEqualityWitness(expandWitness->getPatternTypeWitness()); + } return false; } -- cgit v1.2.3