add new layer to the Num types

This commit is contained in:
rvcas 2020-12-18 16:41:24 -05:00
parent 4d692af639
commit aa4b376134
10 changed files with 441 additions and 92 deletions

View file

@ -1219,7 +1219,7 @@ fn float_type(u: VarId) -> SolvedType {
Vec::new(),
Box::new(builtin_aliases::num_type(SolvedType::Apply(
Symbol::ATTR_ATTR,
vec![flex(u), builtin_aliases::floatingpoint_type()],
vec![flex(u), builtin_aliases::float_type()],
))),
),
],
@ -1237,7 +1237,7 @@ fn int_type(u: VarId) -> SolvedType {
Vec::new(),
Box::new(builtin_aliases::num_type(SolvedType::Apply(
Symbol::ATTR_ATTR,
vec![flex(u), builtin_aliases::integer_type()],
vec![flex(u), builtin_aliases::int_type()],
))),
),
],

View file

@ -76,33 +76,71 @@ pub fn num_float() -> Type {
Type::Alias(
Symbol::NUM_F64,
vec![],
Box::new(num_num(num_floatingpoint())),
Box::new(num_num(num_floatingpoint(num_binary64()))),
)
}
#[inline(always)]
pub fn num_floatingpoint() -> Type {
pub fn num_floatingpoint(range: Type) -> Type {
let alias_content = Type::TagUnion(
vec![(TagName::Private(Symbol::NUM_AT_FLOATINGPOINT), vec![])],
vec![(
TagName::Private(Symbol::NUM_AT_FLOATINGPOINT),
vec![range.clone()],
)],
Box::new(Type::EmptyTagUnion),
);
Type::Alias(Symbol::NUM_FLOATINGPOINT, vec![], Box::new(alias_content))
Type::Alias(
Symbol::NUM_FLOATINGPOINT,
vec![("range".into(), range)],
Box::new(alias_content),
)
}
#[inline(always)]
pub fn num_binary64() -> Type {
let alias_content = Type::TagUnion(
vec![(TagName::Private(Symbol::NUM_AT_BINARY64), vec![])],
Box::new(Type::EmptyTagUnion),
);
Type::Alias(Symbol::NUM_BINARY64, vec![], Box::new(alias_content))
}
#[inline(always)]
pub fn num_int() -> Type {
Type::Alias(Symbol::NUM_I64, vec![], Box::new(num_num(num_integer())))
Type::Alias(
Symbol::NUM_I64,
vec![],
Box::new(num_num(num_integer(num_signed64()))),
)
}
#[inline(always)]
pub fn num_integer() -> Type {
pub fn num_signed64() -> Type {
let alias_content = Type::TagUnion(
vec![(TagName::Private(Symbol::NUM_AT_INTEGER), vec![])],
vec![(TagName::Private(Symbol::NUM_AT_SIGNED64), vec![])],
Box::new(Type::EmptyTagUnion),
);
Type::Alias(Symbol::NUM_INTEGER, vec![], Box::new(alias_content))
Type::Alias(Symbol::NUM_SIGNED64, vec![], Box::new(alias_content))
}
#[inline(always)]
pub fn num_integer(range: Type) -> Type {
let alias_content = Type::TagUnion(
vec![(
TagName::Private(Symbol::NUM_AT_INTEGER),
vec![range.clone()],
)],
Box::new(Type::EmptyTagUnion),
);
Type::Alias(
Symbol::NUM_INTEGER,
vec![("range".into(), range)],
Box::new(alias_content),
)
}
#[inline(always)]

View file

@ -1,4 +1,4 @@
use crate::builtins::{num_floatingpoint, num_integer, num_num};
use crate::builtins::{num_binary64, num_floatingpoint, num_integer, num_num, num_signed64};
use crate::expr::{exists, Info};
use roc_can::annotation::IntroducedVariables;
use roc_can::constraint::Constraint::{self, *};
@ -174,16 +174,17 @@ fn constrain_pattern(
}
IntLiteral(_) => {
let (num_uvar, int_uvar, num_type) = unique_int(var_store);
let (var1, var2, num_uvar, int_uvar, num_type) = unique_int(var_store);
state.constraints.push(exists(
vec![num_uvar, int_uvar],
vec![num_uvar, int_uvar, var1, var2],
Constraint::Pattern(pattern.region, PatternCategory::Int, num_type, expected),
));
}
FloatLiteral(_) => {
let (num_uvar, float_uvar, num_type) = unique_float(var_store);
let (var1, var2, num_uvar, float_uvar, num_type) = unique_float(var_store);
state.constraints.push(exists(
vec![num_uvar, float_uvar],
vec![num_uvar, float_uvar, var1, var2],
Constraint::Pattern(pattern.region, PatternCategory::Float, num_type, expected),
));
}
@ -434,12 +435,42 @@ fn unique_num(var_store: &mut VarStore, val_type: Type) -> (Variable, Variable,
(num_uvar, val_uvar, num_type)
}
fn unique_int(var_store: &mut VarStore) -> (Variable, Variable, Type) {
unique_num(var_store, num_integer())
fn unique_integer(var_store: &mut VarStore, val_type: Type) -> (Variable, Variable, Type) {
let num_uvar = var_store.fresh();
let val_uvar = var_store.fresh();
let val_utype = attr_type(Bool::variable(val_uvar), val_type);
let num_type = num_integer(val_utype);
(num_uvar, val_uvar, num_type)
}
fn unique_float(var_store: &mut VarStore) -> (Variable, Variable, Type) {
unique_num(var_store, num_floatingpoint())
fn unique_int(var_store: &mut VarStore) -> (Variable, Variable, Variable, Variable, Type) {
let (var1, var2, typ) = unique_integer(var_store, num_signed64());
let (var3, var4, typ) = unique_num(var_store, typ);
(var1, var2, var3, var4, typ)
}
fn unique_floatingpoint(var_store: &mut VarStore, val_type: Type) -> (Variable, Variable, Type) {
let num_uvar = var_store.fresh();
let val_uvar = var_store.fresh();
let val_utype = attr_type(Bool::variable(val_uvar), val_type);
let num_type = num_floatingpoint(val_utype);
(num_uvar, val_uvar, num_type)
}
fn unique_float(var_store: &mut VarStore) -> (Variable, Variable, Variable, Variable, Type) {
let (var1, var2, typ) = unique_floatingpoint(var_store, num_binary64());
let (var3, var4, typ) = unique_num(var_store, typ);
(var1, var2, var3, var4, typ)
}
pub fn constrain_expr(
@ -472,10 +503,10 @@ pub fn constrain_expr(
)
}
Int(var, _) => {
let (num_uvar, int_uvar, num_type) = unique_int(var_store);
let (var1, var2, num_uvar, int_uvar, num_type) = unique_int(var_store);
exists(
vec![*var, num_uvar, int_uvar],
vec![*var, num_uvar, int_uvar, var1, var2],
And(vec![
Eq(
Type::Variable(*var),
@ -488,10 +519,10 @@ pub fn constrain_expr(
)
}
Float(var, _) => {
let (num_uvar, float_uvar, num_type) = unique_float(var_store);
let (var1, var2, num_uvar, float_uvar, num_type) = unique_float(var_store);
exists(
vec![*var, num_uvar, float_uvar],
vec![*var, num_uvar, float_uvar, var1, var2],
And(vec![
Eq(
Type::Variable(*var),

View file

@ -555,7 +555,7 @@ mod gen_num {
assert_evals_to!(
indoc!(
r#"
always42 : Num.Num Num.Integer -> Num.Num Num.Integer
always42 : Num.Num (Num.Integer Num.Signed64) -> Num.Num (Num.Integer Num.Signed64)
always42 = \_ -> 42
always42 5

View file

@ -797,7 +797,31 @@ define_builtins! {
54 NUM_ATAN: "atan"
55 NUM_ACOS: "acos"
56 NUM_ASIN: "asin"
57 NUM_BITWISE_AND: "bitwiseAnd"
57 NUM_AT_SIGNED128: "@Signed128"
58 NUM_SIGNED128: "Signed128" imported
59 NUM_AT_SIGNED64: "@Signed64"
60 NUM_SIGNED64: "Signed64" imported
61 NUM_AT_SIGNED32: "@Signed32"
62 NUM_SIGNED32: "Signed32" imported
63 NUM_AT_SIGNED16: "@Signed16"
64 NUM_SIGNED16: "Signed16" imported
65 NUM_AT_SIGNED8: "@Signed8"
66 NUM_SIGNED8: "Signed8" imported
67 NUM_AT_UNSIGNED128: "@Unsigned128"
68 NUM_UNSIGNED128: "Unsigned128" imported
69 NUM_AT_UNSIGNED64: "@Unsigned64"
70 NUM_UNSIGNED64: "Unsigned64" imported
71 NUM_AT_UNSIGNED32: "@Unsigned32"
72 NUM_UNSIGNED32: "Unsigned32" imported
73 NUM_AT_UNSIGNED16: "@Unsigned16"
74 NUM_UNSIGNED16: "Unsigned16" imported
75 NUM_AT_UNSIGNED8: "@Unsigned8"
76 NUM_UNSIGNED8: "Unsigned8" imported
77 NUM_AT_BINARY64: "@Binary64"
78 NUM_BINARY64: "Binary64" imported
79 NUM_AT_BINARY32: "@Binary32"
80 NUM_BINARY32: "Binary32" imported
81 NUM_BITWISE_AND: "bitwiseAnd"
}
2 BOOL: "Bool" => {
0 BOOL_BOOL: "Bool" imported // the Bool.Bool type alias

View file

@ -5832,7 +5832,9 @@ pub enum IntOrFloat {
pub fn num_argument_to_int_or_float(subs: &Subs, var: Variable) -> IntOrFloat {
match subs.get_without_compacting(var).content {
Content::Alias(Symbol::NUM_INTEGER, args, _) => {
debug_assert!(args.is_empty());
debug_assert!(args.len() == 1);
// TODO: we probably need to match on the type of the arg
IntOrFloat::IntType
}
Content::FlexVar(_) => {
@ -5840,7 +5842,9 @@ pub fn num_argument_to_int_or_float(subs: &Subs, var: Variable) -> IntOrFloat {
IntOrFloat::IntType
}
Content::Alias(Symbol::NUM_FLOATINGPOINT, args, _) => {
debug_assert!(args.is_empty());
debug_assert!(args.len() == 1);
// TODO: we probably need to match on the type of the arg
IntOrFloat::FloatType
}
Content::Structure(FlatType::Apply(Symbol::ATTR_ATTR, attr_args)) => {

View file

@ -1296,11 +1296,17 @@ fn unwrap_num_tag<'a>(subs: &Subs, var: Variable) -> Result<Layout<'a>, LayoutPr
}
},
Content::Alias(Symbol::NUM_INTEGER, args, _) => {
debug_assert!(args.is_empty());
debug_assert!(args.len() == 1);
// TODO: we probably need to match on the type of the arg
// and return the correct builtin ex: Builtin::{Int32, Int16}
Ok(Layout::Builtin(Builtin::Int64))
}
Content::Alias(Symbol::NUM_FLOATINGPOINT, args, _) => {
debug_assert!(args.is_empty());
debug_assert!(args.len() == 1);
// TODO: we probably need to match on the type of the arg
// and return the correct builtin ex: Builtin::Float32
Ok(Layout::Builtin(Builtin::Float64))
}
Content::FlexVar(_) | Content::RigidVar(_) => {

View file

@ -1326,7 +1326,7 @@ mod solve_expr {
infer_eq(
indoc!(
r#"
int : Num.Num Num.Integer
int : Num.Num (Num.Integer Num.Signed64)
int
"#
@ -1339,7 +1339,7 @@ mod solve_expr {
infer_eq(
indoc!(
r#"
int : Num.Num Num.Integer
int : Num.Num (Num.Integer Num.Signed64)
int = 5
int
@ -1353,7 +1353,7 @@ mod solve_expr {
infer_eq(
indoc!(
r#"
int : Num Integer
int : Num (Integer Signed64)
int
"#
@ -1366,7 +1366,7 @@ mod solve_expr {
infer_eq(
indoc!(
r#"
int : Num Integer
int : Num (Integer Signed64)
int = 5
int
@ -1931,7 +1931,7 @@ mod solve_expr {
infer_eq(
indoc!(
r#"
float : Num.Num Num.FloatingPoint
float : Num.Num (Num.FloatingPoint Num.Binary64)
float
"#
@ -1944,7 +1944,7 @@ mod solve_expr {
infer_eq(
indoc!(
r#"
float : Num.Num Num.FloatingPoint
float : Num.Num (Num.FloatingPoint Num.Binary64)
float = 5.5
float
@ -1958,7 +1958,7 @@ mod solve_expr {
infer_eq(
indoc!(
r#"
float : Num FloatingPoint
float : Num (FloatingPoint Binary64)
float
"#
@ -1971,7 +1971,7 @@ mod solve_expr {
infer_eq(
indoc!(
r#"
float : Num FloatingPoint
float : Num (FloatingPoint Binary64)
float = 5.5
float
@ -2216,7 +2216,7 @@ mod solve_expr {
infer_eq_without_problem(
indoc!(
r#"
x : Num.Num Num.Integer
x : Num.Num (Num.Integer Num.Signed64)
x =
when 2 is
3 -> 4
@ -2428,7 +2428,7 @@ mod solve_expr {
r#"
Foo a : { foo : a }
v : Foo (Num.Num Num.Integer)
v : Foo (Num.Num (Num.Integer Num.Signed64))
v = { foo: 42 }
v
@ -2492,7 +2492,7 @@ mod solve_expr {
r#"
Peano : [ S Peano, Z ]
length : Peano -> Num.Num Num.Integer
length : Peano -> Num.Num (Num.Integer Num.Signed64)
length = \peano ->
when peano is
Z -> 0
@ -2592,10 +2592,10 @@ mod solve_expr {
infer_eq(
indoc!(
r#"
r : { x : (Num.Num Num.Integer) }
r : { x : (Num.Num (Num.Integer Signed64)) }
r = { x : 1 }
s : { left : { x : Num.Num Num.FloatingPoint } }
s : { left : { x : Num.Num (Num.FloatingPoint Num.Binary64) } }
s = { left: { x : 3.14 } }
when 0 is
@ -2757,7 +2757,7 @@ mod solve_expr {
infer_eq_without_problem(
indoc!(
r#"
{ x, y } : { x : Str.Str, y : Num.Num Num.FloatingPoint }
{ x, y } : { x : Str.Str, y : Num.Num (Num.FloatingPoint Num.Binary64) }
{ x, y } = { x : "foo", y : 3.14 }
x
@ -2772,7 +2772,7 @@ mod solve_expr {
infer_eq(
indoc!(
r#"
Foo : { x : Str.Str, y : Num.Num Num.FloatingPoint }
Foo : { x : Str.Str, y : Num.Num (Num.FloatingPoint Num.Binary64) }
{ x, y } : Foo
{ x, y } = { x : "foo", y : 3.14 }
@ -2830,7 +2830,7 @@ mod solve_expr {
infer_eq_without_problem(
indoc!(
r#"
Foo : { x : Str.Str, y : Num.Num Num.FloatingPoint }
Foo : { x : Str.Str, y : Num.Num (Num.FloatingPoint Num.Binary64) }
{ x, y } : Foo
{ x, y } = { x : "foo", y : 3.14 }

View file

@ -38,143 +38,213 @@ pub fn aliases() -> MutMap<Symbol, BuiltinAlias> {
},
);
// Integer : [ @Integer ]
// Integer range : [ @Integer range ]
add_alias(
Symbol::NUM_INTEGER,
BuiltinAlias {
region: Region::zero(),
vars: Vec::new(),
typ: integer_alias_content(),
vars: vec![Located::at(Region::zero(), "range".into())],
typ: integer_alias_content(flex(TVAR1)),
},
);
// I128 Num Integer
// Signed128 : [ @Signed128 ]
add_alias(
Symbol::NUM_SIGNED128,
BuiltinAlias {
region: Region::zero(),
vars: vec![],
typ: signed128_alias_content(),
},
);
// I128 : Num (Integer Signed128)
add_alias(
Symbol::NUM_I128,
BuiltinAlias {
region: Region::zero(),
vars: Vec::new(),
typ: int_alias_content(),
typ: int_alias_content(signed128_type()),
},
);
// U128 : Num Integer
// U128 : Num (Integer Unsigned128)
add_alias(
Symbol::NUM_U128,
BuiltinAlias {
region: Region::zero(),
vars: Vec::new(),
typ: int_alias_content(),
typ: int_alias_content(unsigned128_type()),
},
);
// I64 Num Integer
// Signed64 : [ @Signed64 ]
add_alias(
Symbol::NUM_SIGNED64,
BuiltinAlias {
region: Region::zero(),
vars: vec![],
typ: signed64_alias_content(),
},
);
// I64 : Num (Integer Signed64)
add_alias(
Symbol::NUM_I64,
BuiltinAlias {
region: Region::zero(),
vars: Vec::new(),
typ: int_alias_content(),
typ: int_alias_content(signed64_type()),
},
);
// U64 : Num Integer
// U64 : Num (Integer Unsigned64)
add_alias(
Symbol::NUM_U64,
BuiltinAlias {
region: Region::zero(),
vars: Vec::new(),
typ: int_alias_content(),
typ: int_alias_content(unsigned64_type()),
},
);
// I32 Num Integer
// Signed32 : [ @Signed32 ]
add_alias(
Symbol::NUM_SIGNED32,
BuiltinAlias {
region: Region::zero(),
vars: vec![],
typ: signed32_alias_content(),
},
);
// I32 : Num (Integer Signed32)
add_alias(
Symbol::NUM_I32,
BuiltinAlias {
region: Region::zero(),
vars: Vec::new(),
typ: int_alias_content(),
typ: int_alias_content(signed32_type()),
},
);
// U32 : Num Integer
// U32 : Num (Integer Unsigned32)
add_alias(
Symbol::NUM_U32,
BuiltinAlias {
region: Region::zero(),
vars: Vec::new(),
typ: int_alias_content(),
typ: int_alias_content(unsigned32_type()),
},
);
// I16 Num Integer
// Signed16 : [ @Signed16 ]
add_alias(
Symbol::NUM_SIGNED16,
BuiltinAlias {
region: Region::zero(),
vars: vec![],
typ: signed16_alias_content(),
},
);
// I16 : Num (Integer Signed16)
add_alias(
Symbol::NUM_I16,
BuiltinAlias {
region: Region::zero(),
vars: Vec::new(),
typ: int_alias_content(),
typ: int_alias_content(signed16_type()),
},
);
// U16 : Num Integer
// U16 : Num (Integer Unsigned16)
add_alias(
Symbol::NUM_U16,
BuiltinAlias {
region: Region::zero(),
vars: Vec::new(),
typ: int_alias_content(),
typ: int_alias_content(unsigned16_type()),
},
);
// I8 Num Integer
// Signed8 : [ @Signed8 ]
add_alias(
Symbol::NUM_SIGNED8,
BuiltinAlias {
region: Region::zero(),
vars: vec![],
typ: signed8_alias_content(),
},
);
// I8 : Num (Integer Signed8)
add_alias(
Symbol::NUM_I8,
BuiltinAlias {
region: Region::zero(),
vars: Vec::new(),
typ: int_alias_content(),
typ: int_alias_content(signed8_type()),
},
);
// U8 : Num Integer
// U8 : Num (Integer Unsigned8)
add_alias(
Symbol::NUM_U8,
BuiltinAlias {
region: Region::zero(),
vars: Vec::new(),
typ: int_alias_content(),
typ: int_alias_content(unsigned8_type()),
},
);
// FloatingPoint : [ @FloatingPoint ]
// Binary64 : [ @Binary64 ]
add_alias(
Symbol::NUM_BINARY64,
BuiltinAlias {
region: Region::zero(),
vars: vec![],
typ: binary64_alias_content(),
},
);
// Binary32 : [ @Binary32 ]
add_alias(
Symbol::NUM_BINARY32,
BuiltinAlias {
region: Region::zero(),
vars: vec![],
typ: binary32_alias_content(),
},
);
// FloatingPoint range : [ @FloatingPoint range ]
add_alias(
Symbol::NUM_FLOATINGPOINT,
BuiltinAlias {
region: Region::zero(),
vars: Vec::new(),
typ: floatingpoint_alias_content(),
vars: vec![Located::at(Region::zero(), "range".into())],
typ: floatingpoint_alias_content(flex(TVAR1)),
},
);
// F64 : Num FloatingPoint
// F64 : Num (FloatingPoint Binary64)
add_alias(
Symbol::NUM_F64,
BuiltinAlias {
region: Region::zero(),
vars: Vec::new(),
typ: float_alias_content(),
typ: float_alias_content(binary64_type()),
},
);
// F32 : Num FloatingPoint
// F32 : Num (FloatingPoint Binary32)
add_alias(
Symbol::NUM_F32,
BuiltinAlias {
region: Region::zero(),
vars: Vec::new(),
typ: float_alias_content(),
typ: float_alias_content(binary32_type()),
},
);
@ -226,57 +296,233 @@ fn num_alias_content(range: SolvedType) -> SolvedType {
// FLOATING POINT
#[inline(always)]
pub fn floatingpoint_type() -> SolvedType {
pub fn floatingpoint_type(range: SolvedType) -> SolvedType {
SolvedType::Alias(
Symbol::NUM_FLOATINGPOINT,
Vec::new(),
Box::new(floatingpoint_alias_content()),
vec![("range".into(), range.clone())],
Box::new(floatingpoint_alias_content(range)),
)
}
#[inline(always)]
fn floatingpoint_alias_content() -> SolvedType {
single_private_tag(Symbol::NUM_AT_FLOATINGPOINT, Vec::new())
fn floatingpoint_alias_content(range: SolvedType) -> SolvedType {
single_private_tag(Symbol::NUM_AT_FLOATINGPOINT, vec![range])
}
// FLOAT
#[inline(always)]
pub fn float_type() -> SolvedType {
SolvedType::Alias(Symbol::NUM_F64, Vec::new(), Box::new(float_alias_content()))
SolvedType::Alias(
Symbol::NUM_F64,
Vec::new(),
Box::new(float_alias_content(binary64_type())),
)
}
#[inline(always)]
fn float_alias_content() -> SolvedType {
num_type(floatingpoint_type())
fn float_alias_content(typ: SolvedType) -> SolvedType {
num_type(floatingpoint_type(typ))
}
// INT
#[inline(always)]
pub fn int_type() -> SolvedType {
SolvedType::Alias(Symbol::NUM_I64, Vec::new(), Box::new(int_alias_content()))
SolvedType::Alias(
Symbol::NUM_I64,
Vec::new(),
Box::new(int_alias_content(signed64_type())),
)
}
#[inline(always)]
fn int_alias_content() -> SolvedType {
num_type(integer_type())
fn int_alias_content(range: SolvedType) -> SolvedType {
num_type(integer_type(range))
}
// INTEGER
#[inline(always)]
pub fn integer_type() -> SolvedType {
pub fn integer_type(range: SolvedType) -> SolvedType {
SolvedType::Alias(
Symbol::NUM_INTEGER,
Vec::new(),
Box::new(integer_alias_content()),
vec![("range".into(), range.clone())],
Box::new(integer_alias_content(range)),
)
}
#[inline(always)]
fn integer_alias_content() -> SolvedType {
single_private_tag(Symbol::NUM_AT_INTEGER, Vec::new())
fn integer_alias_content(range: SolvedType) -> SolvedType {
single_private_tag(Symbol::NUM_AT_INTEGER, vec![range])
}
#[inline(always)]
pub fn binary64_type() -> SolvedType {
SolvedType::Alias(
Symbol::NUM_BINARY64,
vec![],
Box::new(binary64_alias_content()),
)
}
#[inline(always)]
fn binary64_alias_content() -> SolvedType {
single_private_tag(Symbol::NUM_AT_BINARY64, vec![])
}
#[inline(always)]
pub fn binary32_type() -> SolvedType {
SolvedType::Alias(
Symbol::NUM_BINARY32,
vec![],
Box::new(binary32_alias_content()),
)
}
#[inline(always)]
fn binary32_alias_content() -> SolvedType {
single_private_tag(Symbol::NUM_AT_BINARY32, vec![])
}
#[inline(always)]
pub fn signed128_type() -> SolvedType {
SolvedType::Alias(
Symbol::NUM_SIGNED128,
vec![],
Box::new(signed128_alias_content()),
)
}
#[inline(always)]
fn signed128_alias_content() -> SolvedType {
single_private_tag(Symbol::NUM_AT_SIGNED128, vec![])
}
#[inline(always)]
pub fn signed64_type() -> SolvedType {
SolvedType::Alias(
Symbol::NUM_SIGNED64,
vec![],
Box::new(signed64_alias_content()),
)
}
#[inline(always)]
fn signed64_alias_content() -> SolvedType {
single_private_tag(Symbol::NUM_AT_SIGNED64, vec![])
}
#[inline(always)]
pub fn signed32_type() -> SolvedType {
SolvedType::Alias(
Symbol::NUM_SIGNED32,
vec![],
Box::new(signed32_alias_content()),
)
}
#[inline(always)]
fn signed32_alias_content() -> SolvedType {
single_private_tag(Symbol::NUM_AT_SIGNED32, vec![])
}
#[inline(always)]
pub fn signed16_type() -> SolvedType {
SolvedType::Alias(
Symbol::NUM_SIGNED16,
vec![],
Box::new(signed16_alias_content()),
)
}
#[inline(always)]
fn signed16_alias_content() -> SolvedType {
single_private_tag(Symbol::NUM_AT_SIGNED16, vec![])
}
#[inline(always)]
pub fn signed8_type() -> SolvedType {
SolvedType::Alias(
Symbol::NUM_SIGNED8,
vec![],
Box::new(signed8_alias_content()),
)
}
#[inline(always)]
fn signed8_alias_content() -> SolvedType {
single_private_tag(Symbol::NUM_AT_SIGNED8, vec![])
}
#[inline(always)]
pub fn unsigned128_type() -> SolvedType {
SolvedType::Alias(
Symbol::NUM_UNSIGNED128,
vec![],
Box::new(unsigned128_alias_content()),
)
}
#[inline(always)]
fn unsigned128_alias_content() -> SolvedType {
single_private_tag(Symbol::NUM_AT_UNSIGNED128, vec![])
}
#[inline(always)]
pub fn unsigned64_type() -> SolvedType {
SolvedType::Alias(
Symbol::NUM_UNSIGNED64,
vec![],
Box::new(unsigned64_alias_content()),
)
}
#[inline(always)]
fn unsigned64_alias_content() -> SolvedType {
single_private_tag(Symbol::NUM_AT_UNSIGNED64, vec![])
}
#[inline(always)]
pub fn unsigned32_type() -> SolvedType {
SolvedType::Alias(
Symbol::NUM_UNSIGNED32,
vec![],
Box::new(unsigned32_alias_content()),
)
}
#[inline(always)]
fn unsigned32_alias_content() -> SolvedType {
single_private_tag(Symbol::NUM_AT_UNSIGNED32, vec![])
}
#[inline(always)]
pub fn unsigned16_type() -> SolvedType {
SolvedType::Alias(
Symbol::NUM_UNSIGNED16,
vec![],
Box::new(unsigned16_alias_content()),
)
}
#[inline(always)]
fn unsigned16_alias_content() -> SolvedType {
single_private_tag(Symbol::NUM_AT_UNSIGNED16, vec![])
}
#[inline(always)]
pub fn unsigned8_type() -> SolvedType {
SolvedType::Alias(
Symbol::NUM_UNSIGNED8,
vec![],
Box::new(unsigned8_alias_content()),
)
}
#[inline(always)]
fn unsigned8_alias_content() -> SolvedType {
single_private_tag(Symbol::NUM_AT_UNSIGNED8, vec![])
}
#[inline(always)]

View file

@ -198,7 +198,7 @@ fn unify_alias(
problems
} else {
mismatch!()
mismatch!("{}", symbol)
}
} else {
unify_pool(subs, pool, real_var, *other_real_var)