mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 00:24:34 +00:00
Rename NonNullableUnwrapped to RecursiveSingleTag
This commit is contained in:
parent
23b8ff896a
commit
4e73899356
2 changed files with 17 additions and 11 deletions
|
@ -245,7 +245,7 @@ fn add_type(target_info: TargetInfo, id: TypeId, types: &Types, impls: &mut Impl
|
|||
types,
|
||||
impls,
|
||||
),
|
||||
RocTagUnion::NonNullableUnwrapped { .. } => {
|
||||
RocTagUnion::RecursiveSingleTag { .. } => {
|
||||
todo!();
|
||||
}
|
||||
RocTagUnion::NonRecursiveSingleTag {
|
||||
|
@ -1416,7 +1416,7 @@ fn type_name(id: TypeId, types: &Types) -> String {
|
|||
| RocType::TagUnion(RocTagUnion::Enumeration { name, .. })
|
||||
| RocType::TagUnion(RocTagUnion::NullableWrapped { name, .. })
|
||||
| RocType::TagUnion(RocTagUnion::NullableUnwrapped { name, .. })
|
||||
| RocType::TagUnion(RocTagUnion::NonNullableUnwrapped { name, .. }) => name.clone(),
|
||||
| RocType::TagUnion(RocTagUnion::RecursiveSingleTag { name, .. }) => name.clone(),
|
||||
RocType::RecursivePointer(content) => type_name(*content, types),
|
||||
RocType::Function { name, .. } => name.clone(),
|
||||
}
|
||||
|
@ -2041,7 +2041,7 @@ fn cannot_derive_copy(roc_type: &RocType, types: &Types) -> bool {
|
|||
| RocType::RocDict(_, _)
|
||||
| RocType::RocSet(_)
|
||||
| RocType::RocBox(_)
|
||||
| RocType::TagUnion(RocTagUnion::NonNullableUnwrapped { .. })
|
||||
| RocType::TagUnion(RocTagUnion::RecursiveSingleTag { .. })
|
||||
| RocType::TagUnion(RocTagUnion::NullableUnwrapped { .. })
|
||||
| RocType::TagUnion(RocTagUnion::NullableWrapped { .. })
|
||||
| RocType::TagUnion(RocTagUnion::Recursive { .. })
|
||||
|
@ -2124,7 +2124,9 @@ fn has_float_help(roc_type: &RocType, types: &Types, do_not_recurse: &[TypeId])
|
|||
non_null_payload: content,
|
||||
..
|
||||
})
|
||||
| RocType::TagUnion(RocTagUnion::NonNullableUnwrapped { content, .. })
|
||||
| RocType::TagUnion(RocTagUnion::RecursiveSingleTag {
|
||||
payload: content, ..
|
||||
})
|
||||
| RocType::RecursivePointer(content) => {
|
||||
if do_not_recurse.contains(content) {
|
||||
false
|
||||
|
|
|
@ -146,11 +146,11 @@ impl Types {
|
|||
}
|
||||
}
|
||||
(
|
||||
NonNullableUnwrapped {
|
||||
content: content_a, ..
|
||||
RecursiveSingleTag {
|
||||
payload: content_a, ..
|
||||
},
|
||||
NonNullableUnwrapped {
|
||||
content: content_b, ..
|
||||
RecursiveSingleTag {
|
||||
payload: content_b, ..
|
||||
},
|
||||
) => content_a == content_b,
|
||||
(
|
||||
|
@ -206,8 +206,8 @@ impl Types {
|
|||
| (_, NonRecursive { .. })
|
||||
| (Recursive { .. }, _)
|
||||
| (_, Recursive { .. })
|
||||
| (NonNullableUnwrapped { .. }, _)
|
||||
| (_, NonNullableUnwrapped { .. })
|
||||
| (RecursiveSingleTag { .. }, _)
|
||||
| (_, RecursiveSingleTag { .. })
|
||||
| (NullableUnwrapped { .. }, _)
|
||||
| (_, NullableUnwrapped { .. }) => false,
|
||||
}
|
||||
|
@ -540,7 +540,11 @@ pub enum RocTagUnion {
|
|||
/// A recursive tag union with just one constructor
|
||||
/// Optimization: No need to store a tag ID (the payload is "unwrapped")
|
||||
/// e.g. `RoseTree a : [Tree a (List (RoseTree a))]`
|
||||
NonNullableUnwrapped { name: String, content: TypeId },
|
||||
RecursiveSingleTag {
|
||||
name: String,
|
||||
tag_name: String,
|
||||
payload: TypeId,
|
||||
},
|
||||
|
||||
/// A recursive tag union that has an empty variant
|
||||
/// Optimization: Represent the empty variant as null pointer => no memory usage & fast comparison
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue