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

Implement Null Coalescing and Null Coalescing assignment operators #10636

Merged
merged 24 commits into from
Oct 17, 2019
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
ecb94dd
Implement null condtional assigment operator
adityapatwardhan Aug 15, 2019
15119cf
Implement ?? operator
adityapatwardhan Aug 22, 2019
0cb1592
Add QuestionDot token
adityapatwardhan Aug 28, 2019
cfd73f9
Fix issues after merge and test fix
adityapatwardhan Sep 25, 2019
137a37b
Change Null coalescing assigned operator to ??=
adityapatwardhan Sep 25, 2019
94ad01f
Make feature experimental
adityapatwardhan Sep 26, 2019
dee8092
Add logic for skipping tests if experimental feature is disabled
adityapatwardhan Sep 27, 2019
9826e69
Fix parsing tests
adityapatwardhan Sep 27, 2019
9e599c4
Address code review feedback
adityapatwardhan Oct 1, 2019
8fd9572
Remove parsing test as it interfers with ternary operator
adityapatwardhan Oct 2, 2019
02dc105
Add few more tests
adityapatwardhan Oct 2, 2019
4e8019e
Address Rob's feedback
adityapatwardhan Oct 4, 2019
a9af2ab
Refactor according to feedback
adityapatwardhan Oct 9, 2019
0e93e14
Add coalesce assignment
adityapatwardhan Oct 9, 2019
771a86d
Add precedence flag for null coalesce operator and add tests
adityapatwardhan Oct 10, 2019
1a4887e
Merge branch 'master' into NullAssignment
adityapatwardhan Oct 10, 2019
73b8982
Revert formatting changes in token.cs
adityapatwardhan Oct 10, 2019
36f4b85
Fix parsing test
adityapatwardhan Oct 10, 2019
d530fcd
More test fixes
adityapatwardhan Oct 10, 2019
3f0f3d1
Check for experimental feature in parsing.tests.ps1
adityapatwardhan Oct 11, 2019
8f39bbb
Updated to move Coalesce code out of Binder
adityapatwardhan Oct 11, 2019
dea5793
Update TokenFlag name
adityapatwardhan Oct 14, 2019
4cf6ba4
Address feedback
adityapatwardhan Oct 15, 2019
268a609
Address Ilya's feedback
adityapatwardhan Oct 15, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add few more tests
  • Loading branch information
adityapatwardhan committed Oct 2, 2019
commit 02dc105cce1aa6e815c66dce045696c6df815598
12 changes: 12 additions & 0 deletions test/powershell/Language/Operators/NullConditional.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ Describe 'NullConditionalOperations' -Tags 'CI' {
$null = [System.Management.Automation.Language.Parser]::ParseInput('1 ??= 100', [ref] $null, [ref] $e)
$e[0].ErrorId | Should -BeExactly 'InvalidLeftHandSide'
}

It 'Variable is non-null' {
adityapatwardhan marked this conversation as resolved.
Show resolved Hide resolved
$num = 10
$num ??= 20

$num | Should -Be 10
}
}

Context 'Null coalesce operator ??' {
Expand Down Expand Up @@ -194,5 +201,10 @@ Describe 'NullConditionalOperations' -Tags 'CI' {
$x ??= $x ?? (GetNull) ?? (GetHello)
$x | Should -BeExactly 'Hello'
}

It 'First two are null' {
$z ??= $null ?? 100
$z | Should -Be 100
}
adityapatwardhan marked this conversation as resolved.
Show resolved Hide resolved
}
}