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

Validation Problem #7

Closed
GoogleCodeExporter opened this issue Apr 7, 2015 · 3 comments
Closed

Validation Problem #7

GoogleCodeExporter opened this issue Apr 7, 2015 · 3 comments

Comments

@GoogleCodeExporter
Copy link
Contributor

I've been struggling with a Magritte validation problem. I find that a 
condition I add (using #addCondition:labelled:) to a MABooleanDescription is 
only intermittently called.

I've simplified the conditions to reproduce the problem to a component 
description comprising of two MABooleanDescription descriptions. The second 
description includes the condition which is intermittently called.

If the value of the first description is true (ie the checkbox is checked) the 
second description's condition will be executed, however if it is false it will 
never be executed.

I suspect the problems lies in the code in  
MAValidatorVisitor>>#visitContainer: which calls MAGraphVisitor>>#use:during: 
which is as follows:

MAGraphVisitor >>use: anObject during: aBlock
    | previous |
    (seen includes: anObject)
        ifTrue: [ ^ self ].
    anObject isNil
        ifFalse: [ seen add: anObject ].
    previous := object. object := anObject.
    aBlock ensure: [ object := previous ]

If the first check box is false, and the second is also false then (seen 
includes: anObject) will return true and method returns early resulting in 
block associated with second description (self visit: description) never being 
executed. 

I've attached a file out of a simple component TestMagritteValidation 
illustrating the problem that I tested in the latest build from Hudson.

Thanks
Nick 

Original issue reported on code.google.com by renggli on 11 Oct 2010 at 7:29

@GoogleCodeExporter
Copy link
Contributor Author

Original comment by renggli on 11 Oct 2010 at 7:30

Attachments:

@GoogleCodeExporter
Copy link
Contributor Author

Not limited to MABooleanDescription, but to any description that can describe 
an identical object multiple times, e.g. MANumberDescription, 
MAClassDescription, MASingleOptionDescription, MASymbolDescription, ...

Original comment by renggli on 11 Oct 2010 at 7:34

@GoogleCodeExporter
Copy link
Contributor Author

A fix for the main issue is attached.

Original comment by p3ano...@gmail.com on 12 Oct 2010 at 12:33

Attachments:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants