From 401259abb87c3658f5c324fb9f1de59d50c1d63c Mon Sep 17 00:00:00 2001 From: Sergey Andreenko Date: Thu, 25 Apr 2019 10:42:54 -0700 Subject: [PATCH] Add a repro test. Commit migrated from https://github.com/dotnet/coreclr/commit/e5decb744c05dcce3f23ec0757517711a0ecb900 --- .../JitBlue/GitHub_24185/GitHub_24185.cs | 36 ++++++++++++++++++++++ .../JitBlue/GitHub_24185/GitHub_24185.csproj | 33 ++++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_24185/GitHub_24185.cs create mode 100644 src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_24185/GitHub_24185.csproj diff --git a/src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_24185/GitHub_24185.cs b/src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_24185/GitHub_24185.cs new file mode 100644 index 0000000..3695ab2 --- /dev/null +++ b/src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_24185/GitHub_24185.cs @@ -0,0 +1,36 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Threading; +using System.Threading.Tasks; + +// The test shows recursive assertion propogation in one statement. + +namespace GitHub_24185 +{ + public class Program + { + static int Main(string[] args) + { + try + { + throw new AggregateException(new Exception("A random exception1"), new Exception("A random exception2")); + } + catch (Exception e) + { + // Each expression in this condition checks that `e` is not null and checks its type. + // This information should be calculated once and propogated by assertion propogation. + if (!(e is AggregateException) || + !((((AggregateException)e).InnerExceptions[0] is ArgumentException) + || ((AggregateException)e).InnerExceptions[0] is AggregateException)) + { + return 100; + } + + } + return 0; + } + } +} diff --git a/src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_24185/GitHub_24185.csproj b/src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_24185/GitHub_24185.csproj new file mode 100644 index 0000000..cc72c51 --- /dev/null +++ b/src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_24185/GitHub_24185.csproj @@ -0,0 +1,33 @@ + + + + + Debug + AnyCPU + 2.0 + {95DFC527-4DC1-495E-97D7-E94EE1F7140D} + Exe + {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + ..\..\ + + + + + + + False + + + + None + True + + + + + + + + + + \ No newline at end of file -- 2.7.4