Crash unifying IO and non-IO functions

Bug #912075 reported by Matt Giuca
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mars
Fix Committed
Critical
Matt Giuca

Bug Description

The typedict module (augment_globalref) crashes trying to unify an IO function type with a non-IO function type.

An IO version of curry2_:

    def curryio2_(f :: (a, b) ->io r, x :: a) :: b ->io r:
        return f(x, ...)

Crashes with the following error:

augment_globalref: Type '((a, b) -> io r, a, b) -> io r' did not unify with '((a, b) -> r, a, b) -> r'.

Related branches

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

Actually, this only happens if you also include a pure function with the same signature (sans io). So if you import the prelude, it will crash because of curry2_, but in isolation the above code won't crash. So here is a complete program that exhibits this error:

def curry2_(f :: (a, b) -> r, x :: a) :: b -> r:
    return f(x, ...)
def curryio2_(f :: (a, b) ->io r, x :: a) :: b ->io r:
    return f(x, ...)

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

Here is an even more minimal example:

def curry0_(f :: () -> r) :: () -> r:
    return f(...)
def curryio0_(f :: () ->io r) :: () ->io r:
    return f(...)

The problem is because the closure template for partially-applying f is being given the same name in both instances: "ct:ty:v1f1:0".

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

Fixed in trunk r1305.

Changed in mars:
status: Triaged → Fix Committed
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.