Skip to content

Commit

Permalink
Merge pull request #7199 from roc-lang/fix-imports-in-expect-7025
Browse files Browse the repository at this point in the history
  • Loading branch information
agu-z authored Nov 6, 2024
2 parents 6828c81 + 0dedab1 commit c1a82ae
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
15 changes: 15 additions & 0 deletions crates/cli/tests/cli_run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -971,6 +971,21 @@ mod cli_run {
);
}

#[test]
#[cfg_attr(windows, ignore)]
fn import_in_expect() {
test_roc_expect(
"crates/cli/tests/module_params",
"ImportInExpect.roc",
&[],
indoc!(
r#"
0 failed and 3 passed in <ignored for test> ms.
"#
),
);
}

#[test]
#[cfg_attr(windows, ignore)]
fn transitive_expects() {
Expand Down
15 changes: 15 additions & 0 deletions crates/cli/tests/module_params/ImportInExpect.roc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module []

https = \url -> "https://$(url)"

expect
import Api { appId: "one", protocol: https }
Api.baseUrl == "https://api.example.com/one"

expect
import Api { appId: "two", protocol: https }
Api.getUser 1 == "https://api.example.com/two/users/1"

expect
import NoParams
NoParams.hello == "hello!"
3 changes: 3 additions & 0 deletions crates/cli/tests/module_params/NoParams.roc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module [hello]

hello = "hello!"
3 changes: 3 additions & 0 deletions crates/compiler/mono/src/ir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2482,6 +2482,9 @@ fn from_can_let<'a>(

lower_rest!(variable, cont.value)
}
ImportParams(_, _, None) => {
lower_rest!(variable, cont.value)
}
Var(original, _) | AbilityMember(original, _, _)
if procs.get_partial_proc(original).is_none() =>
{
Expand Down

0 comments on commit c1a82ae

Please sign in to comment.