Skip to content

Add error message for polymorphic methods in structured refinements #3744

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 2 commits into from
Jan 5, 2018

Conversation

Wojtechnology
Copy link
Contributor

Addresses Typer.scala:1109 in #1589. Polymorphic methods are not allowed in structural refinements as explained here: https://github.com/lampepfl/dotty/blob/88d016c6f0d991698a42bfca2d593f8ec1ae608d/docs/docs/reference/changed/structural-types.md#notes

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.

Otherwise LGTM. Thanks @Wojtechnology

@@ -2064,4 +2064,14 @@ object messages {
val explanation =
hl"An object that contains ${"@static"} members must have a companion class."
}

case class PolymorphicMethodMissingTypeInParent(rsym: Symbol, parentTpt: tpd.Tree)(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.

I would pass parentTpt as a Symbol.

val msg = hl"polymorphic refinement $rsym without matching type in parent $parentTpt is no longer allowed"
val explanation =
hl"""Polymorphic $rsym is not allowed in the structural refinement of $parentTpt because
|$rsym does not override any symbol in $parentTpt. Structural refinement does not allow for
Copy link
Contributor

Choose a reason for hiding this comment

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

any method in ...

@allanrenucci allanrenucci merged commit 84822d8 into scala:master Jan 5, 2018
@Wojtechnology Wojtechnology deleted the ws-error-poly-refinement branch January 5, 2018 22:48
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