I’ve added the example I’m working on to the issue. It’s not directly usable as test case but should give the idea of how to write one.
Cheers, Max > On 17 Jun 2016, at 16:51, Nicolai Hess <[email protected]> wrote: > > > > 2016-06-17 16:41 GMT+02:00 Max Leske <[email protected] > <mailto:[email protected]>>: > I found at least one problem the NEC: NEC assumes that all global bindings > answer a class but that is not true in cases such as Processor and Transcript. > > Can you give a code example where this would fail / raise an error . We > should add a test case for this. > > > > Here’s a fix: > > NECVarTypeGuesser>>pushLiteralVariable: anAssociation > "Push Contents Of anAssociation On Top Of Stack bytecode." > | info | > contextCount > 0 ifTrue:[^self]. > > info := NECTypeInfo definedByMessageSend: (anAssociation value > isBehavior > ifTrue: [ anAssociation value ] > ifFalse: [ anAssociation value class ]). > types add: info > > Issue: > https://pharo.fogbugz.com/f/cases/18513/NEC-fails-to-guess-the-type-of-non-class-bindings > > <https://pharo.fogbugz.com/f/cases/18513/NEC-fails-to-guess-the-type-of-non-class-bindings> > > Cheers, > Max > > >> On 05 Jun 2016, at 17:44, Nicolai Hess <[email protected] >> <mailto:[email protected]>> wrote: >> >> >> >> 2016-06-04 20:41 GMT+02:00 stepharo <[email protected] >> <mailto:[email protected]>>: >> Just to report (I did not have the time to check in 60a) but I got red >> square of death with komitter. >> >> I also got >> >> NECTypedModel>>initializeSelectorsFor: aClass >> |excludedClasses| >> selectors reset. >> excludedClasses := (expanded ifTrue: [#()] ifFalse: [Object >> withAllSuperclasses]). >> selectors addAll: ((aClass allSelectorsWithout: excludedClasses) >> >> collect: [:each | NECSelectorEntry contents: each >> type: #selector]) >> >> >> >> DNU on allSelectorsWithout: >> >> >> with such code >> >> >> mostCommonlyUsedSelectors >> "self mostCommonlyUsedSelectors" >> >> | result | >> result := Bag new. >> environment cla >> >> ^ cursor here >> >> do: [ :each | result addAll: each selectors]. >> ^ result sortedCounts >> >> >> Stef >> >> Can not reproduce the NEC- bug. >> What 5.0 image did you use, the release version? >> In what class did you try to add the method mostCommonlyUsedSelectors? >> >> nicolai >> >> >> > >
