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
55931024
Commit
55931024
authored
10 years ago
by
Emmanouil (Manos) Koukoutos
Committed by
Etienne Kneuss
10 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Make sure MethodLifting freshens class type parameters in lifted mds
parent
bc1a6fc9
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/purescala/MethodLifting.scala
+12
-4
12 additions, 4 deletions
src/main/scala/leon/purescala/MethodLifting.scala
with
12 additions
and
4 deletions
src/main/scala/leon/purescala/MethodLifting.scala
+
12
−
4
View file @
55931024
...
...
@@ -9,6 +9,7 @@ import Trees._
import
Extractors._
import
TreeOps._
import
TypeTrees._
import
TypeTreeOps.instantiateType
object
MethodLifting
extends
TransformationPhase
{
...
...
@@ -21,23 +22,30 @@ object MethodLifting extends TransformationPhase {
program
.
classHierarchyRoots
.
filter
(
_
.
methods
.
nonEmpty
)
flatMap
{
cd
=>
cd
.
methods
.
map
{
fd
=>
// We import class type params
val
ctParams
=
cd
.
tparams
// We import class type params and freshen them
val
ctParams
=
cd
.
tparams
map
{
_
.
freshen
}
val
tparamsMap
=
cd
.
tparams
.
zip
(
ctParams
map
{
_
.
tp
}).
toMap
val
id
=
FreshIdentifier
(
cd
.
id
.
name
+
"$"
+
fd
.
id
.
name
).
setPos
(
fd
.
id
)
val
recType
=
classDefToClassType
(
cd
,
ctParams
.
map
(
_
.
tp
))
val
retType
=
instantiateType
(
fd
.
returnType
,
tparamsMap
)
val
fdParams
=
fd
.
params
map
{
vd
=>
val
newId
=
FreshIdentifier
(
vd
.
id
.
name
).
setType
(
instantiateType
(
vd
.
id
.
getType
,
tparamsMap
))
ValDef
(
newId
,
newId
.
getType
)
}
val
paramsMap
=
fd
.
params
.
zip
(
fdParams
).
map
{
case
(
x
,
y
)
=>
(
x
.
id
,
y
.
id
)}.
toMap
val
receiver
=
FreshIdentifier
(
"$this"
).
setType
(
recType
).
setPos
(
cd
.
id
)
val
nfd
=
new
FunDef
(
id
,
ctParams
++
fd
.
tparams
,
fd
.
return
Type
,
ValDef
(
receiver
,
recType
)
+:
fd
.
p
arams
,
fd
.
defType
)
val
nfd
=
new
FunDef
(
id
,
ctParams
++
fd
.
tparams
,
ret
Type
,
ValDef
(
receiver
,
recType
)
+:
fd
P
arams
,
fd
.
defType
)
nfd
.
copyContentFrom
(
fd
)
nfd
.
setPos
(
fd
)
nfd
.
fullBody
=
instantiateType
(
nfd
.
fullBody
,
tparamsMap
,
paramsMap
)
mdToFds
+=
fd
->
nfd
}
}
def
translateMethod
(
fd
:
FunDef
)
=
{
val
(
nfd
,
rec
)
=
mdToFds
.
get
(
fd
)
match
{
case
Some
(
nfd
)
=>
...
...
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