Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: re-import of identical package with sym.typ.cat == binPkgT #1551

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

he11olx
Copy link

@he11olx he11olx commented May 12, 2023

test case:

func main() {
	script1 := `package script
import "encoding/json"
var _ = json.Marshal
`
	script2 := `package script
import "encoding/json"
var _ = json.Marshal
`
	inter := interp.New(interp.Options{GoPath: build.Default.GOPATH})
	_ = inter.Use(stdlib.Symbols)

	inter.Eval(script1)
	_, err := inter.Eval(script2)
	fmt.Println(err)
	// 2:8: json/_.go redeclared in this block
}

Related to: https://github.com/traefik/yaegi/pull/1066/files

sym.typ.cat == binPkgT
@CLAassistant
Copy link

CLAassistant commented May 12, 2023

CLA assistant check
All committers have signed the CLA.

@he11olx
Copy link
Author

he11olx commented May 12, 2023

Looks like not a bug but a feature. But In REPL, executing two import "fmt" will also report errors.

➜  yaegi
> import "fmt"
: 0x14000030120
> import "fmt"
1:21: fmt/_.go redeclared in this block

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants