Should the language server warn about this case?
Consider the following code:
Mojo language server doesn't produce a type error when body doesn't contain a
return
. There are cases where this makes sense, like when <body>
contains only pass
or ...
. However, for the majority of cases, this clearly won't type check. So, I'm not sure if it's a bug or intended behaviour.
FYI, Python language server like pyright
produces the following error message:
9 Replies
Thanks yeah that's should work in the LSP, as it does produce a compiler error:
Would you mind raising an issue for it?
Didn't sleep last night. Will raise an issue when I wake up.
Filed here: https://github.com/modularml/mojo/issues/1159
Congrats @sora, you just advanced to level 5!
Thanks heaps @sora just seen it 🙏
I'm interested in this subject, I encountered a few weird things with the LSP, where the compiler produced an error but not the LSP. Should we always raise an issue on github when that happens?
If I reformulate, is the expected behavior of the LSP to raise the same error messages as the compiler?
I can imagine that there maybe cases where only the compiler can produce an error, maybe the compiler run more pass than the LSP.
Exactly @sora that's what I had in mind
Maybe you could share the things you encountered and we can ask @Jack Clayton about it.
so yeah clarification would be appreciated