resolves to does not reuse the in clauses from the refers to on the same term. (I expected it to reuse the same tasks for resolving rather than creating a new computation.)

Since resolves to does not reuse the in clauses from the refers to one needs an in clause for correctly resolving references in something else than the current scope.

Example

Example code:

system debug

	class A {
		attributes
			b : B
		methods
			m1 { b . updateA (a? = 3) }		
	}
	
	class B {
		attributes
			a : INT
			c : A
		methods
			m0 { updateA (a? = 3) }	
			m2 { c. b . updateA (a? = 3) }	
			updateA { a' = a + a? }
	}

a? in m1 { b . updateA (a? = 3) } is now resolved in scopes [/ Class:"A"#0 / System:"debug"#0 /, / System:"debug"#0 /, / /], while it should be resolved in Class:B.

Nabl spec:

MethodReference(PathStart(m-ref, prime), params):
	implicitly defines MethodReference MethodReference()
		of type m-def
		in params
		where m-ref resolves to Method m-def
	
MethodReference(Path(path-start, PathComponent(m-ref, prime)), params):
	implicitly defines MethodReference MethodReference()
		of type m-def
		of type2 path-start-ty
		in params
		where m-ref resolves to Method m-def //in Class path-start-ty
		and path-start has type path-start-ty
	
Param(v):
	refers to Variable v in Method m
	where MethodReference() resolves to MethodReference m-ref
	and m-ref has type m
Submitted by Daco Harkes on 14 January 2015 at 16:19

Log in to post comments