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 checker: missing exit checks #14

Closed
joey-coleman opened this issue Nov 22, 2013 · 12 comments
Closed

Type checker: missing exit checks #14

joey-coleman opened this issue Nov 22, 2013 · 12 comments
Labels
bug Incorrect behaviour of the tool language Issues in parser, TC, interpreter, POG or CG Mergable A fix is available on a branch to merge for release
Milestone

Comments

@joey-coleman
Copy link
Member

The following bug was originally reported on Sourceforge by nick_battle, 2009-09-28 11:31:09:

The type checking of statements which handle exceptions (eg. trap) looks for whether the body of the specification covered can in fact throw exceptions, raising an error if not. This search process is limited in VDMJ. In particular, it cannot cross an operation call, assuming that all operations can raise exceptions. This leads to false negatives - not reporting a TC error, when it should.

@joey-coleman
Copy link
Member Author

Comment by nick_battle, 2013-05-31 21:00:24.329000:

  • Release: --> v2.0.0beta2

@joey-coleman
Copy link
Member Author

Comment by nick_battle, 2013-05-31 21:00:24.573000:

Still present in 2.0.0b2

@joey-coleman
Copy link
Member Author

Comment by nick_battle, 2013-08-09 07:32:45.420000:

  • Release: v2.0.0beta2 --> v2.0.0beta4

@joey-coleman
Copy link
Member Author

Comment by nick_battle, 2013-08-27 15:48:50.271000:

  • Release: v2.0.0beta4 --> v2.0.0beta5

@joey-coleman
Copy link
Member Author

Comment by nick_battle, 2013-09-02 11:07:24.655000:

  • Release: v2.0.0beta5 --> v2.0.0beta6

@joey-coleman
Copy link
Member Author

Comment by nick_battle, 2013-10-16 07:06:17.198000:

  • Release: v2.0.0beta6 --> v2.0.0

@joey-coleman
Copy link
Member Author

Comment by nick_battle, 2013-10-16 07:06:17.629000:

Still in 2.0

@lausdahl
Copy link
Member

Please add test case!

@lausdahl lausdahl added bug and removed legacy labels Feb 20, 2014
@nickbattle
Copy link
Contributor

Here you go...

operations
    op1: () ==> ()
    op1() ==
        trap e with skip in skip;       -- error as expected

    op2: () ==> ()
    op2() ==
        trap e with skip in noop();     -- should also be error, but isn't

    noop: () ==> ()
    noop() == skip;     -- NB. no exceptions!

@joey-coleman joey-coleman modified the milestones: v2.0.6, v2.0.4 Mar 10, 2014
@joey-coleman joey-coleman modified the milestones: v2.0.8, v2.0.6 Apr 1, 2014
@joey-coleman joey-coleman modified the milestones: v2.0.10, v2.0.8 May 19, 2014
@joey-coleman joey-coleman modified the milestones: v2.1.2, v2.1.4 Oct 7, 2014
@ldcouto ldcouto modified the milestones: v2.1.4, v2.1.6 Nov 19, 2014
@joey-coleman joey-coleman modified the milestones: v2.1.8, v2.1.6 Jan 15, 2015
@ldcouto ldcouto removed this from the v2.2.2 milestone Feb 26, 2015
@peterwvj peterwvj modified the milestones: v2.5.4, v2.5.2 Sep 11, 2017
@peterwvj peterwvj modified the milestones: v2.5.4, v2.5.6 Nov 9, 2017
@peterwvj peterwvj modified the milestones: v2.5.6, v2.5.8 Dec 11, 2017
@peterwvj peterwvj modified the milestones: v2.6.0, v2.6.2 Feb 16, 2018
@peterwvj peterwvj modified the milestones: v2.6.2, v2.6.4 May 17, 2018
@peterwvj peterwvj modified the milestones: v2.6.4, v2.6.6 Oct 18, 2018
@peterwvj peterwvj modified the milestones: v2.7.0, v2.7.2 Jun 3, 2019
@peterwvj peterwvj modified the milestones: v2.7.2, v2.7.4 Sep 30, 2019
@nickbattle nickbattle added the language Issues in parser, TC, interpreter, POG or CG label Dec 20, 2019
@nickbattle
Copy link
Contributor

This is now much improved in VDMJ and the example above is certainly reporting problems correctly:

Parsed 1 module in 0.124 secs. No syntax errors
Error 3241: Body of trap statement does not throw exceptions in 'DEFAULT' (test.vdm) at line 4:9
Error 3241: Body of trap statement does not throw exceptions in 'DEFAULT' (test.vdm) at line 8:9
Type checked 1 module in 0.254 secs. Found 2 type errors

Applying the changes to the Overture visitor framework next...

@nickbattle
Copy link
Contributor

Now fixed in Overture on ncb/development.

@nickbattle nickbattle removed their assignment Dec 21, 2019
@nickbattle nickbattle added the Mergable A fix is available on a branch to merge for release label Dec 21, 2019
nickbattle added a commit that referenced this issue Dec 22, 2019
@nickbattle
Copy link
Contributor

Added some extra changes that allow expressions to be searched for exit clauses (via their apply calls, which may be operations that raise exceptions).

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 language Issues in parser, TC, interpreter, POG or CG Mergable A fix is available on a branch to merge for release
Projects
None yet
Development

No branches or pull requests

6 participants