help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk] [PATCH] bugfix for Promise >> printOn:


From: Tommy Pettersson
Subject: [Help-smalltalk] [PATCH] bugfix for Promise >> printOn:
Date: Fri, 14 Apr 2017 22:26:55 +0200
User-agent: Mutt/1.5.24 (2015-08-30)

Hi list,

I just subscribed, and this is my first post to the list.

The class Promise has a bug in printOn:. It is supposed to print '(???)' if
its value is not yet known. A missing return causes it to continue to print
the actual value, which will hang until the value is known. Same problem if
Promise has an error.

Here's a trivial patch.

/Tommy


diff --git a/kernel/ValueAdapt.st b/kernel/ValueAdapt.st
index d2957fd..95bdfb0 100644
--- a/kernel/ValueAdapt.st
+++ b/kernel/ValueAdapt.st
@@ -262,8 +262,8 @@ initialized, I suspend the process until a value has been 
assigned.'>
 
        <category: 'printing'>
        aStream print: self class.
-       self hasValue ifFalse: [ aStream nextPutAll: '(???)' ].
-       self hasError ifTrue: [ aStream nextPutAll: '(Error!)' ].
+       self hasValue ifFalse: [ ^aStream nextPutAll: '(???)' ].
+       self hasError ifTrue: [ ^aStream nextPutAll: '(Error!)' ].
 
        aStream
            nextPut: $(;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]