2
0
Эх сурвалжийг харах

Dependency fix for elemented types (ie: pointer types)

Brian Fiete 3 жил өмнө
parent
commit
4b7ad7036c

+ 5 - 0
IDE/Tests/BugW007/BeefProj.toml

@@ -0,0 +1,5 @@
+FileVersion = 1
+
+[Project]
+Name = "Bug"
+StartupObject = "Bug.Program"

+ 6 - 0
IDE/Tests/BugW007/BeefSpace.toml

@@ -0,0 +1,6 @@
+FileVersion = 1
+Projects = {Bug = {Path = "."}}
+
+[Workspace]
+StartupProject = "Bug"
+

+ 13 - 0
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()

+ 29 - 0
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<int, Zonkle*> mDict;
+	}
+}
+
+namespace Bug
+{
+	
+	class Program
+	{
+		public static int Main(String[] args)
+		{
+			return 0;
+		}
+	}
+}

+ 8 - 1
IDEHelper/Compiler/BfModule.cpp

@@ -3490,7 +3490,14 @@ void BfModule::AddDependency(BfType* usedType, BfType* userType, BfDependencyMap
 
 
 	auto depFlag = flags;
 	auto depFlag = flags;
 	if ((flags & (BfDependencyMap::DependencyFlag_MethodGenericArg | BfDependencyMap::DependencyFlag_TypeGenericArg)) != 0)
 	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())
 	if (!usedType->IsGenericTypeInstance())
 	{
 	{

+ 4 - 0
bin/test_ide.bat

@@ -63,6 +63,10 @@ PUSHD %~dp0..\
 @CALL :TEST
 @CALL :TEST
 @IF !ERRORLEVEL! NEQ 0 GOTO HADERROR
 @IF !ERRORLEVEL! NEQ 0 GOTO HADERROR
 
 
+@SET TESTPATH=IDE\Tests\BugW007
+@CALL :TEST
+@IF !ERRORLEVEL! NEQ 0 GOTO HADERROR
+
 @SET TESTPATH=IDE\Tests\IndentTest
 @SET TESTPATH=IDE\Tests\IndentTest
 @CALL :TEST
 @CALL :TEST
 @IF !ERRORLEVEL! NEQ 0 GOTO HADERROR
 @IF !ERRORLEVEL! NEQ 0 GOTO HADERROR