Skip to content

Commit

Permalink
Change required language version to preview
Browse files Browse the repository at this point in the history
  • Loading branch information
alrz committed Sep 29, 2019
1 parent 44a0fb8 commit 008e19d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 25 deletions.
4 changes: 3 additions & 1 deletion src/Compilers/CSharp/Portable/Errors/MessageID.cs
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,9 @@ internal static LanguageVersion RequiredVersion(this MessageID feature)
// Checks are in the LanguageParser unless otherwise noted.
switch (feature)
{
case MessageID.IDS_FeatureRefPartialModOrdering:
return LanguageVersion.Preview;

// C# 8.0 features.
case MessageID.IDS_FeatureAltInterpolatedVerbatimStrings:
case MessageID.IDS_FeatureCoalesceAssignmentExpression:
Expand Down Expand Up @@ -326,7 +329,6 @@ internal static LanguageVersion RequiredVersion(this MessageID feature)
case MessageID.IDS_FeatureExpressionVariablesInQueriesAndInitializers: // semantic check
case MessageID.IDS_FeatureExtensibleFixedStatement: // semantic check
case MessageID.IDS_FeatureIndexingMovableFixedBuffers: //semantic check
case MessageID.IDS_FeatureRefPartialModOrdering:
return LanguageVersion.CSharp7_3;

// C# 7.2 features.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,21 @@ ref public partial struct S {}
// (2,1): error CS8107: Feature 'ref structs' is not available in C# 7.0. Please use language version 7.2 or greater.
// ref partial struct S {}
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion7, "ref").WithArguments("ref structs", "7.2").WithLocation(2, 1),
// (3,1): error CS8107: Feature 'ref and partial modifier ordering' is not available in C# 7.0. Please use language version 7.3 or greater.
// (3,1): error CS8652: The feature 'ref and partial modifier ordering' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version.
// ref partial public struct S {}
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion7, "ref").WithArguments("ref and partial modifier ordering", "7.3").WithLocation(3, 1),
// (3,5): error CS8107: Feature 'ref and partial modifier ordering' is not available in C# 7.0. Please use language version 7.3 or greater.
Diagnostic(ErrorCode.ERR_FeatureInPreview, "ref").WithArguments("ref and partial modifier ordering").WithLocation(3, 1),
// (3,5): error CS8652: The feature 'ref and partial modifier ordering' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version.
// ref partial public struct S {}
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion7, "partial").WithArguments("ref and partial modifier ordering", "7.3").WithLocation(3, 5),
// (4,1): error CS8107: Feature 'ref and partial modifier ordering' is not available in C# 7.0. Please use language version 7.3 or greater.
Diagnostic(ErrorCode.ERR_FeatureInPreview, "partial").WithArguments("ref and partial modifier ordering").WithLocation(3, 5),
// (4,1): error CS8652: The feature 'ref and partial modifier ordering' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version.
// partial ref struct S {}
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion7, "partial").WithArguments("ref and partial modifier ordering", "7.3").WithLocation(4, 1),
Diagnostic(ErrorCode.ERR_FeatureInPreview, "partial").WithArguments("ref and partial modifier ordering").WithLocation(4, 1),
// (4,9): error CS8107: Feature 'ref structs' is not available in C# 7.0. Please use language version 7.2 or greater.
// partial ref struct S {}
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion7, "ref").WithArguments("ref structs", "7.2").WithLocation(4, 9),
// (5,1): error CS8107: Feature 'ref and partial modifier ordering' is not available in C# 7.0. Please use language version 7.3 or greater.
// ref public partial struct S{}
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion7, "ref").WithArguments("ref and partial modifier ordering", "7.3")
// (5,1): error CS8652: The feature 'ref and partial modifier ordering' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version.
// ref public partial struct S {}
Diagnostic(ErrorCode.ERR_FeatureInPreview, "ref").WithArguments("ref and partial modifier ordering").WithLocation(5, 1)
);
}

Expand All @@ -57,15 +57,15 @@ partial public interface I {}

