<div dir="ltr">Hi Juan, all!<div><br></div><div>Thanks for the clarification.</div><div><br></div><div>CodeCoverage de-optimizes methods to do its thing, so <span style="font-family:monospace">CodeCoverageTest temporaryVariable</span> is actually a valid use-case (it's used to check whether the temporary variable declaration is marked as 'covered' when the variable is read.</div><div><br></div><div>Is there any way I can exclude such tests from <span style="font-family:monospace">DecompilerTests?</span></div>I'm building a custom image where I need to check that I didn't break any tests in the base image and that failing tests is breaking my CI builds, preventing the build from suceeding.<div><br></div><div>Cheers!</div><div>Nico PM</div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Mon, May 5, 2025 at 12:54 PM Juan Vuletich <<a href="mailto:juan@cuis.st">juan@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"><u></u>
<div bgcolor="#ffffff">
Hi Nico.<br>
<br>
I don't think this is a bug. Decompiler creates Smalltalk code from
actual bytecode. Dead code had been removed when generating the
bytecode. Looks fine to me.<br>
<br>
Does it make sense to add some use of the 'a' variable, so it is
kept during compilation? I mean, it is difficult to imagine that
CodeCoverageTest can do something interesting with a method that had
all its code optimized out...<br>
<br>
Cheers,<br>
<br>
On 5/4/2025 1:49 PM, Nicolás Papagna Maldonado via Cuis-dev wrote:
<blockquote type="cite">
<div dir="ltr">Hi folks,
<div><br>
</div>
<div>I don't know if this is a bug or the expected behavior.</div>
<div><br>
</div>
<div>Today I ran the tests in <font face="monospace">BaseImageTests</font>
with the <font face="monospace">CodeCoverage</font> package (<a href="https://github.com/npapagna/cuis-code-coverage" target="_blank">https://github.com/npapagna/cuis-code-coverage</a>)
loaded and one of the <span style="font-family:monospace">DecompilerTests </span>failed.</div>
<div>The reason seems to be that <font face="monospace">Decompiler</font>
does not restore unused temporary variables.</div>
<div><br>
</div>
<div>In particular, <font face="monospace">DecompilerTests>>#testDecompilerInClassesCNtoCZ</font>
was failing on <font face="monospace">CodeCoverageTest
temporaryVariable</font>:<br>
<div>(For context: this method is needed to reproduce a test
scenario for the CodeCoverage tool)</div>
<div><br>
</div>
<div><font face="monospace">CodeCoverageTest >>
#temporaryVariable<br>
| a |<br>
a</font>.</div>
<div><font face="monospace"><br>
</font></div>
To reproduce without the CodeCoverage package, evaluate:
<div><font face="monospace"><br>
</font></div>
<div><font face="monospace">Object compile: 'm1 |a| a'.<br>
<br>
newCodeString := (Decompiler new<br>
decompile: #m1<br>
in: Object<br>
method: Object >> #m1) decompileString.</font></div>
</div>
<div><font face="monospace"><br>
</font></div>
Notice that <font face="monospace">newCodeString</font> is <font face="monospace">'m1 ^ self.'</font> and it should be <font face="monospace">'m1 |a| a'</font>(if this is really a bug).
<div><font face="monospace"><br>
</font></div>
<div>The code above was run on HEAD at the moment
(6c13d4eda2e9a8c56362ae3363d7b013917227c5).</div>
<div><br>
</div>
<div>Is this something that needs to be fixed?</div>
<div>
<div><font face="monospace"><br>
</font></div>
Best,<br>
Nico PM</div>
</div>
</blockquote>
<br>
<br>
<pre cols="72">--
Juan Vuletich
<a href="http://www.cuis-smalltalk.org" target="_blank">www.cuis-smalltalk.org</a>
<a href="https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev" target="_blank">https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev</a>
<a href="https://github.com/jvuletich" target="_blank">https://github.com/jvuletich</a>
<a href="https://www.linkedin.com/in/juan-vuletich-75611b3" target="_blank">https://www.linkedin.com/in/juan-vuletich-75611b3</a>
<a href="https://independent.academia.edu/JuanVuletich" target="_blank">https://independent.academia.edu/JuanVuletich</a>
<a href="https://www.researchgate.net/profile/Juan-Vuletich" target="_blank">https://www.researchgate.net/profile/Juan-Vuletich</a>
<a href="https://patents.justia.com/inventor/juan-manuel-vuletich" target="_blank">https://patents.justia.com/inventor/juan-manuel-vuletich</a>
<a href="https://twitter.com/JuanVuletich" target="_blank">https://twitter.com/JuanVuletich</a></pre>
</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>