Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metaclass (and TraitedMetaclass) DNU #classVariableNamed:ifAbsent: #2327

Closed
seandenigris opened this issue Dec 31, 2021 · 9 comments
Closed

Comments

@seandenigris
Copy link
Contributor

Screen Shot 2021-12-31 at 8 40 10 AM

I thought I had reported this, but don't see an issue...

@girba
Copy link
Member

girba commented Dec 31, 2021

How do you get this?

@seandenigris
Copy link
Contributor Author

That one bubbled up from the system somewhere. I don’t remember exactly the steps. There was another way in the inspector. Let me try to record steps

@seandenigris
Copy link
Contributor Author

I got some more info from the debug log in case it helps:

TraitedMetaclass(Object)>>doesNotUnderstand: #classVariableNamed:ifAbsent:
[
			object class
				classVariableNamed: aSymbol
				ifAbsent: [ nil ] ] in GtSlotVariablesBindings>>bindingOf:
LayoutClassScope(LayoutAbstractScope)>>resolveSlot:ifFound:ifNone:
FixedLayout(PointerLayout)>>resolveSlot:ifFound:ifNone:
TraitedMetaclass(ClassDescription)>>gtSlotNamed:ifFound:ifNone:
GtSlotVariablesBindings>>bindingOf:
[ :eachVariableBindings |
		(eachVariableBindings bindingOf: aSymbol)
			ifNotNil: [ :aVariable | ^ aVariable ] ] in GtCompositeVariablesBindings>>bindingOf:
OrderedCollection>>do:
GtCompositeVariablesBindings>>bindingOf:
GtPharoSourceCoderEvaluationContext>>bindingOf:
OCRequestorScope>>lookupVar:declare:
OCMethodScope(OCAbstractMethodScope)>>lookupVar:declare:
OCBlockScope(OCAbstractMethodScope)>>lookupVar:declare:
OCBlockScope(OCAbstractScope)>>lookupVarForDeclaration:
OCASTSemanticAnalyzer>>declareVariableNode:as:
OCASTSemanticAnalyzer>>declareArgumentNode:
[:node | self declareArgumentNode: node ] in OCASTSemanticAnalyzer>>visitBlockNode:
OrderedCollection>>do:
OCASTSemanticAnalyzer>>visitBlockNode:
RBBlockNode>>acceptVisitor:
OCASTSemanticAnalyzer(RBProgramNodeVisitor)>>visitNode:
[ :each | self visitNode: each ] in OCASTSemanticAnalyzer(RBProgramNodeVisitor)>>visitMessageNode:
OrderedCollection>>do:
OCASTSemanticAnalyzer(RBProgramNodeVisitor)>>visitMessageNode:
RBMessageNode>>acceptVisitor:
OCASTSemanticAnalyzer(RBProgramNodeVisitor)>>visitNode:
OCASTSemanticAnalyzer(RBProgramNodeVisitor)>>visitReturnNode:
RBReturnNode>>acceptVisitor:
OCASTSemanticAnalyzer(RBProgramNodeVisitor)>>visitNode:
[ :each | self visitNode: each ] in OCASTSemanticAnalyzer>>visitSequenceNode:
Array(SequenceableCollection)>>do:
OCASTSemanticAnalyzer>>visitSequenceNode:
RBSequenceNode>>acceptVisitor:
OCASTSemanticAnalyzer(RBProgramNodeVisitor)>>visitNode:
OCASTSemanticAnalyzer>>visitMethodNode:
RBMethodNode>>acceptVisitor:
OCASTSemanticAnalyzer(RBProgramNodeVisitor)>>visitNode:
OCASTSemanticAnalyzer>>analyze:
RBMethodNode>>doSemanticAnalysis
 - - - - - - - - - - - - - - -  
			- - - - - - - - - - - - - - - - - -
[ast doSemanticAnalysis] in OpalCompiler>>doSemanticAnalysis
FullBlockClosure(BlockClosure)>>on:do:
OpalCompiler>>doSemanticAnalysis
OpalCompiler>>transformDoit
OpalCompiler>>parseDoIt
OpalCompiler>>compileDoit
[compilationContext noPattern 
		ifTrue: [ self compileDoit ]
		ifFalse: [ self compileMethod ]] in OpalCompiler>>compile
