mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 16:21:11 +00:00
Add test to regression-test over-specialization as in #4717
This commit is contained in:
parent
9a4e4f25c2
commit
52063b2df2
2 changed files with 133 additions and 0 deletions
|
@ -2475,3 +2475,24 @@ fn issue_4772_weakened_monomorphic_destructure() {
|
|||
"###
|
||||
)
|
||||
}
|
||||
|
||||
#[mono_test]
|
||||
fn weakening_avoids_overspecialization() {
|
||||
// Without weakening of let-bindings, this program would force two specializations of
|
||||
// `index` - to `Nat` and the default integer type, `I64`. The test is to ensure only one
|
||||
// specialization, that of `Nat`, exists.
|
||||
indoc!(
|
||||
r###"
|
||||
app "test" provides [main] to "./platform"
|
||||
|
||||
main : (List U8) -> (List U8)
|
||||
main = \input ->
|
||||
index = List.walkUntil input 0 \i, _ -> Break i
|
||||
|
||||
if index == 0 then
|
||||
input
|
||||
else
|
||||
List.drop input index
|
||||
"###
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue