Skip to content

prefix method call expansion is ruining the dependent method types party #4518

Open
scala/scala
#7741
@scabug

Description

@scabug

=== What steps will reproduce the problem (please be specific and use wikiformatting)? ===
scalac -Xexperimental Broke.scala

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()
  }
} 

=== What is the expected behavior? ===
Compiles without error, as it did with 2.7.7 and 2.8.1

=== What do you see instead? ===
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

=== Additional information ===
(for instance, a link to a relevant mailing list discussion)

=== What versions of the following are you using? ===

  • Scala: 2.9RC1
  • Java: n/a
  • Operating system: Debian Linux sid

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions