Skip to content

Differentiating #### from # #17879

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

Open
wants to merge 6 commits into
base: Pharo13
Choose a base branch
from

Conversation

Ducasse
Copy link
Member

@Ducasse Ducasse commented Feb 25, 2025

…missing something (my code was not in the reverted PR so I gave up understanding).

…missing something (my code was not in the reverted PR so I gave up understanding).
@Ducasse
Copy link
Member Author

Ducasse commented Feb 25, 2025

This is strange
the build fails with

NewUndeclaredWarning: SycSourceCodeRefactoringCommand>>setUpModelFromContext: (ScopesManager is Undeclared)
NewUndeclaredWarning: SycExtractMethodAndOccurrencesCommand class>>methodEditorShortcutActivation (ClySourceCodeContext is Undeclared)
NewUndeclaredWarning: SycExtractMethodCommand class>>methodEditorShortcutActivation (ClySourceCodeContext is Undeclared)
Instance of Array did not understand #min:
Array(Object)>>doesNotUnderstand: #min:
[
		start := start min: (anArrayOfNodes min: #start).
		stop := stop max: (anArrayOfNodes max: #stop) ] in OCUnfinishedStatementErrorNode class(OCEnglobingErrorNode class)>>from:contents: in Block: [...
FullBlockClosure(BlockClosure)>>cull:
Array(Collection)>>ifNotEmpty:
OCUnfinishedStatementErrorNode class(OCEnglobingErrorNode class)>>from:contents:
OCParser>>parseStatementInto:periodList:withAcceptedStatementClosers:
OCParser>>parseStatementList:into:untilAnyCloserOf:
OCParser>>parseStatements:into:untilAnyCloserOf:
OCParser>>parseMethodBodyInto:
OCParser>>parseMethod

But I do not get the method that is breaking.

@Ducasse
Copy link
Member Author

Ducasse commented Feb 25, 2025

MetacelloNotification: Loaded -> SystemCommands-PackageCommands --- tonel:///builds/workspace/est_and_branch_Pipeline_PR-17879/64/src()
MetacelloNotification: Loaded -> SystemCommands-PackageCommands-Tests --- tonel:///builds/workspace/est_and_branch_Pipeline_PR-17879/64/src()
NewUndeclaredWarning: SycSourceCodeRefactoringCommand>>setUpModelFromContext: (ScopesManager is Undeclared)
NewUndeclaredWarning: SycExtractMethodAndOccurrencesCommand class>>methodEditorShortcutActivation (ClySourceCodeContext is Undeclared)
NewUndeclaredWarning: SycExtractMethodCommand class>>methodEditorShortcutActivation (ClySourceCodeContext is Undeclared)
Instance of Array did not understand #min:
Array(Object)>>doesNotUnderstand: #min:

@Ducasse
Copy link
Member Author

Ducasse commented Feb 25, 2025

In my image with the changes I could recompile all the classes without any problems.
So I do not get it.

@Ducasse
Copy link
Member Author

Ducasse commented Feb 25, 2025

Smalltalk allClassesDo: [ :each |
	each methodsDo: [ :m |
		(m methodClass name, ' >> ', m selector) traceCr.
		OCParser parseMethod: m sourceCode ]]

Reparsing got it!

defaultMenuIconName
	^ ##smallUpdate

To me this not nice that the compiler does not report it correctly.

@Ducasse
Copy link
Member Author

Ducasse commented Feb 25, 2025

Two kinds of tests

AST.Core.Tests.OCCodeSnippetScriptingTest.testEvaluateFaulty(#snippet->an OCCodeSnippet([(#("a"("b"###("c"###["d"]#["e"]["f"]))))]))](https://ci.inria.fr/pharo-ci-jenkins2/job/Test%20pending%20pull%20request%20and%20branch%20Pipeline/job/PR-17879/3/testReport/junit/MacOSX64.AST.Core.Tests/OCCodeSnippetScriptingTest/osx_64___Tests_osx_64___testEvaluateFaulty__snippet__an_OCCodeSnippet______a___b______c______d_____e____f_________/)
AST.Core.Tests.OCCodeSnippetScriptingTest.testEvaluateOnErrorResume(#snippet->an OCCodeSnippet([(#("a"("b"###("c"###["d"]#["e"]["f"]))))]))](https://ci.inria.fr/pharo-ci-jenkins2/job/Test%20pending%20pull%20request%20and%20branch%20Pipeline/job/PR-17879/3/testReport/junit/MacOSX64.AST.Core.Tests/OCCodeSnippetScriptingTest/osx_64___Tests_osx_64___testEvaluateOnErrorResume__snippet__an_OCCodeSnippet______a___b______c______d_____e____f_________/)
AST.Core.Tests.OCCodeSnippetTest.testCompileFaulty(#snippet->an OCCodeSnippet([(#("a"("b"###("c"###["d"]#["e"]["f"]))))]))](https://ci.inria.fr/pharo-ci-jenkins2/job/Test%20pending%20pull%20request%20and%20branch%20Pipeline/job/PR-17879/3/testReport/junit/MacOSX64.AST.Core.Tests/OCCodeSnippetTest/osx_64___Tests_osx_64___testCompileFaulty__snippet__an_OCCodeSnippet______a___b______c______d_____e____f_________/)
AST.Core.Tests.OCCodeSnippetTest.testCompileOnErrorResume(#snippet->an OCCodeSnippet([(#("a"("b"###("c"###["d"]#["e"]["f"]))))]))](https://ci.inria.fr/pharo-ci-jenkins2/job/Test%20pending%20pull%20request%20and%20branch%20Pipeline/job/PR-17879/3/testReport/junit/MacOSX64.AST.Core.Tests/OCCodeSnippetTest/osx_64___Tests_osx_64___testCompileOnErrorResume__snippet__an_OCCodeSnippet______a___b______c______d_____e____f_________/)
AST.Core.Tests.OCScannerTest.testNextLiteralStopAtLastLetter](https://ci.inria.fr/pharo-ci-jenkins2/job/Test%20pending%20pull%20request%20and%20branch%20Pipeline/job/PR-17879/3/testReport/junit/MacOSX64.AST.Core.Tests/OCScannerTest/osx_64___Tests_osx_64___testNextLiteralStopAtLastLetter/)

@Ducasse
Copy link
Member Author

Ducasse commented Feb 25, 2025

I regenerated the snippet
self updateSnippets: self badExpressions in class OCCodeSnippet but it does not change anything.
and I have no idea what is the logic behind testEvaluateFaulty

@Ducasse
Copy link
Member Author

Ducasse commented Feb 25, 2025

testCompileFaulty

	| method |

	self skipIf: #compile.
	method := self compileSnippet: snippet.
	self assert: method isCompiledMethod.

	snippet isFaulty
		ifTrue: [
			| ast |
			self assert: method hasSourceCode.
			self assert: method sourceCode equals: snippet source.
			ast := method ast.
			self assert: ast isFaulty.

			"Some faulty AST can produce non faulty method where no `signalSyntaxError:` is present"
			]
		ifFalse: [
			self deny: method isFaulty ].
	self testExecute: method

@Ducasse
Copy link
Member Author

Ducasse commented Feb 25, 2025

OCCodeSnippetScriptingTest new

	snippet: (OCCodeSnippet badExpressions at: 35);
	setTestSelector: #testEvaluateFaulty; 
	run	

May be the faulty parametrized test instance

@Ducasse Ducasse changed the title I replayed all the changes in a new image and new branch because I'm … Differentiating #### from # Feb 25, 2025
@Ducasse
Copy link
Member Author

Ducasse commented Feb 25, 2025

I do not get it.
I tried the following with all the tests of the class OCCodeSnippetScriptingTest and none of them failed.

OCCodeSnippet badExpressions 
	collect: [ :each |
		OCCodeSnippetScriptingTest new
			snippet: each;
	setTestSelector: #testEvaluateOnErrorResume; 
	run ]

@Ducasse
Copy link
Member Author

Ducasse commented Feb 25, 2025

(OCCodeSnippet allSnippets 
	collect: [ :each |
		OCCodeSnippetScriptingTest new
			snippet: each;
	setTestSelector: #testEvaluateFaulty; 
	run	.
		 ]	) reject: #hasPassed
> #() 

@Ducasse
Copy link
Member Author

Ducasse commented Feb 25, 2025

With DrTests I can access the failing tests this points to

testExecuteBlock: aRunBlock

	| runBlock |
	"a block that apply value on aRunBlock until it's no more a block"
	runBlock := [
	            | value block phonyBlockArgs |
	            block := aRunBlock.
	            [  phonyBlockArgs := (1 to: block numArgs) asArray.
	               value := block valueWithArguments: phonyBlockArgs.
	               value isBlock ] whileTrue: [ block := value ].
	            value ].

	"Now we can evaluate and check the various possible expectations"
	snippet messageNotUnderstood ifNotNil: [ :mnu |
		runBlock onDNU: mnu do: [ ^ self ].
		self signalFailure: 'Should have raised MNU ' , mnu ].

	snippet raise ifNotNil: [ :class |
		^ self should: runBlock raise: class ].

	snippet hasValue
		ifFalse: [ self should: runBlock raise: OCRuntimeSyntaxError ]
		ifTrue: [ self assert: runBlock value equals: snippet value ]

@Ducasse
Copy link
Member Author

Ducasse commented Feb 25, 2025

This test was passed with a block raising an runtime syntactical error I do not even get how this because #### is not forbidden by the scanner. OK we can get a string but the string should be scanned after. So may be it was not.
But frankly this is too much for nothing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant