Scala Programming Language
  1. Scala Programming Language
  2. SI-2405

import selector removes implicit nature of value

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: Scala 2.10.0-M3, Scala 2.10.0
    • Component/s: Misc Compiler
    • 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 ?

        Issue Links

          Activity

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

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Development