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

proposal: spec: disallow impossible interface-interface type assertions #38907

Open
griesemer opened this issue May 6, 2020 · 0 comments
Open

proposal: spec: disallow impossible interface-interface type assertions #38907

griesemer opened this issue May 6, 2020 · 0 comments
Assignees
Milestone

Comments

@griesemer
Copy link
Contributor

@griesemer griesemer commented May 6, 2020

Now that we have introduced a vet check for this (see #4483), once we use modules to select the language version, we should disallow impossible interface-interface type assertions.

A quick refresher: Given a variable x of type interface I1 with a method m(), and an interface I2 with a method of the same name but different signature m(int), the type assertion x.(I2) can never succeed because no value satisfying I1 can also satisfy I2. The compiler can statically detect that this type assertion makes no sense (it will always panic or return false).

@griesemer griesemer self-assigned this May 6, 2020
@griesemer griesemer changed the title spec: disallow impossible interface-interface type assertions proposal: spec: disallow impossible interface-interface type assertions May 6, 2020
@gopherbot gopherbot added this to the Proposal milestone May 6, 2020
@gopherbot gopherbot added the Proposal label May 6, 2020
@griesemer griesemer modified the milestones: Proposal, Go2 May 6, 2020
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
2 participants
You can’t perform that action at this time.