{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/visualfsharp/issues/1635","repository_url":"https://api.github.com/repos/Microsoft/visualfsharp","labels_url":"https://api.github.com/repos/Microsoft/visualfsharp/issues/1635/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/visualfsharp/issues/1635/comments","events_url":"https://api.github.com/repos/Microsoft/visualfsharp/issues/1635/events","html_url":"https://github.com/Microsoft/visualfsharp/issues/1635","id":183856410,"number":1635,"title":"Type extensions should not need generic type constraints, or throw a more descriptive FS0957","user":{"login":"abelbraaksma","id":16015770,"avatar_url":"https://avatars.githubusercontent.com/u/16015770?v=3","gravatar_id":"","url":"https://api.github.com/users/abelbraaksma","html_url":"https://github.com/abelbraaksma","followers_url":"https://api.github.com/users/abelbraaksma/followers","following_url":"https://api.github.com/users/abelbraaksma/following{/other_user}","gists_url":"https://api.github.com/users/abelbraaksma/gists{/gist_id}","starred_url":"https://api.github.com/users/abelbraaksma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abelbraaksma/subscriptions","organizations_url":"https://api.github.com/users/abelbraaksma/orgs","repos_url":"https://api.github.com/users/abelbraaksma/repos","events_url":"https://api.github.com/users/abelbraaksma/events{/privacy}","received_events_url":"https://api.github.com/users/abelbraaksma/received_events","type":"User","site_admin":false},"labels":[{"id":295281377,"url":"https://api.github.com/repos/Microsoft/visualfsharp/labels/Area-Compiler","name":"Area-Compiler","color":"5319e7","default":false},{"id":164789606,"url":"https://api.github.com/repos/Microsoft/visualfsharp/labels/bug","name":"bug","color":"fc2929","default":true},{"id":295294092,"url":"https://api.github.com/repos/Microsoft/visualfsharp/labels/Urgency-Soon","name":"Urgency-Soon","color":"eb6420","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-10-19T03:20:41Z","updated_at":"2016-11-25T13:34:13Z","closed_at":null,"body":"If you extend a type that has a generic type constraint on one or more of its generic type parameters, you will receive a (not very helpful) error message, like:\n\n> FS0957: The declared type parameters for this type extension do not match the declared type parameters on the original type 'Map<_,_>'\n### Repro steps\n\nA simple example of getting this error is:\n\n```\n// seems valid enough (here extending the F# Map type)\ntype Map<'U, 'V> with\n    static member merge map1 map2 = Map.fold (fun acc key value -> Map.add key value acc) map1 map2\n```\n### Expected behavior\n\nI don't think this error should be raised, the constraints can be inferred from the original type and it is impossible to have two type names with the same generic type parameters, but different constraints.\n\nIf the error _must_ be raised, I suggest a different, or improved error message, something like:\n\n> FS0957: One or more of the declared type parameters for this type extension have a missing or wrong type constraint not matching the original type constraints on 'Map<_,_>'\n### Actual behavior\n\nAn error is raised as mentioned above.\n### Known workarounds\n\nAdd the type constraint is the only logical workaround, but I think it oughtn't be necessary. With more complex type constraints (like member constraints) this can even be a real pain to get right.\n### Related information\n\nTested and seen with VS2015, Update 3, F# 4.0.\n"},"comment":{"url":"https://api.github.com/repos/Microsoft/visualfsharp/issues/comments/262958154","html_url":"https://github.com/Microsoft/visualfsharp/issues/1635#issuecomment-262958154","issue_url":"https://api.github.com/repos/Microsoft/visualfsharp/issues/1635","id":262958154,"user":{"login":"forki","id":57396,"avatar_url":"https://avatars.githubusercontent.com/u/57396?v=3","gravatar_id":"","url":"https://api.github.com/users/forki","html_url":"https://github.com/forki","followers_url":"https://api.github.com/users/forki/followers","following_url":"https://api.github.com/users/forki/following{/other_user}","gists_url":"https://api.github.com/users/forki/gists{/gist_id}","starred_url":"https://api.github.com/users/forki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/forki/subscriptions","organizations_url":"https://api.github.com/users/forki/orgs","repos_url":"https://api.github.com/users/forki/repos","events_url":"https://api.github.com/users/forki/events{/privacy}","received_events_url":"https://api.github.com/users/forki/received_events","type":"User","site_admin":false},"created_at":"2016-11-25T13:34:13Z","updated_at":"2016-11-25T13:34:13Z","body":"I created https://github.com/Microsoft/visualfsharp/pull/1835 which would fix this."}}
{"actor":{"display_login":"forki"}}