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: correct type assertion for bin func types #588

Merged
merged 1 commit into from
Apr 20, 2020
Merged

fix: correct type assertion for bin func types #588

merged 1 commit into from
Apr 20, 2020

Conversation

mvertes
Copy link
Member

@mvertes mvertes commented Apr 20, 2020

Fixes #587.

@mvertes mvertes added bug Something isn't working area/core labels Apr 20, 2020
@mvertes mvertes added this to the v0.8.x milestone Apr 20, 2020
@mvertes mvertes requested a review from ldez April 20, 2020 13:55
@ldez ldez merged commit 3ed4ec3 into master Apr 20, 2020
@ldez ldez deleted the fix-587 branch April 20, 2020 21:01
@derivaro
Copy link

derivaro commented Apr 24, 2020

Hello Marc, sorry if i m late to answer, lot of work....
I m trying to do a piece of code that i do everyday with goroutine, but with interpreted code (with yaegi) to be able to update it "on the fly" the code with a web site that store code snippets...
I do not use static types because json are differents everyday.

js1:=`{api_key:"testkey1", field2:"test2", products[{...}]}`
 var qq map[string]interface{}
  qq = make(map[string]interface{}, 20)
 if err := json.Unmarshal([]byte(js1), &qq); err != nil {

  }
//at this point no error detected and err==nil,
// but if i try to use the interface map qq :
	 apikey := qq["api_key"].(string)
fmt.Println(apikey)  //for example
//this crash yaegi and qq is not filled with the json

I m sure that the code works outside Yaegi.
It would be cool if u can fix this thing because i really love yaegi, it s very powerfull and very usefull (can code backend directly from front and other stranges features to build dynamic code ...)
Rgd
Antoine

@mvertes
Copy link
Member Author

mvertes commented Apr 25, 2020

The unit test map25.go performs something close to what you claim, and works ok on master.
If something is wrong on your side, please could you provide a simple reproducible example like this test ? I can not guess what is not ok with what you provided.
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

assign a type assertion of func
3 participants