<div dir="ltr">Hi folks!<div><br></div><div>I've found another case where source ranges are not computed as expected in the presence of whitespace:</div><div><ol><li style="margin-left:15px">git clone --depth=1 <a href="https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev.git" target="_blank">https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev.git</a> bug_repro (5a58b89c46457c6392f6952c6fc29af481a47654 at the time of reporting this bug)</li><li style="margin-left:15px">Open Cuis from that folder</li><li style="margin-left:15px">Open a workspace</li><li style="margin-left:15px">Evaluate <span style="background-color:rgb(238,238,238)">Object compile: 'm1 1'.</span></li>Print <font face="monospace"><span style="background-color:rgb(238,238,238)">(Object >> #m1) methodNode rawSourceRanges.</span><br></font>This outputs <font face="monospace"><span style="background-color:rgb(238,238,238)">a Dictionary({1}->an OrderedCollection((3 to: 4)) )</span><br></font>Notice the informed source <span class="gmail-il">range</span> for the <span style="background-color:rgb(238,238,238)">{1}</span> node should be just one character (at position 4), not two.</ol><div>Am I missing something?</div></div><div><br></div><div>Thanks!</div><div>Nico PM</div><div><br></div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Wed, Mar 26, 2025 at 12:56 PM Hernán Wilkinson <<a href="mailto:hernan.wilkinson@10pines.com">hernan.wilkinson@10pines.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">I think it is a bug. I do not see why it should work that way...<div>The problem is, is there code that relies on this behavior? and if so, how do we find it?</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Mar 26, 2025 at 9:51 AM Nicolás Papagna Maldonado via Cuis-dev <<a href="mailto:cuis-dev@lists.cuis.st" target="_blank">cuis-dev@lists.cuis.st</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi folks,<br><div><br></div><div>I found out that the source ranges for temporaries declaration nodes are sometimes computed differently:</div><ol><li>git clone --depth=1 <a href="https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev.git" target="_blank">https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev.git</a> bug_repro</li><li>Open Cuis from that folder</li><li>Open a workspace</li><li>Evaluate <font face="monospace" style="background-color:rgb(238,238,238)">Object compile: 'm1 ||'</font></li>Print <font face="monospace"><span style="background-color:rgb(238,238,238)">(Object >> #m1) methodNode rawSourceRanges.</span><br></font>This outputs <font face="monospace"><span style="background-color:rgb(238,238,238)">a Dictionary({| |}->(4 to: 4) )</span><br></font>Notice the informed source range for the temporaries declaration node is just one character (at position 4), not two.<br><li>Evaluate <font face="monospace"><span style="background-color:rgb(238,238,238)">Object compile: 'm1 || '</span><br></font>Notice there is a space after <font face="monospace"><span style="background-color:rgb(238,238,238)">||</span></font></li>Print <font face="monospace"><span style="background-color:rgb(238,238,238)">(Object >> #m2) methodNode rawSourceRanges.</span><br></font>This outputs <font face="monospace"><span style="background-color:rgb(238,238,238)">a Dictionary({| |}->(4 to: 5) )</span><br></font>Notice the informed source range is correct now.</ol>Even though I used a space at the end of the declaration in step 5, it works for newlines too (In fact, that's how I found the bug in one of my methods).<div><br></div><div>I don't know if this bug affects the source ranges of other parse nodes.<br><div><br></div><div>Cheers!</div><div>Nico PM<br>.</div></div></div>
-- <br>
Cuis-dev mailing list<br>
<a href="mailto:Cuis-dev@lists.cuis.st" target="_blank">Cuis-dev@lists.cuis.st</a><br>
<a href="https://lists.cuis.st/mailman/listinfo/cuis-dev" rel="noreferrer" target="_blank">https://lists.cuis.st/mailman/listinfo/cuis-dev</a><br>
</blockquote></div><div><br clear="all"></div><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div style="font-size:small"><div dir="ltr"><div dir="ltr"><div style="font-size:12.8px"><span style="font-family:tahoma,sans-serif;font-size:xx-small;border-collapse:collapse"><strong><span style="font-size:8pt"><span style="font-size:small"><font size="2"><span style="font-weight:normal"><span style="font-weight:bold">Hernán Wilkinson</span><br>Agile Software Development, Teaching & Coaching</span></font></span></span></strong></span></div><div style="font-size:12.8px"><span style="font-family:tahoma,sans-serif;font-size:xx-small;border-collapse:collapse"><strong><span style="font-size:8pt"><span style="font-size:small"><font size="2"><span style="font-weight:normal">Phone: +54-011</span></font></span></span></strong></span><font face="tahoma, sans-serif" size="2">-4893-2057</font></div><div style="font-size:12.8px"><strong style="font-family:tahoma,sans-serif;font-size:xx-small"><span style="font-size:8pt"><span style="font-size:small"><font size="2"><span style="font-weight:normal">Twitter: @HernanWilkinson</span></font></span></span></strong></div><div style="font-size:12.8px"><span style="font-family:tahoma,sans-serif;font-size:xx-small;border-collapse:collapse"><strong><span style="font-size:8pt"><span style="font-size:small"><font size="2"><span style="font-weight:normal">site: <a href="http://www.10pines.com/" style="color:rgb(17,65,112)" target="_blank">http://www.10Pines.com</a></span></font></span></span></strong></span></div><div style="font-size:12.8px"><font face="tahoma, sans-serif"><span style="border-collapse:collapse">Address: Alem 896</span></font>, Floor 6, Buenos Aires, Argentina</div></div></div></div></div></div></div></div>
</blockquote></div><div><br clear="all"></div><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><br>Nicolás Papagna</div>