Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
J
javawlp
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
impresshs
javawlp
Commits
7d56db6e
Commit
7d56db6e
authored
8 years ago
by
koen
Browse files
Options
Downloads
Patches
Plain Diff
fixed a bug where accessing an array A wouldn't throw errors if A wasn't part of the post-condition
parent
6ab5d575
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Settings.hs
+2
-2
2 additions, 2 deletions
Settings.hs
Tests/methods.java
+1
-1
1 addition, 1 deletion
Tests/methods.java
WLP.hs
+6
-5
6 additions, 5 deletions
WLP.hs
with
9 additions
and
8 deletions
Settings.hs
+
2
−
2
View file @
7d56db6e
module
Settings
where
testFile
,
postCond
::
String
testFile
=
"
side-effects
"
postCond
=
"(
x == 2
)"
testFile
=
"
debug
"
postCond
=
"(
true
)"
nrOfUnroll
::
Int
nrOfUnroll
=
1
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Tests/methods.java
+
1
−
1
View file @
7d56db6e
...
...
@@ -4,7 +4,7 @@ public static class Main
public
static
void
main
(
String
[]
args
)
{
C
c1
,
c2
;
c1
=
new
C
(
0
);
c1
=
new
C
(
1
);
c2
=
new
C
(
0
);
c1
.
method1
(
1
);
c2
.
method1
(
1
);
...
...
This diff is collapsed.
Click to expand it.
WLP.hs
+
6
−
5
View file @
7d56db6e
...
...
@@ -168,9 +168,7 @@ wlpExpAlgebra = (fLit, fClassLit, fThis, fThisClass, fInstanceCreation, fQualIns
else
let
varId
=
getReturnVar
invocation
callWlp
=
wlp'
(
inh
{
acc
=
id
,
calls
=
incrCallCount
(
calls
inh
)
(
invocationToId
invocation
),
ret
=
Just
varId
,
object
=
getObject
inh
invocation
})
(
inlineMethod
inh
invocation
)
in
(
callWlp
(
ExpName
(
Name
[
varId
])),
(
callWlp
.
acc
inh
))
fArrayAccess
(
ArrayIndex
a
i
)
inh
=
case
catch
inh
of
Nothing
->
(
arrayAccess
a
i
,
snd
((
foldExp
wlpExpAlgebra
a
)
inh
))
Just
(
cs
,
f
)
->
(
arrayAccess
a
i
,
snd
((
foldExp
wlpExpAlgebra
a
)
inh
{
acc
=
id
})
.
arrayAccessWlp
a
i
inh
)
fArrayAccess
(
ArrayIndex
a
i
)
inh
=
(
arrayAccess
a
i
,
snd
((
foldExp
wlpExpAlgebra
a
)
inh
{
acc
=
id
})
.
arrayAccessWlp
a
i
inh
)
fExpName
name
inh
=
(
ExpName
name
,
(
acc
inh
))
-- x++ increments x but evaluates to the original value
...
...
@@ -208,14 +206,17 @@ wlpExpAlgebra = (fLit, fClassLit, fThis, fThisClass, fInstanceCreation, fQualIns
fAssign
lhs
op
e
inh
=
let
lhs'
=
foldLhs
inh
lhs
rhs'
=
desugarAssign
lhs'
op
e'
(
e'
,
trans
)
=
e
inh
{
acc
=
id
}
in
(
rhs'
,
trans
.
substVar
(
env
inh
)
(
decls
inh
)
lhs'
rhs'
.
acc
inh
)
lhsTrans
=
case
lhs'
of
ArrayLhs
(
ArrayIndex
a
i
)
->
arrayAccessWlp
a
i
inh
{
acc
=
id
}
_
->
id
in
(
rhs'
,
lhsTrans
.
trans
.
substVar
(
env
inh
)
(
decls
inh
)
lhs'
rhs'
.
acc
inh
)
fLambda
=
error
"lambda"
fMethodRef
=
error
"method reference"
-- gets the transformer for array access (as array access may throw an error)
arrayAccessWlp
::
Exp
->
[
Exp
]
->
Inh
->
Exp
->
Exp
arrayAccessWlp
a
i
inh
q
=
case
catch
inh
of
Nothing
->
q
Nothing
->
Cond
(
foldr
(
\
(
i
,
l
)
e
->
e
&*
(
BinOp
i
LThan
l
)
&*
(
BinOp
i
GThanE
(
Lit
(
Int
0
))))
true
(
zip
i
(
dimLengths
a
)))
q
false
Just
(
cs
,
f
)
->
let
e
=
InstanceCreation
[]
(
ClassType
[(
Ident
"ArrayIndexOutOfBoundsException"
,
[]
)])
[]
Nothing
in
Cond
(
foldr
(
\
(
i
,
l
)
e
->
e
&*
(
BinOp
i
LThan
l
)
&*
(
BinOp
i
GThanE
(
Lit
(
Int
0
))))
true
(
zip
i
(
dimLengths
a
)))
q
((
maybe
(
if
f
then
q
else
q
&*
throwException
e
))
(
\
b
->
wlp'
(
inh
{
acc
=
id
,
catch
=
Nothing
})
(
StmtBlock
b
)
q
)
(
getCatch
(
decls
inh
)
(
env
inh
)
e
cs
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment