Skip to content

Named type error messages to new format #3419

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 8 commits into from
Nov 2, 2017

Conversation

DSouzaM
Copy link
Contributor

@DSouzaM DSouzaM commented Nov 1, 2017

Part of #1589.

Changes error messages for named type parameters to use new format (with tests).

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

Copy link
Contributor

@allanrenucci allanrenucci left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution! Just a couple of remarks

case class UndefinedNamedTypeArgument(undefinedName: Name, definedNames: List[Name])(implicit ctx: Context)
extends Message(UndefinedNamedTypeArgumentID) {
val kind = "Syntax"
val msg = hl"Type parameter $undefinedName is undefined. Expected one of ${definedNames.mkString(", ")}."
Copy link
Contributor

Choose a reason for hiding this comment

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

definedNames.map(_.show).mkString(", ")

assertEquals("C", n1.show)
assertEquals("A"::"B"::Nil, l1.map(_.show))
assertEquals("C", n2.show)
assertEquals("A"::"B"::Nil, l2.map(_.show))
Copy link
Contributor

Choose a reason for hiding this comment

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

val tpParams = List("A", "B")
assertEquals(tpParams, l1.map(_.show))
assertEquals(tpParams, l2.map(_.show))

@@ -1865,4 +1865,18 @@ object messages {
|Excluded from this rule are methods that are defined in Java or that override methods defined in Java."""
}
}

case class DuplicateNamedTypeArgument(name: Name)(implicit ctx: Context)
Copy link
Contributor

Choose a reason for hiding this comment

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

Rename to DuplicateNamedTypeParameter

val explanation = ""
}

case class UndefinedNamedTypeArgument(undefinedName: Name, definedNames: List[Name])(implicit ctx: Context)
Copy link
Contributor

Choose a reason for hiding this comment

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

Rename to UndefinedNamedTypeParameter

MissingEmptyArgumentListID
MissingEmptyArgumentListID,
DuplicateNamedTypeArgumentID,
UndefinedNamedTypeArgumentID
Copy link
Contributor

Choose a reason for hiding this comment

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

Rename DuplicateNamedTypeParameterID and UndefinedNamedTypeParameterID

Copy link
Contributor

@allanrenucci allanrenucci left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

@allanrenucci allanrenucci merged commit cbb481c into scala:master Nov 2, 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