var tree = SyntaxFactory.ParseSyntaxTree(text, options: TestOptions.Regular7);
tree.GetDiagnostics().Verify(
// (2,1): error CS8107: Feature 'ref and partial modifier ordering' is not available in C# 7.0. Please use language version 7.3 or greater.
// (2,1): error CS8652: The feature 'ref and partial modifier ordering' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version.
// partial public class C {}
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion7, "partial").WithArguments("ref and partial modifier ordering", "7.3").WithLocation(2, 1),
// (3,1): error CS8107: Feature 'ref and partial modifier ordering' is not available in C# 7.0. Please use language version 7.3 or greater.
Diagnostic(ErrorCode.ERR_FeatureInPreview, "partial").WithArguments("ref and partial modifier ordering").WithLocation(2, 1),
// (3,1): error CS8652: The feature 'ref and partial modifier ordering' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version.
// partial public struct S {}
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion7, "partial").WithArguments("ref and partial modifier ordering", "7.3").WithLocation(3, 1),
// (4,1): error CS8107: Feature 'ref and partial modifier ordering' is not available in C# 7.0. Please use language version 7.3 or greater.
Diagnostic(ErrorCode.ERR_FeatureInPreview, "partial").WithArguments("ref and partial modifier ordering").WithLocation(3, 1),
// (4,1): error CS8652: The feature 'ref and partial modifier ordering' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version.
// partial public interface I {}
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion7, "partial").WithArguments("ref and partial modifier ordering", "7.3").WithLocation(4, 1)
Diagnostic(ErrorCode.ERR_FeatureInPreview, "partial").WithArguments("ref and partial modifier ordering").WithLocation(4, 1)
);
}

Expand All @@ -81,9 +81,10 @@ partial class C

var tree = SyntaxFactory.ParseSyntaxTree(text, options: TestOptions.Regular7);
tree.GetDiagnostics().Verify(
// (4,5): error CS8107: Feature 'ref and partial modifier ordering' is not available in C# 7.0. Please use language version 7.3 or greater.
// (4,5): error CS8652: The feature 'ref and partial modifier ordering' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version.
// partial static void M();
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion7, "partial").WithArguments("ref and partial modifier ordering", "7.3").WithLocation(4, 5));
Diagnostic(ErrorCode.ERR_FeatureInPreview, "partial").WithArguments("ref and partial modifier ordering").WithLocation(4, 5)
);
}

[Fact]
Expand Down Expand Up @@ -161,7 +162,7 @@ partial readonly ref struct S {}
partial public struct S {}
";

var comp = CreateCompilation(text);
var comp = CreateCompilation(text, parseOptions: TestOptions.RegularPreview);
comp.VerifyDiagnostics();

var s1 = comp.GetTypeByMetadataName("S");
Expand All @@ -180,7 +181,7 @@ partial public class C {}
partial abstract class C {}
";

var comp = CreateCompilation(text);
var comp = CreateCompilation(text, parseOptions: TestOptions.RegularPreview);
comp.VerifyDiagnostics();

var s1 = comp.GetTypeByMetadataName("C");
Expand All @@ -197,7 +198,7 @@ partial partial ref class C {}
partial partial ref struct S {}
";

var comp = CreateCompilation(text, parseOptions: TestOptions.Regular7_3);
var comp = CreateCompilation(text, parseOptions: TestOptions.RegularPreview);
comp.VerifyDiagnostics(
// (2,27): error CS0106: The modifier 'ref' is not valid for this item
// partial partial ref class C {}
Expand All @@ -219,7 +220,7 @@ partial ref ref class C {}
partial ref ref struct S {}
";

var comp = CreateCompilation(text, parseOptions: TestOptions.Regular7_3);
var comp = CreateCompilation(text, parseOptions: TestOptions.RegularPreview);
comp.VerifyDiagnostics(
// (2,23): error CS0106: The modifier 'ref' is not valid for this item
// partial ref ref class C {}
Expand All @@ -242,7 +243,7 @@ public void TestPartialAfterIncompleteAttribute_PartialClass()
partial class Test {}
";

var tree = SyntaxFactory.ParseSyntaxTree(test, options: TestOptions.Regular7_3);
var tree = SyntaxFactory.ParseSyntaxTree(test, options: TestOptions.RegularPreview);
tree.GetDiagnostics().Verify(
// (3,11): error CS1026: ) expected
// [Obsolete(
Expand All @@ -262,7 +263,7 @@ public void TestPartialAfterIncompleteAttribute_PartialPublicClass()
partial public class Test {}
";

var tree = SyntaxFactory.ParseSyntaxTree(test, options: TestOptions.Regular7_3);
var tree = SyntaxFactory.ParseSyntaxTree(test, options: TestOptions.RegularPreview);
tree.GetDiagnostics().Verify(
// (3,11): error CS1026: ) expected
// [Obsolete(
Expand All @@ -283,7 +284,7 @@ class partial
}
";

var comp = CreateCompilation(text, parseOptions: TestOptions.Regular7_3);
var comp = CreateCompilation(text, parseOptions: TestOptions.RegularPreview);
comp.VerifyDiagnostics();
}
}
Expand Down

0 comments on commit 008e19d

Please sign in to comment.