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

nil and slice equality is incorrect #1496

Closed
elee1766 opened this issue Dec 21, 2022 · 0 comments · Fixed by #1500
Closed

nil and slice equality is incorrect #1496

elee1766 opened this issue Dec 21, 2022 · 0 comments · Fixed by #1500
Labels
area/core bug Something isn't working
Milestone

Comments

@elee1766
Copy link
Contributor

elee1766 commented Dec 21, 2022

The following program test.go triggers an unexpected result

package main

import "fmt"

func main() {
	a := []byte{} == nil
	b := nil == []byte{}

	fmt.Printf("ans: %v\n", a)
	fmt.Printf("ans: %v\n", b)
}

Expected result

λ go run ./test.go                                                                                                                             
ans: false
ans: false

Got

λ yaegi ./test.go                                                                                                                              
ans: false
ans: true

Yaegi Version

eee72d1

Additional Notes

[]byte{} == nil and nil == []byte{} should both be false

however, yaegi thinks that nil == []byte{}

@mpl mpl added area/core bug Something isn't working labels Dec 26, 2022
traefiker pushed a commit that referenced this issue Mar 23, 2023
hi!

this issue is sorta blocking for me so i thought i would try to fix it. 

im still learning the codebase and understanding how yaegi works, but I thought I would attempt to add a test in the style of other tests as a start.

please let me know if there is anything i need to change / run, or if anyone knows perhaps a good place to start for tackling this issue

Fixes #1496
@traefiker traefiker added this to the v0.15.x milestone Mar 23, 2023
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 a pull request may close this issue.

3 participants