Re: Errors caught by gelint in XM_XPATH classes
Eric Bezault <[email protected]>
| Newsgroups | gmane.comp.lang.eiffel.gobo.devel |
|---|---|
| Message-ID | <[email protected]> |
Colin Paul Adams wrote: >>>>>> "Eric" == Eric Bezault <[email protected]> writes: > > Eric> Gelint reports the following errors: [VUAR-2] class > Eric> XM_XPATH_ARRAY_LIST_ITERATOR (33,25): the 1-th actual > Eric> argument (of type 'NONE') does not conform to the > Eric> corresponding formal argument (of type 'G') of feature `has' > > Eric> 3) Use KL_ANY_ROUTINES.same_objects: not a_list.there_exists > Eric> (agent ANY_.same_objects (?, Void)) > > Eric> Solution 3 is the one which will work without any additional > Eric> code. > > ISE 6.1 is rejecting this with: > > Error code: VUAR(2) > Type error: non-conforming actual argument in feature call. > What to do: make sure that type of actual argument conforms to type > of corresponding formal argument. > > Class: XM_XPATH_REVERSE_ARRAY_LIST_ITERATOR [G -> XM_XPATH_ITEM] > Feature: make > Called feature: there_exists (a_test: FUNCTION [ANY, TUPLE [G], BOOLEAN]): BOOLEAN from DS_INDEXABLE > Argument name: a_test > Argument position: 1 > Actual argument type: PREDICATE [KL_ANY_ROUTINES, TUPLE [ANY]] > Formal argument type: FUNCTION [ANY, TUPLE [Generic #1], BOOLEAN] > Line: 37 > list_not_empty: not a_list.is_empty > -> no_void_item: not a_list.there_exists (agent ANY_.same_objects (?, Void)) > do Hmmm, are you sure you don't want to use inline agents? Look at how lovely it would look like: no_void_item: not a_list.there_exists (agent (v: G): BOOLEAN do Result := v = Void end) ;-)) OK, let's try another solution. In order to have something that looks as terse and readable as possible in the client code, I would suggest adding a feature `has_void' in DS_SEARCHABLE and then write your assertion as follows: no_void_item: not a_list.has_void We should note that ARRAY has a feature `all_default', so having `has_default' in DS_SEARCHABLE might look more consistent. But it is not really what we want to express in the assertion, even though in your case the result would be the same. What's your opinion? -- Eric Bezault mailto:[email protected] http://www.gobosoft.com ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone