mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 14:24:45 +00:00
Make sure FunctionKind is determined in all entry points
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?
This commit is contained in:
parent
6869c9f2e1
commit
0e52a7e069
6 changed files with 31 additions and 25 deletions
|
@ -109,13 +109,16 @@ pub const INTERNAL_ERROR_MESSAGE: &str = concat!(
|
|||
#[macro_export]
|
||||
macro_rules! internal_error {
|
||||
() => ({
|
||||
$crate::error_and_exit(format_args!("{}", $crate::INTERNAL_ERROR_MESSAGE))
|
||||
$crate::error_and_exit(format_args!("{}\nLocation: {}:{}:{}", $crate::INTERNAL_ERROR_MESSAGE, file!(), line!(), column!()))
|
||||
});
|
||||
($($arg:tt)*) => ({
|
||||
$crate::error_and_exit(format_args!(
|
||||
"{}{}",
|
||||
"{}{}\nLocation: {}:{}:{}",
|
||||
$crate::INTERNAL_ERROR_MESSAGE,
|
||||
format_args!($($arg)*)
|
||||
format_args!($($arg)*),
|
||||
file!(),
|
||||
line!(),
|
||||
column!(),
|
||||
))
|
||||
})
|
||||
}
|
||||
|
@ -132,13 +135,16 @@ pub const USER_ERROR_MESSAGE: &str = concat!(
|
|||
#[macro_export]
|
||||
macro_rules! user_error {
|
||||
() => ({
|
||||
$crate::error_and_exit(format_args!("{}", $crate::USER_ERROR_MESSAGE))
|
||||
$crate::error_and_exit(format_args!("{}\nLocation: {}:{}:{}", $crate::USER_ERROR_MESSAGE, file!(), line!(), column!()))
|
||||
});
|
||||
($($arg:tt)*) => ({
|
||||
$crate::error_and_exit(format_args!(
|
||||
"{}{}",
|
||||
"{}{}\nLocation: {}:{}:{}",
|
||||
$crate::USER_ERROR_MESSAGE,
|
||||
format_args!($($arg)*)
|
||||
format_args!($($arg)*),
|
||||
file!(),
|
||||
line!(),
|
||||
column!(),
|
||||
))
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue