File tree 3 files changed +37
-19
lines changed
3 files changed +37
-19
lines changed Original file line number Diff line number Diff line change @@ -2046,6 +2046,7 @@ and mcomp_record_description type_pairs env =
2046
2046
if
2047
2047
Ident. name l1.ld_id = Ident. name l2.ld_id
2048
2048
&& l1.ld_mutable = l2.ld_mutable
2049
+ && l1.ld_optional = l2.ld_optional
2049
2050
then iter xs ys
2050
2051
else raise (Unify [] )
2051
2052
| [] , [] -> ()
Original file line number Diff line number Diff line change @@ -526,19 +526,24 @@ let all_record_args lbls =
526
526
in
527
527
List. iter
528
528
(fun ((id , lbl , pat ) as x ) ->
529
+ let lbl_is_optional () =
530
+ match lbl.lbl_repres with
531
+ | Record_inlined _ -> false
532
+ | _ -> lbl.lbl_optional
533
+ in
529
534
let x =
530
535
match pat.pat_desc with
531
536
| Tpat_construct
532
537
( {txt = Longident. Ldot (Longident. Lident " *predef*" , " Some" )},
533
538
_,
534
539
[({pat_desc = Tpat_constant _} as c)] )
535
- when lbl.lbl_optional ->
540
+ when lbl_is_optional () ->
536
541
(id, lbl, c)
537
542
| Tpat_construct
538
543
( {txt = Longident. Ldot (Longident. Lident " *predef*" , " Some" )},
539
544
_,
540
545
[({pat_desc = Tpat_construct (_, cd, _)} as pat_construct)] )
541
- when lbl.lbl_optional -> (
546
+ when lbl_is_optional () -> (
542
547
let cdecl =
543
548
Ast_untagged_variants
544
549
.constructor_declaration_from_constructor_description
Original file line number Diff line number Diff line change @@ -172,24 +172,36 @@ function inlinedRecord(ir) {
172
172
let x1 = ir . x1 ;
173
173
let x0 = ir . x0 ;
174
174
if ( x1 !== undefined ) {
175
- if ( x1 === "x1" ) {
176
- let x2 = ir . x2 ;
177
- if ( x2 !== undefined ) {
178
- return [
179
- x0 ,
180
- "x1" ,
181
- x2 ,
182
- ir . x3
183
- ] ;
184
- }
185
-
175
+ switch ( x1 ) {
176
+ case "x1" :
177
+ let x2 = ir . x2 ;
178
+ if ( x2 !== undefined ) {
179
+ return [
180
+ x0 ,
181
+ "x1" ,
182
+ x2 ,
183
+ ir . x3
184
+ ] ;
185
+ }
186
+ break ;
187
+ case "xx1" :
188
+ let x2$1 = ir . x2 ;
189
+ if ( x2$1 !== undefined ) {
190
+ return [
191
+ x0 ,
192
+ "xx1" ,
193
+ x2$1 ,
194
+ ir . x3
195
+ ] ;
196
+ }
197
+ break ;
186
198
}
187
- let x2$1 = ir . x2 ;
188
- if ( x2$1 !== undefined ) {
199
+ let x2$2 = ir . x2 ;
200
+ if ( x2$2 !== undefined ) {
189
201
return [
190
202
x0 ,
191
203
x1 ,
192
- x2$1 ,
204
+ x2$2 ,
193
205
ir . x3
194
206
] ;
195
207
} else {
@@ -201,12 +213,12 @@ function inlinedRecord(ir) {
201
213
] ;
202
214
}
203
215
}
204
- let x2$2 = ir . x2 ;
205
- if ( x2$2 !== undefined ) {
216
+ let x2$3 = ir . x2 ;
217
+ if ( x2$3 !== undefined ) {
206
218
return [
207
219
x0 ,
208
220
"n/a" ,
209
- x2$2 ,
221
+ x2$3 ,
210
222
ir . x3
211
223
] ;
212
224
} else {
You can’t perform that action at this time.
0 commit comments