Skip to content

Commit 609f497

Browse files
authored
Merge pull request #100 from nblumhardt/cs-accessors-2
Accessors such as `a.B` should be case-sensitive
2 parents 082b805 + 372d968 commit 609f497

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/Serilog.Expressions/Expressions/Compilation/Linq/LinqExpressionCompiler.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,8 @@ static ExpressionBody CompileLogical(Func<ExpressionBody, ExpressionBody, Expres
186186
protected override ExpressionBody Transform(AccessorExpression spx)
187187
{
188188
var receiver = Transform(spx.Receiver);
189-
return LX.Call(TryGetStructurePropertyValueMethod, LX.Constant(StringComparison.OrdinalIgnoreCase), receiver, LX.Constant(spx.MemberName, typeof(string)));
189+
return LX.Call(TryGetStructurePropertyValueMethod, LX.Constant(StringComparison.Ordinal), receiver, LX.Constant(spx.MemberName, typeof(string)));
190190
}
191-
192191
protected override ExpressionBody Transform(ConstantExpression cx)
193192
{
194193
return LX.Constant(cx.Constant);

test/Serilog.Expressions.Tests/Cases/expression-evaluation-cases.asv

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ false ⇶ false
2424
{a: 1, ..{b: 2}, b: undefined()} ⇶ {a: 1}
2525
{a: 1, ..{a: undefined()}} ⇶ {a: 1}
2626
{..{a: 1}, ..{b: 2, c: 3}} ⇶ {a: 1, b: 2, c: 3}
27+
{a: 1}['a'] ⇶ 1
28+
{a: 1}['A'] ⇶ undefined()
29+
{a: 1}.a ⇶ 1
30+
{a: 1}.A ⇶ undefined()
31+
ElementAt({a: 1}, 'A') ⇶ undefined()
32+
ElementAt({a: 1}, 'A') ci ⇶ 1
2733

2834
// Strings
2935
'' ⇶ ''

0 commit comments

Comments
 (0)