-
-
Notifications
You must be signed in to change notification settings - Fork 357
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3906 from VincentBlondeau/FIX/Backportof#3410
[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
- Loading branch information
Showing
3 changed files
with
97 additions
and
6 deletions.
There are no files selected for viewing
79 changes: 79 additions & 0 deletions
79
src/TraitsV2-Tests/T2OverloadingOfMethodsInTraitedClassTest.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
Class { | ||
#name : #T2OverloadingOfMethodsInTraitedClassTest, | ||
#superclass : #T2AbstractTest, | ||
#category : #'TraitsV2-Tests-Tests' | ||
} | ||
|
||
{ #category : #tests } | ||
T2OverloadingOfMethodsInTraitedClassTest >> createT1 [ | ||
| t1 | | ||
t1 := self newTrait: #T1 with: '' asSlotCollection. | ||
t1 classTrait | ||
compile: | ||
'isTrueForUsersOfTheTraitForT2OverloadingOfMethodsInTraitedClassTest | ||
"Should be removed at the end of the test" | ||
^true | ||
'. | ||
TraitedClass | ||
compile: | ||
'isTrueForUsersOfTheTraitForT2OverloadingOfMethodsInTraitedClassTest | ||
"Should be removed at the end of the test" | ||
^false | ||
'. | ||
Behavior | ||
compile: | ||
'isTrueForUsersOfTheTraitForT2OverloadingOfMethodsInTraitedClassTest | ||
"Should be removed at the end of the test" | ||
^false | ||
'. | ||
^ t1 | ||
] | ||
|
||
{ #category : #tests } | ||
T2OverloadingOfMethodsInTraitedClassTest >> createT2 [ | ||
^ self newTrait: #T2 with: '' asSlotCollection | ||
] | ||
|
||
{ #category : #running } | ||
T2OverloadingOfMethodsInTraitedClassTest >> tearDown [ | ||
TraitedClass | ||
removeSelector: #isTrueForUsersOfTheTraitForT2OverloadingOfMethodsInTraitedClassTest. | ||
Behavior | ||
removeSelector: #isTrueForUsersOfTheTraitForT2OverloadingOfMethodsInTraitedClassTest. | ||
super tearDown | ||
] | ||
|
||
{ #category : #tests } | ||
T2OverloadingOfMethodsInTraitedClassTest >> testDirectTraitSubclassing [ | ||
| t1 c1 | | ||
t1 := self createT1. | ||
c1 := self newClass: #C1 with: '' asSlotCollection uses: t1. | ||
self | ||
assert: | ||
c1 isTrueForUsersOfTheTraitForT2OverloadingOfMethodsInTraitedClassTest | ||
] | ||
|
||
{ #category : #tests } | ||
T2OverloadingOfMethodsInTraitedClassTest >> testIndirectTraitSubclassing [ | ||
| t1 t2 superclass subclass | | ||
t1 := self createT1. | ||
t2 := self createT2. | ||
superclass := self | ||
newClass: #C2Superclass | ||
with: '' asSlotCollection | ||
uses: t2. | ||
|
||
subclass := self | ||
newClass: #C1Subclass | ||
superclass: superclass | ||
with: '' asSlotCollection | ||
uses: t1. | ||
self | ||
deny: | ||
superclass | ||
isTrueForUsersOfTheTraitForT2OverloadingOfMethodsInTraitedClassTest. | ||
self | ||
assert: | ||
subclass | ||
isTrueForUsersOfTheTraitForT2OverloadingOfMethodsInTraitedClassTest | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters