{"action":"closed","issue":{"url":"https://api.github.com/repos/ponylang/ponyc/issues/1751","repository_url":"https://api.github.com/repos/ponylang/ponyc","labels_url":"https://api.github.com/repos/ponylang/ponyc/issues/1751/labels{/name}","comments_url":"https://api.github.com/repos/ponylang/ponyc/issues/1751/comments","events_url":"https://api.github.com/repos/ponylang/ponyc/issues/1751/events","html_url":"https://github.com/ponylang/ponyc/issues/1751","id":216837103,"number":1751,"title":"Assertion failure with annotations","user":{"login":"Praetonus","id":5193706,"avatar_url":"https://avatars2.githubusercontent.com/u/5193706?v=3","gravatar_id":"","url":"https://api.github.com/users/Praetonus","html_url":"https://github.com/Praetonus","followers_url":"https://api.github.com/users/Praetonus/followers","following_url":"https://api.github.com/users/Praetonus/following{/other_user}","gists_url":"https://api.github.com/users/Praetonus/gists{/gist_id}","starred_url":"https://api.github.com/users/Praetonus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Praetonus/subscriptions","organizations_url":"https://api.github.com/users/Praetonus/orgs","repos_url":"https://api.github.com/users/Praetonus/repos","events_url":"https://api.github.com/users/Praetonus/events{/privacy}","received_events_url":"https://api.github.com/users/Praetonus/received_events","type":"User","site_admin":false},"labels":[{"id":353620133,"url":"https://api.github.com/repos/ponylang/ponyc/labels/bug:%204%20-%20in%20progress","name":"bug: 4 - in progress","color":"f9d055","default":false},{"id":283122481,"url":"https://api.github.com/repos/ponylang/ponyc/labels/difficulty:%202%20-%20medium","name":"difficulty: 2 - medium","color":"fbca04","default":false},{"id":353596898,"url":"https://api.github.com/repos/ponylang/ponyc/labels/priority:%202%20-%20medium","name":"priority: 2 - medium","color":"d4c5f9","default":false}],"state":"closed","locked":false,"assignee":{"login":"jemc","id":4623870,"avatar_url":"https://avatars3.githubusercontent.com/u/4623870?v=3","gravatar_id":"","url":"https://api.github.com/users/jemc","html_url":"https://github.com/jemc","followers_url":"https://api.github.com/users/jemc/followers","following_url":"https://api.github.com/users/jemc/following{/other_user}","gists_url":"https://api.github.com/users/jemc/gists{/gist_id}","starred_url":"https://api.github.com/users/jemc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jemc/subscriptions","organizations_url":"https://api.github.com/users/jemc/orgs","repos_url":"https://api.github.com/users/jemc/repos","events_url":"https://api.github.com/users/jemc/events{/privacy}","received_events_url":"https://api.github.com/users/jemc/received_events","type":"User","site_admin":false},"assignees":[{"login":"jemc","id":4623870,"avatar_url":"https://avatars3.githubusercontent.com/u/4623870?v=3","gravatar_id":"","url":"https://api.github.com/users/jemc","html_url":"https://github.com/jemc","followers_url":"https://api.github.com/users/jemc/followers","following_url":"https://api.github.com/users/jemc/following{/other_user}","gists_url":"https://api.github.com/users/jemc/gists{/gist_id}","starred_url":"https://api.github.com/users/jemc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jemc/subscriptions","organizations_url":"https://api.github.com/users/jemc/orgs","repos_url":"https://api.github.com/users/jemc/repos","events_url":"https://api.github.com/users/jemc/events{/privacy}","received_events_url":"https://api.github.com/users/jemc/received_events","type":"User","site_admin":false}],"milestone":null,"comments":2,"created_at":"2017-03-24T16:24:40Z","updated_at":"2017-03-27T15:56:10Z","closed_at":"2017-03-27T15:56:10Z","body":"Minimal example:\r\n\r\n```pony\r\nactor Main\r\n  new create(env: Env) =>\r\n    if \\likely\\ U32(1) == 1 then\r\n      None\r\n    end\r\n```\r\n\r\nUsing annotations on an expression results in an assertion failure:\r\n\r\n```src/libponyc/ast/ast.c:737: setannotation: Assertion `!hasparent(annotation) && (annotation->annotation_type == NULL)` failed.```\r\n\r\nBacktrace:\r\n\r\n```\r\n#2  0x0000000000502349 in ponyint_assert_fail (expr=0x50a12c \"!hasparent(annotation) && (annotation->annotation_type == NULL)\", file=0x509f07 \"src/libponyc/ast/ast.c\", \r\n    line=743, func=0x50a11e \"setannotation\") at src/libponyrt/platform/ponyassert.c:60\r\n#3  0x0000000000432ddb in setannotation (ast=0x7ffff0559300, annotation=0x7ffff0490d80, allow_free=true) at src/libponyc/ast/ast.c:742\r\n#4  0x0000000000433022 in ast_setannotation (ast=0x7ffff0559300, annotation=0x7ffff0490d80) at src/libponyc/ast/ast.c:769\r\n#5  0x0000000000431cb0 in duplicate (parent=0x7ffff0524a80, ast=0x7ffff2f47c40) at src/libponyc/ast/ast.c:361\r\n#6  0x0000000000431d1c in duplicate (parent=0x7ffff0524a80, ast=0x7ffff2f495c0) at src/libponyc/ast/ast.c:368\r\n#7  0x0000000000431d1c in duplicate (parent=0x7ffff0524a80, ast=0x7ffff2f49bc0) at src/libponyc/ast/ast.c:368\r\n#8  0x0000000000431c7c in duplicate (parent=0x7ffff0492cc0, ast=0x7ffff2f48a40) at src/libponyc/ast/ast.c:359\r\n#9  0x0000000000431d1c in duplicate (parent=0x7ffff0492cc0, ast=0x7ffff2f49e80) at src/libponyc/ast/ast.c:368\r\n#10 0x0000000000431d1c in duplicate (parent=0x7ffff0492cc0, ast=0x7ffff2f473c0) at src/libponyc/ast/ast.c:368\r\n#11 0x0000000000431d1c in duplicate (parent=0x7ffff0492cc0, ast=0x7ffff2f49d80) at src/libponyc/ast/ast.c:368\r\n#12 0x0000000000431d1c in duplicate (parent=0x7ffff0492cc0, ast=0x7ffff2f4a080) at src/libponyc/ast/ast.c:368\r\n#13 0x0000000000431d1c in duplicate (parent=0x7ffff0492cc0, ast=0x7ffff2f4a7c0) at src/libponyc/ast/ast.c:368\r\n#14 0x0000000000431d1c in duplicate (parent=0x7ffff0492cc0, ast=0x7ffff2f4a780) at src/libponyc/ast/ast.c:368\r\n#15 0x0000000000431c7c in duplicate (parent=0x0, ast=0x7ffff2f4a6c0) at src/libponyc/ast/ast.c:359\r\n#16 0x0000000000431b4c in ast_dup (ast=0x7ffff2f4a6c0) at src/libponyc/ast/ast.c:452\r\n#17 0x00000000004e11f4 in viewpoint_replace (ast=0x7ffff2f4a6c0, target=0x7ffff0534b40, with=0x7ffff0562480) at src/libponyc/type/viewpoint.c:388\r\n#18 0x00000000004e1545 in viewpoint_replacethis (ast=0x7ffff2f4a6c0, with=0x7ffff0562480) at src/libponyc/type/viewpoint.c:396\r\n#19 0x00000000004f2c9a in lookup_nominal (opt=0x7fffffffe258, from=0x7ffff0562480, orig=0x7ffff0562480, type=0x7ffff0562480, name=0x7ffff3527f40 \"create\", errors=true)\r\n    at src/libponyc/type/lookup.c:161\r\n#20 0x00000000004f20c4 in lookup_base (opt=0x7fffffffe258, from=0x7ffff0562480, orig=0x7ffff0562480, type=0x7ffff0562480, name=0x7ffff3527f40 \"create\", errors=true)\r\n    at src/libponyc/type/lookup.c:355\r\n#21 0x00000000004f1f37 in lookup (opt=0x7fffffffe258, from=0x7ffff0562480, type=0x7ffff0562480, name=0x7ffff3527f40 \"create\") at src/libponyc/type/lookup.c:384\r\n#22 0x0000000000485cc6 in genexe (c=0x7fffffffdda8, program=0x7ffff352fd40) at src/libponyc/codegen/genexe.c:382\r\n#23 0x000000000046b47b in codegen (program=0x7ffff352fd40, opt=0x7fffffffe258) at src/libponyc/codegen/codegen.c:1000\r\n#24 0x000000000044b4c3 in generate_passes (program=0x7ffff352fd40, options=0x7fffffffe258) at src/libponyc/pass/pass.c:291\r\n#25 0x000000000043099d in compile_package (path=0x50cd5e \".\", opt=0x7fffffffe258, print_program_ast=false, print_package_ast=false) at src/ponyc/main.c:245\r\n#26 0x00000000004307d4 in main (argc=1, argv=0x7fffffffe3c8) at src/ponyc/main.c:367\r\n```\r\n\r\nIt looks like the annotation node gets a type assigned to it. It doesn't happen when annotating a type declaration, only when annotating an expression.\r\n\r\nAccording to `git bisect`, this bug was introduced in `f788bb9`."}}
{"actor":{"display_login":"Praetonus"}}