Skip to content

Commit

Permalink
Merge pull request #61068 from dotnet/merges/main-to-features/require…
Browse files Browse the repository at this point in the history
…d-members

Merge main to features/required-members
  • Loading branch information
dotnet-bot authored May 4, 2022
2 parents c803634 + e8928fd commit 221aebe
Show file tree
Hide file tree
Showing 1,019 changed files with 25,747 additions and 8,184 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ dotnet_diagnostic.IDE0043.severity = warning
# IDE0044: Make field readonly
dotnet_diagnostic.IDE0044.severity = warning

# IDE0170: Prefer extended property pattern
dotnet_diagnostic.IDE0170.severity = warning

# RS0016: Only enable if API files are present
dotnet_public_api_analyzer.require_api_files = true

Expand Down Expand Up @@ -211,6 +214,7 @@ csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion
csharp_style_prefer_extended_property_pattern = true:suggestion

# Space preferences
csharp_space_after_cast = false
Expand Down
6 changes: 4 additions & 2 deletions docs/Language Feature Status.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ efforts behind them.
| [Parameter null-checking](https://github.com/dotnet/csharplang/issues/2145) | [param-nullchecking](https://github.com/dotnet/roslyn/tree/features/param-nullchecking) | [Merged in 17.1p3](https://github.com/dotnet/roslyn/issues/36024) | [RikkiGibson](https://github.com/RikkiGibson), [fayrose](https://github.com/fayrose) | [cston](https://github.com/cston), [chsienki](https://github.com/chsienki) | [jaredpar](https://github.com/jaredpar) |
| [Raw string literals](https://github.com/dotnet/csharplang/issues/4304) | [RawStringLiterals](https://github.com/dotnet/roslyn/tree/features/RawStringLiterals) | [Merged into 17.2](https://github.com/dotnet/roslyn/issues/55306) | [CyrusNajmabadi](https://github.com/CyrusNajmabadi) | [jcouv](https://github.com/jcouv) | [CyrusNajmabadi](https://github.com/CyrusNajmabadi) |
| [Cache delegates for static method group](https://github.com/dotnet/roslyn/issues/5835) | main | [Merged into 17.2](https://github.com/dotnet/roslyn/pull/58288) | [pawchen](https://github.com/pawchen) | [AlekseyTs](https://github.com/AlekseyTs), [jcouv](https://github.com/jcouv) | [AlekseyTs](https://github.com/AlekseyTs) |
| [nameof(parameter)](https://github.com/dotnet/csharplang/issues/373) | main | [In Progress](https://github.com/dotnet/roslyn/issues/40524) | [jcouv](https://github.com/jcouv) | TBD | [jcouv](https://github.com/jcouv) |
| [nameof(parameter)](https://github.com/dotnet/csharplang/issues/373) | main | [Merged into 17.3p2](https://github.com/dotnet/roslyn/issues/40524) | [jcouv](https://github.com/jcouv) | [AlekseyTs](https://github.com/AlekseyTs), [RikkiGibson](https://github.com/RikkiGibson) | [jcouv](https://github.com/jcouv) |
| [Relaxing Shift Operator](https://github.com/dotnet/csharplang/issues/4666) | main | [Merged into 17.3p2](https://github.com/dotnet/roslyn/issues/60967) | [AlekseyTs](https://github.com/AlekseyTs) | [333fred](https://github.com/333fred), [jcouv](https://github.com/jcouv) | [MadsTorgersen](https://github.com/MadsTorgersen) |
| [Relax ordering of `ref` and `partial` modifiers](https://github.com/dotnet/csharplang/issues/946) | [ref-partial](https://github.com/dotnet/roslyn/tree/features/ref-partial) | In Progress | [alrz](https://github.com/alrz) | [gafter](https://github.com/gafter) | [jcouv](https://github.com/jcouv) |
| [Generic attributes](https://github.com/dotnet/csharplang/issues/124) | [generic-attributes](https://github.com/dotnet/roslyn/tree/features/generic-attributes) | [Merged into 17.0p4 (preview langver)](https://github.com/dotnet/roslyn/issues/36285) | [AviAvni](https://github.com/AviAvni) | [RikkiGibson](https://github.com/RikkiGibson), [jcouv](https://github.com/jcouv) | [mattwar](https://github.com/mattwar) |
| [Default in deconstruction](https://github.com/dotnet/roslyn/pull/25562) | [decon-default](https://github.com/dotnet/roslyn/tree/features/decon-default) | [Implemented](https://github.com/dotnet/roslyn/issues/25559) | [jcouv](https://github.com/jcouv) | [gafter](https://github.com/gafter) | [jcouv](https://github.com/jcouv) |
Expand All @@ -31,8 +32,9 @@ efforts behind them.
| [Pattern matching on `ReadOnlySpan<char>`](https://github.com/dotnet/csharplang/issues/1881) | [patterns-span-char](https://github.com/dotnet/roslyn/tree/features/patterns-span-char) | [Merged into 17.3p1](https://github.com/dotnet/roslyn/issues/59191) | [YairHalberstadt ](https://github.com/YairHalberstadt) | [cston](https://github.com/cston), [RikkiGibson](https://github.com/RikkiGibson) | [jcouv](https://github.com/jcouv) |
| [nameof accessing instance members](https://github.com/dotnet/roslyn/issues/40229) | main | [In Progress](https://github.com/dotnet/roslyn/pull/48754) | [YairHalberstadt ](https://github.com/YairHalberstadt) | [333fred](https://github.com/333fred), [AlekseyTs](https://github.com/AlekseyTs) | [333fred](https://github.com/333fred) |
| [ref fields](https://github.com/dotnet/csharplang/blob/main/proposals/low-level-struct-improvements.md) | [ref-fields](https://github.com/dotnet/roslyn/tree/features/ref-fields) | [In Progress](https://github.com/dotnet/roslyn/issues/59194) | [cston](https://github.com/cston) | [RikkiGibson](https://github.com/RikkiGibson), [AlekseyTs](https://github.com/AlekseyTs) | [jaredpar](https://github.com/jaredpar) |
| Numeric IntPtr | [numeric-intptr](https://github.com/dotnet/roslyn/tree/features/numeric-intptr) | [In Progress](https://github.com/dotnet/roslyn/issues/60578) | [jcouv](https://github.com/jcouv) | TBD | [jcouv](https://github.com/jcouv) |
| [Numeric IntPtr](https://github.com/dotnet/csharplang/issues/6065) | [numeric-intptr](https://github.com/dotnet/roslyn/tree/features/numeric-intptr) | [In Progress](https://github.com/dotnet/roslyn/issues/60578) | [jcouv](https://github.com/jcouv) | [cston](https://github.com/cston), [333fred](https://github.com/333fred) | [jcouv](https://github.com/jcouv) |
| [File types](https://github.com/dotnet/csharplang/issues/6011) | [file-types](https://github.com/dotnet/roslyn/tree/features/file-types) | [In Progress](https://github.com/dotnet/roslyn/issues/60819) | [RikkiGibson](https://github.com/RikkiGibson) | [333fred](https://github.com/333fred), [cston](https://github.com/cston) | [stephentoub](https://github.com/stephentoub) |
| [DIM for Static Members](https://github.com/dotnet/csharplang/issues/4436) | [DefaultInterfaceImplementation](https://github.com/dotnet/roslyn/tree/features/DefaultInterfaceImplementation) | [In Progress](https://github.com/dotnet/roslyn/issues/60968) | [AlekseyTs](https://github.com/AlekseyTs) | [333fred](https://github.com/333fred), [jcouv](https://github.com/jcouv) | [MadsTorgersen](https://github.com/MadsTorgersen) |

# C# 10.0

Expand Down
45 changes: 45 additions & 0 deletions docs/compilers/CSharp/Compiler Breaking Changes - DotNet 7.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,50 @@
# This document lists known breaking changes in Roslyn after .NET 6 all the way to .NET 7.

## Nameof operator in attribute on method or local function

***Introduced in .NET SDK 7.0.400, Visual Studio 2022 version 17.3.***

When the language version is C# 11 or later, a `nameof` operator in an attribute on a method
brings the type parameters of that method in scope. The same applies for local functions.
A `nameof` operator in an attribute on a method, its type parameters or parameters brings
the parameters of that method in scope. The same applies to local functions, lambdas,
delegates and indexers.

For instance, these will now be errors:
```csharp
class C
{
class TParameter
{
internal const string Constant = """";
}
[MyAttribute(nameof(TParameter.Constant))]
void M<TParameter>() { }
}
```
```csharp
class C
{
class parameter
{
internal const string Constant = """";
}
[MyAttribute(nameof(parameter.Constant))]
void M(int parameter) { }
}
```

Possible workarounds are:

1. Rename the type parameter or parameter to avoid shadowing the name from outer scope.
1. Use a string literal instead of the `nameof` operator.
1. Downgrade the `<LangVersion>` element to 9.0 or earlier.

Note: The break will also apply to C# 10 and earlier when .NET 7 ships, but is
currently scoped down to users of LangVer=preview.
Tracked by https://github.com/dotnet/roslyn/issues/60640

## Unsigned right shift operator

***Introduced in .NET SDK 6.0.400, Visual Studio 2022 version 17.3.***
Expand Down
2 changes: 1 addition & 1 deletion docs/features/source-generators.cookbook.md
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ using VerifyCS = CSharpSourceGeneratorVerifier<YourGenerator>;
And use the following in your test method:

```csharp
var code = "initial code"
var code = "initial code";
var generated = "expected generated code";
await new VerifyCS.Test
{
Expand Down
2 changes: 1 addition & 1 deletion eng/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ function TestUsingRunTests() {
}

if ($lspEditor) {
$lspLogs = Join-Path $TempDir "VisualStudio\LSP"
$lspLogs = Join-Path $TempDir "VSLogs"
$telemetryLog = Join-Path $TempDir "VSTelemetryLog"
if (Test-Path $lspLogs) {
Write-Host "Copying LSP logs to $LogDir"
Expand Down
2 changes: 1 addition & 1 deletion eng/config/PublishData.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
"channels": [],
"vsBranch": "rel/d17.3",
"vsMajorVersion": 17,
"insertionCreateDraftPR": true,
"insertionTitlePrefix": "[d17.3p1]"
},
"main": {
Expand All @@ -132,7 +133,6 @@
],
"vsBranch": "main",
"vsMajorVersion": 17,
"insertionCreateDraftPR": false,
"insertionTitlePrefix": "[d17.3p2]"
}
}
Expand Down
18 changes: 15 additions & 3 deletions eng/publish-assets.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,23 @@ function Publish-Nuget($publishData, [string]$packageDir) {
try {
# Retrieve the feed name to source mapping.
$feedData = GetFeedPublishData

# Let packageFeeds default to the default set of feeds
$packageFeeds = "default"
if ($publishData.PSobject.Properties.Name -contains "packageFeeds") {
$packageFeeds = $publishData.packageFeeds
}

# If the configured packageFeeds is arcade, then skip publishing here. Arcade will handle publishing packages to their feeds.
if ($packageFeeds.equals("arcade")) {
Write-Host " Skipping publishing for all packages as they will be published by arcade"
continue
}

# Let packageFeeds default to the default set of feeds
$packageFees = $publishData.packageFeeds
if (!$packageFeeds) {
$packageFeeds = "default"
$packageFeeds = "default"
if ($publishData.PSobject.Properties.Name -contains "packageFeeds") {
$packageFeeds = $publishData.packageFeeds
}

# If the configured packageFeeds is arcade, then skip publishing here. Arcade will handle publishing packages to their feeds.
Expand Down
1 change: 1 addition & 0 deletions src/Analyzers/CSharp/Analyzers/CSharpAnalyzers.projitems
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@
<Compile Include="$(MSBuildThisFileDirectory)UsePatternMatching\CSharpUseNotPatternDiagnosticAnalyzer.cs" />
<Compile Include="$(MSBuildThisFileDirectory)UseSimpleUsingStatement\UseSimpleUsingStatementDiagnosticAnalyzer.cs" />
<Compile Include="$(MSBuildThisFileDirectory)UseThrowExpression\CSharpUseThrowExpressionDiagnosticAnalyzer.cs" />
<Compile Include="$(MSBuildThisFileDirectory)UseUTF8StringLiteral\UseUTF8StringLiteralDiagnosticAnalyzer.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ValidateFormatString\CSharpValidateFormatStringDiagnosticAnalyzer.cs" />
<Compile Include="$(MSBuildThisFileDirectory)NewLines\EmbeddedStatementPlacement\EmbeddedStatementPlacementDiagnosticAnalyzer.cs" />
</ItemGroup>
Expand Down
6 changes: 6 additions & 0 deletions src/Analyzers/CSharp/Analyzers/CSharpAnalyzersResources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -365,4 +365,10 @@
<data name="Convert_to_top_level_statements" xml:space="preserve">
<value>Convert to top-level statements</value>
</data>
<data name="Convert_to_UTF8_string_literal" xml:space="preserve">
<value>Convert to UTF-8 string literal</value>
</data>
<data name="Use_UTF8_string_literal" xml:space="preserve">
<value>Use UTF-8 string literal</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static bool IsSimplifiable(
Type: null,
PositionalPatternClause: null,
Designation: null,
PropertyPatternClause: { Subpatterns: { Count: 1 } subpatterns }
PropertyPatternClause.Subpatterns: { Count: 1 } subpatterns
}
} &&
subpatterns[0] is { ExpressionColon: { } inner } &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private enum ConstantResult
case IIsTypeOperation { Syntax: BinaryExpressionSyntax binaryExpression } op:
return Type.TryCreate(binaryExpression, op);

case IIsPatternOperation { Pattern: { Syntax: PatternSyntax pattern } } op:
case IIsPatternOperation { Pattern.Syntax: PatternSyntax pattern } op:
return new Source(pattern, op.Value);

case IParenthesizedOperation op:
Expand Down
Loading

0 comments on commit 221aebe

Please sign in to comment.