aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cmd/compile/internal/noder/stencil.go4
-rw-r--r--test/fixedbugs/issue53309.go42
2 files changed, 44 insertions, 2 deletions
diff --git a/src/cmd/compile/internal/noder/stencil.go b/src/cmd/compile/internal/noder/stencil.go
index 88e4961666..3f12aa3cbd 100644
--- a/src/cmd/compile/internal/noder/stencil.go
+++ b/src/cmd/compile/internal/noder/stencil.go
@@ -1330,10 +1330,10 @@ func (g *genInst) dictPass(info *instInfo) {
m = convertUsingDictionary(info, info.dictParam, m.Pos(), mce.X, m, m.Type())
}
case ir.ODOTTYPE, ir.ODOTTYPE2:
- if !m.Type().HasShape() {
+ dt := m.(*ir.TypeAssertExpr)
+ if !dt.Type().HasShape() && !dt.X.Type().HasShape() {
break
}
- dt := m.(*ir.TypeAssertExpr)
var rtype, itab ir.Node
if dt.Type().IsInterface() || dt.X.Type().IsEmptyInterface() {
// TODO(mdempsky): Investigate executing this block unconditionally.
diff --git a/test/fixedbugs/issue53309.go b/test/fixedbugs/issue53309.go
new file mode 100644
index 0000000000..2b752fe161
--- /dev/null
+++ b/test/fixedbugs/issue53309.go
@@ -0,0 +1,42 @@
+// run
+
+// Copyright 2022 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+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 use[T any](v Value[T]) {
+ _, ok := v.(*taskResult)
+ if !ok {
+ panic("output must be *taskResult")
+ }
+}
+
+func main() {
+ tr := &taskResult{&taskDefinition{}}
+ use(Value[string](tr))
+}