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

parser::ty::named_type() can silently do nothing #829

Open
SimonSapin opened this issue Feb 9, 2024 · 0 comments
Open

parser::ty::named_type() can silently do nothing #829

SimonSapin opened this issue Feb 9, 2024 · 0 comments
Labels
apollo-parser bug Something isn't working triage

Comments

@SimonSapin
Copy link
Contributor

SimonSapin commented Feb 9, 2024

As found during #828. Current implementation:

pub(crate) fn named_type(p: &mut Parser) {
    if let Some(TokenKind::Name) = p.peek() {
        let _g = p.start_node(SyntaxKind::NAMED_TYPE);
        name::name(p);
    }
}

The caller has no way to tell if the if branch was taken without duplicating it outside of the function. Let’s check how this function is actually used and whether it’d be better to have it emit an error.

We should also check if there are other cases of this in the parser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
apollo-parser bug Something isn't working triage
Projects
None yet
Development

No branches or pull requests

1 participant