{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/visualfsharp/issues/882","labels_url":"https://api.github.com/repos/Microsoft/visualfsharp/issues/882/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/visualfsharp/issues/882/comments","events_url":"https://api.github.com/repos/Microsoft/visualfsharp/issues/882/events","html_url":"https://github.com/Microsoft/visualfsharp/pull/882","id":127494396,"number":882,"title":"Intrinsic extensions fix for #49","user":{"login":"7sharp9","id":588746,"avatar_url":"https://avatars.githubusercontent.com/u/588746?v=3","gravatar_id":"","url":"https://api.github.com/users/7sharp9","html_url":"https://github.com/7sharp9","followers_url":"https://api.github.com/users/7sharp9/followers","following_url":"https://api.github.com/users/7sharp9/following{/other_user}","gists_url":"https://api.github.com/users/7sharp9/gists{/gist_id}","starred_url":"https://api.github.com/users/7sharp9/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/7sharp9/subscriptions","organizations_url":"https://api.github.com/users/7sharp9/orgs","repos_url":"https://api.github.com/users/7sharp9/repos","events_url":"https://api.github.com/users/7sharp9/events{/privacy}","received_events_url":"https://api.github.com/users/7sharp9/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Microsoft/visualfsharp/labels/cla-signed","name":"cla-signed","color":"207de5"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-01-19T17:13:10Z","updated_at":"2016-01-19T20:33:15Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/Microsoft/visualfsharp/pulls/882","html_url":"https://github.com/Microsoft/visualfsharp/pull/882","diff_url":"https://github.com/Microsoft/visualfsharp/pull/882.diff","patch_url":"https://github.com/Microsoft/visualfsharp/pull/882.patch"},"body":"Ok this is a combination of the work Alex Corrado and I have done to get intrinsic type extensions on generative provided types working correctly.  \r\n\r\nThe gist of the fix is that provided types were calculated far for ahead in the compile chain for them to be available in the type checking phase so this PR moves that phase to be slightly earlier in the compilation chain.  This is also detailed in the commit comnents.\r\n\r\nI have tested in both fsi and fsc and everything looks good:\r\n\r\nGiven a generative type provider that simply creates a generated type with a method named `MyMethod` and a property names `MyProperty`, and then intrinsically extends it with a `Foo` property\r\n\r\n```\r\n#r \"IntrinsicTypeExtensions.dll\"\r\ntype t = BasicProvider.Generative.MyType with\r\n  override x.ToString() = \"Hello World\"\r\n  member x.Foo = 42\"\"\")\r\n      Some exp\r\n    with ex -> None\r\n```\r\n\r\n```\r\nF# Interactive for F# 4.0 (private)\r\nFreely distributed under the Apache 2.0 Open Source License\r\n\r\nFor help type #help;;\r\n\r\n> \r\n--> Referenced '/Users/dave/Projects/IntrinsicTypeExtensions/IntrinsicTypeExtensions/bin/Debug/IntrinsicTypeExtensions.dll' (file may be locked by F# Interactive process)\r\n\r\ntype t =\r\n  class\r\n    new : unit -> t\r\n    member Foo : int\r\n    member MyMethod : unit -> string\r\n    member MyProperty : string\r\n    member ToString : unit -> string\r\n```\r\n\r\nUsing static linker debug output, we get the following:\r\n```\r\nadding provider-generated assembly 'tmp43eaf32e' into static linking set\r\ndeciding whether to rewrite type ref \"System.Object\"\r\ndeciding whether to rewrite type ref \"BasicProvider.Generative.MyType\"\r\nrewriting type ref \"BasicProvider.Generative.MyType\" to \"FSI_0001+t\"\r\ndeciding whether to rewrite type ref \"System.String\"\r\nHave [<Generate>] root 'BasicProvider.Generative.MyType, tmp43eaf32e, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'\r\nRelocating BasicProvider.Generative.MyType, tmp43eaf32e, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null to FSI_0001+t \r\nKeep provided type <Module>, tmp43eaf32e, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null in place because it wasn't relocated\r\n```\r\n\r\nI can add tests etc as long as I know what and where to add them to."},"comment":{"url":"https://api.github.com/repos/Microsoft/visualfsharp/issues/comments/172977503","html_url":"https://github.com/Microsoft/visualfsharp/pull/882#issuecomment-172977503","issue_url":"https://api.github.com/repos/Microsoft/visualfsharp/issues/882","id":172977503,"user":{"login":"chkn","id":289291,"avatar_url":"https://avatars.githubusercontent.com/u/289291?v=3","gravatar_id":"","url":"https://api.github.com/users/chkn","html_url":"https://github.com/chkn","followers_url":"https://api.github.com/users/chkn/followers","following_url":"https://api.github.com/users/chkn/following{/other_user}","gists_url":"https://api.github.com/users/chkn/gists{/gist_id}","starred_url":"https://api.github.com/users/chkn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chkn/subscriptions","organizations_url":"https://api.github.com/users/chkn/orgs","repos_url":"https://api.github.com/users/chkn/repos","events_url":"https://api.github.com/users/chkn/events{/privacy}","received_events_url":"https://api.github.com/users/chkn/received_events","type":"User","site_admin":false},"created_at":"2016-01-19T20:33:15Z","updated_at":"2016-01-19T20:33:15Z","body":"@KevinRansom I just signed the CLA"}}