Uploaded image for project: 'Scala Programming Language'
  1. Scala Programming Language
  2. SI-2405

import selector removes implicit nature of value

    Details

    • Type: Bug
    • Status: CLOSED
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: Scala 2.10.0-M3, Scala 2.10.0
    • Component/s: Compiler (Misc)
    • Labels:
      None
    • Environment:

      import selector implicit remove

      Description

      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 ?

        Attachments

          Issue Links

            Activity

            Hide
            retronym Jason Zaugg added a comment -

            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
            

            Show
            retronym Jason Zaugg added a comment - 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
            Hide
            retronym Jason Zaugg added a comment -
            Show
            retronym Jason Zaugg added a comment - Some progress: https://github.com/retronym/scala/compare/ticket/2405

              People

              • Assignee:
                odersky Martin Odersky
                Reporter:
                rjolly rjolly
                TracCC:
                Paul Phillips, Seth Tisue
              • Votes:
                1 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: