Skip to content

Implement Homogeneous Tuple Type #237

@cake-monotone

Description

@cake-monotone

As Type::Tuple is becoming more actively used in implementations, I think we should implement Homogeneous Tuples before the refactoring cost becomes too high.

I’m considering an implementation like the following using an enum:

Implementation blueprint (Outdated)
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
pub enum TupleType<'db> {
    Heterogeneous(HeterogeneousTupleType<'db>),
    Homogeneous(HomogeneousTupleType<'db>),
}

#[salsa::interned]
pub struct HeterogeneousTupleType<'db> {
    elements: Box<[Type<'db>]>,
}

#[salsa::interned]
pub struct HomogeneousTupleType<'db> {
    element: Type<'db>,
}

Expected Issues

Currently, it seems that there is no way to assign a homogeneous tuple type in the tests.

Do you have any suggestions for a proper way to handle this? Or should we wait for another feature to be merged first?

Metadata

Metadata

Assignees

No one assigned

    Labels

    genericsBugs or features relating to ty's generics implementation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions