mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
Don't add path instructions for newtypes that decay into their args
This commit is contained in:
parent
d4ad981448
commit
eee13a4aa3
5 changed files with 44 additions and 11 deletions
|
@ -977,9 +977,16 @@ fn needs_tests(pattern: &Pattern) -> bool {
|
|||
|
||||
match pattern {
|
||||
Identifier(_) | Underscore => false,
|
||||
NewtypeDestructure { arguments, .. } => {
|
||||
// Newtypes that only have one argument decay immediately into that argument, so no
|
||||
// test for them is needed.
|
||||
//
|
||||
// Newtypes with > 1 argument decay into a struct of those arguments, and we'll need to
|
||||
// read the appropriate argument in the struct when constructing the decision tree.
|
||||
arguments.len() != 1
|
||||
}
|
||||
|
||||
RecordDestructure(_, _)
|
||||
| NewtypeDestructure { .. }
|
||||
| AppliedTag { .. }
|
||||
| OpaqueUnwrap { .. }
|
||||
| BitLiteral { .. }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue