Nested pattern with two fields raises interpreter error

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

Bug Description

The following code raises an interpreter error on call to nestpattern(Box(1,2)):
"Field reference to something not an ADT"

type Box(a):
    Box(a)

type Pair(a, b):
    Pair(a, b)

def nestpattern(x :: Box(Pair(a, b))) :: Int:
    switch x:
        case Box(Pair(a, b)):
            return 0

The generated assembly code is:
        $T:0 = x.Box(0)
        $T:0 = $T:0.Pair(0)
        $T:0:1 = $T:0.Pair(1) # Error occurs on this line

Clearly the assembly code is invalid -- $T:0 is re-assigned even though it is still in use.

Related branches

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

Added test case compiler/nestpattern.

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

Fixed in trunk r1013.

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.