{"action":"created","comment":{"url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/pulls/comments/200006993","pull_request_review_id":134235988,"id":200006993,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwMDAwNjk5Mw==","diff_hunk":"@@ -4011,11 +3958,72 @@ private static boolean isValidMapInsertion(BType mapType, BValue value) {\n         return false;\n     }\n \n+    @Deprecated\n     private static boolean checkFunctionCast(BValue value, BType lhsType) {\n-        if (value.getType().getTag() != TypeTags.FUNCTION_POINTER_TAG) {\n+        return checkFunctionCast(value.getType(), lhsType);\n+    }\n+\n+    public static boolean isAssignable(BType sourceType, BType targetType) {\n+        if (targetType.getTag() == TypeTags.UNION_TAG) {\n+            return checkUnionAssignable(sourceType, targetType);\n+        }\n+\n+        // TODO: 6/26/18 complete impl. for JSON assignable\n+        if (targetType.getTag() == TypeTags.JSON_TAG && sourceType.getTag() == TypeTags.JSON_TAG) {\n+            return true;\n+        }\n+\n+        if (targetType.getTag() == TypeTags.ARRAY_TAG && sourceType.getTag() == TypeTags.ARRAY_TAG) {\n+            return checkArrayCast(((BArrayType) sourceType).getElementType(),\n+                                  ((BArrayType) targetType).getElementType());\n+        }\n+\n+        if (sourceType.getTag() == TypeTags.TUPLE_TAG && targetType.getTag() == TypeTags.TUPLE_TAG) {\n+            return checkTupleAssignable(sourceType, targetType);\n+        }\n+\n+        return checkCast(sourceType, targetType);\n+    }\n+\n+    private static boolean checkUnionAssignable(BType sourceType, BType targetType) {\n+        if (sourceType.getTag() == TypeTags.UNION_TAG) {\n+            for (BType sourceMemberType : ((BUnionType) sourceType).getMemberTypes()) {\n+                if (!checkUnionAssignable(sourceMemberType, targetType)) {\n+                    return false;\n+                }\n+            }\n+            return true;\n+        } else {\n+            BUnionType targetUnionType = (BUnionType) targetType;\n+            for (BType memberType : targetUnionType.getMemberTypes()) {\n+                if (isAssignable(sourceType, memberType)) {\n+                    return true;\n+                }\n+            }\n+            return false;\n+        }\n+    }\n+\n+    private static boolean checkTupleAssignable(BType sourceType, BType targetType) {","path":"bvm/ballerina-core/src/main/java/org/ballerinalang/bre/bvm/CPU.java","position":294,"original_position":253,"commit_id":"d238e8befa7115bb4e02eabae96957a82614dc71","original_commit_id":"f29cb1ae9b5a41d28c7108b4f385e5c258b50c4b","user":{"login":"MaryamZi","id":8376983,"node_id":"MDQ6VXNlcjgzNzY5ODM=","avatar_url":"https://avatars1.githubusercontent.com/u/8376983?v=4","gravatar_id":"","url":"https://api.github.com/users/MaryamZi","html_url":"https://github.com/MaryamZi","followers_url":"https://api.github.com/users/MaryamZi/followers","following_url":"https://api.github.com/users/MaryamZi/following{/other_user}","gists_url":"https://api.github.com/users/MaryamZi/gists{/gist_id}","starred_url":"https://api.github.com/users/MaryamZi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MaryamZi/subscriptions","organizations_url":"https://api.github.com/users/MaryamZi/orgs","repos_url":"https://api.github.com/users/MaryamZi/repos","events_url":"https://api.github.com/users/MaryamZi/events{/privacy}","received_events_url":"https://api.github.com/users/MaryamZi/received_events","type":"User","site_admin":false},"body":"Had to have two separate methods since a check by value is required in the case of finite types.","created_at":"2018-07-04T04:41:30Z","updated_at":"2018-07-04T04:41:30Z","html_url":"https://github.com/ballerina-platform/ballerina-lang/pull/9273#discussion_r200006993","pull_request_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/pulls/9273","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/ballerina-platform/ballerina-lang/pulls/comments/200006993"},"html":{"href":"https://github.com/ballerina-platform/ballerina-lang/pull/9273#discussion_r200006993"},"pull_request":{"href":"https://api.github.com/repos/ballerina-platform/ballerina-lang/pulls/9273"}},"in_reply_to_id":199432497},"pull_request":{"url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/pulls/9273","id":197795253,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk3Nzk1MjUz","html_url":"https://github.com/ballerina-platform/ballerina-lang/pull/9273","diff_url":"https://github.com/ballerina-platform/ballerina-lang/pull/9273.diff","patch_url":"https://github.com/ballerina-platform/ballerina-lang/pull/9273.patch","issue_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/issues/9273","number":9273,"state":"open","locked":false,"title":"Allow assignable types/values with streams","user":{"login":"MaryamZi","id":8376983,"node_id":"MDQ6VXNlcjgzNzY5ODM=","avatar_url":"https://avatars1.githubusercontent.com/u/8376983?v=4","gravatar_id":"","url":"https://api.github.com/users/MaryamZi","html_url":"https://github.com/MaryamZi","followers_url":"https://api.github.com/users/MaryamZi/followers","following_url":"https://api.github.com/users/MaryamZi/following{/other_user}","gists_url":"https://api.github.com/users/MaryamZi/gists{/gist_id}","starred_url":"https://api.github.com/users/MaryamZi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MaryamZi/subscriptions","organizations_url":"https://api.github.com/users/MaryamZi/orgs","repos_url":"https://api.github.com/users/MaryamZi/repos","events_url":"https://api.github.com/users/MaryamZi/events{/privacy}","received_events_url":"https://api.github.com/users/MaryamZi/received_events","type":"User","site_admin":false},"body":"## Purpose\r\nAllow assignable types/values with streams.\r\n\r\nFix #8999 ","created_at":"2018-06-27T17:00:41Z","updated_at":"2018-07-04T04:41:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9c70b634eff517079121c6752fca61acd0834bb7","assignee":null,"assignees":[],"requested_reviewers":[],"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}],"milestone":null,"commits_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/pulls/9273/commits","review_comments_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/pulls/9273/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/9273/comments","statuses_url":"https://api.github.com/repos/ballerina-platform/ballerina-lang/statuses/d238e8befa7115bb4e02eabae96957a82614dc71","head":{"label":"MaryamZi:stream-contr-allow-assignable","ref":"stream-contr-allow-assignable","sha":"d238e8befa7115bb4e02eabae96957a82614dc71","user":{"login":"MaryamZi","id":8376983,"node_id":"MDQ6VXNlcjgzNzY5ODM=","avatar_url":"https://avatars1.githubusercontent.com/u/8376983?v=4","gravatar_id":"","url":"https://api.github.com/users/MaryamZi","html_url":"https://github.com/MaryamZi","followers_url":"https://api.github.com/users/MaryamZi/followers","following_url":"https://api.github.com/users/MaryamZi/following{/other_user}","gists_url":"https://api.github.com/users/MaryamZi/gists{/gist_id}","starred_url":"https://api.github.com/users/MaryamZi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MaryamZi/subscriptions","organizations_url":"https://api.github.com/users/MaryamZi/orgs","repos_url":"https://api.github.com/users/MaryamZi/repos","events_url":"https://api.github.com/users/MaryamZi/events{/privacy}","received_events_url":"https://api.github.com/users/MaryamZi/received_events","type":"User","site_admin":false},"repo":{"id":119959335,"node_id":"MDEwOlJlcG9zaXRvcnkxMTk5NTkzMzU=","name":"ballerina","full_name":"MaryamZi/ballerina","owner":{"login":"MaryamZi","id":8376983,"node_id":"MDQ6VXNlcjgzNzY5ODM=","avatar_url":"https://avatars1.githubusercontent.com/u/8376983?v=4","gravatar_id":"","url":"https://api.github.com/users/MaryamZi","html_url":"https://github.com/MaryamZi","followers_url":"https://api.github.com/users/MaryamZi/followers","following_url":"https://api.github.com/users/MaryamZi/following{/other_user}","gists_url":"https://api.github.com/users/MaryamZi/gists{/gist_id}","starred_url":"https://api.github.com/users/MaryamZi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MaryamZi/subscriptions","organizations_url":"https://api.github.com/users/MaryamZi/orgs","repos_url":"https://api.github.com/users/MaryamZi/repos","events_url":"https://api.github.com/users/MaryamZi/events{/privacy}","received_events_url":"https://api.github.com/users/MaryamZi/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/MaryamZi/ballerina","description":"Ballerina is a new programming language for integration built on a sequence diagram metaphor.","fork":true,"url":"https://api.github.com/repos/MaryamZi/ballerina","forks_url":"https://api.github.com/repos/MaryamZi/ballerina/forks","keys_url":"https://api.github.com/repos/MaryamZi/ballerina/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MaryamZi/ballerina/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MaryamZi/ballerina/teams","hooks_url":"https://api.github.com/repos/MaryamZi/ballerina/hooks","issue_events_url":"https://api.github.com/repos/MaryamZi/ballerina/issues/events{/number}","events_url":"https://api.github.com/repos/MaryamZi/ballerina/events","assignees_url":"https://api.github.com/repos/MaryamZi/ballerina/assignees{/user}","branches_url":"https://api.github.com/repos/MaryamZi/ballerina/branches{/branch}","tags_url":"https://api.github.com/repos/MaryamZi/ballerina/tags","blobs_url":"https://api.github.com/repos/MaryamZi/ballerina/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MaryamZi/ballerina/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MaryamZi/ballerina/git/refs{/sha}","trees_url":"https://api.github.com/repos/MaryamZi/ballerina/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MaryamZi/ballerina/statuses/{sha}","languages_url":"https://api.github.com/repos/MaryamZi/ballerina/languages","stargazers_url":"https://api.github.com/repos/MaryamZi/ballerina/stargazers","contributors_url":"https://api.github.com/repos/MaryamZi/ballerina/contributors","subscribers_url":"https://api.github.com/repos/MaryamZi/ballerina/subscribers","subscription_url":"https://api.github.com/repos/MaryamZi/ballerina/subscription","commits_url":"https://api.github.com/repos/MaryamZi/ballerina/commits{/sha}","git_commits_url":"https://api.github.com/repos/MaryamZi/ballerina/git/commits{/sha}","comments_url":"https://api.github.com/repos/MaryamZi/ballerina/comments{/number}","issue_comment_url":"https://api.github.com/repos/MaryamZi/ballerina/issues/comments{/number}","contents_url":"https://api.github.com/repos/MaryamZi/ballerina/contents/{+path}","compare_url":"https://api.github.com/repos/MaryamZi/ballerina/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MaryamZi/ballerina/merges","archive_url":"https://api.github.com/repos/MaryamZi/ballerina/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MaryamZi/ballerina/downloads","issues_url":"https://api.github.com/repos/MaryamZi/ballerina/issues{/number}","pulls_url":"https://api.github.com/repos/MaryamZi/ballerina/pulls{/number}","milestones_url":"https://api.github.com/repos/MaryamZi/ballerina/milestones{/number}","notifications_url":"https://api.github.com/repos/MaryamZi/ballerina/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MaryamZi/ballerina/labels{/name}","releases_url":"https://api.github.com/repos/MaryamZi/ballerina/releases{/id}","deployments_url":"https://api.github.com/repos/MaryamZi/ballerina/deployments","created_at":"2018-02-02T09:10:37Z","updated_at":"2018-04-04T04:15:50Z","pushed_at":"2018-07-03T17:00:09Z","git_url":"git://github.com/MaryamZi/ballerina.git","ssh_url":"git@github.com:MaryamZi/ballerina.git","clone_url":"https://github.com/MaryamZi/ballerina.git","svn_url":"https://github.com/MaryamZi/ballerina","homepage":"","size":238462,"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":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ballerina-platform:master","ref":"master","sha":"10e0af6077512ceef509fe322630c4d7f887d47e","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","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},"private":false,"html_url":"https://github.com/ballerina-platform/ballerina-lang","description":"Ballerina is a new programming language for integration built on a sequence diagram metaphor.","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-07-04T04:25:20Z","pushed_at":"2018-07-04T04:40:10Z","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":239435,"stargazers_count":701,"watchers_count":701,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":333,"mirror_url":null,"archived":false,"open_issues_count":509,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":333,"open_issues":509,"watchers":701,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ballerina-platform/ballerina-lang/pulls/9273"},"html":{"href":"https://github.com/ballerina-platform/ballerina-lang/pull/9273"},"issue":{"href":"https://api.github.com/repos/ballerina-platform/ballerina-lang/issues/9273"},"comments":{"href":"https://api.github.com/repos/ballerina-platform/ballerina-lang/issues/9273/comments"},"review_comments":{"href":"https://api.github.com/repos/ballerina-platform/ballerina-lang/pulls/9273/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/9273/commits"},"statuses":{"href":"https://api.github.com/repos/ballerina-platform/ballerina-lang/statuses/d238e8befa7115bb4e02eabae96957a82614dc71"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"MaryamZi"}}