[Cuis-dev] Syntax Error notification undo bug

Hernan Wilkinson hernan.wilkinson at 10pines.com
Thu Jun 6 12:09:40 PDT 2019

Thank you Eric!
You change is on github now.

About making the "good" fix, sadly there are no tests for the parser,
scanner or compiler... (at least that I'm aware of)
The refactoring tests use the parser and compiler a lot but they do not
cover all the paths.
Making a change in the parser is difficult but not impossible, but be aware
that you should do it using a subclass of the parser because if you make a
mistake you wont be able to fix it because the parser does not work anymore
If you want to give it a try let me know and I'll show you how to do it.


On Wed, Jun 5, 2019 at 3:22 PM Eric Brandwein via Cuis-dev <
cuis-dev at lists.cuis.st> wrote:

> Hi all,
> There's currently a bug when having an unrecognized selector in a method
> and a syntax error at the same time. When the method is saved, and the undo
> command is generated, the selector replacement and the syntax error
> notification insertion of text are merged into one command, which in turn
> makes the command not represent the actual user input.
> For example, if we don't have the m2 method defined, and we try to save
> this method:
> m1
>     self m2.
>     [
> , an 'Unrecognized selector' popup will appear, prompting you to select
> the correct selector. After selecting it, a syntax error text will appear
> after the '[', and the source text will end up looking something like this:
> m1
>     self m1.
>     [End of block expected ->
> After undoing the last command, because the selector replacement was
> merged with the syntax error replacement, the method will look something
> like this:
> m1
>     self m2ed ->
> I made a ChangeSet that fixes it by checking that the stop position of the
> last replacement corresponds with the start position of the new replacement
> before merging the two. But I believe the problem comes from the fact that
> syntax error replacements should not be merged at all with previous
> replacement commands; after all, user text replacements and syntax error
> text replacements seem to me pretty separate undoable commands.
> Changing this without having tests for the TextEditor seemed like a pretty
> dangerous task, so I didn't. Plus, the way I thought about changing it
> involved changing the Parser, which seemed even more dangerous. There
> probably are tests for the Parser, but I couldn't find them in the
> BaseSystemTests. Where are they?
> Cheers,
> Eric
> --
> Cuis-dev mailing list
> Cuis-dev at lists.cuis.st
> https://lists.cuis.st/mailman/listinfo/cuis-dev


*HernĂ¡n WilkinsonAgile Software Development, Teaching & Coaching*
*Phone: +54-011*-4893-2057
*Twitter: @HernanWilkinson*
*site: http://www.10Pines.com <http://www.10pines.com/>*
Address: Alem 896, Floor 6, Buenos Aires, Argentina
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20190606/03d4239e/attachment.html>

More information about the Cuis-dev mailing list