NewTools icon indicating copy to clipboard operation
NewTools copied to clipboard

Can't load NewTools-FileDialog

Open ackerleytng opened this issue 5 years ago • 5 comments

I'm getting a #asTraitComposition was sent to nil, where Smalltalk compiler evaluate: self traitCompositionString is nil.

To reproduce, I'm using a Pharo 9.0 image and after doing this

Metacello new
    baseline: 'NewTools';
    repository: 'github://pharo-spec/NewTools';
    load.

I manually loaded NewTools-FileDialog and got this issue.

I noticed that TSpDynamicPresenter is nowhere in this repository, could that be why?

ackerleytng avatar Aug 10 '20 01:08 ackerleytng

Hi @ackerleytng it is possible you need to also load https://github.com/pharo-spec/Spec

StevenCostiou avatar Aug 10 '20 07:08 StevenCostiou

@StevenCostiou I tried loading Spec with the Metacello code on the Spec readme, but I'm still getting the same error. I tried editing the .class.st file directly, and I'm able to load FileDialog if I delete these two lines

	#traits : 'TSpDynamicPresenter',
	#classTraits : 'TSpDynamicPresenter classTrait',

Is there something else I can try?

ackerleytng avatar Aug 10 '20 14:08 ackerleytng

Here's the full stack in the debugger, which I get when I load FileDialog.

