mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00

There are a lot of entry points for a Roc program. They should probably be all consolidated into one, but for now, when FunctionKind is needed, determine it from the environment. This fixes EXPERIMENTAL_ROC_ERASE for `roc test` etc. Also print the location of a failure when `internal_error!` is called. I think this should panic instead, and I thought it used to - does anyone know if that changed?
22 lines
621 B
Rust
22 lines
621 B
Rust
/// How function kinds should be represented in the type system.
|
|
#[derive(Debug, Clone, Copy)]
|
|
pub enum FunctionKind {
|
|
/// Function values are solved to lambda sets; lambda sets are the kind.
|
|
LambdaSet,
|
|
/// Function values are erased, no kind is introduced.
|
|
Erased,
|
|
}
|
|
|
|
impl FunctionKind {
|
|
pub fn from_env() -> Self {
|
|
if cfg!(debug_assertions) {
|
|
if std::env::var("EXPERIMENTAL_ROC_ERASE").is_ok() {
|
|
FunctionKind::Erased
|
|
} else {
|
|
FunctionKind::LambdaSet
|
|
}
|
|
} else {
|
|
FunctionKind::LambdaSet
|
|
}
|
|
}
|
|
}
|