Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TC assigns too large type to parameterized field of data constructor #457

Closed
PaulKlint opened this issue Dec 22, 2013 · 2 comments
Closed

Comments

@PaulKlint
Copy link
Member

In the following (correct) example str s2 = m.tval2 is not accepted by the type checker:

module experiments::Compiler::Examples::Tst

data Exp1[&T] = tval(&T tval) | tval2(&T tval1, &T tval2) | ival(int x);

value main(list[value] args) {m = tval2("abc", "def"); str s2 = m.tval2; return s2 == "def";}   

gives

error("Initializer type &T \<: value not assignable to variable of type str",|rascal:///experiments/Compiler/Examples/Tst.rsc|(178,12,<5,59>,<5,71>))
@mahills
Copy link
Member

mahills commented Dec 23, 2013

All the declared fields for ADTs are tracked in a map so we know what the type of each field is. The problem was that the field types were not being instantiated with the type parameter bindings. The good news is that all the field type logic is in one function, so we don't need to change this for field access, field update, etc.

@PaulKlint
Copy link
Member Author

Confirmed.Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants