Open
Description
tinygo version 0.38.0 linux/amd64 (using go version go1.24.4 and LLVM version 19.1.2)
Managed to simplify it to such a reproducer
-- go.mod --
module test
go 1.18
-- test_test.go --
package main
import (
"testing"
)
type Label struct{}
type Item[T any] struct {
Value T
Labels []Label
}
func run[T any](input <-chan Item[T]) {
for item := range input {
if len(item.Labels) != 0 {
panic(len(item.Labels))
}
}
}
func NotUsed() {
type T struct{ any }
run[T](nil)
}
func Benchmark(b *testing.B) {
type T struct{}
items := make(chan Item[T])
go func() {
for i := 0; i < b.N; i++ {
items <- Item[T]{Labels: nil}
}
close(items)
}()
run(items)
}
tinygo test -benchmem -run=^$ -bench ^ -v -count=1
panic: 2284738
FAIL test 1.149s
Metadata
Metadata
Assignees
Labels
No labels