Repository navigation
Add support for supplying generic method type parameters - #12412
Conversation
Yeah this will possibly need a change to EditorSyntax. |
|
Rain Sallow (/u/ta11ow) (@vexx32) There are many formatting and style issue. Please fix issues for changed code and move unrelated ones to another PR (I mean specially build.psm1 and some in other code). It will very help reviewers! |
|
Ilya (@iSazonov) ah, you're right. I'll have to do a bit of a rebase to clear that up, give me a few moments. I think a lot of those came from Dave's original code here, so I'll pare out what's needed and drop the unrelated style changes. Thanks! 💖 |
0304cf5 to
4685610
Compare
|
Ilya (@iSazonov) that should do it. Time for bed. 😁 |
4685610 to
5dccfb3
Compare
f099a15 to
9a865d0
Compare
9a865d0 to
d41d8f0
Compare
|
Rob Holt (@rjmholt) Can you review? |
|
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
|
Rob Holt (@rjmholt) Could you review this please? |
d41d8f0 to
1442838
Compare
Co-authored-by: Ilya <darpa@yandex.ru>
This comment has been minimized.
This comment has been minimized.
1 similar comment
|
This PR has Quantification details
Why proper sizing of changes matters
Optimal pull request sizes drive a better predictable PR flow as they strike a
What can I do to optimize my changes
How to interpret the change counts in git diff output
Was this comment helpful? 👍 :ok_hand: :thumbsdown: (Email) |
Rain Sallow (/u/ta11ow) (vexx32)
left a comment
There was a problem hiding this comment.
Had a quick look over your edits and they look good to me, thanks for helping sort those out!
Also pushed a commit adding some tests for the tab completion, modelled after the existing tab completion tests for normal type token completions.
|
I realize this question is probably beyond the scope of this PR, but I feel it's still relevant: Does it make sense to attempt coercion of enumerables passed as arguments to method parameters constrained by generic type parameters when overload resolution is not otherwise ambiguous? Take the following example: Edit: as soon as I posted this I realized what I'm really asking for is "can we have better coercion semantics for downcasting to interfaces with covariant generic type parameters?" which is sorta orthogonal to this change and should be chased separately, please ignore this :) |
|
Mathias R. Jessen (@IISResetMe) I agree we should have that, and agree it's out of this scope... but I would really love to have that. Because yeah, in some method calls it does feel like casts should not be necessary. Maybe would be good to file a follow up issue with that? I think it'll be easier to manage with the changes from this PR actually defining some of the types needed for the method call, so PS has less to infer from just the arguments. |
What are the concerns around breaking PSES? |
Changes in Parser. |
|
Thanks Rain Sallow (/u/ta11ow) (@vexx32) for your contribution!
Mathias R. Jessen (@IISResetMe) Feel free to open an issue for discussion about this 😄 Andy Jordan (@andschwa) I guess |
|
Just noticed no documentation issue was filed. Rain Sallow (/u/ta11ow) (@vexx32) can you please open a documentation issue for this feature? |
|
Aye, will do! EDIT: Doc issue filed: MicrosoftDocs/PowerShell-Docs#8533 |
|
w00000000. Congrats Rain Sallow (/u/ta11ow) (@vexx32) |
|
Rain Sallow (/u/ta11ow) (@vexx32) Finally! This is awesome! |
PR Summary
Adds support for specifying type arguments for generic methods.
For example:
Many thanks to Dave Wyatt (@dlwyatt) for the initial parsing implementation! 😊 💖
PR Context
Resolves #5146
/cc Jason Shirk (@lzybkr) Dongbo Wang (@daxian-dbw)
/cc TylerLeonhardt would this necessitate an update to language spec like the
dispose{}one did?This may affect tools not using an actual PS parser, but in general I think the impact will be minor overall, likely requiring some updates to any regex recognition patterns for some syntax highlighting rules.
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.