ooc-lang / rock

:ocean: self-hosted ooc compiler that generates c99
http://ooc-lang.org/
MIT License
401 stars 40 forks source link

rock sometimes segfaults when classes try to implement interfaces #998

Closed alexnask closed 8 years ago

alexnask commented 8 years ago

Haven't pinpointed what causes this yet.

Here is the current smallest testcase I could find:

Printable: interface {
    toString: func -> String
}

Foo: class implements Printable { 
}

This code compiles:

Printable: interface {
    toString: func -> String
}

Foo: class implements Printable {
    toString: func -> String { "hi" }
}

This code segfaults rock:

Printable: interface {
    toString: func -> String

    print: func {
        toString() println()
    }
}

Foo: class implements Printable {
    toString: func -> String { "hi" }
}

It seems that implementing toString stops the segfault, unless print is also defined in Printable, which brings back the segfault.