-
Notifications
You must be signed in to change notification settings - Fork 163
Mismatched function return type shows error diagnostic in the whole function #301
Comments
We are just using the span from the compiler, so we don't get to choose where we put the squiggle. I agree this seems not great though (and I think it would be not great in the compiler without an IDE too). cc @estebank I'm closing this issue since it is a compiler issue, but we might look at opening a compiler issue to fix this. |
I believe this would be covered by rust-lang/rust#50009. Out of curiosity (as I don't use VSCode at the moment), are you displaying secondary spans at all? I intend to change the diagnostic to point at the last line of the scope (in this case |
Awesome!
Currently, no, but @Xanewok has been working on adding that now that there is support in VSCode. |
That sounds great. I'll have to sit down and think about some better wording for this diagnostic, maybe even adding a new error code (or extend E0069) with text along the lines of "function body does not return a value of type RETURN_TYPE". That way it wouldn't break expectations when pointing at the function signature when complaining about the body as much as if we were to use the same |
Implement hover subcommand for rust-lang#292
The following function fails to return its described return type:
Ideally, there should be an error decoration under the function's name, or possibly its return type. Currently the decoration spans the entire function implementation, which makes it very hard to notice other error decorations:
The text was updated successfully, but these errors were encountered: