Skip to content

Commit dea5189

Browse files
committed
net5.0 target; fixes; use ParserConstruction namespace for Superpower types
1 parent da683a0 commit dea5189

39 files changed

+62
-81
lines changed

src/Serilog.Expressions/Expressions/Ast/ConstantExpression.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public override string ToString()
2828
case IFormattable formattable:
2929
return formattable.ToString(null, CultureInfo.InvariantCulture);
3030
default:
31-
return (sv.Value ?? "null").ToString();
31+
return (sv.Value ?? "null").ToString() ?? "<ToString() returned null>";
3232
}
3333
}
3434

src/Serilog.Expressions/Expressions/Parsing/Combinators.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
using System;
2-
using Serilog.Superpower;
3-
using Serilog.Superpower.Model;
42

53
namespace Serilog.Expressions.Parsing
64
{

src/Serilog.Expressions/Expressions/Parsing/ExpressionTextParsers.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
using Serilog.Superpower;
2-
using Serilog.Superpower.Model;
3-
using Serilog.Superpower.Parsers;
4-
5-
namespace Serilog.Expressions.Parsing
1+
namespace Serilog.Expressions.Parsing
62
{
73
static class ExpressionTextParsers
84
{

src/Serilog.Expressions/Expressions/Parsing/ExpressionToken.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
using Serilog.Superpower.Display;
2-
3-
namespace Serilog.Expressions.Parsing
1+
namespace Serilog.Expressions.Parsing
42
{
53
enum ExpressionToken
64
{

src/Serilog.Expressions/Expressions/Parsing/ExpressionTokenParsers.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
using System.Linq;
44
using Serilog.Events;
55
using Serilog.Expressions.Ast;
6-
using Serilog.Superpower;
7-
using Serilog.Superpower.Model;
8-
using Serilog.Superpower.Parsers;
96

107
namespace Serilog.Expressions.Parsing
118
{

src/Serilog.Expressions/Expressions/Parsing/ExpressionTokenizer.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
using System.Collections.Generic;
22
using System.Linq;
3-
using Serilog.Superpower;
4-
using Serilog.Superpower.Model;
53

64
namespace Serilog.Expressions.Parsing
75
{

src/Serilog.Expressions/Expressions/Parsing/ParserExtensions.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
using System;
2-
using Serilog.Superpower;
3-
using Serilog.Superpower.Model;
42

53
namespace Serilog.Expressions.Parsing
64
{

src/Serilog.Expressions/Expressions/Runtime/Coerce.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public static bool String(LogEventPropertyValue? value, [MaybeNullWhen(false)] o
6262

6363
if (sv.Value?.GetType().IsEnum ?? false)
6464
{
65-
str = sv.Value.ToString();
65+
str = sv.Value.ToString()!;
6666
return true;
6767
}
6868
}

src/Serilog.Expressions/Expressions/Runtime/RuntimeOperators.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -470,14 +470,14 @@ public static LogEventPropertyValue _Internal_IsNotNull(LogEventPropertyValue? v
470470

471471
public static LogEventPropertyValue? ToString(LogEventPropertyValue? value, LogEventPropertyValue? format)
472472
{
473-
if (!(value is ScalarValue sv) ||
473+
if (value is not ScalarValue sv ||
474474
sv.Value == null ||
475-
!(Coerce.String(format, out var fmt) || format == null || format is ScalarValue { Value: null }))
475+
!(Coerce.String(format, out var fmt) || format is null or ScalarValue { Value: null }))
476476
{
477477
return null;
478478
}
479479

480-
string toString;
480+
string? toString;
481481
if (sv.Value is IFormattable formattable)
482482
{
483483
// TODO #19: formatting is culture-specific.

src/Serilog.Expressions/Expressions/StaticMemberNameResolver.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Diagnostics.CodeAnalysis;
34
using System.Linq;
45
using System.Reflection;
56

@@ -27,9 +28,9 @@ public StaticMemberNameResolver(Type type)
2728
}
2829

2930
/// <inheritdoc />
30-
public override bool TryResolveFunctionName(string name, out MethodInfo implementation)
31+
public override bool TryResolveFunctionName(string name, [MaybeNullWhen(false)] out MethodInfo implementation)
3132
{
3233
return _methods.TryGetValue(name, out implementation);
3334
}
3435
}
35-
}
36+
}

0 commit comments

Comments
 (0)