If I have a NaBL rule like this:

TypeDef(name, cnt):
	defines Type name
	of param-count cnt

Then two TypeDefs that only differ on param-count, e.g. TypeDef("Func", 1) and TypeDef("Func", 2), result in a Duplicate definition error. I would expect NaBL to distinguish the two definitions by their properties and not generate an error. This is neccesary to implement generics (distinguishing Func<TResult> from Func<T1, TResult>) and overloading (distinguishing f(x : int) from f(x : string)).

I’ve added a project that demonstrates this issue.

I can’t use the non-unique keyword here, as that would join all definitions into one, whereas I need separate definitions.

Submitted by D. Pelsmaeker on 27 June 2014 at 12:26
DuplicateDefinition.zip27 June 2014 at 12:26

On 27 June 2014 at 13:15 Guido Wachsmuth commented:

You should turn off the default duplicate check and implement your own check instead. See the assignments of IN4303 on how to do this.

On 27 June 2014 at 13:30 Gabriël Konat commented:

This currently is intended behaviour. You can disable the duplicate definition error by adding nabl-check-disable-duplicate(|uri, ns) = ?NablNsType(), and creating your own constraint rule that checks for this.

Log in to post comments