From 4b7ad7036c71d38a5cd8a7b5572c0b0c2d2e0c98 Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Sun, 24 Oct 2021 16:07:12 -0700 Subject: [PATCH] Dependency fix for elemented types (ie: pointer types) --- IDE/Tests/BugW007/BeefProj.toml | 5 +++++ IDE/Tests/BugW007/BeefSpace.toml | 6 ++++++ IDE/Tests/BugW007/scripts/Test.txt | 13 +++++++++++++ IDE/Tests/BugW007/src/Program.bf | 29 +++++++++++++++++++++++++++++ IDEHelper/Compiler/BfModule.cpp | 9 ++++++++- bin/test_ide.bat | 4 ++++ 6 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 IDE/Tests/BugW007/BeefProj.toml create mode 100644 IDE/Tests/BugW007/BeefSpace.toml create mode 100644 IDE/Tests/BugW007/scripts/Test.txt create mode 100644 IDE/Tests/BugW007/src/Program.bf diff --git a/IDE/Tests/BugW007/BeefProj.toml b/IDE/Tests/BugW007/BeefProj.toml new file mode 100644 index 00000000..f0c46edc --- /dev/null +++ b/IDE/Tests/BugW007/BeefProj.toml @@ -0,0 +1,5 @@ +FileVersion = 1 + +[Project] +Name = "Bug" +StartupObject = "Bug.Program" diff --git a/IDE/Tests/BugW007/BeefSpace.toml b/IDE/Tests/BugW007/BeefSpace.toml new file mode 100644 index 00000000..c389207f --- /dev/null +++ b/IDE/Tests/BugW007/BeefSpace.toml @@ -0,0 +1,6 @@ +FileVersion = 1 +Projects = {Bug = {Path = "."}} + +[Workspace] +StartupProject = "Bug" + diff --git a/IDE/Tests/BugW007/scripts/Test.txt b/IDE/Tests/BugW007/scripts/Test.txt new file mode 100644 index 00000000..6d91cf86 --- /dev/null +++ b/IDE/Tests/BugW007/scripts/Test.txt @@ -0,0 +1,13 @@ +# This tests that renaming namespace properly deletes types + +ShowFile("src/Program.bf") + +Compile() + +Sleep(1000) +GotoText("//Test") +AdjustCursor(-1, 0) +InsertText("2") +Sleep(1000) + +Compile() \ No newline at end of file diff --git a/IDE/Tests/BugW007/src/Program.bf b/IDE/Tests/BugW007/src/Program.bf new file mode 100644 index 00000000..2c27d90a --- /dev/null +++ b/IDE/Tests/BugW007/src/Program.bf @@ -0,0 +1,29 @@ +#pragma warning disable 168 + +using System; +using System.Collections; + +namespace Bug //Test +{ + struct Zonkle + { + int mA; + } + + class Zorp + { + Dictionary mDict; + } +} + +namespace Bug +{ + + class Program + { + public static int Main(String[] args) + { + return 0; + } + } +} diff --git a/IDEHelper/Compiler/BfModule.cpp b/IDEHelper/Compiler/BfModule.cpp index 14cac746..a7ffd4b8 100644 --- a/IDEHelper/Compiler/BfModule.cpp +++ b/IDEHelper/Compiler/BfModule.cpp @@ -3490,7 +3490,14 @@ void BfModule::AddDependency(BfType* usedType, BfType* userType, BfDependencyMap auto depFlag = flags; if ((flags & (BfDependencyMap::DependencyFlag_MethodGenericArg | BfDependencyMap::DependencyFlag_TypeGenericArg)) != 0) - depFlag = BfDependencyMap::DependencyFlag_GenericArgRef; // Will cause a rebuild but not an outright deletion of the type + { + if (usedType->IsDependendType()) + { + // Cause a rebuild but not an outright deletion of the type + // We can only do this if the 'usedType' can actually hold the dependency which can actually trigger a deletion chain + depFlag = BfDependencyMap::DependencyFlag_GenericArgRef; + } + } if (!usedType->IsGenericTypeInstance()) { diff --git a/bin/test_ide.bat b/bin/test_ide.bat index 176e966b..afb06e49 100644 --- a/bin/test_ide.bat +++ b/bin/test_ide.bat @@ -63,6 +63,10 @@ PUSHD %~dp0..\ @CALL :TEST @IF !ERRORLEVEL! NEQ 0 GOTO HADERROR +@SET TESTPATH=IDE\Tests\BugW007 +@CALL :TEST +@IF !ERRORLEVEL! NEQ 0 GOTO HADERROR + @SET TESTPATH=IDE\Tests\IndentTest @CALL :TEST @IF !ERRORLEVEL! NEQ 0 GOTO HADERROR