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
Specification should mention that implicit scope for a view includes parts of the types of the arguments. #5089
Comments
Imported From: https://issues.scala-lang.org/browse/SI-5089?orig=1 |
@retronym said: "odersky may want to take a quick look and update the spec" |
@paulp said: scala> 1 + 2
res0: Int = 3
scala> 1.+(2)
res1: Double = 3.0 |
@Alefas said: class RichInt {
def +++ = 1
def foo = 2
}
implicit def i2r(x: Int): RichInt = new RichInt
1.+++
1.foo So 1.id should be call to Int id, or should be Doudle id call in both cases. |
@paulp said: Oh yes, I've wanted to remove it since forever. The only decent argument against is breaking code, and it's hard to believe we'd break much. I'm not sure why +++ acts that way. |
Commit Message Bot (anonymous) said: 1.+(2) - what is it? Is it 3 or 3.0? Come scala 2.11 you won't Primarily, that's these forms: 3.f 3.d 3. If you prefer an error to a warning, use -Xfuture. Let's deprecate 012 == 10 too! (See comment.) References #5089, no review. |
@retronym said: |
@gkossakowski said: |
@Alefas said: |
@adriaanm said: |
This example is really weird
This shouldn't compile in both cases. According to language specification implicit scope for e.v(args) is type of e. Here type of e is Int, so i2o can't be in implicit scope.
So this is possibly bug of lang specification, I mean implicit scope actually is bigger then Int.
However anyway it's compiler bug, because both exmples should be the same (infix operations is just syntactic sugar).
The text was updated successfully, but these errors were encountered: