mirror of
https://github.com/roc-lang/roc.git
synced 2024-09-22 08:17:40 +03:00
add some Constraints statistics reporting
This commit is contained in:
parent
9ac194a3b3
commit
f5ebc5bec9
@ -1,7 +1,7 @@
|
||||
use crate::expected::{Expected, PExpected};
|
||||
use roc_collections::soa::{EitherIndex, Index, Slice};
|
||||
use roc_module::ident::TagName;
|
||||
use roc_module::symbol::Symbol;
|
||||
use roc_module::symbol::{ModuleId, Symbol};
|
||||
use roc_region::all::{Loc, Region};
|
||||
use roc_types::subs::Variable;
|
||||
use roc_types::types::{Category, PatternCategory, Type};
|
||||
@ -140,6 +140,26 @@ impl Constraints {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn statistics(&self, module_id: ModuleId) -> Result<String, std::fmt::Error> {
|
||||
use std::fmt::Write;
|
||||
|
||||
let mut buf = String::new();
|
||||
|
||||
writeln!(buf, "Constraints statistics for module {:?}:", module_id)?;
|
||||
|
||||
writeln!(buf, " constraints length: {}:", self.constraints.len())?;
|
||||
writeln!(buf, " types length: {}:", self.types.len())?;
|
||||
writeln!(
|
||||
buf,
|
||||
" let_constraints length: {}:",
|
||||
self.let_constraints.len()
|
||||
)?;
|
||||
writeln!(buf, " expectations length: {}:", self.expectations.len())?;
|
||||
writeln!(buf, " categories length: {}:", self.categories.len())?;
|
||||
|
||||
Ok(buf)
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
const fn push_type_variable(var: Variable) -> EitherIndex<Type, Variable> {
|
||||
// that's right, we use the variable's integer value as the index
|
||||
|
Loading…
Reference in New Issue
Block a user