Admit occurs check under recursive tag unions when programs have type errors

This commit is contained in:
Ayaz Hafiz 2022-11-16 12:30:09 -06:00
parent 216a786d52
commit a8b55dc794
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
2 changed files with 40 additions and 8 deletions

View file

@ -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.