-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Generic number literals miss overloaded method #11482
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
Comments
This can be expressed without givens or generic number literals: import java.math.BigInteger
class B
object B {
def apply(x: BigInteger): B = ???
def apply(x: String): B = ???
}
object Test {
val x = B(1)
}
|
Yes, with class B
object B {
def apply(x: BigInt): B = ???
def apply(x: String): B = ???
}
object Test {
val x = B(1)
} So your initial comment that the problem is that implicit conversions are not applied when doing overloading resolution, seems wrong. In addition, generic number literal is a different problem (though it could be seen as a subcase of implicit conversion, as I argued in #7468, but let's put it aside for the moment). Note that I use Java's So I think the initial problem with generic number literals is not solved (and would be interesting to solve). The fact that the import scala.language.experimental.genericNumberLiterals
class B
object B {
def apply(x: BigInt): B = ???
def apply(x: String): B = ???
}
object Test {
val x = B(18446744073709551616)
// ^^^^^^^^^^^^^^^^^^^^
// number too large
} Remove |
Compiler version
3.0.0-RC1
Minimized code and output
Expectation
Should work as when there's no overload:
The text was updated successfully, but these errors were encountered: