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
8f743372
Commit
8f743372
authored
9 years ago
by
Etienne Kneuss
Browse files
Options
Downloads
Patches
Plain Diff
Substitute types in synthesis holes
parent
037665b0
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/purescala/TypeOps.scala
+3
-0
3 additions, 0 deletions
src/main/scala/leon/purescala/TypeOps.scala
src/test/scala/leon/unit/purescala/TypeOpsSuite.scala
+15
-0
15 additions, 0 deletions
src/test/scala/leon/unit/purescala/TypeOpsSuite.scala
with
18 additions
and
0 deletions
src/main/scala/leon/purescala/TypeOps.scala
+
3
−
0
View file @
8f743372
...
@@ -319,6 +319,9 @@ object TypeOps {
...
@@ -319,6 +319,9 @@ object TypeOps {
case
Error
(
tpe
,
desc
)
=>
case
Error
(
tpe
,
desc
)
=>
Error
(
tpeSub
(
tpe
),
desc
).
copiedFrom
(
e
)
Error
(
tpeSub
(
tpe
),
desc
).
copiedFrom
(
e
)
case
Hole
(
tpe
,
alts
)
=>
Hole
(
tpeSub
(
tpe
),
alts
.
map
(
srec
)).
copiedFrom
(
e
)
case
g
@
GenericValue
(
tpar
,
id
)
=>
case
g
@
GenericValue
(
tpar
,
id
)
=>
tpeSub
(
tpar
)
match
{
tpeSub
(
tpar
)
match
{
case
newTpar
:
TypeParameter
=>
case
newTpar
:
TypeParameter
=>
...
...
This diff is collapsed.
Click to expand it.
src/test/scala/leon/unit/purescala/TypeOpsSuite.scala
+
15
−
0
View file @
8f743372
...
@@ -61,4 +61,19 @@ class TypeOpsSuite extends LeonTestSuite with helpers.WithLikelyEq with helpers.
...
@@ -61,4 +61,19 @@ class TypeOpsSuite extends LeonTestSuite with helpers.WithLikelyEq with helpers.
assert
(
isSubtypeOf
(
listD
.
typed
,
listD
.
typed
),
"List[T] <: List[T]"
)
assert
(
isSubtypeOf
(
listD
.
typed
,
listD
.
typed
),
"List[T] <: List[T]"
)
}
}
test
(
"instantiateType Hole"
)
{
ctx
=>
val
tp1
=
TypeParameter
.
fresh
(
"a"
)
val
tp2
=
TypeParameter
.
fresh
(
"b"
)
val
tpd
=
TypeParameterDef
(
tp1
)
val
e1
=
Hole
(
tp1
,
Nil
)
val
e2
=
instantiateType
(
e1
,
Map
(
tpd
->
tp2
),
Map
())
e2
match
{
case
Hole
(
tp
,
_
)
=>
assert
(
tp
==
tp2
,
"Type should have been substituted"
)
case
_
=>
fail
(
"Incorrect expr shape, should be a Hole"
)
}
}
}
}
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