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

Closed
findleyr opened this issue May 14, 2021 · 4 comments
Closed

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

findleyr opened this issue May 14, 2021 · 4 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@findleyr
Copy link
Contributor

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 added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label May 14, 2021
@findleyr findleyr modified the milestones: Backlog, Go1.18 May 14, 2021
@griesemer griesemer self-assigned this May 14, 2021
@gopherbot
Copy link

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

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>
@griesemer
Copy link
Contributor

This was fixed with the above CLs.

@gopherbot
Copy link

Change https://golang.org/cl/339832 mentions this issue: [dev.typeparams] cmd/compile/internal/types2: remove TestIncompleteInterfaces (cleanup)

gopherbot pushed a commit that referenced this issue Aug 5, 2021
…terfaces (cleanup)

TestIncompleteInterfaces is not useful anymore because interface
printing always shows the syntactic type structure of an interface.

Also remove the respective support code in interface printing and
simplify that code.

Move the newDefined and nopos support declarations unchanged into
api_test.go where they are used.

Updates #46167.

Change-Id: I23e303bc4ae4271912ba75f201bd2b7cd4a17b3e
Reviewed-on: https://go-review.googlesource.com/c/go/+/339832
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
@golang golang locked and limited conversation to collaborators Jun 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants