Skip to content

Conversation

@surfingoldelephant
Copy link
Contributor

PR Summary

In this PR:

  • Restructures about_Logical_Operators, by shifting about some of the existing content and adding a new Syntax header.
  • Adds -and/-or/-xor equal precedence note to about_Logical_Operators.
  • Removes PS 6+ operators from PS 5.1 about_Operator_Precedence doc (in line with 5.1's about_Operators doc).
  • Adds an -and/-or precedence example to about_Operator_Precedence.
  • Formatting/verbiage changes.

PR Context

The main motivation behind this PR was to highlight -and/-or's equal precedence, which is a departure from other languages like C# and other fields like mathematics. This behavior is likely surprising to users coming from other languages/fields.

There are also other contexts within PowerShell that have different operator precedence, like WQL and the AD filter (both of which give higher precedence to their AND operator). The AD filter especially is a source of confusion (users often mistakenly confuse AD filter syntax with PowerShell syntax and pass a script block to Get-AD* -Filter).

Based on above, I felt PowerShell's -and/-or precedence needed additional attention in both about_Logical_Operators and about_Operator_Precedence.

A real-world example where a user was surprised by PowerShell's behavior can be found here.

PR Checklist

  • Descriptive Title: This PR's title is a synopsis of the changes it proposes.
  • Summary: This PR's summary describes the scope and intent of the change.
  • Contributor's Guide: I have read the contributor's guide.
  • Style: This PR adheres to the style guide.

This shifts about some of the existing content and adds a new header
for Syntax. It also adds link references and makes minor formatting
changes.
This removes operators added in newer PS versions from the PS 5.1
about_Operator_Precedence doc. The PS 5.1 about_Operators doc already
doesn't include new operators like ??.
This adds an example involving both -and and -or to
about_Operator_Precedence. It demonstrates the equal precedence
between the two operators and calls out how this differs from other
languages such as C#.

It also notes that other contexts *within* PowerShell such as WQL and
the AD filter have their own operator precedence which might differ
(in both aforementioned cases, AND has higher precedence than OR).
@learn-build-service-prod
Copy link
Contributor

PoliCheck Scan Report

The following report lists PoliCheck issues in PR files. Before you merge the PR, you must fix all severity-1 and severity-2 issues. The AI Review Details column lists suggestions for either removing or replacing the terms. If you find a false positive result, mention it in a PR comment and include this text: #policheck-false-positive. This feedback helps reduce false positives in future scans.

✅ No issues found

More information about PoliCheck

Information: PoliCheck | Severity Guidance | Term
For any questions: Try searching the learn.microsoft.com contributor guides or post your question in the Learn support channel.

@learn-build-service-prod
Copy link
Contributor

Learn Build status updates of commit e691f23:

⚠️ Validation status: warnings

File Status Preview URL Details
reference/7.4/Microsoft.PowerShell.Core/About/about_Operator_Precedence.md ⚠️Warning View (powershell-7.4) Details
reference/7.5/Microsoft.PowerShell.Core/About/about_Operator_Precedence.md ⚠️Warning View (powershell-7.5) Details
reference/7.6/Microsoft.PowerShell.Core/About/about_Operator_Precedence.md ⚠️Warning View (powershell-7.6) Details
reference/5.1/Microsoft.PowerShell.Core/About/about_Logical_Operators.md ✅Succeeded View (powershell-5.1)
reference/5.1/Microsoft.PowerShell.Core/About/about_Operator_Precedence.md ✅Succeeded View (powershell-5.1)
reference/7.4/Microsoft.PowerShell.Core/About/about_Logical_Operators.md ✅Succeeded View (powershell-7.4)
reference/7.5/Microsoft.PowerShell.Core/About/about_Logical_Operators.md ✅Succeeded View (powershell-7.5)
reference/7.6/Microsoft.PowerShell.Core/About/about_Logical_Operators.md ✅Succeeded View (powershell-7.6)

reference/7.4/Microsoft.PowerShell.Core/About/about_Operator_Precedence.md

  • Line 196, Column 44: [Warning: file-not-found - See documentation] Invalid file link: 'about_WQL.md'.

reference/7.5/Microsoft.PowerShell.Core/About/about_Operator_Precedence.md

  • Line 196, Column 44: [Warning: file-not-found - See documentation] Invalid file link: 'about_WQL.md'.

reference/7.6/Microsoft.PowerShell.Core/About/about_Operator_Precedence.md

  • Line 196, Column 44: [Warning: file-not-found - See documentation] Invalid file link: 'about_WQL.md'.

For more details, please refer to the build report.

Note: Your PR may contain errors or warnings or suggestions unrelated to the files you changed. This happens when external dependencies like GitHub alias, Microsoft alias, cross repo links are updated. Please use these instructions to resolve them.

@surfingoldelephant
Copy link
Contributor Author

Regarding the invalid links above, I see now that about_WQL.md only exists in the 5.1 directory.

I see the redirect_url for /powershell/module/microsoft.powershell.core/about/about_wql, so is switching about_WQL.md to that the right approach here?

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.

1 participant