Skip to content

Ordering of implicit definitions matters #1209

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
scabug opened this issue Aug 11, 2008 · 3 comments
Closed

Ordering of implicit definitions matters #1209

scabug opened this issue Aug 11, 2008 · 3 comments

Comments

@scabug
Copy link

scabug commented Aug 11, 2008

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);
}
@scabug
Copy link
Author

scabug commented Aug 11, 2008

Imported From: https://issues.scala-lang.org/browse/SI-1209?orig=1
Reporter: wdietl

@scabug
Copy link
Author

scabug commented Aug 11, 2008

@SethTisue said:
see #801

@scabug
Copy link
Author

scabug commented Aug 14, 2008

@dragos said:
This is intentional. Add an explicit return type to the implicit methods to make them visible before their definition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant