Skip to content

Commit 44d16e9

Browse files
Additional changes to the gladstone PR. (#77977)
2 parents dd3440b + c775133 commit 44d16e9

File tree

19 files changed

+593
-256
lines changed

19 files changed

+593
-256
lines changed

Ide.slnf

Lines changed: 248 additions & 0 deletions
Large diffs are not rendered by default.

eng/Version.Details.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
<SourceBuild RepoName="source-build-externals" ManagedOnly="true" />
1414
</Dependency>
1515
<!-- Intermediate is necessary for source build. -->
16-
<Dependency Name="Microsoft.SourceBuild.Intermediate.source-build-reference-packages" Version="10.0.617601">
16+
<Dependency Name="Microsoft.SourceBuild.Intermediate.source-build-reference-packages" Version="10.0.618101">
1717
<Uri>https://github.com/dotnet/source-build-reference-packages</Uri>
18-
<Sha>1556b6c639edcaee959013681afcf2e66b118537</Sha>
18+
<Sha>f216638d3d6324b6ec140f826b92a7f853dbdfb7</Sha>
1919
<SourceBuild RepoName="source-build-reference-packages" ManagedOnly="true" />
2020
</Dependency>
2121
<Dependency Name="System.CommandLine" Version="2.0.0-beta4.24528.1">

eng/config/PublishData.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,9 @@
183183
"Shipping",
184184
"NonShipping"
185185
],
186-
"vsBranch": "main",
186+
"vsBranch": "feature/d18initial",
187187
"vsMajorVersion": 17,
188-
"insertionCreateDraftPR": true,
188+
"insertionCreateDraftPR": false,
189189
"insertionTitlePrefix": "[d17.15 P1]"
190190
}
191191
}

eng/targets/VisualStudio.FastUpToDateCheckWorkarounds.targets

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,16 @@
1111

1212
<Target Name="CollectVsixUpToDateCheckBuilt">
1313
</Target>
14+
15+
<PropertyGroup>
16+
<CollectUpToDateCheckInputDesignTimeDependsOn>$(CollectUpToDateCheckInputDesignTimeDependsOn);RemoveBuildOutputSourceItems</CollectUpToDateCheckInputDesignTimeDependsOn>
17+
</PropertyGroup>
18+
19+
<!-- Add a workaround for https://github.com/dotnet/project-system/issues/9651 until we decide what we want to do there long term. -->
20+
<Target Name="RemoveBuildOutputSourceItems" DependsOnTargets="AddUpToDateCheckVSIXSourceItems" Condition="'$(CreateVsixContainer)' == 'true'">
21+
<ItemGroup>
22+
<_ItemsInObjDirectory Include="$(IntermediateOutputPath)\**\*" Set="VsixItems" />
23+
<UpToDateCheckInput Remove="@(_ItemsInObjDirectory)" MatchOnMetadata="Set" />
24+
</ItemGroup>
25+
</Target>
1426
</Project>

src/Analyzers/CSharp/Tests/MisplacedUsingDirectives/MisplacedUsingDirectivesTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1042,7 +1042,7 @@ namespace TestNamespace
10421042
}
10431043

10441044
[Fact]
1045-
public Task WhenInsidePreferred_UsingsInBoth_UsingsMoved_FileScopedNamespaec()
1045+
public Task WhenInsidePreferred_UsingsInBoth_UsingsMoved_FileScopedNamespace()
10461046
{
10471047
var testCode = """
10481048
[|using Microsoft.CodeAnalysis;|]
@@ -1054,6 +1054,7 @@ namespace TestNamespace;
10541054

10551055
var fixedTestCode = """
10561056
namespace TestNamespace;
1057+
10571058
{|Warning:using Microsoft.CodeAnalysis;|}
10581059
10591060
using System;

src/EditorFeatures/CSharpTest/ChangeSignature/ChangeSignatureTests.cs

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,74 @@ await TestChangeSignatureViaCommandAsync(
6767
expectedUpdatedInvocationDocumentCode: expectedCode);
6868
}
6969

