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
97
97
false
98
98
| UnknownType -> true
99
99
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
+
100
107
let has_untagged (attrs : Parsetree.attributes ) =
101
108
Ext_list. exists attrs (function {txt} , _ -> txt = untagged)
102
109
Original file line number Diff line number Diff line change @@ -551,6 +551,11 @@ let all_record_args lbls =
551
551
in
552
552
match cdecl with
553
553
| 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)
554
559
| Some cstr -> (
555
560
match
556
561
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) {
30
30
}
31
31
32
32
function decodeNull ( x ) {
33
- let match = x . field ;
34
- if ( match !== undefined && match === null ) {
33
+ let tmp = x . field ;
34
+ if ( tmp === null ) {
35
35
return "yes it's null" ;
36
36
} else {
37
37
return "no" ;
You can’t perform that action at this time.
0 commit comments