UndefinedObject(Object)>>doesNotUnderstand: #asTraitComposition
UndefinedObject>>doesNotUnderstand: #asTraitComposition
MCClassDefinition>>traitCompositionCompiled
[ :builder | 
			builder
				superclass: superClass;
				name: name;
				layoutClass: (ObjectLayout layoutForType: type);
				slots: self instanceVariables;
				sharedVariables: self classVariables;
				sharedPools: self sharedPoolsString;
				classSlots: self classInstanceVariables;
				traitComposition: self traitCompositionCompiled;
				classTraitComposition: self classTraitCompositionCompiled;
				comment: comment stamp: commentStamp;
				category: category;
				environment: superClass environment ] in [ Smalltalk classInstaller
		make: [ :builder | 
			builder
				superclass: superClass;
				name: name;
				layoutClass: (ObjectLayout layoutForType: type);
				slots: self instanceVariables;
				sharedVariables: self classVariables;
				sharedPools: self sharedPoolsString;
				classSlots: self classInstanceVariables;
				traitComposition: self traitCompositionCompiled;
				classTraitComposition: self classTraitCompositionCompiled;
				comment: comment stamp: commentStamp;
				category: category;
				environment: superClass environment ] ] in MCClassDefinition>>createClass in Block: [ :builder | ...
ShiftClassInstaller>>make:
ShiftClassInstaller class>>make:
[ Smalltalk classInstaller
		make: [ :builder | 
			builder
				superclass: superClass;
				name: name;
				layoutClass: (ObjectLayout layoutForType: type);
				slots: self instanceVariables;
				sharedVariables: self classVariables;
				sharedPools: self sharedPoolsString;
				classSlots: self classInstanceVariables;
				traitComposition: self traitCompositionCompiled;
				classTraitComposition: self classTraitCompositionCompiled;
				comment: comment stamp: commentStamp;
				category: category;
				environment: superClass environment ] ] in MCClassDefinition>>createClass in Block: [ Smalltalk classInstaller...
FullBlockClosure(BlockClosure)>>on:do:
MCClassDefinition>>createClass
MCClassDefinition>>load
MCClassDefinition(MCDefinition)>>addMethodAdditionTo:
[ :each | each addMethodAdditionTo: methodAdditions ] in MCPackageLoader>>basicLoadDefinitions in Block: [ :each | each addMethodAdditionTo: methodAddition...etc...
[ :each | | newLabel |
			"Special handling for first and last element"
			(count = 0 or: [ count + 1 = size or: [(Time millisecondsSince: lastUpdate) >= msecs]]) 
				ifTrue: [ 
					bar current: count.
					oldLabel = (newLabel := (labelBlock cull: each) ifNil: [oldLabel]) 
						ifFalse: [
							bar label: newLabel.
							oldLabel := newLabel ].
				lastUpdate := Time millisecondClockValue ].
			aBlock value: each.
			count := count + 1 ] in [:bar |
		labelBlock := aStringOrBlock isString
			ifTrue: [
				bar label: aStringOrBlock.
				[ :dummyItem | aStringOrBlock] ]
			ifFalse: [ aStringOrBlock ].

		self do: [ :each | | newLabel |
			"Special handling for first and last element"
			(count = 0 or: [ count + 1 = size or: [(Time millisecondsSince: lastUpdate) >= msecs]]) 
				ifTrue: [ 
					bar current: count.
					oldLabel = (newLabel := (labelBlock cull: each) ifNil: [oldLabel]) 
						ifFalse: [
							bar label: newLabel.
							oldLabel := newLabel ].
				lastUpdate := Time millisecondClockValue ].
			aBlock value: each.
			count := count + 1 ] ] in OrderedCollection(Collection)>>do:displayingProgress:every: in Block: [ :each | | newLabel |...
OrderedCollection>>do:
[:bar |
		labelBlock := aStringOrBlock isString
			ifTrue: [
				bar label: aStringOrBlock.
				[ :dummyItem | aStringOrBlock] ]
			ifFalse: [ aStringOrBlock ].

		self do: [ :each | | newLabel |
			"Special handling for first and last element"
			(count = 0 or: [ count + 1 = size or: [(Time millisecondsSince: lastUpdate) >= msecs]]) 
				ifTrue: [ 
					bar current: count.
					oldLabel = (newLabel := (labelBlock cull: each) ifNil: [oldLabel]) 
						ifFalse: [
							bar label: newLabel.
							oldLabel := newLabel ].
				lastUpdate := Time millisecondClockValue ].
			aBlock value: each.
			count := count + 1 ] ] in OrderedCollection(Collection)>>do:displayingProgress:every: in Block: [:bar |...
FullBlockClosure(BlockClosure)>>cull:
[ ^ block cull: self ] in [ self prepareForRunning.
	  CurrentJob value: self during: [ ^ block cull: self ] ] in Job>>run in Block: [ ^ block cull: self ]
[ activeProcess
			psValueAt: index
			put: anObject.
		aBlock value ] in CurrentJob(DynamicVariable)>>value:during: in Block: [ activeProcess...
FullBlockClosure(BlockClosure)>>ensure:
CurrentJob(DynamicVariable)>>value:during:
CurrentJob class(DynamicVariable class)>>value:during:
[ self prepareForRunning.
	  CurrentJob value: self during: [ ^ block cull: self ] ] in Job>>run in Block: [ self prepareForRunning....
FullBlockClosure(BlockClosure)>>ensure:
Job>>run
MorphicUIManager(UIManager)>>displayProgress:from:to:during:
ByteString(String)>>displayProgressFrom:to:during:
OrderedCollection(Collection)>>do:displayingProgress:every:
OrderedCollection(Collection)>>do:displayingProgress:
MCPackageLoader>>basicLoadDefinitions
[self basicLoadDefinitions] in MCPackageLoader>>basicLoad in Block: [self basicLoadDefinitions]

ackerleytng avatar Aug 10 '20 14:08 ackerleytng

I try and I have the same error. I think this error is a consequence of trait renaming, proof: https://github.com/pharo-spec/Spec/issues/748 TSpDynamicPresenter is not existed but SpTDynamicPresenter exist

as we saw self traitCompositionString return 'TSpDynamicPresenter'

we can see from FDPathPresenter.class.st

Class {
	#name : #FDPathPresenter,
	#superclass : #SpPresenter,
	#traits : 'TSpDynamicPresenter',
	#classTraits : 'TSpDynamicPresenter classTrait',
	#instVars : [
		'action',
		'count'
	],
	#category : #'NewTools-FileDialog-UI'
}

so the error come from monticello trying to evaluate 'TSpDynamicPresenter' that don't exist

CafeKrem avatar Aug 10 '20 15:08 CafeKrem

Thanks for the feedback. From monday I will ask pablo to show me how I can work on fix some problems in Spec2 and newTools.

Ducasse avatar Aug 15 '20 17:08 Ducasse