Account for SingleQuote in the case statements for the cli, plus some errata

+ Evidently I failed to finish fixing merge conflicts
+ Some of the types that the SingleQuote code mentioned didn't exist according to the build step. I looked around and switched them out for types it LOOKED like they were supposed to be, but someone should probably check this
+ Don't make commits like this; it's multiple unrelated changes thrown together. I'm still figuring out my way around here
This commit is contained in:
Chelsea Troy 2021-12-01 00:13:15 -06:00
parent 6cf755ad8d
commit 0e5f82526a
3 changed files with 9 additions and 19 deletions

View file

@ -524,6 +524,7 @@ impl<'a> RemoveSpaces<'a> for Expr<'a> {
Expr::PrecedenceConflict(a) => Expr::PrecedenceConflict(a), Expr::PrecedenceConflict(a) => Expr::PrecedenceConflict(a),
Expr::SpaceBefore(a, _) => a.remove_spaces(arena), Expr::SpaceBefore(a, _) => a.remove_spaces(arena),
Expr::SpaceAfter(a, _) => a.remove_spaces(arena), Expr::SpaceAfter(a, _) => a.remove_spaces(arena),
Expr::SingleQuote(a) => Expr::Num(a),
} }
} }
} }
@ -565,6 +566,7 @@ impl<'a> RemoveSpaces<'a> for Pattern<'a> {
} }
Pattern::SpaceBefore(a, _) => a.remove_spaces(arena), Pattern::SpaceBefore(a, _) => a.remove_spaces(arena),
Pattern::SpaceAfter(a, _) => a.remove_spaces(arena), Pattern::SpaceAfter(a, _) => a.remove_spaces(arena),
Pattern::SingleQuote(a) => Pattern::NumLiteral(a),
} }
} }
} }

View file

@ -3039,7 +3039,7 @@ pub fn with_hole<'a>(
SingleQuote(character) => Stmt::Let( SingleQuote(character) => Stmt::Let(
assigned, assigned,
Expr::Literal(Literal::Int(character as _)), Expr::Literal(Literal::Int(character as _)),
Layout::Builtin(Builtin::Int32), Layout::int_width(IntWidth::I32),
hole, hole,
), ),
@ -7327,7 +7327,7 @@ fn from_can_pattern_help<'a>(
} }
} }
StrLiteral(v) => Ok(Pattern::StrLiteral(v.clone())), StrLiteral(v) => Ok(Pattern::StrLiteral(v.clone())),
SingleQuote(c) => Ok(Pattern::IntLiteral(*c as _, IntPrecision::I32)), SingleQuote(c) => Ok(Pattern::IntLiteral(*c as _, IntWidth::I32)),
Shadowed(region, ident) => Err(RuntimeError::Shadowing { Shadowed(region, ident) => Err(RuntimeError::Shadowing {
original_region: *region, original_region: *region,
shadow: ident.clone(), shadow: ident.clone(),

View file

@ -1054,19 +1054,6 @@ fn format_category<'b>(
]), ]),
alloc.text(" produces:"), alloc.text(" produces:"),
), ),
<<<<<<< HEAD:compiler/reporting/src/error/type.rs
List => alloc.concat(vec![this_is, alloc.text(" a list of type:")]),
Num => alloc.concat(vec![this_is, alloc.text(" a number of type:")]),
Int => alloc.concat(vec![this_is, alloc.text(" an integer of type:")]),
Float => alloc.concat(vec![this_is, alloc.text(" a float of type:")]),
Str => alloc.concat(vec![this_is, alloc.text(" a string of type:")]),
StrInterpolation => alloc.concat(vec![
this_is,
alloc.text(" a value in a string interpolation, which was of type:"),
]),
Character => alloc.concat(vec![this_is, alloc.text(" a character of type:")]),
=======
List => ( List => (
alloc.concat(vec![this_is, alloc.text(" a list")]), alloc.concat(vec![this_is, alloc.text(" a list")]),
alloc.text(" of type:"), alloc.text(" of type:"),
@ -1094,18 +1081,19 @@ fn format_category<'b>(
]), ]),
alloc.text(" which was of type:"), alloc.text(" which was of type:"),
), ),
>>>>>>> trunk:reporting/src/error/type.rs Character => (
alloc.concat(vec![this_is, alloc.text(" a character")
]),
alloc.text(" of type:")
),
Lambda => ( Lambda => (
alloc.concat(vec![this_is, alloc.text(" an anonymous function")]), alloc.concat(vec![this_is, alloc.text(" an anonymous function")]),
alloc.text(" of type:"), alloc.text(" of type:"),
), ),
ClosureSize => ( ClosureSize => (
alloc.concat(vec![this_is, alloc.text(" the closure size of a function")]), alloc.concat(vec![this_is, alloc.text(" the closure size of a function")]),
alloc.text(" of type:"), alloc.text(" of type:"),
), ),
TagApply { TagApply {
tag_name: TagName::Global(name), tag_name: TagName::Global(name),
args_count: 0, args_count: 0,