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

[Trait] Impossible to use from a classTrait a method that is also defined in a subclass of Behavior even when following the doc #3410

Closed
VincentBlondeau opened this issue May 24, 2019 · 5 comments · Fixed by #3904

Comments

@VincentBlondeau
Copy link
Contributor

Following of #3389

So I try what is written in the doc, and it happens that it fails. I expect that the Trait MyTrait takes the lead on the methods that are defined on the class side.

Example to reproduce the issue:

Trait
	named: #MyTrait
	uses: {}
	category: 'TestTrait'.

(Smalltalk globals at: #MyTrait) classTrait compile: 'obsolete2 ^true' classified: 'testing'.
(Smalltalk globals at: #Behavior)  compile: 'obsolete2 ^false' classified: 'testing'.
(Smalltalk globals at: #TraitedClass)  compile: 'obsolete2 ^false' classified: 'testing'.


Object subclass: #MyTraitUser
	uses: (Smalltalk globals at: #MyTrait) 
	instanceVariableNames: ''
	classVariableNames: ''
	package: 'TestTrait'.

self assert: (Smalltalk globals at: #MyTraitUser) class obsolete2
VincentBlondeau added a commit to VincentBlondeau/pharo that referenced this issue May 24, 2019
@VincentBlondeau
Copy link
Contributor Author

With the previous commit, this assertion is true:

self assert: ((Smalltalk globals at: #MyTraitUser) class >> #obsolete) sourceCode
 = 'obsolete ^true'.

But sill not this one...
self assert: (Smalltalk globals at: #MyTraitUser) class obsolete2

@VincentBlondeau
Copy link
Contributor Author

Actually the good assertion is self assert: (Smalltalk globals at: #MyTraitUser) obsolete2 and not self assert: (Smalltalk globals at: #MyTraitUser) class obsolete2

@VincentBlondeau
Copy link
Contributor Author

Tests still should be added related to #3426 .

Backport have to be done too

@VincentBlondeau
Copy link
Contributor Author

There is still an issue when there is a trait that is already used in the superclass. The subclass does not contain the right method. Test will be added in a PR

VincentBlondeau added a commit to VincentBlondeau/pharo that referenced this issue Jul 12, 2019
add tests for issue
Fix previous failing test
tesonep added a commit that referenced this issue Jul 17, 2019
Fix Fully #3410- [Trait] Impossible to use from a classTrait a method that is also defined in a subclass of Behavior even when following the doc
@VincentBlondeau
Copy link
Contributor Author

#3906 should be integrated too

MarcusDenker added a commit that referenced this issue Jul 19, 2019
[Backport] Fix for #3410-[Trait] Impossible to use from a classTrait a method that is also defined in a subclass of Behavior even when following the doc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant