We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Consider the following class with the overloaded method a:
a
class C { def a(x: Int) = 1 def a(x: String) = 2 }
Invocation of method a with a argument of type Char returns 1 (numeric widening):
Char
scala> new C().a(32 : Char) res4: Int = 1
resolveOverload on the term symbol a however returns NoSymbol (signalling an overload ambiguity):
resolveOverload
NoSymbol
scala> import scala.reflect.runtime.universe._ import scala.reflect.runtime.universe._ scala> import scala.reflect.runtime.{ currentMirror => cm } import scala.reflect.runtime.{currentMirror=>cm} scala> class C { | def a(x: Int) = 1 | def a(x: String) = 2 | } defined class C scala> val t = typeOf[C] t: reflect.runtime.universe.Type = C scala> val a = t.member(newTermName("a")).asTermSymbol a: reflect.runtime.universe.TermSymbol = value a scala> a.alternatives.size res5: Int = 2 scala> val aSymb = a.resolveOverloaded(posVargs = List(typeOf[Char])) aSymb: reflect.runtime.universe.Symbol = <none> scala> aSymb == NoSymbol res6: Boolean = true
In order to reproduce this bug use the following input:
import scala.reflect.runtime.universe._ import scala.reflect.runtime.{ currentMirror => cm } class C { def a(x: Int) = 1 def a(x: String) = 2 } val t = typeOf[C] val a = t.member(newTermName("a")).asTermSymbol val aSymb = a.resolveOverloaded(posVargs = List(typeOf[Char])) aSymb == NoSymbol
The text was updated successfully, but these errors were encountered:
Imported From: https://issues.scala-lang.org/browse/SI-6061?orig=1 Reporter: @dgruntz Affected Versions: 2.10.0
Sorry, something went wrong.
@dgruntz said: proposed fix in scala/scala#883
cvogt
No branches or pull requests
Consider the following class with the overloaded method
a
:Invocation of method
a
with a argument of typeChar
returns 1 (numeric widening):resolveOverload
on the term symbola
however returnsNoSymbol
(signalling an overload ambiguity):In order to reproduce this bug use the following input:
The text was updated successfully, but these errors were encountered: