Skip to content

Improve migration message for Scala 2 procedures #1021

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

Merged
merged 1 commit into from
Jan 17, 2016

Conversation

smarter
Copy link
Member

@smarter smarter commented Jan 12, 2016

It's not correct to just add = you also need to specify the return
type to be Unit otherwise things may not work as expected, this is
especially important for a main method.

Review by @odersky

It's not correct to just add `=` you also need to specify the return
type to be `Unit` otherwise things may not work as expected, this is
especially important for a `main` method.
@smarter smarter force-pushed the fix/procedure-migration branch from b7411a3 to 3b5c70b Compare January 14, 2016 16:09
@odersky
Copy link
Contributor

odersky commented Jan 17, 2016

Not sure about this. : Unit = is needlessly heavy, in particular for local procedures. So advising it unconditionally is a bit of an overkill.

@sjrd
Copy link
Member

sjrd commented Jan 17, 2016

I don't think there are many Unit-returning local procedures in typical codebases. Except possibly tail-recursive Unit-returning procedures, but those need the : Unit.

It's fine if users want to remove the : Unit part themselves when they think it's too heavy. But the compiler recommendation should at least always recommend something correct. And adding only = will sometimes (and more often than not IMO) be wrong.

@odersky
Copy link
Contributor

odersky commented Jan 17, 2016

OK, you have convinced me. LGTM.

odersky added a commit that referenced this pull request Jan 17, 2016
Improve migration message for Scala 2 procedures
@odersky odersky merged commit 0e32220 into scala:master Jan 17, 2016
@allanrenucci allanrenucci deleted the fix/procedure-migration branch December 14, 2017 19:22
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