[Cuis-dev] [FIX] Add class instance variables to classes sometimes fails
Gerald Klix
cuis.01 at klix.ch
Wed Jun 29 00:03:03 PDT 2022
Hi Juan,
I now wrote a test case with three tests,
which I included.
The good news: It fails.
The bad news: It fails in a different manner.
In this case I can not add a class instance variables
to a subclass.
I tested it on the following image versions:
Haver 6.0
latest update: #5330
Cuis 6.0
latest update: #5330
For both I used this VM:
5.0-202205191319-HVR_MVP_ALPHA4.2_WINKEY_2022-05-19 Sat May 21 13:57:23
CEST 2022 clang [Production Spur 64-bit x86_64 VM]
CoInterpreter VMMaker.oscog-mt.3184 uuid:
57b61827-3f1a-ab45-966e-7c5caaef28d7 May 21 2022
StackToRegisterMappingCogit VMMaker.oscog-mt.3179 uuid:
c6fbcb07-2a19-ed4f-8b40-9c119a70882a May 21 2022
VM: 202205191319-HVR_MVP_ALPHA4.2_WINKEY_2022-05-19
bear at speedy:gitwork/opensmalltalk-vm
Date: Thu May 19 15:19:40 2022 CommitHash: 776d7d19d
Plugins: 202205191319-HVR_MVP_ALPHA4.2_WINKEY_2022-05-19
bear at speedy:gitwork/opensmalltalk-vm
Linux speedy 5.4.0-110-generic #124~18.04.1-Ubuntu SMP Fri Apr 22
12:01:21 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
plugin path:
/home/bear/smallworks/cuis/5.0-202205191319-HVR_MVP_ALPHA4.2_WINKEY_2022-05-19-64bit/
[default:
/home/bear/smallworks/cuis/5.0-202205191319-HVR_MVP_ALPHA4.2_WINKEY_2022-05-19-64bit/]
With the Cuis image, I also used this VM:
5.0-202205110711 Wed May 11 07:49:55 UTC 2022 clang [Production Spur
64-bit x86_64 VM]
CoInterpreter VMMaker.oscog-mt.3184 uuid:
57b61827-3f1a-ab45-966e-7c5caaef28d7 May 11 2022
StackToRegisterMappingCogit VMMaker.oscog-mt.3179 uuid:
c6fbcb07-2a19-ed4f-8b40-9c119a70882a May 11 2022
VM: 202205110711 runner at fv-az197-581:work/opensmalltalk-vm/opensmalltalk-vm
Date: Wed May 11 09:11:21 2022 CommitHash: 95dbe9d
Plugins: 202205110711
runner at fv-az197-581:work/opensmalltalk-vm/opensmalltalk-vm
Linux fv-az197-581 5.4.0-1077-azure #80~18.04.1-Ubuntu SMP Wed Apr 13
02:07:09 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
plugin path:
/home/bear/smallworks/cuis/Environments/VM/sqcogspur64linuxht/lib/squeak/5.0-202205110711-64bit/
[default:
/home/bear/smallworks/cuis/Environments/VM/sqcogspur64linuxht/lib/squeak/5.0-202205110711-64bit/]
HTH,
Gerald
On 6/29/22 06:51, Gerald Klix via Cuis-dev wrote:
> Hi Juan,
>
> your prudence is justified.
> My alleged “fix” isn't a fix in all cases.
> Sorry, I was to hasty.
>
> I consider this issue crucial -- currently it blocks
> me refactoring some code in an important project of mine --
> there I will to write some testcases right now.
>
>
> HTH,
>
> Gerald
>
>
>
> On 6/28/22 21:18, Juan Vuletich wrote:
>> On 6/28/2022 9:42 AM, Gerald Klix via Cuis-dev wrote:
>>> Hi all, Hi Juan,
>>>
>>> Yesterday night I discovered that adding class instance variables to
>>> a class with sub-classes (sometimes) fails in Haver.
>>>
>>> Alas this is not only an issue in Haver but also in
>>> Cuis. Please find enclosed a fix for that issue.
>>>
>>>
>>> HTH and Best Regards,
>>>
>>> Gerald
>>
>> Can you tell steps to reproduce? I'd like to understand the source of
>> the problem.
>>
>> Thanks,
>>
>
-------------- next part --------------
'From Haver 6.0 [latest update: #5330] on 29 June 2022 at 8:40:00 am'!
'Description '!
!provides: 'ClassInstanceVariableTests' 1 1!
!requires: 'Cuis-Base' 60 5330 nil!
SystemOrganization addCategory: 'ClassInstanceVariableTests'!
!classDefinition: #SimpleClassInstanceVariableTest category: 'ClassInstanceVariableTests'!
TestCase subclass: #SimpleClassInstanceVariableTest
instanceVariableNames: 'class1 class2'
classVariableNames: ''
poolDictionaries: ''
category: 'ClassInstanceVariableTests'!
!classDefinition: 'SimpleClassInstanceVariableTest class' category: 'ClassInstanceVariableTests'!
SimpleClassInstanceVariableTest class
instanceVariableNames: ''!
!SimpleClassInstanceVariableTest commentStamp: '<historical>' prior: 0!
I am a test case that defines two classes with the superclass having one class instance variable.
I test whether a class instance variable can be added.!
!SimpleClassInstanceVariableTest methodsFor: 'naming' stamp: 'KLG 6/29/2022 08:16:11'!
class1
"Answer class1"
^ Smalltalk at: self className1 ifAbsent: [ nil ]! !
!SimpleClassInstanceVariableTest methodsFor: 'naming' stamp: 'KLG 6/29/2022 08:16:06'!
class2
"Answer class2"
^ Smalltalk at: self className2 ifAbsent: [ nil ]! !
!SimpleClassInstanceVariableTest methodsFor: 'naming' stamp: 'KLG 6/29/2022 08:12:29'!
className1
^ self classNames at:1! !
!SimpleClassInstanceVariableTest methodsFor: 'naming' stamp: 'KLG 6/29/2022 08:12:46'!
className2
^ self classNames at:2! !
!SimpleClassInstanceVariableTest methodsFor: 'naming' stamp: 'KLG 6/29/2022 08:08:15'!
classNames
"Answer the names of the test classes to use."
^ #(CIBTC1 CIBTC2)! !
!SimpleClassInstanceVariableTest methodsFor: 'testing' stamp: 'KLG 6/29/2022 08:38:52'!
testAddingAClassInstanceToTheSubclass
"Try to add an instance variable to the subclass."
.
class2 class instanceVariableNames: 'iv3'.
self
assert: (class2 class instVarNames includes: 'iv3').
! !
!SimpleClassInstanceVariableTest methodsFor: 'testing' stamp: 'KLG 6/29/2022 08:31:36'!
testAddingAClassInstanceVariableAfter
"Try to add an instance variable."
self
assert: (class1 class instVarNames includes: 'iv2');
deny: (class1 class instVarNames includes: 'iv1').
class1 class instanceVariableNames: 'iv2 iv1'.
self
assert: (class1 class instVarNames includes: 'iv2');
assert: (class1 class instVarNames includes: 'iv1').
! !
!SimpleClassInstanceVariableTest methodsFor: 'testing' stamp: 'KLG 6/29/2022 08:31:23'!
testAddingAClassInstanceVariableBefore
"Try to add an instance variable."
self
assert: (class1 class instVarNames includes: 'iv2');
deny: (class1 class instVarNames includes: 'iv1').
class1 class instanceVariableNames: 'iv1 iv2'.
self
assert: (class1 class instVarNames includes: 'iv2');
assert: (class1 class instVarNames includes: 'iv1').
! !
!SimpleClassInstanceVariableTest methodsFor: 'testing' stamp: 'KLG 6/29/2022 08:18:32'!
testClassDefintions
"Make sure we realy defined some classes."
self
assert: (class1 isKindOf: Behavior);
assert: (class2 isKindOf: Behavior);
assert: (class2 inheritsFrom: class1)
! !
!SimpleClassInstanceVariableTest methodsFor: 'setUp/tearDown' stamp: 'KLG 6/29/2022 08:37:38'!
setUp
"Remove both classes and set them up again."
self classNames do: [ :name |
Smalltalk includesKey: name :: ifTrue: [
Smalltalk removeClassNamed: name ] ].
class1 _ Object
subclass: self className1
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: self class category.
class2 _ class1
subclass: self className2
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: self class category.
class1 class instanceVariableNames: 'iv2'! !
More information about the Cuis-dev
mailing list