mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 06:44:46 +00:00
Get things compiling
This commit is contained in:
parent
70bef827a7
commit
f35e43768a
18 changed files with 541 additions and 253 deletions
|
@ -1095,7 +1095,10 @@ fn test_to_equality<'a>(
|
|||
}
|
||||
|
||||
Test::IsStr(test_str) => {
|
||||
let lhs = Expr::Literal(Literal::Str(env.arena.alloc(test_str)));
|
||||
let lhs = Expr::Literal(Literal::Str {
|
||||
interpolations: &[],
|
||||
suffix: env.arena.alloc(test_str),
|
||||
});
|
||||
let lhs_symbol = env.unique_symbol();
|
||||
let (mut stores, rhs_symbol) = path_to_expr(env, cond_symbol, &path, &cond_layout);
|
||||
|
||||
|
|
|
@ -590,7 +590,10 @@ pub enum Literal<'a> {
|
|||
// Literals
|
||||
Int(i64),
|
||||
Float(f64),
|
||||
Str(&'a str),
|
||||
Str {
|
||||
interpolations: &'a [(&'a str, Symbol)],
|
||||
suffix: &'a str,
|
||||
},
|
||||
/// Closed tag unions containing exactly two (0-arity) tags compile to Expr::Bool,
|
||||
/// so they can (at least potentially) be emitted as 1-bit machine bools.
|
||||
///
|
||||
|
@ -669,7 +672,13 @@ impl<'a> Literal<'a> {
|
|||
Float(lit) => alloc.text(format!("{}f64", lit)),
|
||||
Bool(lit) => alloc.text(format!("{}", lit)),
|
||||
Byte(lit) => alloc.text(format!("{}u8", lit)),
|
||||
Str(lit) => alloc.text(format!("{:?}", lit)),
|
||||
Str {
|
||||
interpolations,
|
||||
suffix,
|
||||
} => {
|
||||
// alloc.text(format!("{:?}", lit))
|
||||
todo!("Literal::to_doc for Str");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1242,12 +1251,18 @@ pub fn with_hole<'a>(
|
|||
hole,
|
||||
),
|
||||
|
||||
Str(string) | BlockStr(string) => Stmt::Let(
|
||||
assigned,
|
||||
Expr::Literal(Literal::Str(arena.alloc(string))),
|
||||
Layout::Builtin(Builtin::Str),
|
||||
hole,
|
||||
),
|
||||
Str {
|
||||
interpolations,
|
||||
suffix: _,
|
||||
} => {
|
||||
todo!("mono IR to turn Str interpolations into Let");
|
||||
// Stmt::Let(
|
||||
// assigned,
|
||||
// Expr::Literal(Literal::Str(arena.alloc(string))),
|
||||
// Layout::Builtin(Builtin::Str),
|
||||
// hole,
|
||||
// )
|
||||
}
|
||||
|
||||
Num(var, num) => match num_argument_to_int_or_float(env.subs, var) {
|
||||
IntOrFloat::IntType => Stmt::Let(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue