SYSTEM WARNING: Creating default object from empty value

SYSTEM WARNING: Creating default object from empty value

Mantis - Squeak
Viewing Issue Advanced Details
7232 Compiler minor always 11-25-08 21:14 02-06-11 23:48
elhochme  
nicolas cellier  
normal  
closed 3.10.2  
fixed  
none    
none trunk  
0007232: Out of Scope error always displayed when I have a block where a local variable is declared and assigned to but not used.
I found the issue due to when I'm developing I'll hit "accept" in the middle before the method is completed.

The issue is I declare a temp variable in a block and assign a value to it, but if I don't use it, then I get an out-of-scope error. If you put the following code on a class in the Class browser, and try to "accept" you'll get out-of-scope

BEFORE ACCEPT:

generateDoc
    | aDir |

    aDir := FileDirectory on:self directory.
    
    aDir directoryNames do:[ :dirName |
        | tmpDir |
            tmpDir := FileDirectory on:(aDir fullNameFor:dirName) ].


AFTER ACCEPT:

generateDoc
    | aDir |

    aDir := FileDirectory on:self directory.
    
    aDir directoryNames do:[ :dirName |
        | tmpDir |
            tmpDir := FileDirectory on:(aDir fullNameFor:dirName) out of scope ->].
I'm using Squeak 3.10.2-7179

Discussion on #squeak occurred on November 25, 2008 around 4:00pm EST. BrianRice tried looking into it but mentioned I should file a bug and have someone more familiar with the Compiler look into it.
duplicate of 0006831closed nicolas cellier | | [ | unusedVar | ]. Doesn't compile because of "out of scope ->" 
related to 0006704closed  Parser proposes to remove temps it can not remove 

Notes
(0012808)
KenCausey   
11-26-08 00:01   
I'm not certain but I believe the change in 0006704 harvested as update 7145 is the likely culprit.
(0013863)
nicolas cellier   
09-07-10 19:18   
Could not reproduce in trunk 4.2
Probably solved in 4.1