This page is no longer maintained — Please continue to the home page at www.scala-lang.org

-Xexperimental dependent types regression in 2.9

2 replies
Tupshin Harper
Joined: 2009-02-10,
User offline. Last seen 42 years 45 weeks ago.

The following code compiles with the -Xexperimental flag with both 2.7.7
and 2.8.1. However, with 2.9.0RC1 (as well as the eclipse nightly
plugin), I get
scalac -Xexperimental Broke.scala
../../Broke.scala:6: error: type mismatch;
found : Broke.this.tempval.type with Broke.this.Foo[x$2.type(in
value broke_val)] where type x$2.type(in value broke_val) <:
java.lang.Object with Singleton
required: Broke.this.tempval.type with Broke.this.Foo[x$2.type(in
value broke_val)] forSome { type x$2.type(in value broke_val) <:
java.lang.Object with Singleton }
val broke_val = new AnyRef {} -: tempval // type mismatch error only
when assigning
^
one error found

class Broke {

val tempval = new AnyRef {val roleA = new AnyRef with Bar}.roleA

new AnyRef {} -: tempval // when not assigning to anything, no problem
val broke_val = new AnyRef {} -: tempval // type mismatch error only
when assigning

trait Foo[AnyRef] { }

trait Bar extends Foo[AnyRef] {
def -:(core: AnyRef): this.type with Foo[core.type] = throw new
Exception()
}
}

pastebin version in case the code gets munged:
http://pastebin.com/atYNLBYC

-Tupshin

odersky
Joined: 2008-07-29,
User offline. Last seen 45 weeks 6 days ago.
Re: -Xexperimental dependent types regression in 2.9


On Tue, Apr 26, 2011 at 3:26 AM, Tupshin Harper <tupshin [at] tupshin [dot] com> wrote:
The following code compiles with the -Xexperimental flag with both 2.7.7 and 2.8.1. However, with 2.9.0RC1 (as well as the eclipse nightly plugin), I get
scalac -Xexperimental Broke.scala
../../Broke.scala:6: error: type mismatch;
 found   : Broke.this.tempval.type with Broke.this.Foo[x$2.type(in value broke_val)] where type x$2.type(in value broke_val) <: java.lang.Object with Singleton
 required: Broke.this.tempval.type with Broke.this.Foo[x$2.type(in value broke_val)] forSome { type x$2.type(in value broke_val) <: java.lang.Object with Singleton }
 val broke_val = new AnyRef {} -: tempval // type mismatch error only when assigning
     ^
one error found


class Broke {

 val tempval = new AnyRef {val roleA = new AnyRef with Bar}.roleA

 new AnyRef {} -: tempval // when not assigning to anything, no problem
 val broke_val = new AnyRef {} -: tempval // type mismatch error only when assigning

 trait Foo[AnyRef] {  }

 trait Bar extends Foo[AnyRef] {
   def -:(core: AnyRef): this.type with Foo[core.type] = throw new Exception()
 }
}


Thanks for reporting the problem. It would be good to file a ticket in trak. We'll try to take a look at this soon.

 -- Martin

Tupshin Harper
Joined: 2009-02-10,
User offline. Last seen 42 years 45 weeks ago.
Re: -Xexperimental dependent types regression in 2.9
Done.
https://lampsvn.epfl.ch/trac/scala/ticket/4518

Thanks.

-Tupshin

On 04/26/2011 02:59 AM, martin odersky wrote:
BANLkTin+K7mr3qSeoWQPeD3ykBgskF0pjg [at] mail [dot] gmail [dot] com" type="cite">

On Tue, Apr 26, 2011 at 3:26 AM, Tupshin Harper <tupshin [at] tupshin [dot] com" rel="nofollow">tupshin [at] tupshin [dot] com> wrote:
The following code compiles with the -Xexperimental flag with both 2.7.7 and 2.8.1. However, with 2.9.0RC1 (as well as the eclipse nightly plugin), I get
scalac -Xexperimental Broke.scala
../../Broke.scala:6: error: type mismatch;
 found   : Broke.this.tempval.type with Broke.this.Foo[x$2.type(in value broke_val)] where type x$2.type(in value broke_val) <: java.lang.Object with Singleton
 required: Broke.this.tempval.type with Broke.this.Foo[x$2.type(in value broke_val)] forSome { type x$2.type(in value broke_val) <: java.lang.Object with Singleton }
 val broke_val = new AnyRef {} -: tempval // type mismatch error only when assigning
     ^
one error found


class Broke {

 val tempval = new AnyRef {val roleA = new AnyRef with Bar}.roleA

 new AnyRef {} -: tempval // when not assigning to anything, no problem
 val broke_val = new AnyRef {} -: tempval // type mismatch error only when assigning

 trait Foo[AnyRef] {  }

 trait Bar extends Foo[AnyRef] {
   def -:(core: AnyRef): this.type with Foo[core.type] = throw new Exception()
 }
}


Thanks for reporting the problem. It would be good to file a ticket in trak. We'll try to take a look at this soon.

 -- Martin


Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland