Skip to content

Commit

Permalink
compile CharLit patterns (#615)
Browse files Browse the repository at this point in the history
* compile CharLit patterns

* add test
  • Loading branch information
ggreif authored and mergify[bot] committed Aug 13, 2019
1 parent ed6f02e commit 7b2139c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/codegen/compile.ml
Original file line number Diff line number Diff line change
Expand Up @@ -6222,11 +6222,14 @@ and compile_lit_pat env l =
BoxedSmallWord.unbox env ^^
snd (compile_lit env l) ^^
compile_eq env Type.(Prim Word32)
| CharLit _ ->
snd (compile_lit env l) ^^
compile_eq env Type.(Prim Char)
| Word64Lit _ ->
BoxedWord64.unbox env ^^
snd (compile_lit env l) ^^
compile_eq env Type.(Prim Word64)
| (TextLit t) ->
| TextLit t ->
Text.lit env t ^^
Text.compare env
| _ -> todo_trap env "compile_lit_pat" (Arrange_ir.lit l)
Expand Down
12 changes: 12 additions & 0 deletions test/run/char-pats.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
switch 'a' {
case 'b' assert false;
case 'a' assert true;
case _ assert false;
};

switch (?'\u{28ae4}') {
case (?'a') assert false;
case (?'\u{28ae4}') assert true;
case _ assert false;
}

0 comments on commit 7b2139c

Please sign in to comment.