Pattern typechecker gives slightly-wrong type error

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

Bug Description

Consider:

type FooType(a):
    Foo(a)

type BarType:
    Bar

type BazType:
    Baz

def foo(x :: FooType(BarType)) :: Int:
    switch x:
        case Foo(Baz):
            return 1
    return 0

This should print out:
Type error in pattern 'Foo(Baz)'
        Term: Baz
        Type: BazType
        Expected: BarType.

Instead it prints out:
Type error in pattern 'Foo(Baz)'
        Term: Foo(Baz)
        Type: FooType(BazType)
        Expected: FooType(BarType).

This is due to a minor bug in the way patterns are unified.

Tags: types

Related branches

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

Fixed in newtypes branch, r1016.

Changed in mars:
status: In Progress → Fix Committed
Revision history for this message
Matt Giuca (mgiuca) wrote :

Merged to trunk, r1030.

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.