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 seems to mix-up imported grammars #786

Closed
PaulKlint opened this issue Mar 11, 2015 · 4 comments
Closed

TC seems to mix-up imported grammars #786

PaulKlint opened this issue Mar 11, 2015 · 4 comments

Comments

@PaulKlint
Copy link
Member

Compiling the following example gives unexpected error messages that suggest that the Rascal grammar (indeed imported by StaticTestingUtils) is still visible when the Pico grammar is being checked. Both grammars indeed use the names body and name in their rules but this should not lead to this confusion.

module experiments::Compiler::Examples::Tst1

import lang::rascal::tests::types::StaticTestingUtils;

import demo::lang::Pico::Syntax;

gives

error("Field body already defined as type {Statement ;}* on non-terminal type Statement, cannot redefine to type Statement",|project://rascal/src/org/rascalmpl/library/lang/rascal/syntax/Rascal.rsc|(20573,9,<588,7>,<588,16>))
error("Field name already defined as type Id on non-terminal type Expression, cannot redefine to type Name",|project://rascal/src/org/rascalmpl/library/lang/rascal/syntax/Rascal.rsc|(6414,10,<194,7>,<194,17>))
@PaulKlint
Copy link
Member Author

This example comes from lang::rascal::tests::types::PatternTCTests and I just noticed that the import of demo::lang::Pico::Syntax is completely redundant. So in that specific case this error is no show stopper, but it may bite us in the future :-(

@mahills
Copy link
Member

mahills commented Mar 11, 2015

I'll have to go back and look through prior notes, but I think this is clashing with what we decided earlier. Part of the reason we are seeing this is because we are bringing in all the syntax info transitively, even when it isn't in scope, since the compiler needed this. It may be possible, in that case, to have it not register the sorts into the global sort map, but this may cause all sorts of confusion as well.

@PaulKlint
Copy link
Member Author

You are right this seems to be a recurring theme and that probably means that we have not yet found the ideal solution. As for now, let's keep the issue open but wait to address it when a more urgent occurrence surfaces.

@PaulKlint
Copy link
Member Author

Current situation is acceptable.

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