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

Five static errors in /lang/rascal/tests/basic/Maps.rsc, mostly, related to empty maps #741

Closed
PaulKlint opened this issue Dec 12, 2014 · 2 comments

Comments

@PaulKlint
Copy link
Member

error("Product not defined on void and void",|project://rascal/src/org/rascalmpl/library/lang/rascal/tests/basic/Maps.rsc|(915,3,<26,32>,<26,35>))
error("map[int, int] and map[str, str] incomparable",|project://rascal/src/org/rascalmpl/library/lang/rascal/tests/basic/Maps.rsc|(1728,10,<49,8>,<49,18>))
error("map[int, int] and map[str, str] incomparable",|project://rascal/src/org/rascalmpl/library/lang/rascal/tests/basic/Maps.rsc|(2819,10,<85,10>,<85,20>))
error("value must be a subtype of void",|project://rascal/src/org/rascalmpl/library/lang/rascal/tests/basic/Maps.rsc|(626,8,<20,41>,<20,49>))
error("map[int, int] and map[real, int] incomparable",|project://rascal/src/org/rascalmpl/library/lang/rascal/tests/basic/Maps.rsc|(3020,18,<94,24>,<94,42>))
@jurgenvinju
Copy link
Member

  • the first message is very interesting. The type checker is right because truly the whole expression does not have any possible meaning. It sees the list is empty and because emptiness is represented first class in the type system by void it can compute that the multiplication does not make sense. I believe this is great and we should make the test more complex to make the type checker not able to see this.
  • the second message is a correct static error afaik; this is where the type checker can help if types are incomparable a comparison between values does not make sense (i.e. is either tautological or contradictory).
  • same for the third
  • the fourth message is the same story as the first message
  • the fifth is the same story as the second

I propose we:

  • rewrite the tests such that the type checker can't find the tautologies
  • invest in the future to explain these tautologies better in the error message

@jurgenvinju
Copy link
Member

Either that or we define that void is defined on all operators, which is also a valid static interpretation and will hide the first and the fourth message but not the second, third and fifth.

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

3 participants