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

Juan Vuletich juan at cuis.st
Mon Sep 22 06:49:30 PDT 2025


Both fixes and tests are now at GitHub.

Thanks!

On 21/09/2025 4:36 PM, Hernán Wilkinson via Cuis-dev wrote:
> 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 Wilkinson
>     Agile 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 Wilkinson
> Agile 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
>
-- 
Juan Vuletich
www.cuis.st
github.com/jvuletich
researchgate.net/profile/Juan-Vuletich
independent.academia.edu/JuanVuletich
patents.justia.com/inventor/juan-manuel-vuletich
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20250922/36066190/attachment.htm>


More information about the Cuis-dev mailing list