-
Notifications
You must be signed in to change notification settings - Fork 16
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
Fix #1486 if with assignment #1541
Conversation
Esto también podría tener un quick fix.
(No lo vi todavía, ni idea si ya lo hiciste.)
El mar., 16 de oct. de 2018 a la(s) 08:09, Fernando Dodino (
notifications@github.com) escribió:
… @fdodino <https://github.com/fdodino> requested your review on: #1541
<#1541> Fix #1486
<#1486> if with assignment.
—
You are receiving this because your review was requested.
Reply to this email directly, view it on GitHub
<#1541 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AEa1OaQMpX3QCL_96RQ8A2DnwgZupLNgks5ulb6EgaJpZM4XeHnI>
.
|
No lo hice, tendría que probarlo bien |
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.
Dejé unos comentarios usando el feature "suggestion" que dijo github... supuestamente se pueden aplicar directamente, pero no sé bien como. Me pareció intersante el feature para acelerar el proceso de revisión, veamos si cumple con lo que promete.
...ct.wollok.tests/src/org/uqbar/project/wollok/tests/xpect/nonBooleanValueInIfCondition.wlk.xt
Outdated
Show resolved
Hide resolved
org.uqbar.project.wollok/src/org/uqbar/project/wollok/messages.properties
Outdated
Show resolved
Hide resolved
org.uqbar.project.wollok/src/org/uqbar/project/wollok/messages_es.properties
Outdated
Show resolved
Hide resolved
@@ -820,7 +821,11 @@ class WollokDslValidator extends AbstractConfigurableDslValidator { | |||
@CheckGroup(WollokCheckGroup.POTENTIAL_PROGRAMMING_PROBLEM) | |||
def nonBooleanValueInIfCondition(WIfExpression it) { | |||
if (!condition.isBooleanOrUnknownType) { | |||
report(WollokDslValidator_EXPECTING_BOOLEAN, it, WIF_EXPRESSION__CONDITION) | |||
if (condition instanceof WAssignment) { |
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.
Esto sólo chequea que la asignación esté en la raiz del nodo condición, hay otras posibilidades que no estamos considerando.
- En este mismo punto, si hubiera un árbol de condicionales (tipo A and B or C), sería interesante hacer la misma validación sobre sus componentes.
- En otros lugares donde aparezca el = en un lugar donde se espera una expresión (como argumento en un mensaje, return, etc).
No pararía el PR por esto, pero tal vez podríamos registrar esos issues.
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.
Ahí le agregué validaciones a la condición binaria.
En el return el mensaje que tira es "Cannot return an assignment".
Me parece bien continuarlo como issues donde evaluemos qué tipo de mensaje salta y cómo lo queremos tunear.
….properties Co-Authored-By: fdodino <fernando.dodino@gmail.com>
…ct/wollok into fix-#1486-if-with-assignment
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.
👏
Este tiene