Skip to content
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

align val and def signature inference #2742

Closed
scabug opened this issue Dec 1, 2009 · 7 comments
Closed

align val and def signature inference #2742

scabug opened this issue Dec 1, 2009 · 7 comments

Comments

@scabug
Copy link

scabug commented Dec 1, 2009

It seems like C4 should compile too.

object Test {
  class A
  class B
  implicit def a2b(x: A): B = new B
  
  abstract class C1 { def f: B }
  
  class C2 extends C1 { def f = new A }     // compiles
  class C3 extends C1 { val f: B = new A }  // compiles
  
  // a.scala:16: error: overriding method f in class C1 of type => Test.B;
  //  value f has incompatible type
  //   class C4 extends C1 { val f = new A }
  //                             ^
  class C4 extends C1 { val f = new A }
}
@scabug
Copy link
Author

scabug commented Dec 1, 2009

Imported From: https://issues.scala-lang.org/browse/SI-2742?orig=1
Reporter: @paulp

@scabug
Copy link
Author

scabug commented Dec 2, 2009

@hubertp said:
I am guessing this one belongs to you, Martin.

@scabug
Copy link
Author

scabug commented Dec 2, 2009

@odersky said:
This is as speced, but one an discuss whether we should extend it. For methods, return types in inherited abstract methods are taken as expected type of the right hand side. For values there is no such rule. So this would be a spec enhancement request, as I see it.

@scabug
Copy link
Author

scabug commented Oct 15, 2013

@gkossakowski said:
Unassigning and rescheduling to M7 as previous deadline was missed.

@scabug
Copy link
Author

scabug commented Jun 23, 2016

@adriaanm said:
This came up while working on the fields refactoring (representing vals in traits as defs).

@scabug
Copy link
Author

scabug commented Jun 28, 2016

@adriaanm said:
We'll introduce this as a flag in 2.12.x

@scabug scabug closed this as completed Oct 28, 2016
@scabug
Copy link
Author

scabug commented Oct 28, 2016

@adriaanm said:
Fixed by scala/scala#5141

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

2 participants