Skip to content

Ordering of implicit definitions matters #1209

Closed
@scabug

Description

@scabug

The following example program worked with scalac 2.7.1.final, but with a current SVN version the ordering of implicit definitions must have changed. This might be intentional, but I did not find it mentioned on the changes list.

class MyImplicit {

  // With this implicit, the example works
  // with scalac 2.7.1.final and 2.7.1.r15731-b20080811151138
  // implicit def c2powerc(c: C) = new PowerC(c);

  class UseIt {
    def m(c : C) = c.power
  }

  class C {}

  class PowerC(c: C) {
    def power = "Power!"
  }

  // With this implicit, the example works
  // with scalac 2.7.1.final, but results in
  //   error: value power is not a member of MyImplicit.this.C
  // with 2.7.1.r15731-b20080811151138.
  implicit def c2powerc(c: C) = new PowerC(c);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions