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
the deeper I dig into #4799, the more I scratch my head. here is another meta-bug I think I need to isolate and fixed separately from #4799.
I know this one may looks like #7712 and #7637 because on surface it looks like object slicing. Indeed it sliced the object. But the problem highlighted here is the inconsistent internal representation of array construction of generic objects.
I will use macro to demonstrate the problem and to avoid object slicing at runtime. The problem itself not of macros module, but it originate from commonType algorithm of array construction semcheck.
import macros
typeVehicle[T] =objectofRootObj
tire: T
Car[T] =objectofVehicle[T]
Bike[T] =objectofVehicle[T]
macropeek(n: typed): untyped=echogetTypeImpl(n).treeRepr
echo"---------"var v =Vehicle[int](tire: 3)
var c =Car[int](tire: 4)
var b =Bike[int](tire: 2)
peek([v, c, b])
peek([c, b, v]) # change elements position
the deeper I dig into #4799, the more I scratch my head. here is another meta-bug I think I need to isolate and fixed separately from #4799.
I know this one may looks like #7712 and #7637 because on surface it looks like object slicing. Indeed it sliced the object. But the problem highlighted here is the inconsistent internal representation of array construction of generic objects.
I will use macro to demonstrate the problem and to avoid object slicing at runtime. The problem itself not of macros module, but it originate from commonType algorithm of array construction semcheck.
output:
The text was updated successfully, but these errors were encountered: