Skip to content

Commit 264159c

Browse files
committed
ES: fix conversion as-pat
1 parent e38be6c commit 264159c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

grin/src/Transformations/ExtendedSyntax/Conversion.hs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,18 @@ instance Convertible Exp New.Exp where
150150
| EBind (SReturn (Var var')) (ConstTagNode tag args) rhs2 <- rhs1
151151
, var == var'
152152
-> pure $ New.EBindF lhs1 (oldNodeToAsPat tag args var) rhs2
153+
{- NOTE:
154+
v.0 <- pure <value>
155+
<pat> <- pure v.0 -- pat is neither a node pat nor a var pat
156+
<rhs2>
157+
158+
v.0 <- pure <value>
159+
<rhs2>
160+
-}
161+
| EBind (SReturn (Var var')) valPat rhs2 <- rhs1
162+
, isn't _Var valPat
163+
, var == var'
164+
-> pure $ New.EBindF lhs1 (New.VarPat $ convert var) rhs2
153165
{- NOTE: In this case, v.0 has been defined earlier in the program.
154166
This is a more general case that covers the one before as well.
155167

0 commit comments

Comments
 (0)