{"action":"created","issue":{"url":"https://api.github.com/repos/racket/typed-racket/issues/365","repository_url":"https://api.github.com/repos/racket/typed-racket","labels_url":"https://api.github.com/repos/racket/typed-racket/issues/365/labels{/name}","comments_url":"https://api.github.com/repos/racket/typed-racket/issues/365/comments","events_url":"https://api.github.com/repos/racket/typed-racket/issues/365/events","html_url":"https://github.com/racket/typed-racket/pull/365","id":157017631,"number":365,"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},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-05-26T15:54:43Z","updated_at":"2016-06-06T18:47:42Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/racket/typed-racket/pulls/365","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"},"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."},"comment":{"url":"https://api.github.com/repos/racket/typed-racket/issues/comments/224051205","html_url":"https://github.com/racket/typed-racket/pull/365#issuecomment-224051205","issue_url":"https://api.github.com/repos/racket/typed-racket/issues/365","id":224051205,"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},"created_at":"2016-06-06T18:47:42Z","updated_at":"2016-06-06T18:47:42Z","body":"I've just squashed all of my commits into one, which got rid of the reverts of reverts."}}
{"actor":{"display_login":"AlexKnauth"}}