mirror of
https://github.com/roc-lang/roc.git
synced 2025-07-19 12:35:07 +00:00
Crash at runtime rather than panicking when if condition is erroneous
Closes #5318
This commit is contained in:
parent
cdf8677dfb
commit
a9975b1f7f
4 changed files with 31 additions and 9 deletions
|
@ -7,6 +7,7 @@ use quote::quote;
|
|||
#[proc_macro_attribute]
|
||||
pub fn mono_test(args: TokenStream, item: TokenStream) -> TokenStream {
|
||||
let mut no_check = false;
|
||||
let mut allow_type_errors = false;
|
||||
let mut mode = "exec".to_owned();
|
||||
for arg in syn::parse_macro_input!(args as syn::AttributeArgs) {
|
||||
use syn::{Lit, Meta, MetaNameValue, NestedMeta};
|
||||
|
@ -22,6 +23,9 @@ pub fn mono_test(args: TokenStream, item: TokenStream) -> TokenStream {
|
|||
if path.is_ident("no_check") {
|
||||
no_check = true;
|
||||
}
|
||||
if path.is_ident("allow_type_errors") {
|
||||
allow_type_errors = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,7 +44,7 @@ pub fn mono_test(args: TokenStream, item: TokenStream) -> TokenStream {
|
|||
#[test]
|
||||
#(#attributes)*
|
||||
#visibility fn #name(#args) {
|
||||
compiles_to_ir(#name_str, #body, &#mode, #no_check);
|
||||
compiles_to_ir(#name_str, #body, &#mode, #allow_type_errors, #no_check);
|
||||
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue