Closed matifreyre closed 8 years ago
It is actually a parser lever error, no is not a custom static check. Probably the interpretPropagatingErrors method is not handling right this kind of parsing / linking errors (?)
On Wed, Jul 20, 2016 at 10:22 AM, Matías Freyre notifications@github.com wrote:
I modified this method in lang.wlk due to previous changes to indexOf:
method contains(other) { try { return self.indexOf(other) >= 0 } catch { return false } }
Notice how catch doesn't have a variable there. I didn't really need that variable, so I just tried it that way.
There is a test for contains that goes like this:
@Test def void testContains() { ''' assert.that("aguacate".contains("cat")) assert.that("aguacate".contains("agua")) assert.notThat("aguacate".contains("managua")) '''.test }
This tests passed perfectly, so I thought that that catch syntax was valid. test uses interpretPropagatingErrors and not interpretPropagatingErrorsWithoutStaticChecks.
But when I tried to use that same syntax in the Wollok environment, I got a static check that didn't allow me to. See this simple code:
try { throw new Exception("text") } catch { assert.that(true) } assert.fail("Error")
[image: image] https://cloud.githubusercontent.com/assets/10454118/16987354/1acbac3e-4e62-11e6-960a-b94dcd9fcd87.png
I didn't disable any check in the wollok environment, so I would expect to have the exact same checks. This case means there could be other tests that pass when they should fail.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/uqbar-project/wollok/issues/833, or mute the thread https://github.com/notifications/unsubscribe-auth/AEORWPkJbit36qN6Fp8fG7HNSdxN5eonks5qXiD9gaJpZM4JQxMf .
The difference should be because the wrong code is in the library. I don't know how the tests is handling the errors in that. I will add a test to validate the content of the library
I have added the test, but now there are a lot of errors. I will fix all the libraries.
I modified this method in lang.wlk due to previous changes to indexOf:
Notice how
catch
doesn't have a variable there. I didn't really need that variable, so I just tried it that way.There is a test for
contains
that goes like this:This test passed perfectly, so I thought that that
catch
syntax was valid.test
usesinterpretPropagatingErrors
and notinterpretPropagatingErrorsWithoutStaticChecks
.But when I tried to use that same syntax in the Wollok environment, I got a static check that didn't allow me to. See this simple code:
I didn't enable nor disable any check in the wollok environment, so I would expect to have the exact same checks. This case means there could be other tests that pass when they should fail.