aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2022-07-14 17:10:54 +0000
committerCherry Mui <cherryyz@google.com>2022-07-27 16:55:10 +0000
commit6ff8801d3e93ed5dc6dfa3263183cc57b50a039b (patch)
tree067676f9036dc876611363e094e0babbdeb94429
parent76ba1a5e5571232e553f0495f2ce6b468c3ebb9d (diff)
downloadgo-6ff8801d3e93ed5dc6dfa3263183cc57b50a039b.tar.gz
go-6ff8801d3e93ed5dc6dfa3263183cc57b50a039b.zip
[release-branch.go1.18] cmd/compile: revert "fix missing dict pass for type assertions"
This reverts CL 411934 (commit 460a93b54af4a0305f6007e44e41e6160a6469d8). Fixes #53852. Updates #53357. Change-Id: I93d7015d8962d22ffd73128b038e4e7e7ca41c2f Reviewed-on: https://go-review.googlesource.com/c/go/+/417615 Run-TryBot: Cherry Mui <cherryyz@google.com> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: David Chase <drchase@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
-rw-r--r--src/cmd/compile/internal/noder/stencil.go4
-rw-r--r--test/typeparam/issue53309.go42
2 files changed, 2 insertions, 44 deletions
diff --git a/src/cmd/compile/internal/noder/stencil.go b/src/cmd/compile/internal/noder/stencil.go
index e89b69284c..a41b35a0dd 100644
--- a/src/cmd/compile/internal/noder/stencil.go
+++ b/src/cmd/compile/internal/noder/stencil.go
@@ -1297,10 +1297,10 @@ func (g *genInst) dictPass(info *instInfo) {
m = convertUsingDictionary(info, info.dictParam, m.Pos(), mce.X, m, m.Type(), false)
}
case ir.ODOTTYPE, ir.ODOTTYPE2:
- dt := m.(*ir.TypeAssertExpr)
- if !dt.Type().HasShape() && !dt.X.Type().HasShape() {
+ if !m.Type().HasShape() {
break
}
+ dt := m.(*ir.TypeAssertExpr)
var rt ir.Node
if dt.Type().IsInterface() || dt.X.Type().IsEmptyInterface() {
ix := findDictType(info, m.Type())
diff --git a/test/typeparam/issue53309.go b/test/typeparam/issue53309.go
deleted file mode 100644
index d505f6b58a..0000000000
--- a/test/typeparam/issue53309.go
+++ /dev/null
@@ -1,42 +0,0 @@
-// run -gcflags=-G=3
-
-// 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))
-}