From 86b0a2df7e3b1da550d7cd8e98e8dacf4803e685 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 24 Sep 2024 16:22:54 +0000 Subject: [PATCH] fix error message. --- jit-compiler/src/compiler.rs | 2 +- jit-compiler/tests/execution.rs | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/jit-compiler/src/compiler.rs b/jit-compiler/src/compiler.rs index 1ecfd885b..27127d5e0 100644 --- a/jit-compiler/src/compiler.rs +++ b/jit-compiler/src/compiler.rs @@ -40,7 +40,7 @@ pub fn generate_glue_code( let ty = analyzed.type_of_symbol(sym); if ty != int_int_fun && ty.ty != Type::Col { return Err(format!( - "Only (int -> int) functions and columns are supported, but requested {}", + "Only (int -> int) functions and columns are supported, but requested{}", format_type_scheme_around_name(sym, &Some(ty)), )); } diff --git a/jit-compiler/tests/execution.rs b/jit-compiler/tests/execution.rs index 89d4dcd75..e85c4e8fe 100644 --- a/jit-compiler/tests/execution.rs +++ b/jit-compiler/tests/execution.rs @@ -14,11 +14,7 @@ fn identity_function() { assert_eq!(f(10), 10); } -#[test] -#[should_panic = "Only (int -> int) functions and columns are supported, but requested c: int -> bool"] -fn invalid_function() { - let _ = compile("let c: int -> bool = |i| true;", "c"); -} + #[test] fn sqrt() { let f = compile( @@ -41,3 +37,9 @@ fn sqrt() { assert_eq!(f(99), 9); assert_eq!(f(0), 0); } + +#[test] +#[should_panic = "Only (int -> int) functions and columns are supported, but requested c: int -> bool"] +fn invalid_function() { + let _ = compile("let c: int -> bool = |i| true;", "c"); +}