File tree 2 files changed +21
-0
lines changed
src/cmd/compile/internal/noder
2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -442,9 +442,21 @@ func (r *reader) doTyp() *types.Type {
442
442
return r .structType ()
443
443
case pkgbits .TypeInterface :
444
444
return r .interfaceType ()
445
+ case pkgbits .TypeUnion :
446
+ return r .unionType ()
445
447
}
446
448
}
447
449
450
+ func (r * reader ) unionType () * types.Type {
451
+ terms := make ([]* types.Type , r .Len ())
452
+ tildes := make ([]bool , len (terms ))
453
+ for i := range terms {
454
+ tildes [i ] = r .Bool ()
455
+ terms [i ] = r .typ ()
456
+ }
457
+ return types .NewUnion (terms , tildes )
458
+ }
459
+
448
460
func (r * reader ) interfaceType () * types.Type {
449
461
tpkg := types .LocalPkg // TODO(mdempsky): Remove after iexport is gone.
450
462
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 p
8
+
9
+ type I interface { any | int }
You can’t perform that action at this time.
0 commit comments