-
Notifications
You must be signed in to change notification settings - Fork 750
Improve error message for MismatchingTypes #5639
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Kevin Su <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5639 +/- ##
==========================================
+ Coverage 36.17% 36.19% +0.01%
==========================================
Files 1302 1302
Lines 109484 109627 +143
==========================================
+ Hits 39609 39677 +68
- Misses 65737 65803 +66
- Partials 4138 4147 +9
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Signed-off-by: Kevin Su <[email protected]>
Signed-off-by: Kevin Su <[email protected]>
Signed-off-by: Kevin Su <[email protected]>
Signed-off-by: Kevin Su <[email protected]>
Signed-off-by: Kevin Su <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is easily one of the most useful PRs coming out of this effort to improve error messages. Thank you for working on it!
|
||
errs.Collect(errors.NewMismatchingTypesErr(nodeID, val.Promise.Var, sourceType.String(), expectedType.String())) | ||
errs.Collect(errors.NewMismatchingTypesErr(node.GetId(), outputVar, sourceType.String(), inputVar, expectedType.String())) | ||
return nil, nil, !errs.HasErrors() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup, outputVar is a promise.
outputVar = fmt.Sprintf("%s.%s", upNode.GetMetadata().Name, val.Promise.Var) |
if len(toVar) == 0 { | ||
errMsg = fmt.Sprintf("Variable [%v] (type [%v]) doesn't match expected type [%v].", fromVar, fromType, | ||
toType) | ||
} else { | ||
errMsg = fmt.Sprintf("The output variable '%v' has type [%v], but it's assigned to"+ | ||
" the input variable '%v' which has type type [%v].", fromVar, fromType, toVar, toType) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we have 2 different functions instead? One to handle the previous case and another one to handle the new case where toVar
is set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's better. updated it, thanks~
Signed-off-by: Kevin Su <[email protected]>
func NewMismatchingVariablesErr(nodeID, fromVar, fromType, toVar, toType string) *CompileError { | ||
return newError( | ||
MismatchingTypes, | ||
fmt.Sprintf("The output variable '%v' has type [%v], but it's assigned to the input variable '%v' which has type type [%v].", fromVar, fromType, toVar, toType), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The output variable ... the input variable
The upstream variable ... the downstream variable
Do you think it will be better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait, I think the version now is better.
Details: failed to compile workflow for [resource_type:WORKFLOW project:"flytesnacks" domain:"development" name:"example.wf3" version:"ArJxfyEQms9wkDQCL-2Tpw"] with err: Collected Errors: 1
Error 0: Code: MismatchingTypes, Node Id: n1, Description: The output variable 'subwf1.o0' has type [simple:INTEGER], but it's assigned to the input variable 't2.a' which has type type [simple:STRING].
I'm a little bit tired today, let me review this PR tomorrow morning when I'm energetic. |
Signed-off-by: Future-Outlier <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, this is super helpful.
Signed-off-by: Kevin Su <[email protected]>
Signed-off-by: Kevin Su <[email protected]>
Signed-off-by: Kevin Su <[email protected]>
Signed-off-by: Kevin Su <[email protected]>
* wip Signed-off-by: Kevin Su <[email protected]> * wip Signed-off-by: Kevin Su <[email protected]> * wip Signed-off-by: Kevin Su <[email protected]> * update tests Signed-off-by: Kevin Su <[email protected]> * nit Signed-off-by: Kevin Su <[email protected]> * fix tests Signed-off-by: Kevin Su <[email protected]> * address comment Signed-off-by: Kevin Su <[email protected]> * fix tests Signed-off-by: Future-Outlier <[email protected]> * nit Signed-off-by: Kevin Su <[email protected]> * lint Signed-off-by: Kevin Su <[email protected]> * fix ci Signed-off-by: Kevin Su <[email protected]> * lint Signed-off-by: Kevin Su <[email protected]> --------- Signed-off-by: Kevin Su <[email protected]> Signed-off-by: Future-Outlier <[email protected]> Co-authored-by: Future-Outlier <[email protected]> Signed-off-by: pmahindrakar-oss <[email protected]>
* wip Signed-off-by: Kevin Su <[email protected]> * wip Signed-off-by: Kevin Su <[email protected]> * wip Signed-off-by: Kevin Su <[email protected]> * update tests Signed-off-by: Kevin Su <[email protected]> * nit Signed-off-by: Kevin Su <[email protected]> * fix tests Signed-off-by: Kevin Su <[email protected]> * address comment Signed-off-by: Kevin Su <[email protected]> * fix tests Signed-off-by: Future-Outlier <[email protected]> * nit Signed-off-by: Kevin Su <[email protected]> * lint Signed-off-by: Kevin Su <[email protected]> * fix ci Signed-off-by: Kevin Su <[email protected]> * lint Signed-off-by: Kevin Su <[email protected]> --------- Signed-off-by: Kevin Su <[email protected]> Signed-off-by: Future-Outlier <[email protected]> Co-authored-by: Future-Outlier <[email protected]> Signed-off-by: Bugra Gedik <[email protected]>
* wip Signed-off-by: Kevin Su <[email protected]> * wip Signed-off-by: Kevin Su <[email protected]> * wip Signed-off-by: Kevin Su <[email protected]> * update tests Signed-off-by: Kevin Su <[email protected]> * nit Signed-off-by: Kevin Su <[email protected]> * fix tests Signed-off-by: Kevin Su <[email protected]> * address comment Signed-off-by: Kevin Su <[email protected]> * fix tests Signed-off-by: Future-Outlier <[email protected]> * nit Signed-off-by: Kevin Su <[email protected]> * lint Signed-off-by: Kevin Su <[email protected]> * fix ci Signed-off-by: Kevin Su <[email protected]> * lint Signed-off-by: Kevin Su <[email protected]> --------- Signed-off-by: Kevin Su <[email protected]> Signed-off-by: Future-Outlier <[email protected]> Co-authored-by: Future-Outlier <[email protected]>
Tracking issue
NA
Why are the changes needed?
The compilation error message is not clear to users. The error message only shows the node ID, so users don't know which task/workflow has problems.
What changes were proposed in this pull request?
Add task/workflow name to the error message.
How was this patch tested?
Setup process
Screenshots
Related PRs
NA
Docs link
NA