@@ -149,9 +149,8 @@ func iimportCommon(fset *token.FileSet, imports map[string]*types.Package, data
149
149
r .Seek (sLen + dLen , io .SeekCurrent )
150
150
151
151
p := iimporter {
152
- exportVersion : version ,
153
- ipath : path ,
154
- version : int (version ),
152
+ version : int (version ),
153
+ ipath : path ,
155
154
156
155
stringData : stringData ,
157
156
stringCache : make (map [uint64 ]string ),
@@ -255,9 +254,8 @@ func iimportCommon(fset *token.FileSet, imports map[string]*types.Package, data
255
254
}
256
255
257
256
type iimporter struct {
258
- exportVersion int64
259
- ipath string
260
- version int
257
+ version int
258
+ ipath string
261
259
262
260
stringData []byte
263
261
stringCache map [uint64 ]string
@@ -428,7 +426,7 @@ func (r *importReader) obj(name string) {
428
426
// We need to "declare" a typeparam in order to have a name that
429
427
// can be referenced recursively (if needed) in the type param's
430
428
// bound.
431
- if r .p .exportVersion < iexportVersionGenerics {
429
+ if r .p .version < iexportVersionGenerics {
432
430
errorf ("unexpected type param type" )
433
431
}
434
432
// Remove the "path" from the type param name that makes it unique
@@ -445,7 +443,7 @@ func (r *importReader) obj(name string) {
445
443
id := ident {r .currPkg .Name (), name }
446
444
r .p .tparamIndex [id ] = t
447
445
var implicit bool
448
- if r .p .exportVersion >= iexportVersionGo1_18 {
446
+ if r .p .version >= iexportVersionGo1_18 {
449
447
implicit = r .bool ()
450
448
}
451
449
constraint := r .typ ()
@@ -474,6 +472,10 @@ func (r *importReader) declare(obj types.Object) {
474
472
475
473
func (r * importReader ) value () (typ types.Type , val constant.Value ) {
476
474
typ = r .typ ()
475
+ if r .p .version >= iexportVersionGo1_18 {
476
+ // TODO: add support for using the kind.
477
+ _ = constant .Kind (r .int64 ())
478
+ }
477
479
478
480
switch b := typ .Underlying ().(* types.Basic ); b .Info () & types .IsConstType {
479
481
case types .IsBoolean :
@@ -616,7 +618,7 @@ func (r *importReader) qualifiedIdent() (*types.Package, string) {
616
618
}
617
619
618
620
func (r * importReader ) pos () token.Pos {
619
- if r .p .exportVersion >= iexportVersionPosCol {
621
+ if r .p .version >= iexportVersionPosCol {
620
622
r .posv1 ()
621
623
} else {
622
624
r .posv0 ()
@@ -746,7 +748,7 @@ func (r *importReader) doType(base *types.Named) (res types.Type) {
746
748
return typ
747
749
748
750
case typeParamType :
749
- if r .p .exportVersion < iexportVersionGenerics {
751
+ if r .p .version < iexportVersionGenerics {
750
752
errorf ("unexpected type param type" )
751
753
}
752
754
pkg , name := r .qualifiedIdent ()
@@ -760,7 +762,7 @@ func (r *importReader) doType(base *types.Named) (res types.Type) {
760
762
return r .p .tparamIndex [id ]
761
763
762
764
case instanceType :
763
- if r .p .exportVersion < iexportVersionGenerics {
765
+ if r .p .version < iexportVersionGenerics {
764
766
errorf ("unexpected instantiation type" )
765
767
}
766
768
// pos does not matter for instances: they are positioned on the original
@@ -779,7 +781,7 @@ func (r *importReader) doType(base *types.Named) (res types.Type) {
779
781
return t
780
782
781
783
case unionType :
782
- if r .p .exportVersion < iexportVersionGenerics {
784
+ if r .p .version < iexportVersionGenerics {
783
785
errorf ("unexpected instantiation type" )
784
786
}
785
787
terms := make ([]* typeparams.Term , r .uint64 ())
0 commit comments