FullBlockClosure(BlockClosure)>>on:do:
OpalCompiler>>compile
[
		self class compiler
			source: aSourceString;
			class: methodClass newAnonymousSubclass;
			context: aGtPharoSourceCoderEvaluationContext runtimeContext;
			requestor: aGtPharoSourceCoderEvaluationContext;
			noPattern: isForMethod not;
			failBlock: anEvaluationFailBlock;
			compile ] in GtPharoSnippetCoder(GtPharoSourceCoder)>>primitiveAnonymousCompile:inContext:onFailDo:
FullBlockClosure(BlockClosure)>>on:do:
[
		aBlock
			on: Exception
			do: [ :anException |
				"it is very important that the monitor is not locked when an exception happens"
				monitor exit.
				"after an #exit call the monitor is open for another process, so if users start to compile code
				from within the debugger. If debugger code compilation is not wrapped in this critical block,
				there might be a problem of code modification from multiple processes. The chance of this, however, is very slim."
				anException pass ] ] in GtPharoCodeModifier>>critical:
[
	self enter.
	aBlock value] in Monitor>>critical:
FullBlockClosure(BlockClosure)>>ensure:
Monitor>>critical:
GtPharoCodeModifier>>critical:
GtPharoSnippetCoder(GtPharoSourceCoder)>>primitiveAnonymousCompile:inContext:onFailDo:
GtPharoSnippetCoder(GtPharoSourceCoder)>>primitiveEvaluate:inContext:onFailDo:
[ 
		self
			primitiveEvaluate: aDecoratedSourceString
			inContext: aSourceCoderEvaluationContext
			onFailDo: [
				| aResultWithSyntaxError |

				aResultWithSyntaxError := GtSourceCoderEvaluationResultWithSyntaxError new
					evaluationContext: aSourceCoderEvaluationContext.
				aThenBlock cull: aResultWithSyntaxError.
				^ aResultWithSyntaxError ] ] in GtPharoSnippetCoder(GtSourceCoder)>>evaluate:decorated:inContext:thenDo:
FullBlockClosure(BlockClosure)>>on:do:
GtPharoSnippetCoder(GtSourceCoder)>>evaluateBlock:onErrorDo:
GtPharoSnippetCoder(GtSourceCoder)>>evaluate:decorated:inContext:thenDo:
GtPharoSnippetCoder(GtSourceCoder)>>evaluate:inContext:thenDo:
GtPharoSnippetCoder(GtSourceCoder)>>doItAndGoInContext:
GtPharoSnippetCoderViewModel(GtSourceCoderViewModel)>>doItAndGoAll
GtPharoSnippetCoderViewModel(GtSourceCoderViewModel)>>doItAndGo

seandenigris added a commit to seandenigris/Pharo-Enhancements that referenced this issue Jan 1, 2022
Pending resolution of feenkcom/gtoolkit/issues/2327

OT: NB. this alternate implementation from Date was removed from UFFA:
```smalltalk
subtractYears: anInteger

	(self monthIndex = 2 and: [ self dayOfMonth = 29 ]) ifTrue: [ self error: 'Subtracting years from a leap year is undefined' ].
	^ Date year: self year - anInteger month: self monthName day: self dayOfMonth.
```

Noting that here because it differs from our implementation and can't remember why!
@botwhytho
Copy link

I don't have logs but I've recently consistently encountered it by running code in a class specific inspector, which I do plenty, but recently have had to move to doing in a Playground in another tab because of this regression. An example below.

image

@girba
Copy link
Member

girba commented Jan 3, 2022

I cannot reproduce this. Can you reproduce it consistently in the latest version?

@botwhytho
Copy link

Not consistently, but sporadically in 0.8.1145. I've experienced this in the scenario I mention above (Class inspector as opposed to snippet in playground) consistently, but not ALL the time, so sporadic since ~0.8.1100

@syrel
Copy link
Member

syrel commented Jan 3, 2022

Hi

This turned out to be a bug in Pharo. Metaclass is not polymorphic with Class... I reported it and it is fixed in Pharo 10. pharo-project/pharo#10334

I think we should add a patch to Pharo while building GT :)

@seandenigris
Copy link
Contributor Author

syrel added a commit to feenkcom/gtoolkit-maestro-rs that referenced this issue Jan 6, 2022
@syrel
Copy link
Member

syrel commented Jan 6, 2022

added a patch

@syrel syrel closed this as completed Jan 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants