[squeak-dev] Please fix menus in the PointerFinder

Tobias Pape Das.Linux at gmx.de
Wed Oct 7 23:06:05 UTC 2015


On 08.10.2015, at 00:23, Eliot Miranda <eliot.miranda at gmail.com> wrote:

> Tobias,
> 
>     no need to apologise.  When we have a 100% test coverage, though, then you'll be in trouble ;-)  Or rather, you won't because you'll know :-)

Because you touched the topic... ;D
The changes to the shadowing code broke the decompiler
and makes the DecompilerTest unhappy.

Here's the before [1], here after [2].
Note how the o variable gets hoisted for the #ifNotNil: but then
is being shadowed by the :o of the block tempVar.

Where can we fix this?

Best regards
	-Tobias



[1]: >>>
ProtoObjectTest>>#testIfNotNilIfNil

	| object returnValue block |
	object := ProtoObject new.
	returnValue := Object new.
	self should: [ object ifNotNil: [ self halt ] ifNil: [ self error ]  ] raise: Halt.
	self should: [ object ifNotNil: [ :o | self halt ] ifNil: [ self error ] ] raise: Halt.
	self assert: (object ifNotNil: [ :o | o == object ] ifNil: [ false ]).
	self assert: (object ifNotNil: [ returnValue ] ifNil: [ false ]) == returnValue.
	self assert: (object ifNotNil: [ :o | returnValue ] ifNil: [ false ]) == returnValue.
	"Now the same without inlining."
	block := [ self halt ].
	self should: [ object ifNotNil: block ifNil: [ self error ]  ] raise: Halt.
	block := [ :o | self halt ].
	self should: [ object ifNotNil: block ifNil: [ self error ] ] raise: Halt.
	block := [ :o | o == object ].
	self assert: (object ifNotNil: block ifNil: [ false ]).
	block := [ returnValue ].
	self assert: (object ifNotNil: block ifNil: [ false ]) == returnValue.
	block := [ :o | returnValue ].
	self assert: (object ifNotNil: block ifNil: [ false ]) == returnValue

[2]: >>>
ProtoObjectTest>>#testIfNotNilIfNil
	| object returnValue o block |
	object := ProtoObject new.
	returnValue := Object new.
	self
		should: [object
				ifNil: [self error]
				ifNotNil: [self halt]]
		raise: Halt.
	self
		should: [object
				ifNil: [self error]
				ifNotNil: [:o | self halt]]
		raise: Halt.
	self
		assert: ((o := object)
				ifNil: [false]
				ifNotNil: [o == object]).
	self assert: (object
			ifNil: [false]
			ifNotNil: [returnValue])
			== returnValue.
	self assert: ((o := object)
			ifNil: [false]
			ifNotNil: [returnValue])
			== returnValue.
	block := [self halt].
	self
		should: [object
				ifNotNil: block
				ifNil: [self error]]
		raise: Halt.
	block := [:o | self halt].
	self
		should: [object
				ifNotNil: block
				ifNil: [self error]]
		raise: Halt.
	block := [:o | o == object].
	self
		assert: (object
				ifNotNil: block
				ifNil: [false]).
	block := [returnValue].
	self assert: (object
			ifNotNil: block
			ifNil: [false])
			== returnValue.
	block := [:o | returnValue].
	self assert: (object
			ifNotNil: block
			ifNil: [false])
			== returnValue


More information about the Squeak-dev mailing list