Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Inconsistent Errors With Regards to Name Validity #102
There are a few cases where errors are produces with regards to conflicting names between an implementation and a type. However, the errors seem to be erroneous.
The following example produces an error: "x is already defined in component type contract."
However, this does not produce an error:
Produces "field is already defined in type contract"
While the following does not:
Duplicated on develop branch hash bd1b83d.
The problem lies in the AgreeJavaValidator in the checkNameOverlap() method. At lines 1704..1709 names introduced only in node definitions are excluded. This check should exclude, at a minimum, the cases described above.
However, the root of the problem is that the check does not follow the scoping rules given in the AgreeScopeProvider. It would likely be better to refactor this check to use this scope provider instead to automatically keep the rules in synch.
Also the check does not presently consider names that are introduced in package annex libraries.
On second, thought, the Xtext infrastructure already checks for name duplication automatically. Does this check actually add anything? Or, is it merely superfluous and generates spurious errors?
After looking into this for a few hours, a proper solution is going to take significant effort.
The following appear to be dead ends:
Looks like for now the most expedient way of dealing with this issue is to merely continue excluding names defined within node definitions and add those for linearizations and record fields.