This PR is a nice addition in the general case
https://github.com/roc-lang/roc/pull/9816
However it triggers on all my unit tests where i intentionally build inputs to test a deterministic pattern in a match statement (e.g. test Ok or Err cases). Not sure how to account for both use cases though ...
hm, can you show an example of one of these tests?
here is a toy example
Color : [Blue, Red]
get_favorite_color : (Str) -> Color
get_favorite_color = |name| {
if name == "Bob" {
Blue
} else {
Red
}
}
expect match get_favorite_color("Bob") {
Blue => Bool.True
_ => Bool.False
}
UNCONDITIONAL CONDITION
This match value is known at compile time, so this match will always inspect the same value.
Are expect's evaluated at compile time?
Like not roc test but roc build is doing this?
I assume this is roc test
but roc test has its constants get evaluated at compile-time just like everything else, so it makes sense from the compiler's perspective to flag this :smile:
I think we just need to disable that check inside expect
actually I guess even roc check would flag it
it shows up in all cases
10% ❯ roc examples/bugs/unconditional_conditional.roc
┌─────────────────────────┐
│ UNCONDITIONAL CONDITION ├─ This match value is known at compile time, so this match will always inspect the same value. ──────────────────────────┐
└┬────────────────────────┘ │
│ │
│ expect match get_messages("Bob") { │
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ │
└────────────────────── /var/folders/6t/1pxgxq6x3z5279ljlxshg2nc0000gn/T/roc/release-fast-26ecddf3/Vo9KUFE5LHdQ2vChgIPqlQkHThUTjpdX/main.roc:18:14 ┘
Found 0 error(s) and 1 warning(s) for /var/folders/6t/1pxgxq6x3z5279ljlxshg2nc0000gn/T/roc/release-fast-26ecddf3/Vo9KUFE5LHdQ2vChgIPqlQkHThUTjpdX/main.roc.
terrocotta on main [!?] via ↯ v0.16.0
10% ❯ roc build examples/bugs/unconditional_conditional.roc
┌─────────────────────────┐
│ UNCONDITIONAL CONDITION ├─ This match value is known at compile time, so ───┐
└┬────────────────────────┘ this match will always inspect the same value. │
│ │
│ expect match get_messages("Bob") { │
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ │
└────────────────────────────────────────────────────────────────────────────┘
/var/folders/6t/1pxgxq6x3z5279ljlxshg2nc0000gn/T/roc/release-fast-26ecddf3/N01parxE2JborsMqhPcXgNd8BuiPF8SO/unconditional_conditional.roc:18:14
0 errors and 1 warning found in 56ms while successfully building:
unconditional_conditional
terrocotta on main [!?] via ↯ v0.16.0
10% ❯ roc test examples/bugs/unconditional_conditional.roc
All (1) tests passed in 10.0 ms.
┌─────────────────────────┐
│ UNCONDITIONAL CONDITION ├─ This match value is known at compile time, so ───┐
└┬────────────────────────┘ this match will always inspect the same value. │
│ │
│ expect match get_messages("Bob") { │
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ │
└────────────────────────────────────────────────────────────────────────────┘
/Users/romain/Projects/terrocotta/examples/bugs/unconditional_conditional.roc:12:14
yeah I'll push a fix for this!
PR for this: https://github.com/roc-lang/roc/pull/9863
@Romain Lepert landed - lmk if that fixes it for you!
it works on roc_nightly-2026-06-30-09084da :)
Last updated: Jul 23 2026 at 13:15 UTC