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

Type of record pattern not resolved #681

Closed
peterwvj opened this issue Apr 30, 2018 · 6 comments
Closed

Type of record pattern not resolved #681

peterwvj opened this issue Apr 30, 2018 · 6 comments
Labels
bug Incorrect behaviour of the tool Mergable A fix is available on a branch to merge for release
Milestone

Comments

@peterwvj
Copy link
Member

peterwvj commented Apr 30, 2018

Description

The type of a record pattern in an invariant is not being resolved.

Steps to Reproduce

  1. Create a file with the following content
module A

exports all
definitions 

state S of
inv mk_S() == true
init s == s = mk_S()
end 

end A
  1. Type-check the model

  2. Inspect the type of the record pattern (first occurence of mk_S()) in the type-checked AST.

Expected behavior: [What you expect to happen]

The type of the record pattern should be a record type.

Actual behavior: [What actually happens]

The type of the record pattern is unresolved (see attached screenshot).
debugger

Reproduces how often: [What percentage of the time does it reproduce?]

Every time.

Versions

Overture 2.6.0.
Ubuntu 17.10
OpenJDK 8, 64 bit.

Additional Information

None.

@peterwvj peterwvj added the bug Incorrect behaviour of the tool label Apr 30, 2018
@peterwvj peterwvj added this to the v2.6.2 milestone Apr 30, 2018
@nickbattle
Copy link
Contributor

This seems to be OK on VDMJ. I'll try to track it down in Overture.

@nickbattle
Copy link
Contributor

From a quick look, this appears to be (yet) another case where VDMJ works by using a reference to the same piece of AST from two or more places, and hence fixing one instance fixes them all. In Overture, you cannot duplicate pieces of AST like this - adding something to the AST in one place removes it from where it came from. These can be tricky to fix. I'll look at it more closely tomorrow.

@peterwvj
Copy link
Member Author

peterwvj commented May 1, 2018

Thanks, Nick!

@nickbattle
Copy link
Contributor

So I tried adding the obvious changes to type check the copy of the record pattern, but for some reason that doesn't work. I'm still trying to understand why... and all the visitors aren't helping :-(

@nickbattle nickbattle added the Mergable A fix is available on a branch to merge for release label May 1, 2018
@nickbattle
Copy link
Contributor

Of course it's about type resolution, not type checking... duh. So I just pushed a type resolve change for StateDefinitions to ncb/development. Can you give it a try?

@peterwvj
Copy link
Member Author

peterwvj commented May 2, 2018

I just tried your fix on a few examples, and it seems to do the job. Many thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Incorrect behaviour of the tool Mergable A fix is available on a branch to merge for release
Projects
None yet
Development

No branches or pull requests

2 participants