diff --git a/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj b/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj index 1993cc873..0282f9d00 100644 --- a/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj +++ b/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj @@ -8,7 +8,7 @@ net10.0-windows - 13 + preview win-x64 win-arm64 @@ -146,6 +146,7 @@ + diff --git a/ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs b/ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs index dfc3eb8ac..d67877e72 100644 --- a/ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs +++ b/ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs @@ -527,6 +527,12 @@ namespace ICSharpCode.Decompiler.Tests await RunForLibrary(cscOptions: cscOptions | CompilerOptions.NullableEnable); } + [Test] + public async Task ExtensionProperties([ValueSource(nameof(roslyn4OrNewerOptions))] CompilerOptions cscOptions) + { + await RunForLibrary(cscOptions: cscOptions | CompilerOptions.Preview); + } + [Test] public async Task NullPropagation([ValueSource(nameof(roslynOnlyOptions))] CompilerOptions cscOptions) { diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/ExtensionProperties.cs b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/ExtensionProperties.cs new file mode 100644 index 000000000..691276561 --- /dev/null +++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/ExtensionProperties.cs @@ -0,0 +1,38 @@ +using System.Collections.Generic; +using System.Linq; + +namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty +{ + internal static class ExtensionProperties + { + extension(ICollection collection) where T : notnull + { + public bool IsEmpty => collection.Count == 0; + + public int Test { + get { + return 42; + } + set { + } + } + + public void AddIfNotNull(T item) + { + if (item != null) + { + collection.Add(item); + } + } + + public T2 Cast(int index) where T2 : T + { + return (T2)(object)collection.ElementAt(index); + } + + public static void StaticExtension() + { + } + } + } +}