diff --git a/crates/ir/src/from_ast/astconv.rs b/crates/ir/src/from_ast/astconv.rs index 83520d9e..424ffb2a 100644 --- a/crates/ir/src/from_ast/astconv.rs +++ b/crates/ir/src/from_ast/astconv.rs @@ -1165,6 +1165,12 @@ fn try_transform(ns: ast::Namespace) -> BuildRes { ns.bindings.iter().copied().map(ast::Expr::Concrete), toplevel_id.clone(), builder.diag(), + ).map_err( + |mut e| { + let err = Error::misc(format!("Incorrect parameter bindings provided to top-level component {}", sig.name)).add_note(e.add_message("Parameter bindings should be provided via the `--bindings` flag in a `.toml` file.")); + e.add_error(err); + e + } )? .into_iter() .enumerate() diff --git a/tests/errors/binding/main-concrete.expect b/tests/errors/binding/main-concrete.expect index c50b9dfc..d72605a4 100644 --- a/tests/errors/binding/main-concrete.expect +++ b/tests/errors/binding/main-concrete.expect @@ -2,9 +2,9 @@ 1 ---STDERR--- error: Default values for parameters in the main component must be concrete - ┌─ tests/errors/binding/main-default.fil:2:19 + ┌─ tests/errors/binding/main-concrete.fil:2:19 │ -2 │ comp main[?A=31, ?B=1+W]<'G:1>() -> () { +2 │ comp main[?A=31, ?B=1+A]<'G:1>() -> () { │ ^ Parameter was not given a concrete value Compilation failed with 1 errors. diff --git a/tests/errors/binding/main-concrete.fil b/tests/errors/binding/main-concrete.fil index 4c031f23..f407c05c 100644 --- a/tests/errors/binding/main-concrete.fil +++ b/tests/errors/binding/main-concrete.fil @@ -1,4 +1,4 @@ // check default parameters in the main component -comp main[?A=31, ?B=1+W]<'G:1>() -> () { +comp main[?A=31, ?B=1+A]<'G:1>() -> () { } \ No newline at end of file diff --git a/tests/errors/binding/main-param.expect b/tests/errors/binding/main-param.expect index 73227f73..5df91b41 100644 --- a/tests/errors/binding/main-param.expect +++ b/tests/errors/binding/main-param.expect @@ -7,5 +7,8 @@ error: `main' requires at least 1 parameters but 0 were provided 2 │ comp main[A]<'G:1>() -> () { │ ^^^^ `main' requires at least 1 parameters but 0 were provided -Compilation failed with 1 errors. +error: Incorrect parameter bindings provided to top-level component main + = Parameter bindings should be provided via the `--bindings` flag in a `.toml` file. + +Compilation failed with 2 errors. Run with --show-models to generate assignments for failing constraints.