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

meta-function confuses typing of default arrow #132

Open
eelcovisser opened this issue Nov 14, 2016 · 4 comments
Open

meta-function confuses typing of default arrow #132

eelcovisser opened this issue Nov 14, 2016 · 4 comments

Comments

@eelcovisser
Copy link
Contributor

The following signature causes various explicated rules on default arrow to mis-typed expecting to see Index instead of V

signature
  sort aliases
    Index = Map(Int, Int)
  variables
    I : Index
  constructors  
    ArrayV : Index -> V 
  arrows    
    initArray(Int, Int, V, Index) --> Index

For example,

  E E1 |- __LValue2Exp__(lv1) :: H H1 -default-> v1 :: H H3
  where
    E E1 |- lv1 :: H H1 -lval-> a1 :: H H2;
    read(a1) :: H H2 -default-> v1 :: H H3.

This rule has a type error in the explicated code.

Running the generated interpreter leads to class cast exception.

There should be no confusion between arrow for meta-function and default arrow.

@eelcovisser
Copy link
Contributor Author

This is probably due to the overloading of the Index sort.

@eelcovisser
Copy link
Contributor Author

Index was already used as sort in the syntax definition to deal with an ambiguity of the Subscript construct:

Index = Exp

This caused a whole bunch of confusion in the type checker by equating Exp and Map(Int, Int).

While the problem is solved for me, the diagnosis should be improved.

@vvergu
Copy link
Member

vvergu commented Nov 15, 2016

What were the errors/warnings that you did receive and what would you have liked different?

@eelcovisser
Copy link
Contributor Author

It is an error to define a sort alias to a primitive type (Int, Map, etc.) if the sort is also used as a syntactic sort (i.e. as target sort for a constructor declaration).

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