diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/NullPropagation.cs b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/NullPropagation.cs index 33c4617de..efb9ec366 100644 --- a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/NullPropagation.cs +++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/NullPropagation.cs @@ -68,16 +68,42 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty { } } + + private class Container + { + public GenericStruct Other; + } private struct GenericStruct { public T1 Field1; public T2 Field2; + public Container Other; public override string ToString() { return "(" + Field1?.ToString() + ", " + Field2?.ToString() + ")"; } + + public int? GetTextLength() + { + return Field1?.ToString().Length + Field2?.ToString().Length + 4; + } + + public string Chain1() + { + return Other?.Other.Other?.Other.Field1?.ToString(); + } + + public string Chain2() + { + return Other?.Other.Other?.Other.Field1?.ToString()?.GetType().Name; + } + + public int? GetTextLengthNRE() + { + return (Field1?.ToString()).Length; + } } public interface ITest