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 does not properly resolve parse function #449

Closed
PaulKlint opened this issue Dec 20, 2013 · 4 comments
Closed

TC does not properly resolve parse function #449

PaulKlint opened this issue Dec 20, 2013 · 4 comments

Comments

@PaulKlint
Copy link
Member

import Exception;
import ParseTree;

syntax A = a: "a";

test bool tstA(){
    pt = parse(#A, "a");
    return a() := pt && pt is a;
}

gives

error("Could not instantiate type variables in type fun &T \<: Tree(type[&T \<: Tree], loc) with argument types (type[A],str)",|rascal:///experiments/Compiler/Examples/Tst.rsc|(327,14,<17,9>,<17,23>))
error("Function of type fun &T \<: Tree(type[&T \<: Tree], map[Production robust, list[CharRange] lookaheads], str, loc) cannot be called with argument types (type[A],str)",|rascal:///experiments/Compiler/Examples/Tst.rsc|(327,14,<17,9>,<17,23>))
error("Could not instantiate type variables in type fun &T \<: Tree(type[&T \<: Tree], str) with argument types (type[A],str)",|rascal:///experiments/Compiler/Examples/Tst.rsc|(327,14,<17,9>,<17,23>))
error("Name pt is not in scope",|rascal:///experiments/Compiler/Examples/Tst.rsc|(367,2,<18,24>,<18,26>))
error("Name pt is not in scope",|rascal:///experiments/Compiler/Examples/Tst.rsc|(361,2,<18,18>,<18,20>))
error("Function of type fun &T \<: Tree(type[&T \<: Tree], str, loc) cannot be called with argument types (type[A],str)",|rascal:///experiments/Compiler/Examples/Tst.rsc|(327,14,<17,9>,<17,23>))
|rascal://experiments::Compiler::Rascal2muRascal::RascalModule|(2652,25,<80,12>,<80,37>): "Module contains errors!"

@mahills
Copy link
Member

mahills commented Dec 21, 2013

This is most likely because Tree has a special status in the type system -- it is a normal ADT that also happens to be the supertype of all concrete syntax types.

@PaulKlint
Copy link
Member Author

Do you see a solution for this?

@mahills
Copy link
Member

mahills commented Dec 21, 2013

I think I just need to call my own subtype function which checks this case first and then dispatches to the normal subtype function. I will work on it today.

@mahills
Copy link
Member

mahills commented Dec 22, 2013

This is now working. I added support for making Tree a supertype of all concrete syntax nonterminal types -- this was actually a fairly straightforward addition to ParseTree.rsc. Getting the rest of it working wasn't so straight-forward...

@mahills mahills closed this as completed Dec 22, 2013
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