prog8
prog8 copied to clipboard
Compiler crash when merging into block that has no symbol prefixing
Simple example:
%import textio
plane {
struct Point {
ubyte x
ubyte y
}
}
txt {
%option merge
sub print_pt(^^plane.Point p) {
txt.chrout('(')
txt.print_ub(p.x)
txt.chrout(',')
txt.print_ub(p.y)
txt.chrout(')')
}
}
main {
sub start() {
^^plane.Point origin = ^^plane.Point:[0,0]
txt.print_pt(origin)
}
}
Result:
Exception in thread "main" prog8.code.core.AssemblyError: argument type incompatible ^^p8b_plane.p8t_Point vs param ^^plane.Point
Adding %option no_symbol_prefixing into the plane block avoids the problem.
commit b38fff76e98c8742e7612e72049582557db23a99 adds a hack (fairly robust though) that works around this problem. Needs a proper fix one day.