@@ -4294,29 +4294,29 @@ and literal ?(is_const=false) cx loc lit =
4294
4294
then Literal (None , s), RString
4295
4295
else AnyLiteral , RLongStringLit (max_literal_length)
4296
4296
in
4297
- let lit_type = match lit with
4298
- | Literal (_ , s ) when is_const -> SingletonStrT s
4299
- | _ -> StrT lit
4297
+ let lit_type, r_desc = match ( lit, r_desc) with
4298
+ | ( Literal (_ , s ), _ ) when is_const -> SingletonStrT s, RStringLit s
4299
+ | ( _ , r_desc ) -> StrT lit, r_desc
4300
4300
in
4301
4301
DefT (annot_reason (mk_reason r_desc loc), make_trust () , lit_type)
4302
4302
end
4303
4303
4304
4304
| Boolean b ->
4305
- let lit_type = if is_const
4306
- then SingletonBoolT b
4307
- else BoolT (Some b)
4305
+ let lit_type, r_desc = if is_const
4306
+ then SingletonBoolT b, RBooleanLit b
4307
+ else BoolT (Some b), RBoolean
4308
4308
in
4309
- DefT (annot_reason (mk_reason RBoolean loc), make_trust () , lit_type)
4309
+ DefT (annot_reason (mk_reason r_desc loc), make_trust () , lit_type)
4310
4310
4311
4311
| Null ->
4312
4312
NullT. at loc |> with_trust make_trust
4313
4313
4314
4314
| Number f ->
4315
- let lit_type = if is_const
4316
- then SingletonNumT (f, lit.raw)
4317
- else NumT (Literal (None , (f, lit.raw)))
4315
+ let lit_type, r_desc = if is_const
4316
+ then SingletonNumT (f, lit.raw), RNumberLit lit.raw
4317
+ else NumT (Literal (None , (f, lit.raw))), RNumber
4318
4318
in
4319
- DefT (annot_reason (mk_reason RNumber loc), make_trust () , lit_type)
4319
+ DefT (annot_reason (mk_reason r_desc loc), make_trust () , lit_type)
4320
4320
4321
4321
| BigInt _ ->
4322
4322
let reason = annot_reason (mk_reason (RBigIntLit lit.raw) loc) in
0 commit comments