Skip to content

Add an error message class for a case where a trait is expected #3465

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 3 commits into from
Nov 14, 2017
Merged

Add an error message class for a case where a trait is expected #3465

merged 3 commits into from
Nov 14, 2017

Conversation

maseev
Copy link
Contributor

@maseev maseev commented Nov 13, 2017

This PR is related to #1589. Specifically, it adds a new error message class for the following case - Checking.scala:551

"""class A
|class B
|
|val a = new A with B // will fail with a compile error - B is not a trait"""
Copy link
Contributor

Choose a reason for hiding this comment

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

You should stripMargin here

"""class A
|trait B
|
|val a = new A with B // compiles normally"""
Copy link
Contributor

Choose a reason for hiding this comment

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

You should stripMargin here

@@ -1888,4 +1888,32 @@ object messages {
}
val explanation = "A statement is either an import, a definition or an expression."
}

case class TraitIsExpected(tref: TypeRef)(implicit ctx: Context) extends Message(TraitIsExpectedID) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I would rather pass the symbol instead of the TypeRef

@maseev
Copy link
Contributor Author

maseev commented Nov 13, 2017

@allanrenucci all done. PTAL.

@maseev
Copy link
Contributor Author

maseev commented Nov 14, 2017

It seems that the CLA check is still pending. Is there anything I can do to make it pass? 😟

@nicolasstucki
Copy link
Contributor

Sometimes the CLA stalls

@nicolasstucki nicolasstucki merged commit f728134 into scala:master Nov 14, 2017
@maseev maseev deleted the iss1589-trait-is-expected branch November 14, 2017 09:13
@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.

3 participants