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

Method type syntax in errors & warnings doesn't have colon for the return type #11416

Open
psilospore opened this Issue Feb 25, 2019 · 3 comments

Comments

Projects
None yet
4 participants
@psilospore
Copy link

psilospore commented Feb 25, 2019

This error seems like it should be:

 error: ambiguous reference to overloaded definition,
18-both method apply in object Foo2 of type (z: String)Base[T]
19-and  method apply in object Foo2 of type (a: Int)Base[T]

had colons before the return type like this?

 error: ambiguous reference to overloaded definition,
18-both method apply in object Foo2 of type (z: String): Base[T]
19-and  method apply in object Foo2 of type (a: Int): Base[T]

Not sure if this is standard so it might not be a bug. But if it is valid I don't mind picking this up.

@psilospore psilospore changed the title Error for "ambiguous reference to overloaded definition" doesn't have colon for return type Error for "ambiguous reference to overloaded definition" doesn't have colon for the return type Feb 25, 2019

@hrhino

This comment has been minimized.

Copy link
Member

hrhino commented Feb 25, 2019

That's the long-running way that scalac prints MethodTypes, and matches the way that I usually mistype methods signatures the first time around. It's probably inspired by Java's descriptors (of the form (I)LBase; in the above example).

I think it makes sense to print these sorts of things in as close to real Scala code as can be done, though.

@hrhino hrhino added this to the Backlog milestone Feb 25, 2019

@SethTisue SethTisue changed the title Error for "ambiguous reference to overloaded definition" doesn't have colon for the return type Method type syntax in errors & warnings doesn't have colon for the return type Feb 25, 2019

@som-snytt

This comment has been minimized.

Copy link

som-snytt commented Feb 27, 2019

This is how the types are represented in the spec.

There was another PR or ticket to have REPL print everything in Scala syntax. It would be handy if there were a compiler flag to pick a pretty printing option.

@SethTisue

This comment has been minimized.

Copy link
Member

SethTisue commented Feb 27, 2019

There was another PR or ticket to have REPL print everything in Scala syntax

you're probably thinking of #10024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.