70+
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/75676")]
71+
public async Task TestForPrimaryConstructor_ViaCommand()
72+
{
73+
var markup = """
74+
public class Base {
75+
public $$Base(string Item2, string Item1)
76+
{
77+
}
78+
}
79+
80+
public class Derived() : Base("Item2", "Item1")
81+
{
82+
}
83+
""";
84+
var expectedCode = """
85+
public class Base {
86+
public Base(string Item1, string Item2)
87+
{
88+
}
89+
}
90+
91+
public class Derived() : Base("Item1", "Item2")
92+
{
93+
}
94+
""";
95+
96+
await TestChangeSignatureViaCommandAsync(
97+
LanguageNames.CSharp,
98+
markup: markup,
99+
updatedSignature: [1, 0],
100+
expectedUpdatedInvocationDocumentCode: expectedCode);
101+
}
102+
103+
[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/75676")]
104+
public async Task TestForPrimaryConstructorParamsArray_ViaCommand()
105+
{
106+
var markup = """
107+
public class Base {
108+
public $$Base(string Item2, string Item1, params object[] items)
109+
{
110+
Console.WriteLine(items.Length);
111+
}
112+
}
113+
114+
public class Derived() : Base("Item2", "Item1", 1, "test", true)
115+
{
116+
}
117+
""";
118+
var expectedCode = """
119+
public class Base {
120+
public Base(string Item1, string Item2, params object[] items)
121+
{
122+
Console.WriteLine(items.Length);
123+
}
124+
}
125+
126+
public class Derived() : Base("Item1", "Item2", 1, "test", true)
127+
{
128+
}
129+
""";
130+
131+
await TestChangeSignatureViaCommandAsync(
132+
LanguageNames.CSharp,
133+
markup: markup,
134+
updatedSignature: [1, 0, 2],
135+
expectedUpdatedInvocationDocumentCode: expectedCode);
136+
}
137+
70138
[Fact]
71139
public async Task TestOnLambdaWithTwoDiscardParameters_ViaCommand()
72140
{

src/Features/CSharp/Portable/ChangeSignature/CSharpChangeSignatureService.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ internal sealed class CSharpChangeSignatureService : AbstractChangeSignatureServ
8080
SyntaxKind.SimpleLambdaExpression,
8181
SyntaxKind.ParenthesizedLambdaExpression,
8282
SyntaxKind.NameMemberCref,
83+
SyntaxKind.PrimaryConstructorBaseType,
8384
];
8485

8586
private static readonly ImmutableArray<SyntaxKind> _updatableNodeKinds =
@@ -104,6 +105,7 @@ internal sealed class CSharpChangeSignatureService : AbstractChangeSignatureServ
104105
SyntaxKind.RecordDeclaration,
105106
SyntaxKind.StructDeclaration,
106107
SyntaxKind.ClassDeclaration,
108+
SyntaxKind.PrimaryConstructorBaseType,
107109
];
108110

109111
[ImportingConstructor]
@@ -272,6 +274,7 @@ private static bool InSymbolHeader(SyntaxNode matchingNode, int position)
272274
case SyntaxKind.ObjectCreationExpression:
273275
return ((ObjectCreationExpressionSyntax)matchingNode).Type;
274276

277+
case SyntaxKind.PrimaryConstructorBaseType:
275278
case SyntaxKind.ConstructorDeclaration:
276279
case SyntaxKind.IndexerDeclaration:
277280
case SyntaxKind.ThisConstructorInitializer:
@@ -507,6 +510,22 @@ or SyntaxKind.StructDeclaration
507510
cancellationToken));
508511
}
509512

513+
if (updatedNode is PrimaryConstructorBaseTypeSyntax primaryConstructor)
514+
{
515+
var symbolInfo = semanticModel.GetSymbolInfo((PrimaryConstructorBaseTypeSyntax)originalNode, cancellationToken);
516+
517+
return primaryConstructor.WithArgumentList(
518+
UpdateArgumentList(
519+
document,
520+
declarationSymbol,
521+
signaturePermutation,
522+
primaryConstructor.ArgumentList,
523+
isReducedExtensionMethod: false,
524+
IsParamsArrayExpanded(semanticModel, primaryConstructor, symbolInfo, cancellationToken),
525+
originalNode.SpanStart,
526+
cancellationToken));
527+
}
528+
510529
Debug.Assert(false, "Unknown reference location");
511530
return null;
512531
}
@@ -618,6 +637,7 @@ private static bool IsParamsArrayExpanded(SemanticModel semanticModel, SyntaxNod
618637
BaseObjectCreationExpressionSyntax objectCreation => objectCreation.ArgumentList,
619638
ConstructorInitializerSyntax constructorInitializer => constructorInitializer.ArgumentList,
620639
ElementAccessExpressionSyntax elementAccess => elementAccess.ArgumentList,
640+
PrimaryConstructorBaseTypeSyntax primaryConstructor => primaryConstructor.ArgumentList,
621641
_ => throw ExceptionUtilities.UnexpectedValue(node.Kind())
622642
};
623643

src/Features/CSharpTest/ExtractClass/ExtractClassTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1269,6 +1269,7 @@ class Program : MyBase
12691269
// this is my real document header
12701270
12711271
namespace ConsoleApp185;
1272+
12721273
using System;
12731274
using System.Collections.Generic;
12741275

0 commit comments

Comments
 (0)