Yes, it will also be fixed. Was there any open bug report or feature request about this?
Also, explicit CAST() does what it should:
Code: Select all
type t1: as integer i: end type
type t2 extends t1: as integer j: end type
type t3 extends t2: as integer k: end type
'' up-cast with explicit CAST()
scope
dim x3 as T3 = (1,2,3)
dim p as T1 ptr = new T2(cast(T1,x3))
'' fbc 1.10.0 1.09.0
print p->i '' 1 1
print cast(T2 ptr, p)->j '' 0 0
end scope
I haven't fully tested all forms but (INIT), TYPE(), BASE(), NEW(), etc, should all work the same.
Just one example using (INIT). In this case I try to show how initializer lists would change if user was to go back and add new fields to the base types:
Code: Select all
scope
type t1 : as integer i: end type
type t2 extends t1: as integer j: end type
type t3 extends t2: as integer k: end type
dim x1 as T1 = (10)
dim x2 as T2 = (x1,20)
dim x3 as T3 = (x2,30)
'' fbc 1.10.0 1.09.0
print x3.i '' 10 10
print x3.j '' 20 30
print x3.k '' 30 0
end scope
print
scope
type t1 : as integer i,a: end type
type t2 extends t1: as integer j,b: end type
type t3 extends t2: as integer k,c: end type
dim x1 as T1 = (10,11)
dim x2 as T2 = (x1,20,21)
dim x3 as T3 = (x2,30,31)
'' fbc 1.10.0 1.09.0
print x3.i '' 10 10
print x3.a '' 11 11
print x3.j '' 20 30
print x3.b '' 21 31
print x3.k '' 30 0
print x3.c '' 31 0
end scope