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

EXISTENTIAL flag is not pickled causing spurious declarations being created during unpickling

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: Scala 2.9.2
    • Fix Version/s: Scala 2.9.3-RC1, Scala 2.10.0
    • Component/s: None
    • Labels:
      None

      Description

      EXISTENTIAL flag is declared as following constant (in 2.9.x branch):

      final val EXISTENTIAL   = 0x800000000L  // type is an existential parameter or skolem
      

      The PickledFlags defined in the same file determines which flags get pickled:

      final val PickledFlags: Long  = 0xFFFFFFFFL
      

      Simple REPL experiment (instead of counting number of zeros...) shows that EXISTENTIAL flag does not get pickled:

      scala> final val EXISTENTIAL   = 0x800000000L
      EXISTENTIAL: Long(34359738368L) = 34359738368
      
      scala> final val PickledFlags: Long  = 0xFFFFFFFFL
      PickledFlags: Long = 4294967295
      
      scala> EXISTENTIAL & PickledFlags
      res0: Long = 0
      

      This results in symbols for existential types being entered as decls when unpickling:

      if (sym.owner.isClass && sym != classRoot && sym != moduleRoot &&
                  !sym.isModuleClass && !sym.isRefinementClass && !sym.isTypeParameter && !sym.isExistentiallyBound)
                symScope(sym.owner) enter sym
      

      due to !sym.isExistentiallyBound returning wrong result (true). This has severe consequences for sbt's incremental compilation because sbt thinks that API has changed. See https://groups.google.com/d/topic/simple-build-tool/Anumu_erCVY/discussion for example.

        Activity

        Hide
        Paul Phillips added a comment -

        See also this, which apparently missed the whole 2.9 series despite predating it:

        commit 4df206e6402f2e56bc450818acc14a707101c390
        Author: Paul Phillips <paulp@improving.org>
        Date:   1 year, 5 months ago
        
            Existentially quantified symbols, when read by ...
            
            Existentially quantified symbols, when read by the unpickler, do not
            have the existential flag set. This leads to failure. This patch seeks
            improvement. Closes #4757, review by odersky.
        

        and it came back out a year later (presumably after the set of pickled flags was expanded)

        commit 3e2c31fbebfd723e8a9afd28cbd0a62659466069 (refs/pull/887/head)
        Author: Paul Phillips <paulp@improving.org>
        Date:   4 months ago
        
            Removed EXISTENTIAL special case in unpickler.
        
        Show
        Paul Phillips added a comment - See also this, which apparently missed the whole 2.9 series despite predating it: commit 4df206e6402f2e56bc450818acc14a707101c390 Author: Paul Phillips <paulp@improving.org> Date: 1 year, 5 months ago Existentially quantified symbols, when read by ... Existentially quantified symbols, when read by the unpickler, do not have the existential flag set. This leads to failure. This patch seeks improvement. Closes #4757, review by odersky. and it came back out a year later (presumably after the set of pickled flags was expanded) commit 3e2c31fbebfd723e8a9afd28cbd0a62659466069 (refs/pull/887/head) Author: Paul Phillips <paulp@improving.org> Date: 4 months ago Removed EXISTENTIAL special case in unpickler.
        Hide
        Paul Phillips added a comment -

        Correction: it doesn't predate 2.9.0, only the later ones.

        Show
        Paul Phillips added a comment - Correction: it doesn't predate 2.9.0, only the later ones.
        Hide
        Grzegorz Kossakowski added a comment -

        Yes, I should mention that in 2.10.x branch this is fixed.

        Show
        Grzegorz Kossakowski added a comment - Yes, I should mention that in 2.10.x branch this is fixed.
        Show
        Adriaan Moors added a comment - WIP: https://github.com/adriaanm/scala/compare/scala:2.9.x...adriaanm:ticket-6692-2.9.x
        Hide
        Adriaan Moors added a comment -

        for 2.9.3: https://github.com/scala/scala/pull/1761
        test in sbt as soon as 2.9.3 is released: https://github.com/harrah/xsbt/issues/623

        Show
        Adriaan Moors added a comment - for 2.9.3: https://github.com/scala/scala/pull/1761 test in sbt as soon as 2.9.3 is released: https://github.com/harrah/xsbt/issues/623
        Hide
        Adriaan Moors added a comment -
        Show
        Adriaan Moors added a comment - fixed for 2.9.3 in https://github.com/scala/scala/pull/1761

          People

          • Assignee:
            Adriaan Moors
            Reporter:
            Grzegorz Kossakowski
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development