Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

定数パターンやガード付きパターンを記述できるようにする #673

Open
github-actions bot opened this issue Jan 11, 2025 · 0 comments
Assignees

Comments

@github-actions
Copy link

// TODO: 定数パターンやガード付きパターンを記述できるようにする

    pub statement: Vec<Statement>,
}

/// 分岐を含まない任意のパターン
#[derive(Eq, PartialEq, Clone, Debug)]
pub enum SinglePattern {
    Discard,
    Bind(Identifier),
    Tuple(Vec<Self>),
    // TODO: 定数パターンやガード付きパターンを記述できるようにする
}

impl SinglePattern {
    // 将来実装するので今は黙らせる
    #[expect(clippy::must_use_candidate, clippy::missing_const_for_fn)]
    pub fn is_irrefutable_with_scrutinee_type_information(&self) -> bool {
        true
    }
}

impl Display for SinglePattern {
    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
        match self {
            Self::Discard => f.write_str("_"),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant