Skip to content

Add error message for wrong number of argument patterns #3508

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

Conversation

gosubpl
Copy link
Contributor

@gosubpl gosubpl commented Nov 20, 2017

Refs #1589

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

assertMessageCount(1, messages)
val UnapplyInvalidNumberOfArguments(qual, argTypes) :: Nil = messages
assertEquals("Boo", qual.show)
assertEquals("(class Int, class String)", s"(${argTypes.map(_.typeSymbol).mkString(", ")})")
Copy link
Contributor

Choose a reason for hiding this comment

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

Use argTypes.map(_.typeSymbol).mkString("(", ", ", ")") instead of s"(${argTypes.map(_.typeSymbol).mkString(", ")})".

|Expected usage would be something like:
|case $qual(${argTypes.map(_ => '_')}%, %) => ...
|
|where subsequent arguments would have following types: ($argTypes%, %).""".stripMargin
Copy link
Contributor

Choose a reason for hiding this comment

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

""".stripMargin should be on the next line.

Copy link
Contributor

Choose a reason for hiding this comment

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

The issue with stripMargin being on the next line is that it adds an extra line to the explanation which is not desired.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@nicolasstucki @allanrenucci can you please decide which option is recommended? I will gladly oblige.
Also - whoever does the merge can fix it as I have checked 'Allow edits from maintainers'.

Copy link
Contributor

Choose a reason for hiding this comment

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

Use Allan's.

@gosubpl gosubpl force-pushed the wip/1589-unapply-invalid-number-args-2 branch from ce1313e to e5e9270 Compare November 20, 2017 15:45
@gosubpl
Copy link
Contributor Author

gosubpl commented Nov 20, 2017

@nicolasstucki thanks for such a quick review! I have reflected your comments.

@nicolasstucki nicolasstucki merged commit 42f8369 into scala:master Nov 21, 2017
@gosubpl
Copy link
Contributor Author

gosubpl commented Nov 21, 2017

Many thanks!

@gosubpl gosubpl deleted the wip/1589-unapply-invalid-number-args-2 branch November 21, 2017 15:22
@maseev maseev mentioned this pull request Nov 22, 2017
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.

4 participants