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
a8dfb887
Commit
a8dfb887
authored
Apr 06, 2021
by
Kim Nguyễn
Browse files
Silently ignore values and types with unsupported features.
parent
25dec7e5
Changes
2
Show whitespace changes
Inline
Side-by-side
driver/ocaml.prims
View file @
a8dfb887
Stdlib
Stdlib.Buffer
Stdlib.Bytes
Stdlib.Char
...
...
ocamliface/mltypes.real.ml
View file @
a8dfb887
...
...
@@ -230,6 +230,7 @@ let get_var id =
vars
:=
(
id
,
i
)
::
!
vars
;
i
exception
Skip
let
constr_table
=
Hashtbl
.
create
1024
type
env
=
{
constrs
:
StringSet
.
t
;
seen
:
IntSet
.
t
;
vars
:
t
IntMap
.
t
}
...
...
@@ -247,8 +248,8 @@ let rec unfold_constr env p args =
let
k
=
(
pn
,
args_id
)
in
try
Hashtbl
.
find
constr_table
k
with
Not_found
->
if
StringSet
.
mem
pn
env
.
constrs
then
failwith
(
"Polymorphic recursion forbidden : "
^
pn
);
if
StringSet
.
mem
pn
env
.
constrs
then
raise
Skip
(*
failwith ("Polymorphic recursion forbidden : " ^ pn)
*)
;
let
slot
=
new_slot
()
in
slot
.
recurs
<-
1
;
Hashtbl
.
add
constr_table
k
slot
;
...
...
@@ -312,7 +313,7 @@ let rec unfold_constr env p args =
|
Type_abstract
,
Some
t
->
Link
(
unfold
env
t
)
|
Type_abstract
,
None
->
(
match
args
with
[]
->
Abstract
pn
|
_l
->
raise
(
PolyAbstract
pn
))
|
Type_open
,
_
->
f
ai
lwith
"unsupported open type"
);
|
Type_open
,
_
->
r
ai
se
Skip
);
slot
and
unfold
env
ty
=
...
...
@@ -349,7 +350,7 @@ and unfold env ty =
try
Link
(
IntMap
.
find
ty
.
id
env
.
vars
)
with
Not_found
->
Var
(
get_var
ty
.
id
))
|
Tconstr
(
p
,
args
,
_
)
->
Link
(
unfold_constr
env
p
args
)
|
_
->
f
ai
lwith
"Unsupported feature"
);
|
_
->
r
ai
se
Skip
);
slot
let
unfold
ty
=
...
...
@@ -395,7 +396,7 @@ let values_of_sig name sg =
match
id
.
[
0
]
with
|
'
a'
..
'
z'
|
'
_'
->
(
let
n
=
name
^
"."
^
id
in
try
(
n
,
fst
(
find_value
n
))
::
accu
with
PolyAbstract
_
->
accu
)
try
(
n
,
fst
(
find_value
n
))
::
accu
with
Skip
|
PolyAbstract
_
->
accu
)
|
_
->
accu
(* operator *)
)
|
_
->
accu
)
...
...
@@ -449,9 +450,11 @@ let read_cmi name =
when
Mlcompat
.
Mltypes
.
is_sig_value_val_reg
s
->
if
not
(
Mlcompat
.
Mltypes
.
is_sig_value_deprecated
s
)
then
begin
let
id
,
t
=
Mlcompat
.
Mltypes
.
get_id_t_from_sig_value
s
in
try
let
unf
,
n
=
unfold
t
in
if
n
!=
0
then
unsupported
"polymorphic value"
;
values
:=
(
Ocaml
.
Ident
.
name
id
,
t
,
unf
)
::
!
values
with
Skip
->
()
end
|
Sig_type
_
as
s
->
let
id
,
t
,
rs
=
Mlcompat
.
Mltypes
.
get_sig_type
s
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