Skip to content

Commit

Permalink
interp: fix import of binary type symbols in current scope (#1380)
Browse files Browse the repository at this point in the history
Fixes #1360.
  • Loading branch information
mvertes committed May 4, 2022
1 parent 4e77fc9 commit 606b4c3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
14 changes: 14 additions & 0 deletions _test/issue-1360.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package main

import (
"fmt"
. "net"
)

func main() {
v := IP{}
fmt.Println(v)
}

// Output:
// <nil>
4 changes: 3 additions & 1 deletion interp/gta.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,12 @@ func (interp *Interpreter) gta(root *node, rpath, importPath, pkgName string) ([
case ".": // import symbols in current scope
for n, v := range pkg {
typ := v.Type()
kind := binSym
if isBinType(v) {
typ = typ.Elem()
kind = typeSym
}
sc.sym[n] = &symbol{kind: binSym, typ: valueTOf(typ, withScope(sc)), rval: v}
sc.sym[n] = &symbol{kind: kind, typ: valueTOf(typ, withScope(sc)), rval: v}
}
default: // import symbols in package namespace
if name == "" {
Expand Down

0 comments on commit 606b4c3

Please sign in to comment.