Skip to content

Commit

Permalink
resolved merge artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
anish-palakurthi committed Aug 7, 2024
1 parent d050af3 commit 421efc0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 33 deletions.
17 changes: 0 additions & 17 deletions engine/baml-lib/baml-core/src/ir/repr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -859,23 +859,6 @@ pub struct TestCase {
pub args: IndexMap<String, Expression>,
}

impl WithRepr<TestCaseFunction> for (&ConfigurationWalker<'_>, usize) {
fn attributes(&self, _db: &ParserDatabase) -> NodeAttributes {
let span = self.0.test_case().functions[self.1].1.clone();
NodeAttributes {
meta: IndexMap::new(),
overrides: IndexMap::new(),
span: Some(span),
}
}

fn repr(&self, db: &ParserDatabase) -> Result<TestCaseFunction> {
Ok(TestCaseFunction(
self.0.test_case().functions[self.1].0.clone(),
))
}
}

impl WithRepr<TestCaseFunction> for (&ConfigurationWalker<'_>, usize) {
fn attributes(&self, _db: &ParserDatabase) -> NodeAttributes {
let span = self.0.test_case().functions[self.1].1.clone();
Expand Down
25 changes: 9 additions & 16 deletions engine/baml-schema-wasm/src/runtime_wasm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1171,25 +1171,18 @@ impl WasmRuntime {
Ok(p) => (p, None),
Err(e) => (Vec::new(), Some(e)),
};

// Any missing params should be set to an error
let _ = tc.function().inputs().right().map(|func_params| {
for (param_name, t) in func_params {
if !params.iter().any(|p| p.name.cmp(param_name).is_eq())
&& !t.is_optional()
{
params.insert(
0,
WasmParam {
name: param_name.to_string(),
value: None,
error: Some("Missing parameter".to_string()),
},
);
}
// Any missing params should be set to an error
tc.function().inputs().iter().for_each(|func_params| {
let (param_name, t) = func_params;
if !params.iter().any(|p| p.name == *param_name) && !t.is_optional() {
params.push(WasmParam {
name: param_name.to_string(),
value: None,
error: Some("Missing parameter".to_string()),
});
}
});

let wasm_span = match tc.span() {
Some(span) => span.into(),
None => WasmSpan::default(),
Expand Down

0 comments on commit 421efc0

Please sign in to comment.