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
4bf2762d
Commit
4bf2762d
authored
Jul 10, 2007
by
Pietro Abate
Browse files
[r2002-12-02 23:35:19 by cvscast] Empty log message
Original author: cvscast Date: 2002-12-02 23:35:19+00:00
parent
34237e20
Changes
1
Hide whitespace changes
Inline
Side-by-side
types/patterns.ml
View file @
4bf2762d
...
...
@@ -1134,7 +1134,15 @@ struct
let
combine_record
l
present
absent
=
match
(
present
,
absent
)
with
|
(
`Ignore
r1
,
Some
r2
)
when
r1
=
r2
->
r1
|
(
`Ignore
r
,
None
)
->
r
(* | (`Ignore r, None) -> r *)
(* Could allow this when r has no `Result_other ... *)
(* Otherwise:
debug compile {| x = Int; y =? Int |} {| x = Any |};;
[DEBUG:compile]
let disp_0 = function
| Record ->
[x ]SomeField:$0;NoField:$1
*)
|
(
`None
,
Some
r
)
->
r
|
_
->
`Label
(
l
,
present
,
absent
)
...
...
@@ -1478,13 +1486,13 @@ struct
|
None
,
Some
r2
->
`Result
r2
|
_
->
assert
false
)
|
Some
l
->
let
labs
=
l
::
labs
in
let
(
plabs
,
absent
)
=
let
pl
=
label_not_found
l
pl
in
let
t
=
Types
.
Record
.
restrict_label_absent
t
l
in
pl
,
dispatch_record_opt
disp
t
pl
labs
in
let
present
=
let
labs
=
l
::
labs
in
let
pl
=
label_found
l
pl
in
let
t
=
Types
.
Record
.
restrict_label_present
t
l
in
if
Types
.
Record
.
is_empty
t
then
`None
else
...
...
@@ -1628,8 +1636,14 @@ struct
Format
.
fprintf
ppf
" @[%a@]@
\n
"
print_record
r
and
print_record
ppf
=
function
|
`Result
r
->
Format
.
fprintf
ppf
"%a"
print_ret
r
|
`Result_other
(
_
,
r1
,
r2
)
->
Format
.
fprintf
ppf
"SomeField:%a;NoField:%a"
print_ret
r1
print_ret
r2
|
`Result_other
(
fields
,
r1
,
r2
)
->
Format
.
fprintf
ppf
"["
;
List
.
iter
(
fun
l
->
Format
.
fprintf
ppf
"%s "
(
Types
.
LabelPool
.
value
l
))
fields
;
Format
.
fprintf
ppf
"]"
;
Format
.
fprintf
ppf
"SomeField:%a;NoField:%a"
print_ret
r1
print_ret
r2
|
`Label
(
l
,
present
,
absent
)
->
let
l
=
Types
.
LabelPool
.
value
l
in
Format
.
fprintf
ppf
"check label %s:@
\n
"
l
;
...
...
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