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

Fix for issue 22516 #1856

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/TraitsV2-Tests/T2AbstractTest.class.st
Expand Up @@ -10,6 +10,11 @@ Class {
#category : #'TraitsV2-Tests-Tests'
}

{ #category : #'instance creation' }
T2AbstractTest >> newClass: aName [
^self newClass: aName with: #() uses: #()
]

{ #category : #'instance creation' }
T2AbstractTest >> newClass: aName superclass: aSuperclass with: slots uses: aComposition [

Expand Down
26 changes: 26 additions & 0 deletions src/TraitsV2-Tests/T2TraitTest.class.st
Expand Up @@ -155,6 +155,32 @@ T2TraitTest >> testMethodsAddedInMetaclassPresentInSubclassesAfterRemovingSuperc

]

{ #category : #tests }
T2TraitTest >> testSelectorsWithExplicitOrigin [
"Obtain the subset of selectors that are defined either locally or inherited from traits. But, exclude selectors of methods from implicit traits such as TraitedClass"
| t1 c1 |

t1 := self newTrait: #T1 with: #().
t1 compile: 'instanceSideMethod'.
t1 class compile: 'classSideMethod'.
c1 := self newClass: #C1 with: #() uses: t1.
self assertCollection: c1 selectorsWithExplicitOrigin hasSameElements: #(instanceSideMethod).
self assertCollection: c1 class selectorsWithExplicitOrigin hasSameElements: #(classSideMethod).

]

{ #category : #tests }
T2TraitTest >> testSelectorsWithExplicitOriginNoTrait [
"Obtain the subset of selectors that are defined either locally or inherited from traits. But, exclude selectors of methods from implicit traits such as TraitedClass"
| c1 |
c1 := self newClass: #C1.
c1 compile: 'instanceSideMethod'.
c1 class compile: 'classSideMethod'.
self assertCollection: c1 selectorsWithExplicitOrigin hasSameElements: #(instanceSideMethod).
self assertCollection: c1 class selectorsWithExplicitOrigin hasSameElements: #(classSideMethod).

]

{ #category : #tests }
T2TraitTest >> testSequence [
| t1 t2 c1 obj |
Expand Down
5 changes: 5 additions & 0 deletions src/TraitsV2/ClassDescription.extension.st
Expand Up @@ -16,6 +16,11 @@ ClassDescription >> baseComposition [
^ TaEmptyComposition new
]

{ #category : #'*TraitsV2' }
ClassDescription >> selectorsWithExplicitOrigin [
^self traitComposition selectors , self localSelectors
]

{ #category : #'*TraitsV2' }
ClassDescription >> traitComposition [
^ TaEmptyComposition new
Expand Down