Doesn’t properly resolve a Var(x) where x refers to a Field. We think this is due to the presence of multiple namespaces in the rule for Var since the Type(x) rules resolve properly.


namespaces

Module
Class
Field
Function
Variable

rules

Module(x, _) : 
	defines Module x
	scopes Class
	
Class(x, _) :
	defines Class x of type Type(x)
	scopes Field
	

Parameter(t, x) :
	defines Variable x of type t
	
Field(t, x) :
	defines Field x of type t

Function(x,p*,b) :
	defines Function x 
	scopes Variable
	
Type(x) :
	refers to Class x
	refers to Class "String"
	refers to Class "Int"
	
Var(x):		
	refers to Variable x
	refers to Field x

Submitted by Hassan Chafi on 28 October 2012 at 06:11

On 28 October 2012 at 11:27 Gabriël Konat commented:

This is a bug in the name resolution algorithm.
A workaround is to change every “scopes Field” and “scopes Variable” to scope both Fields and variables:

    Class(x, _) :
        defines Class x of type Type(x)
        scopes Variable, Field


    Function(x,p*,b) :
        defines Function x 
        scopes Variable, Field

On 29 October 2012 at 01:21 Hassan Chafi commented:

I made the changes, but still having an issue. resolution fails for Fields inside a function.


On 30 October 2012 at 12:40 Gabriël Konat commented:

Can you show me your project so I can have a look?


On 1 November 2012 at 21:06 Hassan Chafi commented:

I will email you the code.


On 8 January 2013 at 13:01 Eelco Visser tagged nabl

On 8 January 2013 at 13:01 Eelco Visser tagged 1.2

On 18 January 2013 at 20:17 Guido Wachsmuth removed tag 1.2

On 18 January 2013 at 20:17 Guido Wachsmuth tagged 1.1

On 18 January 2013 at 20:17 Guido Wachsmuth commented:

Should work with 1.1 already.


On 30 January 2013 at 12:56 Vlad Vergu tagged client

On 30 January 2013 at 12:57 Vlad Vergu tagged @guwac

On 30 January 2013 at 12:57 Vlad Vergu tagged unconfirmed

On 30 January 2013 at 12:58 Vlad Vergu commented:

This should at least be confirmed before 1.1.


On 2 February 2013 at 01:09 Guido Wachsmuth commented:

This issue is caused by a missing scope.

Currently, classes scope fields. A field f in class c gets a URI Field://c/f. Functions scope variables. A variable v in function f gets a URI Var://f/v. When a variable or field reference vf is resolved, the following URIs can be resolved: Var://f/vf, Field://f/vf, Var://vf, Field://vf. None of these URIs will meet the URI of an actual field, since the class name is missing in the URI.

The definition can be fixed by classes scoping functions. This will include class names in the URIs: Var://c/f/vf, Field://c/f/vf, Var://c/vf, Field://c/vf (this one will actually match fields in the surrounding class), Var://vf, Field://vf.


On 2 February 2013 at 01:09 Guido Wachsmuth closed this issue.

On 2 February 2013 at 01:21 Guido Wachsmuth removed tag unconfirmed

Log in to post comments