Type error for cases with int literals on polymorphic types
Bug #509457 reported by
Matt Giuca
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.
Related branches
Changed in mars: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
Fixed in trunk r941.