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
Assignees

Comments

@alandonovan
Copy link
Contributor

@alandonovan alandonovan commented Oct 15, 2018

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

@alandonovan alandonovan commented Oct 15, 2018

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.

Loading

@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
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants