diff --git a/external/Test/AllowsRefStructDemo.dll b/external/Test/AllowsRefStructDemo.dll new file mode 100644 index 000000000..0d77406e9 Binary files /dev/null and b/external/Test/AllowsRefStructDemo.dll differ diff --git a/mdoc/Consts.cs b/mdoc/Consts.cs index e5ef8abdd..a0045b330 100644 --- a/mdoc/Consts.cs +++ b/mdoc/Consts.cs @@ -3,7 +3,7 @@ namespace Mono.Documentation { public static class Consts { - public static string MonoVersion = "5.9.3.8"; + public static string MonoVersion = "5.9.4"; public const string DocId = "DocId"; public const string CppCli = "C++ CLI"; public const string CppCx = "C++ CX"; diff --git a/mdoc/Mono.Documentation/MDocUpdater.Member.cs b/mdoc/Mono.Documentation/MDocUpdater.Member.cs index 22b0f4ff0..5e065ae01 100644 --- a/mdoc/Mono.Documentation/MDocUpdater.Member.cs +++ b/mdoc/Mono.Documentation/MDocUpdater.Member.cs @@ -44,6 +44,9 @@ internal static void MakeTypeParameterConstraints(XmlElement root, XmlElement e, AppendElementText(ce, "ParameterAttribute", "NotNullableValueTypeConstraint"); if ((attrs & GenericParameterAttributes.ReferenceTypeConstraint) != 0) AppendElementText(ce, "ParameterAttribute", "ReferenceTypeConstraint"); + // Check for 'allows ref struct' constraint + if ((attrs & (GenericParameterAttributes)0x0020) != 0) // Assuming 0x0020 is the flag for 'allows ref struct' + AppendElementText(ce, "ParameterAttribute", "AllowByRefLike"); #if NEW_CECIL foreach (GenericParameterConstraint c in constraints) diff --git a/mdoc/Mono.Documentation/Updater/Formatters/CSharpFullMemberFormatter.cs b/mdoc/Mono.Documentation/Updater/Formatters/CSharpFullMemberFormatter.cs index ec0f20573..2bc1d7dab 100644 --- a/mdoc/Mono.Documentation/Updater/Formatters/CSharpFullMemberFormatter.cs +++ b/mdoc/Mono.Documentation/Updater/Formatters/CSharpFullMemberFormatter.cs @@ -314,9 +314,10 @@ private StringBuilder AppendConstraints (StringBuilder buf, IList 0 || isnew) + buf.Append(", "); + buf.Append("allows ref struct"); + } } return buf; } diff --git a/mdoc/mdoc.Test/FormatterTests.cs b/mdoc/mdoc.Test/FormatterTests.cs index 187c7fa27..71e86194a 100644 --- a/mdoc/mdoc.Test/FormatterTests.cs +++ b/mdoc/mdoc.Test/FormatterTests.cs @@ -601,6 +601,24 @@ public void CSharpStaticEventImplementation(string typeFullName, string eventNam TestEventSignature(staticVirtualMemberDllPath, typeFullName, eventName, expectedSignature); } + [TestCase("AllowsRefStructDemo.IRefStructProcessor`1", + "public interface IRefStructProcessor where T : allows ref struct")] + public void CSharpAllowsRefStructForTypeTest(string typeFullName, string expectedSignature) + { + var allowsRefStructDllPath = "../../../../external/Test/AllowsRefStructDemo.dll"; + TestTypeSignature(allowsRefStructDllPath, typeFullName, expectedSignature); + } + + [TestCase("AllowsRefStructDemo.Immutable", "Update", + "public bool Update (TArg transformerArgument) where TArg : new(), allows ref struct;")] + [TestCase("AllowsRefStructDemo.RefStructHandler", "Handle", + "public void Handle (ref T item) where T : new(), allows ref struct;")] + public void CSharpAllowsRefStructForMemberTest(string typeFullName, string methodName, string expectedSignature) + { + var allowsRefStructDllPath = "../../../../external/Test/AllowsRefStructDemo.dll"; + TestMethodSignature(allowsRefStructDllPath, typeFullName, methodName, expectedSignature); + } + #region Helper Methods string RealTypeName(string name){ switch (name) { diff --git a/mdoc/mdoc.nuspec b/mdoc/mdoc.nuspec index 1b49673cf..8257cc2cb 100644 --- a/mdoc/mdoc.nuspec +++ b/mdoc/mdoc.nuspec @@ -2,7 +2,7 @@ mdoc - 5.9.3.8 + 5.9.4 mdoc Microsoft Microsoft