Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Smalltalk - collection is empty error when saving

Tags:

smalltalk

Does anyone know what would cause this? I can't save anything to my class because I get a debugging exception thrown: Collection is empty

enter image description here


Link to source: https://dl.dropboxusercontent.com/u/1817765/Pharo%20Crash%20Files.rar

Steps to recreate:

  • Launch Pharo 1.1
  • Select the .image file, without the .changes file in the same directory
  • Attempt to select NumberWithUnits>>=
    • Crash
  • Attempt to save almost anything to NumberWithUnits
    • Crash
like image 518
MrDuk Avatar asked Jun 16 '13 02:06

MrDuk


2 Answers

The issue was that I didn't have the correct .changes file associated with my project. Since my teammate and I were collaborating, these were lost in translation. Once I placed the correct .changes files in the directory of my .image file, everything worked out.

like image 181
MrDuk Avatar answered Nov 12 '22 17:11

MrDuk


Squeak/Pharo have special handling in case of absent source code: they try and decompile CompiledMethod from appropriate MethodDictionary.

What you saw here is a failure of Decompiler to properly decompile some method.

Without code, the IDE is non functional, and you are stuck (you can't save your code, browse your code, debug your code...)

This Pharo 1.1 version is very old and you won't get any support on it.

But interestingly, the bug of Decompiler that you encountered is still present on current Squeak trunk development (4.5)
And the method that makes the Decompiler loosy is:

< aNumberWithUnits
    (self compareUnits: aNumberWithUnits) 
        ifTrue: [self value: ((aNumberWithUnits value) < (self value) ifTrue: [^true] ifFalse: [^false]).] 
        ifFalse: [^Error new signal: 'Incompatible unit types.'].

This is a rather unconventional code since the message [self value: ...] will never be sent.
The reason is that the parameter will be evaluated first, and both branches of the condition will return ifTrue: [^true] ifFalse: [^false].

Since you explored some dark corner that only newbies do explore, and that we failed to test, I'd just say thank you.

If you feel like it, you can open a report on http://bugs.squeak.org

like image 37
aka.nice Avatar answered Nov 12 '22 18:11

aka.nice