inflight/preflight type mismatch error ergonomic improvements
eladb opened this issue ยท 6 comments
I tried this
Implement IFunctionHandler
but forgot to indicate that handle
is inflight
.
Used this code:
bring cloud;
class Handler impl cloud.IFunctionHandler {
pub handle(event: str) {
}
}
Instead of this (forgot to add the inflight
modifier on the handle
method):
bring cloud;
class Handler impl cloud.IFunctionHandler {
pub inflight handle(event: str) {
}
}
I expected this:
If the types only differ in their inflight / preflight - the error should say it explicitly
Instead, this happened
error: Expected type to be "inflight (event: str): void", but got "preflight (event: str): void" instead
--> wing/main.w:3:7
|
3 | class Handler impl cloud.IFunctionHandler {
| ^^^^^^^ Expected type to be "inflight (event: str): void", but got "preflight (event: str): void" instead
Is there a workaround?
N/A
Component
Compiler
Wing Version
0.33.1
Wing Console Version
No response
Node.js Version
No response
Platform(s)
No response
Anything else?
No response
Community Notes
- Please vote by adding a ๐ reaction to the issue to help us prioritize.
- If you are interested to work on this issue, please leave a comment.
Hi,
This issue hasn't seen activity in 60 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days.
Feel free to re-open this issue when there's an update or relevant information to be added.
Thanks!
Would love to have a look at this. If I understand it correctly we want a clearer error message when the only difference between two types is the phase? Something like "Expected phase to be "inflight", but got "preflight" instead"?
Started looking through the type_check.rs code already to gain some understanding as this would be my first issue to the project.
Thanks @Lancear. A lot has changed in wing since this issue was opened, so I updated the I tried this
and Instead, this happened
sections with up-to-date code.
You are correct - we'd like a clearer error message as you suggested.
I'm assigning this issue to you, just to make sure no-one else will work on it simultaneously.
Please let us know if you need assistance or pointers by commenting on this issue or on #dev Slack channel.
Thank you!
While going through the related type-checker code I took some notes with things I didn't fully grasp and the locations I think I need to add a check for the more specific error messages (function phase check comments).
Any feedback to the comments is greatly appreciated, gonna explore my notes some more by trying out compiling some wing code files.
Congrats! ๐ This was released in Wing 0.44.0.