mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-01 07:41:12 +00:00
store Str.Str type in a compact way
This commit is contained in:
parent
7589ab0c95
commit
9ac194a3b3
1 changed files with 9 additions and 1 deletions
|
@ -41,7 +41,11 @@ impl Constraints {
|
|||
let includes_tags = Vec::new();
|
||||
let strings = Vec::new();
|
||||
|
||||
types.extend([Type::EmptyRec, Type::EmptyTagUnion]);
|
||||
types.extend([
|
||||
Type::EmptyRec,
|
||||
Type::EmptyTagUnion,
|
||||
Type::Apply(Symbol::STR_STR, vec![], Region::zero()),
|
||||
]);
|
||||
|
||||
categories.extend([
|
||||
Category::Record,
|
||||
|
@ -91,6 +95,7 @@ impl Constraints {
|
|||
|
||||
pub const EMPTY_RECORD: Index<Type> = Index::new(0);
|
||||
pub const EMPTY_TAG_UNION: Index<Type> = Index::new(1);
|
||||
pub const STR: Index<Type> = Index::new(2);
|
||||
|
||||
pub const CATEGORY_RECORD: Index<Category> = Index::new(0);
|
||||
pub const CATEGORY_FOREIGNCALL: Index<Category> = Index::new(1);
|
||||
|
@ -124,6 +129,9 @@ impl Constraints {
|
|||
match typ {
|
||||
Type::EmptyRec => EitherIndex::from_left(Self::EMPTY_RECORD),
|
||||
Type::EmptyTagUnion => EitherIndex::from_left(Self::EMPTY_TAG_UNION),
|
||||
Type::Apply(Symbol::STR_STR, args, _) if args.is_empty() => {
|
||||
EitherIndex::from_left(Self::STR)
|
||||
}
|
||||
Type::Variable(var) => Self::push_type_variable(var),
|
||||
other => {
|
||||
let index: Index<Type> = Index::push_new(&mut self.types, other);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue