mirror of
https://github.com/roc-lang/roc.git
synced 2024-11-13 09:49:11 +03:00
Update symbols definition
This commit is contained in:
parent
31cc64b634
commit
85c622b169
@ -1845,7 +1845,7 @@ fn num_float(pool: &mut Pool, range: TypeId) -> Type2 {
|
||||
let num_num_id = pool.add(num_num_type);
|
||||
|
||||
Type2::Alias(
|
||||
Symbol::NUM_FLOAT,
|
||||
Symbol::NUM_FRAC,
|
||||
PoolVec::new(vec![range].into_iter(), pool),
|
||||
num_num_id,
|
||||
)
|
||||
|
@ -3,7 +3,7 @@ interface Num
|
||||
[
|
||||
Num,
|
||||
Int,
|
||||
Float,
|
||||
Frac,
|
||||
|
||||
Integer,
|
||||
FloatingPoint,
|
||||
|
@ -176,7 +176,7 @@ fn builtin_alias(
|
||||
#[inline(always)]
|
||||
pub fn num_float(range: Type) -> Type {
|
||||
builtin_alias(
|
||||
Symbol::NUM_FLOAT,
|
||||
Symbol::NUM_FRAC,
|
||||
vec![range.clone()],
|
||||
Box::new(num_num(num_floatingpoint(range))),
|
||||
AliasKind::Structural,
|
||||
|
@ -79,7 +79,7 @@ const EXPANDED_STACK_SIZE: usize = 8 * 1024 * 1024;
|
||||
const PRELUDE_TYPES: [(&str, Symbol); 33] = [
|
||||
("Num", Symbol::NUM_NUM),
|
||||
("Int", Symbol::NUM_INT),
|
||||
("Float", Symbol::NUM_FLOAT),
|
||||
("Frac", Symbol::NUM_FRAC),
|
||||
("Integer", Symbol::NUM_INTEGER),
|
||||
("FloatingPoint", Symbol::NUM_FLOATINGPOINT),
|
||||
("Binary32", Symbol::NUM_BINARY32),
|
||||
|
@ -1086,7 +1086,7 @@ define_builtins! {
|
||||
78 NUM_MUL_WRAP: "mulWrap"
|
||||
79 NUM_MUL_CHECKED: "mulChecked"
|
||||
80 NUM_INT: "Int"
|
||||
81 NUM_FLOAT: "Float"
|
||||
81 NUM_FRAC: "Frac"
|
||||
82 NUM_NATURAL: "Natural"
|
||||
83 NUM_NAT: "Nat"
|
||||
84 NUM_INT_CAST: "intCast"
|
||||
|
@ -1038,7 +1038,7 @@ impl<'a> Layout<'a> {
|
||||
return Ok(Layout::i64());
|
||||
}
|
||||
|
||||
Symbol::NUM_FLOAT | Symbol::NUM_FLOATINGPOINT
|
||||
Symbol::NUM_FRAC | Symbol::NUM_FLOATINGPOINT
|
||||
if is_unresolved_var(env.subs, actual_var) =>
|
||||
{
|
||||
// default to f64
|
||||
|
@ -252,8 +252,8 @@ impl Aliases {
|
||||
|
||||
Some((num_content_var, AliasKind::Structural))
|
||||
}
|
||||
Symbol::NUM_FLOAT => {
|
||||
// Float range : Num (FloatingPoint range)
|
||||
Symbol::NUM_FRAC => {
|
||||
// Frac range : Num (FloatingPoint range)
|
||||
//
|
||||
// build `FloatingPoint range := range`
|
||||
let fpoint_content_var = Self::build_num_opaque(
|
||||
|
@ -39,9 +39,9 @@ pub fn aliases() -> MutMap<Symbol, BuiltinAlias> {
|
||||
},
|
||||
);
|
||||
|
||||
// Float range : Num (FloatingPoint range)
|
||||
// Frac range : Num (FloatingPoint range)
|
||||
add_alias(
|
||||
Symbol::NUM_FLOAT,
|
||||
Symbol::NUM_FRAC,
|
||||
BuiltinAlias {
|
||||
region: Region::zero(),
|
||||
vars: vec![Loc::at(Region::zero(), "range".into())],
|
||||
@ -303,7 +303,7 @@ pub fn aliases() -> MutMap<Symbol, BuiltinAlias> {
|
||||
},
|
||||
);
|
||||
|
||||
// Dec : Float Decimal
|
||||
// Dec : Frac Decimal
|
||||
add_alias(
|
||||
Symbol::NUM_DEC,
|
||||
BuiltinAlias {
|
||||
@ -314,7 +314,7 @@ pub fn aliases() -> MutMap<Symbol, BuiltinAlias> {
|
||||
},
|
||||
);
|
||||
|
||||
// F64 : Float Binary64
|
||||
// F64 : Frac Binary64
|
||||
add_alias(
|
||||
Symbol::NUM_F64,
|
||||
BuiltinAlias {
|
||||
@ -325,7 +325,7 @@ pub fn aliases() -> MutMap<Symbol, BuiltinAlias> {
|
||||
},
|
||||
);
|
||||
|
||||
// F32 : Float Binary32
|
||||
// F32 : Frac Binary32
|
||||
add_alias(
|
||||
Symbol::NUM_F32,
|
||||
BuiltinAlias {
|
||||
@ -411,12 +411,12 @@ fn floatingpoint_alias_content(range: SolvedType) -> SolvedType {
|
||||
range
|
||||
}
|
||||
|
||||
// FLOAT
|
||||
// FRAC
|
||||
|
||||
#[inline(always)]
|
||||
pub fn float_type(range: SolvedType) -> SolvedType {
|
||||
SolvedType::Alias(
|
||||
Symbol::NUM_FLOAT,
|
||||
Symbol::NUM_FRAC,
|
||||
vec![(range.clone())],
|
||||
vec![],
|
||||
Box::new(float_alias_content(range)),
|
||||
|
@ -423,7 +423,7 @@ fn write_content<'a>(
|
||||
write_integer(env, ctx, content, subs, buf, parens, write_parens)
|
||||
}
|
||||
|
||||
Symbol::NUM_FLOAT => write_float(
|
||||
Symbol::NUM_FRAC => write_float(
|
||||
env,
|
||||
ctx,
|
||||
get_single_arg(subs, args),
|
||||
|
@ -2428,8 +2428,8 @@ fn to_diff<'b>(
|
||||
_ => false,
|
||||
};
|
||||
let is_float = |t: &ErrorType| match t {
|
||||
ErrorType::Type(Symbol::NUM_FLOAT, _) => true,
|
||||
ErrorType::Alias(Symbol::NUM_FLOAT, _, _, _) => true,
|
||||
ErrorType::Type(Symbol::NUM_FRAC, _) => true,
|
||||
ErrorType::Alias(Symbol::NUM_FRAC, _, _, _) => true,
|
||||
|
||||
ErrorType::Type(Symbol::NUM_NUM, args) => {
|
||||
matches!(
|
||||
|
Loading…
Reference in New Issue
Block a user