mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-01 02:42:17 +00:00
Admit occurs check under recursive tag unions when programs have type errors
This commit is contained in:
parent
216a786d52
commit
a8b55dc794
2 changed files with 40 additions and 8 deletions
|
@ -33,15 +33,23 @@
|
|||
//! 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_set {
|
||||
($flag:path) => {
|
||||
if !cfg!(debug_assertions) {
|
||||
false
|
||||
} else {
|
||||
let flag = std::env::var($flag);
|
||||
!flag.is_err() && flag.as_deref() != Ok("0")
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! dbg_do {
|
||||
($flag:path, $expr:expr) => {
|
||||
#[cfg(debug_assertions)]
|
||||
{
|
||||
let flag = std::env::var($flag);
|
||||
if !flag.is_err() && flag.as_deref() != Ok("0") {
|
||||
$expr
|
||||
}
|
||||
if $crate::dbg_set!($flag) {
|
||||
$expr
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -91,6 +99,15 @@ flags! {
|
|||
/// chainging how defs are constrained.
|
||||
ROC_VERIFY_RIGID_LET_GENERALIZED
|
||||
|
||||
/// Verifies that an `occurs` check indeed only contains non-recursive types that need to be
|
||||
/// fixed-up.
|
||||
///
|
||||
/// This flag is disabled by default because an occurs check may pass through an inferred
|
||||
/// partially-recursive structure if a part of that structure also has type errors. However, in
|
||||
/// the presence of programs without type errors, occurs checks should always consist of only
|
||||
/// non-recursive types, and this flag should pass.
|
||||
ROC_VERIFY_OCCURS_RECURSION
|
||||
|
||||
// ===Mono===
|
||||
|
||||
/// Writes a pretty-printed mono IR to stderr after function specialization.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue