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

Better error message when pattern matching against the companion object instead of the type #4879

Closed
scabug opened this issue Aug 6, 2011 · 2 comments

Comments

@scabug
Copy link

@scabug scabug commented Aug 6, 2011

scala> case class C(a: Any)
defined class C

scala> (new C(())) match {
     |    case C =>
     | }
<console>:9: error: pattern type is incompatible with expected type;
 found   : object C
 required: C
          case C =>
               ^

Suggested type diagnostics:

"Note: you referred to the companion object of the class C. Perhaps you meant '_ : C' or 'C(_)'"

/////////////////////////////////////////

Created from Jason Zaugg comment on https://issues.scala-lang.org/browse/SI-3092?focusedCommentId=48914&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-48914

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Aug 6, 2011

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Aug 7, 2011

Commit Message Bot (anonymous) said:
(extempore in r25458) Better error message for case class/object match confusion.
Closes #4879, no review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.