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

A var defined in a script not updated after reload in REPL with -Yrepl-class-based

    Details

      Description

      It is possible to produce this problem with the Scala REPL using -Yrepl-class-based. The key to triggering this problem seems to be having an anonymous class with at least two members. Included is a new sample file that can be used to exhibit this problem. Below is a session showing the behavior:

      ~/t/t/6393 scala -Yrepl-class-based
      Welcome to Scala 2.11.8 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_74).
      Type in expressions for evaluation. Or try :help.
       
      scala> :load Fail.scala
      Loading Fail.scala...
      X: Serializable{def getArray(n: Int): Array[Double]; def multiplySum(x: Double,v: Seq[Double]): Double} = $anon$1@5ddf0d24
       
      scala> val a = X.getArray(100)
      warning: there was one feature warning; re-run with -feature for details
      a: Array[Double] = Array(0.6445967025789217, 0.8356433165638456, 0.9050186287112574, 0.06344554850936357, 0.008363070900988756, 0.6593626537474886, 0.7424265307039932, 0.5035629973234215, 0.5510831160354674, 0.37366654438205593, 0.33299751842582703, 0.3800633883472283, 0.4153963387304084, 0.2752468331316783, 0.8699452196820426, 0.31938530945559984, 0.7990568815957724, 0.6875841747139724, 0.31949965197609675, 0.026911873556428878, 0.2616536698127736, 0.5580118021155783, 0.28345994848845435, 0.1773433165304532, 0.2549417030032525, 0.9777692443616465, 0.6296846343712603, 0.8589339648876033, 0.7020098253707141, 0.8518829567943531, 0.41154622619731374, 0.1075129613308311, 0.8499252434316056, 0.3841876768177086, 0.137415801614582, 0.27030938222499756, 0.5511585560527115, 0.26252884257087217, ...
      scala> X = null
      X: Serializable{def getArray(n: Int): Array[Double]; def multiplySum(x: Double,v: Seq[Double]): Double} = null
       
      scala> :load Fail.scala
      Loading Fail.scala...
      X: Serializable{def getArray(n: Int): Array[Double]; def multiplySum(x: Double,v: Seq[Double]): Double} = $anon$1@52c8295b
       
      scala> X
      res0: Serializable{def getArray(n: Int): Array[Double]; def multiplySum(x: Double,v: Seq[Double]): Double} = null
      

      This has been tested with Scala 2.11.8 and 2.11.7

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                apm A. P. Marki
                Reporter:
                corruptmemory Jim Powers
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: