Skip to content

Instantly share code, notes, and snippets.

@lasandell
Last active August 29, 2015 14:09
Show Gist options
  • Save lasandell/e0e432b0397f40e62def to your computer and use it in GitHub Desktop.
Save lasandell/e0e432b0397f40e62def to your computer and use it in GitHub Desktop.
The static coercion from type EventInfoProxy to 'a involves an indeterminate type based on information prior to this program point. Static coercions are not allowed on some types. Further type annotations are needed.
let annotateMember data (memb:'t :> #MemberInfo) =
match box memb with
| :? EventInfo as event ->
{ new EventInfoProxy(event) with
override __.GetCustomAttributesData() = data } :> 't
| :? MethodInfo as meth ->
{ new MethodInfoProxy(meth) with
override __.GetCustomAttributesData() = data } :> 't
| :? PropertyInfo as prop ->
{ new PropertyInfoProxy(prop) with
override __.GetCustomAttributesData() = data } :> 't
| _ ->
memb :> 't
@lasandell
Copy link
Author

If I do :?> then it says can't convert 't to 't ... ugh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment