bcc icon indicating copy to clipboard operation
bcc copied to clipboard

Boolean/comparison not interpreted as "long" in method overloads

Open GWRon opened this issue 1 year ago • 0 comments

Heya,

Seems passing a "comparison result" as parameter is not interpreting it as int when only method overloads accept "long" (not "int")

SuperStrict
Framework Brl.StandardIO

Type TTest
    Method New(i:Long)
    End Method

    Method New(i:ULong)
    End Method
End Type

Function Func:Int()
    Return 1
End Function

Print (Func() = 2) 'uses "StringFromInt(_m_untitled2_Func()==2)"

'leads to error
Local t:TTest = New TTest(Func()=2)

Results in:

Compile Error: Unable to determine overload to use: Method TTest.New(i:Long) or Method TTest.New(i:ULong).

(when also adding an ":int"-accepting overload, this one is used and no error pops up)

I mentioned this at discord and our fellow coder @HurryStarfish annotated:

...okay nevermind, i tried it out and the blitzmax-ng compiler only complains if you use the comparison as an argument passing an int literal works

and:

Local arr:Object = [1 = 2]
Print TTypeId.ForObject(arr).Name()
'prints Int[]

GWRon avatar Nov 11 '24 13:11 GWRon