Overriding final function builds, but segfaults when run #851

Closed
davidhesselbom opened this Issue Jan 9, 2015 · 3 comments

Projects

None yet

3 participants

@davidhesselbom
Contributor

This builds, but when you run the program, it segfaults. I don't think it should build in the first place. Is this a bug?

First: class {
    init: func
    test: final func
}

Second: class extends First {
    init: func
    test: func
}

s := Second new()
s test()
@zhaihj
Contributor
zhaihj commented Jan 9, 2015

I think it should be disallowed.
Inheriting from a final function makes no sense.

But how should we do with cover? It seems that every function in cover is final.

@zhaihj
Contributor
zhaihj commented Jan 9, 2015

related problem:

First: class {
    init: func
    test: func
}

Second: class extends First {
    init: func
    test: final func
}

s := Second new()
s test()

By compiling the above code, I get:

test.ooc: In function ‘test__Second_class’:
test.ooc:28:29: error: ‘test__Second_test_impl’ undeclared (first use in this function)

Final func does not have impl, but rock is still using _impl when accessing it.

        .test = (void*) test__Second_test_impl,

patch:
zhaihj@6921ea6

@fasterthanlime fasterthanlime added a commit that referenced this issue Jan 12, 2015
@fasterthanlime fasterthanlime Add tests for #851 a63fdb3
@fasterthanlime
Collaborator

Seems like this has been fixed in master, not sure why this bug is still open!

@fasterthanlime fasterthanlime modified the milestone: 0.9.10 Jul 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment