From 913f4d09b91e3fd7449468b135881c940cacb3c0 Mon Sep 17 00:00:00 2001 From: Yong He Date: Sat, 20 Jan 2018 02:48:12 -0500 Subject: bug fixes fixes #373 fixes bug that misses current translation unit's scope when resolving entry-point global type argument expression. --- source/slang/check.cpp | 8 ++++++-- source/slang/syntax.cpp | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'source') diff --git a/source/slang/check.cpp b/source/slang/check.cpp index 7cfb317fb..c4aa9bfba 100644 --- a/source/slang/check.cpp +++ b/source/slang/check.cpp @@ -6944,14 +6944,18 @@ namespace Slang entryPoint->decl = entryPointFuncDecl; // Lookup generic parameter types in global scope + List> scopesToTry; + scopesToTry.Add(entryPoint->getTranslationUnit()->SyntaxNode->scope); + for (auto & module : entryPoint->compileRequest->loadedModulesList) + scopesToTry.Add(module->moduleDecl->scope); for (auto name : entryPoint->genericParameterTypeNames) { // parse type name RefPtr type; - for (auto & module : entryPoint->compileRequest->loadedModulesList) + for (auto & s : scopesToTry) { RefPtr typeExpr = entryPoint->compileRequest->parseTypeString(entryPoint->getTranslationUnit(), - name, module->moduleDecl->scope); + name, s); DiagnosticSink nSink; SemanticsVisitor visitor( &nSink, diff --git a/source/slang/syntax.cpp b/source/slang/syntax.cpp index 552f1dc56..85a702726 100644 --- a/source/slang/syntax.cpp +++ b/source/slang/syntax.cpp @@ -355,7 +355,7 @@ void Type::accept(IValVisitor* visitor, void* extra) auto arrType = type->AsArrayType(); if (!arrType) return false; - return (ArrayLength == arrType->ArrayLength && baseType->Equals(arrType->baseType.Ptr())); + return (ArrayLength->EqualsVal(arrType->ArrayLength) && baseType->Equals(arrType->baseType.Ptr())); } RefPtr ArrayExpressionType::SubstituteImpl(SubstitutionSet subst, int* ioDiff) -- cgit v1.2.3