Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
inox
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
Package registry
Model registry
Operate
Environments
Terraform modules
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
LARA
inox
Commits
46bf1166
Commit
46bf1166
authored
9 years ago
by
Regis Blanc
Browse files
Options
Downloads
Patches
Plain Diff
support for old keyword with mutable parameters
parent
49c6e436
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/scala/leon/xlang/AntiAliasingPhase.scala
+4
-5
4 additions, 5 deletions
src/main/scala/leon/xlang/AntiAliasingPhase.scala
src/test/resources/regression/verification/xlang/valid/ArrayParamMutation8.scala
+25
-0
25 additions, 0 deletions
...ession/verification/xlang/valid/ArrayParamMutation8.scala
with
29 additions
and
5 deletions
src/main/scala/leon/xlang/AntiAliasingPhase.scala
+
4
−
5
View file @
46bf1166
...
...
@@ -41,7 +41,7 @@ object AntiAliasingPhase extends TransformationPhase {
}
val
res
=
replaceFunDefs
(
pgm
)(
fd
=>
updatedFunctions
.
get
(
fd
),
(
fi
,
fd
)
=>
None
)
println
(
res
.
_1
)
//
println(res._1)
res
.
_1
}
...
...
@@ -117,7 +117,9 @@ object AntiAliasingPhase extends TransformationPhase {
val
newBody
=
replace
(
aliasedParams
.
zipWithIndex
.
map
{
case
(
id
,
i
)
=>
(
id
.
toVariable
,
TupleSelect
(
newRes
.
toVariable
,
i
+
2
))
:
(
Expr
,
Expr
)}.
toMap
+
(
id
.
toVariable
,
TupleSelect
(
newRes
.
toVariable
,
i
+
2
))
:
(
Expr
,
Expr
)}.
toMap
++
aliasedParams
.
map
(
id
=>
(
Old
(
id
),
id
.
toVariable
)
:
(
Expr
,
Expr
)).
toMap
+
(
res
.
toVariable
->
TupleSelect
(
newRes
.
toVariable
,
1
)),
postBody
)
Lambda
(
Seq
(
newRes
),
newBody
).
setPos
(
post
)
...
...
@@ -272,9 +274,6 @@ object AntiAliasingPhase extends TransformationPhase {
}
def
invocEffects
(
fi
:
FunctionInvocation
)
:
Set
[
Identifier
]
=
{
if
(!
effects
.
isDefinedAt
(
fi
.
tfd
.
fd
))
{
println
(
"fi not defined: "
+
fi
)
}
//TODO: the require should be fine once we consider nested functions as well
//require(effects.isDefinedAt(fi.tfd.fd)
val
mutatedParams
:
Set
[
Int
]
=
effects
.
get
(
fi
.
tfd
.
fd
).
getOrElse
(
Set
())
...
...
This diff is collapsed.
Click to expand it.
src/test/resources/regression/verification/xlang/valid/ArrayParamMutation8.scala
0 → 100644
+
25
−
0
View file @
46bf1166
/* Copyright 2009-2015 EPFL, Lausanne */
import
leon.lang._
object
ArrayParamMutation8
{
def
odd
(
a
:
Array
[
BigInt
])
:
Boolean
=
{
require
(
a
.
length
>
0
&&
a
(
0
)
>=
0
)
if
(
a
(
0
)
==
0
)
false
else
{
a
(
0
)
=
a
(
0
)
-
1
even
(
a
)
}
}
ensuring
(
res
=>
if
(
old
(
a
)(
0
)
%
2
==
1
)
res
else
!
res
)
def
even
(
a
:
Array
[
BigInt
])
:
Boolean
=
{
require
(
a
.
length
>
0
&&
a
(
0
)
>=
0
)
if
(
a
(
0
)
==
0
)
true
else
{
a
(
0
)
=
a
(
0
)
-
1
odd
(
a
)
}
}
ensuring
(
res
=>
if
(
old
(
a
)(
0
)
%
2
==
0
)
res
else
!
res
)
}
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