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
468b9dc4
Commit
468b9dc4
authored
10 years ago
by
Emmanouil (Manos) Koukoutos
Committed by
Etienne Kneuss
10 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix bug that misses tests
parent
2e4547cd
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/scala/leon/repair/RepairTrackingEvaluator.scala
+20
-5
20 additions, 5 deletions
src/main/scala/leon/repair/RepairTrackingEvaluator.scala
with
20 additions
and
5 deletions
src/main/scala/leon/repair/RepairTrackingEvaluator.scala
+
20
−
5
View file @
468b9dc4
...
...
@@ -8,6 +8,7 @@ import leon.purescala.TypeTrees._
import
leon.purescala.Definitions._
import
leon.LeonContext
import
leon.evaluators.RecursiveEvaluator
import
leon.synthesis._
class
RepairTrackingEvaluator
(
ctx
:
LeonContext
,
prog
:
Program
)
extends
RecursiveEvaluator
(
ctx
,
prog
,
50000
)
{
type
RC
=
CollectingRecContext
...
...
@@ -21,13 +22,25 @@ class RepairTrackingEvaluator(ctx: LeonContext, prog: Program) extends Recursive
// This is a call graph to track dependencies of function invocations.
// If fi1 calls fi2 but fails fi2's precondition, we consider it
// fi1's fault and we don't register the dependency.
private
val
callGraph
:
MMap
[
FI
,
Set
[
FI
]]
=
MMap
().
withDefaultValue
(
Set
())
private
val
callGraph
:
MMap
[
FI
,
Set
[
FI
]]
=
MMap
()
//.withDefaultValue(Set())
private
def
registerNode
(
fi
:
FI
)
=
if
(!
callGraph
.
contains
(
fi
))
callGraph
update
(
fi
,
Set
())
private
def
registerCall
(
fi
:
FI
,
lastFI
:
Option
[
FI
])
=
{
lastFI
foreach
{
lfi
=>
callGraph
update
(
lfi
,
callGraph
(
lfi
)
+
fi
)
}
}
def
fullCallGraph
=
leon
.
utils
.
GraphOps
.
transitiveClosure
(
callGraph
.
toMap
)
def
fullCallGraph
=
{
/*println("About to print")
for{
(test, tests) <-callGraph
} {
println(test._2 mkString ", ")
println(new ExamplesTable("", tests.toSeq.map{ x => InExample(x._2)}).toString)
}*/
leon
.
utils
.
GraphOps
.
transitiveClosure
(
callGraph
.
toMap
)
}
// Tracks if every function invocation succeeded or failed
private
val
fiStatus_
:
MMap
[
FI
,
Boolean
]
=
MMap
().
withDefaultValue
(
false
)
...
...
@@ -48,9 +61,6 @@ class RepairTrackingEvaluator(ctx: LeonContext, prog: Program) extends Recursive
gctx
.
stepsLeft
-=
1
val
evArgs
=
args
.
map
(
a
=>
e
(
a
))
// We consider this function invocation successful, unless the opposite is proven.
registerSuccessful
(
tfd
.
fd
,
evArgs
)
// build a mapping for the function...
val
frameBlamingCaller
=
rctx
.
withVars
((
tfd
.
params
.
map
(
_
.
id
)
zip
evArgs
).
toMap
)
...
...
@@ -58,8 +68,11 @@ class RepairTrackingEvaluator(ctx: LeonContext, prog: Program) extends Recursive
if
(
tfd
.
hasPrecondition
)
{
e
(
tfd
.
precondition
.
get
)(
frameBlamingCaller
,
gctx
)
match
{
case
BooleanLiteral
(
true
)
=>
// We consider this function invocation successful, unless the opposite is proven.
registerSuccessful
(
tfd
.
fd
,
evArgs
)
// Only register a call dependency if the call we depend on does not fail precondition
registerCall
((
tfd
.
fd
,
evArgs
),
rctx
.
lastFI
)
registerNode
((
tfd
.
fd
,
evArgs
))
case
BooleanLiteral
(
false
)
=>
// Caller's fault!
rctx
.
lastFI
foreach
registerFailed
...
...
@@ -70,6 +83,8 @@ class RepairTrackingEvaluator(ctx: LeonContext, prog: Program) extends Recursive
throw
RuntimeError
(
typeErrorMsg
(
other
,
BooleanType
))
}
}
else
{
registerSuccessful
(
tfd
.
fd
,
evArgs
)
registerNode
((
tfd
.
fd
,
evArgs
))
registerCall
((
tfd
.
fd
,
evArgs
),
rctx
.
lastFI
)
}
...
...
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