From de43c7356926bf0d47a5adce9afb700c23cb389d Mon Sep 17 00:00:00 2001 From: GrahamTheCoder Date: Mon, 12 Feb 2024 21:45:55 +0000 Subject: [PATCH] Test for case similar to #782 --- .../CSharp/ExpressionTests/ExpressionTests.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Tests/CSharp/ExpressionTests/ExpressionTests.cs b/Tests/CSharp/ExpressionTests/ExpressionTests.cs index 4e767005..b6875deb 100644 --- a/Tests/CSharp/ExpressionTests/ExpressionTests.cs +++ b/Tests/CSharp/ExpressionTests/ExpressionTests.cs @@ -107,6 +107,25 @@ public void S() }"); } + [Fact] + public async Task DynamicBoolAsync() + { + await TestConversionVisualBasicToCSharpAsync(@" +Public Class C + Public Function IsHybridApp() As Boolean + Return New Object().Session(""hybrid"") IsNot Nothing AndAlso New Object().Session(""hybrid"") = 1 + End Function +End Class", @"using Microsoft.VisualBasic.CompilerServices; // Install-Package Microsoft.VisualBasic + +public partial class C +{ + public bool IsHybridApp() + { + return Conversions.ToBoolean(((dynamic)new object()).Session(""hybrid"") is not null && Operators.ConditionalCompareObjectEqual(((dynamic)new object()).Session(""hybrid""), 1, false)); + } +}"); + } + [Fact] public async Task ConversionOfNotUsesParensIfNeededAsync() {