mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
Consolidate and improve debug_flags
This commit is contained in:
parent
293bc6b15b
commit
a760510be0
4 changed files with 27 additions and 3 deletions
|
@ -24,17 +24,22 @@
|
|||
//! ROC_PRINT_IR_AFTER_RESET_REUSE=0 \
|
||||
//! ROC_PRINT_IR_AFTER_REFCOUNT=0 \
|
||||
//! ROC_PRETTY_PRINT_IR_SYMBOLS=0 \
|
||||
//! # ...other flags
|
||||
//! cargo"
|
||||
//! ```
|
||||
//!
|
||||
//! Now you can turn debug flags on and off as you like.
|
||||
//!
|
||||
//! These flags are also set in .cargo/config found at the repository root. You can modify them
|
||||
//! there to avoid maintaining a separate script.
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! dbg_do {
|
||||
($flag:path, $expr:expr) => {
|
||||
#[cfg(debug_assertions)]
|
||||
{
|
||||
if std::env::var($flag).as_ref() == Ok(&"0".to_string()) {
|
||||
let flag = std::env::var($flag);
|
||||
if !flag.is_err() && flag.as_deref() != Ok("0") {
|
||||
$expr
|
||||
}
|
||||
}
|
||||
|
@ -62,6 +67,22 @@ flags! {
|
|||
/// Prints all type mismatches hit during type unification.
|
||||
ROC_PRINT_MISMATCHES
|
||||
|
||||
/// Verifies that after let-generalization of a def, any rigid variables in the type annotation
|
||||
/// of the def are indeed generalized.
|
||||
///
|
||||
/// Note that rigids need not always be generalized in a def. For example, they may be
|
||||
/// constrained by a type from a lower rank, as `b` is in the following def:
|
||||
///
|
||||
/// F a : { foo : a }
|
||||
/// foo = \arg ->
|
||||
/// x : F b
|
||||
/// x = arg
|
||||
/// x.foo
|
||||
///
|
||||
/// Instead, this flag is useful for checking that in general, introduction is correct, when
|
||||
/// chainging how defs are constrained.
|
||||
ROC_VERIFY_RIGID_LET_GENERALIZED
|
||||
|
||||
// ===Mono===
|
||||
|
||||
/// Writes a pretty-printed mono IR to stderr after function specialization.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue