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, types2: unnecessarily incomplete interface in error message #46167

Open
findleyr opened this issue May 14, 2021 · 2 comments
Open

go/types, types2: unnecessarily incomplete interface in error message #46167

findleyr opened this issue May 14, 2021 · 2 comments
Assignees
Milestone

Comments

@findleyr
Copy link
Contributor

@findleyr findleyr commented May 14, 2021

Before my coffee kicked in this morning, I made the following mistake:

var I interface {
  f()
}

func _(i I) {}

(I typed var instead of type)

I got an error about I not being a type. That's good. However, the specific error message was "I (variable of type interface{f() /* incomplete */}) is not a type".

There's no reason for the type of I to be incomplete at this point in the type checking pass, and even if there were we should probably evaluate the error message later when it can be more accurate.

CC @griesemer

@findleyr findleyr modified the milestones: Backlog, Go1.18 May 14, 2021
@griesemer griesemer self-assigned this May 14, 2021
@gopherbot
Copy link

@gopherbot gopherbot commented May 14, 2021

Change https://golang.org/cl/320150 mentions this issue: [dev.typeparams] cmd/compile/internal/types2: print "incomplete" for interfaces in debug mode only

gopherbot pushed a commit that referenced this issue May 14, 2021
…interfaces in debug mode only

The /* incomplete */ comment printed for interfaces that have not been
"completed" yet is not useful for end-users; it's here for type-checker
debugging. Rather than trying to pass through a debug flag through all
print routines (which may require new exported API), simply don't print
the comment unless we have the debug flag set inside the type-checker.

For #46167.

Change-Id: Ibd22edfe63001dfd2b814eeb94c2d54d35afd88c
Reviewed-on: https://go-review.googlesource.com/c/go/+/320150
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
@gopherbot
Copy link

@gopherbot gopherbot commented Jun 3, 2021

Change https://golang.org/cl/324731 mentions this issue: go/types: print "incomplete" for interfaces in debug mode only

gopherbot pushed a commit that referenced this issue Jun 4, 2021
… mode only

This is a straightforward port of CL 320150 to go/types.

Fixes #46167

Change-Id: Id1845046f598ac4fefd68cda6a5a03b7a5fc5a4a
Reviewed-on: https://go-review.googlesource.com/c/go/+/324731
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
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
3 participants