1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 12:32:20 +02:00

Fixed generic interference with generic tuples

This commit is contained in:
Brian Fiete 2020-08-26 06:10:36 -07:00
parent 7e947265da
commit 79c9f5d818
6 changed files with 41 additions and 26 deletions

View file

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

View file

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

View file

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

View file

@ -395,6 +395,24 @@ bool BfGenericInferContext::InferGenericArgument(BfMethodInstance* methodInstanc
return true; 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())) if ((wantType->IsGenericTypeInstance()) && (wantType->IsUnspecializedTypeVariation()))
{ {
auto wantGenericType = (BfTypeInstance*)wantType; auto wantGenericType = (BfTypeInstance*)wantType;
@ -524,24 +542,6 @@ bool BfGenericInferContext::InferGenericArgument(BfMethodInstance* methodInstanc
} }
} }
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; 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) 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; BfTypedValue leftValue;
if (leftExpression != NULL) if (leftExpression != NULL)
{ {

View file

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

View file

@ -11,6 +11,10 @@ SETLOCAL EnableDelayedExpansion
PUSHD %~dp0..\ 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 @SET TESTPATH=IDE\Tests\CompileFail001
@CALL :TEST @CALL :TEST
@IF !ERRORLEVEL! NEQ 0 GOTO HADERROR @IF !ERRORLEVEL! NEQ 0 GOTO HADERROR