From e5decb744c05dcce3f23ec0757517711a0ecb900 Mon Sep 17 00:00:00 2001 From: Sergey Andreenko Date: Thu, 25 Apr 2019 10:42:54 -0700 Subject: Add a repro test. --- .../JitBlue/GitHub_24185/GitHub_24185.cs | 36 ++++++++++++++++++++++ .../JitBlue/GitHub_24185/GitHub_24185.csproj | 33 ++++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 tests/src/JIT/Regression/JitBlue/GitHub_24185/GitHub_24185.cs create mode 100644 tests/src/JIT/Regression/JitBlue/GitHub_24185/GitHub_24185.csproj (limited to 'tests') diff --git a/tests/src/JIT/Regression/JitBlue/GitHub_24185/GitHub_24185.cs b/tests/src/JIT/Regression/JitBlue/GitHub_24185/GitHub_24185.cs new file mode 100644 index 0000000000..3695ab2a8f --- /dev/null +++ b/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/tests/src/JIT/Regression/JitBlue/GitHub_24185/GitHub_24185.csproj b/tests/src/JIT/Regression/JitBlue/GitHub_24185/GitHub_24185.csproj new file mode 100644 index 0000000000..cc72c511df --- /dev/null +++ b/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 -- cgit v1.2.3