Opened 6 years ago

Closed 6 years ago

#254 closed defect (fixed)

Bad error message for function with Bools

Reported by: benl Owned by:
Priority: normal Milestone: 0.3.0
Component: Unknown Version: 0.2.1
Keywords: Cc:


module Test 
imports { 
        addNat  :: [r1 r2 r3 : %]
                . Nat r1 
                -(!0 | Use r3)> Nat r2 
                -(Read r1 + Read r2 + Alloc r3 | Use r1 + Use r3)> Nat r3;
with letrec
thing [r1 : %] (b : Bool r1) : Int r1
 = let  x       = case b of
                        True  -> N# [r1] 5#
                        False -> N# [r1] 6#
   in   addInt [:r1 r1 r1:] x (N# [r1] 1#)
Error loading module
  When checking expression.
    Cannot instantiate constructor type with discriminant type args.
     Either the constructor has an invalid type,
     or the type of the discriminant does not match the type of the pattern.
          Constructor type: Bool r1
         Discriminant type: *0

Why is the discrim type bad?

Change History (1)

comment:1 Changed 6 years ago by benl

  • Resolution set to fixed
  • Status changed from new to closed

True isn't part of the Lite language, only True#. We weren't checking for undefined constructors used as patterns.

Note: See TracTickets for help on using tickets.