pharo icon indicating copy to clipboard operation
pharo copied to clipboard

Walkback: #name was sent to nil on MethodRecategorized announcement when filing in code

Open macta opened this issue 1 year ago • 3 comments

Bug description Filing in some code exported from epicea in an older image gives a Walkback: #name was sent to nil

To Reproduce Steps to reproduce the behavior:

  1. File out some code with epicea (or use attached file) 2.Use the new file browser to locate the .st file and use filein

Expected behavior Should import the code

Screenshots n/a

Version information:

  • OS: [e.g. iOS]
  • Version: [e.g. 1.6.1]
  • Pharo Version P13 build 89

Expected development cost Could be as simple as:

methodRecategorized: aMethodRecategorized

	| oldMethod newMethod |
	"Workaround: When a trait is removed from the trait composition,
		then this announcement is wrongly announced."
	aMethodRecategorized methodRecategorized ifNil: [ ^ self ].
        aMethodRecategorized oldProtocol ifNil: [ ^ self ].
...

Additional context Add any other context about the problem here. EpLog-2024-06-04.23-47-41.st.txt

macta avatar Jun 04 '24 23:06 macta

stack

UndefinedObject(Object)>>doesNotUnderstand: #name EpMonitor>>methodRecategorized: [ :ann | self methodRecategorized: ann ] in EpMonitor>>subscribeToSystemAnnouncer in Block: [ :ann | self methodRecategorized: ann ] [ :ann | "During the tests, we should only log with Epicea if the test case declare it wants logging." (CurrentExecutionEnvironment value isTest and: [ CurrentExecutionEnvironment value testCase shouldLogWithEpicea not ]) ifFalse: [ block value: ann ] ] in [ :announcement :block | self systemAnnouncer weak when: announcement do: [ :ann | "During the tests, we should only log with Epicea if the test case declare it wants logging." (CurrentExecutionEnvironment value isTest and: [ CurrentExecutionEnvironment value testCase shouldLogWithEpicea not ]) ifFalse: [ block value: ann ] ] for: self ] in EpMonitor>>subscribeToSystemAnnouncer in Block: [ :ann | "During the tests, we should only log[..] FullBlockClosure(BlockClosure)>>cull: FullBlockClosure(BlockClosure)>>cull:cull: [ action cull: anAnnouncement cull: announcer ] in WeakAnnouncementSubscription(AbstractAnnouncementSubscription)>>deliver: in Block: [ action cull: anAnnouncement cull: announcer ] FullBlockClosure(BlockClosure)>>on:do: [ Processor terminateRealActive ] in [ :ex | | onDoCtx handler bottom thisCtx | onDoCtx := thisContext. thisCtx := onDoCtx home.

		  "find the context on stack for which this method's is sender"

		  [ onDoCtx sender == thisCtx ] whileFalse: [
			  onDoCtx := onDoCtx sender.
			  onDoCtx ifNil: [ "Can't find our home context. seems like we're already forked
			and handling another exception in new thread. In this case, just pass it through handler."
				  ^ handlerAction cull: ex ] ].

		  bottom := [ Processor terminateRealActive ] asContext.
		  onDoCtx privSender: bottom.

		  handler := [ handlerAction cull: ex ] asContext.
		  handler privSender: thisContext sender.

		  (Process forContext: handler priority: Processor activePriority) resume.

		  "cut the stack of current process"
		  thisContext privSender: thisCtx.
		  nil ] in FullBlockClosure(BlockClosure)>>on:fork: in Block: [ Processor terminateRealActive ]

macta avatar Jun 04 '24 23:06 macta

I think the FileOut files out categories wrongly: If you look at your fileout, the preamble has the protocol wrongly as "Protocol (*TimTools) - 1 selector(s)"

!StRewriterDemoRules class methodsFor: 'Protocol (*TimTools) - 1 selector(s)' stamp: '6/4/2024 23:47'!

We should as a first step fix that (it needs to write the name, not the printString of the Protocol)

MarcusDenker avatar Jun 06 '24 09:06 MarcusDenker

One place where this might happen is

ChangeRecord>>#fileOutOn:

MarcusDenker avatar Jun 06 '24 10:06 MarcusDenker