Details

      Description

      Depending on order of traits, private members can shadow inherited members and prevent compilation. This does not happen with separate compilation.

      scala> :pa
      // Entering paste mode (ctrl-D to finish)
       
      trait A { private val x = 1 }
      trait B { val x = 2 }
      trait C extends B with A { println(x) }
       
      // Exiting paste mode, now interpreting.
       
      <console>:9: error: value x in trait A cannot be accessed in C
             trait C extends B with A { println(x) }
                                                ^
       
      scala> :reset
      Resetting interpreter state.
       
      scala> trait A { private val x = 1 }
      defined trait A
       
      scala> trait B { val x = 2 }
      defined trait B
       
      scala> trait C extends B with A { println(x) }
      defined trait C
      

      Expected behavior (to me anyway) is that private members (which are not inherited) should not shadow inherited members when resolving symbols in subclasses. But in either case behavior should be consistent between combined and separate compilation.

      Edit: damn this editor/formatter.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                retronym Jason Zaugg
                Reporter:
                rnorris Rob Norris
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: