| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
PoshChan-Bot (@PoshChan) please retry Windows |
Sorry, something went wrong.
|
Aditya Patwardhan (@adityapatwardhan), successfully started retry of PowerShell-CI-Windows |
Sorry, something went wrong.
There was a problem hiding this comment.
Remove trailing spaces here.
Sorry, something went wrong.
There was a problem hiding this comment.
Fixed
Sorry, something went wrong.
There was a problem hiding this comment.
Not fixed yet.
Sorry, something went wrong.
There was a problem hiding this comment.
In C#, there is no point to support ?. for member access to static members, but in PowerShell, you can do $a = [string]; $a::Equals(...), which makes it debatable whether we want to support it.
Sorry, something went wrong.
There was a problem hiding this comment.
Though it is technically possible to implement something like: $a = [string]; ${a}?::Equals(...), i doubt there is any usefulness to this.
Sorry, something went wrong.
There was a problem hiding this comment.
Yeah, it's technically possible. I vote for postponing it until we have a ask. Steve Lee (@SteveL-MSFT) any thoughts?
Sorry, something went wrong.
There was a problem hiding this comment.
Though it is technically possible to implement something like: $a = [string]; ${a}?::Equals(...), i doubt there is any usefulness to this.
Where I think it would be most useful is situations where you want to invoke a static method only if an assembly is already loaded. e.g.
('MyCustomType' -as [type])?::Initialize()
Sorry, something went wrong.
There was a problem hiding this comment.
That certainly beats my current method! (and has better utility, probably, as well)
switch ($null) {
('typename' -as [type]) { . Type.ps1 }
('type2name' -as [type]) { . Type2.ps1 }
}
Sorry, something went wrong.
There was a problem hiding this comment.
Since it's additive we can postpone
Sorry, something went wrong.
|
Dongbo Wang (@daxian-dbw) - Please re-review. |
Sorry, something went wrong.
There was a problem hiding this comment.
Not fixed yet.
Sorry, something went wrong.
|
Rob Holt (@rjmholt) and James Truher (@JamesWTruher) Can you please review this PR as well? Thanks! |
Sorry, something went wrong.
| @@ -404,6 +404,7 @@ internal List<CompletionResult> GetResultHelper(CompletionContext completionCont | |||
|
|
|||
There was a problem hiding this comment.
Aditya Patwardhan (@adityapatwardhan), your last commit had 1 failures in PowerShell-CI-windows
Enter-PSHostProcess tests.By Process Id.Can enter using NamedPipeConnectionInfo
Exception calling "Invoke" with "0" argument(s): "The runspace state is not valid for this operation."
at <ScriptBlock>, D:\a\1\s\test\powershell\Modules\Microsoft.PowerShell.Core\Enter-PSHostProcess.Tests.ps1: line 136
136: $ps.AddScript('$pid').Invoke() | Should -Be $pwshId
Sorry, something went wrong.
| @@ -404,6 +404,7 @@ internal List<CompletionResult> GetResultHelper(CompletionContext completionCont | |||
|
|
|||
There was a problem hiding this comment.
Aditya Patwardhan (@adityapatwardhan), your last commit had 1 failures in PowerShell-CI-windows
NullConditionalMemberAccess.?. operator tests.Use ?. on a dynamic method name that does not exist
Expected an exception, with FullyQualifiedErrorId 'Argument' to be thrown, but the FullyQualifiedErrorId was 'MethodNotFound'. from D:\a\1\s\test\powershell\Language\Operators\NullConditional.Tests.ps1:343 char:15
+ { (Get-Date '11/11/2019')?.$methodName() } | Should -Thro ?
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
at <ScriptBlock>, D:\a\1\s\test\powershell\Language\Operators\NullConditional.Tests.ps1: line 343
343: { (Get-Date '11/11/2019')?.$methodName() } | Should -Throw -ErrorId 'Argument'
Sorry, something went wrong.
| @@ -404,6 +404,7 @@ internal List<CompletionResult> GetResultHelper(CompletionContext completionCont | |||
|
|
|||
There was a problem hiding this comment.
Aditya Patwardhan (@adityapatwardhan), your last commit had 1 failures in PowerShell-CI-linux
NullConditionalMemberAccess.?. operator tests.Use ?. on a dynamic method name that does not exist
Expected an exception, with FullyQualifiedErrorId 'Argument' to be thrown, but the FullyQualifiedErrorId was 'MethodNotFound'. from /home/vsts/work/1/s/test/powershell/Language/Operators/NullConditional.Tests.ps1:343 char:15
+ { (Get-Date '11/11/2019')?.$methodName() } | Should -Thro ?
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
at <ScriptBlock>, /home/vsts/work/1/s/test/powershell/Language/Operators/NullConditional.Tests.ps1: line 343
343: { (Get-Date '11/11/2019')?.$methodName() } | Should -Throw -ErrorId 'Argument'
Sorry, something went wrong.
| @@ -404,6 +404,7 @@ internal List<CompletionResult> GetResultHelper(CompletionContext completionCont | |||
|
|
|||
There was a problem hiding this comment.
Aditya Patwardhan (@adityapatwardhan), your last commit had 1 failures in PowerShell-CI-macos
NullConditionalMemberAccess.?. operator tests.Use ?. on a dynamic method name that does not exist
Expected an exception, with FullyQualifiedErrorId 'Argument' to be thrown, but the FullyQualifiedErrorId was 'MethodNotFound'. from /Users/runner/runners/2.160.0/work/1/s/test/powershell/Language/Operators/NullConditional.Tests.ps1:343 char:15
+ { (Get-Date '11/11/2019')?.$methodName() } | Should -Thro ?
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
at <ScriptBlock>, /Users/runner/runners/2.160.0/work/1/s/test/powershell/Language/Operators/NullConditional.Tests.ps1: line 343
343: { (Get-Date '11/11/2019')?.$methodName() } | Should -Throw -ErrorId 'Argument'
Sorry, something went wrong.
| @@ -404,6 +404,7 @@ internal List<CompletionResult> GetResultHelper(CompletionContext completionCont | |||
|
|
|||
There was a problem hiding this comment.
Aditya Patwardhan (@adityapatwardhan), your last commit had 20 failures in PowerShell-CI-static-analysis
(These are 5 of the failures)
Verify Markdown Links.Verify links in /home/vsts/work/1/s/README.md.https://docs.microsoft.com/powershell/scripting/setup/installing-powershell-core-on-windows?view=powershell-6 should work
retry of URL failed with error: Response status code does not indicate success: 404 (Not Found).
at <ScriptBlock>, /home/vsts/work/1/s/test/common/markdown/markdown-link.tests.ps1: line 117
117: throw "retry of URL failed with error: $($_.Exception.Message)"
Verify Markdown Links.Verify links in /home/vsts/work/1/s/README.md.https://docs.microsoft.com/powershell/scripting/setup/installing-powershell-core-on-linux?view=powershell-6#ubuntu-1804 should work
retry of URL failed with error: Response status code does not indicate success: 404 (Not Found).
at <ScriptBlock>, /home/vsts/work/1/s/test/common/markdown/markdown-link.tests.ps1: line 117
117: throw "retry of URL failed with error: $($_.Exception.Message)"
Verify Markdown Links.Verify links in /home/vsts/work/1/s/README.md.https://docs.microsoft.com/powershell/scripting/setup/installing-powershell-core-on-linux?view=powershell-6#ubuntu-1604 should work
retry of URL failed with error: Response status code does not indicate success: 404 (Not Found).
at <ScriptBlock>, /home/vsts/work/1/s/test/common/markdown/markdown-link.tests.ps1: line 117
117: throw "retry of URL failed with error: $($_.Exception.Message)"
Verify Markdown Links.Verify links in /home/vsts/work/1/s/README.md.https://docs.microsoft.com/powershell/scripting/setup/installing-powershell-core-on-linux?view=powershell-6#debian-9 should work
retry of URL failed with error: Response status code does not indicate success: 404 (Not Found).
at <ScriptBlock>, /home/vsts/work/1/s/test/common/markdown/markdown-link.tests.ps1: line 117
117: throw "retry of URL failed with error: $($_.Exception.Message)"
Verify Markdown Links.Verify links in /home/vsts/work/1/s/README.md.https://docs.microsoft.com/powershell/scripting/setup/installing-powershell-core-on-linux?view=powershell-6#centos-7 should work
retry of URL failed with error: Response status code does not indicate success: 404 (Not Found).
at <ScriptBlock>, /home/vsts/work/1/s/test/common/markdown/markdown-link.tests.ps1: line 117
117: throw "retry of URL failed with error: $($_.Exception.Message)"
Sorry, something went wrong.
There was a problem hiding this comment.
One open issue: [System.DBNull]::Value?.GetTypeCode() and [NullString]::Value?.GetType() will return nothing, which might raise confusion. We need to discuss and decide if it's fine to have this semantics for the null-conditional operator.
Talked with Aditya Patwardhan (@adityapatwardhan) offline, and we will discuss and address this in the RC release.
/cc James Truher (@JamesWTruher) Steve Lee (@SteveL-MSFT) Rob Holt (@rjmholt)
Sorry, something went wrong.
|
PoshChan-Bot (@PoshChan) please retry static |
Sorry, something went wrong.
|
Aditya Patwardhan (@adityapatwardhan), successfully started retry of PowerShell-CI-static-analysis |
Sorry, something went wrong.
|
Dongbo Wang (@daxian-dbw) Ready to merge? |
Sorry, something went wrong.
|
🎉v7.0.0-preview.6 has been released which incorporates this pull request.:tada: Handy links: |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
PR Summary
PR for ?. and ?[] operators.
Braces need around variable name. Like ${x}?.Name and ${x}?.Get()
Implementation on RFC - PowerShell/PowerShell-RFC#223
PR Context
The null conditional member access operators allow to check the item for being null before a property is accessed or an index is used or a method is invoked. This helps reduced the null checking logic from scripts.
PR Checklist