prog8 icon indicating copy to clipboard operation
prog8 copied to clipboard

Compiler crash when merging into block that has no symbol prefixing

Open markjreed opened this issue 3 weeks ago • 1 comments

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.

markjreed avatar Dec 03 '25 01:12 markjreed

commit b38fff76e98c8742e7612e72049582557db23a99 adds a hack (fairly robust though) that works around this problem. Needs a proper fix one day.

irmen avatar Dec 03 '25 20:12 irmen