{"action":"closed","issue":{"url":"https://api.github.com/repos/FStarLang/FStar/issues/791","repository_url":"https://api.github.com/repos/FStarLang/FStar","labels_url":"https://api.github.com/repos/FStarLang/FStar/issues/791/labels{/name}","comments_url":"https://api.github.com/repos/FStarLang/FStar/issues/791/comments","events_url":"https://api.github.com/repos/FStarLang/FStar/issues/791/events","html_url":"https://github.com/FStarLang/FStar/issues/791","id":196986626,"number":791,"title":"Variable not found when typechecking mutually recursive types","user":{"login":"tahina-pro","id":15695239,"avatar_url":"https://avatars.githubusercontent.com/u/15695239?v=3","gravatar_id":"","url":"https://api.github.com/users/tahina-pro","html_url":"https://github.com/tahina-pro","followers_url":"https://api.github.com/users/tahina-pro/followers","following_url":"https://api.github.com/users/tahina-pro/following{/other_user}","gists_url":"https://api.github.com/users/tahina-pro/gists{/gist_id}","starred_url":"https://api.github.com/users/tahina-pro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tahina-pro/subscriptions","organizations_url":"https://api.github.com/users/tahina-pro/orgs","repos_url":"https://api.github.com/users/tahina-pro/repos","events_url":"https://api.github.com/users/tahina-pro/events{/privacy}","received_events_url":"https://api.github.com/users/tahina-pro/received_events","type":"User","site_admin":false},"labels":[{"id":90066076,"url":"https://api.github.com/repos/FStarLang/FStar/labels/bug","name":"bug","color":"fc2929","default":true}],"state":"closed","locked":false,"assignee":{"login":"nikswamy","id":6163359,"avatar_url":"https://avatars.githubusercontent.com/u/6163359?v=3","gravatar_id":"","url":"https://api.github.com/users/nikswamy","html_url":"https://github.com/nikswamy","followers_url":"https://api.github.com/users/nikswamy/followers","following_url":"https://api.github.com/users/nikswamy/following{/other_user}","gists_url":"https://api.github.com/users/nikswamy/gists{/gist_id}","starred_url":"https://api.github.com/users/nikswamy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nikswamy/subscriptions","organizations_url":"https://api.github.com/users/nikswamy/orgs","repos_url":"https://api.github.com/users/nikswamy/repos","events_url":"https://api.github.com/users/nikswamy/events{/privacy}","received_events_url":"https://api.github.com/users/nikswamy/received_events","type":"User","site_admin":false},"assignees":[{"login":"nikswamy","id":6163359,"avatar_url":"https://avatars.githubusercontent.com/u/6163359?v=3","gravatar_id":"","url":"https://api.github.com/users/nikswamy","html_url":"https://github.com/nikswamy","followers_url":"https://api.github.com/users/nikswamy/followers","following_url":"https://api.github.com/users/nikswamy/following{/other_user}","gists_url":"https://api.github.com/users/nikswamy/gists{/gist_id}","starred_url":"https://api.github.com/users/nikswamy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nikswamy/subscriptions","organizations_url":"https://api.github.com/users/nikswamy/orgs","repos_url":"https://api.github.com/users/nikswamy/repos","events_url":"https://api.github.com/users/nikswamy/events{/privacy}","received_events_url":"https://api.github.com/users/nikswamy/received_events","type":"User","site_admin":false}],"milestone":null,"comments":1,"created_at":"2016-12-21T17:16:22Z","updated_at":"2016-12-22T20:02:36Z","closed_at":"2016-12-22T20:02:36Z","body":"The following example fails at type checking:\r\n\r\n```\r\nmodule Test\r\ntype t a = | T : a -> t a\r\nand  u = | U : (fun x -> t x) unit -> u\r\n```\r\n\r\nWith `fstar --dump_module Test test.fst`, I obtain:\r\n\r\n```\r\nmodule Test\r\ntype Test.t a : Type\r\ndatacon Test.T : ( -> Tot (_0:a@0 -> Tot (t a@1)))\r\ntype Test.u  : Type\r\ndatacon Test.U : (_0:((fun x -> (t x@0)) unit) -> Tot u)\r\n[...] (projectors and discriminators)\r\ntest.fst(2,7-2,8) : (Error) Variable \"a#10\" not found\r\n```\r\n\r\nHowever:\r\n* replacing `(fun x -> t x) unit` with `t unit` works, giving:\r\n  ```\r\n  module Test\r\n  type Test.t a : Type\r\n  datacon Test.T : ( -> Tot (_0:a@0 -> Tot (t a@1)))\r\n  type Test.u  : Type\r\n  datacon Test.U : (_0:(t unit) -> Tot u)\r\n  [...] (projectors and discriminators)\r\n  module Test\r\n  type Test.t a : Type\r\n  type Test.u  : Type\r\n  datacon Test.T : (_0:a@0 -> Tot (t a@1))\r\n  datacon Test.U : (_0:(t unit) -> Tot u)\r\n  [...] (projectors and discriminators)\r\n  ```\r\n* independently, replacing `and u` with `type u` (non-mutually recursive) works, giving:\r\n  ```\r\n  module Test\r\n  type Test.t a : Type\r\n  datacon Test.T : ( -> Tot (_0:a@0 -> Tot (t a@1)))\r\n  [...] (projectors and discriminators)\r\n  type Test.u  : Type\r\n  datacon Test.U : (_0:((fun x -> (t x@0)) unit) -> Tot u)\r\n  [...] (projectors and discriminators)\r\n  module Test\r\n  type Test.t a : Type\r\n  datacon Test.T : (_0:a@0 -> Tot (t a@1))\r\n  [...] (projectors and discriminators)\r\n  type Test.u  : Type\r\n  datacon Test.U : (_0:((fun x -> (t x@0)) unit) -> Tot u)\r\n  [...] (projectors and discriminators)\r\n  ```\r\n"}}
{"actor":{"display_login":"nikswamy"}}