[ https://issues.apache.org/jira/browse/SPARK-4165?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14195713#comment-14195713 ]
Apache Spark commented on SPARK-4165: ------------------------------------- User 'ScrapCodes' has created a pull request for this issue: https://github.com/apache/spark/pull/2158 > Using Companion Objects throws ambiguous reference error in REPL when an > instance of Class is initialized > --------------------------------------------------------------------------------------------------------- > > Key: SPARK-4165 > URL: https://issues.apache.org/jira/browse/SPARK-4165 > Project: Spark > Issue Type: Bug > Components: Spark Shell > Affects Versions: 1.0.1, 1.1.0 > Reporter: Shiti Saxena > Assignee: Prashant Sharma > > Tried the following in the master branch REPL. > {noformat} > Spark context available as sc. > scala> import akka.actor.{Actor,Props} > import akka.actor.{Actor, Props} > scala> :pas > // Entering paste mode (ctrl-D to finish) > class EchoActor extends Actor{ > override def receive = { > case message => sender ! message > } > } > object EchoActor { > def props: Props = Props(new EchoActor()) > } > // Exiting paste mode, now interpreting. > defined class EchoActor > defined module EchoActor > scala> EchoActor.props > <console>:15: error: reference to EchoActor is ambiguous; > it is imported twice in the same scope by > import $VAL1.EchoActor > and import INSTANCE.EchoActor > EchoActor.props > {noformat} > Using a companion Object works when the apply method is not overloaded. > {noformat} > scala> :pas > // Entering paste mode (ctrl-D to finish) > case class TestA(w:String) > object TestA{ > def print = { println("hello")} > } > // Exiting paste mode, now interpreting. > defined class TestA > defined module TestA > scala> TestA.print > hello > {noformat} > When the apply method is overloaded, it throws ambiguous reference error > {noformat} > scala> :pas > // Entering paste mode (ctrl-D to finish) > case class T1(s:String,len:Int) > object T1{ > def apply(s:String):T1 = T1(s,s.size) > } > // Exiting paste mode, now interpreting. > defined class T1 > defined module T1 > scala> T1("abcd") > <console>:15: error: reference to T1 is ambiguous; > it is imported twice in the same scope by > import $VAL17.T1 > and import INSTANCE.T1 > T1("abcd") > ^ > scala> T1("abcd",4) > <console>:15: error: reference to T1 is ambiguous; > it is imported twice in the same scope by > import $VAL18.T1 > and import INSTANCE.T1 > T1("abcd",4) > {noformat} -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org