pharo-ide/Calypso

Adding a method in a class from _UnpackagedPackage breaks

Opened this issue · 4 comments

Today I tried to add a class and methods in _UnpackagedPackage but I got exceptions. I have the impression it happens only in this package.

UndefinedObject(Object)>>doesNotUnderstand: #name
ReflectiveMethod>>run:with:in:
SycMoveMethodsToClassPackageCommand(SycMethodRepackagingCommand)>>moveMethod:toPackage:
[ :each |
classPackage := each origin package.
self moveMethod: each toPackage: classPackage.
each tagWith: targetTagName ] in SycMoveMethodsToClassPackageCommand>>execute in Block: [ :each | ...
Array(SequenceableCollection)>>do:
SycMoveMethodsToClassPackageCommand>>execute
[ (extendingPackage notNil
and: [ aMethod package ~~ extendingPackage ])
ifTrue: [ ^ (SycMoveMethodsToPackageCommand
for: {aMethod}
to: extendingPackage) execute ].

(extendingPackage isNil and: [ aMethod isExtension ])
ifTrue:
[ (SycMoveMethodsToClassPackageCommand for: {aMethod}) execute ] ] in ClyMethodCreationToolMorph(ClyMethodEditorToolMorph)>>packageEditingMethod: in Block: [ (extendingPackage notNil...
BlockClosure>>ensure:
ClyMethodCreationToolMorph(ClyTextEditorToolMorph)>>applyChangesBy:
ClyMethodCreationToolMorph(ClyMethodEditorToolMorph)>>packageEditingMethod:
ClyMethodCreationToolMorph(ClyMethodEditorToolMorph)>>tagAndPackageEditingMethod:
ClyMethodCreationToolMorph>>applyChanges
[ self changesAreAboutApply.
applied := self applyChanges ] in [ textMorph hasUnacceptedEdits: true.
[ self changesAreAboutApply.
applied := self applyChanges ]
on: Error
do: [ :err |
textModel text: self editingText.
textMorph hasUnacceptedEdits: true.
err pass ].
applied
ifTrue: [ textMorph hasUnacceptedEdits: false.
self textUpdated.
browser focusActiveTab ]
ifFalse: [ textModel text: self editingText.
textMorph hasUnacceptedEdits: true ] ] in ClyMethodCreationToolMorph(ClyTextEditorToolMorph)>>changesAccepted in Block: [ self changesAreAboutApply....
BlockClosure>>on:do:
[ textMorph hasUnacceptedEdits: true.
[ self changesAreAboutApply.
applied := self applyChanges ]
on: Error
do: [ :err |
textModel text: self editingText.
textMorph hasUnacceptedEdits: true.
err pass ].
applied
ifTrue: [ textMorph hasUnacceptedEdits: false.
self textUpdated.
browser focusActiveTab ]
ifFalse: [ textModel text: self editingText.
textMorph hasUnacceptedEdits: true ] ] in ClyMethodCreationToolMorph(ClyTextEditorToolMorph)>>changesAccepted in Block: [ textMorph hasUnacceptedEdits: true....
BlockClosure>>ensure:
ClyMethodCreationToolMorph(ClyTextEditorToolMorph)>>applyChangesBy:
ClyMethodCreationToolMorph(ClyTextEditorToolMorph)>>changesAccepted
MessageSend>>value
MessageSend>>cull:
MessageSend>>cull:cull:
[ action cull: anAnnouncement cull: announcer ] in AnnouncementSubscription>>deliver: in Block: [ action cull: anAnnouncement cull: announcer ]
BlockClosure>>on:do:
BlockClosure>>on:fork:
AnnouncementSubscription>>deliver:
[ "Ensure delivery to remaining announcements" subscription deliver: anAnnouncement ] in SubscriptionRegistry>>deliver:to:startingAt: in Block: [ "Ensure delivery to remaining announcements" sub...etc...
BlockClosure>>ifCurtailed:
SubscriptionRegistry>>deliver:to:startingAt:
SubscriptionRegistry>>deliver:to:
SubscriptionRegistry>>deliver:

yes, it always fail.
For other packages method after compilation always has package but it is not true in this case

I would fix on Pharo side. _UnpackagedPackage should behave like a normal package

Following code works wrong in that case:

"Create AClass2 in _UnpackagedPackage"
selector := AClass2 compile: 'someMethod999'.
method := AClass2 >> selector.
method package ==> nil