borgo
borgo copied to clipboard
generates code with invalid generics when calling helper functions
The following borgo code:
use fmt
struct foo<T> {
val: T
}
impl<T> (f: foo<T>) {
fn print() {
printHelper(f)
}
}
fn printHelper<T>(f: foo<T>) {
fmt.Println(f.val)
}
fn main() {
let f = foo{val: 5}
f.print()
}
generates:
package main
import (
"fmt"
)
type foo[T any] struct {
val T
}
func (f foo[T]) print () {
printHelper[any](f)
}
func printHelper [T any] (f foo[T]) {
fmt.Println(f.val)
}
func main () {
f := foo[int] { val: 5, }
f.print()
}
The issue here is that the line that reads printHelper[any](f) should read printHelper[T](f).
I can't find a way to get borgo to generate compiling Go code for this case.