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

Can't overload methods on reflection artifacts #8190

Closed
scabug opened this issue Jan 27, 2014 · 3 comments
Closed

Can't overload methods on reflection artifacts #8190

scabug opened this issue Jan 27, 2014 · 3 comments
Assignees
Milestone

Comments

@scabug
Copy link

scabug commented Jan 27, 2014

20:37 ~/Projects/Master/sandbox (master)$ cat Test.scala
import scala.reflect.runtime.universe._

object Test extends App {
  def foo(s: Symbol) = ???
  def foo(ts: TermSymbol) = ???
}
20:37 ~/Projects/Master/sandbox (master)$ scalac Test.scala
Test.scala:5: error: double definition:
def foo(s: reflect.runtime.universe.Symbol): Nothing at line 4 and
def foo(ts: reflect.runtime.universe.TermSymbol): Nothing at line 5
have same type after erasure: (s: scala.reflect.api.Symbols#SymbolApi)Nothing
  def foo(ts: TermSymbol) = ???
      ^
one error found
@scabug
Copy link
Author

scabug commented Jan 27, 2014

Imported From: https://issues.scala-lang.org/browse/SI-8190?orig=1
Reporter: @xeno-by
See #8063

@scabug
Copy link
Author

scabug commented Jan 27, 2014

@xeno-by said (edited on Jan 27, 2014 6:37:36 PM UTC):
Here are the corresponding definitions:

type Symbol >: Null <: SymbolApi

type TermSymbol >: Null <: Symbol with TermSymbolApi
trait TermSymbolApi extends SymbolApi { this: TermSymbol => ... }

If one thinks about it, it's clear why TermSymbol erases to SymbolApi. Symbol is the first component of a compound type, and it erases to SymbolApi.

I'll change TermSymbol to say <: TermSymbolApi with Symbol, but in the meanwhile we could think why not scan other components of compound types looking for a base class that refines the erasure of the first component.

@scabug
Copy link
Author

scabug commented Feb 1, 2014

@xeno-by said:
scala/scala#3452

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