bcc
bcc copied to clipboard
Wrong overload used when argument is a function result)
SuperStrict
Framework Brl.StandardIO
Type TTest
Method GetChannelReachLevel:Int()
Return 0
End Method
Method GetPriceForPlayer:Int(playerID:Int, audienceReachLevel:Int = -1)
Return 0
End Method
End Type
Local t:TTest = New TTest
Print t.GetPriceForPlayer(1, Max(1, t.GetChannelReachLevel()))
Output (with latest bcc/brl.mod, ...)
Building untitled2
[ 81%] Processing:untitled2.bmx
Compile Warning: In call to Method TTest.GetPriceForPlayer:Int(playerID:Int,audienceReachLevel:Int): Argument #2 is "Long" but declaration is "Int".
[/tmp/untitled2.bmx;17;0]
Changing last line:
Print t.GetPriceForPlayer(1, Max(1, t.GetChannelReachLevel()))
'to
Print t.GetPriceForPlayer(1, Max(1:Int, t.GetChannelReachLevel()))
makes it compile / not warning anymore.
this also works:
Local t:TTest = New TTest
Local v:Int = Max(1, t.GetChannelReachLevel())
Print t.GetPriceForPlayer(1, v)
I see this min/max-error (long instead of int) a lot of times in my code - so instead of casting things manually I will wait for a proper fix of the issue itself. Thanks.