Interactive: Generics fail to unify oddly-bound types

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

Bug Description

In interactive mode, some fully general types (e.g. 'a') fail to unify with other types.

It appears the only case this arises is when the "other type" is a complex type with badly-bound type variables, which can only be caused by bug #418161. Therefore, solving that bug may cause this one to disappear, but I still want to investigate.

Observed behaviour:
?> a = [1,2,3]
?> :t a
a :: Array(t_1) # This is caused by bug #41861
?> show(a)
Type error in expression 'show(a)'
        Term: a
        Type: Array(a)
        Expected: a.

Expected behaviour:
?> show(a)
[91, 49, 44, 32, 50, 44, 32, 51, 93]

Note that this bug doesn't occur for array literals:
?> show([1,2,3])
[91, 49, 44, 32, 50, 44, 32, 51, 93]

Or for properly-bound types:

def ai :: Array(Int):
    return [1,2,3]

?> :t ai
ai :: Array(Int)
?> show(ai)
[91, 49, 44, 32, 50, 44, 32, 51, 93]

So it may just be a side-effect of bug #418161.

Tags: types
Matt Giuca (mgiuca)
Changed in mars:
assignee: nobody → Matt Giuca (mgiuca)
importance: Undecided → High
status: New → Triaged
Matt Giuca (mgiuca)
tags: added: types
Matt Giuca (mgiuca)
Changed in mars:
milestone: none → 0.3
Revision history for this message
Matt Giuca (mgiuca) wrote :

Needs to be fixed (this isn't part of the type system refactor; it's a high-priority bug).

Changed in mars:
milestone: 0.3 → 0.2.1
Revision history for this message
Matt Giuca (mgiuca) wrote :

This is a duplicate of #418161, as it occurs because local variables in interactive have no varset. Type variables without varsets are not merged correctly when the varsets merge, causing certain type variables to happen to be considered equal.

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.