Calypso
Calypso copied to clipboard
Adding a method in a class from _UnpackagedPackage breaks
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:
It looks like some metalink is installed into executed code and it fails (error is inside ReflectiveMethod)
пт, 21 дек. 2018 г. в 09:47, CyrilFerlicot [email protected]:
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:
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/pharo-ide/Calypso/issues/395, or mute the thread https://github.com/notifications/unsubscribe-auth/AHxaoFF3meMlI-YGxMiX3dwB5XCslmbPks5u7K5JgaJpZM4ZdsKg .
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