Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compile CharLit patterns #615

Merged
merged 2 commits into from
Aug 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}