Source locations and structured errors for text codecs (extracted from jsont)
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

loc: drop unused [type loc := t] in Error sig and unused [err_unexp]

Warnings 34 and 32, respectively. [type loc := t] in the Error module
is never referenced — the Meta module has a similar line that IS used
(Meta.make etc. return [loc]), so that one stays. [err_unexp] in
Path.parse was declared but never called from within the same module.

+2 -4
-1
lib/loc.ml
··· 251 251 let err_unexp_eoi i = err i "Unexpected end of input" 252 252 let err_unexp_char i s = err i "Unexpected character: %C" s.[i] 253 253 let err_illegal_char i s = err i "Illegal character here: %C" s.[i] 254 - let err_unexp i s = err i "Unexpected input: %S" (string_subrange ~first:i s) 255 254 256 255 let parse_index p s i max = 257 256 let first, stop = match s.[i] with '[' -> (i + 1, ']') | _ -> (i, '.') in
+2 -3
lib/loc.mli
··· 251 251 Errors carry a structured context (the path from the root value to the 252 252 erroring sub-value), the source location of the error, and a kind. *) 253 253 module Error : sig 254 - type loc := t 255 - 256 254 type kind = .. 257 255 (** The type of error kinds. Extensible: each codec library extends this with 258 256 its own typed constructors (e.g. sort mismatches, missing members, ··· 260 258 261 259 type kind += 262 260 | Msg of string 263 - (** [Msg s] is the generic message kind used by {!msg} and {!msgf}. *) 261 + (** [Msg s] is the generic message kind used by {!msg}, {!fail}, and 262 + {!failf}. *) 264 263 265 264 val register_kind_printer : 266 265 (kind -> (Format.formatter -> unit) option) -> unit