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

feat: Add unit literals and unit types to parser #1960

Merged
merged 2 commits into from
Jul 18, 2023

Conversation

jfecher
Copy link
Contributor

@jfecher jfecher commented Jul 18, 2023

Description

Problem*

Resolves #1933 and #1937, succeeds #1956

Summary*

Previously all parenthesized types were parsed as tuple types. I've fixed this to have:

  • parenthesized singular types (with no trailing comma) parsed as the parenthesized type. So (Field) = Field.
  • tuple types with 0 elements are always parsed as Type::Unit.

Documentation

  • This PR requires documentation updates when merged.

    • I will submit a noir-lang/docs PR.
    • I will request for and support Dev Rel's help in documenting this PR.

Additional Context

PR Checklist*

  • I have tested the changes locally.
  • I have formatted the changes with Prettier and/or cargo fmt on default settings.

@jfecher jfecher changed the title Parse unit types fix: Parse unit types Jul 18, 2023
@jfecher jfecher mentioned this pull request Jul 18, 2023
2 tasks
@ghost
Copy link

ghost commented Jul 18, 2023

don't forget about this case:

fn test() {
    ()
}

@jfecher
Copy link
Contributor Author

jfecher commented Jul 18, 2023

Right, this is also somewhat of a feature addition since we didn't have unit literals at all anymore. I think I'll rename the PR to reflect this.

@jfecher jfecher changed the title fix: Parse unit types feat: Add unit literals and unit types to parser Jul 18, 2023
@kevaundray kevaundray added this pull request to the merge queue Jul 18, 2023
Merged via the queue into master with commit ea80de5 Jul 18, 2023
@kevaundray kevaundray deleted the jf/parse-unit-types branch July 18, 2023 20:41
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

Successfully merging this pull request may close these issues.

expression without assignment is incorrectly typechecked
2 participants