Auto-Arrays doesnt handle New <object> syntax properly, it gets :<unknown> while all other forms of initialization gets proper metadata (:TDummy in this case).
Which also causes TTypeId.ForObject to crash..
Not just BRL.Reflections fault ;) The compiler needs some fixing too...
Framework BRL.Blitz
Import BRL.Reflection
SuperStrict
Type TDummy
Method Create_1:TDummy()
Return Self
EndMethod
Function Create_2:TDummy()
Return New TDummy
EndFunction
EndType
Local dummy:TDummy = New TDummy
' all these work as expected, ending up with ":TDummy" metadata...
Global works_1:Object[] = [ New TDummy.Create_1() ]
Global works_2:Object[] = [ TDummy.Create_2() ]
Global works_3:Object[] = [ dummy ]
Global unknownmetadata:Object[] = [ New TDummy ] ' <-- array has metadata ":<unknown>"
PrintType( works_1)
PrintType( works_2)
PrintType( works_3)
PrintType( unknownmetadata) ' <-- TTypeId.ForObject() crashes on unknown metadata
Function PrintType( a:Object[])
Local t:TTypeId = TTypeId.ForObject(a)
If t Then WriteStdOut t.Name() + "~n"
EndFunction
|