[Cuis-dev] [bug?] Decompiler does not restore unused temporary variables

Nicolás Papagna Maldonado nicolas.papagna at gmail.com
Sun May 4 09:49:40 PDT 2025


Hi folks,

I don't know if this is a bug or the expected behavior.

Today I ran the tests in BaseImageTests with the CodeCoverage package (
https://github.com/npapagna/cuis-code-coverage) loaded and one of the
DecompilerTests failed.
The reason seems to be that Decompiler does not restore unused temporary
variables.

In particular, DecompilerTests>>#testDecompilerInClassesCNtoCZ was failing
on CodeCoverageTest temporaryVariable:
(For context: this method is needed to reproduce a test scenario for the
CodeCoverage tool)

CodeCoverageTest >> #temporaryVariable
    | a |
    a.

To reproduce without the CodeCoverage package, evaluate:

Object compile: 'm1 |a| a'.

newCodeString := (Decompiler new
    decompile: #m1
    in: Object
    method: Object >> #m1) decompileString.

Notice that newCodeString is 'm1 ^ self.' and it should be 'm1 |a| a'(if
this is really a bug).

The code above was run on HEAD at the moment
(6c13d4eda2e9a8c56362ae3363d7b013917227c5).

Is this something that needs to be fixed?

Best,
Nico PM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20250504/1cd8498d/attachment.htm>


More information about the Cuis-dev mailing list