Type error for cases with int literals on polymorphic types

Bug #509457 reported by Matt Giuca
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mars
Fix Released
High
Matt Giuca

Bug Description

If a switch is made on a type which is polymorphic, but instantiated as Int, Mars will give a bogus type error on a case with an int literal. This doesn't seem to happen for named-constructor patterns, only int literals.

eg:

def case_intlit(x :: Maybe(Int)) :: Int:
    switch x:
        case Just(1):
            return 2
        case Just(q):
            return q

(case_intlit) Type error in pattern 'Just(1)'
        Term: 1
        Type: Int
        Expected: a.

It looks like the type is being compared for a perfect match rather than being unified.

Tags: types

Related branches

Revision history for this message
Matt Giuca (mgiuca) wrote :

Fixed in trunk r941.

Changed in mars:
status: Triaged → Fix Committed
Matt Giuca (mgiuca)
Changed in mars:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.