{"action":"created","comment":{"url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/pulls/comments/224978698","pull_request_review_id":164483889,"id":224978698,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyNDk3ODY5OA==","diff_hunk":"@@ -1,8 +1,8 @@\n type Person record {","path":"tests/ballerina-unit-test/src/test/resources/test-src/expressions/lambda/struct-function-pointers.bal","position":1,"original_position":1,"commit_id":"83e02fde78f777a24c27abe662701c4dac5df3a6","original_commit_id":"83e02fde78f777a24c27abe662701c4dac5df3a6","user":{"login":"NatashaWso2","id":13446645,"node_id":"MDQ6VXNlcjEzNDQ2NjQ1","avatar_url":"https://avatars3.githubusercontent.com/u/13446645?v=4","gravatar_id":"","url":"https://api.github.com/users/NatashaWso2","html_url":"https://github.com/NatashaWso2","followers_url":"https://api.github.com/users/NatashaWso2/followers","following_url":"https://api.github.com/users/NatashaWso2/following{/other_user}","gists_url":"https://api.github.com/users/NatashaWso2/gists{/gist_id}","starred_url":"https://api.github.com/users/NatashaWso2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NatashaWso2/subscriptions","organizations_url":"https://api.github.com/users/NatashaWso2/orgs","repos_url":"https://api.github.com/users/NatashaWso2/repos","events_url":"https://api.github.com/users/NatashaWso2/events{/privacy}","received_events_url":"https://api.github.com/users/NatashaWso2/received_events","type":"User","site_admin":false},"body":"Shall we add the license header?\r\n\r\n","created_at":"2018-10-14T03:51:44Z","updated_at":"2018-10-14T03:51:44Z","html_url":"https://github.com/ballerina-platform/ballerina-lang/pull/10710#discussion_r224978698","pull_request_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/pulls/10710","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/ballerina-platform/ballerina-lang/pulls/comments/224978698"},"html":{"href":"https://github.com/ballerina-platform/ballerina-lang/pull/10710#discussion_r224978698"},"pull_request":{"href":"https://api.github.com/repos/ballerina-platform/ballerina-lang/pulls/10710"}}},"pull_request":{"url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/pulls/10710","id":220679063,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIwNjc5MDYz","html_url":"https://github.com/ballerina-platform/ballerina-lang/pull/10710","diff_url":"https://github.com/ballerina-platform/ballerina-lang/pull/10710.diff","patch_url":"https://github.com/ballerina-platform/ballerina-lang/pull/10710.patch","issue_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/issues/10710","number":10710,"state":"open","locked":false,"title":"Add support for optional fields","user":{"login":"pubudu91","id":6260009,"node_id":"MDQ6VXNlcjYyNjAwMDk=","avatar_url":"https://avatars2.githubusercontent.com/u/6260009?v=4","gravatar_id":"","url":"https://api.github.com/users/pubudu91","html_url":"https://github.com/pubudu91","followers_url":"https://api.github.com/users/pubudu91/followers","following_url":"https://api.github.com/users/pubudu91/following{/other_user}","gists_url":"https://api.github.com/users/pubudu91/gists{/gist_id}","starred_url":"https://api.github.com/users/pubudu91/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pubudu91/subscriptions","organizations_url":"https://api.github.com/users/pubudu91/orgs","repos_url":"https://api.github.com/users/pubudu91/repos","events_url":"https://api.github.com/users/pubudu91/events{/privacy}","received_events_url":"https://api.github.com/users/pubudu91/received_events","type":"User","site_admin":false},"body":"## Purpose\r\n> This PR adds support for optional fields in records. Users can use the `?` operator after a field identifier in the record definition to mark that field as optional. Fix #10628 \r\n\r\n## Goals\r\n> Describe the solutions that this feature/fix will introduce to resolve the problems described above\r\n\r\n## Approach\r\n>- A new flag (`OPTIONAL`) was introduced to mark optional fields.\r\n>- When building the field nodes, if a field is optional, the `OPTIONAL` flag is added to it. In addition to that, if there is an explicit expression available to be used as the default value of the field, it's marked with the `DEFAULTABLE` flag.\r\n>- The TypeChecker logic for record literals was improved to include a check to ensure all the non-defaultable required fields of the record type is there in the literal.\r\n>- For optional fields, a field key is not added to the record. If using field based access to accesss a non-existent optional field, it'll throw a runtime error. If index based access is used, it will return nil.\r\n\r\n## Samples\r\n```ballerina\r\ntype CountryCode \"LK\"|\"USA\"|\"UK\";\r\n\r\ntype Person record {\r\n    string fname = \"default\";\r\n    string lname?;\r\n    int age? = 999;\r\n    Address adrs;\r\n};\r\n\r\ntype Address record {\r\n    string street;\r\n    string city;\r\n    CountryCode country;\r\n};\r\n\r\nfunction test() {\r\n    Person p1 = {adrs:{country: \"LK\"}}; \r\n    Person p2 = {}; // compile error\r\n    io:println(p1.adrs); // runtime error\r\n    io:println(p1[\"adrs\"]); // nil is returned\r\n}\r\n```\r\n## Related PRs\r\n> PR #10632 should be merged before this","created_at":"2018-10-05T12:05:43Z","updated_at":"2018-10-14T03:51:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2ee9cf68da51fe7dd57f39fb26820e2b62366ffb","assignee":null,"assignees":[],"requested_reviewers":[{"login":"hasithaa","id":1356214,"node_id":"MDQ6VXNlcjEzNTYyMTQ=","avatar_url":"https://avatars0.githubusercontent.com/u/1356214?v=4","gravatar_id":"","url":"https://api.github.com/users/hasithaa","html_url":"https://github.com/hasithaa","followers_url":"https://api.github.com/users/hasithaa/followers","following_url":"https://api.github.com/users/hasithaa/following{/other_user}","gists_url":"https://api.github.com/users/hasithaa/gists{/gist_id}","starred_url":"https://api.github.com/users/hasithaa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hasithaa/subscriptions","organizations_url":"https://api.github.com/users/hasithaa/orgs","repos_url":"https://api.github.com/users/hasithaa/repos","events_url":"https://api.github.com/users/hasithaa/events{/privacy}","received_events_url":"https://api.github.com/users/hasithaa/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":828131785,"node_id":"MDU6TGFiZWw4MjgxMzE3ODU=","url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/labels/Component/BVM","name":"Component/BVM","color":"0b6664","default":false},{"id":828131123,"node_id":"MDU6TGFiZWw4MjgxMzExMjM=","url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/labels/Component/Compiler","name":"Component/Compiler","color":"0b6664","default":false},{"id":684576184,"node_id":"MDU6TGFiZWw2ODQ1NzYxODQ=","url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/labels/Type/New%20Feature","name":"Type/New Feature","color":"1d76db","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/pulls/10710/commits","review_comments_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/pulls/10710/comments","review_comment_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/issues/10710/comments","statuses_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/statuses/83e02fde78f777a24c27abe662701c4dac5df3a6","head":{"label":"pubudu91:rec-optional-fields","ref":"rec-optional-fields","sha":"83e02fde78f777a24c27abe662701c4dac5df3a6","user":{"login":"pubudu91","id":6260009,"node_id":"MDQ6VXNlcjYyNjAwMDk=","avatar_url":"https://avatars2.githubusercontent.com/u/6260009?v=4","gravatar_id":"","url":"https://api.github.com/users/pubudu91","html_url":"https://github.com/pubudu91","followers_url":"https://api.github.com/users/pubudu91/followers","following_url":"https://api.github.com/users/pubudu91/following{/other_user}","gists_url":"https://api.github.com/users/pubudu91/gists{/gist_id}","starred_url":"https://api.github.com/users/pubudu91/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pubudu91/subscriptions","organizations_url":"https://api.github.com/users/pubudu91/orgs","repos_url":"https://api.github.com/users/pubudu91/repos","events_url":"https://api.github.com/users/pubudu91/events{/privacy}","received_events_url":"https://api.github.com/users/pubudu91/received_events","type":"User","site_admin":false},"repo":{"id":88832164,"node_id":"MDEwOlJlcG9zaXRvcnk4ODgzMjE2NA==","name":"ballerina","full_name":"pubudu91/ballerina","private":false,"owner":{"login":"pubudu91","id":6260009,"node_id":"MDQ6VXNlcjYyNjAwMDk=","avatar_url":"https://avatars2.githubusercontent.com/u/6260009?v=4","gravatar_id":"","url":"https://api.github.com/users/pubudu91","html_url":"https://github.com/pubudu91","followers_url":"https://api.github.com/users/pubudu91/followers","following_url":"https://api.github.com/users/pubudu91/following{/other_user}","gists_url":"https://api.github.com/users/pubudu91/gists{/gist_id}","starred_url":"https://api.github.com/users/pubudu91/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pubudu91/subscriptions","organizations_url":"https://api.github.com/users/pubudu91/orgs","repos_url":"https://api.github.com/users/pubudu91/repos","events_url":"https://api.github.com/users/pubudu91/events{/privacy}","received_events_url":"https://api.github.com/users/pubudu91/received_events","type":"User","site_admin":false},"html_url":"https://github.com/pubudu91/ballerina","description":"Ballerina is a new programming language for integration built on a sequence diagram metaphor.","fork":true,"url":"https://api.github.com/repos/pubudu91/ballerina","forks_url":"https://api.github.com/repos/pubudu91/ballerina/forks","keys_url":"https://api.github.com/repos/pubudu91/ballerina/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pubudu91/ballerina/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pubudu91/ballerina/teams","hooks_url":"https://api.github.com/repos/pubudu91/ballerina/hooks","issue_events_url":"https://api.github.com/repos/pubudu91/ballerina/issues/events{/number}","events_url":"https://api.github.com/repos/pubudu91/ballerina/events","assignees_url":"https://api.github.com/repos/pubudu91/ballerina/assignees{/user}","branches_url":"https://api.github.com/repos/pubudu91/ballerina/branches{/branch}","tags_url":"https://api.github.com/repos/pubudu91/ballerina/tags","blobs_url":"https://api.github.com/repos/pubudu91/ballerina/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pubudu91/ballerina/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pubudu91/ballerina/git/refs{/sha}","trees_url":"https://api.github.com/repos/pubudu91/ballerina/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pubudu91/ballerina/statuses/{sha}","languages_url":"https://api.github.com/repos/pubudu91/ballerina/languages","stargazers_url":"https://api.github.com/repos/pubudu91/ballerina/stargazers","contributors_url":"https://api.github.com/repos/pubudu91/ballerina/contributors","subscribers_url":"https://api.github.com/repos/pubudu91/ballerina/subscribers","subscription_url":"https://api.github.com/repos/pubudu91/ballerina/subscription","commits_url":"https://api.github.com/repos/pubudu91/ballerina/commits{/sha}","git_commits_url":"https://api.github.com/repos/pubudu91/ballerina/git/commits{/sha}","comments_url":"https://api.github.com/repos/pubudu91/ballerina/comments{/number}","issue_comment_url":"https://api.github.com/repos/pubudu91/ballerina/issues/comments{/number}","contents_url":"https://api.github.com/repos/pubudu91/ballerina/contents/{+path}","compare_url":"https://api.github.com/repos/pubudu91/ballerina/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pubudu91/ballerina/merges","archive_url":"https://api.github.com/repos/pubudu91/ballerina/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pubudu91/ballerina/downloads","issues_url":"https://api.github.com/repos/pubudu91/ballerina/issues{/number}","pulls_url":"https://api.github.com/repos/pubudu91/ballerina/pulls{/number}","milestones_url":"https://api.github.com/repos/pubudu91/ballerina/milestones{/number}","notifications_url":"https://api.github.com/repos/pubudu91/ballerina/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pubudu91/ballerina/labels{/name}","releases_url":"https://api.github.com/repos/pubudu91/ballerina/releases{/id}","deployments_url":"https://api.github.com/repos/pubudu91/ballerina/deployments","created_at":"2017-04-20T07:04:37Z","updated_at":"2018-04-25T18:17:23Z","pushed_at":"2018-10-12T06:52:03Z","git_url":"git://github.com/pubudu91/ballerina.git","ssh_url":"git@github.com:pubudu91/ballerina.git","clone_url":"https://github.com/pubudu91/ballerina.git","svn_url":"https://github.com/pubudu91/ballerina","homepage":"","size":261846,"stargazers_count":0,"watchers_count":0,"language":"Java","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":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ballerina-platform:master","ref":"master","sha":"56921afd8358ff652d4dddba50fb969fc0e4915e","user":{"login":"ballerina-platform","id":34733518,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM0NzMzNTE4","avatar_url":"https://avatars2.githubusercontent.com/u/34733518?v=4","gravatar_id":"","url":"https://api.github.com/users/ballerina-platform","html_url":"https://github.com/ballerina-platform","followers_url":"https://api.github.com/users/ballerina-platform/followers","following_url":"https://api.github.com/users/ballerina-platform/following{/other_user}","gists_url":"https://api.github.com/users/ballerina-platform/gists{/gist_id}","starred_url":"https://api.github.com/users/ballerina-platform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ballerina-platform/subscriptions","organizations_url":"https://api.github.com/users/ballerina-platform/orgs","repos_url":"https://api.github.com/users/ballerina-platform/repos","events_url":"https://api.github.com/users/ballerina-platform/events{/privacy}","received_events_url":"https://api.github.com/users/ballerina-platform/received_events","type":"Organization","site_admin":false},"repo":{"id":73930305,"node_id":"MDEwOlJlcG9zaXRvcnk3MzkzMDMwNQ==","name":"ballerina-lang","full_name":"ballerina-platform/ballerina-lang","private":false,"owner":{"login":"ballerina-platform","id":34733518,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM0NzMzNTE4","avatar_url":"https://avatars2.githubusercontent.com/u/34733518?v=4","gravatar_id":"","url":"https://api.github.com/users/ballerina-platform","html_url":"https://github.com/ballerina-platform","followers_url":"https://api.github.com/users/ballerina-platform/followers","following_url":"https://api.github.com/users/ballerina-platform/following{/other_user}","gists_url":"https://api.github.com/users/ballerina-platform/gists{/gist_id}","starred_url":"https://api.github.com/users/ballerina-platform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ballerina-platform/subscriptions","organizations_url":"https://api.github.com/users/ballerina-platform/orgs","repos_url":"https://api.github.com/users/ballerina-platform/repos","events_url":"https://api.github.com/users/ballerina-platform/events{/privacy}","received_events_url":"https://api.github.com/users/ballerina-platform/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/ballerina-platform/ballerina-lang","description":"Ballerina is a compiled, transactional, statically and strongly typed programming language with textual and graphical syntaxes.","fork":false,"url":"https://api.github.com/repos/ballerina-platform/ballerina-lang","forks_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/forks","keys_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/teams","hooks_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/hooks","issue_events_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/issues/events{/number}","events_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/events","assignees_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/assignees{/user}","branches_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/branches{/branch}","tags_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/tags","blobs_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/git/refs{/sha}","trees_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/statuses/{sha}","languages_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/languages","stargazers_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/stargazers","contributors_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/contributors","subscribers_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/subscribers","subscription_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/subscription","commits_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/commits{/sha}","git_commits_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/git/commits{/sha}","comments_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/comments{/number}","issue_comment_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/issues/comments{/number}","contents_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/contents/{+path}","compare_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/merges","archive_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/downloads","issues_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/issues{/number}","pulls_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/pulls{/number}","milestones_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/milestones{/number}","notifications_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/labels{/name}","releases_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/releases{/id}","deployments_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/deployments","created_at":"2016-11-16T14:58:44Z","updated_at":"2018-10-14T00:04:14Z","pushed_at":"2018-10-14T00:04:06Z","git_url":"git://github.com/ballerina-platform/ballerina-lang.git","ssh_url":"git@github.com:ballerina-platform/ballerina-lang.git","clone_url":"https://github.com/ballerina-platform/ballerina-lang.git","svn_url":"https://github.com/ballerina-platform/ballerina-lang","homepage":"","size":261898,"stargazers_count":1421,"watchers_count":1421,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":399,"mirror_url":null,"archived":false,"open_issues_count":504,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":399,"open_issues":504,"watchers":1421,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ballerina-platform/ballerina-lang/pulls/10710"},"html":{"href":"https://github.com/ballerina-platform/ballerina-lang/pull/10710"},"issue":{"href":"https://api.github.com/repos/ballerina-platform/ballerina-lang/issues/10710"},"comments":{"href":"https://api.github.com/repos/ballerina-platform/ballerina-lang/issues/10710/comments"},"review_comments":{"href":"https://api.github.com/repos/ballerina-platform/ballerina-lang/pulls/10710/comments"},"review_comment":{"href":"https://api.github.com/repos/ballerina-platform/ballerina-lang/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ballerina-platform/ballerina-lang/pulls/10710/commits"},"statuses":{"href":"https://api.github.com/repos/ballerina-platform/ballerina-lang/statuses/83e02fde78f777a24c27abe662701c4dac5df3a6"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"NatashaWso2"}}