gsdlab/clafer — Issue #13: inconvenient name resolution
Author: mantkiew
Created: 2012-01-27 16:51:15+00:00
State: open

clafer v.0.2.26-01.2012

If a given name is found locally, upwards in the hierarchy it should take precedence before going through references.

```clafer
abstract Person
age : integer
xor maritalStatus
neverMarried
married
[ age >= 18 ] // here, the modeler clearly means Person.age, not spouse.age
spouse -> Person
[ spouse = parent.parent.parent ] // here, the modeler means spouse.maritalStatus.married.spouse
divorced
children -> Person *
parents -> Person 2
```

The clafer name resolver outputs:

clafer: element is not unique : "age". Available paths:
["c2_age","c9_spouse","c5_married"]
["c2_age","c11_children","c9_spouse","c5_married"]
["c2_age","c12_parents","c9_spouse","c5_married"]
["c2_age","c12_parents","c11_children","c9_spouse","c5_married"]["c2_age","c11_children","c12_parents","c9_spouse","c5_married"]
["c2_age","c9_spouse","c5_married","c3_maritalStatus","c9_spouse","c5_married"]["c2_age","c11_children","c9_spouse","c5_married","c3_maritalStatus","c9_spouse","c5_married"]["c2_age","c12_parents","c9_spouse","c5_married","c3_maritalStatus","c9_spouse","c5_married"]
["c2_age","c9_spouse","c5_married","c3_maritalStatus","c11_children","c9_spouse","c5_married"]["c2_age","c9_spouse","c5_married","c3_maritalStatus","c12_parents","c9_spouse","c5_married"]["c2_age","c12_parents","c11_children","c9_spouse","c5_married","c3_maritalStatus","c9_spouse","c5_married"]
["c2_age","c11_children","c12_parents","c9_spouse","c5_married","c3_maritalStatus","c9_spouse","c5_married"]
["c2_age","c12_parents","c9_spouse","c5_married","c3_maritalStatus","c11_children","c9_spouse","c5_married"]
["c2_age","c9_spouse","c5_married","c3_maritalStatus","c12_parents","c11_children","c9_spouse","c5_married"]
["c2_age","c11_children","c9_spouse","c5_married","c3_maritalStatus","c12_parents","c9_spouse","c5_married"]
["c2_age","c9_spouse","c5_married","c3_maritalStatus","c11_children","c12_parents","c9_spouse","c5_married"]

and

clafer: element is not unique : "spouse". Available paths:
["c6_spouse","c5_married","c3_maritalStatus","c6_spouse"]
["c6_spouse","c5_married","c3_maritalStatus","c15_children","c6_spouse"]
["c6_spouse","c5_married","c3_maritalStatus","c16_parents","c6_spouse"]
["c6_spouse","c5_married","c3_maritalStatus","c16_parents","c15_children","c6_spouse"]
["c6_spouse","c5_married","c3_maritalStatus","c15_children","c16_parents","c6_spouse"]

Also, it would be good if the available paths were presented each in a new line. I reformatted the original output, which looks as follows:

clafer: element is not unique : "spouse". Available paths: ["c6_spouse","c5_married","c3_maritalStatus","c6_spouse"]["c6
_spouse","c5_married","c3_maritalStatus","c15_children","c6_spouse"]["c6_spouse","c5_married","c3_maritalStatus","c16_pa
rents","c6_spouse"]["c6_spouse","c5_married","c3_maritalStatus","c16_parents","c15_children","c6_spouse"]["c6_spouse","c
5_married","c3_maritalStatus","c15_children","c16_parents","c6_spouse"]