Skip to content

Compilation bug on matches without all the constructor fields #53

@developedby

Description

@developedby

Reproducing the behavior

@Bool__all$(&xs) = 
  (~xs {
    #Nil:1 
    #Cons:λ&h λ&t @Bool__and$(h @Bool__all$(t))})

@Bool__all$(&xs) = 
  (~xs {
    #Nil:1 
    #Cons{h t}: @Bool__and$(h @Bool__all$(t))})
  //      /\ 

The first one is giving error running in compiled mode, because the HVM->C compiler assumes that pattern matches will always have the exact number of fields, even though semantically having a lambda should be the same.
As a compiler optimization we avoid creating an application to apply the matched field and simply substitute instead, but that obviously doesn't work if there is no lambda.

System Settings

Commit 58c7adc

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions