diff --git a/tests/PolySharp.Tests/LanguageFeatures.cs b/tests/PolySharp.Tests/LanguageFeatures.cs index ff14210..b7fd966 100644 --- a/tests/PolySharp.Tests/LanguageFeatures.cs +++ b/tests/PolySharp.Tests/LanguageFeatures.cs @@ -1,4 +1,6 @@ using System; +using System.Collections; +using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; using System.Runtime.Versioning; @@ -102,6 +104,10 @@ public static void InitializeModule() { } + public void RefReadonlyMethod(ref readonly int x) + { + } + [Experimental("PS0001")] public void ExperimentalMethod() { @@ -151,6 +157,30 @@ public static ReadOnlySpan TestRange(ReadOnlySpan numbers) } } +[CollectionBuilder(typeof(CollectionClass), nameof(Create))] +internal class CollectionClass : IEnumerable +{ + public CollectionClass Test() + { + return [1, 2, 3]; + } + + public static CollectionClass Create(ReadOnlySpan values) + { + return new(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return null!; + } + + IEnumerator IEnumerable.GetEnumerator() + { + return null!; + } +} + internal class AnotherTestClass { // CallerArgumentExpressionAttribute diff --git a/tests/PolySharp.Tests/RuntimeSupport.cs b/tests/PolySharp.Tests/RuntimeSupport.cs index 211cfaa..1e34a92 100644 --- a/tests/PolySharp.Tests/RuntimeSupport.cs +++ b/tests/PolySharp.Tests/RuntimeSupport.cs @@ -84,4 +84,19 @@ public void MakeUpSomeNewType() public void ReferenceSomeAssemblyFile() { } +} + +internal class AccessorApis +{ +#pragma warning disable IDE0044 + private int field; +#pragma warning restore IDE0044 + + [StackTraceHidden] + public void HideMe() + { + } + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = nameof(field))] + public static extern ref int GetField(RandomApis obj); } \ No newline at end of file