{"action":"created","issue":{"url":"https://api.github.com/repos/lampepfl/dotty/issues/1246","repository_url":"https://api.github.com/repos/lampepfl/dotty","labels_url":"https://api.github.com/repos/lampepfl/dotty/issues/1246/labels{/name}","comments_url":"https://api.github.com/repos/lampepfl/dotty/issues/1246/comments","events_url":"https://api.github.com/repos/lampepfl/dotty/issues/1246/events","html_url":"https://github.com/lampepfl/dotty/pull/1246","id":152987040,"number":1246,"title":"Multiversal Equality","user":{"login":"odersky","id":795990,"avatar_url":"https://avatars.githubusercontent.com/u/795990?v=3","gravatar_id":"","url":"https://api.github.com/users/odersky","html_url":"https://github.com/odersky","followers_url":"https://api.github.com/users/odersky/followers","following_url":"https://api.github.com/users/odersky/following{/other_user}","gists_url":"https://api.github.com/users/odersky/gists{/gist_id}","starred_url":"https://api.github.com/users/odersky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/odersky/subscriptions","organizations_url":"https://api.github.com/users/odersky/orgs","repos_url":"https://api.github.com/users/odersky/repos","events_url":"https://api.github.com/users/odersky/events{/privacy}","received_events_url":"https://api.github.com/users/odersky/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2016-05-04T11:14:14Z","updated_at":"2016-05-20T20:28:55Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/lampepfl/dotty/pulls/1246","html_url":"https://github.com/lampepfl/dotty/pull/1246","diff_url":"https://github.com/lampepfl/dotty/pull/1246.diff","patch_url":"https://github.com/lampepfl/dotty/pull/1246.patch"},"body":"The first 4 commits were taken from the previous PR to add mutliversal equals. Review by @smarter."},"comment":{"url":"https://api.github.com/repos/lampepfl/dotty/issues/comments/220710595","html_url":"https://github.com/lampepfl/dotty/pull/1246#issuecomment-220710595","issue_url":"https://api.github.com/repos/lampepfl/dotty/issues/1246","id":220710595,"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},"created_at":"2016-05-20T20:28:55Z","updated_at":"2016-05-20T20:28:55Z","body":"> There was one test that failed under new rules: run/t2030.scala. It was moved to pos-scala2.\r\n\r\nThe two possible implicits are `scala.collection.immutable.SortedSet.newCanBuildFrom` and `scala.collection.immutable.TreeSet.newCanBuildFrom`, previously the first one was chosen, but now they're ambiguous. I was curious about what was going on here so I minimized it and explained it, this could be added as a testcase:\r\n```scala\r\n// Minimized from t2030.scala\r\n\r\nclass Both[-A, +B]\r\n\r\ntrait Factory[A] {\r\n  implicit def make: Both[A, A] = new Both[A, A]\r\n}\r\n\r\ntrait X\r\nobject X extends Factory[X] {\r\n  override implicit def make: Both[X, X] = super.make\r\n}\r\n\r\nclass Y extends X\r\nobject Y extends Factory[Y] {\r\n  // override implicit def make: Both[Y, Y] = super.make\r\n}\r\n\r\nobject Test {\r\n  def get(implicit ev: Both[Y, X]) = ev\r\n\r\n  // There are two possible implicits here: X.make and Y.make, neither are\r\n  // subtype of each other, so who wins?\r\n  // - Under the old scheme it's X.make because `isAsGood` sees that X.make is defined\r\n  // in X whereas Y.make is defined in Factory\r\n  // - Under the new scheme it's ambiguous because we replace contravariance by covariance\r\n  // in top-level type parameters so Y.make is treated as a subtype of X.make\r\n  // In both schemes we can get Y.make to win by uncommenting the override for make in Y\r\n  // (Y wins against X because `isDerived` also considers the subtyping relationships\r\n  // of companion classes)\r\n  get\r\n}\r\n```\r\n\r\nThis means that we can fix the issue in the standard library by adding an override of `newCanBuildFrom` in `TreeSet`, as a bonus this means that `res1` in `t2030.scala` gets the inferred type `TreeSet[Int]` instead of `SortedSet[Int]`."}}
{"actor":{"display_login":"smarter"}}