-
Notifications
You must be signed in to change notification settings - Fork 18k
go/types: incorrect recursive interface call accepted inside interface method declaration #22992
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
Comments
The problem is that type checking of closure bodies happens immediately, while type-checking the enclosing and thus incomplete signature, rather than delayed, as is the case for regular functions/methods. There's already a TODO that this should be changed (go/types/expr.go:1034). |
Change https://golang.org/cl/83017 mentions this issue: |
Change https://golang.org/cl/83397 mentions this issue: |
Change https://golang.org/cl/84898 mentions this issue: |
R=go1.11 Also: Moved Checker.pos field into context where it belongs. This is a cleanup/code factoring. For #22992. Change-Id: If9d4f0af537cb181f73735e709ebc8258b2a1378 Reviewed-on: https://go-review.googlesource.com/83017 Reviewed-by: Alan Donovan <adonovan@google.com>
R=go1.11 types.Eval historically never evaluated any delayed tests, which included verification of validity of map keys, but also function literal bodies. Now, embedded interfaces are also type-checked in a delayed fashion, so it becomes imperative to do all delayed checks for eval (otherwise obviously incorrect type expressions are silently accepted). Enabling the delayed tests also removes the restriction that function literals were not type-checked. Also fixed a bug where eval wouldn't return a type-checking error because check.handleBailout was using the wrong err variable. Added tests that verify that method set computation is using the right types when evaluating interfaces with embedded types. For #18395. For #22992. Change-Id: I574fa84568b5158bca4b4ccd4ef5abb616fbf896 Reviewed-on: https://go-review.googlesource.com/84898 Reviewed-by: Alan Donovan <adonovan@google.com>
type-checks without problems; yet the call I.m has two parameters (the interface I, and a byte array of appropriate length). For reference, cmd/compile produces:
Clearly an esoteric case, but good for corner-case testing.
The text was updated successfully, but these errors were encountered: