[Gambas-user] Bug with conversion?
Benoît Minisini
g4mba5 at gmail.com
Wed Feb 10 21:15:03 CET 2021
Le 10/02/2021 à 21:07, Jussi Lahtinen a écrit :
> There seems to be a case where Gambas does extra conversions or maybe
> I'm missing something. See attachment.
>
> Look at the improved ArrayBoundsTest() function.
>
> From these lines:
> Debug gb.Integer
> Debug TypeOf(iMyArray1.Bounds.Count);; TypeOf(iMyArray2.Bounds.Count);;
> TypeOf(iMyArray3.Bounds.Count);; TypeOf(iMyArray4.Bounds.Count)
> Debug [iMyArray1.Bounds.Count, iMyArray2.Bounds.Count,
> iMyArray3.Bounds.Count, iMyArray4.Bounds.Count]
> This is what I get:
> mTest.ArrayBoundsTest.2548: 4
> mTest.ArrayBoundsTest.2549: 4 4 4 4
> mTest.ArrayBoundsTest.2550: (Variant[] 0x559e6c3b9178)
>
> I would expect integer[].
>
>
> Jussi
>
iMyArray1 is an Object, i.e. can by any object datatype. So the
interpreter can't assume that iMyArray1.Bounds.Count is an integer. It
could be anything, according to the actual class of iMyArray1, and if i
has a Bounds property that has a Count property.
Regards,
--
Benoît Minisini
More information about the User
mailing list