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

go/types: AssignableTo and Implements disagree over untyped nil #28219

Closed
alandonovan opened this issue Oct 15, 2018 · 1 comment
Closed

go/types: AssignableTo and Implements disagree over untyped nil #28219

alandonovan opened this issue Oct 15, 2018 · 1 comment

Comments

@alandonovan
Copy link
Contributor

https://play.golang.org/p/ZTGD0NwNsfQ

	untypedNil := Typ[UntypedNil]
	error := Universe.Lookup("error").Type().Underlying().(*Interface)
	fmt.Println(Implements(untypedNil, error))   // "false"
	fmt.Println(AssignableTo(untypedNil, error)) // "true"

This seems like at least a documentation issue.

@alandonovan
Copy link
Contributor Author

Closing after offline discussion with gri. The comment I proposed to add to Implements:

// Untyped nil is assignable to any interface, but implements only the empty interface.

would only be repeating what the spec already says.

@golang golang locked and limited conversation to collaborators Oct 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants