Nested pattern with two fields raises interpreter error
Bug #576375 reported by
Matt Giuca
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(
"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
Changed in mars: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
Added test case compiler/ nestpattern.