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

Implicit resolution doesn't work with -Yrepl-class-based in REPL

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: Scala 2.11.8
    • Fix Version/s: Backlog
    • Component/s: Repl / Interpreter
    • Labels:
      None

      Description

      The following codes failed when enabling -Yrepl-class-based.

      $ build/quick/bin/scala -Yrepl-class-based
      Welcome to Scala 2.12.0-20160601-124948-128ac65991 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_45).
      Type in expressions for evaluation. Or try :help.
       
      scala> :paste
      // Entering paste mode (ctrl-D to finish)
       
      object X {
        implicit def bar(a: Array[String]) = new Foo(a)
        class Foo(a: Array[String]) {
          def toX: Seq[String] = a.toSeq
        }
      }
       
      // Exiting paste mode, now interpreting.
       
      warning: there was one feature warning; re-run with -feature for details
      defined object X
       
      scala> import X._
      import X._
       
      scala> :paste
      // Entering paste mode (ctrl-D to finish)
       
      class Bar(s: String) {
        val x = Array(s).toX
      }
       
      // Exiting paste mode, now interpreting.
       
      <console>:12: error: value toX is not a member of Array[String]
               val x = Array(s).toX
                                ^
       
      scala> 
      

      The above codes work well when disabling -Yrepl-class-based

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                zsxwing Shixiong Zhu
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated: