• Andrei Paskevich's avatar
    Pattern: add compile_bare which does not require known_map · 43aeab83
    Andrei Paskevich authored
    In pattern compilation, we only need to know the full list of
    constructors for a given type, whenever
    1. we want to check that a symbol used in a pattern is indeed
       a constructor;
    2. we want to check for non-exhaustive matching and return an
       example of a non-covered pattern, if any.
    Thus, we need to give Pattern.compile access to the current
    known_map whenever we check new declarations in Decl or Mlw_decl.
    However, once we have checked the patterns, we do not need the
    full constructor lists just to compile the match expressions.
    Just knowing the number of constructors (provided in ls_constr)
    is enough to detect non-exhaustive matching during compilation.
    43aeab83
pattern.ml 6.04 KB