uqbar-project / wollok

Wollok Programming Language
GNU General Public License v3.0
60 stars 16 forks source link

Misplaced error reporting when a constructor is invoked with invalid argument count #1277

Closed npasserini closed 6 years ago

npasserini commented 7 years ago

If I invoke a constructor with an invalid argument count, the first parameter is underlined, which is not accurate. We should highlight the whole constructor invocation expression.

llamada a constructor con cantidad invalida de parametros resalta el primer parametro

fdodino commented 7 years ago

Well, @npasserini , I can configure to highlight the referenced class XOR the arguments:

Screenshot from 2017-11-06 12-17-08.png

But not both, since report uses EStructuralFeature. And Constructor calls have 3 estructural features:

    EReference WCONSTRUCTOR_CALL__CLASS_REF = eINSTANCE.getWConstructorCall_ClassRef();

    EReference WCONSTRUCTOR_CALL__ARGUMENTS = eINSTANCE.getWConstructorCall_Arguments();

    EReference WCONSTRUCTOR_CALL__MIXINS = eINSTANCE.getWConstructorCall_Mixins();

What do you think? I think nowadays behavior is better, because the problem is related with arguments.

npasserini commented 7 years ago

Me pregunto si ARGUMENTS me va a marcar todos los arguments o espera un índice para marcar uno. Si los marca todos, supongo que es lo más preciso. Si marca uno solo, supongo que sólo tenemos la opción CLASS_REF

Ahora, yo creo que sí se puede marcar toda la expresión, si lo ponés en el nodo padre.... estoy en clase ahora como para verificarlo....

2017-11-06 12:20 GMT-03:00 Fernando Dodino notifications@github.com:

Well, @npasserini https://github.com/npasserini , I can configure to highlight the referenced class XOR the arguments:

[image: Screenshot from 2017-11-06 12-17-08.png] https://camo.githubusercontent.com/a115e3f8bec7b4133940d823776544831e60eed5/68747470733a2f2f776166666c65696f2d6469726563742d75706c6f6164732d70726f64756374696f6e2e73332e616d617a6f6e6177732e636f6d2f75706c6f6164732f3537366139656463333863396534306530303834386332302f313235353136633636653832633732386163653231653064343664623937383832363837386462613837653661623033613234666666393936393134373732323765343966323761336464356235363865653130333635303538343234656134353334343464303462656136643337656635663232653761393835393065656564363362306132323934336231396664626164363439626135376261323064393461383265346235646235656463666137663734623964666430313236373534353035613962663534663334613739333461636435386666343265393463353161303132333336326530363437622e706e67

But not both, since report uses EStructuralFeature. And Constructor calls have 3 estructural features:

EReference WCONSTRUCTOR_CALL__CLASS_REF = eINSTANCE.getWConstructorCall_ClassRef();

EReference WCONSTRUCTOR_CALL__ARGUMENTS = eINSTANCE.getWConstructorCall_Arguments();

EReference WCONSTRUCTOR_CALL__MIXINS = eINSTANCE.getWConstructorCall_Mixins();

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/uqbar-project/wollok/issues/1277#issuecomment-342180623, or mute the thread https://github.com/notifications/unsubscribe-auth/AEa1OcziGOY7LS-q8wYb8_qzktSn9YUyks5szyPCgaJpZM4Pkdnm .

fdodino commented 7 years ago

Ahí encontré una manera...

https://www.eclipse.org/forums/index.php/t/1071395/

Sería algo como

        messageAcceptor.acceptError(WollokDslValidator_WCONSTRUCTOR_CALL__ARGUMENTS + expectedMessage, c,
                c.before, c.after - 2, WRONG_NUMBER_ARGUMENTS_CONSTRUCTOR_CALL)

Tengo que traerme algunas cosas de QuickFixUtils, y a la larga por ahí haga un refactor, pero es por ahí.