mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-01 15:51:12 +00:00
add some Constraints statistics reporting
This commit is contained in:
parent
9ac194a3b3
commit
f5ebc5bec9
1 changed files with 21 additions and 1 deletions
|
@ -1,7 +1,7 @@
|
||||||
use crate::expected::{Expected, PExpected};
|
use crate::expected::{Expected, PExpected};
|
||||||
use roc_collections::soa::{EitherIndex, Index, Slice};
|
use roc_collections::soa::{EitherIndex, Index, Slice};
|
||||||
use roc_module::ident::TagName;
|
use roc_module::ident::TagName;
|
||||||
use roc_module::symbol::Symbol;
|
use roc_module::symbol::{ModuleId, Symbol};
|
||||||
use roc_region::all::{Loc, Region};
|
use roc_region::all::{Loc, Region};
|
||||||
use roc_types::subs::Variable;
|
use roc_types::subs::Variable;
|
||||||
use roc_types::types::{Category, PatternCategory, Type};
|
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)]
|
#[inline(always)]
|
||||||
const fn push_type_variable(var: Variable) -> EitherIndex<Type, Variable> {
|
const fn push_type_variable(var: Variable) -> EitherIndex<Type, Variable> {
|
||||||
// that's right, we use the variable's integer value as the index
|
// that's right, we use the variable's integer value as the index
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue