compiler: fix issue with methods on generic structs

This commit is contained in:
Phil Kedy
2022-07-18 21:19:57 -04:00
committed by Ayke
parent 5026047cde
commit 58072a5167
2 changed files with 18 additions and 6 deletions
+8
View File
@@ -3,6 +3,9 @@ package main
func main() {
println("add:", Add(3, 5))
println("add:", Add(int8(3), 5))
var c C[int]
c.F() // issue 2951
}
type Integer interface {
@@ -12,3 +15,8 @@ type Integer interface {
func Add[T Integer](a, b T) T {
return a + b
}
// Test for https://github.com/tinygo-org/tinygo/issues/2951
type C[V any] struct{}
func (c *C[V]) F() {}