Skip to content

Compiler assertion failure on missing parens for an aliased function

test case

unit temp;

struct S
{
    function ok(): S
    {
        assert(0);
    }
}

alias ng(t) => t.ok;

function main(): s32
{
    var S s;
    s .= ok();
    s = ng(s);
    return 0;
} 

output

temp.sx:11:17: error, cannot implicitly convert s.ok of type function ok(S* this):S to type S
src/styx/ast/types.sx:830:17: runtime error, assert failure, missing .resolved() when comparing a TypeIdentifier
error: the tool (/home/bin/styx) has returned the status 4 (SIGILL)

notes

  • also visible when s .= ng(s); is used.
  • correct code is s = ng(s)();
Edited by Basile.B