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
ebcbe6cf
Commit
ebcbe6cf
authored
14 years ago
by
Ali Sinan Köksal
Browse files
Options
Downloads
Patches
Plain Diff
extracted "Typed" expressions of kind x: T
parent
c7d7013e
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
cp-demo/FirstClassConstraints.scala
+1
-1
1 addition, 1 deletion
cp-demo/FirstClassConstraints.scala
src/cp/CodeExtraction.scala
+1
-0
1 addition, 0 deletions
src/cp/CodeExtraction.scala
src/cp/Extractors.scala
+7
-0
7 additions, 0 deletions
src/cp/Extractors.scala
with
9 additions
and
1 deletion
cp-demo/FirstClassConstraints.scala
+
1
−
1
View file @
ebcbe6cf
...
@@ -18,7 +18,7 @@ object FirstClassConstraints {
...
@@ -18,7 +18,7 @@ object FirstClassConstraints {
def
main
(
args
:
Array
[
String
])
:
Unit
=
{
def
main
(
args
:
Array
[
String
])
:
Unit
=
{
val
l
=
List
(
1
,
3
,
5
,
7
)
val
l
=
List
(
1
,
3
,
5
,
7
)
for
(
x
<-
(
oneOf
(
l
)
minimizing
(
(
x
:
Int
)
=>
-
x
)).
findAll
)
for
(
x
<-
(
oneOf
(
l
)
minimizing
(
-
(
_
:
Int
))).
findAll
)
println
(
"A solution: "
+
x
)
println
(
"A solution: "
+
x
)
val
mapper
:
Term1
[
MyList
,
MyList
]
=
(
l
:
MyList
)
=>
l
match
{
case
MyCons
(
_
,
xs
)
=>
xs
;
case
x
=>
x
}
val
mapper
:
Term1
[
MyList
,
MyList
]
=
(
l
:
MyList
)
=>
l
match
{
case
MyCons
(
_
,
xs
)
=>
xs
;
case
x
=>
x
}
...
...
This diff is collapsed.
Click to expand it.
src/cp/CodeExtraction.scala
+
1
−
0
View file @
ebcbe6cf
...
@@ -628,6 +628,7 @@ trait CodeExtraction extends Extractors {
...
@@ -628,6 +628,7 @@ trait CodeExtraction extends Extractors {
}
}
case
ExInt32Literal
(
v
)
=>
IntLiteral
(
v
).
setType
(
Int32Type
)
case
ExInt32Literal
(
v
)
=>
IntLiteral
(
v
).
setType
(
Int32Type
)
case
ExBooleanLiteral
(
v
)
=>
BooleanLiteral
(
v
).
setType
(
BooleanType
)
case
ExBooleanLiteral
(
v
)
=>
BooleanLiteral
(
v
).
setType
(
BooleanType
)
case
ExTyped
(
e
,
tpt
)
=>
rec
(
e
).
setType
(
scalaType2PureScala
(
unit
,
silent
)(
tpt
.
tpe
))
case
i
@
ExIdentifier
(
sym
,
tpt
)
=>
varSubsts
.
get
(
sym
)
match
{
case
i
@
ExIdentifier
(
sym
,
tpt
)
=>
varSubsts
.
get
(
sym
)
match
{
case
Some
(
fun
)
=>
fun
()
case
Some
(
fun
)
=>
fun
()
case
None
=>
{
case
None
=>
{
...
...
This diff is collapsed.
Click to expand it.
src/cp/Extractors.scala
+
7
−
0
View file @
ebcbe6cf
...
@@ -210,6 +210,13 @@ trait Extractors {
...
@@ -210,6 +210,13 @@ trait Extractors {
}
}
}
}
object
ExTyped
{
def
unapply
(
tree
:
Typed
)
:
Option
[(
Tree
,
Tree
)]
=
tree
match
{
case
Typed
(
e
,
t
)
=>
Some
((
e
,
t
))
case
_
=>
None
}
}
object
ExIntIdentifier
{
object
ExIntIdentifier
{
def
unapply
(
tree
:
Ident
)
:
Option
[
String
]
=
tree
match
{
def
unapply
(
tree
:
Ident
)
:
Option
[
String
]
=
tree
match
{
case
i
:
Ident
if
i.symbol.tpe
=
=
IntClass
.
tpe
=>
Some
(
i
.
symbol
.
name
.
toString
)
case
i
:
Ident
if
i.symbol.tpe
=
=
IntClass
.
tpe
=>
Some
(
i
.
symbol
.
name
.
toString
)
...
...
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