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
17335b8d
Commit
17335b8d
authored
May 27, 2014
by
Julien Lopez
Browse files
[TESTS][LAMBDA] Fix accept type for branches in abstraction
parent
cc0fe98c
Changes
1
Show whitespace changes
Inline
Side-by-side
tests/lambda/src/compute.ml
View file @
17335b8d
...
@@ -7,6 +7,8 @@ module Locals = Map.Make(String)
...
@@ -7,6 +7,8 @@ module Locals = Map.Make(String)
(* To throw in case of an unbound name *)
(* To throw in case of an unbound name *)
exception
Error
exception
Error
let
polyvar
=
Types
.
var
(
`Var
(
Var
.
make_id
"A"
))
let
type_of_string
s
=
match
s
with
let
type_of_string
s
=
match
s
with
|
"Int"
->
Builtin_defs
.
int
|
"Int"
->
Builtin_defs
.
int
|
"String"
->
Builtin_defs
.
string
|
"String"
->
Builtin_defs
.
string
...
@@ -107,17 +109,6 @@ and make_sigma s =
...
@@ -107,17 +109,6 @@ and make_sigma s =
|
[]
->
acc
in
|
[]
->
acc
in
aux
[]
s
aux
[]
s
and
type_of_sigma
x
s
=
let
rec
aux2
x
acc
=
function
|
[]
->
acc
|
(
id
,
t2
)
::
rest
when
id
=
x
->
aux2
x
(
Types
.
cap
acc
(
type_of_ptype
t2
))
rest
|
_
::
rest
->
aux2
x
acc
rest
in
let
rec
aux
x
acc
=
function
|
[]
->
acc
|
l
::
rest
->
aux
x
(
Types
.
cup
acc
(
aux2
x
Types
.
any
l
))
rest
in
aux
x
Types
.
empty
s
and
type_of_ptype
=
and
type_of_ptype
=
let
open
Types
in
function
let
open
Types
in
function
|
Type
(
t
)
->
type_of_string
t
|
Type
(
t
)
->
type_of_string
t
...
@@ -151,6 +142,9 @@ and first_param loc iface =
...
@@ -151,6 +142,9 @@ and first_param loc iface =
in
in
_first_param
loc
[]
iface
_first_param
loc
[]
iface
and
accept_type
t
=
if
Types
.
equiv
t
polyvar
then
Builtin_defs
.
any
else
t
and
parse_abstr
env
l
loc
fun_name
iface
fv
body
=
and
parse_abstr
env
l
loc
fun_name
iface
fv
body
=
let
fun_typ
=
type_of_ptype
iface
in
let
fun_typ
=
type_of_ptype
iface
in
let
ptype
,
iface
=
first_param
loc
iface
in
let
ptype
,
iface
=
first_param
loc
iface
in
...
@@ -158,7 +152,7 @@ and parse_abstr env l loc fun_name iface fv body =
...
@@ -158,7 +152,7 @@ and parse_abstr env l loc fun_name iface fv body =
|
None
->
l
|
None
->
l
|
Some
(
id
,
name
)
->
Locals
.
add
name
(
id
,
fun_typ
)
l
)
in
|
Some
(
id
,
name
)
->
Locals
.
add
name
(
id
,
fun_typ
)
l
)
in
let
b
,
btype
=
parse_branches
env
l
ptype
[]
Types
.
empty
body
in
let
b
,
btype
=
parse_branches
env
l
ptype
[]
Types
.
empty
body
in
let
brs
=
{
Typed
.
br_typ
=
type_of_ptype
p
type
;
br_accept
=
Types
.
any
;
let
brs
=
{
Typed
.
br_typ
=
b
type
;
br_accept
=
accept_type
btype
;
br_branches
=
b
}
in
br_branches
=
b
}
in
let
abstr
=
{
Typed
.
fun_name
=
fun_name
;
fun_iface
=
iface
;
fun_body
=
brs
;
let
abstr
=
{
Typed
.
fun_name
=
fun_name
;
fun_iface
=
iface
;
fun_body
=
brs
;
fun_typ
=
fun_typ
;
fun_fv
=
fv
}
in
fun_typ
=
fun_typ
;
fun_fv
=
fv
}
in
...
...
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