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

import selector removes implicit nature of value #2405

Closed
scabug opened this Issue Sep 28, 2009 · 3 comments

Comments

Projects
None yet
2 participants
@scabug
Copy link

scabug commented Sep 28, 2009

Using a selector in an import statement removes the implicit nature of the imported value (tested in scala-2.7.5.final and scala-2.8.0.r18762):

object A { implicit val x = 1 }
import A.x
implicitly[Int] // 1

// restart

object A { implicit val x = 1 }
import A.{x => y}
implicitly[Int] // error: could not find implicit value for parameter e: Int
y // 1
x // error: not found: value x [as expected]

Is it on purpose ?

@scabug

This comment has been minimized.

Copy link
Author

scabug commented Sep 28, 2009

Imported From: https://issues.scala-lang.org/browse/SI-2405?orig=1
Reporter: @rjolly
Other Milestones: 2.10.0

@scabug

This comment has been minimized.

Copy link
Author

scabug commented May 21, 2012

@retronym said:
Still a problem with 2.10.x

scala> object A { implicit val x = 1 }
defined module A

scala> import A.{x => y}
import A.{x=>y}

scala> y
res1: Int = 1

scala> implicitly[Int]
<console>:10: error: could not find implicit value for parameter e: Int
              implicitly[Int]
                        ^

scala> :implicits
No implicits have been imported other than those in Predef.

scala> import A.x
import A.x

scala> :implicits
/* 1 implicit members imported from A */
  /* 1 defined in A */
  implicit val x: Int
@scabug

This comment has been minimized.

Copy link
Author

scabug commented May 21, 2012

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.