Skip to content

Fix #1169: Fix strange type formatting in error message #3927

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 1 commit into from
Jan 27, 2018

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Jan 26, 2018

We already generate an error message for i1169.scala, but it looked weird:

|bridge generated for member method produce=> X in class XProducer
|which overrides method produce=> T in trait Producer
|clashes with definition of the member itself; both have erased type (): Object.

The fix changes how ExprTypes in method signatures are handled. We now get:

|bridge generated for member method produce: X in class XProducer
|which overrides method produce: T in trait Producer
|clashes with definition of the member itself; both have erased type (): Object."

@@ -56,7 +56,13 @@ class Bridges(root: ClassSymbol)(implicit ctx: Context) {
bridgesScope.lookupAll(member.name).exists(bridge =>
bridgeTarget(bridge) == member && bridge.signature == other.signature)
def info(sym: Symbol)(implicit ctx: Context) = sym.info
def desc(sym: Symbol)= i"$sym${info(sym)(preErasureCtx)} in ${sym.owner}"
def desc(sym: Symbol)= {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe:

val infoStr = sym.showDcl(preErasureCtx)
i"$infoStr in ${sym.owner}"

This will print def produce: => X. But I think we could configure the printer to not print the =>. Other part of the compiler (such as error messages) could benefit from it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The problem is that printing the type will always print the =>. Otherwise it would be confusing. I would should work on the Printer but it has to look at the larger context to do the right thing.

@liufengyun
Copy link
Contributor

Need to rebase because of #3892

We already generate an error message for i1169.scala, but it looked weird:

    |bridge generated for member method produce=> X in class XProducer
    |which overrides method produce=> T in trait Producer
    |clashes with definition of the member itself; both have erased type (): Object.

The fix changes how ExprTypes in method signatures are handled. We now get:

    |bridge generated for member method produce: X in class XProducer
    |which overrides method produce: T in trait Producer
    |clashes with definition of the member itself; both have erased type (): Object."
@odersky odersky merged commit fc06068 into scala:master Jan 27, 2018
@allanrenucci allanrenucci deleted the fix-#1169-1 branch January 27, 2018 12:55
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