{"action":"created","comment":{"url":"https://api.github.com/repos/racket/typed-racket/pulls/comments/64959135","id":64959135,"diff_hunk":"@@ -250,9 +251,17 @@\n ;;  make-predicate\n ;;  cast\n \n-;; Helper to construct syntax for contract definitions\n+;; Helpers to construct syntax for contract definitions\n+;; make-contract-def-rhs : Type-Stx Boolean Boolean -> Syntax\n (define (make-contract-def-rhs type flat? maker?)\n-  (contract-def-property #'#f `#s(contract-def ,type ,flat? ,maker? untyped)))\n+  (define contract-def `#s(contract-def ,type ,flat? ,maker? untyped))\n+  (contract-def-property #'#f (λ () contract-def)))\n+\n+;; make-contract-def-rhs/from-typed : Id Boolean Boolean -> Syntax\n+(define (make-contract-def-rhs/from-typed id flat? maker?)\n+  (contract-def-property\n+   #'#f\n+   (λ () `#s(contract-def ,(or (cast-table-ref id) #'Any) ,flat? ,maker? typed))))","path":"typed-racket-lib/typed-racket/base-env/prims-contract.rkt","position":null,"original_position":24,"commit_id":"83d390e9185e8df21c09d6a7d91601c2ff3f66c8","original_commit_id":"357e4a12419fbc6af056a77710823bfc53b1a75e","user":{"login":"samth","id":244723,"avatar_url":"https://avatars.githubusercontent.com/u/244723?v=3","gravatar_id":"","url":"https://api.github.com/users/samth","html_url":"https://github.com/samth","followers_url":"https://api.github.com/users/samth/followers","following_url":"https://api.github.com/users/samth/following{/other_user}","gists_url":"https://api.github.com/users/samth/gists{/gist_id}","starred_url":"https://api.github.com/users/samth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samth/subscriptions","organizations_url":"https://api.github.com/users/samth/orgs","repos_url":"https://api.github.com/users/samth/repos","events_url":"https://api.github.com/users/samth/events{/privacy}","received_events_url":"https://api.github.com/users/samth/received_events","type":"User","site_admin":false},"body":"Ok, we should figure out where that error is coming from. What's the stack trace when you get the error?","created_at":"2016-05-27T19:57:49Z","updated_at":"2016-05-27T19:57:49Z","html_url":"https://github.com/racket/typed-racket/pull/365#discussion_r64959135","pull_request_url":"https://api.github.com/repos/racket/typed-racket/pulls/365","_links":{"self":{"href":"https://api.github.com/repos/racket/typed-racket/pulls/comments/64959135"},"html":{"href":"https://github.com/racket/typed-racket/pull/365#discussion_r64959135"},"pull_request":{"href":"https://api.github.com/repos/racket/typed-racket/pulls/365"}}},"pull_request":{"url":"https://api.github.com/repos/racket/typed-racket/pulls/365","id":71580194,"html_url":"https://github.com/racket/typed-racket/pull/365","diff_url":"https://github.com/racket/typed-racket/pull/365.diff","patch_url":"https://github.com/racket/typed-racket/pull/365.patch","issue_url":"https://api.github.com/repos/racket/typed-racket/issues/365","number":365,"state":"open","locked":false,"title":"Close cast soundness loophole","user":{"login":"AlexKnauth","id":6600123,"avatar_url":"https://avatars.githubusercontent.com/u/6600123?v=3","gravatar_id":"","url":"https://api.github.com/users/AlexKnauth","html_url":"https://github.com/AlexKnauth","followers_url":"https://api.github.com/users/AlexKnauth/followers","following_url":"https://api.github.com/users/AlexKnauth/following{/other_user}","gists_url":"https://api.github.com/users/AlexKnauth/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexKnauth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexKnauth/subscriptions","organizations_url":"https://api.github.com/users/AlexKnauth/orgs","repos_url":"https://api.github.com/users/AlexKnauth/repos","events_url":"https://api.github.com/users/AlexKnauth/events{/privacy}","received_events_url":"https://api.github.com/users/AlexKnauth/received_events","type":"User","site_admin":false},"body":"Fixes https://github.com/racket/typed-racket/issues/108\r\nFixes PR 13626\r\nFixes PR 14955\r\n\r\nThis makes `cast` generate two contracts, one from typed to untyped using the original type of the expression, and one from untyped to typed, using the type it's casting to. \r\n\r\nSo in examples like this:\r\n```racket\r\n#lang typed/racket\r\n\r\n(: v Boolean)\r\n(define v #f)\r\n(: f (Boolean -> Boolean))\r\n(define (f x)\r\n  (set! v x)\r\n  x)\r\n\r\nv ; #f\r\n((cast f (String -> String)) \"hello\") ; error!\r\nv ; if that hadn't been an error, this would be \"hello\" with type Boolean\r\n```\r\nThe cast applies a contract for the new type `String -> String` going from untyped to typed, but first it applies a contract for the old type, `Boolean -> Boolean`, going from typed to untyped. This also means that doing `((cast f (Boolean -> Boolean)) #t)` succeeds and sets `v` to `#t`, because it checked that the argument was a boolean first.","created_at":"2016-05-26T15:54:43Z","updated_at":"2016-05-27T19:57:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a9ba30678ece501dcad509b792a1db0005cc2d04","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/racket/typed-racket/pulls/365/commits","review_comments_url":"https://api.github.com/repos/racket/typed-racket/pulls/365/comments","review_comment_url":"https://api.github.com/repos/racket/typed-racket/pulls/comments{/number}","comments_url":"https://api.github.com/repos/racket/typed-racket/issues/365/comments","statuses_url":"https://api.github.com/repos/racket/typed-racket/statuses/83d390e9185e8df21c09d6a7d91601c2ff3f66c8","head":{"label":"AlexKnauth:close-cast-loophole","ref":"close-cast-loophole","sha":"83d390e9185e8df21c09d6a7d91601c2ff3f66c8","user":{"login":"AlexKnauth","id":6600123,"avatar_url":"https://avatars.githubusercontent.com/u/6600123?v=3","gravatar_id":"","url":"https://api.github.com/users/AlexKnauth","html_url":"https://github.com/AlexKnauth","followers_url":"https://api.github.com/users/AlexKnauth/followers","following_url":"https://api.github.com/users/AlexKnauth/following{/other_user}","gists_url":"https://api.github.com/users/AlexKnauth/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexKnauth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexKnauth/subscriptions","organizations_url":"https://api.github.com/users/AlexKnauth/orgs","repos_url":"https://api.github.com/users/AlexKnauth/repos","events_url":"https://api.github.com/users/AlexKnauth/events{/privacy}","received_events_url":"https://api.github.com/users/AlexKnauth/received_events","type":"User","site_admin":false},"repo":{"id":29779436,"name":"typed-racket","full_name":"AlexKnauth/typed-racket","owner":{"login":"AlexKnauth","id":6600123,"avatar_url":"https://avatars.githubusercontent.com/u/6600123?v=3","gravatar_id":"","url":"https://api.github.com/users/AlexKnauth","html_url":"https://github.com/AlexKnauth","followers_url":"https://api.github.com/users/AlexKnauth/followers","following_url":"https://api.github.com/users/AlexKnauth/following{/other_user}","gists_url":"https://api.github.com/users/AlexKnauth/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexKnauth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexKnauth/subscriptions","organizations_url":"https://api.github.com/users/AlexKnauth/orgs","repos_url":"https://api.github.com/users/AlexKnauth/repos","events_url":"https://api.github.com/users/AlexKnauth/events{/privacy}","received_events_url":"https://api.github.com/users/AlexKnauth/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/AlexKnauth/typed-racket","description":null,"fork":true,"url":"https://api.github.com/repos/AlexKnauth/typed-racket","forks_url":"https://api.github.com/repos/AlexKnauth/typed-racket/forks","keys_url":"https://api.github.com/repos/AlexKnauth/typed-racket/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AlexKnauth/typed-racket/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AlexKnauth/typed-racket/teams","hooks_url":"https://api.github.com/repos/AlexKnauth/typed-racket/hooks","issue_events_url":"https://api.github.com/repos/AlexKnauth/typed-racket/issues/events{/number}","events_url":"https://api.github.com/repos/AlexKnauth/typed-racket/events","assignees_url":"https://api.github.com/repos/AlexKnauth/typed-racket/assignees{/user}","branches_url":"https://api.github.com/repos/AlexKnauth/typed-racket/branches{/branch}","tags_url":"https://api.github.com/repos/AlexKnauth/typed-racket/tags","blobs_url":"https://api.github.com/repos/AlexKnauth/typed-racket/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AlexKnauth/typed-racket/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AlexKnauth/typed-racket/git/refs{/sha}","trees_url":"https://api.github.com/repos/AlexKnauth/typed-racket/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AlexKnauth/typed-racket/statuses/{sha}","languages_url":"https://api.github.com/repos/AlexKnauth/typed-racket/languages","stargazers_url":"https://api.github.com/repos/AlexKnauth/typed-racket/stargazers","contributors_url":"https://api.github.com/repos/AlexKnauth/typed-racket/contributors","subscribers_url":"https://api.github.com/repos/AlexKnauth/typed-racket/subscribers","subscription_url":"https://api.github.com/repos/AlexKnauth/typed-racket/subscription","commits_url":"https://api.github.com/repos/AlexKnauth/typed-racket/commits{/sha}","git_commits_url":"https://api.github.com/repos/AlexKnauth/typed-racket/git/commits{/sha}","comments_url":"https://api.github.com/repos/AlexKnauth/typed-racket/comments{/number}","issue_comment_url":"https://api.github.com/repos/AlexKnauth/typed-racket/issues/comments{/number}","contents_url":"https://api.github.com/repos/AlexKnauth/typed-racket/contents/{+path}","compare_url":"https://api.github.com/repos/AlexKnauth/typed-racket/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AlexKnauth/typed-racket/merges","archive_url":"https://api.github.com/repos/AlexKnauth/typed-racket/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AlexKnauth/typed-racket/downloads","issues_url":"https://api.github.com/repos/AlexKnauth/typed-racket/issues{/number}","pulls_url":"https://api.github.com/repos/AlexKnauth/typed-racket/pulls{/number}","milestones_url":"https://api.github.com/repos/AlexKnauth/typed-racket/milestones{/number}","notifications_url":"https://api.github.com/repos/AlexKnauth/typed-racket/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AlexKnauth/typed-racket/labels{/name}","releases_url":"https://api.github.com/repos/AlexKnauth/typed-racket/releases{/id}","deployments_url":"https://api.github.com/repos/AlexKnauth/typed-racket/deployments","created_at":"2015-01-24T14:41:25Z","updated_at":"2016-01-30T00:40:58Z","pushed_at":"2016-05-27T17:25:20Z","git_url":"git://github.com/AlexKnauth/typed-racket.git","ssh_url":"git@github.com:AlexKnauth/typed-racket.git","clone_url":"https://github.com/AlexKnauth/typed-racket.git","svn_url":"https://github.com/AlexKnauth/typed-racket","homepage":null,"size":6697,"stargazers_count":0,"watchers_count":0,"language":"Racket","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"racket:master","ref":"master","sha":"c7de8194241982f9557d0ab8826a5759f4acb025","user":{"login":"racket","id":232371,"avatar_url":"https://avatars.githubusercontent.com/u/232371?v=3","gravatar_id":"","url":"https://api.github.com/users/racket","html_url":"https://github.com/racket","followers_url":"https://api.github.com/users/racket/followers","following_url":"https://api.github.com/users/racket/following{/other_user}","gists_url":"https://api.github.com/users/racket/gists{/gist_id}","starred_url":"https://api.github.com/users/racket/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/racket/subscriptions","organizations_url":"https://api.github.com/users/racket/orgs","repos_url":"https://api.github.com/users/racket/repos","events_url":"https://api.github.com/users/racket/events{/privacy}","received_events_url":"https://api.github.com/users/racket/received_events","type":"Organization","site_admin":false},"repo":{"id":27412259,"name":"typed-racket","full_name":"racket/typed-racket","owner":{"login":"racket","id":232371,"avatar_url":"https://avatars.githubusercontent.com/u/232371?v=3","gravatar_id":"","url":"https://api.github.com/users/racket","html_url":"https://github.com/racket","followers_url":"https://api.github.com/users/racket/followers","following_url":"https://api.github.com/users/racket/following{/other_user}","gists_url":"https://api.github.com/users/racket/gists{/gist_id}","starred_url":"https://api.github.com/users/racket/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/racket/subscriptions","organizations_url":"https://api.github.com/users/racket/orgs","repos_url":"https://api.github.com/users/racket/repos","events_url":"https://api.github.com/users/racket/events{/privacy}","received_events_url":"https://api.github.com/users/racket/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/racket/typed-racket","description":"Typed Racket","fork":false,"url":"https://api.github.com/repos/racket/typed-racket","forks_url":"https://api.github.com/repos/racket/typed-racket/forks","keys_url":"https://api.github.com/repos/racket/typed-racket/keys{/key_id}","collaborators_url":"https://api.github.com/repos/racket/typed-racket/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/racket/typed-racket/teams","hooks_url":"https://api.github.com/repos/racket/typed-racket/hooks","issue_events_url":"https://api.github.com/repos/racket/typed-racket/issues/events{/number}","events_url":"https://api.github.com/repos/racket/typed-racket/events","assignees_url":"https://api.github.com/repos/racket/typed-racket/assignees{/user}","branches_url":"https://api.github.com/repos/racket/typed-racket/branches{/branch}","tags_url":"https://api.github.com/repos/racket/typed-racket/tags","blobs_url":"https://api.github.com/repos/racket/typed-racket/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/racket/typed-racket/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/racket/typed-racket/git/refs{/sha}","trees_url":"https://api.github.com/repos/racket/typed-racket/git/trees{/sha}","statuses_url":"https://api.github.com/repos/racket/typed-racket/statuses/{sha}","languages_url":"https://api.github.com/repos/racket/typed-racket/languages","stargazers_url":"https://api.github.com/repos/racket/typed-racket/stargazers","contributors_url":"https://api.github.com/repos/racket/typed-racket/contributors","subscribers_url":"https://api.github.com/repos/racket/typed-racket/subscribers","subscription_url":"https://api.github.com/repos/racket/typed-racket/subscription","commits_url":"https://api.github.com/repos/racket/typed-racket/commits{/sha}","git_commits_url":"https://api.github.com/repos/racket/typed-racket/git/commits{/sha}","comments_url":"https://api.github.com/repos/racket/typed-racket/comments{/number}","issue_comment_url":"https://api.github.com/repos/racket/typed-racket/issues/comments{/number}","contents_url":"https://api.github.com/repos/racket/typed-racket/contents/{+path}","compare_url":"https://api.github.com/repos/racket/typed-racket/compare/{base}...{head}","merges_url":"https://api.github.com/repos/racket/typed-racket/merges","archive_url":"https://api.github.com/repos/racket/typed-racket/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/racket/typed-racket/downloads","issues_url":"https://api.github.com/repos/racket/typed-racket/issues{/number}","pulls_url":"https://api.github.com/repos/racket/typed-racket/pulls{/number}","milestones_url":"https://api.github.com/repos/racket/typed-racket/milestones{/number}","notifications_url":"https://api.github.com/repos/racket/typed-racket/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/racket/typed-racket/labels{/name}","releases_url":"https://api.github.com/repos/racket/typed-racket/releases{/id}","deployments_url":"https://api.github.com/repos/racket/typed-racket/deployments","created_at":"2014-12-02T03:00:29Z","updated_at":"2016-05-26T22:10:55Z","pushed_at":"2016-05-27T17:25:21Z","git_url":"git://github.com/racket/typed-racket.git","ssh_url":"git@github.com:racket/typed-racket.git","clone_url":"https://github.com/racket/typed-racket.git","svn_url":"https://github.com/racket/typed-racket","homepage":"","size":7454,"stargazers_count":80,"watchers_count":80,"language":"Racket","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":28,"mirror_url":null,"open_issues_count":111,"forks":28,"open_issues":111,"watchers":80,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/racket/typed-racket/pulls/365"},"html":{"href":"https://github.com/racket/typed-racket/pull/365"},"issue":{"href":"https://api.github.com/repos/racket/typed-racket/issues/365"},"comments":{"href":"https://api.github.com/repos/racket/typed-racket/issues/365/comments"},"review_comments":{"href":"https://api.github.com/repos/racket/typed-racket/pulls/365/comments"},"review_comment":{"href":"https://api.github.com/repos/racket/typed-racket/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/racket/typed-racket/pulls/365/commits"},"statuses":{"href":"https://api.github.com/repos/racket/typed-racket/statuses/83d390e9185e8df21c09d6a7d91601c2ff3f66c8"}}}}
{"actor":{"display_login":"samth"}}