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

Specialization + Upper Lower Bounds cause TypeError

    Details

    • Type: Bug
    • Status: CLOSED
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: Scala 2.10.0-M2, Scala 2.10.0
    • Fix Version/s: Scala 2.10.0-M3
    • Environment:

      library version: version 2.10.0-M2-0118-gf1c39dd981-2012-03-11
      compiler version: version 2.10.0-M2-0118-gf1c39dd981-2012-03-11
      reconstructed args: -Xscript Main -d /tmp/scalascript5606505759334571591.tm

      Description

      The following mixture of attempting a phantom-type constraint + specialization explodes at compile time:

      trait C
      class Foo[@specialized(Int) T, A] {
        def bar[B >: A <: C]: T = ???
      }
      

      With the following exception:

      error: 
           while compiling:  /home/jsuereth/projects/tmp/phantom-bug.scala
             current phase:  specialize
           library version:  version 2.10.0-M2-0118-gf1c39dd981-2012-03-11
          compiler version:  version 2.10.0-M2-0118-gf1c39dd981-2012-03-11
        reconstructed args:  -Xscript Main -d /tmp/scalascript5606505759334571591.tmp
       
      uncaught exception during compilation: scala.reflect.internal.Types$TypeError
      

      Remove any one of the type bounds makes the code succeed. Removing the @specialize annotation also makes the code succeed.

        Attachments

          Activity

            People

            • Assignee:
              prokopec Aleksandar Prokopec
              Reporter:
              jsuereth Josh Suereth
            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: