Mantis Bugtracker
  

Viewing Issue Advanced Details Jump to Notes ] View Simple ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0007362 [Squeak] Morphic minor always 07-06-09 20:53 04-18-10 22:04
Reporter sig View Status public  
Assigned To nicolas cellier
Priority normal Resolution fixed Platform any
Status closed   OS any
Projection none   OS Version any
ETA none Fixed in Version trunk Product Version 3.10
  Product Build
Summary 0007362: Text>>copyFrom:to: prevents using a subclasses
Description In one of my experiments, i tried to subclass a Text by own subclass,
and i found that when i trying to pass its instance to a Workspace,
the workspace morph instead of operating with my intance of Text
subclass, unexpectably uses the instance of Text , which seems
appeared out of nowhere.

The root of all evil is in Text>>copyFrom:to:

copyFrom: start to: stop
       "Answer a copied subrange of the receiver."

       | realStart realStop |
       stop > self size
               ifTrue: [realStop _ self size] "handle selection at end of string"
               ifFalse: [realStop _ stop].
       start < 1
               ifTrue: [realStart _ 1] "handle selection before start of string"
               ifFalse: [realStart _ start].
>>> ^Text
               string: (string copyFrom: realStart to: realStop)
               runs: (runs copyFrom: realStart to: realStop)


after replacing 'Text' with 'self class' , everything works perfectly.
Steps To Reproduce Here the way to reproduce it & test code which should not fail:

| txtClass text |

txtClass := Text clone.
txtClass methodDict: MethodDictionary new; superclass: Text.

text := txtClass fromString: 'blahblah'.

self assert: ( text copyFrom: 1 to: text size) class == txtClass.
Additional Information
Attached Files

- Relationships

- Notes
(0013367 - 66 - 78 - 238 - 238 - 238 - 238)
nicolas cellier
10-19-09 10:33
edited on: 10-19-09 10:33

Fixed in http://source.squeak.org/trunk/Collections-nice.167.mcz [^]

 

- Issue History
Date Modified Username Field Change
07-06-09 20:53 sig New Issue
10-19-09 10:33 nicolas cellier Status new => resolved
10-19-09 10:33 nicolas cellier Fixed in Version  => trunk
10-19-09 10:33 nicolas cellier Resolution open => fixed
10-19-09 10:33 nicolas cellier Assigned To  => nicolas cellier
10-19-09 10:33 nicolas cellier Note Added: 0013367
10-19-09 10:33 nicolas cellier Note Edited: 0013367
04-18-10 22:04 andreas Status resolved => closed


Mantis 1.0.8[^]
Copyright © 2000 - 2007 Mantis Group
41 total queries executed.
32 unique queries executed.
Powered by Mantis Bugtracker