Comments (9)
Intriguingly this case reduces to types.AssignableTo("*types.Struct", "types.Type")
returning false. The plot thickens...
from go.
🍿 yet type Type2 types.Type
is found.
It must be the case that the types.Type
returned by Type.Underlying
is from a different realm.
This is why all the stringer interfaces in the standard library are found (because string is a basic type), yet types.Type
is not.
from go.
It must have been broken by https://go.dev/cl/518896. obj and localpkgs are no longer in the same realm 😞
How this was not caught by any of our tests, I don't know.
That's quite an oversight.
from go.
Change https://go.dev/cl/581875 mentions this issue: gopls/internal/golang: fix resolution of in-package implementations
from go.
Aha: the local query works if it originates from the declaring package, because of the way caching works.
This is probably why it wasn't noticed: users may have grown used to jumping to the package and then running the implements query (I believe @hyangah mentioned that she does this).
from go.
Interestingly, objects were already being compared from different realms, in test variants. Perhaps I saw that and therefore assumed that the object identity didn't matter... (being generous to myself).
The CL above also fixes the pre-existing bug finding local implementations declared in test variants.
from go.
I meant to follow-up this morning but you beat me to it. (Thanks!) I still don't understand why realms (my first thought too) could explain the AssignableTo result in this specific case where the RHS is an interface type with only a public method (Underlying) whose signature doesn't mention a named type (only string). The assignability check shouldn't involve any considerations of Named type identity.
from go.
where the RHS is an interface type with only a public method (Underlying) whose signature doesn't mention a named type (only string).
types.Type
is interface{ String() string; Underlying() Type }
. The Named type identity that matters is the result of Underlying: a types.Type.
The CL I sent you contains a fix, along with a test for this regression as well as the preexisting inconsistency I described, and should make the oversight clear.
from go.
types.Type is interface{ String() string; Underlying() Type }. The Named type identity that matters is the result of Underlying: a types.Type.
Of course, Type. I need more coffee. Or just coffee. Thanks.
from go.
Related Issues (20)
- cmd/fix: invalid -go=go1.21.0 [1.21 backport] HOT 3
- cmd/fix: fails to run on modules whose go directive value is in "1.n.m" format introduced in Go 1.21.0 [1.22 backport] HOT 6
- cmd/fix: invalid -go=go1.21.0 [1.23 backport] HOT 4
- cmd/fix: invalid -go=go1.21.0 [1.23 backport] [1.22 backport]
- cmd/internal/moddeps: TestAllDependencies/std(quick) failures HOT 1
- x/term: windows: arrow keys not received and thus history not working HOT 3
- cmd/cgo: clarify safety of calling unsafe.Slice and unsafe.String with C pointers HOT 3
- x/pkgsite: golang source src net http should add HttpRequestToHttpsAddress. every version I add this func too tired HOT 2
- error obtaining VCS status: exit status 128 / Use -buildvcs=false to disable VCS stamping. HOT 2
- proxy.golang.org: HOT 1
- syscall: on ARM-based MacOS, read() is unable to read more than 1024 bytes at once HOT 8
- Not possible to build go from source tarballs HOT 5
- net/http: Conflicts with pattern when using NewServeMux HOT 2
- x/oauth2: ExampleJWTConfig refers to unknown identifier: JWTConfig HOT 4
- wasm: pass command line arguments and environment variables via go.importObject HOT 3
- proposal: allow importing of somePrivateFunction into _test.go files HOT 2
- cmd/compile: differences in assembly between new(T) and &T{} HOT 4
- x/tools/gopls: error loading workspace folders HOT 12
- path/filepath: Rel() fails on Windows when only one parameter has `\\?\` prefix HOT 4
- access: Run TryBot Permissions HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go.