From 499b0253c224e68ceed6e5b6b1ee9cd7d65aad0f Mon Sep 17 00:00:00 2001 From: Yong He Date: Mon, 30 Jan 2023 19:24:09 -0800 Subject: Make ArrayExpressionType a DeclRefType and define its autodiff extension in stdlib. (#2615) * Allow array parameters in forward diff. * Use type canonicalization instead of coersion. * Reimplement array type. * Fix. * Update test case. --------- Co-authored-by: Yong He --- source/slang/slang-check-conversion.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'source/slang/slang-check-conversion.cpp') diff --git a/source/slang/slang-check-conversion.cpp b/source/slang/slang-check-conversion.cpp index c6daf5e86..6decce625 100644 --- a/source/slang/slang-check-conversion.cpp +++ b/source/slang/slang-check-conversion.cpp @@ -275,10 +275,11 @@ namespace Slang // TODO(tfoley): If we can compute the size of the array statically, // then we want to check that there aren't too many initializers present - auto toElementType = toArrayType->baseType; - - if(auto toElementCount = toArrayType->arrayLength) + auto toElementType = toArrayType->getElementType(); + if(!toArrayType->isUnsized()) { + auto toElementCount = toArrayType->getElementCount(); + // In the case of a sized array, we need to check that the number // of elements being initialized matches what was declared. // @@ -349,7 +350,7 @@ namespace Slang // We have a new type for the conversion, based on what // we learned. toType = m_astBuilder->getArrayType(toElementType, - m_astBuilder->getOrCreate(m_astBuilder->getIntType(), elementCount)); + m_astBuilder->getIntVal(m_astBuilder->getIntType(), elementCount)); } } else if(auto toMatrixType = as(toType)) -- cgit v1.2.3