{"action":"created","comment":{"url":"https://api.github.com/repos/kLabz/haxe-react/pulls/comments/216152135","pull_request_review_id":153576362,"id":216152135,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxNjE1MjEzNQ==","diff_hunk":"@@ -6,60 +6,38 @@\n */\n package react;\n \n-import haxe.macro.Context;\n+#if macro\n+import haxe.macro.Context.*;\n import haxe.macro.Expr;\n-import haxe.macro.TypeTools;\n-\n-#if !macro\n-@:genericBuild(react.PartialMacro.build())\n+using tink.MacroApi;\n #end\n-class Partial<T> {}\n-\n-class PartialMacro {\n-\t#if macro\n-\tstatic function build()\n-\t{\n-\t\tswitch Context.getLocalType()\n-\t\t{\n-\t\t\t// Match when class's type parameter leads to an anonymous type (we convert to a complex type in the process to make it easier to work with)\n-\t\t\tcase TInst(_, [Context.followWithAbstracts(_) => TypeTools.toComplexType(_) => TAnonymous(fields)]):\n-\t\t\t\t// Add @:optional meta to all fields\n-\t\t\t\tvar newFields = fields.map(addMeta);\n-\t\t\t\treturn TAnonymous(newFields);\n-\n-\t\t\tdefault:\n-\t\t\t\tContext.fatalError('Type parameter should be an anonymous structure', Context.currentPos());\n-\t\t}\n-\n-\t\treturn null;\n-\t}\n-\n-\tstatic function addMeta(field: Field): Field\n-\t{\n-\t\t// Handle Null<T> and optional fields already parsed by the compiler\n-\t\tvar kind = switch (field.kind) {\n-\t\t\tcase FVar(TPath({\n-\t\t\t\t\tname: 'StdTypes',\n-\t\t\t\t\tsub: 'Null',\n-\t\t\t\t\tparams: [TPType(TPath(tpath))]\n-\t\t\t\t}), write):\n-\t\t\t\tFVar(TPath(tpath), write);\n-\n-\t\t\tdefault:\n-\t\t\t\tfield.kind;\n-\t\t}\n \n-\t\treturn {\n-\t\t\tname: field.name,\n-\t\t\tkind: kind,\n-\t\t\taccess: field.access,\n-\t\t\tmeta: field.meta.concat([{\n-\t\t\t\tname: ':optional',\n-\t\t\t\tparams: [],\n-\t\t\t\tpos: Context.currentPos()\n-\t\t\t}]),\n-\t\t\tpos: field.pos\n-\t\t};\n-\t}\n-\t#end\n-}\n+@:forward\n+abstract Partial<T>(T) {\n+  @:from static macro function ofAny(e:Expr) {\n+\n+\t\tvar expected = getExpectedType();\n+    \n+\t\tvar ret =\n+\t\t \tswitch followWithAbstracts(getExpectedType()) {\n+\t\t\t\tcase TDynamic(_): e;\n+\t\t\t\tcase TAnonymous(_.get().fields => fields):\n+\t\t\t\t\tvar t = TAnonymous([\n+\t\t\t\t\t\tfor (f in fields) {\n+\t\t\t\t\t\t\tname: f.name,\n+\t\t\t\t\t\t\tpos: e.pos,\n+\t\t\t\t\t\t\tkind: FProp('default', 'never', f.type.toComplex()),\n+\t\t\t\t\t\t\tmeta: [{ name: ':optional', params: [], pos: e.pos }]\n+\t\t\t\t\t\t}\n+\t\t\t\t\t]);//TODO: consider caching these\n+\n+\t\t\t\t\tmacro @:pos(e.pos) ($e:$t);","path":"src/lib/react/Partial.hx","position":83,"original_position":83,"commit_id":"691e464a36690239fab5a2af76dc7425f978ccd7","original_commit_id":"691e464a36690239fab5a2af76dc7425f978ccd7","user":{"login":"kLabz","id":6101998,"node_id":"MDQ6VXNlcjYxMDE5OTg=","avatar_url":"https://avatars2.githubusercontent.com/u/6101998?v=4","gravatar_id":"","url":"https://api.github.com/users/kLabz","html_url":"https://github.com/kLabz","followers_url":"https://api.github.com/users/kLabz/followers","following_url":"https://api.github.com/users/kLabz/following{/other_user}","gists_url":"https://api.github.com/users/kLabz/gists{/gist_id}","starred_url":"https://api.github.com/users/kLabz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kLabz/subscriptions","organizations_url":"https://api.github.com/users/kLabz/orgs","repos_url":"https://api.github.com/users/kLabz/repos","events_url":"https://api.github.com/users/kLabz/events{/privacy}","received_events_url":"https://api.github.com/users/kLabz/received_events","type":"User","site_admin":false},"body":"Well yeah there's an issue with this added `cast`, it makes `Partial<T>` behave as `Dynamic` :D I'll try to make it work with my codebase somehow.","created_at":"2018-09-09T09:14:57Z","updated_at":"2018-09-09T09:14:58Z","html_url":"https://github.com/kLabz/haxe-react/pull/4#discussion_r216152135","pull_request_url":"https://api.github.com/repos/kLabz/haxe-react/pulls/4","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/kLabz/haxe-react/pulls/comments/216152135"},"html":{"href":"https://github.com/kLabz/haxe-react/pull/4#discussion_r216152135"},"pull_request":{"href":"https://api.github.com/repos/kLabz/haxe-react/pulls/4"}},"in_reply_to_id":216150389},"pull_request":{"url":"https://api.github.com/repos/kLabz/haxe-react/pulls/4","id":214130217,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE0MTMwMjE3","html_url":"https://github.com/kLabz/haxe-react/pull/4","diff_url":"https://github.com/kLabz/haxe-react/pull/4.diff","patch_url":"https://github.com/kLabz/haxe-react/pull/4.patch","issue_url":"https://api.github.com/repos/kLabz/haxe-react/issues/4","number":4,"state":"closed","locked":false,"title":"Simplify partial state handling.","user":{"login":"back2dos","id":509501,"node_id":"MDQ6VXNlcjUwOTUwMQ==","avatar_url":"https://avatars3.githubusercontent.com/u/509501?v=4","gravatar_id":"","url":"https://api.github.com/users/back2dos","html_url":"https://github.com/back2dos","followers_url":"https://api.github.com/users/back2dos/followers","following_url":"https://api.github.com/users/back2dos/following{/other_user}","gists_url":"https://api.github.com/users/back2dos/gists{/gist_id}","starred_url":"https://api.github.com/users/back2dos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/back2dos/subscriptions","organizations_url":"https://api.github.com/users/back2dos/orgs","repos_url":"https://api.github.com/users/back2dos/repos","events_url":"https://api.github.com/users/back2dos/events{/privacy}","received_events_url":"https://api.github.com/users/back2dos/received_events","type":"User","site_admin":false},"body":"On a side note, it'd be nice if you could turn this on: https://travis-ci.org/kLabz/haxe-react/ ;)","created_at":"2018-09-09T06:13:39Z","updated_at":"2018-09-09T09:14:58Z","closed_at":"2018-09-09T08:14:48Z","merged_at":"2018-09-09T08:14:47Z","merge_commit_sha":"e7072267bbfcb65283e1b449aec3d44192164ba1","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/kLabz/haxe-react/pulls/4/commits","review_comments_url":"https://api.github.com/repos/kLabz/haxe-react/pulls/4/comments","review_comment_url":"https://api.github.com/repos/kLabz/haxe-react/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kLabz/haxe-react/issues/4/comments","statuses_url":"https://api.github.com/repos/kLabz/haxe-react/statuses/691e464a36690239fab5a2af76dc7425f978ccd7","head":{"label":"back2dos:next","ref":"next","sha":"691e464a36690239fab5a2af76dc7425f978ccd7","user":{"login":"back2dos","id":509501,"node_id":"MDQ6VXNlcjUwOTUwMQ==","avatar_url":"https://avatars3.githubusercontent.com/u/509501?v=4","gravatar_id":"","url":"https://api.github.com/users/back2dos","html_url":"https://github.com/back2dos","followers_url":"https://api.github.com/users/back2dos/followers","following_url":"https://api.github.com/users/back2dos/following{/other_user}","gists_url":"https://api.github.com/users/back2dos/gists{/gist_id}","starred_url":"https://api.github.com/users/back2dos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/back2dos/subscriptions","organizations_url":"https://api.github.com/users/back2dos/orgs","repos_url":"https://api.github.com/users/back2dos/repos","events_url":"https://api.github.com/users/back2dos/events{/privacy}","received_events_url":"https://api.github.com/users/back2dos/received_events","type":"User","site_admin":false},"repo":{"id":122471062,"node_id":"MDEwOlJlcG9zaXRvcnkxMjI0NzEwNjI=","name":"haxe-react","full_name":"back2dos/haxe-react","owner":{"login":"back2dos","id":509501,"node_id":"MDQ6VXNlcjUwOTUwMQ==","avatar_url":"https://avatars3.githubusercontent.com/u/509501?v=4","gravatar_id":"","url":"https://api.github.com/users/back2dos","html_url":"https://github.com/back2dos","followers_url":"https://api.github.com/users/back2dos/followers","following_url":"https://api.github.com/users/back2dos/following{/other_user}","gists_url":"https://api.github.com/users/back2dos/gists{/gist_id}","starred_url":"https://api.github.com/users/back2dos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/back2dos/subscriptions","organizations_url":"https://api.github.com/users/back2dos/orgs","repos_url":"https://api.github.com/users/back2dos/repos","events_url":"https://api.github.com/users/back2dos/events{/privacy}","received_events_url":"https://api.github.com/users/back2dos/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/back2dos/haxe-react","description":"React JS applications development using the Haxe language","fork":true,"url":"https://api.github.com/repos/back2dos/haxe-react","forks_url":"https://api.github.com/repos/back2dos/haxe-react/forks","keys_url":"https://api.github.com/repos/back2dos/haxe-react/keys{/key_id}","collaborators_url":"https://api.github.com/repos/back2dos/haxe-react/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/back2dos/haxe-react/teams","hooks_url":"https://api.github.com/repos/back2dos/haxe-react/hooks","issue_events_url":"https://api.github.com/repos/back2dos/haxe-react/issues/events{/number}","events_url":"https://api.github.com/repos/back2dos/haxe-react/events","assignees_url":"https://api.github.com/repos/back2dos/haxe-react/assignees{/user}","branches_url":"https://api.github.com/repos/back2dos/haxe-react/branches{/branch}","tags_url":"https://api.github.com/repos/back2dos/haxe-react/tags","blobs_url":"https://api.github.com/repos/back2dos/haxe-react/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/back2dos/haxe-react/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/back2dos/haxe-react/git/refs{/sha}","trees_url":"https://api.github.com/repos/back2dos/haxe-react/git/trees{/sha}","statuses_url":"https://api.github.com/repos/back2dos/haxe-react/statuses/{sha}","languages_url":"https://api.github.com/repos/back2dos/haxe-react/languages","stargazers_url":"https://api.github.com/repos/back2dos/haxe-react/stargazers","contributors_url":"https://api.github.com/repos/back2dos/haxe-react/contributors","subscribers_url":"https://api.github.com/repos/back2dos/haxe-react/subscribers","subscription_url":"https://api.github.com/repos/back2dos/haxe-react/subscription","commits_url":"https://api.github.com/repos/back2dos/haxe-react/commits{/sha}","git_commits_url":"https://api.github.com/repos/back2dos/haxe-react/git/commits{/sha}","comments_url":"https://api.github.com/repos/back2dos/haxe-react/comments{/number}","issue_comment_url":"https://api.github.com/repos/back2dos/haxe-react/issues/comments{/number}","contents_url":"https://api.github.com/repos/back2dos/haxe-react/contents/{+path}","compare_url":"https://api.github.com/repos/back2dos/haxe-react/compare/{base}...{head}","merges_url":"https://api.github.com/repos/back2dos/haxe-react/merges","archive_url":"https://api.github.com/repos/back2dos/haxe-react/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/back2dos/haxe-react/downloads","issues_url":"https://api.github.com/repos/back2dos/haxe-react/issues{/number}","pulls_url":"https://api.github.com/repos/back2dos/haxe-react/pulls{/number}","milestones_url":"https://api.github.com/repos/back2dos/haxe-react/milestones{/number}","notifications_url":"https://api.github.com/repos/back2dos/haxe-react/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/back2dos/haxe-react/labels{/name}","releases_url":"https://api.github.com/repos/back2dos/haxe-react/releases{/id}","deployments_url":"https://api.github.com/repos/back2dos/haxe-react/deployments","created_at":"2018-02-22T11:42:41Z","updated_at":"2018-02-22T11:42:43Z","pushed_at":"2018-09-09T06:41:51Z","git_url":"git://github.com/back2dos/haxe-react.git","ssh_url":"git@github.com:back2dos/haxe-react.git","clone_url":"https://github.com/back2dos/haxe-react.git","svn_url":"https://github.com/back2dos/haxe-react","homepage":"","size":1190,"stargazers_count":0,"watchers_count":0,"language":"Haxe","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"kLabz:next","ref":"next","sha":"3849d9c3fba26f3ec8e37111d68ef8930cd908b2","user":{"login":"kLabz","id":6101998,"node_id":"MDQ6VXNlcjYxMDE5OTg=","avatar_url":"https://avatars2.githubusercontent.com/u/6101998?v=4","gravatar_id":"","url":"https://api.github.com/users/kLabz","html_url":"https://github.com/kLabz","followers_url":"https://api.github.com/users/kLabz/followers","following_url":"https://api.github.com/users/kLabz/following{/other_user}","gists_url":"https://api.github.com/users/kLabz/gists{/gist_id}","starred_url":"https://api.github.com/users/kLabz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kLabz/subscriptions","organizations_url":"https://api.github.com/users/kLabz/orgs","repos_url":"https://api.github.com/users/kLabz/repos","events_url":"https://api.github.com/users/kLabz/events{/privacy}","received_events_url":"https://api.github.com/users/kLabz/received_events","type":"User","site_admin":false},"repo":{"id":89694764,"node_id":"MDEwOlJlcG9zaXRvcnk4OTY5NDc2NA==","name":"haxe-react","full_name":"kLabz/haxe-react","owner":{"login":"kLabz","id":6101998,"node_id":"MDQ6VXNlcjYxMDE5OTg=","avatar_url":"https://avatars2.githubusercontent.com/u/6101998?v=4","gravatar_id":"","url":"https://api.github.com/users/kLabz","html_url":"https://github.com/kLabz","followers_url":"https://api.github.com/users/kLabz/followers","following_url":"https://api.github.com/users/kLabz/following{/other_user}","gists_url":"https://api.github.com/users/kLabz/gists{/gist_id}","starred_url":"https://api.github.com/users/kLabz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kLabz/subscriptions","organizations_url":"https://api.github.com/users/kLabz/orgs","repos_url":"https://api.github.com/users/kLabz/repos","events_url":"https://api.github.com/users/kLabz/events{/privacy}","received_events_url":"https://api.github.com/users/kLabz/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kLabz/haxe-react","description":"React JS applications development using the Haxe language","fork":true,"url":"https://api.github.com/repos/kLabz/haxe-react","forks_url":"https://api.github.com/repos/kLabz/haxe-react/forks","keys_url":"https://api.github.com/repos/kLabz/haxe-react/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kLabz/haxe-react/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kLabz/haxe-react/teams","hooks_url":"https://api.github.com/repos/kLabz/haxe-react/hooks","issue_events_url":"https://api.github.com/repos/kLabz/haxe-react/issues/events{/number}","events_url":"https://api.github.com/repos/kLabz/haxe-react/events","assignees_url":"https://api.github.com/repos/kLabz/haxe-react/assignees{/user}","branches_url":"https://api.github.com/repos/kLabz/haxe-react/branches{/branch}","tags_url":"https://api.github.com/repos/kLabz/haxe-react/tags","blobs_url":"https://api.github.com/repos/kLabz/haxe-react/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kLabz/haxe-react/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kLabz/haxe-react/git/refs{/sha}","trees_url":"https://api.github.com/repos/kLabz/haxe-react/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kLabz/haxe-react/statuses/{sha}","languages_url":"https://api.github.com/repos/kLabz/haxe-react/languages","stargazers_url":"https://api.github.com/repos/kLabz/haxe-react/stargazers","contributors_url":"https://api.github.com/repos/kLabz/haxe-react/contributors","subscribers_url":"https://api.github.com/repos/kLabz/haxe-react/subscribers","subscription_url":"https://api.github.com/repos/kLabz/haxe-react/subscription","commits_url":"https://api.github.com/repos/kLabz/haxe-react/commits{/sha}","git_commits_url":"https://api.github.com/repos/kLabz/haxe-react/git/commits{/sha}","comments_url":"https://api.github.com/repos/kLabz/haxe-react/comments{/number}","issue_comment_url":"https://api.github.com/repos/kLabz/haxe-react/issues/comments{/number}","contents_url":"https://api.github.com/repos/kLabz/haxe-react/contents/{+path}","compare_url":"https://api.github.com/repos/kLabz/haxe-react/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kLabz/haxe-react/merges","archive_url":"https://api.github.com/repos/kLabz/haxe-react/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kLabz/haxe-react/downloads","issues_url":"https://api.github.com/repos/kLabz/haxe-react/issues{/number}","pulls_url":"https://api.github.com/repos/kLabz/haxe-react/pulls{/number}","milestones_url":"https://api.github.com/repos/kLabz/haxe-react/milestones{/number}","notifications_url":"https://api.github.com/repos/kLabz/haxe-react/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kLabz/haxe-react/labels{/name}","releases_url":"https://api.github.com/repos/kLabz/haxe-react/releases{/id}","deployments_url":"https://api.github.com/repos/kLabz/haxe-react/deployments","created_at":"2017-04-28T10:14:53Z","updated_at":"2018-09-09T08:29:29Z","pushed_at":"2018-09-09T08:29:28Z","git_url":"git://github.com/kLabz/haxe-react.git","ssh_url":"git@github.com:kLabz/haxe-react.git","clone_url":"https://github.com/kLabz/haxe-react.git","svn_url":"https://github.com/kLabz/haxe-react","homepage":"","size":1226,"stargazers_count":0,"watchers_count":0,"language":"Haxe","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"next"}},"_links":{"self":{"href":"https://api.github.com/repos/kLabz/haxe-react/pulls/4"},"html":{"href":"https://github.com/kLabz/haxe-react/pull/4"},"issue":{"href":"https://api.github.com/repos/kLabz/haxe-react/issues/4"},"comments":{"href":"https://api.github.com/repos/kLabz/haxe-react/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/kLabz/haxe-react/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/kLabz/haxe-react/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kLabz/haxe-react/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/kLabz/haxe-react/statuses/691e464a36690239fab5a2af76dc7425f978ccd7"}},"author_association":"NONE"}}
{"actor":{"display_login":"kLabz"}}