diff --git a/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj b/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj index 09f5092f0f..697ca18d97 100644 --- a/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj +++ b/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj @@ -153,7 +153,7 @@ - + diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/DynamicTests.cs b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/DynamicTests.cs index 01edd50d21..7b90338f10 100644 --- a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/DynamicTests.cs +++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/DynamicTests.cs @@ -1,4 +1,7 @@ using System; +#if CS120 +using System.Collections.Generic; +#endif namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty { @@ -74,6 +77,12 @@ private static void CallWithIn(in dynamic d) } #endif +#if CS120 + private static void CallWithRefReadonly(ref readonly Dictionary d) + { + } +#endif + private static void CallWithRef(ref dynamic d) { } diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/FunctionPointers.cs b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/FunctionPointers.cs index 9423c42542..aa49e2b792 100644 --- a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/FunctionPointers.cs +++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/FunctionPointers.cs @@ -95,14 +95,17 @@ public class B public unsafe delegate* F12; public unsafe delegate* F13; public unsafe delegate* F14; - public unsafe D[], dynamic> F15; - public unsafe delegate*.B> F16; +#if CS120 + public unsafe delegate* F15; +#endif + public unsafe D[], dynamic> F16; + public unsafe delegate*.B> F17; } internal class FunctionPointersWithNativeIntegerTypes { public unsafe delegate* F1; - #if !(CS110 && NET70) +#if !(CS110 && NET70) public unsafe delegate* F2; public unsafe delegate* F3; public unsafe delegate* F4; @@ -111,7 +114,7 @@ internal class FunctionPointersWithNativeIntegerTypes public unsafe delegate*, IntPtr> F7; public unsafe delegate*> F8; public unsafe delegate*> F9; - #endif +#endif } internal class FunctionPointersWithRefParams diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/RefLocalsAndReturns.cs b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/RefLocalsAndReturns.cs index d3e2f75c63..7a65ff10ac 100644 --- a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/RefLocalsAndReturns.cs +++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/RefLocalsAndReturns.cs @@ -326,17 +326,18 @@ public ref readonly int M(in int x) { return ref x; } + public ref readonly int M2(ref readonly int x) { return ref x; } - public void Test() - { - int x = 32; - M(in x); - M2(in x); - } + public void Test() + { + int x = 32; + M(in x); + M2(in x); + } #endif -} + } } diff --git a/ICSharpCode.Decompiler/TypeSystem/FunctionPointerType.cs b/ICSharpCode.Decompiler/TypeSystem/FunctionPointerType.cs index c2589db4df..5d71478fdd 100644 --- a/ICSharpCode.Decompiler/TypeSystem/FunctionPointerType.cs +++ b/ICSharpCode.Decompiler/TypeSystem/FunctionPointerType.cs @@ -58,17 +58,22 @@ public static FunctionPointerType FromSignature(MethodSignature signature { IType paramType = p; ReferenceKind kind = ReferenceKind.None; - if (p is ModifiedType modreq) + if (p is ModifiedType mod) { - if (modreq.Modifier.IsKnownType(KnownAttribute.In)) + if (mod.Modifier.IsKnownType(KnownAttribute.In)) { kind = ReferenceKind.In; - paramType = modreq.ElementType; + paramType = mod.ElementType; } - else if (modreq.Modifier.IsKnownType(KnownAttribute.Out)) + else if (mod.Modifier.IsKnownType(KnownAttribute.Out)) { kind = ReferenceKind.Out; - paramType = modreq.ElementType; + paramType = mod.ElementType; + } + else if (mod.Modifier.IsKnownType(KnownAttribute.RequiresLocation)) + { + kind = ReferenceKind.RefReadOnly; + paramType = mod.ElementType; } } if (paramType.Kind == TypeKind.ByReference)