hades-lang icon indicating copy to clipboard operation
hades-lang copied to clipboard

Uninferrable type argument

Open dhruvrajvanshi opened this issue 2 years ago • 0 comments

import hades.memory as Mem
struct Box[T] {
    val _ptr: *mut T
}

def new_box[T](): Box[T] {
    // Uninferrable T even though return type annotation
    // should be enough to infer the type argument here
    return Box(Mem.allocate(1))

    // this works as a workaround
    // return Box[T](Mem.allocate(1))
}

dhruvrajvanshi avatar Oct 16 '22 20:10 dhruvrajvanshi