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

Fixes #5640 Typer crash on 0 arity tuple #5660

Merged
merged 2 commits into from
Jan 4, 2019
Merged

Conversation

eklavya
Copy link
Contributor

@eklavya eklavya commented Dec 25, 2018

No description provided.

Copy link
Member

@dottybot dottybot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, and thank you for opening this PR! 🎉

All contributors have signed the CLA, thank you! ❤️

Have an awesome day! ☀️

@@ -920,8 +920,8 @@ object desugar {
assert(arity <= Definitions.MaxTupleArity)
def tupleTypeRef = defn.TupleType(arity)
if (arity == 1) ts.head
else if (ctx.mode is Mode.Type) AppliedTypeTree(ref(tupleTypeRef), ts)
else if (arity == 0) unitLiteral
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would compute a unitLiteral as a type, which is wrong. I believe the right test is:

else if (arity == 0)
  if (ctx.mode is Mode.Type) TypeTree(defn.UnitType) else unitLiteral
else ...

@odersky
Copy link
Contributor

odersky commented Jan 4, 2019

All LGTM now. Thanks for the fix!

@odersky odersky merged commit 8743454 into scala:master Jan 4, 2019
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.

3 participants