pharo-project / pharo

Pharo is a dynamic reflective pure object-oriented language supporting live programming inspired by Smalltalk.
http://pharo.org
Other
1.2k stars 355 forks source link

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

Open macta opened 3 months ago

macta commented 3 months ago

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:

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 commented 3 months ago

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 ]
MarcusDenker commented 3 months ago

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 commented 3 months ago

One place where this might happen is

ChangeRecord>>#fileOutOn: