Skip to content

Miscompilation of Nat literals #3515

@Z-snails

Description

@Z-snails
toNat : Nat -> () -> Nat
toNat 0 () = 1
toNat _ _ = 1

Steps to Reproduce

Load this file in idris2, then run :di toNat

Expected Behavior

Compiled: \ {arg:0}, {arg:1} => case {arg:0} of
  { 0 => 1
  ; _ => 1
  }

or

Compiled: \ {arg:0}, {arg:1} => case {arg:0} of
  { 0 => 1 + 0
  ; _ => 1
  }

or similar

Observed Behavior

Compiled: \ {arg:0}, {arg:1} => case {arg:0} of
  { 0 => Prelude.Types.S {tag = 1} [succ] 0
  ; _ => 1
  }

This produces the wrong thing, eg on chez you get (vector 1 0) instead of 1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions