-
Notifications
You must be signed in to change notification settings - Fork 329
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
WIP: Adds warning on comparing same FirstNameNode #2312
base: main
Are you sure you want to change the base?
Conversation
✅ No public API change. |
return false; | ||
} | ||
|
||
private static bool IsNoOPFirstNameComparison(TexlNode left, TexlNode 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.
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.
NOTE: I will check the impact of the change with the PowerApps using a private build.
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.
// Helps warn no op comparison, e.g. Filter(table, ThisRecord.Value = Value)) or Filter(table, Value = Value) | ||
if (IsNoOPFirstNameComparison(node)) | ||
{ | ||
_txb.ErrorContainer.EnsureError(DocumentErrorSeverity.Severe, node, TexlStrings.WrnNoOpFieldComparison); |
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.
Shouldn't it be a warning instead of DocumentErrorSeverity.Severe?
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.
You are absolutely right! Thanks for catching it...
✅ No public API change. |
827e568
to
e0d9bb3
Compare
✅ No public API change. |
@@ -4575,4 +4575,8 @@ | |||
<value>Delegation warning. The result of this argument '{0}' may be truncated for large data sets before being passed to the '{1}' function.</value> | |||
<comment>Error message when an argument to non-delegable function has possible delegation and resulting rows may be truncated</comment> | |||
</data> | |||
<data name="WrnNoOpFieldComparison" xml:space="preserve"> | |||
<value>This comparison will always be constant. (Always yields true or false). Please consider using 'As' keyword for aliasing scoped variable if this not what you want.</value> |
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.
aliasing isn't a super low-code friendly term. run this by a PM or content person?
This pull request introduces a warning when comparing two identical FirstNameNode instances, which could be either global or scoped variables.
This enhancement is particularly beneficial in scenarios involving scoped variables, where it's easy to misunderstand the concept of implicit
ThisRecord
.It's important to note that this change is non-breaking, as it only adds a warning without generating an error.