Closed
Description
The following program panics for no reason I can discern:
package workflow
import (
"fmt"
"testing"
)
type TaskInput interface {
deps() []*taskDefinition
}
type Value[T any] interface {
metaValue
}
type metaValue interface {
TaskInput
}
type taskDefinition struct {
}
type taskResult struct {
task *taskDefinition
}
func (tr *taskResult) deps() []*taskDefinition {
return nil
}
func TestTrivial(t *testing.T) {
tr := &taskResult{&taskDefinition{}}
use(Value[string](tr))
}
func use[T any](v Value[T]) {
_, ok := v.(*taskResult)
if !ok {
panic(fmt.Errorf("output must be a task result, is %T", v))
}
}
cc @golang/runtime