pub fn parse_module_strict(source: &str) -> Result<Module, ParseModuleError>Expand description
Parse Daml source into a Module, treating any diagnostic as failure.
This is a thin wrapper over parse_module followed by
ParseModuleResult::into_result. Use it for build/CI paths that must not
proceed on recoverable parse problems. For editors, formatters, and other
tools that need partial structure plus diagnostics, keep using
parse_module.
use daml_parser::parse::parse_module_strict;
let module = parse_module_strict("module M where\nfoo : Int\nfoo = 1\n")?;
assert_eq!(module.name, "M");
let strict = parse_module_strict("module M where\n%%% junk\n");
assert!(matches!(
strict.as_ref(),
Err(err) if !err.diagnostics().is_empty()
));ยงErrors
Returns ParseModuleError when parse_module records any diagnostic.