Casting to generic should be forbidden except from Pointer #891

Closed
fasterthanlime opened this Issue Jul 9, 2015 · 1 comment

Projects

None yet

1 participant

@fasterthanlime
Collaborator

Casting to T doesn't work too well apparently..

Peeker: class {
    inner: Object
    init: func (=inner)
    peek: func <T> (T: Class) -> T {
        inner as T // crashes because forgetting the & around (this->inner)
        // inner // works
    }
}

main: func {
    p := Peeker new("hi!")
    p peek(String) println()
}
@fasterthanlime fasterthanlime changed the title from Wtf2 to Casting to generic makes rock forget AddressOf for some reason Jul 9, 2015
@fasterthanlime
Collaborator

Actually, casting to generics should be forbidden, except from Pointer (so structs/HashMap keeps working, for instance).

@fasterthanlime fasterthanlime changed the title from Casting to generic makes rock forget AddressOf for some reason to Casting to generic should be forbidden except from Pointer Jul 9, 2015
@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