local method names

44 views
Skip to first unread message

Dennis Haupt

unread,
Jan 3, 2016, 11:56:41 AM1/3/16
to scala-user
what is the reason i cannot have two local methods with the same name?

Lutz Huehnken

unread,
Feb 4, 2016, 7:15:29 AM2/4/16
to scala-user

Hm.. thinking of minimal example...

class LocalMethods {

def method1: Unit = {
def innerMethod(): Unit = ()
innerMethod()
}

def method2: Unit = {
def innerMethod(): Unit = ()
innerMethod()
}
}

seems to compile ok in 2.11.7. What doesn't?

Dennis Haupt

unread,
Feb 4, 2016, 7:19:33 AM2/4/16
to Lutz Huehnken, scala-user
i meant like this:

class hello {
  def x {
    def a(str:String) = {}
    def a(str:String, str2:String) = {}
  }
}


--
You received this message because you are subscribed to the Google Groups "scala-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Lutz Huehnken

unread,
Feb 4, 2016, 7:29:19 AM2/4/16
to scala-user, lutz.h...@gmail.com

I see. I can't answer your question. But it has come up before and been marked as "won't fix", see https://issues.scala-lang.org/browse/SI-2219
Reply all
Reply to author
Forward
0 new messages