{"action":"created","issue":{"url":"https://api.github.com/repos/nim-lang/Nim/issues/10079","repository_url":"https://api.github.com/repos/nim-lang/Nim","labels_url":"https://api.github.com/repos/nim-lang/Nim/issues/10079/labels{/name}","comments_url":"https://api.github.com/repos/nim-lang/Nim/issues/10079/comments","events_url":"https://api.github.com/repos/nim-lang/Nim/issues/10079/events","html_url":"https://github.com/nim-lang/Nim/issues/10079","id":393733059,"node_id":"MDU6SXNzdWUzOTM3MzMwNTk=","number":10079,"title":"`type(foo)` interpreted as `foo` inside concept","user":{"login":"timotheecour","id":2194784,"node_id":"MDQ6VXNlcjIxOTQ3ODQ=","avatar_url":"https://avatars2.githubusercontent.com/u/2194784?v=4","gravatar_id":"","url":"https://api.github.com/users/timotheecour","html_url":"https://github.com/timotheecour","followers_url":"https://api.github.com/users/timotheecour/followers","following_url":"https://api.github.com/users/timotheecour/following{/other_user}","gists_url":"https://api.github.com/users/timotheecour/gists{/gist_id}","starred_url":"https://api.github.com/users/timotheecour/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timotheecour/subscriptions","organizations_url":"https://api.github.com/users/timotheecour/orgs","repos_url":"https://api.github.com/users/timotheecour/repos","events_url":"https://api.github.com/users/timotheecour/events{/privacy}","received_events_url":"https://api.github.com/users/timotheecour/received_events","type":"User","site_admin":false},"labels":[{"id":192931762,"node_id":"MDU6TGFiZWwxOTI5MzE3NjI=","url":"https://api.github.com/repos/nim-lang/Nim/labels/Concepts","name":"Concepts","color":"006b75","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2018-12-23T08:34:33Z","updated_at":"2018-12-27T21:34:44Z","closed_at":null,"author_association":"COLLABORATOR","body":"in code below, \r\n```\r\ntemplate `$`(t: typedesc)\r\n```\r\ndoesn't work while replacing `$` with anything else seems to work; so it looks like `$` is specially treated and causes bugs.\r\nThis is the root cause of the last remaining failure I'm having in PR https://github.com/nim-lang/Nim/pull/10071 /cc @Araq @dom96 \r\n\r\n### Example\r\n```nim\r\ntype\r\n  Foo = object\r\n    a: int\r\n\r\nproc name(t: typedesc): string = \"abc\"\r\ntemplate name2(t: typedesc): string = name(t)\r\n\r\nwhen defined(case1):\r\n  template `$`(t: typedesc): string = name(t)\r\nwhen defined(case2):\r\n  template `$`(t: untyped): string = name(t)\r\nwhen defined(case3):\r\n  proc `$`(t: typedesc): string = name(t)\r\nwhen defined(case4):\r\n  discard\r\n\r\ntemplate `foobar`(t: typedesc): string = name(t)\r\ntemplate `@!`(t: typedesc): string = name(t)\r\n\r\ntype\r\n  Bar[T]  = concept var s\r\n    s.a is T\r\n    const ValueTypeName1 = name(T)\r\n    const ValueTypeName2 = name2(T)\r\n    const ValueTypeName3 = foobar(T)\r\n    const ValueTypeName3b = `@!`(T)\r\n\r\n    const ValueTypeName4 = $(T)\r\n    const ValueTypeName5 = $T\r\n    const ValueTypeName6 = `$`(T)\r\n\r\nproc genericAlgorithm[T](s: Bar[T]) =\r\n  static:\r\n    echo s.ValueTypeName1 # int\r\n    echo s.ValueTypeName2 # int\r\n    echo s.ValueTypeName3 # int\r\n    echo s.ValueTypeName3b  # ditto\r\n\r\n    echo s.ValueTypeName4 # BUG: 9223372036854775807\r\n    echo s.ValueTypeName5 # ditto\r\n    echo s.ValueTypeName6  # ditto\r\n\r\nvar s = Foo()\r\n\r\ngenericAlgorithm(s)\r\n```\r\n\r\n### Current Output\r\nnim c -r -d:case1 t0084.nim\r\nabc\r\nabc\r\nabc\r\nabc\r\n9223372036854775807\r\n9223372036854775807\r\n9223372036854775807\r\n\r\nlikewise with case2, case3, case4\r\n\r\n### Expected Output\r\ncase1, case2, case3 should print:\r\nabc\r\nabc\r\nabc\r\nabc\r\nabc\r\nabc\r\nabc\r\n\r\ncase4 should give error since $() isn't defined for types (this is prior to https://github.com/nim-lang/Nim/pull/10071 ; in fact I ran into this while debugging failures I'm having for https://github.com/nim-lang/Nim/pull/10071  ; to reproduce this after that PR is merged, remember to go back to bec493925f4573b34c9f188e0041a3d5c2a7467c to reproduce the bug; the bug is real regardless of that PR being merged)\r\n\r\n## additional information\r\n* this could be related to https://github.com/nim-lang/Nim/issues/10078 (case1)\r\n* this could also be related to https://github.com/nim-lang/Nim/issues/9006 , but not sure it's a dup since here, replacing `$` by  `foobar` (or `@!`) makes the bug go away\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/nim-lang/Nim/issues/comments/450235212","html_url":"https://github.com/nim-lang/Nim/issues/10079#issuecomment-450235212","issue_url":"https://api.github.com/repos/nim-lang/Nim/issues/10079","id":450235212,"node_id":"MDEyOklzc3VlQ29tbWVudDQ1MDIzNTIxMg==","user":{"login":"timotheecour","id":2194784,"node_id":"MDQ6VXNlcjIxOTQ3ODQ=","avatar_url":"https://avatars2.githubusercontent.com/u/2194784?v=4","gravatar_id":"","url":"https://api.github.com/users/timotheecour","html_url":"https://github.com/timotheecour","followers_url":"https://api.github.com/users/timotheecour/followers","following_url":"https://api.github.com/users/timotheecour/following{/other_user}","gists_url":"https://api.github.com/users/timotheecour/gists{/gist_id}","starred_url":"https://api.github.com/users/timotheecour/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timotheecour/subscriptions","organizations_url":"https://api.github.com/users/timotheecour/orgs","repos_url":"https://api.github.com/users/timotheecour/repos","events_url":"https://api.github.com/users/timotheecour/events{/privacy}","received_events_url":"https://api.github.com/users/timotheecour/received_events","type":"User","site_admin":false},"created_at":"2018-12-27T21:34:44Z","updated_at":"2018-12-27T21:34:44Z","author_association":"COLLABORATOR","body":"i suspected smthg like that was going on, this ambiguity seems both innecessary and, as shown here, leads to bugs, shall we deprecate that 'feature'?"}}
{"actor":{"display_login":"timotheecour"}}