I extended the Entity lang with the following templates:

Definition.VarDecl = <var <ID>:<ID>>
Definition.PropRef = <propRef <ID>.<ID>>

and binding rules:

VarDecl(v, e):
  refers to Entity e
  defines Var v of type e
    
PropRef(v, p):
  refers to Var v
  refers to Property p in Entity e 
    where v has type e

In the following program, the last occurence of name gives an unresolved reference while it should actually reference the property name of Entity User:

module example

entity User {
  name     : String
}

var v1:User
propRef v1.name

Is something broken or did I do something wrong?

Submitted by Oskar van Rest on 23 March 2014 at 06:13

On 23 March 2014 at 06:20 Oskar van Rest commented:

btw, the following error shows up in the console:

Could not create task for property Type on term "v1"

But when I select either of occurences v1, the properties view does show that it is of type User.


On 23 March 2014 at 09:31 Gabriël Konat commented:

The has type proposition does not work on v because there is no typing rule for it. You need to wrap it in a constructor, such as VarRef, and create a typing rule for it in TS:

VarRef(v) : ty
where definition of v : ty

I’ve seen people use this pattern a few times before, we should support getting the type of a name with a resolution task, with has type, for simple cases like these.


On 8 May 2014 at 12:01 Guido Wachsmuth commented:

Was this fixed, Oskar?


On 8 May 2014 at 16:52 Oskar van Rest commented:

Yes it did, closing the issue…


On 8 May 2014 at 16:52 Oskar van Rest closed this issue.

Log in to post comments