From 35584ef288e65778f56ffead15dcd4716e6adb28 Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Wed, 23 Feb 2022 07:35:21 -0800 Subject: [PATCH] PopulateType fixes with nested generic type references --- IDE/Tests/CompileFail001/src/Declarations.bf | 21 ++++++++++++++++++++ IDEHelper/Compiler/BfModuleTypeUtils.cpp | 2 ++ 2 files changed, 23 insertions(+) diff --git a/IDE/Tests/CompileFail001/src/Declarations.bf b/IDE/Tests/CompileFail001/src/Declarations.bf index fa5256c0..13edb92d 100644 --- a/IDE/Tests/CompileFail001/src/Declarations.bf +++ b/IDE/Tests/CompileFail001/src/Declarations.bf @@ -1,3 +1,4 @@ +using System; namespace IDETest { class Declarations @@ -55,5 +56,25 @@ namespace IDETest mSA.mB = 234; } } + + [AttributeUsage(.All)] + struct AttribAAttribute : Attribute + { + AttribAAttribute mVal; //FAIL + } + + [AttributeUsage(.All)] + struct AttribBAttribute : Attribute + { + [AttribB] //FAIL + int mVal; //FAIL + } + + [AttributeUsage(.All)] + struct AttribCAttribute : Attribute + { + [AttribC] //FAIL + int Val => 123; //FAIL + } } } diff --git a/IDEHelper/Compiler/BfModuleTypeUtils.cpp b/IDEHelper/Compiler/BfModuleTypeUtils.cpp index 21d7a2a7..77ba5134 100644 --- a/IDEHelper/Compiler/BfModuleTypeUtils.cpp +++ b/IDEHelper/Compiler/BfModuleTypeUtils.cpp @@ -10917,6 +10917,8 @@ BfType* BfModule::ResolveTypeRef(BfTypeReference* typeRef, BfPopulateType popula auto parentTypeInstance = outerTypeInstance; if ((parentTypeInstance != NULL) && (parentTypeInstance->IsTypeAlias())) parentTypeInstance = (BfTypeInstance*)GetOuterType(parentTypeInstance)->ToTypeInstance(); + if (parentTypeInstance->mDefineState < BfTypeDefineState_Declared) + PopulateType(parentTypeInstance, BfPopulateType_Declaration); if ((parentTypeInstance != NULL) && (parentTypeInstance->IsGenericTypeInstance())) { genericTypeInst->mGenericTypeInfo->mMaxGenericDepth = BF_MAX(genericTypeInst->mGenericTypeInfo->mMaxGenericDepth, parentTypeInstance->mGenericTypeInfo->mMaxGenericDepth);