ソースを参照

Fixed generic interference with generic tuples

Brian Fiete 5 年 前
コミット
79c9f5d818

+ 13 - 0
IDE/src/IDEApp.bf

@@ -4576,12 +4576,24 @@ namespace IDE
 				dialog.PopupWindow(mMainWindow);
 		}
 
+		[IDECommand]
+		public void SelectConfig(String config)
+		{
+			mMainFrame.mStatusBar.SelectConfig(config);
+		}
+
 		[IDECommand]
 		public void SelectConfig()
 		{
 			mMainFrame.mStatusBar.mConfigComboBox.ShowDropdown();
 		}
 
+		[IDECommand]
+		public void SelectPlatform(String platform)
+		{
+			mMainFrame.mStatusBar.SelectPlatform(platform);
+		}
+
 		[IDECommand]
 		public void SelectPlatform()
 		{
@@ -4887,6 +4899,7 @@ namespace IDE
 			return (mTestManager != null);
 		}
 
+		[IDECommand]
 		protected void RunTests(bool includeIgnored, bool debug)
 		{
 			if (mOutputPanel != null)

+ 1 - 1
IDE/src/ScriptManager.bf

@@ -1015,7 +1015,7 @@ namespace IDE
 				return true;
 
 			if ((!ScriptManager.sActiveManager.mIsBuildScript) && (gApp.AreTestsRunning()))
-				return true;
+				return false;
 
 			if (gApp.mDebugger.HasPendingDebugLoads())
 				return false;

+ 1 - 1
IDE/src/ui/StatusBar.bf

@@ -65,7 +65,7 @@ namespace IDE.ui
 			MarkDirty();
         }
 
-        void SelectPlatform(String platformName)
+        public void SelectPlatform(String platformName)
         {
             mPlatformComboBox.Label = platformName;
             gApp.mPlatformName.Set(platformName);

+ 19 - 24
IDEHelper/Compiler/BfExprEvaluator.cpp

@@ -395,6 +395,24 @@ bool BfGenericInferContext::InferGenericArgument(BfMethodInstance* methodInstanc
 		return true;
 	}
 
+	if (wantType->IsTuple())
+	{
+		if (argType->IsTuple())
+		{
+			auto wantTupleType = (BfTupleType*)wantType;
+			auto argTupleType = (BfTupleType*)argType;
+
+			if (wantTupleType->mFieldInstances.size() == argTupleType->mFieldInstances.size())
+			{
+				for (int fieldIdx = 0; fieldIdx < (int)wantTupleType->mFieldInstances.size(); fieldIdx++)
+				{
+					InferGenericArgument(methodInstance, argTupleType->mFieldInstances[fieldIdx].mResolvedType,
+						wantTupleType->mFieldInstances[fieldIdx].mResolvedType, BfIRValue());
+				}
+			}
+		}
+	}
+
 	if ((wantType->IsGenericTypeInstance()) && (wantType->IsUnspecializedTypeVariation()))
 	{
 		auto wantGenericType = (BfTypeInstance*)wantType;
@@ -522,25 +540,7 @@ bool BfGenericInferContext::InferGenericArgument(BfMethodInstance* methodInstanc
 					InferGenericArgument(methodInstance, argInvokeMethod->GetParamType(argIdx), wantInvokeMethod->GetParamType(argIdx), BfIRValue());
 			}
 		}
-	}
-
-	if (wantType->IsTuple())
-	{
-		if (argType->IsTuple())
-		{
-			auto wantTupleType = (BfTupleType*)wantType;
-			auto argTupleType = (BfTupleType*)argType;
-			
-			if (wantTupleType->mFieldInstances.size() == argTupleType->mFieldInstances.size())
-			{
-				for (int fieldIdx = 0; fieldIdx < (int)wantTupleType->mFieldInstances.size(); fieldIdx++)
-				{
-					InferGenericArgument(methodInstance, argTupleType->mFieldInstances[fieldIdx].mResolvedType, 
-						wantTupleType->mFieldInstances[fieldIdx].mResolvedType, BfIRValue());
-				}
-			}
-		}
-	}
+	}	
 	
 	return true;
 }
@@ -18380,11 +18380,6 @@ void BfExprEvaluator::PerformBinaryOperation(BfExpression* leftExpression, BfExp
 
 void BfExprEvaluator::PerformBinaryOperation(BfExpression* leftExpression, BfExpression* rightExpression, BfBinaryOp binaryOp, BfTokenNode* opToken, BfBinOpFlags flags)
 {	
-	if ((mModule->mCurMethodInstance != NULL) && (mModule->mCurMethodInstance->mMethodDef->mName == "Angle"))
-	{
-		NOP;
-	}
-
 	BfTypedValue leftValue;
 	if (leftExpression != NULL)
 	{

+ 3 - 0
IDEHelper/Tests/scripts/Test.txt

@@ -0,0 +1,3 @@
+RunTests(true, false)
+SelectPlatform("Win64")
+RunTests(true, false)

+ 4 - 0
bin/test_ide.bat

@@ -11,6 +11,10 @@ SETLOCAL EnableDelayedExpansion
 
 PUSHD %~dp0..\
 
+@ECHO Testing IDEHelper\Tests\Test.txt in BeefIDE_d
+%~dp0\RunAndWait %~dp0..\IDE\dist\BeefIDE_d.exe -platform=Win32 -proddir=%~dp0..\IDEHelper\Tests%TESTPATH% -test=scripts\Test.txt
+@IF !ERRORLEVEL! NEQ 0 GOTO:EOF
+
 @SET TESTPATH=IDE\Tests\CompileFail001
 @CALL :TEST
 @IF !ERRORLEVEL! NEQ 0 GOTO HADERROR