cmd/compile: revert "fix missing dict pass for type assertions"
authorMatthew Dempsky <mdempsky@google.com>
Thu, 14 Jul 2022 17:10:54 +0000 (17:10 +0000)
committerPeter Michael Green <plugwash@raspbian.org>
Tue, 9 Aug 2022 16:49:03 +0000 (17:49 +0100)
This reverts CL 411934 (commit 460a93b54af4a0305f6007e44e41e6160a6469d8).

Fixes #53852.
Updates #53357.

Change-Id: I93d7015d8962d22ffd73128b038e4e7e7ca41c2f

Gbp-Pq: Name 0005-cmd-compile-revert-fix-missing-dict-pass-for-type-as.patch

src/cmd/compile/internal/noder/stencil.go
test/typeparam/issue53309.go [deleted file]

index e89b69284c03d6e325f9acc4ae22a12ecddc538d..a41b35a0dd170daba127ef5a0abfc611459e1bd9 100644 (file)
@@ -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 (file)
index d505f6b..0000000
+++ /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))
-}