File tree 2 files changed +31
-0
lines changed
src/cmd/compile/internal/noder 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -1357,6 +1357,9 @@ func (g *genInst) dictPass(info *instInfo) {
1357
1357
}
1358
1358
case ir .ODOTTYPE , ir .ODOTTYPE2 :
1359
1359
dt := m .(* ir.TypeAssertExpr )
1360
+ if dt .Type ().IsEmptyInterface () || (dt .Type ().IsInterface () && ! dt .Type ().HasShape ()) {
1361
+ break
1362
+ }
1360
1363
if ! dt .Type ().HasShape () && ! (dt .X .Type ().HasShape () && ! dt .X .Type ().IsEmptyInterface ()) {
1361
1364
break
1362
1365
}
Original file line number Diff line number Diff line change
1
+ // compile
2
+
3
+ // Copyright 2022 The Go Authors. All rights reserved.
4
+ // Use of this source code is governed by a BSD-style
5
+ // license that can be found in the LICENSE file.
6
+
7
+ package main
8
+
9
+ type Foo struct {}
10
+
11
+ func (Foo ) Blanker () {}
12
+
13
+ type Bar [T any ] interface {
14
+ Blanker ()
15
+ }
16
+
17
+ type Baz interface {
18
+ Some ()
19
+ }
20
+
21
+ func check [T comparable ](p Bar [T ]) {
22
+ _ , _ = p .(any )
23
+ _ , _ = p .(Baz )
24
+ }
25
+
26
+ func main () {
27
+ check [int ](Foo {})
28
+ }
You can’t perform that action at this time.
0 commit comments