{"action":"opened","issue":{"url":"https://api.github.com/repos/lampepfl/dotty/issues/521","labels_url":"https://api.github.com/repos/lampepfl/dotty/issues/521/labels{/name}","comments_url":"https://api.github.com/repos/lampepfl/dotty/issues/521/comments","events_url":"https://api.github.com/repos/lampepfl/dotty/issues/521/events","html_url":"https://github.com/lampepfl/dotty/issues/521","id":72676570,"number":521,"title":"A tail recursive extension method gets two \"$this\" parameters","user":{"login":"smarter","id":63430,"avatar_url":"https://avatars.githubusercontent.com/u/63430?v=3","gravatar_id":"","url":"https://api.github.com/users/smarter","html_url":"https://github.com/smarter","followers_url":"https://api.github.com/users/smarter/followers","following_url":"https://api.github.com/users/smarter/following{/other_user}","gists_url":"https://api.github.com/users/smarter/gists{/gist_id}","starred_url":"https://api.github.com/users/smarter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smarter/subscriptions","organizations_url":"https://api.github.com/users/smarter/orgs","repos_url":"https://api.github.com/users/smarter/repos","events_url":"https://api.github.com/users/smarter/events{/privacy}","received_events_url":"https://api.github.com/users/smarter/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-05-02T17:56:50Z","updated_at":"2015-05-02T17:56:50Z","closed_at":null,"body":"The Issue is that `FullParameterization#fullyParameterizedDef` is called twice:\r\n```scala\r\nimport scala.annotation.tailrec\r\n\r\nclass M(val underlying: Int) extends AnyVal {\r\n  @tailrec def foo: Unit = foo\r\n}\r\n```\r\n`ExtensionMethods` creates a method `foo$extension` using `fullyParameterizedDef`:\r\n```scala\r\n@annotation.tailrec() final def foo$extension($this: M): Unit = \r\n  M.foo$extension($this)\r\n```\r\nand `TailRec` creates a label method using `fullyParameterizedDef` too:\r\n```scala\r\n@annotation.tailrec() final def foo$extension($this: M): Unit = {\r\n  def tailLabel1($this: M.type)($this: M): Unit = tailLabel1($this)($this)\r\n  tailLabel1(this)($this)\r\n}\r\n```\r\nThis seems to actually work at runtime, but having two parameters with the same name does not sound like a good thing, I think that:\r\n- `FullParameterization` should use fresh parameter names when needed\r\n- `-Ycheck` should warn about this sort of thing."}}