Skip to content

types and arrays in F# attribute contructor arguments #387

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 31, 2015

Conversation

Jand42
Copy link
Contributor

@Jand42 Jand42 commented Jul 28, 2015

Enable reading attribute constructor argument values defined with typeof or array syntax. Value is a boxed FSharpType or boxed obj[].

Notes:
I also experimented with correct handling typedefof but that would require some additional functions to look up System.Tuple and FSharpFunc cases properly.
Also, reading arrays and types from IL seemed to have some deeper issues in deserialization.

// TODO: typeof<..> in attribute values
// TODO: arrays in attribute values
| Expr.Op (TOp.Array,_,a,_) -> box [| for i in a -> evalFSharpAttribArg g i |]
| TypeOfExpr g ty -> box ty
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These uses of "box" are a bit unusual for the way much of the compiler is written. I suppose it does make for a minimal diff, which is good, but could you add a comment to evalFSharpAttribArg to indicate the range of objects that can be returned from the function?

@dsyme
Copy link
Contributor

dsyme commented Jul 30, 2015

One comment on the code - otherwise this looks great

dsyme added a commit that referenced this pull request Jul 31, 2015
types and arrays in F# attribute contructor arguments
@dsyme dsyme merged commit d27c3a3 into fsharp:master Jul 31, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants