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

Misleading compiler error on wrong import #5389

Closed
scabug opened this issue Jan 19, 2012 · 6 comments · Fixed by scala/scala#8541
Closed

Misleading compiler error on wrong import #5389

scabug opened this issue Jan 19, 2012 · 6 comments · Fixed by scala/scala#8541

Comments

@scabug
Copy link

scabug commented Jan 19, 2012

Assuming there is no ne package, the following top-level import:

import ne.foobar

makes the compiler complain that:

error: missing arguments for method ne in class Object;
follow this method with `_' if you want to treat it as a partially applied function
       import ne.foo
              ^

I believe this is misleading for the Plain Old User.

@scabug
Copy link
Author

scabug commented Jan 19, 2012

Imported From: https://issues.scala-lang.org/browse/SI-5389?orig=1
Reporter: Christos KK Loverdos (loverdos)
Affected Versions: 2.9.1

@som-snytt
Copy link

I would have used ne.scala in the example, but I guess it's styled NEScala, oh well. I don't even know if it's the compass point or "New England".

I thought I understood import, but apparently not. I bet this puzzler will take us well into 2020.

There is no way of knowing if this is an improvement in terms of user experience, but I see there is no f-d in dotty label.

$ dotc t5389.scala
-- Error: t5389.scala:2:7 ------------------------------------------------------
2 |import ne.something
  |       ^^
  |       Object => Boolean is not stable
one error found

We must do better for what we call, at least in Montreal, "le pou", the plain old user. These are the users you pick up without noticing until they give you an itch to scratch.

@SethTisue
Copy link
Member

the Scala 2 error message seems pretty good to me, actually.

I don't see value in keeping this ticket open another 7 years.

@SethTisue SethTisue removed this from the Backlog milestone Nov 15, 2019
@hrhino
Copy link
Member

hrhino commented Nov 15, 2019

NEScala's in NYC next year, so apparently it's the compass point. York is in England, as every Brit knows, but that didn't survive the trip, as any Bostonian knows.

As for the error message, it seems like the real problem is that you need a stable path to import from, so Dotty's is more correct. I was on the fence about upgrading but now I'm sold.

@som-snytt
Copy link

The feature improvement would be to turn off root import of universal members from modules.

In scala 3, top level

def f = toString.      // dotty.DottyPredef$@2eee9593

In scala 2, you witness it only in imports.

@SethTisue
Copy link
Member

Som Snytt is the Lorax, he speaks for bug #5389

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants