mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
Default Num layout to Int
This commit is contained in:
parent
6ef74a2432
commit
1f6afe1182
1 changed files with 9 additions and 8 deletions
|
@ -537,11 +537,12 @@ fn layout_from_num_content<'a>(content: Content) -> Result<Layout<'a>, ()> {
|
||||||
use roc_types::subs::FlatType::*;
|
use roc_types::subs::FlatType::*;
|
||||||
|
|
||||||
match content {
|
match content {
|
||||||
var @ FlexVar(_) | var @ RigidVar(_) => {
|
FlexVar(_) | RigidVar(_) => {
|
||||||
panic!(
|
// If a Num makes it all the way through type checking with an unbound
|
||||||
"Layout::from_num_content encountered an unresolved {:?}",
|
// type variable, then assume it's a 64-bit integer.
|
||||||
var
|
//
|
||||||
);
|
// (e.g. for (5 + 5) assume both 5s are 64-bit integers.)
|
||||||
|
Ok(Layout::Builtin(Builtin::Int64))
|
||||||
}
|
}
|
||||||
Structure(Apply(symbol, args)) => match symbol {
|
Structure(Apply(symbol, args)) => match symbol {
|
||||||
Symbol::INT_INTEGER => Ok(Layout::Builtin(Builtin::Int64)),
|
Symbol::INT_INTEGER => Ok(Layout::Builtin(Builtin::Int64)),
|
||||||
|
@ -553,12 +554,12 @@ fn layout_from_num_content<'a>(content: Content) -> Result<Layout<'a>, ()> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Alias(_, _, _) => {
|
||||||
|
todo!("TODO recursively resolve type aliases in num_from_content");
|
||||||
|
}
|
||||||
Structure(_) => {
|
Structure(_) => {
|
||||||
panic!("Invalid Num.Num type application: {:?}", content);
|
panic!("Invalid Num.Num type application: {:?}", content);
|
||||||
}
|
}
|
||||||
Alias(_, _, _) => {
|
|
||||||
panic!("TODO recursively resolve type aliases in num_from_content");
|
|
||||||
}
|
|
||||||
Error => Err(()),
|
Error => Err(()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue