onyx-lang / onyx

✨ The compiler and developer toolchain for Onyx

Home Page:https://onyxlang.io

Repository from Github https://github.comonyx-lang/onyxRepository from Github https://github.comonyx-lang/onyx

Quick procedures with captures do not have return types inferred correctly

brendanfh opened this issue · comments

x := 10

f := ([x]) => x

g :: (f: () -> $R) -> R {
    return f()
}

g(f) |> println() // Should return 10
error: Error solving for polymorphic variable 'R'.
   at: /home/brendan/dev/onyx/asdf.onyx:8,10
   |
 8 |     g :: (f: () -> $R) -> R {
   |          ^
error: Unable to solve for polymorphic variable 'R', given the type '() -> unknown'.
   at: /home/brendan/dev/onyx/asdf.onyx:8,21
   |
 8 |     g :: (f: () -> $R) -> R {
   |                     ^
error: Here is where the call is located.
   at: /home/brendan/dev/onyx/asdf.onyx:12,6
    |
 12 |     g(f) |> println() // Should return 10
    |      ^