49 Commits

Author SHA1 Message Date
DAILLER Sylvain
f91bb58b89 Generalization of check_unused_vars to logic and program decl
Description:
- Choice was made to not add unused variables when there is no contract
  and no body (no pre/(x)post, and no body).
- For postcondition variable result, we only check variables that are not
  of unit type. And, we report a warning only if the variable is not present
  in all the ensures.
- For result variable, with several imbricated raise, it seems possible to
  have false positive with no location. Removing the no location case which
  seems unhelpful anyway
2019-08-20 15:48:44 +02:00
Andrei Paskevich
e3cc32aa71 Parser: emit a warning on redundant "import" 2018-06-15 17:08:09 +02:00
Jean-Christophe Filliatre
d8d5512577 bench: valid goals 2017-05-15 10:40:41 +02:00
Andrei Paskevich
78ee406451 rename cty_oldies for recursive calls
This prevents us from binding the same oldie variable twice,
see bench/programs/good/rec_oldies.mlw
2017-01-01 21:34:26 +01:00
Jean-Christophe Filliatre
02be08fa14 updated bench/ 2016-02-22 16:10:13 +01:00
Andrei Paskevich
83858597ce WhyML: add "diverges", "reads {}", and "writes {}" effect clauses
- "diverges" states that the computation may not terminate (which
  does not mean that is always diverges: just as any other effect
  annotation, this clause states a possibility of a side effect).

- "reads {}" states that the computation does not access any variable
  except those that are listed elsewhere in the specification (or the
  proper function arguments, if "reads" is in a function spec).

- "writes {}" states that the computation does not modify any mutable
  value.

- If a function definition or an abstract computation may diverge,
  but there is no "diverges" clause in the specification, a warning
  is produced. If a function definition or an abstract computation
  always terminates, but there is a "diverges" clause in the spec,
  an error is produced.

- If there is a "reads" or a "writes" clause in a function definition
  or an abstract computation, then every modified value must be listed
  in "writes" and every accessed external variable not mentioned in
  the spec must be listed in "reads". (Notice that this is a stricter
  requirement than before, when the presence of a "writes" clause
  did not require to specify "reads".) However, one does not have to
  write "reads {}" or "writes {}" if the corresponding lists are empty.
2014-01-20 12:51:32 +01:00
Andrei Paskevich
bb743fab69 fix WhyML warnings about unused variables in examples 2014-01-19 23:35:04 +01:00
Andrei Paskevich
9fd9469c53 whyml: drop read effects
Now that ghost writes are checked via e_syms.syms_pv,
there is no use for read effects anymore.
2013-04-07 17:59:24 +02:00
Andrei Paskevich
dce120fab6 whyml: keep track of pvsymbols and psymbols in expressions
this commit changes the way of tracking occurrences of regions
and type variables for the purposes of generalization, effect
filtering, and effect checks. It restricts the previous
implementation in two aspects:

- a psymbol p can be monomorphic (= non-generalizable) in an effect
  only if p depends (= is defined via) a pvsymbol whose type contains
  the affected region. See bench/programs/bad-typing/recfun.mlw
  for an example. This restriction is required for soundness.

- an argument of a psymbol cannot contain a region shared with
  another argument or an external pvsymbol. However, we do not
  require (so far) that the argument's type doesn't contain the same
  region twice and we allow the result type to contain known regions.
  This restriction is not necessary for soundness, and is introduced
  only to avoid some unintentional user errors and reduce the gap
  between the types that can be implemented in a "let" and the types
  that can be declared in a "val".
2013-04-06 18:33:04 +02:00
Andrei Paskevich
03d1c7b26e whyml: new specification syntax 2012-10-13 00:23:29 +02:00
Andrei Paskevich
fd87a3422d switch to the new implementation of WhyML 2012-07-20 11:08:25 +02:00
Andrei Paskevich
aacf7ac120 whyml: do not lose 'now marks 2012-07-13 09:22:53 +02:00
Andrei Paskevich
f924e69e5f whyml: keep varmap in psymbols (needed for spec filtering) 2012-07-12 17:23:43 +02:00
Jean-Christophe Filliatre
316f02ade3 fixed bug #13445 2012-02-03 17:15:17 +01:00
Jean-Christophe Filliatre
1267c59a5b fixed bug #13853 (mutual recursive functions and exceptions) 2012-02-03 08:56:00 +01:00
Jean-Christophe Filliatre
2165340a9f terminology: code labels are renamed to (code) marks
new syntax 'L: to introduce a mark
new syntax at t 'L in logical expressions
2011-07-05 14:28:31 +02:00
Andrei Paskevich
ba8bd4b57c remove trailing whitespace, tabs, and latin1 characters 2011-07-01 18:24:59 +02:00
Andrei Paskevich
a1e3ab186f rename "parameter" to "val" 2011-07-01 00:15:30 +02:00
Andrei Paskevich
aa2c430e3b several changes in syntax
- No more "and", "or", "implies", "iff", and "~".
  Use "/\", "\/", "->", "<->", and "not" instead.

- No more "logic". Use "function" or "predicate".
2011-06-29 19:13:18 +02:00
Jean-Christophe Filliatre
fc4eaa70d9 more tests in 'make bench' 2011-05-31 12:46:58 +02:00
Jean-Christophe Filliatre
edb6d0ff05 fixed WP for local functions
no more need for 'globals' field in effects
2011-05-29 15:09:29 +02:00
Jean-Christophe Filliatre
0e1c37e454 programs: simplification of universal quantifications in WPs 2011-05-23 16:59:47 +02:00
Jean-Christophe Filliatre
4991a6578e programs: no more optimization for singleton record types 2011-05-20 18:03:51 +02:00
Jean-Christophe Filliatre
05ca6bebc9 modules: stdlib split in files ref and array 2011-05-16 18:02:53 +02:00
Jean-Christophe Filliatre
1ecaf6cf9c fields can be omitted in effect expressions when not ambiguous 2011-05-09 17:26:10 +02:00