Format string literals in patterns

This commit is contained in:
Ayaz Hafiz 2022-09-07 17:30:52 -05:00
parent 31eb03ab22
commit fc6561ecb6
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
2 changed files with 45 additions and 3 deletions

View file

@ -1,4 +1,5 @@
use crate::annotation::{Formattable, Newlines, Parens};
use crate::expr::fmt_str_literal;
use crate::spaces::{fmt_comments_only, fmt_spaces, NewlineAt};
use crate::Buf;
use roc_parse::ast::{Base, CommentOrNewline, Pattern};
@ -146,9 +147,7 @@ impl<'a> Formattable for Pattern<'a> {
buf.indent(indent);
buf.push_str(string);
}
StrLiteral(literal) => {
todo!("Format string literal: {:?}", literal);
}
StrLiteral(literal) => fmt_str_literal(buf, *literal, indent),
SingleQuote(string) => {
buf.push('\'');
buf.push_str(string);