[Cuis-dev] Test for - Re: Unnecessary method node for . (dot)

Hernán Wilkinson hernan.wilkinson at 10pines.com
Sun Sep 21 12:36:00 PDT 2025


Hi,
 I forgot to send the test that reproduces the error for the extract method.
 Attached is the cs for it.

Hernan

On Sat, Sep 20, 2025 at 6:44 PM Hernán Wilkinson <
hernan.wilkinson at 10pines.com> wrote:

> Hi,
>  attached is a .cs that fixes an edge case when having an unnecessary dot
> at the beginning of a method, for example:
> m1.  <-- that dot
>    ^10 factorial
>
> The method node for that source code had a node without source range, it
> was:
> m1
>     self.  <-- unnecessary generated node and without source range
>     ^10 factorial.
>
> This only happened when the unnecessary dot was before any other
> statement, it did not happen for unnecessary dots elsewhere. For example:
> m1
>     1+2.
>      .
>      ^10 factorial.
>
> generates a method node without the unnecessary self node:
> m1
>     1+2.
>     ^10 factorial
>
> (when the dot was at the beginning of a block, nil was inserted instead of
> self).
> This behavior made the extract method refactoring fail because of that
> unnecessary node without source range.
>
> Attached is the fix and other .cs that remove unnecessary dots I found in
> the source code when checking if the fix worked fine. These other cs are
> not necessary to apply.
>
> Cheers!
> Hernan.
>
>
> --
>
> *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
>


-- 

*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/20250921/576db97b/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: UnsavedChangesTo-BaseImageTests-HAW.011.cs.st
Type: application/octet-stream
Size: 654 bytes
Desc: not available
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20250921/576db97b/attachment.obj>


More information about the Cuis-dev mailing list