tree-sitter / tree-sitter-go

Go grammar for tree-sitter
MIT License
310 stars 65 forks source link

Add support for union of types #95

Closed telyatnikov closed 1 year ago

telyatnikov commented 1 year ago

The following generic function from https://go.dev/doc/tutorial/generics cannot be parsed without error:

func SumIntsOrFloats[K comparable, V int64 | float64](m map[K]V) V {
    var s V
    for _, v := range m {
        s += v
    }
    return s
}