This instance will be upgraded to Heptapod 0.17.2 on 2020-12-03 at 14:00 UTC+1 (a few minutes of down time)

Commit d02eca48 authored by Jesse McGrew's avatar Jesse McGrew

Update to .NET Core 3.0 and add nullability annotations.

parent e98c978791f1
......@@ -183,7 +183,7 @@ class Program {
throw new System.NotImplementedException();
}
[NotNull]
[JetBrains.Annotations.NotNull]
protected override DiagnosticAnalyzer GetCSharpDiagnosticAnalyzer()
{
return new ErrorExceptionUsageAnalyzer();
......
......@@ -24,7 +24,7 @@ namespace ZilfAnalyzers.Test.Helpers
/// <param name="document">The Document to apply the fix on</param>
/// <param name="codeAction">A CodeAction that will be applied to the Document.</param>
/// <returns>A Document with the changes from the CodeAction</returns>
static Document ApplyFix([NotNull] Document document, [NotNull] CodeAction codeAction)
static Document ApplyFix([JetBrains.Annotations.NotNull] Document document, [JetBrains.Annotations.NotNull] CodeAction codeAction)
{
var operations = codeAction.GetOperationsAsync(CancellationToken.None).Result;
var solution = operations.OfType<ApplyChangesOperation>().Single().ChangedSolution;
......@@ -39,7 +39,7 @@ namespace ZilfAnalyzers.Test.Helpers
/// <param name="diagnostics">The Diagnostics that existed in the code before the CodeFix was applied</param>
/// <param name="newDiagnostics">The Diagnostics that exist in the code after the CodeFix was applied</param>
/// <returns>A list of Diagnostics that only surfaced in the code after the CodeFix was applied</returns>
static IEnumerable<Diagnostic> GetNewDiagnostics([NotNull] [InstantHandle] IEnumerable<Diagnostic> diagnostics, [NotNull] [InstantHandle] IEnumerable<Diagnostic> newDiagnostics)
static IEnumerable<Diagnostic> GetNewDiagnostics([JetBrains.Annotations.NotNull] [InstantHandle] IEnumerable<Diagnostic> diagnostics, [JetBrains.Annotations.NotNull] [InstantHandle] IEnumerable<Diagnostic> newDiagnostics)
{
var oldArray = diagnostics.OrderBy(d => d.Location.SourceSpan.Start).ToArray();
var newArray = newDiagnostics.OrderBy(d => d.Location.SourceSpan.Start).ToArray();
......@@ -66,7 +66,7 @@ namespace ZilfAnalyzers.Test.Helpers
/// </summary>
/// <param name="document">The Document to run the compiler diagnostic analyzers on</param>
/// <returns>The compiler diagnostics that were found in the code</returns>
static ImmutableArray<Diagnostic> GetCompilerDiagnostics([NotNull] Document document)
static ImmutableArray<Diagnostic> GetCompilerDiagnostics([JetBrains.Annotations.NotNull] Document document)
{
return document.GetSemanticModelAsync().Result.GetDiagnostics();
}
......@@ -76,7 +76,7 @@ namespace ZilfAnalyzers.Test.Helpers
/// </summary>
/// <param name="document">The Document to be converted to a string</param>
/// <returns>A string containing the syntax of the Document after formatting</returns>
[NotNull]
[JetBrains.Annotations.NotNull]
static string GetStringFromDocument(Document document)
{
var simplifiedDoc = Simplifier.ReduceAsync(document, Simplifier.Annotation).Result;
......
......@@ -40,7 +40,7 @@ namespace ZilfAnalyzers.Test.Helpers
{
DiagnosticResultLocation[] locations;
[NotNull]
[JetBrains.Annotations.NotNull]
public DiagnosticResultLocation[] Locations
{
get => locations ?? (locations = new DiagnosticResultLocation[] { });
......
......@@ -24,7 +24,7 @@ namespace ZilfAnalyzers.Test.Helpers
static readonly IReadOnlyCollection<MetadataReference> ProjectMetadataReferences =
GetProjectMetadataReferences();
[NotNull, ItemNotNull]
[JetBrains.Annotations.NotNull, ItemNotNull]
private static IReadOnlyCollection<MetadataReference> GetProjectMetadataReferences()
{
var result = new List<MetadataReference>
......@@ -72,7 +72,7 @@ namespace ZilfAnalyzers.Test.Helpers
/// <param name="analyzer">The analyzer to be run on the sources</param>
/// <returns>An IEnumerable of Diagnostics that surfaced in the source code, sorted by Location</returns>
[ItemNotNull]
private static async Task<Diagnostic[]> GetSortedDiagnosticsAsync([NotNull] string[] sources, [NotNull] string language, DiagnosticAnalyzer analyzer)
private static async Task<Diagnostic[]> GetSortedDiagnosticsAsync([JetBrains.Annotations.NotNull] string[] sources, [JetBrains.Annotations.NotNull] string language, DiagnosticAnalyzer analyzer)
{
return await GetSortedDiagnosticsFromDocumentsAsync(analyzer, GetDocuments(sources, language)).ConfigureAwait(false);
}
......@@ -85,7 +85,7 @@ namespace ZilfAnalyzers.Test.Helpers
/// <param name="documents">The Documents that the analyzer will be run on</param>
/// <returns>An IEnumerable of Diagnostics that surfaced in the source code, sorted by Location</returns>
[ItemNotNull]
protected static async Task<Diagnostic[]> GetSortedDiagnosticsFromDocumentsAsync(DiagnosticAnalyzer analyzer, [NotNull] Document[] documents)
protected static async Task<Diagnostic[]> GetSortedDiagnosticsFromDocumentsAsync(DiagnosticAnalyzer analyzer, [JetBrains.Annotations.NotNull] Document[] documents)
{
var projects = new HashSet<Project>();
foreach (var document in documents)
......@@ -137,8 +137,8 @@ namespace ZilfAnalyzers.Test.Helpers
/// </summary>
/// <param name="diagnostics">The list of Diagnostics to be sorted</param>
/// <returns>An IEnumerable containing the Diagnostics in order of Location</returns>
[NotNull]
static Diagnostic[] SortDiagnostics([NotNull] IEnumerable<Diagnostic> diagnostics)
[JetBrains.Annotations.NotNull]
static Diagnostic[] SortDiagnostics([JetBrains.Annotations.NotNull] IEnumerable<Diagnostic> diagnostics)
{
return diagnostics.OrderBy(d => d.Location.SourceSpan.Start).ToArray();
}
......@@ -152,8 +152,8 @@ namespace ZilfAnalyzers.Test.Helpers
/// <param name="sources">Classes in the form of strings</param>
/// <param name="language">The language the source code is in</param>
/// <returns>A Tuple containing the Documents produced from the sources and their TextSpans if relevant</returns>
[NotNull]
static Document[] GetDocuments([NotNull] string[] sources, [NotNull] string language)
[JetBrains.Annotations.NotNull]
static Document[] GetDocuments([JetBrains.Annotations.NotNull] string[] sources, [JetBrains.Annotations.NotNull] string language)
{
if (language != LanguageNames.CSharp && language != LanguageNames.VisualBasic)
{
......@@ -188,7 +188,7 @@ namespace ZilfAnalyzers.Test.Helpers
/// <param name="sources">Classes in the form of strings</param>
/// <param name="language">The language the source code is in</param>
/// <returns>A Project created out of the Documents created from the source strings</returns>
static Project CreateProject([NotNull] string[] sources, string language = LanguageNames.CSharp)
static Project CreateProject([JetBrains.Annotations.NotNull] string[] sources, string language = LanguageNames.CSharp)
{
string fileNamePrefix = DefaultFilePathPrefix;
string fileExt = language == LanguageNames.CSharp ? CSharpDefaultFileExt : VisualBasicDefaultExt;
......
......@@ -53,7 +53,7 @@ namespace ZilfAnalyzers.Test.Helpers
Assert.AreEqual(expectedValue, actualValue);
}
[NotNull]
[JetBrains.Annotations.NotNull]
static string ToSafeString(this char c)
{
switch (c)
......
......@@ -155,7 +155,7 @@ namespace Zilf.Diagnostics {
await VerifyCSharpFixAsync(test, fixtest);
}
[NotNull]
[JetBrains.Annotations.NotNull]
protected override DiagnosticAnalyzer GetCSharpDiagnosticAnalyzer()
{
return new MessageConstantAnalyzer();
......
......@@ -23,14 +23,14 @@ namespace ZilfAnalyzers.Test.Helpers
/// Returns the codefix being tested (C#) - to be implemented in non-abstract class
/// </summary>
/// <returns>The CodeFixProvider to be used for CSharp code</returns>
[NotNull]
[JetBrains.Annotations.NotNull]
protected abstract CodeFixProvider GetCSharpCodeFixProvider();
/// <summary>
/// Returns the codefix being tested (VB) - to be implemented in non-abstract class
/// </summary>
/// <returns>The CodeFixProvider to be used for VisualBasic code</returns>
[NotNull]
[JetBrains.Annotations.NotNull]
protected abstract CodeFixProvider GetBasicCodeFixProvider();
/// <summary>
......@@ -70,7 +70,7 @@ namespace ZilfAnalyzers.Test.Helpers
/// <param name="newSource">A class in the form of a string after the CodeFix was applied to it</param>
/// <param name="codeFixIndex">Index determining which codefix to apply if there are multiple</param>
/// <param name="allowNewCompilerDiagnostics">A bool controlling whether or not the test will fail if the CodeFix introduces other warnings after being applied</param>
static async Task VerifyFixAsync(string language, DiagnosticAnalyzer analyzer, [NotNull] CodeFixProvider codeFixProvider, string oldSource, string newSource, int? codeFixIndex, bool allowNewCompilerDiagnostics)
static async Task VerifyFixAsync(string language, DiagnosticAnalyzer analyzer, [JetBrains.Annotations.NotNull] CodeFixProvider codeFixProvider, string oldSource, string newSource, int? codeFixIndex, bool allowNewCompilerDiagnostics)
{
var document = CreateDocument(oldSource, language);
var analyzerDiagnostics = await GetSortedDiagnosticsFromDocumentsAsync(analyzer, new[] { document }).ConfigureAwait(false);
......
......@@ -38,7 +38,7 @@ namespace ZilfAnalyzers.Test.Helpers
/// </summary>
/// <param name="source">A class in the form of a string to run the analyzer on</param>
/// <param name="expected"> DiagnosticResults that should appear after the analyzer is run on the source</param>
protected async Task VerifyCSharpDiagnosticAsync(string source, [NotNull] params DiagnosticResult[] expected)
protected async Task VerifyCSharpDiagnosticAsync(string source, [JetBrains.Annotations.NotNull] params DiagnosticResult[] expected)
{
await VerifyDiagnosticsAsync(new[] { source }, LanguageNames.CSharp, GetCSharpDiagnosticAnalyzer(), expected);
}
......@@ -49,7 +49,7 @@ namespace ZilfAnalyzers.Test.Helpers
/// </summary>
/// <param name="source">A class in the form of a string to run the analyzer on</param>
/// <param name="expected">DiagnosticResults that should appear after the analyzer is run on the source</param>
protected async Task VerifyBasicDiagnosticAsync(string source, [NotNull] params DiagnosticResult[] expected)
protected async Task VerifyBasicDiagnosticAsync(string source, [JetBrains.Annotations.NotNull] params DiagnosticResult[] expected)
{
await VerifyDiagnosticsAsync(new[] { source }, LanguageNames.VisualBasic, GetBasicDiagnosticAnalyzer(), expected);
}
......@@ -60,7 +60,7 @@ namespace ZilfAnalyzers.Test.Helpers
/// </summary>
/// <param name="sources">An array of strings to create source documents from to run the analyzers on</param>
/// <param name="expected">DiagnosticResults that should appear after the analyzer is run on the sources</param>
protected async Task VerifyCSharpDiagnosticAsync([NotNull] string[] sources, [NotNull] params DiagnosticResult[] expected)
protected async Task VerifyCSharpDiagnosticAsync([JetBrains.Annotations.NotNull] string[] sources, [JetBrains.Annotations.NotNull] params DiagnosticResult[] expected)
{
await VerifyDiagnosticsAsync(sources, LanguageNames.CSharp, GetCSharpDiagnosticAnalyzer(), expected);
}
......@@ -71,7 +71,7 @@ namespace ZilfAnalyzers.Test.Helpers
/// </summary>
/// <param name="sources">An array of strings to create source documents from to run the analyzers on</param>
/// <param name="expected">DiagnosticResults that should appear after the analyzer is run on the sources</param>
protected async Task VerifyBasicDiagnosticAsync([NotNull] string[] sources, [NotNull] params DiagnosticResult[] expected)
protected async Task VerifyBasicDiagnosticAsync([JetBrains.Annotations.NotNull] string[] sources, [JetBrains.Annotations.NotNull] params DiagnosticResult[] expected)
{
await VerifyDiagnosticsAsync(sources, LanguageNames.VisualBasic, GetBasicDiagnosticAnalyzer(), expected);
}
......@@ -84,7 +84,7 @@ namespace ZilfAnalyzers.Test.Helpers
/// <param name="language">The language of the classes represented by the source strings</param>
/// <param name="analyzer">The analyzer to be run on the source code</param>
/// <param name="expected">DiagnosticResults that should appear after the analyzer is run on the sources</param>
static async Task VerifyDiagnosticsAsync([NotNull] string[] sources, [NotNull] string language, DiagnosticAnalyzer analyzer, [NotNull] params DiagnosticResult[] expected)
static async Task VerifyDiagnosticsAsync([JetBrains.Annotations.NotNull] string[] sources, [JetBrains.Annotations.NotNull] string language, DiagnosticAnalyzer analyzer, [JetBrains.Annotations.NotNull] params DiagnosticResult[] expected)
{
var diagnostics = await GetSortedDiagnosticsAsync(sources, language, analyzer).ConfigureAwait(false);
VerifyDiagnosticResults(diagnostics, analyzer, expected);
......@@ -100,7 +100,7 @@ namespace ZilfAnalyzers.Test.Helpers
/// <param name="actualResults">The Diagnostics found by the compiler after running the analyzer on the source code</param>
/// <param name="analyzer">The analyzer that was being run on the sources</param>
/// <param name="expectedResults">Diagnostic Results that should have appeared in the code</param>
static void VerifyDiagnosticResults([NotNull] IEnumerable<Diagnostic> actualResults, DiagnosticAnalyzer analyzer, [NotNull] params DiagnosticResult[] expectedResults)
static void VerifyDiagnosticResults([JetBrains.Annotations.NotNull] IEnumerable<Diagnostic> actualResults, DiagnosticAnalyzer analyzer, [JetBrains.Annotations.NotNull] params DiagnosticResult[] expectedResults)
{
var expectedCount = expectedResults.Length;
var actualResultsArray = actualResults as Diagnostic[] ?? actualResults.ToArray();
......@@ -172,7 +172,7 @@ namespace ZilfAnalyzers.Test.Helpers
/// <param name="diagnostic">The diagnostic that was found in the code</param>
/// <param name="actual">The Location of the Diagnostic found in the code</param>
/// <param name="expected">The DiagnosticResultLocation that should have been found</param>
static void VerifyDiagnosticLocation(DiagnosticAnalyzer analyzer, Diagnostic diagnostic, [NotNull] Location actual, DiagnosticResultLocation expected)
static void VerifyDiagnosticLocation(DiagnosticAnalyzer analyzer, Diagnostic diagnostic, [JetBrains.Annotations.NotNull] Location actual, DiagnosticResultLocation expected)
{
var actualSpan = actual.GetLineSpan();
......@@ -213,8 +213,8 @@ namespace ZilfAnalyzers.Test.Helpers
/// <param name="analyzer">The analyzer that this verifier tests</param>
/// <param name="diagnostics">The Diagnostics to be formatted</param>
/// <returns>The Diagnostics formatted as a string</returns>
[NotNull]
static string FormatDiagnostics(DiagnosticAnalyzer analyzer, [NotNull] params Diagnostic[] diagnostics)
[JetBrains.Annotations.NotNull]
static string FormatDiagnostics(DiagnosticAnalyzer analyzer, [JetBrains.Annotations.NotNull] params Diagnostic[] diagnostics)
{
var builder = new StringBuilder();
for (int i = 0; i < diagnostics.Length; ++i)
......
......@@ -208,7 +208,7 @@ namespace Zilf.Diagnostics {
#endif
}
[NotNull]
[JetBrains.Annotations.NotNull]
protected override DiagnosticAnalyzer GetCSharpDiagnosticAnalyzer()
{
return new ZilObjectAnalyzer();
......
......@@ -6,14 +6,14 @@
<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2019.1.3" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="3.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="3.3.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="16.7.3069">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="MSTest.TestAdapter" Version="1.4.0" />
<PackageReference Include="MSTest.TestFramework" Version="1.4.0" />
<PackageReference Include="MSTest.TestAdapter" Version="2.0.0" />
<PackageReference Include="MSTest.TestFramework" Version="2.0.0" />
</ItemGroup>
<ItemGroup>
......
[*.cs]
# RNUL: Parameter is missing nullability annotation.
dotnet_diagnostic.RNUL.severity = silent
# RINUL: Parameter is missing item nullability annotation.
dotnet_diagnostic.RINUL.severity = silent
......@@ -27,6 +27,8 @@ namespace ZilfAnalyzers
public override void Initialize([NotNull] AnalysisContext context)
{
context.EnableConcurrentExecution();
context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.Analyze | GeneratedCodeAnalysisFlags.ReportDiagnostics);
context.RegisterSyntaxNodeAction(AnalyzeNode, SyntaxKind.ObjectCreationExpression);
}
......
......@@ -51,6 +51,8 @@ namespace ZilfAnalyzers
public override void Initialize([NotNull] AnalysisContext context)
{
context.EnableConcurrentExecution();
context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.Analyze | GeneratedCodeAnalysisFlags.ReportDiagnostics);
context.RegisterSyntaxNodeAction(AnalyzeNode, SyntaxKind.ClassDeclaration);
}
......
......@@ -28,7 +28,6 @@ namespace ZilfAnalyzers
DiagnosticSeverity.Warning,
isEnabledByDefault: true);
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } =
ImmutableArray.Create(
Rule_ComparingZilObjectsWithEquals,
......@@ -36,6 +35,8 @@ namespace ZilfAnalyzers
public override void Initialize([NotNull] AnalysisContext context)
{
context.EnableConcurrentExecution();
context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.Analyze | GeneratedCodeAnalysisFlags.ReportDiagnostics);
context.RegisterSyntaxNodeAction(AnalyzeMemberAccessishNode, SyntaxKind.SimpleMemberAccessExpression, SyntaxKind.ConditionalAccessExpression);
context.RegisterSyntaxNodeAction(AnalyzeInvocationNode, SyntaxKind.InvocationExpression);
context.RegisterSymbolAction(AnalyzeClassSymbol, SymbolKind.NamedType);
......@@ -63,7 +64,7 @@ namespace ZilfAnalyzers
{
var diagnostic = Diagnostic.Create(
Rule_PartiallyOverriddenZilObjectComparison,
overridingMethod.Locations.First(),
overridingMethod.Locations[0],
type.ToDisplayString(SymbolDisplayFormat.CSharpShortErrorMessageFormat),
baseEqualsMethod.ToDisplayString(SymbolDisplayFormat.CSharpShortErrorMessageFormat),
baseExactlyEqualsMethod?.ToDisplayString(SymbolDisplayFormat.CSharpShortErrorMessageFormat));
......
......@@ -24,7 +24,7 @@
<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2019.1.3" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="3.1.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="3.3.1" PrivateAssets="all" />
<!--<PackageReference Update="NETStandard.Library" PrivateAssets="all" />-->
</ItemGroup>
......
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<TargetFramework>netcoreapp3.0</TargetFramework>
<OutputType>Exe</OutputType>
<Product>ZILF</Product>
<Version>0.8</Version>
......@@ -13,7 +13,7 @@
<None Include="..\Zilf.licenseheader" Link="Zilf.licenseheader" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2018.3.0">
<PackageReference Include="JetBrains.Annotations" Version="2019.1.3">
<PrivateAssets>all</PrivateAssets>
<ExcludeAssets>runtime</ExcludeAssets>
<IncludeAssets>compile; build; native; contentfiles; analyzers</IncludeAssets>
......
[*.cs]
# RCS1194: Implement exception constructors.
dotnet_diagnostic.RCS1194.severity = suggestion
# RCS1139: Add summary element to documentation comment.
dotnet_diagnostic.RCS1139.severity = silent
......@@ -18,26 +18,25 @@
using System;
using System.Runtime.Serialization;
using JetBrains.Annotations;
namespace Zapf.Parsing.Diagnostics
{
[Serializable]
public abstract class AssemblerError : Exception
{
protected AssemblerError(ISourceLine node, string message)
protected AssemblerError(ISourceLine? node, string message)
: base(message)
{
Node = node;
}
protected AssemblerError([NotNull] SerializationInfo info, StreamingContext context)
protected AssemblerError(SerializationInfo info, StreamingContext context)
: base(info, context)
{
Node = (ISourceLine)info.GetValue("node", typeof(ISourceLine));
}
public ISourceLine Node { get; }
public ISourceLine? Node { get; }
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
......
......@@ -16,62 +16,62 @@
* along with ZILF. If not, see <http://www.gnu.org/licenses/>.
*/
using System.Diagnostics.CodeAnalysis;
using JetBrains.Annotations;
namespace Zapf.Parsing.Diagnostics
{
public static class Errors
{
public static void Warn([NotNull] IErrorSink sink, [CanBeNull] ISourceLine node, [NotNull] string message)
public static void Warn(IErrorSink sink, ISourceLine? node, string message)
{
sink.HandleWarning(new Warning(node, message));
}
[StringFormatMethod("format")]
public static void Warn([NotNull] IErrorSink sink, [CanBeNull] ISourceLine node, [NotNull] string format, [NotNull] params object[] args)
public static void Warn(IErrorSink sink, ISourceLine? node, string format, params object[] args)
{
Warn(sink, node, string.Format(format, args));
}
public static void Serious([NotNull] IErrorSink sink, [NotNull] string message)
public static void Serious(IErrorSink sink, string message)
{
Serious(sink, null, message);
}
[StringFormatMethod("format")]
public static void Serious([NotNull] IErrorSink sink, [NotNull] string format, [NotNull] params object[] args)
public static void Serious(IErrorSink sink, string format, params object[] args)
{
Serious(sink, string.Format(format, args));
}
public static void Serious([NotNull] IErrorSink sink, ISourceLine node, [NotNull] string message)
public static void Serious(IErrorSink sink, ISourceLine? node, string message)
{
sink.HandleSeriousError(new SeriousError(node, message));
}
[StringFormatMethod("format")]
public static void Serious([NotNull] IErrorSink sink, ISourceLine node, [NotNull] string format,
[NotNull] params object[] args)
public static void Serious(IErrorSink sink, ISourceLine? node, string format,
params object[] args)
{
Serious(sink, node, string.Format(format, args));
}
[NotNull]
public static SeriousError MakeSerious(ISourceLine node, [NotNull] string message)
public static SeriousError MakeSerious(ISourceLine? node, string message)
{
return new SeriousError(node, message);
}
[NotNull]
[StringFormatMethod("format")]
public static SeriousError MakeSerious(ISourceLine node, [NotNull] string format, [NotNull] params object[] args)
public static SeriousError MakeSerious(ISourceLine? node, string format, params object[] args)
{
return MakeSerious(node, string.Format(format, args));
}
/// <exception cref="SeriousError">Always thrown.</exception>
[ContractAnnotation("=> halt")]
public static void ThrowSerious([NotNull] string message)
[DoesNotReturn]
public static void ThrowSerious(string message)
{
ThrowSerious(null, message);
}
......@@ -79,14 +79,16 @@ namespace Zapf.Parsing.Diagnostics
/// <exception cref="SeriousError">Always thrown.</exception>
[ContractAnnotation("=> halt")]
[StringFormatMethod("format")]
public static void ThrowSerious([NotNull] string format, [NotNull] params object[] args)
[DoesNotReturn]
public static void ThrowSerious(string format, params object[] args)
{
ThrowSerious(null, format, args);
}
/// <exception cref="SeriousError">Always thrown.</exception>
[ContractAnnotation("=> halt")]
public static void ThrowSerious(ISourceLine node, [NotNull] string message)
[DoesNotReturn]
public static void ThrowSerious(ISourceLine? node, string message)
{
throw MakeSerious(node, message);
}
......@@ -94,14 +96,16 @@ namespace Zapf.Parsing.Diagnostics
/// <exception cref="SeriousError">Always thrown.</exception>
[ContractAnnotation("=> halt")]
[StringFormatMethod("format")]
public static void ThrowSerious(ISourceLine node, [NotNull] string format, [NotNull] params object[] args)
[DoesNotReturn]
public static void ThrowSerious(ISourceLine? node, string format, params object[] args)
{
throw MakeSerious(node, format, args);
}