-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Add support for supplying generic method type parameters #12412
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
Conversation
Yeah this will possibly need a change to EditorSyntax. |
|
@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! |
|
@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! 💖 |
|
@iSazonov that should do it. Time for bed. 😁 |
src/System.Management.Automation/engine/CommandCompletion/CompletionAnalysis.cs
Outdated
Show resolved
Hide resolved
src/System.Management.Automation/engine/CommandCompletion/CompletionAnalysis.cs
Outdated
Show resolved
Hide resolved
src/System.Management.Automation/engine/CommandCompletion/CompletionAnalysis.cs
Outdated
Show resolved
Hide resolved
src/System.Management.Automation/engine/CommandCompletion/CompletionAnalysis.cs
Outdated
Show resolved
Hide resolved
|
@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. |
|
@rjmholt Could you review this please? |
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) |
vexx32
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 :) |
|
@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. |
daxian-dbw
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
What are the concerns around breaking PSES? |
Changes in Parser. |
|
Thanks @vexx32 for your contribution!
@IISResetMe Feel free to open an issue for discussion about this 😄 @andschwa I guess |
|
Just noticed no documentation issue was filed. @vexx32 can you please open a documentation issue for this feature? |
|
Aye, will do! EDIT: Doc issue filed: MicrosoftDocs/PowerShell-Docs#8533 |
|
w00000000. Congrats @vexx32 |
|
@vexx32 Finally! This is awesome! |
PR Summary
Adds support for specifying type arguments for generic methods.
For example:
Many thanks to @dlwyatt for the initial parsing implementation! 😊 💖
PR Context
Resolves #5146
/cc @lzybkr @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.