Skip to content

Commit bedbbe4

Browse files
committed
Fix struct match bug.
1 parent 94161d0 commit bedbbe4

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

langs/outlaw/compile-expr.rkt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@
340340
cm2))])])]
341341
[(PStruct n ps)
342342
(match (compile-struct-patterns ps c g (cons #f cm) next 1)
343-
[(list i f cm)
343+
[(list i f cm1)
344344
(let ((fail (gensym)))
345345
(list
346346
(seq (Mov r8 rax)
@@ -358,7 +358,7 @@
358358
(Label fail)
359359
(Add rsp (*8 (length cm)))
360360
(Jmp next))
361-
cm))])]
361+
cm1))])]
362362

363363
[(PPred e)
364364
(let ((fail (gensym 'fail)))

langs/outlaw/test/test-runner.rkt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,12 @@
604604
(check-equal? (run '(let ((x 1)) x x x)) 1)
605605
(check-equal? (run '(match 1 [1 2 3])) 3)
606606
(check-equal? (run '(system-type)) (system-type))
607+
(check-equal? (run '(struct Foo (x))
608+
'(struct Bar (y))
609+
'(match (Bar 1)
610+
[(Foo x) #f]
611+
[(Bar x) x]))
612+
1)
607613
)
608614

609615

0 commit comments

Comments
 (0)