<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Integrated. Thanks!</p>
<div class="moz-cite-prefix">On 10/09/2025 6:38 PM, Nicolás Papagna
Maldonado via Cuis-dev wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CADGn7BNvP7UZssf1OyW1OY3J+n9NLRnwJakCB-bag4SBNTzkKw@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">
<div>Hi folks,</div>
<div><br>
</div>
<div>Attached is a fix for the order in which the parameters of
the extract method refactoring </div>
<div><br>
</div>
<div><b>Actual behavior</b>: when extracting a method using the
Extract Method refactoring, the order of the parameters is
non-deterministic.</div>
<div><br>
</div>
<div>Trying to extract <font face="monospace">a + b</font> from
the following example multiple times might suggest to the user
the message <font face="monospace">keyword1: a keyword2: b</font>
or <font face="monospace">keyword1: b keyword2: a</font>
randomly.</div>
<div><br>
</div>
<blockquote style="margin:0 0 0 40px;border:none;padding:0px">
<div><font face="monospace">a := 1.</font></div>
<div><font face="monospace">b := 2.</font></div>
<div><font face="monospace">^ a + b</font></div>
</blockquote>
<div><font face="monospace"><br>
</font></div>
This bug has two causes:
<div>
<ul>
<li><font face="monospace">Encoder>>#initializeCompleteSourceRangesBasedOn:</font>
uses a <font face="monospace">Dictionary</font> to store
source ranges.</li>
<li>Even if this is fixed, <font face="monospace">Encoder</font>
itself uses a <font face="monospace">Dictionary</font> to
store source ranges (used in the method above).</li>
</ul>
<div>This use of <span style="font-family:monospace">Dictionary</span> makes
enumeration order non-deterministic.</div>
<div><br>
</div>
<div><b>Expected behavior</b>: parameters should be suggested
in the order they appear in the source code.</div>
<div><br>
</div>
<div><b>Proposed solution</b>: the bug was fixed by sorting
the parameter nodes for the method to be extracted by the
position they appear in the source code.</div>
<div><br>
</div>
<div>Cheers!</div>
<div>Nico PM</div>
<div><br>
</div>
<div><font face="monospace"><br>
</font></div>
</div>
</div>
<br>
<fieldset class="moz-mime-attachment-header"></fieldset>
</blockquote>
<pre class="moz-signature" cols="72">--
Juan Vuletich
<a class="moz-txt-link-abbreviated" href="http://www.cuis.st">www.cuis.st</a>
github.com/jvuletich
researchgate.net/profile/Juan-Vuletich
independent.academia.edu/JuanVuletich
patents.justia.com/inventor/juan-manuel-vuletich</pre>
</body>
</html>