Treat single quote literals as ranged numbers for inference purposes

This commit is contained in:
Ayaz Hafiz 2022-10-03 15:19:38 -05:00
parent 797763b5fa
commit 178b634266
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
10 changed files with 179 additions and 16 deletions

View file

@ -4027,12 +4027,18 @@ pub fn with_hole<'a>(
hole,
),
SingleQuote(character) => Stmt::Let(
assigned,
Expr::Literal(Literal::Int((character as i128).to_ne_bytes())),
Layout::int_width(IntWidth::I32),
hole,
),
SingleQuote(_, _, character, _) => {
let layout = layout_cache
.from_var(env.arena, variable, env.subs)
.unwrap();
Stmt::Let(
assigned,
Expr::Literal(Literal::Int((character as i128).to_ne_bytes())),
layout,
hole,
)
}
LetNonRec(def, cont) => from_can_let(
env,
procs,