Skip to content
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

Function pointer type inference #4310

Merged
merged 8 commits into from
Jan 25, 2021

Conversation

333fred
Copy link
Member

@333fred 333fred commented Jan 7, 2021

I've taken a stab at creating a spec for function pointer type inference, basing it off the rules for constructed and delegate type inference. I'm unsure that I actually got the wording right that reflects the actual rules I'm implementing in dotnet/roslyn#50249, so careful review is appreciated.

@AlekseyTs
Copy link
Contributor

AlekseyTs commented Jan 9, 2021

Done with review pass (commit 2) #Closed

@AlekseyTs
Copy link
Contributor

AlekseyTs commented Jan 15, 2021

Done with review pass (commit 3) #Closed

* Add exact inference section.
* Correct the upper and lower bound qualifications. No implicit conversions are considered when doing inference, we simply add the correct bounds for the type (upper, lower, or exact).
@333fred
Copy link
Member Author

333fred commented Jan 15, 2021

@AlekseyTs I believe I've addressed the feedback.

@AlekseyTs
Copy link
Contributor

AlekseyTs commented Jan 15, 2021

Done with review pass (commit 5) #Closed

@333fred
Copy link
Member Author

333fred commented Jan 16, 2021

@AlekseyTs addressed feedback.

Copy link
Contributor

@AlekseyTs AlekseyTs left a comment

Choose a reason for hiding this comment

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

LGTM (commit 6)

@AlekseyTs
Copy link
Contributor

This is not blocking, but I think we need to bring the proposal to LDM for an approval.

@333fred
Copy link
Member Author

333fred commented Jan 16, 2021

This is not blocking, but I think we need to bring the proposal to LDM for an approval.

I think we can do that over email, I'll send one.

@333fred
Copy link
Member Author

333fred commented Jan 20, 2021

@AlekseyTs made the change we discussed offline.

Copy link
Contributor

@AlekseyTs AlekseyTs left a comment

Choose a reason for hiding this comment

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

LGTM (commit 7)

Copy link
Member

@jcouv jcouv left a comment

Choose a reason for hiding this comment

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

Done with review pass (iteration 7)

Copy link
Member

@jcouv jcouv left a comment

Choose a reason for hiding this comment

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

LGTM Thanks (iteration 8)

@333fred 333fred merged commit 6ab8409 into dotnet:master Jan 25, 2021
@333fred 333fred deleted the function-pointer-variance branch January 25, 2021 19:08
The following case is added to bullet 3:

> * `V` is a function pointer type `delegate*<V2..Vk, V1>` and there is a function pointer type `delegate*<U2..Uk, U1>` such that `U` is identical to
`delegate*<U2..Uk, U1>`, and the calling convention of `V` is identical to `U`, and the refness of `Vi` is identical to `Ui`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Why "there is a function pointer type delegate*<U2..Uk, U1> such that U is identical to
delegate*<U2..Uk, U1>", not just "U is a function pointer type delegate*<U2..Uk, U1>"?

Copy link
Contributor

Choose a reason for hiding this comment

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

"the calling convention of V is identical to U" is a bit imprecise. Either "V and U have identical calling conventions" or "the calling convention of V is identical to the calling convention of U"

The following case is added to bullet 3:

> * `V` is a function pointer type `delegate*<V2..Vk, V1>` and there is a function pointer type `delegate*<U2..Uk, U1>` such that `U` is identical to
`delegate*<U2..Uk, U1>`, and the calling convention of `V` is identical to `U`, and the refness of `Vi` is identical to `Ui`.
Copy link
Contributor

Choose a reason for hiding this comment

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

"the refness of Vi is identical to Ui" same comment plus make clear that it is each of the Vi, e.g.: "the refness of each Vi is identical to the refness of the corresponding Ui" or something like that.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, is refness a word? I believe we have another term for it, though I would have to dig to find it.

The following case is added to bullet 2:

> * `U` is a function pointer type `delegate*<U2..Uk, U1>` and `V` is a function pointer type which is identical to `delegate*<V2..Vk, V1>`, and the
calling convention of `U` is identical to `V`, and the refness of `Ui` is identical to `Vi`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comments as above, mutatis mutandum.

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.

4 participants