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
26d698ca
Commit
26d698ca
authored
Oct 05, 2007
by
Pietro Abate
Browse files
[r2002-12-02 23:22:25 by cvscast] Empty log message
Original author: cvscast Date: 2002-12-02 23:22:25+00:00
parent
8d7ec92c
Changes
2
Hide whitespace changes
Inline
Side-by-side
types/types.mli
View file @
26d698ca
...
...
@@ -21,7 +21,6 @@ val descr: node -> descr
val
equal_descr
:
descr
->
descr
->
bool
val
hash_descr
:
descr
->
int
module
DescrHash
:
Hashtbl
.
S
with
type
key
=
descr
module
DescrMap
:
Map
.
S
with
type
key
=
descr
...
...
@@ -37,6 +36,8 @@ val neg : descr -> descr
val
empty
:
descr
val
any
:
descr
val
any_node
:
node
(** Constructors **)
type
pair_kind
=
[
`Normal
|
`XML
]
...
...
typing/typer.ml
View file @
26d698ca
...
...
@@ -374,24 +374,22 @@ and pat_aux seen s = match s.descr' with
raise
(
Patterns
.
Error
"Difference not allowed in patterns"
)
|
`Times
(
s1
,
s2
)
->
Patterns
.
times
(
pat_node
s1
)
(
pat_node
s2
)
|
`Xml
(
s1
,
s2
)
->
Patterns
.
xml
(
pat_node
s1
)
(
pat_node
s2
)
|
`Record
(
false
,_
)
->
(* TODO: handle this case with a type constraint ... *)
raise
(
Patterns
.
Error
"Closed records are not allowed in record patterns"
);
|
`Record
(
true
,
r
)
->
let
l
=
List
.
map
(
fun
(
l
,
o
,
s
)
->
if
o
then
raise
(
Patterns
.
Error
"Optional field not allowed in record patterns"
);
Patterns
.
record
l
(
pat_node
s
)
)
r
in
(
match
l
with
|
[]
->
Patterns
.
constr
Types
.
Record
.
any
|
h
::
t
->
List
.
fold_left
Patterns
.
cap
h
t
)
|
`Record
(
o
,
r
)
->
let
pats
=
ref
[]
in
let
aux
(
l
,
o
,
s
)
=
if
StringSet
.
is_empty
(
fv
s
)
then
(
l
,
(
o
,
type_node
s
))
else
if
o
then
raise
(
Patterns
.
Error
"Optional field not allowed in record patterns"
)
else
(
pats
:=
Patterns
.
record
l
(
pat_node
s
)
::
!
pats
;
(
l
,
(
false
,
Types
.
any_node
))
)
in
let
constr
=
Types
.
record'
(
o
,
List
.
map
aux
r
)
in
List
.
fold_left
Patterns
.
cap
(
Patterns
.
constr
constr
)
!
pats
(* TODO: can avoid constr when o=true, and all fields have fv *)
|
`Capture
x
->
Patterns
.
capture
x
|
`Constant
(
x
,
c
)
->
Patterns
.
constant
x
c
|
`Arrow
_
->
...
...
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