File tree Expand file tree Collapse file tree 3 files changed +14
-2
lines changed
Expand file tree Collapse file tree 3 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -97,6 +97,13 @@ let block_type_can_be_undefined = function
9797 false
9898 | UnknownType -> true
9999
100+ let tag_can_be_undefined tag =
101+ match tag.tag_type with
102+ | None -> false
103+ | Some (String _ | Int _ | Float _ | BigInt _ | Bool _ | Null ) -> false
104+ | Some (Untagged block_type ) -> block_type_can_be_undefined block_type
105+ | Some Undefined -> true
106+
100107let has_untagged (attrs : Parsetree.attributes ) =
101108 Ext_list. exists attrs (function {txt} , _ -> txt = untagged)
102109
Original file line number Diff line number Diff line change @@ -551,6 +551,11 @@ let all_record_args lbls =
551551 in
552552 match cdecl with
553553 | None -> x
554+ | Some cstr
555+ when Ast_untagged_variants. is_nullary_variant cstr.cd_args ->
556+ let _, tag = Ast_untagged_variants. get_cstr_loc_tag cstr in
557+ if Ast_untagged_variants. tag_can_be_undefined tag then x
558+ else (id, lbl, pat_construct)
554559 | Some cstr -> (
555560 match
556561 Ast_untagged_variants. get_block_type ~env: pat.pat_env cstr
Original file line number Diff line number Diff line change @@ -30,8 +30,8 @@ function decodeGroup(group) {
3030}
3131
3232function decodeNull ( x ) {
33- let match = x . field ;
34- if ( match !== undefined && match === null ) {
33+ let tmp = x . field ;
34+ if ( tmp === null ) {
3535 return "yes it's null" ;
3636 } else {
3737 return "no" ;
You can’t perform that action at this time.
0 commit comments