{"action":"created","issue":{"url":"https://api.github.com/repos/lampepfl/dotty/issues/4742","repository_url":"https://api.github.com/repos/lampepfl/dotty","labels_url":"https://api.github.com/repos/lampepfl/dotty/issues/4742/labels{/name}","comments_url":"https://api.github.com/repos/lampepfl/dotty/issues/4742/comments","events_url":"https://api.github.com/repos/lampepfl/dotty/issues/4742/events","html_url":"https://github.com/lampepfl/dotty/issues/4742","id":337066372,"node_id":"MDU6SXNzdWUzMzcwNjYzNzI=","number":4742,"title":"Type inference issue: No ClassTag available for Nothing","user":{"login":"allanrenucci","id":4996324,"node_id":"MDQ6VXNlcjQ5OTYzMjQ=","avatar_url":"https://avatars1.githubusercontent.com/u/4996324?v=4","gravatar_id":"","url":"https://api.github.com/users/allanrenucci","html_url":"https://github.com/allanrenucci","followers_url":"https://api.github.com/users/allanrenucci/followers","following_url":"https://api.github.com/users/allanrenucci/following{/other_user}","gists_url":"https://api.github.com/users/allanrenucci/gists{/gist_id}","starred_url":"https://api.github.com/users/allanrenucci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/allanrenucci/subscriptions","organizations_url":"https://api.github.com/users/allanrenucci/orgs","repos_url":"https://api.github.com/users/allanrenucci/repos","events_url":"https://api.github.com/users/allanrenucci/events{/privacy}","received_events_url":"https://api.github.com/users/allanrenucci/received_events","type":"User","site_admin":false},"labels":[{"id":288606644,"node_id":"MDU6TGFiZWwyODg2MDY2NDQ=","url":"https://api.github.com/repos/lampepfl/dotty/labels/area:typer","name":"area:typer","color":"006b75","default":false},{"id":21379537,"node_id":"MDU6TGFiZWwyMTM3OTUzNw==","url":"https://api.github.com/repos/lampepfl/dotty/labels/itype:bug","name":"itype:bug","color":"cc317c","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-06-29T16:44:25Z","updated_at":"2018-06-29T19:03:45Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"```scala\r\nimport scala.reflect.ClassTag\r\n\r\nclass Test {\r\n  def foo[T <: String: ClassTag](f: T => Int) = 1\r\n  def bar(f: String => Int) = foo(f)\r\n}\r\n```\r\n```\r\n-- Error: tests/allan/Test.scala:27:36 -----------------------------------------\r\n27 |  def bar(f: String => Int) = foo(f)\r\n   |                                    ^\r\n   |                                    No ClassTag available for Nothing\r\none error found\r\n```"},"comment":{"url":"https://api.github.com/repos/lampepfl/dotty/issues/comments/401445816","html_url":"https://github.com/lampepfl/dotty/issues/4742#issuecomment-401445816","issue_url":"https://api.github.com/repos/lampepfl/dotty/issues/4742","id":401445816,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMTQ0NTgxNg==","user":{"login":"smarter","id":63430,"node_id":"MDQ6VXNlcjYzNDMw","avatar_url":"https://avatars2.githubusercontent.com/u/63430?v=4","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":"2018-06-29T19:03:45Z","updated_at":"2018-06-29T19:03:45Z","author_association":"MEMBER","body":"> I think this could be solved if we somehow recorded the fact that we did a comparison T <:< String\r\n\r\nHere's how this could be implemented: instead of using a `TypeBounds` to store the bounds of a constraint, use a `MemoryTypeBounds`  that remembers if one if its bound has been touched, and instead of `derivedTypeBounds` use `updateLo` and `updateHi`:\r\n```scala\r\n  class MemoryTypeBounds(lo: Type, hi: Type, loTouched: Boolean = false, hiTouched: Boolean = false)\r\n      extends TypeBounds(lo, hi) {\r\n    val touched = loTouched || hiTouched\r\n\r\n    def updateLo(lo: Type) = {\r\n      if (lo == this.lo && loTouched) this\r\n      else new MemoryTypeBounds(lo, hi, loTouched = true, hiTouched)\r\n    }\r\n    def updateHi(hi: Type) = {\r\n      if (hi == this.hi && hiTouched) this\r\n      else new MemoryTypeBounds(lo, hi, loTouched, hiTouched = true)\r\n    }\r\n  }\r\n```"}}
{"actor":{"display_login":"smarter"}}