diff --git a/IDEHelper/Compiler/BfExprEvaluator.cpp b/IDEHelper/Compiler/BfExprEvaluator.cpp index 87b7d97f..82b8b479 100644 --- a/IDEHelper/Compiler/BfExprEvaluator.cpp +++ b/IDEHelper/Compiler/BfExprEvaluator.cpp @@ -949,6 +949,10 @@ void BfMethodMatcher::CompareMethods(BfMethodInstance* prevMethodInstance, BfTyp //else if ((!prevWasGenericParam) && (IsType(arg, prevParamType)) && (!IsType(arg, paramType))) else if ((!wasArgDeferred) && (!prevWasGenericParam) && (IsType(arg, prevParamType)) && ((resolvedArg == NULL) || (paramType != resolvedArg->mBestBoundType))) isWorse = true; + else if ((wasArgDeferred) && (paramType != prevParamType) && (paramType == arg.mType) && (paramType == resolvedArg->mBestBoundType)) + isBetter = true; + else if ((wasArgDeferred) && (paramType != prevParamType) && (prevParamType == arg.mType) && (prevParamType == resolvedArg->mBestBoundType)) + isWorse = true; else { bool canCastFromCurToPrev = mModule->CanCast(mModule->GetFakeTypedValue(paramType), prevParamType, implicitCastFlags); diff --git a/IDEHelper/Tests/src/MethodCalls.bf b/IDEHelper/Tests/src/MethodCalls.bf index cd4664ec..df763e8e 100644 --- a/IDEHelper/Tests/src/MethodCalls.bf +++ b/IDEHelper/Tests/src/MethodCalls.bf @@ -228,6 +228,36 @@ namespace Tests return fVals[0]; } + static int IntTest(int16 a) + { + return 1; + } + + static int IntTest(int32 a) + { + return 2; + } + + static int IntTest(int a) + { + return 3; + } + + static int IntTest2(int a) + { + return 3; + } + + static int IntTest2(int32 a) + { + return 2; + } + + static int IntTest2(int16 a) + { + return 1; + } + [Test] public static void TestBasics() { @@ -305,6 +335,27 @@ namespace Tests float4 fVals = .(123, 234, 345, 456); Test.Assert(GetFirstFloat(*(.)&fVals) == 123); Test.Assert(GetFirstFloatRef(ref *(.)&fVals) == 123); + + const int i = 1; + const int16 i16 = 1; + const int32 i32 = 1; + Test.Assert(IntTest(i16) == 1); + Test.Assert(IntTest(-43) == 1); + Test.Assert(IntTest(i32) == 2); + Test.Assert(IntTest((int32)(-43)) == 2); + Test.Assert(IntTest((int32)-43) == 2); + Test.Assert(IntTest(i) == 3); + Test.Assert(IntTest((int)(-43)) == 3); + Test.Assert(IntTest((int)-43) == 3); + + Test.Assert(IntTest2(i16) == 1); + Test.Assert(IntTest2(-43) == 1); + Test.Assert(IntTest2(i32) == 2); + Test.Assert(IntTest2((int32)(-43)) == 2); + Test.Assert(IntTest2((int32)-43) == 2); + Test.Assert(IntTest2(i) == 3); + Test.Assert(IntTest2((int)(-43)) == 3); + Test.Assert(IntTest2((int)-43) == 3); } } }