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

Cypress topaz format has trouble when classes in system have empty method category names (I think) #16

Open
dalehenrich opened this issue Oct 31, 2016 · 0 comments

Comments

@dalehenrich
Copy link

Error running Cypress package boilerplate for topaz:

topaz 1> doit
| packageName |
packageName := 'Cypress-GemStoneCompatibilityLayer'.
System myUserProfile symbolList do: [:symDict |
	symDict do: [:possibleClass |
			| toRemove |
		possibleClass isBehavior ifTrue: [
			{possibleClass. possibleClass class} do: [:aClass |
				aClass category = packageName
					ifTrue: [
							"*anythingbutpackagename[-anything]"
						toRemove := aClass categoryNames select: 
										[:each |
										(each first = $* and: [(each size = (packageName size + 1) and: [(each findStringNoCase: packageName startingAt: 2) = 2])
														or: [each size > (packageName size + 1) and: [(each findStringNoCase: packageName startingAt: 2) = 2 and: [(each at: packageName size + 2) = $-]]]])
										or: [each first ~= $*]]
					]
					ifFalse: [
							"*packagename[-anything]"
						toRemove := aClass categoryNames select: 
										[:each |
										each first = $* and: [(each size = (packageName size + 1) and: [(each findStringNoCase: packageName startingAt: 2) = 2])
														or: [each size > (packageName size + 1) and: [(each findStringNoCase: packageName startingAt: 2) = 2 and: [(each at: packageName size + 2) = $-]]]]]
					].
				toRemove do: [:each | aClass removeCategory: each].
			]
		]
	]
].
true.
%
ERROR 2019 , a ImproperOperation occurred (error 2019), reason:objErrCollectionEmpty, An attempt was made to access elements of the empty collection #''. (ImproperOperation)

From code inspection it looks like we need to protect the senders of `#first':

    aClass categoryNames select:
                                        [:each |
                                        each first = $* ...
to something like this:

    aClass categoryNames select:
                                        [:each |
                                        each isEmpty not and: [each first = $* ...

dalehenrich added a commit to dalehenrich/CypressReferenceImplementation that referenced this issue Nov 2, 2016
dalehenrich added a commit to dalehenrich/CypressReferenceImplementation that referenced this issue Nov 2, 2016
…fix for issue rjsargent#16 ... pushing topaz bootstrap files to 3.4.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant