Details

      Description

      Essentially the same problem volatility was introduced to deal with, but in this case there are never any abstract types involved:

      object Test extends Application {
       trait A
       trait B extends A
       
        trait C {
          trait D { type T >: B <: A }
          val y: (D with this.type)#T = new B { }
        }
       
        class D extends C {
          trait E
          type T = E 
          def frob(arg : E) : E = arg
          frob(y)
        }
       
        new D
      }
      

      Yielding:

      java.lang.ExceptionInInitializerError
              at Test.main(volatile-intersection.scala)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:585)
      	at scala.tools.nsc.ObjectRunner$$$$anonfun$$run$$1.apply(ObjectRunner.scala:75)
      	at scala.tools.nsc.ObjectRunner$$.withContextClassLoader(ObjectRunner.scala:49)
      	at scala.tools.nsc.ObjectRunner$$.run(ObjectRunner.scala:74)
      	at scala.tools.nsc.MainGenericRunner$$.main(MainGenericRunner.scala:154)
      	at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)
      Caused by: java.lang.ClassCastException: Test$$C$$$$anon$$1
      	at Test$$D.<init>(volatile-intersection.scala:14)
      	at Test$$.<init>(volatile-intersection.scala:17)
      	at Test$$.<clinit>(volatile-intersection.scala)
      	... 10 more
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                odersky Martin Odersky
                Reporter:
                washburn Geoffrey Alan Washburn
                TracCC:
                Ismael Juma
              • Votes:
                1 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: