[PATCH] bugfix for Promise >> printOn:

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] bugfix for Promise >> printOn:

Tommy Pettersson
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: $(;

_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk