You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
here, foo expects func(int) but it gets func(bool).
What did you see happen?
The entire function literal (signature and body) is underlined with red squiggles. The problem is with the signature, but the red squiggles over the entire body make it hard to see where the problem actually is.
I.e.
What did you expect to see?
This is a feature request - it would be nice if only the signature is underlined as the problem.
The text was updated successfully, but these errors were encountered:
danvolchek
added
gopls
Issues related to the Go language server, gopls.
Tools
This label describes issues relating to any tools in the x/tools repository.
labels
Mar 20, 2025
the type checker reports a types.Error of this form:
types.Error{
Pos: ‸₀,
Msg: "cannot use (func(bool) literal) (value of type func(bool)) as func(int) value in argument to foo",
go116code: 23,
go116start:‸₀,
go116end:‸₁,
}
(I have replaced positions by numbered markers: ‸₀, etc.)
So the question is: should the type checker associate a smaller start/end range with this error, or should gopls post-process the syntax node enclosing that range, perhaps with special cases for FuncLit and other forms that are typically multiline? I would start with the type checker.
gopls version
go env
Env info
What did you do?
In vscode, passed a function literal with an incompatible signature as an argument to another function, i.e.
here,
foo
expectsfunc(int)
but it getsfunc(bool)
.What did you see happen?
The entire function literal (signature and body) is underlined with red squiggles. The problem is with the signature, but the red squiggles over the entire body make it hard to see where the problem actually is.
I.e.
What did you expect to see?
This is a feature request - it would be nice if only the signature is underlined as the problem.
I.e.
Editor and settings
Logs
No response
The text was updated successfully, but these errors were encountered: