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

Are type aliases handled correctly: aliased []int and a function returning a nil slice? #936

Open
jjhoo opened this issue Aug 27, 2019 · 0 comments

Comments

@jjhoo
Copy link

@jjhoo jjhoo commented Aug 27, 2019

The following code produces different results between go and gopherjs. It seems that an empty array is returned instead of nil, and comparison fails.

package main

import (
	"fmt"
)

type intList []int

func Test() []int {
	return nil
}

func main() {
	var s1 intList = Test()
	var s2 []int = Test()
	
	fmt.Println(s1 == nil, s2 == nil)
	fmt.Printf("%#v %#v", s1, s2)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.