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

bug: type problem #2023

Closed
petar-dambovaliev opened this issue May 2, 2024 · 0 comments
Closed

bug: type problem #2023

petar-dambovaliev opened this issue May 2, 2024 · 0 comments

Comments

@petar-dambovaliev
Copy link
Contributor

The following code prints 123.

type Foo interface{
	foo()
}

func NewSet() Foo {
	return 123
}

func main() {
	f := NewSet()
	println(f)
}

This is not a valid program because an integer does not satisfy the interface Foo.
We should see an error here.

@petar-dambovaliev petar-dambovaliev self-assigned this May 3, 2024
petar-dambovaliev added a commit that referenced this issue May 7, 2024
solves [issue](#2023)

<details><summary>Contributors' checklist...</summary>

- [x] Added new tests, or not needed, or not feasible
- [x] Provided an example (e.g. screenshot) to aid review or the PR is
self-explanatory
- [x] Updated the official documentation or not needed
- [x] No breaking changes were made, or a `BREAKING CHANGE: xxx` message
was included in the description
- [x] Added references to related issues and PRs

---------

Co-authored-by: deelawn <dboltz03@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

1 participant