You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 4, 2023. It is now read-only.
I have found an issue with casting to and from 'type array' and 'Object array'. In this example I create an array of 'typeb'. I get the array by 'Object[]'. I can then cast to an array of 'typea[]' - which I would expect to be invalid and end up as 'Null'? I can then interate throught the returned and cast array using an iterator of 'typea' which of course shows me the data from a 'typeb' - as the array was originally a 'typeb[]'.
I'm not always so good with explaining so here's the example...
Strict
Type typea
Field a_a:Int
Field a_b:Int
Field a_c:Int
Method debug()
Print "typea"
EndMethod
EndType
Type typeb
Field b_a:Int
Field b_b:Int
Field b_c:Int
Method debug()
Print "typeb"
EndMethod
EndType
Type container
Field data:typeb[]
Method New()
For Local i:Int = 0 Until 10
data :+ [New typeb]
Next
EndMethod
Method getdata:Object[]()
Return data
EndMethod
EndType
Local con:container = New container
Local data:typea[] = typea[](con.getdata()) ' This Local data appears valid but is actually a 'typeb[]'
For Local t:typea = EachIn data
Print t.a_a ' I can access the 't' using typea fields but they are actually referencing a 'typeb' object
t.debug()
Next