Skip to content

Attempt at fixing Applications.scala:95 #1589 #3780

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

Closed
wants to merge 1 commit into from

Conversation

aesteve
Copy link
Contributor

@aesteve aesteve commented Jan 9, 2018

First try at implementing an error message, please tell me if I'm doing a mistake in some way.

Especially :

  • is val kind = "Reference" the right kind of error
  • I don't really know how to test the explain part
  • is the explain message relevant, correct, and not too big
  • should I also be testing unapplySeq ?

Thanks a lot for the review.

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! ☀️

@aesteve
Copy link
Contributor Author

aesteve commented Jan 9, 2018

I signed the CLA. Should I open a new PR ?

@liufengyun
Copy link
Contributor

@aesteve You can update the PR (e.g. by force push), and it will re-trigger the CI.

@aesteve aesteve force-pushed the invalid-unapply-return-type branch from 9692824 to b072494 Compare January 9, 2018 12:12
@aesteve aesteve mentioned this pull request Jan 9, 2018
|The return type of an extractor should be chosen as follows:
| - If it is just a test, return a ${"Boolean"}. For instance ${"case even()"}
| - If it returns a single sub-value of type ${s"$resultClassName"}, return an ${s"Option[$resultClassName]"}
| - If you want to return several sub-values ${"T1,...,Tn"}, group them in an optional tuple ${"Option[(T1,...,Tn)]"}.
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not telling the full story, we also need to mention option-less pattern matching
and talk about unapplySeq.

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe unapplySeq has been deprecated in #3747

@OlivierBlanvillain
Copy link
Contributor

By the way, this is a duplicate of #3501.

@odersky
Copy link
Contributor

odersky commented Jan 12, 2019

I believe a lot more work needs to be done on good unapply error messages. That work has to be in the Typer checker, which has to become better at finding root causes of unapply errors. Adding a fixed error message for the failure would make things more complicated at the present time

@odersky odersky closed this Jan 12, 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.

6 participants