Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cduce
cduce
Commits
17e63c21
Commit
17e63c21
authored
Jul 11, 2014
by
Julien Lopez
Browse files
Bugfix in parser: syntactic sugar if_then_else
parent
f3ca4bed
Changes
2
Hide whitespace changes
Inline
Side-by-side
parser/parser.ml
View file @
17e63c21
...
...
@@ -112,7 +112,9 @@ let is_capture =
)
let
if_then_else
cond
e1
e2
=
Match
(
cond
,
[
pat_true
,
e1
;
pat_false
,
e2
])
let
if_then_else
cond
e1
e2
=
Match
(
cond
,
[(
mk
(
0
,
0
)
(
Cst
(
Atom
(
ident
"true"
))))
,
e1
;
(
mk
(
0
,
0
)
(
Cst
(
Atom
(
ident
"false"
))))
,
e2
])
let
logical_and
e1
e2
=
if_then_else
e1
e2
cst_false
let
logical_or
e1
e2
=
if_then_else
e1
cst_true
e2
...
...
tests/lambda/src/lambdaTests.ml
View file @
17e63c21
...
...
@@ -185,7 +185,7 @@ let tests_eval = "CDuce runtime tests (Typed -> Lambda -> Value)" >:::
| x : (!Int) -> x).[2; 3]"
);
assert_equal
~
msg
:
"Test CDuce.runtime.misc.is_int failed"
~
printer
:
(
fun
x
->
x
)
"Abstraction([(Int,Bool),(Bool,Bool),(Any
\\
(Bool | Int),Any
\\
(Bool | Int))],Mono)"
"Abstraction([(Int,Bool),(Bool,Bool),(Any
\\
(
(Bool | Int)
)
,Any
\\
(
(Bool | Int))
)
],Mono)"
(
run_test_eval
"fun ((Int -> Bool) & (Bool -> Bool) & ((!(Int|Bool)) -> (!(Int|Bool))))
| x : Int -> `true
| x : Bool -> `false
...
...
@@ -409,10 +409,10 @@ let tests_eval = "CDuce runtime tests (Typed -> Lambda -> Value)" >:::
"union"
>::
(
fun
test_ctxt
->
assert_equal
~
msg
:
"Test CDuce.runtime.union.identity failed"
~
printer
:
(
fun
x
->
x
)
"Abstraction([(Int | [ Char* ]
,
Int | [ Char* ])],Mono)"
~
printer
:
(
fun
x
->
x
)
"Abstraction([(
(
Int | [ Char* ]
),(
Int | [ Char* ])
)
],Mono)"
(
run_test_eval
"fun f x : (Int | String) : (Int | String) -> x"
);
assert_equal
~
msg
:
"Test CDuce.runtime.union.match failed"
~
printer
:
(
fun
x
->
x
)
"Abstraction([(Int | [ Char* ]
,
Int | [ Char* ])],Mono)"
~
printer
:
(
fun
x
->
x
)
"Abstraction([(
(
Int | [ Char* ]
),(
Int | [ Char* ])
)
],Mono)"
(
run_test_eval
"fun f x : (Int | String) : (Int | String) ->
match x : (Int | String) with
| _ : Int -> 2
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment