Skip to content

Commit 5ec80ec

Browse files
Ensure EnC tests use "preview" lang version for C# and "latest" for VB
VB Note: EditingTestBase.vb already specifies LanguageVersion.Latest when parsing.
1 parent 0cc8235 commit 5ec80ec

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

src/Features/CSharpTest/EditAndContinue/Helpers/CSharpEditAndContinueTestVerifier.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ internal sealed class CSharpEditAndContinueTestVerifier(Action<SyntaxNode>? faul
1717
public override string ProjectFileExtension => ".csproj";
1818
public override TreeComparer<SyntaxNode> TopSyntaxComparer => SyntaxComparer.TopLevel;
1919
public override string? TryGetResource(string keyword) => EditingTestBase.TryGetResource(keyword);
20+
public override ParseOptions ParseOptions => CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.Preview);
2021

2122
public override ImmutableArray<SyntaxNode> GetDeclarators(ISymbol method)
2223
{

src/Features/CSharpTest/EditAndContinue/Helpers/EditingTestBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ internal static string GetDocumentFilePath(int documentIndex)
134134
private static SyntaxTree ParseSource(string markedSource, int documentIndex = 0)
135135
=> SyntaxFactory.ParseSyntaxTree(
136136
SourceMarkers.Clear(markedSource),
137-
CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp12),
137+
CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.Preview),
138138
path: GetDocumentFilePath(documentIndex));
139139

140140
internal static EditScriptDescription GetTopEdits(string methodBody1, string methodBody2, MethodKind kind)

src/Features/TestUtilities/EditAndContinue/EditAndContinueTestVerifier.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@
99
using System.IO;
1010
using System.Linq;
1111
using System.Threading;
12-
using Microsoft.CodeAnalysis.Differencing;
1312
using Microsoft.CodeAnalysis.Contracts.EditAndContinue;
13+
using Microsoft.CodeAnalysis.Differencing;
1414
using Microsoft.CodeAnalysis.Emit;
15+
using Microsoft.CodeAnalysis.Host;
16+
using Microsoft.CodeAnalysis.Host.Mef;
1517
using Microsoft.CodeAnalysis.Test.Utilities;
1618
using Microsoft.CodeAnalysis.Text;
1719
using Roslyn.Test.Utilities;
1820
using Roslyn.Utilities;
1921
using Xunit;
2022
using static Microsoft.CodeAnalysis.EditAndContinue.AbstractEditAndContinueAnalyzer;
21-
using Microsoft.CodeAnalysis.Host.Mef;
22-
using Microsoft.CodeAnalysis.Host;
2323

2424
namespace Microsoft.CodeAnalysis.EditAndContinue.UnitTests;
2525

@@ -58,6 +58,7 @@ protected EditAndContinueTestVerifier(Action<SyntaxNode>? faultInjector)
5858
public abstract string ProjectFileExtension { get; }
5959
public abstract TreeComparer<SyntaxNode> TopSyntaxComparer { get; }
6060
public abstract string? TryGetResource(string keyword);
61+
public abstract ParseOptions ParseOptions { get; }
6162

6263
internal static AbstractEditAndContinueAnalyzer CreateAnalyzer(Action<SyntaxNode>? faultInjector, string languageName)
6364
{
@@ -463,7 +464,8 @@ private void CreateProjects(EditScriptDescription[] editScripts, AdhocWorkspace
463464
language: LanguageName,
464465
compilationOutputInfo: default,
465466
filePath: Path.Combine(TempRoot.Root, "project" + ProjectFileExtension),
466-
checksumAlgorithm: SourceHashAlgorithms.Default));
467+
checksumAlgorithm: SourceHashAlgorithms.Default),
468+
parseOptions: ParseOptions);
467469

468470
oldProject = workspace.AddProject(projectInfo).WithMetadataReferences(TargetFrameworkUtil.GetReferences(targetFramework));
469471
foreach (var editScript in editScripts)

src/Features/VisualBasicTest/EditAndContinue/Helpers/VisualBasicEditAndContinueTestVerifier.vb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.EditAndContinue
4444
Public Overrides Function TryGetResource(keyword As String) As String
4545
Return EditingTestBase.TryGetResource(keyword)
4646
End Function
47+
48+
Public Overrides ReadOnly Property ParseOptions As ParseOptions
49+
Get
50+
Return VisualBasicParseOptions.Default.WithLanguageVersion(LanguageVersion.Latest)
51+
End Get
52+
End Property
4753
End Class
4854
End Namespace
4955

0 commit comments

Comments
 (0)