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

Self type get ignored when used with type alias

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: Scala 2.10.3
    • Fix Version/s: Scala 2.11.0-M8
    • Component/s: Misc Compiler
    • Labels:
      None
    • Environment:

      Win7 x64
      scala 2.10.3

      Description

      Below code compiles:

      Welcome to Scala version 2.10.3 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_4
      5).
      Type in expressions to have them evaluated.
      Type :help for more information.
      
      scala> object A {
           | trait B
           | trait C {self: B =>}
           | }
      defined module A
      
      scala> trait Alias {
           | type B = A.B
           | type C = A.C
           | }
      defined trait Alias
      
      scala> new Alias { new C{} }
      res0: Alias = $anon$1@5636bc0a
      

        Activity

        Hide
        Jason Zaugg added a comment -

        Could you please elaborate on why you believe there is a bug here? I don't see one.

        Show
        Jason Zaugg added a comment - Could you please elaborate on why you believe there is a bug here? I don't see one.
        Hide
        Jason Zaugg added a comment -

        Oh, I see it now:

        
        trait B
        trait C {self: B =>}
        
        object Test {
          new C {} // fails
          type CC = C
          new CC {} // should fail, doesn't
        }
        
        Show
        Jason Zaugg added a comment - Oh, I see it now: trait B trait C {self: B =>} object Test { new C {} // fails type CC = C new CC {} // should fail, doesn't }
        Show
        Jason Zaugg added a comment - https://github.com/scala/scala/pull/3130

          People

          • Assignee:
            Jason Zaugg
            Reporter:
            Junhai Zheng
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development