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

Optimiser disagrees with compiler over what syntax is valid

    Details

    • Type: Bug
    • Status: Open
    • Priority: Critical
    • Resolution: Unresolved
    • Affects Version/s: Scala 2.10.0
    • Fix Version/s: Backlog
    • Component/s: Compiler (Misc), Optimizer
    • Labels:
      None
    • Environment:

      Scala compiler version 2.10.0.dev-1302-g6a33a20 – Copyright 2002-2011, LAMP/EPFL

      Description

      ----------
      import java.io.

      {File}

      abstract sealed trait Path

      { val path: String val name: String }

      case class ExternalPath(path: String) extends File(path) with Path

      { override lazy val name: String = getName }

      ----------

      $ scalac -version
      Scala compiler version 2.10.0.dev-1302-g6a33a20 – Copyright 2002-2011, LAMP/EPFL

      $ scala z.scala
      $

      $ scala -optimize z.scala
      /tmp/z.scala:6: error: overriding value path in trait Path of type String;
      variable path in class File of type String has weaker access privileges; it should not be private
      case class ExternalPath(path: String) extends File(path) with Path {
      ^
      one error found
      $

        Attachments

          Activity

          Hide
          extempore Paul Phillips added a comment -

          This is another case of java private fields polluting subclasses. (It's specific to the use of "path", which is a File private.)

          See also SI-3160, SI-4762, and some others I can't find.

          Show
          extempore Paul Phillips added a comment - This is another case of java private fields polluting subclasses. (It's specific to the use of "path", which is a File private.) See also SI-3160 , SI-4762 , and some others I can't find.
          Hide
          rich dougherty Rich Dougherty added a comment -

          I see this error when compiling Akka with -optimize (which we don't usually do).

          [error] /p/akka/g/akka-actor/src/main/scala/akka/dispatch/Mailbox.scala:540: overriding method queue in trait QueueBasedMessageQueue of type => java.util.Queue[akka.dispatch.Envelope];
          [error]  variable queue in class PriorityBlockingQueue of type Array[Object] has weaker access privileges; it should not be private
          [error]     new PriorityBlockingQueue[Envelope](initialCapacity, cmp) with QueueBasedMessageQueue with UnboundedMessageQueueSemantics {
          [error]         ^
          [warn] 6 warnings found
          [error] one error found
          

          Show
          rich dougherty Rich Dougherty added a comment - I see this error when compiling Akka with -optimize (which we don't usually do). [error] /p/akka/g/akka-actor/src/main/scala/akka/dispatch/Mailbox.scala:540: overriding method queue in trait QueueBasedMessageQueue of type => java.util.Queue[akka.dispatch.Envelope]; [error] variable queue in class PriorityBlockingQueue of type Array[Object] has weaker access privileges; it should not be private [error] new PriorityBlockingQueue[Envelope](initialCapacity, cmp) with QueueBasedMessageQueue with UnboundedMessageQueueSemantics { [error] ^ [warn] 6 warnings found [error] one error found
          Hide
          magarcia Miguel Garcia added a comment -

          The new optimizer , http://magarciaepfl.github.io/scala/ , isn't prone to this bug. Just checked.

          Show
          magarcia Miguel Garcia added a comment - The new optimizer , http://magarciaepfl.github.io/scala/ , isn't prone to this bug. Just checked.

            People

            • Assignee:
              Unassigned
              Reporter:
              alanbur Alan Burlison
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated: