repo_name
stringclasses 6
values | pr_number
int64 512
78.9k
| pr_title
stringlengths 3
144
| pr_description
stringlengths 0
30.3k
| author
stringlengths 2
21
| date_created
timestamp[ns, tz=UTC] | date_merged
timestamp[ns, tz=UTC] | previous_commit
stringlengths 40
40
| pr_commit
stringlengths 40
40
| query
stringlengths 17
30.4k
| filepath
stringlengths 9
210
| before_content
stringlengths 0
112M
| after_content
stringlengths 0
112M
| label
int64 -1
1
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Compilers/Server/VBCSCompilerTests/AnalyzerConsistencyCheckerTests.cs | // 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.
#nullable disable
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CommandLine;
using Microsoft.CodeAnalysis.CSharp;
using Roslyn.Test.Utilities;
using Xunit;
using Xunit.Abstractions;
namespace Microsoft.CodeAnalysis.CompilerServer.UnitTests
{
public class AnalyzerConsistencyCheckerTests : TestBase
{
private ICompilerServerLogger Logger { get; }
public AnalyzerConsistencyCheckerTests(ITestOutputHelper testOutputHelper)
{
Logger = new XunitCompilerServerLogger(testOutputHelper);
}
[Fact]
public void MissingReference()
{
var directory = Temp.CreateDirectory();
var alphaDll = directory.CreateFile("Alpha.dll").WriteAllBytes(TestResources.AssemblyLoadTests.Alpha);
var analyzerReferences = ImmutableArray.Create(new CommandLineAnalyzerReference("Alpha.dll"));
var result = AnalyzerConsistencyChecker.Check(directory.Path, analyzerReferences, new InMemoryAssemblyLoader(), Logger);
Assert.True(result);
}
[Fact]
public void AllChecksPassed()
{
var directory = Temp.CreateDirectory();
var alphaDll = directory.CreateFile("Alpha.dll").WriteAllBytes(TestResources.AssemblyLoadTests.Alpha);
var betaDll = directory.CreateFile("Beta.dll").WriteAllBytes(TestResources.AssemblyLoadTests.Beta);
var gammaDll = directory.CreateFile("Gamma.dll").WriteAllBytes(TestResources.AssemblyLoadTests.Gamma);
var deltaDll = directory.CreateFile("Delta.dll").WriteAllBytes(TestResources.AssemblyLoadTests.Delta);
var analyzerReferences = ImmutableArray.Create(
new CommandLineAnalyzerReference("Alpha.dll"),
new CommandLineAnalyzerReference("Beta.dll"),
new CommandLineAnalyzerReference("Gamma.dll"),
new CommandLineAnalyzerReference("Delta.dll"));
var result = AnalyzerConsistencyChecker.Check(directory.Path, analyzerReferences, new InMemoryAssemblyLoader(), Logger);
Assert.True(result);
}
[Fact]
public void DifferingMvids()
{
var directory = Temp.CreateDirectory();
// Load Beta.dll from the future Alpha.dll path to prime the assembly loader
var alphaDll = directory.CreateFile("Alpha.dll").WriteAllBytes(TestResources.AssemblyLoadTests.Beta);
var assemblyLoader = new InMemoryAssemblyLoader();
var betaAssembly = assemblyLoader.LoadFromPath(alphaDll.Path);
alphaDll.WriteAllBytes(TestResources.AssemblyLoadTests.Alpha);
var gammaDll = directory.CreateFile("Gamma.dll").WriteAllBytes(TestResources.AssemblyLoadTests.Gamma);
var deltaDll = directory.CreateFile("Delta.dll").WriteAllBytes(TestResources.AssemblyLoadTests.Delta);
var analyzerReferences = ImmutableArray.Create(
new CommandLineAnalyzerReference("Alpha.dll"),
new CommandLineAnalyzerReference("Gamma.dll"),
new CommandLineAnalyzerReference("Delta.dll"));
var result = AnalyzerConsistencyChecker.Check(directory.Path, analyzerReferences, assemblyLoader, Logger);
Assert.False(result);
}
[Fact]
public void AssemblyLoadException()
{
var directory = Temp.CreateDirectory();
var deltaDll = directory.CreateFile("Delta.dll").WriteAllBytes(TestResources.AssemblyLoadTests.Delta);
var analyzerReferences = ImmutableArray.Create(
new CommandLineAnalyzerReference("Delta.dll"));
var result = AnalyzerConsistencyChecker.Check(directory.Path, analyzerReferences, TestAnalyzerAssemblyLoader.LoadNotImplemented, Logger);
Assert.False(result);
}
[Fact]
public void NetstandardIgnored()
{
var directory = Temp.CreateDirectory();
const string name = "netstandardRef";
var comp = CSharpCompilation.Create(
name,
new[] { SyntaxFactory.ParseSyntaxTree(@"class C {}") },
references: new MetadataReference[] { MetadataReference.CreateFromImage(TestMetadata.ResourcesNetStandard20.netstandard) },
options: new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary, warningLevel: Diagnostic.MaxWarningLevel));
var compFile = directory.CreateFile(name);
comp.Emit(compFile.Path);
var analyzerReferences = ImmutableArray.Create(new CommandLineAnalyzerReference(name));
var result = AnalyzerConsistencyChecker.Check(directory.Path, analyzerReferences, new InMemoryAssemblyLoader(), Logger);
Assert.True(result);
}
private class InMemoryAssemblyLoader : IAnalyzerAssemblyLoader
{
private readonly Dictionary<string, Assembly> _assemblies = new Dictionary<string, Assembly>(StringComparer.OrdinalIgnoreCase);
public void AddDependencyLocation(string fullPath)
{
}
public Assembly LoadFromPath(string fullPath)
{
Assembly assembly;
if (!_assemblies.TryGetValue(fullPath, out assembly))
{
var bytes = File.ReadAllBytes(fullPath);
assembly = Assembly.Load(bytes);
_assemblies[fullPath] = assembly;
}
return assembly;
}
}
}
}
| // 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.
#nullable disable
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CommandLine;
using Microsoft.CodeAnalysis.CSharp;
using Roslyn.Test.Utilities;
using Xunit;
using Xunit.Abstractions;
using Microsoft.CodeAnalysis.Test.Utilities;
namespace Microsoft.CodeAnalysis.CompilerServer.UnitTests
{
[CollectionDefinition(Name)]
public class AssemblyLoadTestFixtureCollection : ICollectionFixture<AssemblyLoadTestFixture>
{
public const string Name = nameof(AssemblyLoadTestFixtureCollection);
private AssemblyLoadTestFixtureCollection() { }
}
[Collection(AssemblyLoadTestFixtureCollection.Name)]
public class AnalyzerConsistencyCheckerTests : TestBase
{
private ICompilerServerLogger Logger { get; }
private AssemblyLoadTestFixture TestFixture { get; }
public AnalyzerConsistencyCheckerTests(ITestOutputHelper testOutputHelper, AssemblyLoadTestFixture testFixture)
{
Logger = new XunitCompilerServerLogger(testOutputHelper);
TestFixture = testFixture;
}
[Fact]
public void MissingReference()
{
var directory = Temp.CreateDirectory();
var alphaDll = directory.CopyFile(TestFixture.Alpha.Path);
var analyzerReferences = ImmutableArray.Create(new CommandLineAnalyzerReference("Alpha.dll"));
var result = AnalyzerConsistencyChecker.Check(directory.Path, analyzerReferences, new InMemoryAssemblyLoader(), Logger);
Assert.True(result);
}
[Fact]
public void AllChecksPassed()
{
var analyzerReferences = ImmutableArray.Create(
new CommandLineAnalyzerReference("Alpha.dll"),
new CommandLineAnalyzerReference("Beta.dll"),
new CommandLineAnalyzerReference("Gamma.dll"),
new CommandLineAnalyzerReference("Delta.dll"));
var result = AnalyzerConsistencyChecker.Check(Path.GetDirectoryName(TestFixture.Alpha.Path), analyzerReferences, new InMemoryAssemblyLoader(), Logger);
Assert.True(result);
}
[Fact]
public void DifferingMvids()
{
var directory = Temp.CreateDirectory();
// Load Beta.dll from the future Alpha.dll path to prime the assembly loader
var alphaDll = directory.CopyFile(TestFixture.Beta.Path, name: "Alpha.dll");
var assemblyLoader = new InMemoryAssemblyLoader();
var betaAssembly = assemblyLoader.LoadFromPath(alphaDll.Path);
// now overwrite the {directory}/Alpha.dll file with the content from our Alpha.dll test resource
alphaDll.CopyContentFrom(TestFixture.Alpha.Path);
directory.CopyFile(TestFixture.Gamma.Path);
directory.CopyFile(TestFixture.Delta1.Path);
var analyzerReferences = ImmutableArray.Create(
new CommandLineAnalyzerReference("Alpha.dll"),
new CommandLineAnalyzerReference("Gamma.dll"),
new CommandLineAnalyzerReference("Delta.dll"));
var result = AnalyzerConsistencyChecker.Check(directory.Path, analyzerReferences, assemblyLoader, Logger);
Assert.False(result);
}
[Fact]
public void AssemblyLoadException()
{
var directory = Temp.CreateDirectory();
directory.CopyFile(TestFixture.Delta1.Path);
var analyzerReferences = ImmutableArray.Create(
new CommandLineAnalyzerReference("Delta.dll"));
var result = AnalyzerConsistencyChecker.Check(directory.Path, analyzerReferences, TestAnalyzerAssemblyLoader.LoadNotImplemented, Logger);
Assert.False(result);
}
[Fact]
public void NetstandardIgnored()
{
var directory = Temp.CreateDirectory();
const string name = "netstandardRef";
var comp = CSharpCompilation.Create(
name,
new[] { SyntaxFactory.ParseSyntaxTree(@"class C {}") },
references: new MetadataReference[] { MetadataReference.CreateFromImage(TestMetadata.ResourcesNetStandard20.netstandard) },
options: new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary, warningLevel: Diagnostic.MaxWarningLevel));
var compFile = directory.CreateFile(name);
comp.Emit(compFile.Path);
var analyzerReferences = ImmutableArray.Create(new CommandLineAnalyzerReference(name));
var result = AnalyzerConsistencyChecker.Check(directory.Path, analyzerReferences, new InMemoryAssemblyLoader(), Logger);
Assert.True(result);
}
private class InMemoryAssemblyLoader : IAnalyzerAssemblyLoader
{
private readonly Dictionary<string, Assembly> _assemblies = new Dictionary<string, Assembly>(StringComparer.OrdinalIgnoreCase);
public void AddDependencyLocation(string fullPath)
{
}
public Assembly LoadFromPath(string fullPath)
{
Assembly assembly;
if (!_assemblies.TryGetValue(fullPath, out assembly))
{
var bytes = File.ReadAllBytes(fullPath);
assembly = Assembly.Load(bytes);
_assemblies[fullPath] = assembly;
}
return assembly;
}
}
}
}
| 1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Compilers/Test/Resources/Core/Microsoft.CodeAnalysis.Compiler.Test.Resources.csproj | <?xml version="1.0" encoding="utf-8"?>
<!-- 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. -->
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFrameworks>netcoreapp3.1;netstandard2.0</TargetFrameworks>
<RootNamespace></RootNamespace>
<EnableDefaultItems>false</EnableDefaultItems>
<IsShipping>false</IsShipping>
</PropertyGroup>
<ItemGroup Label="Project References">
<ProjectReference Include="..\..\..\Core\Portable\Microsoft.CodeAnalysis.csproj" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="ExpressionCompiler\*.*" LogicalName="ExpressionCompiler.%(FileName)%(Extension)" />
<Content Include="Analyzers\FaultyAnalyzer.cs" />
<EmbeddedResource Include="Analyzers\FaultyAnalyzer.dll" />
<Content Include="AssemblyLoadTests\Alpha.cs" />
<EmbeddedResource Include="AssemblyLoadTests\Alpha.dll" />
<Content Include="AssemblyLoadTests\Beta.cs" />
<EmbeddedResource Include="AssemblyLoadTests\Beta.dll" />
<Content Include="AssemblyLoadTests\Delta.cs" />
<EmbeddedResource Include="AssemblyLoadTests\Delta.dll" />
<Content Include="AssemblyLoadTests\Gamma.cs" />
<EmbeddedResource Include="AssemblyLoadTests\Gamma.dll" />
<EmbeddedResource Include="DiagnosticTests\badresfile.res" />
<Content Include="DiagnosticTests\ErrTestLib01.cs" />
<EmbeddedResource Include="DiagnosticTests\ErrTestLib01.dll" />
<Content Include="DiagnosticTests\ErrTestLib02.cs" />
<EmbeddedResource Include="DiagnosticTests\ErrTestLib02.dll" />
<Content Include="DiagnosticTests\ErrTestLib11.cs" />
<EmbeddedResource Include="DiagnosticTests\ErrTestLib11.dll" />
<Content Include="DiagnosticTests\ErrTestMod01.cs" />
<EmbeddedResource Include="DiagnosticTests\ErrTestMod01.netmodule" />
<Content Include="DiagnosticTests\ErrTestMod02.cs" />
<EmbeddedResource Include="DiagnosticTests\ErrTestMod02.netmodule" />
<EmbeddedResource Include="Encoding\sjis.cs" />
<Content Include="MetadataTests\InterfaceAndClass\CSClasses01.cs" />
<EmbeddedResource Include="MetadataTests\InterfaceAndClass\CSClasses01.dll" />
<Content Include="MetadataTests\InterfaceAndClass\CSInterfaces01.cs" />
<EmbeddedResource Include="MetadataTests\InterfaceAndClass\CSInterfaces01.dll" />
<EmbeddedResource Include="MetadataTests\InterfaceAndClass\VBClasses01.dll" />
<Content Include="MetadataTests\InterfaceAndClass\VBClasses01.vb" />
<EmbeddedResource Include="MetadataTests\InterfaceAndClass\VBClasses02.dll" />
<Content Include="MetadataTests\InterfaceAndClass\VBClasses02.vb" />
<EmbeddedResource Include="MetadataTests\InterfaceAndClass\VBInterfaces01.dll" />
<Content Include="MetadataTests\InterfaceAndClass\VBInterfaces01.vb" />
<EmbeddedResource Include="MetadataTests\Interop\IndexerWithByRefParam.dll" />
<Content Include="MetadataTests\Interop\IndexerWithByRefParam.il" />
<Content Include="MetadataTests\Interop\Interop.Mock01.cs" />
<EmbeddedResource Include="MetadataTests\Interop\Interop.Mock01.dll" />
<Content Include="MetadataTests\Interop\Interop.Mock01.Impl.cs" />
<EmbeddedResource Include="MetadataTests\Interop\Interop.Mock01.Impl.dll" />
<EmbeddedResource Include="MetadataTests\Invalid\ClassLayout.dll" />
<Content Include="MetadataTests\Invalid\ClassLayout.il" />
<EmbeddedResource Include="MetadataTests\Invalid\CustomAttributeTableUnsorted.dll" />
<EmbeddedResource Include="MetadataTests\Invalid\EmptyModuleTable.netmodule" />
<EmbeddedResource Include="MetadataTests\Invalid\IncorrectCustomAssemblyTableSize_TooManyMethodSpecs.dll" />
<EmbeddedResource Include="MetadataTests\Invalid\InvalidDynamicAttributeArgs.dll" />
<Content Include="MetadataTests\Invalid\InvalidDynamicAttributeArgs.il" />
<EmbeddedResource Include="MetadataTests\Invalid\InvalidFuncDelegateName.dll" />
<Content Include="MetadataTests\Invalid\InvalidFuncDelegateName.il" />
<EmbeddedResource Include="MetadataTests\Invalid\InvalidGenericType.dll" />
<Content Include="MetadataTests\Invalid\InvalidGenericType.il" />
<EmbeddedResource Include="MetadataTests\Invalid\InvalidModuleName.dll" />
<Content Include="MetadataTests\Invalid\LongTypeFormInSignature.cs" />
<EmbeddedResource Include="MetadataTests\Invalid\LongTypeFormInSignature.dll" />
<EmbeddedResource Include="MetadataTests\Invalid\ManyMethodSpecs.vb" />
<EmbeddedResource Include="MetadataTests\Invalid\Obfuscated.dll" />
<EmbeddedResource Include="MetadataTests\Invalid\Obfuscated2.dll" />
<Content Include="MetadataTests\Invalid\Signatures\build.bat" />
<Content Include="MetadataTests\Invalid\Signatures\munge.csx" />
<Content Include="MetadataTests\Invalid\Signatures\SignatureCycle2.il" />
<Content Include="MetadataTests\Invalid\Signatures\TypeSpecInWrongPlace.il" />
<EmbeddedResource Include="MetadataTests\Invalid\Signatures\SignatureCycle2.exe" />
<EmbeddedResource Include="MetadataTests\Invalid\Signatures\TypeSpecInWrongPlace.exe" />
<Content Include="MetadataTests\Members.cs" />
<EmbeddedResource Include="MetadataTests\Members.dll" />
<EmbeddedResource Include="MetadataTests\NativeApp.exe" />
<Content Include="MetadataTests\NetModule01\AppCS.cs" />
<EmbeddedResource Include="MetadataTests\NetModule01\AppCS.exe" />
<Content Include="MetadataTests\NetModule01\ModuleCS00.cs" />
<EmbeddedResource Include="MetadataTests\NetModule01\ModuleCS00.mod" />
<Content Include="MetadataTests\NetModule01\ModuleCS01.cs" />
<EmbeddedResource Include="MetadataTests\NetModule01\ModuleCS01.mod" />
<EmbeddedResource Include="MetadataTests\NetModule01\ModuleVB01.mod" />
<Content Include="MetadataTests\NetModule01\ModuleVB01.vb.txt" />
<EmbeddedResource Include="NetFX\aacorlib\aacorlib.v15.0.3928.cs" />
<Content Include="NetFX\aacorlib\build.cmd" />
<Content Include="NetFX\aacorlib\Key.snk" />
<EmbeddedResource Include="NetFX\Minimal\minasync.dll" />
<EmbeddedResource Include="NetFX\Minimal\mincorlib.dll" />
<Content Include="NetFX\Minimal\build.cmd" />
<Content Include="NetFX\Minimal\Key.snk" />
<Content Include="NetFX\Minimal\minasync.cs" />
<EmbeddedResource Include="NetFX\Minimal\minasynccorlib.dll" />
<Content Include="NetFX\Minimal\mincorlib.cs" />
<EmbeddedResource Include="NetFX\ValueTuple\System.ValueTuple.dll" />
<EmbeddedResource Include="SymbolsTests\Metadata\public-and-private.dll" />
<EmbeddedResource Include="SymbolsTests\CustomModifiers\GenericMethodWithModifiers.dll" />
<Content Include="SymbolsTests\NoPia\ParametersWithoutNames.cs" />
<EmbeddedResource Include="PerfTests\CSPerfTest.cs" />
<Content Include="SymbolsTests\BigVisitor.cs" />
<EmbeddedResource Include="SymbolsTests\BigVisitor.dll" />
<EmbeddedResource Include="SymbolsTests\CorLibrary\FakeMsCorLib.dll" />
<Content Include="SymbolsTests\CorLibrary\FakeMsCorLib.il" />
<Content Include="SymbolsTests\CorLibrary\GuidTest1.dll" />
<EmbeddedResource Include="SymbolsTests\CorLibrary\GuidTest2.exe" />
<EmbeddedResource Include="SymbolsTests\CorLibrary\NoMsCorLibRef.dll" />
<Content Include="SymbolsTests\CorLibrary\NoMsCorLibRef.il" />
<Content Include="SymbolsTests\CustomModifiers\CppCli.cpp" />
<EmbeddedResource Include="SymbolsTests\CustomModifiers\CppCli.dll" />
<EmbeddedResource Include="SymbolsTests\CustomModifiers\Modifiers.dll" />
<Content Include="SymbolsTests\CustomModifiers\Modifiers.il" />
<EmbeddedResource Include="SymbolsTests\CustomModifiers\Modifiers.netmodule" />
<Content Include="SymbolsTests\CustomModifiers\ModifiersAssembly.il" />
<Content Include="SymbolsTests\CustomModifiers\ModoptTestOrignal.cs" />
<EmbeddedResource Include="SymbolsTests\CustomModifiers\ModoptTests.dll" />
<Content Include="SymbolsTests\CustomModifiers\ModoptTests.il" />
<EmbeddedResource Include="SymbolsTests\Cyclic\Cyclic1.dll" />
<Content Include="SymbolsTests\Cyclic\Cyclic1.vb" />
<EmbeddedResource Include="SymbolsTests\Cyclic\Cyclic2.dll" />
<Content Include="SymbolsTests\Cyclic\Cyclic2.vb" />
<EmbeddedResource Include="SymbolsTests\CyclicInheritance\Class1.dll" />
<Content Include="SymbolsTests\CyclicInheritance\Class1.vb" />
<EmbeddedResource Include="SymbolsTests\CyclicInheritance\Class2.dll" />
<Content Include="SymbolsTests\CyclicInheritance\Class2.vb" />
<EmbeddedResource Include="SymbolsTests\CyclicInheritance\Class3.dll" />
<Content Include="SymbolsTests\CyclicInheritance\Class3.vb" />
<EmbeddedResource Include="SymbolsTests\CyclicStructure\cycledstructs.dll" />
<Content Include="SymbolsTests\CyclicStructure\cycledstructs.il" />
<EmbeddedResource Include="SymbolsTests\Delegates\DelegateByRefParamArray.dll" />
<Content Include="SymbolsTests\Delegates\DelegateByRefParamArray.il" />
<EmbeddedResource Include="SymbolsTests\Delegates\DelegatesWithoutInvoke.dll" />
<Content Include="SymbolsTests\Delegates\DelegatesWithoutInvoke.il" />
<Content Include="SymbolsTests\Delegates\DelegateWithoutInvoke.vb" />
<Content Include="SymbolsTests\DifferByCase\Consumer.cs" />
<EmbeddedResource Include="SymbolsTests\DifferByCase\Consumer.dll" />
<Content Include="SymbolsTests\DifferByCase\CsharpCaseSen.cs" />
<EmbeddedResource Include="SymbolsTests\DifferByCase\CsharpCaseSen.dll" />
<Content Include="SymbolsTests\DifferByCase\CSharpDifferCaseOverloads.cs" />
<EmbeddedResource Include="SymbolsTests\DifferByCase\CSharpDifferCaseOverloads.dll" />
<Content Include="SymbolsTests\DifferByCase\TypeAndNamespaceDifferByCase.cs" />
<EmbeddedResource Include="SymbolsTests\DifferByCase\TypeAndNamespaceDifferByCase.dll" />
<EmbeddedResource Include="SymbolsTests\Events.dll" />
<Content Include="SymbolsTests\Events.il" />
<Content Include="SymbolsTests\ExplicitInterfaceImplementation\CSharpExplicitInterfaceImplementation.cs" />
<EmbeddedResource Include="SymbolsTests\ExplicitInterfaceImplementation\CSharpExplicitInterfaceImplementation.dll" />
<Content Include="SymbolsTests\ExplicitInterfaceImplementation\CSharpExplicitInterfaceImplementationEvents.cs" />
<EmbeddedResource Include="SymbolsTests\ExplicitInterfaceImplementation\CSharpExplicitInterfaceImplementationEvents.dll" />
<Content Include="SymbolsTests\ExplicitInterfaceImplementation\CSharpExplicitInterfaceImplementationProperties.cs" />
<EmbeddedResource Include="SymbolsTests\ExplicitInterfaceImplementation\CSharpExplicitInterfaceImplementationProperties.dll" />
<EmbeddedResource Include="SymbolsTests\ExplicitInterfaceImplementation\ILExplicitInterfaceImplementation.dll" />
<Content Include="SymbolsTests\ExplicitInterfaceImplementation\ILExplicitInterfaceImplementation.il" />
<EmbeddedResource Include="SymbolsTests\ExplicitInterfaceImplementation\ILExplicitInterfaceImplementationProperties.dll" />
<Content Include="SymbolsTests\ExplicitInterfaceImplementation\ILExplicitInterfaceImplementationProperties.il" />
<EmbeddedResource Include="SymbolsTests\Fields\ConstantFields.dll" />
<Content Include="SymbolsTests\Fields\ConstantFields.il" />
<Content Include="SymbolsTests\Fields\CSFields.cs" />
<EmbeddedResource Include="SymbolsTests\Fields\CSFields.dll" />
<EmbeddedResource Include="SymbolsTests\Fields\VBFields.dll" />
<Content Include="SymbolsTests\Fields\VBFields.vb" />
<EmbeddedResource Include="SymbolsTests\FSharpTestLibrary.dll" />
<Content Include="SymbolsTests\FSharpTestLibrary.fs" />
<EmbeddedResource Include="SymbolsTests\Indexers.dll" />
<Content Include="SymbolsTests\Indexers.il" />
<Content Include="SymbolsTests\InheritIComparable.cs" />
<EmbeddedResource Include="SymbolsTests\InheritIComparable.dll" />
<Content Include="SymbolsTests\Interface\MDInterfaceMapping.cs" />
<EmbeddedResource Include="SymbolsTests\Interface\MDInterfaceMapping.dll" />
<EmbeddedResource Include="SymbolsTests\Interface\StaticMethodInInterface.dll" />
<Content Include="SymbolsTests\Interface\StaticMethodInInterface.il" />
<EmbeddedResource Include="SymbolsTests\MDTestLib1.dll" />
<Content Include="SymbolsTests\MDTestLib1.vb" />
<EmbeddedResource Include="SymbolsTests\MDTestLib2.dll" />
<Content Include="SymbolsTests\MDTestLib2.vb" />
<Content Include="SymbolsTests\Metadata\AttributeInterop01.cs" />
<EmbeddedResource Include="SymbolsTests\Metadata\AttributeInterop01.dll" />
<Content Include="SymbolsTests\Metadata\AttributeInterop02.cs" />
<EmbeddedResource Include="SymbolsTests\Metadata\AttributeInterop02.dll" />
<Content Include="SymbolsTests\Metadata\AttributeTestDef01.cs" />
<EmbeddedResource Include="SymbolsTests\Metadata\AttributeTestDef01.dll" />
<Content Include="SymbolsTests\Metadata\AttributeTestLib01.cs" />
<EmbeddedResource Include="SymbolsTests\Metadata\AttributeTestLib01.dll" />
<Content Include="SymbolsTests\Metadata\DynamicAttribute.cs" />
<EmbeddedResource Include="SymbolsTests\Metadata\DynamicAttribute.dll" />
<Content Include="SymbolsTests\Metadata\InvalidCharactersInAssemblyName.cmd" />
<EmbeddedResource Include="SymbolsTests\Metadata\InvalidCharactersInAssemblyName.dll" />
<Content Include="SymbolsTests\Metadata\InvalidCharactersInAssemblyName.il" />
<EmbeddedResource Include="SymbolsTests\Metadata\MDTestAttributeApplicationLib.dll" />
<EmbeddedResource Include="SymbolsTests\Metadata\InvalidPublicKey.dll" />
<Content Include="SymbolsTests\Metadata\MDTestAttributeApplicationLib.vb" />
<EmbeddedResource Include="SymbolsTests\Metadata\MDTestAttributeDefLib.dll" />
<Content Include="SymbolsTests\Metadata\MDTestAttributeDefLib.vb" />
<EmbeddedResource Include="SymbolsTests\Metadata\MscorlibNamespacesAndTypes.bsl" />
<EmbeddedResource Include="SymbolsTests\Methods\ByRefReturn.dll" />
<Content Include="SymbolsTests\Methods\ByRefReturn.il" />
<Content Include="SymbolsTests\Methods\CSMethods.cs" />
<EmbeddedResource Include="SymbolsTests\Methods\CSMethods.dll" />
<EmbeddedResource Include="SymbolsTests\Methods\ILMethods.dll" />
<Content Include="SymbolsTests\Methods\ILMethods.il" />
<EmbeddedResource Include="SymbolsTests\Methods\VBMethods.dll" />
<Content Include="SymbolsTests\Methods\VBMethods.vb" />
<EmbeddedResource Include="SymbolsTests\MissingTypes\CL2.dll" />
<Content Include="SymbolsTests\MissingTypes\CL2.vb" />
<EmbeddedResource Include="SymbolsTests\MissingTypes\CL3.dll" />
<EmbeddedResource Include="SymbolsTests\MissingTypes\CL3.vb" />
<EmbeddedResource Include="SymbolsTests\MissingTypes\MDMissingType.dll" />
<Content Include="SymbolsTests\MissingTypes\MDMissingType.vb" />
<EmbeddedResource Include="SymbolsTests\MissingTypes\MDMissingTypeLib.dll" />
<Content Include="SymbolsTests\MissingTypes\MDMissingTypeLib_1.vb" />
<Content Include="SymbolsTests\MissingTypes\MDMissingTypeLib_2.vb" />
<EmbeddedResource Include="SymbolsTests\MissingTypes\MDMissingTypeLib_New.dll" />
<EmbeddedResource Include="SymbolsTests\MissingTypes\MissingTypesEquality1.dll" />
<Content Include="SymbolsTests\MissingTypes\MissingTypesEquality1.il" />
<EmbeddedResource Include="SymbolsTests\MissingTypes\MissingTypesEquality2.dll" />
<Content Include="SymbolsTests\MissingTypes\MissingTypesEquality2.il" />
<EmbeddedResource Include="SymbolsTests\MultiModule\Consumer.dll" />
<Content Include="SymbolsTests\MultiModule\Consumer.vb" />
<EmbeddedResource Include="SymbolsTests\MultiModule\mod2.netmodule" />
<Content Include="SymbolsTests\MultiModule\mod2.vb" />
<EmbeddedResource Include="SymbolsTests\MultiModule\mod3.netmodule" />
<Content Include="SymbolsTests\MultiModule\mod3.vb" />
<EmbeddedResource Include="SymbolsTests\MultiModule\MultiModule.dll" />
<Content Include="SymbolsTests\MultiModule\MultiModule.vb" />
<Content Include="SymbolsTests\MultiTargeting\c1.dll" />
<Content Include="SymbolsTests\MultiTargeting\c3.dll" />
<Content Include="SymbolsTests\MultiTargeting\c4.dll" />
<Content Include="SymbolsTests\MultiTargeting\c7.dll" />
<Content Include="SymbolsTests\MultiTargeting\Source1.vb" />
<EmbeddedResource Include="SymbolsTests\MultiTargeting\Source1Module.netmodule" />
<Content Include="SymbolsTests\MultiTargeting\Source3.vb" />
<EmbeddedResource Include="SymbolsTests\MultiTargeting\Source3Module.netmodule" />
<Content Include="SymbolsTests\MultiTargeting\Source4.vb" />
<EmbeddedResource Include="SymbolsTests\MultiTargeting\Source4Module.netmodule" />
<Content Include="SymbolsTests\MultiTargeting\Source5.vb" />
<EmbeddedResource Include="SymbolsTests\MultiTargeting\Source5Module.netmodule" />
<Content Include="SymbolsTests\MultiTargeting\Source7.vb" />
<EmbeddedResource Include="SymbolsTests\MultiTargeting\Source7Module.netmodule" />
<Content Include="SymbolsTests\netModule\CrossRefBuild.bat" />
<EmbeddedResource Include="SymbolsTests\netModule\CrossRefLib.dll" />
<Content Include="SymbolsTests\netModule\CrossRefLib.vb" />
<EmbeddedResource Include="SymbolsTests\netModule\CrossRefModule1.netmodule" />
<Content Include="SymbolsTests\netModule\CrossRefModule1.vb" />
<EmbeddedResource Include="SymbolsTests\netModule\CrossRefModule2.netmodule" />
<Content Include="SymbolsTests\netModule\CrossRefModule2.vb" />
<EmbeddedResource Include="SymbolsTests\netModule\hash_module.netmodule" />
<EmbeddedResource Include="SymbolsTests\netModule\netModule1.netmodule" />
<Content Include="SymbolsTests\netModule\netModule1.vb" />
<EmbeddedResource Include="SymbolsTests\netModule\netModule2.netmodule" />
<Content Include="SymbolsTests\netModule\netModule2.vb" />
<EmbeddedResource Include="SymbolsTests\netModule\x64COFF.obj" />
<EmbeddedResource Include="SymbolsTests\NoPia\A.dll" />
<Content Include="SymbolsTests\NoPia\A.vb" />
<EmbeddedResource Include="SymbolsTests\NoPia\B.dll" />
<Content Include="SymbolsTests\NoPia\B.vb" />
<EmbeddedResource Include="SymbolsTests\NoPia\C.dll" />
<Content Include="SymbolsTests\NoPia\C.vb" />
<EmbeddedResource Include="SymbolsTests\NoPia\D.dll" />
<Content Include="SymbolsTests\NoPia\D.vb" />
<EmbeddedResource Include="SymbolsTests\NoPia\ExternalAsm1.dll" />
<EmbeddedResource Include="SymbolsTests\NoPia\GeneralPia.dll" />
<Content Include="SymbolsTests\NoPia\GeneralPia.vb" />
<EmbeddedResource Include="SymbolsTests\NoPia\GeneralPiaCopy.dll" />
<EmbeddedResource Include="SymbolsTests\NoPia\Library1.dll" />
<Content Include="SymbolsTests\NoPia\Library1.vb" />
<EmbeddedResource Include="SymbolsTests\NoPia\Library2.dll" />
<Content Include="SymbolsTests\NoPia\Library2.vb" />
<EmbeddedResource Include="SymbolsTests\NoPia\LocalTypes1.dll" />
<Content Include="SymbolsTests\NoPia\LocalTypes1.vb" />
<EmbeddedResource Include="SymbolsTests\NoPia\LocalTypes2.dll" />
<Content Include="SymbolsTests\NoPia\LocalTypes2.vb" />
<EmbeddedResource Include="SymbolsTests\NoPia\LocalTypes3.dll" />
<Content Include="SymbolsTests\NoPia\LocalTypes3.vb" />
<EmbeddedResource Include="SymbolsTests\NoPia\NoPIAGenerics1-Asm1.dll" />
<EmbeddedResource Include="SymbolsTests\NoPia\Pia1.dll" />
<EmbeddedResource Include="SymbolsTests\NoPia\ParametersWithoutNames.dll" />
<Content Include="SymbolsTests\NoPia\Pia1.vb" />
<EmbeddedResource Include="SymbolsTests\NoPia\Pia1Copy.dll" />
<EmbeddedResource Include="SymbolsTests\NoPia\Pia2.dll" />
<Content Include="SymbolsTests\NoPia\Pia2.vb" />
<EmbeddedResource Include="SymbolsTests\NoPia\Pia3.dll" />
<Content Include="SymbolsTests\NoPia\Pia3.vb" />
<EmbeddedResource Include="SymbolsTests\NoPia\Pia4.dll" />
<Content Include="SymbolsTests\NoPia\Pia4.vb" />
<EmbeddedResource Include="SymbolsTests\NoPia\Pia5.dll" />
<Content Include="SymbolsTests\NoPia\Pia5.vb" />
<EmbeddedResource Include="SymbolsTests\Properties.dll" />
<Content Include="SymbolsTests\Properties.il" />
<EmbeddedResource Include="SymbolsTests\PropertiesWithByRef.dll" />
<Content Include="SymbolsTests\PropertiesWithByRef.il" />
<EmbeddedResource Include="SymbolsTests\Regress40025DLL.dll" />
<EmbeddedResource Include="SymbolsTests\RetargetingCycle\V1\ClassA.dll" />
<Content Include="SymbolsTests\RetargetingCycle\V1\ClassA.vb" />
<EmbeddedResource Include="SymbolsTests\RetargetingCycle\V1\ClassB.netmodule" />
<Content Include="SymbolsTests\RetargetingCycle\V1\ClassB.vb" />
<EmbeddedResource Include="SymbolsTests\RetargetingCycle\V2\ClassA.dll" />
<Content Include="SymbolsTests\RetargetingCycle\V2\ClassA.vb" />
<EmbeddedResource Include="SymbolsTests\RetargetingCycle\V2\ClassB.dll" />
<Content Include="SymbolsTests\RetargetingCycle\V2\ClassB.vb" />
<EmbeddedResource Include="SymbolsTests\snKey.snk" />
<EmbeddedResource Include="SymbolsTests\snKey2.snk" />
<EmbeddedResource Include="SymbolsTests\snPublicKey.snk" />
<EmbeddedResource Include="SymbolsTests\snPublicKey2.snk" />
<EmbeddedResource Include="SymbolsTests\snMaxSizeKey.snk" />
<EmbeddedResource Include="SymbolsTests\snMaxSizePublicKey.snk" />
<EmbeddedResource Include="SymbolsTests\TypeForwarders\Forwarded.netmodule" />
<EmbeddedResource Include="SymbolsTests\TypeForwarders\TypeForwarder.dll" />
<Content Include="SymbolsTests\TypeForwarders\TypeForwarder.vb" />
<Content Include="SymbolsTests\TypeForwarders\TypeForwarder1.cs" />
<Content Include="SymbolsTests\TypeForwarders\TypeForwarder2.cs" />
<Content Include="SymbolsTests\TypeForwarders\TypeForwarder3.cs" />
<EmbeddedResource Include="SymbolsTests\TypeForwarders\TypeForwarderBase.dll" />
<EmbeddedResource Include="SymbolsTests\TypeForwarders\TypeForwarderLib.dll" />
<Content Include="SymbolsTests\UseSiteErrors\CSharpErrors.cs" />
<EmbeddedResource Include="SymbolsTests\UseSiteErrors\CSharpErrors.dll" />
<EmbeddedResource Include="SymbolsTests\UseSiteErrors\ILErrors.dll" />
<Content Include="SymbolsTests\UseSiteErrors\ILErrors.il" />
<Content Include="SymbolsTests\UseSiteErrors\Unavailable.cs" />
<EmbeddedResource Include="SymbolsTests\UseSiteErrors\Unavailable.dll" />
<EmbeddedResource Include="SymbolsTests\V1\MTTestLib1.Dll" />
<EmbeddedResource Include="SymbolsTests\V1\MTTestLib1_V1.vb" />
<EmbeddedResource Include="SymbolsTests\V1\MTTestLib2.Dll" />
<EmbeddedResource Include="SymbolsTests\V1\MTTestLib2_V1.vb" />
<EmbeddedResource Include="SymbolsTests\V1\MTTestModule1.netmodule" />
<EmbeddedResource Include="SymbolsTests\V1\MTTestModule2.netmodule" />
<EmbeddedResource Include="SymbolsTests\V2\MTTestLib1.Dll" />
<EmbeddedResource Include="SymbolsTests\V2\MTTestLib1_V2.vb" />
<EmbeddedResource Include="SymbolsTests\V2\MTTestLib3.Dll" />
<EmbeddedResource Include="SymbolsTests\V2\MTTestLib3_V2.vb" />
<EmbeddedResource Include="SymbolsTests\V2\MTTestModule1.netmodule" />
<EmbeddedResource Include="SymbolsTests\V2\MTTestModule3.netmodule" />
<EmbeddedResource Include="SymbolsTests\V3\MTTestLib1.Dll" />
<EmbeddedResource Include="SymbolsTests\V3\MTTestLib1_V3.vb" />
<EmbeddedResource Include="SymbolsTests\V3\MTTestLib4.Dll" />
<EmbeddedResource Include="SymbolsTests\V3\MTTestLib4_V3.vb" />
<EmbeddedResource Include="SymbolsTests\V3\MTTestModule1.netmodule" />
<EmbeddedResource Include="SymbolsTests\V3\MTTestModule4.netmodule" />
<EmbeddedResource Include="SymbolsTests\VBConversions.dll" />
<Content Include="SymbolsTests\VBConversions.vb" />
<Content Include="SymbolsTests\Versioning\AR_SA.cs" />
<EmbeddedResource Include="SymbolsTests\Versioning\AR_SA\Culture.dll" />
<Content Include="SymbolsTests\Versioning\Build.cmd" />
<Content Include="SymbolsTests\Versioning\EN_US.cs" />
<EmbeddedResource Include="SymbolsTests\Versioning\EN_US\Culture.dll" />
<Content Include="SymbolsTests\Versioning\Key.snk" />
<EmbeddedResource Include="SymbolsTests\Versioning\V1\C.dll" />
<EmbeddedResource Include="SymbolsTests\Versioning\V2\C.dll" />
<Content Include="SymbolsTests\Versioning\Version1.vb" />
<Content Include="SymbolsTests\Versioning\Version2.vb" />
<Content Include="SymbolsTests\With Spaces Assembly.il" />
<EmbeddedResource Include="SymbolsTests\With Spaces.dll" />
<Content Include="SymbolsTests\With Spaces.il" />
<EmbeddedResource Include="SymbolsTests\With Spaces.netmodule" />
<EmbeddedResource Include="SymbolsTests\WithEvents\SimpleWithEvents.dll" />
<Content Include="SymbolsTests\WithEvents\SimpleWithEvents.vb" />
<Content Include="WinRt\MakeWinMds.cmd" />
<Content Include="WinRt\W1.il" />
<EmbeddedResource Include="WinRt\W1.winmd" />
<Content Include="WinRt\W2.il" />
<EmbeddedResource Include="WinRt\W2.winmd" />
<Content Include="WinRt\WB.il" />
<EmbeddedResource Include="WinRt\WB.winmd" />
<Content Include="WinRt\WB_Version1.il" />
<EmbeddedResource Include="WinRt\WB_Version1.winmd" />
<EmbeddedResource Include="WinRt\Windows.ildump" />
<EmbeddedResource Include="WinRt\Windows.Languages.WinRTTest.winmd" />
<EmbeddedResource Include="WinRt\Windows.winmd" />
<Content Include="WinRt\WinMDPrefixing.cs" />
<EmbeddedResource Include="WinRt\WinMDPrefixing.ildump" />
<EmbeddedResource Include="WinRt\WinMDPrefixing.winmd" />
<Content Include="SymbolsTests\netModule\hash_module.cs" />
<EmbeddedResource Include="SymbolsTests\NoPia\MissingPIAAttributes.dll" />
<Content Include="WinRt\WImpl.il" />
<EmbeddedResource Include="WinRt\WImpl.winmd" />
<EmbeddedResource Include="PerfTests\VBPerfTest.vb" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="NetFX\ValueTuple\ValueTuple.cs" />
<EmbeddedResource Include="NetFX\ValueTuple\TupleElementNamesAttribute.cs" />
<Content Include="SymbolsTests\CustomModifiers\GenericMethodWithModifiers.cpp" />
<None Include="SymbolsTests\Metadata\public-and-private.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="ResourceLoader.cs" />
<Compile Include="TestKeys.cs" />
<Compile Include="TestResources.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="SymbolsTests\nativeCOFFResources.obj" />
</ItemGroup>
</Project> | <?xml version="1.0" encoding="utf-8"?>
<!-- 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. -->
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFrameworks>netcoreapp3.1;netstandard2.0</TargetFrameworks>
<RootNamespace></RootNamespace>
<EnableDefaultItems>false</EnableDefaultItems>
<IsShipping>false</IsShipping>
</PropertyGroup>
<ItemGroup Label="Project References">
<ProjectReference Include="..\..\..\Core\Portable\Microsoft.CodeAnalysis.csproj" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="ExpressionCompiler\*.*" LogicalName="ExpressionCompiler.%(FileName)%(Extension)" />
<EmbeddedResource Include="DiagnosticTests\badresfile.res" />
<Content Include="DiagnosticTests\ErrTestLib01.cs" />
<EmbeddedResource Include="DiagnosticTests\ErrTestLib01.dll" />
<Content Include="DiagnosticTests\ErrTestLib02.cs" />
<EmbeddedResource Include="DiagnosticTests\ErrTestLib02.dll" />
<Content Include="DiagnosticTests\ErrTestLib11.cs" />
<EmbeddedResource Include="DiagnosticTests\ErrTestLib11.dll" />
<Content Include="DiagnosticTests\ErrTestMod01.cs" />
<EmbeddedResource Include="DiagnosticTests\ErrTestMod01.netmodule" />
<Content Include="DiagnosticTests\ErrTestMod02.cs" />
<EmbeddedResource Include="DiagnosticTests\ErrTestMod02.netmodule" />
<EmbeddedResource Include="Encoding\sjis.cs" />
<Content Include="MetadataTests\InterfaceAndClass\CSClasses01.cs" />
<EmbeddedResource Include="MetadataTests\InterfaceAndClass\CSClasses01.dll" />
<Content Include="MetadataTests\InterfaceAndClass\CSInterfaces01.cs" />
<EmbeddedResource Include="MetadataTests\InterfaceAndClass\CSInterfaces01.dll" />
<EmbeddedResource Include="MetadataTests\InterfaceAndClass\VBClasses01.dll" />
<Content Include="MetadataTests\InterfaceAndClass\VBClasses01.vb" />
<EmbeddedResource Include="MetadataTests\InterfaceAndClass\VBClasses02.dll" />
<Content Include="MetadataTests\InterfaceAndClass\VBClasses02.vb" />
<EmbeddedResource Include="MetadataTests\InterfaceAndClass\VBInterfaces01.dll" />
<Content Include="MetadataTests\InterfaceAndClass\VBInterfaces01.vb" />
<EmbeddedResource Include="MetadataTests\Interop\IndexerWithByRefParam.dll" />
<Content Include="MetadataTests\Interop\IndexerWithByRefParam.il" />
<Content Include="MetadataTests\Interop\Interop.Mock01.cs" />
<EmbeddedResource Include="MetadataTests\Interop\Interop.Mock01.dll" />
<Content Include="MetadataTests\Interop\Interop.Mock01.Impl.cs" />
<EmbeddedResource Include="MetadataTests\Interop\Interop.Mock01.Impl.dll" />
<EmbeddedResource Include="MetadataTests\Invalid\ClassLayout.dll" />
<Content Include="MetadataTests\Invalid\ClassLayout.il" />
<EmbeddedResource Include="MetadataTests\Invalid\CustomAttributeTableUnsorted.dll" />
<EmbeddedResource Include="MetadataTests\Invalid\EmptyModuleTable.netmodule" />
<EmbeddedResource Include="MetadataTests\Invalid\IncorrectCustomAssemblyTableSize_TooManyMethodSpecs.dll" />
<EmbeddedResource Include="MetadataTests\Invalid\InvalidDynamicAttributeArgs.dll" />
<Content Include="MetadataTests\Invalid\InvalidDynamicAttributeArgs.il" />
<EmbeddedResource Include="MetadataTests\Invalid\InvalidFuncDelegateName.dll" />
<Content Include="MetadataTests\Invalid\InvalidFuncDelegateName.il" />
<EmbeddedResource Include="MetadataTests\Invalid\InvalidGenericType.dll" />
<Content Include="MetadataTests\Invalid\InvalidGenericType.il" />
<EmbeddedResource Include="MetadataTests\Invalid\InvalidModuleName.dll" />
<Content Include="MetadataTests\Invalid\LongTypeFormInSignature.cs" />
<EmbeddedResource Include="MetadataTests\Invalid\LongTypeFormInSignature.dll" />
<EmbeddedResource Include="MetadataTests\Invalid\ManyMethodSpecs.vb" />
<EmbeddedResource Include="MetadataTests\Invalid\Obfuscated.dll" />
<EmbeddedResource Include="MetadataTests\Invalid\Obfuscated2.dll" />
<Content Include="MetadataTests\Invalid\Signatures\build.bat" />
<Content Include="MetadataTests\Invalid\Signatures\munge.csx" />
<Content Include="MetadataTests\Invalid\Signatures\SignatureCycle2.il" />
<Content Include="MetadataTests\Invalid\Signatures\TypeSpecInWrongPlace.il" />
<EmbeddedResource Include="MetadataTests\Invalid\Signatures\SignatureCycle2.exe" />
<EmbeddedResource Include="MetadataTests\Invalid\Signatures\TypeSpecInWrongPlace.exe" />
<Content Include="MetadataTests\Members.cs" />
<EmbeddedResource Include="MetadataTests\Members.dll" />
<EmbeddedResource Include="MetadataTests\NativeApp.exe" />
<Content Include="MetadataTests\NetModule01\AppCS.cs" />
<EmbeddedResource Include="MetadataTests\NetModule01\AppCS.exe" />
<Content Include="MetadataTests\NetModule01\ModuleCS00.cs" />
<EmbeddedResource Include="MetadataTests\NetModule01\ModuleCS00.mod" />
<Content Include="MetadataTests\NetModule01\ModuleCS01.cs" />
<EmbeddedResource Include="MetadataTests\NetModule01\ModuleCS01.mod" />
<EmbeddedResource Include="MetadataTests\NetModule01\ModuleVB01.mod" />
<Content Include="MetadataTests\NetModule01\ModuleVB01.vb.txt" />
<EmbeddedResource Include="NetFX\aacorlib\aacorlib.v15.0.3928.cs" />
<Content Include="NetFX\aacorlib\build.cmd" />
<Content Include="NetFX\aacorlib\Key.snk" />
<EmbeddedResource Include="NetFX\Minimal\minasync.dll" />
<EmbeddedResource Include="NetFX\Minimal\mincorlib.dll" />
<Content Include="NetFX\Minimal\build.cmd" />
<Content Include="NetFX\Minimal\Key.snk" />
<Content Include="NetFX\Minimal\minasync.cs" />
<EmbeddedResource Include="NetFX\Minimal\minasynccorlib.dll" />
<Content Include="NetFX\Minimal\mincorlib.cs" />
<EmbeddedResource Include="NetFX\ValueTuple\System.ValueTuple.dll" />
<EmbeddedResource Include="SymbolsTests\Metadata\public-and-private.dll" />
<EmbeddedResource Include="SymbolsTests\CustomModifiers\GenericMethodWithModifiers.dll" />
<Content Include="SymbolsTests\NoPia\ParametersWithoutNames.cs" />
<EmbeddedResource Include="PerfTests\CSPerfTest.cs" />
<Content Include="SymbolsTests\BigVisitor.cs" />
<EmbeddedResource Include="SymbolsTests\BigVisitor.dll" />
<EmbeddedResource Include="SymbolsTests\CorLibrary\FakeMsCorLib.dll" />
<Content Include="SymbolsTests\CorLibrary\FakeMsCorLib.il" />
<Content Include="SymbolsTests\CorLibrary\GuidTest1.dll" />
<EmbeddedResource Include="SymbolsTests\CorLibrary\GuidTest2.exe" />
<EmbeddedResource Include="SymbolsTests\CorLibrary\NoMsCorLibRef.dll" />
<Content Include="SymbolsTests\CorLibrary\NoMsCorLibRef.il" />
<Content Include="SymbolsTests\CustomModifiers\CppCli.cpp" />
<EmbeddedResource Include="SymbolsTests\CustomModifiers\CppCli.dll" />
<EmbeddedResource Include="SymbolsTests\CustomModifiers\Modifiers.dll" />
<Content Include="SymbolsTests\CustomModifiers\Modifiers.il" />
<EmbeddedResource Include="SymbolsTests\CustomModifiers\Modifiers.netmodule" />
<Content Include="SymbolsTests\CustomModifiers\ModifiersAssembly.il" />
<Content Include="SymbolsTests\CustomModifiers\ModoptTestOrignal.cs" />
<EmbeddedResource Include="SymbolsTests\CustomModifiers\ModoptTests.dll" />
<Content Include="SymbolsTests\CustomModifiers\ModoptTests.il" />
<EmbeddedResource Include="SymbolsTests\Cyclic\Cyclic1.dll" />
<Content Include="SymbolsTests\Cyclic\Cyclic1.vb" />
<EmbeddedResource Include="SymbolsTests\Cyclic\Cyclic2.dll" />
<Content Include="SymbolsTests\Cyclic\Cyclic2.vb" />
<EmbeddedResource Include="SymbolsTests\CyclicInheritance\Class1.dll" />
<Content Include="SymbolsTests\CyclicInheritance\Class1.vb" />
<EmbeddedResource Include="SymbolsTests\CyclicInheritance\Class2.dll" />
<Content Include="SymbolsTests\CyclicInheritance\Class2.vb" />
<EmbeddedResource Include="SymbolsTests\CyclicInheritance\Class3.dll" />
<Content Include="SymbolsTests\CyclicInheritance\Class3.vb" />
<EmbeddedResource Include="SymbolsTests\CyclicStructure\cycledstructs.dll" />
<Content Include="SymbolsTests\CyclicStructure\cycledstructs.il" />
<EmbeddedResource Include="SymbolsTests\Delegates\DelegateByRefParamArray.dll" />
<Content Include="SymbolsTests\Delegates\DelegateByRefParamArray.il" />
<EmbeddedResource Include="SymbolsTests\Delegates\DelegatesWithoutInvoke.dll" />
<Content Include="SymbolsTests\Delegates\DelegatesWithoutInvoke.il" />
<Content Include="SymbolsTests\Delegates\DelegateWithoutInvoke.vb" />
<Content Include="SymbolsTests\DifferByCase\Consumer.cs" />
<EmbeddedResource Include="SymbolsTests\DifferByCase\Consumer.dll" />
<Content Include="SymbolsTests\DifferByCase\CsharpCaseSen.cs" />
<EmbeddedResource Include="SymbolsTests\DifferByCase\CsharpCaseSen.dll" />
<Content Include="SymbolsTests\DifferByCase\CSharpDifferCaseOverloads.cs" />
<EmbeddedResource Include="SymbolsTests\DifferByCase\CSharpDifferCaseOverloads.dll" />
<Content Include="SymbolsTests\DifferByCase\TypeAndNamespaceDifferByCase.cs" />
<EmbeddedResource Include="SymbolsTests\DifferByCase\TypeAndNamespaceDifferByCase.dll" />
<EmbeddedResource Include="SymbolsTests\Events.dll" />
<Content Include="SymbolsTests\Events.il" />
<Content Include="SymbolsTests\ExplicitInterfaceImplementation\CSharpExplicitInterfaceImplementation.cs" />
<EmbeddedResource Include="SymbolsTests\ExplicitInterfaceImplementation\CSharpExplicitInterfaceImplementation.dll" />
<Content Include="SymbolsTests\ExplicitInterfaceImplementation\CSharpExplicitInterfaceImplementationEvents.cs" />
<EmbeddedResource Include="SymbolsTests\ExplicitInterfaceImplementation\CSharpExplicitInterfaceImplementationEvents.dll" />
<Content Include="SymbolsTests\ExplicitInterfaceImplementation\CSharpExplicitInterfaceImplementationProperties.cs" />
<EmbeddedResource Include="SymbolsTests\ExplicitInterfaceImplementation\CSharpExplicitInterfaceImplementationProperties.dll" />
<EmbeddedResource Include="SymbolsTests\ExplicitInterfaceImplementation\ILExplicitInterfaceImplementation.dll" />
<Content Include="SymbolsTests\ExplicitInterfaceImplementation\ILExplicitInterfaceImplementation.il" />
<EmbeddedResource Include="SymbolsTests\ExplicitInterfaceImplementation\ILExplicitInterfaceImplementationProperties.dll" />
<Content Include="SymbolsTests\ExplicitInterfaceImplementation\ILExplicitInterfaceImplementationProperties.il" />
<EmbeddedResource Include="SymbolsTests\Fields\ConstantFields.dll" />
<Content Include="SymbolsTests\Fields\ConstantFields.il" />
<Content Include="SymbolsTests\Fields\CSFields.cs" />
<EmbeddedResource Include="SymbolsTests\Fields\CSFields.dll" />
<EmbeddedResource Include="SymbolsTests\Fields\VBFields.dll" />
<Content Include="SymbolsTests\Fields\VBFields.vb" />
<EmbeddedResource Include="SymbolsTests\FSharpTestLibrary.dll" />
<Content Include="SymbolsTests\FSharpTestLibrary.fs" />
<EmbeddedResource Include="SymbolsTests\Indexers.dll" />
<Content Include="SymbolsTests\Indexers.il" />
<Content Include="SymbolsTests\InheritIComparable.cs" />
<EmbeddedResource Include="SymbolsTests\InheritIComparable.dll" />
<Content Include="SymbolsTests\Interface\MDInterfaceMapping.cs" />
<EmbeddedResource Include="SymbolsTests\Interface\MDInterfaceMapping.dll" />
<EmbeddedResource Include="SymbolsTests\Interface\StaticMethodInInterface.dll" />
<Content Include="SymbolsTests\Interface\StaticMethodInInterface.il" />
<EmbeddedResource Include="SymbolsTests\MDTestLib1.dll" />
<Content Include="SymbolsTests\MDTestLib1.vb" />
<EmbeddedResource Include="SymbolsTests\MDTestLib2.dll" />
<Content Include="SymbolsTests\MDTestLib2.vb" />
<Content Include="SymbolsTests\Metadata\AttributeInterop01.cs" />
<EmbeddedResource Include="SymbolsTests\Metadata\AttributeInterop01.dll" />
<Content Include="SymbolsTests\Metadata\AttributeInterop02.cs" />
<EmbeddedResource Include="SymbolsTests\Metadata\AttributeInterop02.dll" />
<Content Include="SymbolsTests\Metadata\AttributeTestDef01.cs" />
<EmbeddedResource Include="SymbolsTests\Metadata\AttributeTestDef01.dll" />
<Content Include="SymbolsTests\Metadata\AttributeTestLib01.cs" />
<EmbeddedResource Include="SymbolsTests\Metadata\AttributeTestLib01.dll" />
<Content Include="SymbolsTests\Metadata\DynamicAttribute.cs" />
<EmbeddedResource Include="SymbolsTests\Metadata\DynamicAttribute.dll" />
<Content Include="SymbolsTests\Metadata\InvalidCharactersInAssemblyName.cmd" />
<EmbeddedResource Include="SymbolsTests\Metadata\InvalidCharactersInAssemblyName.dll" />
<Content Include="SymbolsTests\Metadata\InvalidCharactersInAssemblyName.il" />
<EmbeddedResource Include="SymbolsTests\Metadata\MDTestAttributeApplicationLib.dll" />
<EmbeddedResource Include="SymbolsTests\Metadata\InvalidPublicKey.dll" />
<Content Include="SymbolsTests\Metadata\MDTestAttributeApplicationLib.vb" />
<EmbeddedResource Include="SymbolsTests\Metadata\MDTestAttributeDefLib.dll" />
<Content Include="SymbolsTests\Metadata\MDTestAttributeDefLib.vb" />
<EmbeddedResource Include="SymbolsTests\Metadata\MscorlibNamespacesAndTypes.bsl" />
<EmbeddedResource Include="SymbolsTests\Methods\ByRefReturn.dll" />
<Content Include="SymbolsTests\Methods\ByRefReturn.il" />
<Content Include="SymbolsTests\Methods\CSMethods.cs" />
<EmbeddedResource Include="SymbolsTests\Methods\CSMethods.dll" />
<EmbeddedResource Include="SymbolsTests\Methods\ILMethods.dll" />
<Content Include="SymbolsTests\Methods\ILMethods.il" />
<EmbeddedResource Include="SymbolsTests\Methods\VBMethods.dll" />
<Content Include="SymbolsTests\Methods\VBMethods.vb" />
<EmbeddedResource Include="SymbolsTests\MissingTypes\CL2.dll" />
<Content Include="SymbolsTests\MissingTypes\CL2.vb" />
<EmbeddedResource Include="SymbolsTests\MissingTypes\CL3.dll" />
<EmbeddedResource Include="SymbolsTests\MissingTypes\CL3.vb" />
<EmbeddedResource Include="SymbolsTests\MissingTypes\MDMissingType.dll" />
<Content Include="SymbolsTests\MissingTypes\MDMissingType.vb" />
<EmbeddedResource Include="SymbolsTests\MissingTypes\MDMissingTypeLib.dll" />
<Content Include="SymbolsTests\MissingTypes\MDMissingTypeLib_1.vb" />
<Content Include="SymbolsTests\MissingTypes\MDMissingTypeLib_2.vb" />
<EmbeddedResource Include="SymbolsTests\MissingTypes\MDMissingTypeLib_New.dll" />
<EmbeddedResource Include="SymbolsTests\MissingTypes\MissingTypesEquality1.dll" />
<Content Include="SymbolsTests\MissingTypes\MissingTypesEquality1.il" />
<EmbeddedResource Include="SymbolsTests\MissingTypes\MissingTypesEquality2.dll" />
<Content Include="SymbolsTests\MissingTypes\MissingTypesEquality2.il" />
<EmbeddedResource Include="SymbolsTests\MultiModule\Consumer.dll" />
<Content Include="SymbolsTests\MultiModule\Consumer.vb" />
<EmbeddedResource Include="SymbolsTests\MultiModule\mod2.netmodule" />
<Content Include="SymbolsTests\MultiModule\mod2.vb" />
<EmbeddedResource Include="SymbolsTests\MultiModule\mod3.netmodule" />
<Content Include="SymbolsTests\MultiModule\mod3.vb" />
<EmbeddedResource Include="SymbolsTests\MultiModule\MultiModule.dll" />
<Content Include="SymbolsTests\MultiModule\MultiModule.vb" />
<Content Include="SymbolsTests\MultiTargeting\c1.dll" />
<Content Include="SymbolsTests\MultiTargeting\c3.dll" />
<Content Include="SymbolsTests\MultiTargeting\c4.dll" />
<Content Include="SymbolsTests\MultiTargeting\c7.dll" />
<Content Include="SymbolsTests\MultiTargeting\Source1.vb" />
<EmbeddedResource Include="SymbolsTests\MultiTargeting\Source1Module.netmodule" />
<Content Include="SymbolsTests\MultiTargeting\Source3.vb" />
<EmbeddedResource Include="SymbolsTests\MultiTargeting\Source3Module.netmodule" />
<Content Include="SymbolsTests\MultiTargeting\Source4.vb" />
<EmbeddedResource Include="SymbolsTests\MultiTargeting\Source4Module.netmodule" />
<Content Include="SymbolsTests\MultiTargeting\Source5.vb" />
<EmbeddedResource Include="SymbolsTests\MultiTargeting\Source5Module.netmodule" />
<Content Include="SymbolsTests\MultiTargeting\Source7.vb" />
<EmbeddedResource Include="SymbolsTests\MultiTargeting\Source7Module.netmodule" />
<Content Include="SymbolsTests\netModule\CrossRefBuild.bat" />
<EmbeddedResource Include="SymbolsTests\netModule\CrossRefLib.dll" />
<Content Include="SymbolsTests\netModule\CrossRefLib.vb" />
<EmbeddedResource Include="SymbolsTests\netModule\CrossRefModule1.netmodule" />
<Content Include="SymbolsTests\netModule\CrossRefModule1.vb" />
<EmbeddedResource Include="SymbolsTests\netModule\CrossRefModule2.netmodule" />
<Content Include="SymbolsTests\netModule\CrossRefModule2.vb" />
<EmbeddedResource Include="SymbolsTests\netModule\hash_module.netmodule" />
<EmbeddedResource Include="SymbolsTests\netModule\netModule1.netmodule" />
<Content Include="SymbolsTests\netModule\netModule1.vb" />
<EmbeddedResource Include="SymbolsTests\netModule\netModule2.netmodule" />
<Content Include="SymbolsTests\netModule\netModule2.vb" />
<EmbeddedResource Include="SymbolsTests\netModule\x64COFF.obj" />
<EmbeddedResource Include="SymbolsTests\NoPia\A.dll" />
<Content Include="SymbolsTests\NoPia\A.vb" />
<EmbeddedResource Include="SymbolsTests\NoPia\B.dll" />
<Content Include="SymbolsTests\NoPia\B.vb" />
<EmbeddedResource Include="SymbolsTests\NoPia\C.dll" />
<Content Include="SymbolsTests\NoPia\C.vb" />
<EmbeddedResource Include="SymbolsTests\NoPia\D.dll" />
<Content Include="SymbolsTests\NoPia\D.vb" />
<EmbeddedResource Include="SymbolsTests\NoPia\ExternalAsm1.dll" />
<EmbeddedResource Include="SymbolsTests\NoPia\GeneralPia.dll" />
<Content Include="SymbolsTests\NoPia\GeneralPia.vb" />
<EmbeddedResource Include="SymbolsTests\NoPia\GeneralPiaCopy.dll" />
<EmbeddedResource Include="SymbolsTests\NoPia\Library1.dll" />
<Content Include="SymbolsTests\NoPia\Library1.vb" />
<EmbeddedResource Include="SymbolsTests\NoPia\Library2.dll" />
<Content Include="SymbolsTests\NoPia\Library2.vb" />
<EmbeddedResource Include="SymbolsTests\NoPia\LocalTypes1.dll" />
<Content Include="SymbolsTests\NoPia\LocalTypes1.vb" />
<EmbeddedResource Include="SymbolsTests\NoPia\LocalTypes2.dll" />
<Content Include="SymbolsTests\NoPia\LocalTypes2.vb" />
<EmbeddedResource Include="SymbolsTests\NoPia\LocalTypes3.dll" />
<Content Include="SymbolsTests\NoPia\LocalTypes3.vb" />
<EmbeddedResource Include="SymbolsTests\NoPia\NoPIAGenerics1-Asm1.dll" />
<EmbeddedResource Include="SymbolsTests\NoPia\Pia1.dll" />
<EmbeddedResource Include="SymbolsTests\NoPia\ParametersWithoutNames.dll" />
<Content Include="SymbolsTests\NoPia\Pia1.vb" />
<EmbeddedResource Include="SymbolsTests\NoPia\Pia1Copy.dll" />
<EmbeddedResource Include="SymbolsTests\NoPia\Pia2.dll" />
<Content Include="SymbolsTests\NoPia\Pia2.vb" />
<EmbeddedResource Include="SymbolsTests\NoPia\Pia3.dll" />
<Content Include="SymbolsTests\NoPia\Pia3.vb" />
<EmbeddedResource Include="SymbolsTests\NoPia\Pia4.dll" />
<Content Include="SymbolsTests\NoPia\Pia4.vb" />
<EmbeddedResource Include="SymbolsTests\NoPia\Pia5.dll" />
<Content Include="SymbolsTests\NoPia\Pia5.vb" />
<EmbeddedResource Include="SymbolsTests\Properties.dll" />
<Content Include="SymbolsTests\Properties.il" />
<EmbeddedResource Include="SymbolsTests\PropertiesWithByRef.dll" />
<Content Include="SymbolsTests\PropertiesWithByRef.il" />
<EmbeddedResource Include="SymbolsTests\Regress40025DLL.dll" />
<EmbeddedResource Include="SymbolsTests\RetargetingCycle\V1\ClassA.dll" />
<Content Include="SymbolsTests\RetargetingCycle\V1\ClassA.vb" />
<EmbeddedResource Include="SymbolsTests\RetargetingCycle\V1\ClassB.netmodule" />
<Content Include="SymbolsTests\RetargetingCycle\V1\ClassB.vb" />
<EmbeddedResource Include="SymbolsTests\RetargetingCycle\V2\ClassA.dll" />
<Content Include="SymbolsTests\RetargetingCycle\V2\ClassA.vb" />
<EmbeddedResource Include="SymbolsTests\RetargetingCycle\V2\ClassB.dll" />
<Content Include="SymbolsTests\RetargetingCycle\V2\ClassB.vb" />
<EmbeddedResource Include="SymbolsTests\snKey.snk" />
<EmbeddedResource Include="SymbolsTests\snKey2.snk" />
<EmbeddedResource Include="SymbolsTests\snPublicKey.snk" />
<EmbeddedResource Include="SymbolsTests\snPublicKey2.snk" />
<EmbeddedResource Include="SymbolsTests\snMaxSizeKey.snk" />
<EmbeddedResource Include="SymbolsTests\snMaxSizePublicKey.snk" />
<EmbeddedResource Include="SymbolsTests\TypeForwarders\Forwarded.netmodule" />
<EmbeddedResource Include="SymbolsTests\TypeForwarders\TypeForwarder.dll" />
<Content Include="SymbolsTests\TypeForwarders\TypeForwarder.vb" />
<Content Include="SymbolsTests\TypeForwarders\TypeForwarder1.cs" />
<Content Include="SymbolsTests\TypeForwarders\TypeForwarder2.cs" />
<Content Include="SymbolsTests\TypeForwarders\TypeForwarder3.cs" />
<EmbeddedResource Include="SymbolsTests\TypeForwarders\TypeForwarderBase.dll" />
<EmbeddedResource Include="SymbolsTests\TypeForwarders\TypeForwarderLib.dll" />
<Content Include="SymbolsTests\UseSiteErrors\CSharpErrors.cs" />
<EmbeddedResource Include="SymbolsTests\UseSiteErrors\CSharpErrors.dll" />
<EmbeddedResource Include="SymbolsTests\UseSiteErrors\ILErrors.dll" />
<Content Include="SymbolsTests\UseSiteErrors\ILErrors.il" />
<Content Include="SymbolsTests\UseSiteErrors\Unavailable.cs" />
<EmbeddedResource Include="SymbolsTests\UseSiteErrors\Unavailable.dll" />
<EmbeddedResource Include="SymbolsTests\V1\MTTestLib1.Dll" />
<EmbeddedResource Include="SymbolsTests\V1\MTTestLib1_V1.vb" />
<EmbeddedResource Include="SymbolsTests\V1\MTTestLib2.Dll" />
<EmbeddedResource Include="SymbolsTests\V1\MTTestLib2_V1.vb" />
<EmbeddedResource Include="SymbolsTests\V1\MTTestModule1.netmodule" />
<EmbeddedResource Include="SymbolsTests\V1\MTTestModule2.netmodule" />
<EmbeddedResource Include="SymbolsTests\V2\MTTestLib1.Dll" />
<EmbeddedResource Include="SymbolsTests\V2\MTTestLib1_V2.vb" />
<EmbeddedResource Include="SymbolsTests\V2\MTTestLib3.Dll" />
<EmbeddedResource Include="SymbolsTests\V2\MTTestLib3_V2.vb" />
<EmbeddedResource Include="SymbolsTests\V2\MTTestModule1.netmodule" />
<EmbeddedResource Include="SymbolsTests\V2\MTTestModule3.netmodule" />
<EmbeddedResource Include="SymbolsTests\V3\MTTestLib1.Dll" />
<EmbeddedResource Include="SymbolsTests\V3\MTTestLib1_V3.vb" />
<EmbeddedResource Include="SymbolsTests\V3\MTTestLib4.Dll" />
<EmbeddedResource Include="SymbolsTests\V3\MTTestLib4_V3.vb" />
<EmbeddedResource Include="SymbolsTests\V3\MTTestModule1.netmodule" />
<EmbeddedResource Include="SymbolsTests\V3\MTTestModule4.netmodule" />
<EmbeddedResource Include="SymbolsTests\VBConversions.dll" />
<Content Include="SymbolsTests\VBConversions.vb" />
<Content Include="SymbolsTests\Versioning\AR_SA.cs" />
<EmbeddedResource Include="SymbolsTests\Versioning\AR_SA\Culture.dll" />
<Content Include="SymbolsTests\Versioning\Build.cmd" />
<Content Include="SymbolsTests\Versioning\EN_US.cs" />
<EmbeddedResource Include="SymbolsTests\Versioning\EN_US\Culture.dll" />
<Content Include="SymbolsTests\Versioning\Key.snk" />
<EmbeddedResource Include="SymbolsTests\Versioning\V1\C.dll" />
<EmbeddedResource Include="SymbolsTests\Versioning\V2\C.dll" />
<Content Include="SymbolsTests\Versioning\Version1.vb" />
<Content Include="SymbolsTests\Versioning\Version2.vb" />
<Content Include="SymbolsTests\With Spaces Assembly.il" />
<EmbeddedResource Include="SymbolsTests\With Spaces.dll" />
<Content Include="SymbolsTests\With Spaces.il" />
<EmbeddedResource Include="SymbolsTests\With Spaces.netmodule" />
<EmbeddedResource Include="SymbolsTests\WithEvents\SimpleWithEvents.dll" />
<Content Include="SymbolsTests\WithEvents\SimpleWithEvents.vb" />
<Content Include="WinRt\MakeWinMds.cmd" />
<Content Include="WinRt\W1.il" />
<EmbeddedResource Include="WinRt\W1.winmd" />
<Content Include="WinRt\W2.il" />
<EmbeddedResource Include="WinRt\W2.winmd" />
<Content Include="WinRt\WB.il" />
<EmbeddedResource Include="WinRt\WB.winmd" />
<Content Include="WinRt\WB_Version1.il" />
<EmbeddedResource Include="WinRt\WB_Version1.winmd" />
<EmbeddedResource Include="WinRt\Windows.ildump" />
<EmbeddedResource Include="WinRt\Windows.Languages.WinRTTest.winmd" />
<EmbeddedResource Include="WinRt\Windows.winmd" />
<Content Include="WinRt\WinMDPrefixing.cs" />
<EmbeddedResource Include="WinRt\WinMDPrefixing.ildump" />
<EmbeddedResource Include="WinRt\WinMDPrefixing.winmd" />
<Content Include="SymbolsTests\netModule\hash_module.cs" />
<EmbeddedResource Include="SymbolsTests\NoPia\MissingPIAAttributes.dll" />
<Content Include="WinRt\WImpl.il" />
<EmbeddedResource Include="WinRt\WImpl.winmd" />
<EmbeddedResource Include="PerfTests\VBPerfTest.vb" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="NetFX\ValueTuple\ValueTuple.cs" />
<EmbeddedResource Include="NetFX\ValueTuple\TupleElementNamesAttribute.cs" />
<Content Include="SymbolsTests\CustomModifiers\GenericMethodWithModifiers.cpp" />
<None Include="SymbolsTests\Metadata\public-and-private.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="ResourceLoader.cs" />
<Compile Include="TestKeys.cs" />
<Compile Include="TestResources.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="SymbolsTests\nativeCOFFResources.obj" />
</ItemGroup>
</Project> | 1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Compilers/Test/Resources/Core/TestResources.cs | // 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.
#nullable disable
namespace TestResources
{
public static class AnalyzerTests
{
private static byte[] s_faultyAnalyzer;
public static byte[] FaultyAnalyzer => ResourceLoader.GetOrCreateResource(ref s_faultyAnalyzer, "Analyzers.FaultyAnalyzer.dll");
}
public static class AssemblyLoadTests
{
private static byte[] s_alpha;
public static byte[] Alpha => ResourceLoader.GetOrCreateResource(ref s_alpha, "AssemblyLoadTests.Alpha.dll");
private static byte[] s_beta;
public static byte[] Beta => ResourceLoader.GetOrCreateResource(ref s_beta, "AssemblyLoadTests.Beta.dll");
private static byte[] s_delta;
public static byte[] Delta => ResourceLoader.GetOrCreateResource(ref s_delta, "AssemblyLoadTests.Delta.dll");
private static byte[] s_gamma;
public static byte[] Gamma => ResourceLoader.GetOrCreateResource(ref s_gamma, "AssemblyLoadTests.Gamma.dll");
}
public static class DiagnosticTests
{
private static byte[] s_badresfile;
public static byte[] badresfile => ResourceLoader.GetOrCreateResource(ref s_badresfile, "DiagnosticTests.badresfile.res");
private static byte[] s_errTestLib01;
public static byte[] ErrTestLib01 => ResourceLoader.GetOrCreateResource(ref s_errTestLib01, "DiagnosticTests.ErrTestLib01.dll");
private static byte[] s_errTestLib02;
public static byte[] ErrTestLib02 => ResourceLoader.GetOrCreateResource(ref s_errTestLib02, "DiagnosticTests.ErrTestLib02.dll");
private static byte[] s_errTestLib11;
public static byte[] ErrTestLib11 => ResourceLoader.GetOrCreateResource(ref s_errTestLib11, "DiagnosticTests.ErrTestLib11.dll");
private static byte[] s_errTestMod01;
public static byte[] ErrTestMod01 => ResourceLoader.GetOrCreateResource(ref s_errTestMod01, "DiagnosticTests.ErrTestMod01.netmodule");
private static byte[] s_errTestMod02;
public static byte[] ErrTestMod02 => ResourceLoader.GetOrCreateResource(ref s_errTestMod02, "DiagnosticTests.ErrTestMod02.netmodule");
}
public static class Basic
{
private static byte[] s_members;
public static byte[] Members => ResourceLoader.GetOrCreateResource(ref s_members, "MetadataTests.Members.dll");
private static byte[] s_nativeApp;
public static byte[] NativeApp => ResourceLoader.GetOrCreateResource(ref s_nativeApp, "MetadataTests.NativeApp.exe");
}
public static class ExpressionCompiler
{
private static byte[] s_empty;
public static byte[] Empty => ResourceLoader.GetOrCreateResource(ref s_empty, "ExpressionCompiler.Empty.dll");
private static byte[] s_libraryA;
public static byte[] LibraryA => ResourceLoader.GetOrCreateResource(ref s_libraryA, "ExpressionCompiler.LibraryA.winmd");
private static byte[] s_libraryB;
public static byte[] LibraryB => ResourceLoader.GetOrCreateResource(ref s_libraryB, "ExpressionCompiler.LibraryB.winmd");
private static byte[] s_noValidTables;
public static byte[] NoValidTables => ResourceLoader.GetOrCreateResource(ref s_noValidTables, "ExpressionCompiler.NoValidTables.metadata");
private static byte[] s_windows;
public static byte[] Windows => ResourceLoader.GetOrCreateResource(ref s_windows, "ExpressionCompiler.Windows.winmd");
private static byte[] s_windowsData;
public static byte[] WindowsData => ResourceLoader.GetOrCreateResource(ref s_windowsData, "ExpressionCompiler.Windows.Data.winmd");
private static byte[] s_windowsStorage;
public static byte[] WindowsStorage => ResourceLoader.GetOrCreateResource(ref s_windowsStorage, "ExpressionCompiler.Windows.Storage.winmd");
}
}
namespace TestResources.MetadataTests
{
public static class InterfaceAndClass
{
private static byte[] s_CSClasses01;
public static byte[] CSClasses01 => ResourceLoader.GetOrCreateResource(ref s_CSClasses01, "MetadataTests.InterfaceAndClass.CSClasses01.dll");
private static byte[] s_CSInterfaces01;
public static byte[] CSInterfaces01 => ResourceLoader.GetOrCreateResource(ref s_CSInterfaces01, "MetadataTests.InterfaceAndClass.CSInterfaces01.dll");
private static byte[] s_VBClasses01;
public static byte[] VBClasses01 => ResourceLoader.GetOrCreateResource(ref s_VBClasses01, "MetadataTests.InterfaceAndClass.VBClasses01.dll");
private static byte[] s_VBClasses02;
public static byte[] VBClasses02 => ResourceLoader.GetOrCreateResource(ref s_VBClasses02, "MetadataTests.InterfaceAndClass.VBClasses02.dll");
private static byte[] s_VBInterfaces01;
public static byte[] VBInterfaces01 => ResourceLoader.GetOrCreateResource(ref s_VBInterfaces01, "MetadataTests.InterfaceAndClass.VBInterfaces01.dll");
}
public static class Interop
{
private static byte[] s_indexerWithByRefParam;
public static byte[] IndexerWithByRefParam => ResourceLoader.GetOrCreateResource(ref s_indexerWithByRefParam, "MetadataTests.Interop.IndexerWithByRefParam.dll");
private static byte[] s_interop_Mock01;
public static byte[] Interop_Mock01 => ResourceLoader.GetOrCreateResource(ref s_interop_Mock01, "MetadataTests.Interop.Interop.Mock01.dll");
private static byte[] s_interop_Mock01_Impl;
public static byte[] Interop_Mock01_Impl => ResourceLoader.GetOrCreateResource(ref s_interop_Mock01_Impl, "MetadataTests.Interop.Interop.Mock01.Impl.dll");
}
public static class Invalid
{
private static byte[] s_classLayout;
public static byte[] ClassLayout => ResourceLoader.GetOrCreateResource(ref s_classLayout, "MetadataTests.Invalid.ClassLayout.dll");
private static byte[] s_customAttributeTableUnsorted;
public static byte[] CustomAttributeTableUnsorted => ResourceLoader.GetOrCreateResource(ref s_customAttributeTableUnsorted, "MetadataTests.Invalid.CustomAttributeTableUnsorted.dll");
private static byte[] s_emptyModuleTable;
public static byte[] EmptyModuleTable => ResourceLoader.GetOrCreateResource(ref s_emptyModuleTable, "MetadataTests.Invalid.EmptyModuleTable.netmodule");
private static byte[] s_incorrectCustomAssemblyTableSize_TooManyMethodSpecs;
public static byte[] IncorrectCustomAssemblyTableSize_TooManyMethodSpecs => ResourceLoader.GetOrCreateResource(ref s_incorrectCustomAssemblyTableSize_TooManyMethodSpecs, "MetadataTests.Invalid.IncorrectCustomAssemblyTableSize_TooManyMethodSpecs.dll");
private static byte[] s_invalidDynamicAttributeArgs;
public static byte[] InvalidDynamicAttributeArgs => ResourceLoader.GetOrCreateResource(ref s_invalidDynamicAttributeArgs, "MetadataTests.Invalid.InvalidDynamicAttributeArgs.dll");
private static byte[] s_invalidFuncDelegateName;
public static byte[] InvalidFuncDelegateName => ResourceLoader.GetOrCreateResource(ref s_invalidFuncDelegateName, "MetadataTests.Invalid.InvalidFuncDelegateName.dll");
private static byte[] s_invalidGenericType;
public static byte[] InvalidGenericType => ResourceLoader.GetOrCreateResource(ref s_invalidGenericType, "MetadataTests.Invalid.InvalidGenericType.dll");
private static byte[] s_invalidModuleName;
public static byte[] InvalidModuleName => ResourceLoader.GetOrCreateResource(ref s_invalidModuleName, "MetadataTests.Invalid.InvalidModuleName.dll");
private static byte[] s_longTypeFormInSignature;
public static byte[] LongTypeFormInSignature => ResourceLoader.GetOrCreateResource(ref s_longTypeFormInSignature, "MetadataTests.Invalid.LongTypeFormInSignature.dll");
private static string s_manyMethodSpecs;
public static string ManyMethodSpecs => ResourceLoader.GetOrCreateResource(ref s_manyMethodSpecs, "MetadataTests.Invalid.ManyMethodSpecs.vb");
private static byte[] s_obfuscated;
public static byte[] Obfuscated => ResourceLoader.GetOrCreateResource(ref s_obfuscated, "MetadataTests.Invalid.Obfuscated.dll");
private static byte[] s_obfuscated2;
public static byte[] Obfuscated2 => ResourceLoader.GetOrCreateResource(ref s_obfuscated2, "MetadataTests.Invalid.Obfuscated2.dll");
public static class Signatures
{
private static byte[] s_signatureCycle2;
public static byte[] SignatureCycle2 => ResourceLoader.GetOrCreateResource(ref s_signatureCycle2, "MetadataTests.Invalid.Signatures.SignatureCycle2.exe");
private static byte[] s_typeSpecInWrongPlace;
public static byte[] TypeSpecInWrongPlace => ResourceLoader.GetOrCreateResource(ref s_typeSpecInWrongPlace, "MetadataTests.Invalid.Signatures.TypeSpecInWrongPlace.exe");
}
}
public static class NetModule01
{
private static byte[] s_appCS;
public static byte[] AppCS => ResourceLoader.GetOrCreateResource(ref s_appCS, "MetadataTests.NetModule01.AppCS.exe");
private static byte[] s_moduleCS00;
public static byte[] ModuleCS00 => ResourceLoader.GetOrCreateResource(ref s_moduleCS00, "MetadataTests.NetModule01.ModuleCS00.mod");
private static byte[] s_moduleCS01;
public static byte[] ModuleCS01 => ResourceLoader.GetOrCreateResource(ref s_moduleCS01, "MetadataTests.NetModule01.ModuleCS01.mod");
private static byte[] s_moduleVB01;
public static byte[] ModuleVB01 => ResourceLoader.GetOrCreateResource(ref s_moduleVB01, "MetadataTests.NetModule01.ModuleVB01.mod");
}
}
namespace TestResources.NetFX
{
public static class aacorlib_v15_0_3928
{
private static string s_aacorlib_v15_0_3928_cs;
public static string aacorlib_v15_0_3928_cs => ResourceLoader.GetOrCreateResource(ref s_aacorlib_v15_0_3928_cs, "NetFX.aacorlib.aacorlib.v15.0.3928.cs");
}
public static class Minimal
{
private static byte[] s_mincorlib;
public static byte[] mincorlib => ResourceLoader.GetOrCreateResource(ref s_mincorlib, "NetFX.Minimal.mincorlib.dll");
private static byte[] s_minasync;
public static byte[] minasync => ResourceLoader.GetOrCreateResource(ref s_minasync, "NetFX.Minimal.minasync.dll");
private static byte[] s_minasynccorlib;
public static byte[] minasynccorlib => ResourceLoader.GetOrCreateResource(ref s_minasynccorlib, "NetFX.Minimal.minasynccorlib.dll");
}
public static class ValueTuple
{
private static byte[] s_tuplelib;
public static byte[] tuplelib => ResourceLoader.GetOrCreateResource(ref s_tuplelib, "NetFX.ValueTuple.System.ValueTuple.dll");
private static string s_tuplelib_cs;
public static string tuplelib_cs => ResourceLoader.GetOrCreateResource(ref s_tuplelib_cs, "NetFX.ValueTuple.ValueTuple.cs");
private static string s_tupleAttributes_cs;
public static string tupleattributes_cs => ResourceLoader.GetOrCreateResource(ref s_tupleAttributes_cs, "NetFX.ValueTuple.TupleElementNamesAttribute.cs");
}
}
namespace TestResources
{
public static class PerfTests
{
private static string s_CSPerfTest;
public static string CSPerfTest => ResourceLoader.GetOrCreateResource(ref s_CSPerfTest, "PerfTests.CSPerfTest.cs");
private static string s_VBPerfTest;
public static string VBPerfTest => ResourceLoader.GetOrCreateResource(ref s_VBPerfTest, "PerfTests.VBPerfTest.vb");
}
public static class General
{
private static byte[] s_bigVisitor;
public static byte[] BigVisitor => ResourceLoader.GetOrCreateResource(ref s_bigVisitor, "SymbolsTests.BigVisitor.dll");
private static byte[] s_delegateByRefParamArray;
public static byte[] DelegateByRefParamArray => ResourceLoader.GetOrCreateResource(ref s_delegateByRefParamArray, "SymbolsTests.Delegates.DelegateByRefParamArray.dll");
private static byte[] s_delegatesWithoutInvoke;
public static byte[] DelegatesWithoutInvoke => ResourceLoader.GetOrCreateResource(ref s_delegatesWithoutInvoke, "SymbolsTests.Delegates.DelegatesWithoutInvoke.dll");
private static byte[] s_shiftJisSource;
public static byte[] ShiftJisSource => ResourceLoader.GetOrCreateResource(ref s_shiftJisSource, "Encoding.sjis.cs");
private static byte[] s_events;
public static byte[] Events => ResourceLoader.GetOrCreateResource(ref s_events, "SymbolsTests.Events.dll");
private static byte[] s_CSharpExplicitInterfaceImplementation;
public static byte[] CSharpExplicitInterfaceImplementation => ResourceLoader.GetOrCreateResource(ref s_CSharpExplicitInterfaceImplementation, "SymbolsTests.ExplicitInterfaceImplementation.CSharpExplicitInterfaceImplementation.dll");
private static byte[] s_CSharpExplicitInterfaceImplementationEvents;
public static byte[] CSharpExplicitInterfaceImplementationEvents => ResourceLoader.GetOrCreateResource(ref s_CSharpExplicitInterfaceImplementationEvents, "SymbolsTests.ExplicitInterfaceImplementation.CSharpExplicitInterfaceImplementationEvents.dll");
private static byte[] s_CSharpExplicitInterfaceImplementationProperties;
public static byte[] CSharpExplicitInterfaceImplementationProperties => ResourceLoader.GetOrCreateResource(ref s_CSharpExplicitInterfaceImplementationProperties, "SymbolsTests.ExplicitInterfaceImplementation.CSharpExplicitInterfaceImplementationProperties.dll");
private static byte[] s_ILExplicitInterfaceImplementation;
public static byte[] ILExplicitInterfaceImplementation => ResourceLoader.GetOrCreateResource(ref s_ILExplicitInterfaceImplementation, "SymbolsTests.ExplicitInterfaceImplementation.ILExplicitInterfaceImplementation.dll");
private static byte[] s_ILExplicitInterfaceImplementationProperties;
public static byte[] ILExplicitInterfaceImplementationProperties => ResourceLoader.GetOrCreateResource(ref s_ILExplicitInterfaceImplementationProperties, "SymbolsTests.ExplicitInterfaceImplementation.ILExplicitInterfaceImplementationProperties.dll");
private static byte[] s_FSharpTestLibrary;
public static byte[] FSharpTestLibrary => ResourceLoader.GetOrCreateResource(ref s_FSharpTestLibrary, "SymbolsTests.FSharpTestLibrary.dll");
private static byte[] s_indexers;
public static byte[] Indexers => ResourceLoader.GetOrCreateResource(ref s_indexers, "SymbolsTests.Indexers.dll");
private static byte[] s_inheritIComparable;
public static byte[] InheritIComparable => ResourceLoader.GetOrCreateResource(ref s_inheritIComparable, "SymbolsTests.InheritIComparable.dll");
private static byte[] s_MDTestLib1;
public static byte[] MDTestLib1 => ResourceLoader.GetOrCreateResource(ref s_MDTestLib1, "SymbolsTests.MDTestLib1.dll");
private static byte[] s_MDTestLib2;
public static byte[] MDTestLib2 => ResourceLoader.GetOrCreateResource(ref s_MDTestLib2, "SymbolsTests.MDTestLib2.dll");
private static byte[] s_nativeCOFFResources;
public static byte[] nativeCOFFResources => ResourceLoader.GetOrCreateResource(ref s_nativeCOFFResources, "SymbolsTests.nativeCOFFResources.obj");
private static byte[] s_properties;
public static byte[] Properties => ResourceLoader.GetOrCreateResource(ref s_properties, "SymbolsTests.Properties.dll");
private static byte[] s_propertiesWithByRef;
public static byte[] PropertiesWithByRef => ResourceLoader.GetOrCreateResource(ref s_propertiesWithByRef, "SymbolsTests.PropertiesWithByRef.dll");
private static byte[] s_regress40025DLL;
public static byte[] Regress40025DLL => ResourceLoader.GetOrCreateResource(ref s_regress40025DLL, "SymbolsTests.Regress40025DLL.dll");
private static byte[] s_snKey;
public static byte[] snKey => ResourceLoader.GetOrCreateResource(ref s_snKey, "SymbolsTests.snKey.snk");
private static byte[] s_snKey2;
public static byte[] snKey2 => ResourceLoader.GetOrCreateResource(ref s_snKey2, "SymbolsTests.snKey2.snk");
private static byte[] s_snPublicKey;
public static byte[] snPublicKey => ResourceLoader.GetOrCreateResource(ref s_snPublicKey, "SymbolsTests.snPublicKey.snk");
private static byte[] s_snPublicKey2;
public static byte[] snPublicKey2 => ResourceLoader.GetOrCreateResource(ref s_snPublicKey2, "SymbolsTests.snPublicKey2.snk");
private static byte[] s_snMaxSizeKey;
public static byte[] snMaxSizeKey => ResourceLoader.GetOrCreateResource(ref s_snMaxSizeKey, "SymbolsTests.snMaxSizeKey.snk");
private static byte[] s_snMaxSizePublicKey;
public static byte[] snMaxSizePublicKey => ResourceLoader.GetOrCreateResource(ref s_snMaxSizePublicKey, "SymbolsTests.snMaxSizePublicKey.snk");
public static string snMaxSizePublicKeyString => "002400000480000014080000060200000024000052534131004000000100010079bb5332224912" +
"5411d2b44dd63b137e1b452899a7e7f626917328ff9e25c728e3e3b503ba34deab31d1f1ae1558" +
"8c4bda69eccea5b13e4a4e10b39fc2fd9f05d1ba728beb8365bad6b6da9adc653836d3ff12b9a6" +
"98900c3f593cf088b2504ec949489b6f837e76fe84ddd30ccedce1d836e5b8fb149b8e9e0b8b8f" +
"bc2cdaee0e76eb549270c4df104accb72530113f431d88982ae69ed75e09530d6951722b60342e" +
"b1f5dd5babacdb365dd71597680c50fe85bce823ee902ab3377e7eef8f96168f8c8a1e8264ba94" +
"481f5208e4c21208ea312bc1a34bd0e615b39ce8948c4a4d2c0a48b0bc901dfc0519afc378f859" +
"5a77375e6c265e1c38bdc7dbf7c4d07d36b67ac94464fe5c26aed915f1c035756d0f3363fce751" +
"0f12459060f417ab5df610ffca60e6dd739dc750189f23a47716c75a7a8e3363b198f05093d2a0" +
"c9debafbfca3d682c5ea3ed578118d9dc7d0f8828cad1c03ede009d774585b9665e0c8d7325805" +
"faba80796f668f79c92b9a195bc7530bb8ecaaba07a7cfdb70c46b96ca613102b1a674bfc742fa" +
"9562704edb78063db818c0675c9bd8c18d203fc4d5bc2685003bc6c136caf07a202578cb85480d" +
"50f6187b88fb733a2f4ce200bbda68c4ef47483a3530ae8403cb38253a06e2e9385b6d3ae9a718" +
"2ba7a23f03499cec1c92ae06dde6b304c025d23466ebbbac9e06b5d7eb932fc009bc1803d03571" +
"0ec7bce4a6176b407ffdc9a5b55a3ff444609172a146bf76ae40759634e8224ba2882371808f44" +
"59a37f8e69115424947818f19ff6609a715f550e33de0307195fe1e526c57efc7212d6cb561dd8" +
"33cb8c28ae9dc32a4bc0f775887001a5ec36cf63e5b2aa9989d3fa29ebf57e4fa89a206a32e75b" +
"cac3c2f26c3267ec1b7433d4a3b90bc01563ddbffffe586ccfb8ee59af34e3127ebf99036427e0" +
"9c107d47c1e885a032065dce6dd646305bf84fb9123392c89794318e2fdffd5eaa62d1e52d29b9" +
"4e484f2fb73fea0487bbdaa1790e79fc0e09372c6187c742c8a3f160d09818f51dc58f71ff1a1e" +
"d955d9b373bfe92e09eac22241c2b96ce0213aa266f21aae95489921269bffdf5c0a0794716daf" +
"8b5daa3a496004297b3a25c6472027f4b6f9fd82d4e297546faa6ac31579a30b3da1d6c6f04125" +
"667868b536b9d9ebd767e4d1cabbaeb977ec0738dab3b599fe63ea0ec622261d90c3c0c1ebc1ab" +
"631b2162284a9659e961c541aab1658853a9a6501e73f11c9c27b8e9bf41f03187dab5909d8433" +
"499f9dfaec2a2c907e39bf1683c75c882e469e79aba05d597a24db33479fac758f5bdc4cbd79df" +
"03ec1e403f231bfb81ff9db7ee4cfe084f5c187729cc9f072d7a710651ea15f0e43f330e321723" +
"21554d7bf9fd784d18a80a13509818286616d4a7251e2c57f1c257aa0c57bd75da0b0e01532ad5" +
"17de450733f8379a9db8c9f12ac77b65215d44b40eebb513ec9ddc9537f7811eb5283386422d90" +
"6d26077608a1f506e966426d40cc5e61e2d7e888586c85050ec29eff79116c42c9714ad6672441" +
"03a9e79af9b330825ff186b19a791b60eca8776539ca2759f9dbbd87d07f3dac38b814ae9707e4" +
"73ee52e10b3e8d8344bc06287a9c6c58ab36658b4a6ab48ae2e6d08d748b35868c5207aab08311" +
"91f451595d0104968050ae1c13e0d619fa766cd90821732b9fbcc429815606704633515cbe5ad5" +
"e33a28690534748e15413c65d9a370b12946a36796aa4d8e5b471675a3471439e133476981e21e" +
"9a4dfeae52f657a5fe3ab6cd6ad8aabc09bd5d9af77226c6cfbe01fb38546b5c0b8b825e03bda1" +
"3d85403765bd5a6cbed19fd09674fd691d732328948f5ab07e03d7f919eee0ac23f6de7d49ae44" +
"f15f8459683ab792270945ee2807158a5e6898cb912cbe3b0b6820565045a41699d0a5e3b89319" +
"fb921008e18bb1c28557600c33cf2c299a79213834cb9ec72ba6402699c381060cfebaa3faf52d" +
"9b2f1b68c3cc0db79ff47b293853b80ec4198c7fe099077f876f2d6c26305cab1c9de8bb8daae4" +
"22e1ef7c5c76949c8d27fde90281781eef364cc001d0916108d6c0ace740521ec549d912fbaf71" +
"68bd37f790b46282684030dcdc2d52cb41d4b763adfc701a1d392166d4b3269ab30fb83a4fd183" +
"4771e0ea24680c09f55413750b082787e4bb301e107c34cfab1cc88b7d68489602cb8e46bd73c9" +
"6c8de8af5285f919e93cc6251df057443460a15d432e130510f8adbaa8d28c574db7d9ef6fb947" +
"b70e274d93cfaa47d00f3318643a08815c10975722324037504d7f0e3902393d5327bc0467ea5b" +
"d555ba0671ca3873486038abeccc6d48a11c6e3ffb2acca285a53641a02233bb7e7c76ab38acf6" +
"759b985e22b18da77932c0c04217798d1473ebf41061d8c006c9479b34745fbea8a1761000d16f" +
"414a544a7dc4a5a346871981d1ed3fe4dfcb8494e95643b8bae2e13bbfcb5a432c2dfd481e1d61" +
"bab2bcc0d7140fe9b472d25112b2e241c3026a7468560ce3ed582d6872b041680bff3998d51afc" +
"a45094e3e1982510fe8573ac2d3ab596d9d0c6b43a5f72c6046f24c2ac457fd440d6f8d4dd0b71" +
"399d0c1aa366e7a86c57ba5235d327da1245b5ecdf0b3e0e81a0418a5743f3fe98ef6c9236dce0" +
"2463c798af2b239f6ddf2e5a5ffa198151c2ffbf932b7357e80e858c9ddb81fe8223897af61cae" +
"c44ae4f07e686b1d721fa78b39c7934179786592472f8739fb90fd5ae41e118fafbb30bd7b02c3" +
"cf3def669d830f4dcdf863919c1ee6c3b68a4d66a74af3088592a4055b54738804034d134c5a92" +
"e47395955d222b04472da50de86f931084653e4b0f91ffccef2c777c80d92683f8f87b6b60733d" +
"73b0035501dd2adba2bbdf6697";
private static byte[] s_CSharpErrors;
public static byte[] CSharpErrors => ResourceLoader.GetOrCreateResource(ref s_CSharpErrors, "SymbolsTests.UseSiteErrors.CSharpErrors.dll");
private static byte[] s_ILErrors;
public static byte[] ILErrors => ResourceLoader.GetOrCreateResource(ref s_ILErrors, "SymbolsTests.UseSiteErrors.ILErrors.dll");
private static byte[] s_unavailable;
public static byte[] Unavailable => ResourceLoader.GetOrCreateResource(ref s_unavailable, "SymbolsTests.UseSiteErrors.Unavailable.dll");
private static byte[] s_VBConversions;
public static byte[] VBConversions => ResourceLoader.GetOrCreateResource(ref s_VBConversions, "SymbolsTests.VBConversions.dll");
private static byte[] s_culture_AR_SA;
public static byte[] Culture_AR_SA => ResourceLoader.GetOrCreateResource(ref s_culture_AR_SA, "SymbolsTests.Versioning.AR_SA.Culture.dll");
private static byte[] s_culture_EN_US;
public static byte[] Culture_EN_US => ResourceLoader.GetOrCreateResource(ref s_culture_EN_US, "SymbolsTests.Versioning.EN_US.Culture.dll");
private static byte[] s_C1;
public static byte[] C1 => ResourceLoader.GetOrCreateResource(ref s_C1, "SymbolsTests.Versioning.V1.C.dll");
private static byte[] s_C2;
public static byte[] C2 => ResourceLoader.GetOrCreateResource(ref s_C2, "SymbolsTests.Versioning.V2.C.dll");
private static byte[] s_with_Spaces;
public static byte[] With_Spaces => ResourceLoader.GetOrCreateResource(ref s_with_Spaces, "SymbolsTests.With Spaces.dll");
private static byte[] s_with_SpacesModule;
public static byte[] With_SpacesModule => ResourceLoader.GetOrCreateResource(ref s_with_SpacesModule, "SymbolsTests.With Spaces.netmodule");
}
}
namespace TestResources.SymbolsTests
{
public static class CorLibrary
{
private static byte[] s_fakeMsCorLib;
public static byte[] FakeMsCorLib => ResourceLoader.GetOrCreateResource(ref s_fakeMsCorLib, "SymbolsTests.CorLibrary.FakeMsCorLib.dll");
private static byte[] s_guidTest2;
public static byte[] GuidTest2 => ResourceLoader.GetOrCreateResource(ref s_guidTest2, "SymbolsTests.CorLibrary.GuidTest2.exe");
private static byte[] s_noMsCorLibRef;
public static byte[] NoMsCorLibRef => ResourceLoader.GetOrCreateResource(ref s_noMsCorLibRef, "SymbolsTests.CorLibrary.NoMsCorLibRef.dll");
}
public static class CustomModifiers
{
private static byte[] s_cppCli;
public static byte[] CppCli => ResourceLoader.GetOrCreateResource(ref s_cppCli, "SymbolsTests.CustomModifiers.CppCli.dll");
private static byte[] s_modifiers;
public static byte[] Modifiers => ResourceLoader.GetOrCreateResource(ref s_modifiers, "SymbolsTests.CustomModifiers.Modifiers.dll");
private static byte[] s_modifiersModule;
public static byte[] ModifiersModule => ResourceLoader.GetOrCreateResource(ref s_modifiersModule, "SymbolsTests.CustomModifiers.Modifiers.netmodule");
private static byte[] s_modoptTests;
public static byte[] ModoptTests => ResourceLoader.GetOrCreateResource(ref s_modoptTests, "SymbolsTests.CustomModifiers.ModoptTests.dll");
private static byte[] s_genericMethodWithModifiers;
public static byte[] GenericMethodWithModifiers => ResourceLoader.GetOrCreateResource(ref s_genericMethodWithModifiers, "SymbolsTests.CustomModifiers.GenericMethodWithModifiers.dll");
}
public static class Cyclic
{
private static byte[] s_cyclic1;
public static byte[] Cyclic1 => ResourceLoader.GetOrCreateResource(ref s_cyclic1, "SymbolsTests.Cyclic.Cyclic1.dll");
private static byte[] s_cyclic2;
public static byte[] Cyclic2 => ResourceLoader.GetOrCreateResource(ref s_cyclic2, "SymbolsTests.Cyclic.Cyclic2.dll");
}
public static class CyclicInheritance
{
private static byte[] s_class1;
public static byte[] Class1 => ResourceLoader.GetOrCreateResource(ref s_class1, "SymbolsTests.CyclicInheritance.Class1.dll");
private static byte[] s_class2;
public static byte[] Class2 => ResourceLoader.GetOrCreateResource(ref s_class2, "SymbolsTests.CyclicInheritance.Class2.dll");
private static byte[] s_class3;
public static byte[] Class3 => ResourceLoader.GetOrCreateResource(ref s_class3, "SymbolsTests.CyclicInheritance.Class3.dll");
}
public static class CyclicStructure
{
private static byte[] s_cycledstructs;
public static byte[] cycledstructs => ResourceLoader.GetOrCreateResource(ref s_cycledstructs, "SymbolsTests.CyclicStructure.cycledstructs.dll");
}
public static class DifferByCase
{
private static byte[] s_consumer;
public static byte[] Consumer => ResourceLoader.GetOrCreateResource(ref s_consumer, "SymbolsTests.DifferByCase.Consumer.dll");
private static byte[] s_csharpCaseSen;
public static byte[] CsharpCaseSen => ResourceLoader.GetOrCreateResource(ref s_csharpCaseSen, "SymbolsTests.DifferByCase.CsharpCaseSen.dll");
private static byte[] s_CSharpDifferCaseOverloads;
public static byte[] CSharpDifferCaseOverloads => ResourceLoader.GetOrCreateResource(ref s_CSharpDifferCaseOverloads, "SymbolsTests.DifferByCase.CSharpDifferCaseOverloads.dll");
private static byte[] s_typeAndNamespaceDifferByCase;
public static byte[] TypeAndNamespaceDifferByCase => ResourceLoader.GetOrCreateResource(ref s_typeAndNamespaceDifferByCase, "SymbolsTests.DifferByCase.TypeAndNamespaceDifferByCase.dll");
}
public static class Fields
{
private static byte[] s_constantFields;
public static byte[] ConstantFields => ResourceLoader.GetOrCreateResource(ref s_constantFields, "SymbolsTests.Fields.ConstantFields.dll");
private static byte[] s_CSFields;
public static byte[] CSFields => ResourceLoader.GetOrCreateResource(ref s_CSFields, "SymbolsTests.Fields.CSFields.dll");
private static byte[] s_VBFields;
public static byte[] VBFields => ResourceLoader.GetOrCreateResource(ref s_VBFields, "SymbolsTests.Fields.VBFields.dll");
}
public static class Interface
{
private static byte[] s_MDInterfaceMapping;
public static byte[] MDInterfaceMapping => ResourceLoader.GetOrCreateResource(ref s_MDInterfaceMapping, "SymbolsTests.Interface.MDInterfaceMapping.dll");
private static byte[] s_staticMethodInInterface;
public static byte[] StaticMethodInInterface => ResourceLoader.GetOrCreateResource(ref s_staticMethodInInterface, "SymbolsTests.Interface.StaticMethodInInterface.dll");
}
public static class Metadata
{
private static byte[] s_attributeInterop01;
public static byte[] AttributeInterop01 => ResourceLoader.GetOrCreateResource(ref s_attributeInterop01, "SymbolsTests.Metadata.AttributeInterop01.dll");
private static byte[] s_attributeInterop02;
public static byte[] AttributeInterop02 => ResourceLoader.GetOrCreateResource(ref s_attributeInterop02, "SymbolsTests.Metadata.AttributeInterop02.dll");
private static byte[] s_attributeTestDef01;
public static byte[] AttributeTestDef01 => ResourceLoader.GetOrCreateResource(ref s_attributeTestDef01, "SymbolsTests.Metadata.AttributeTestDef01.dll");
private static byte[] s_attributeTestLib01;
public static byte[] AttributeTestLib01 => ResourceLoader.GetOrCreateResource(ref s_attributeTestLib01, "SymbolsTests.Metadata.AttributeTestLib01.dll");
private static byte[] s_dynamicAttribute;
public static byte[] DynamicAttribute => ResourceLoader.GetOrCreateResource(ref s_dynamicAttribute, "SymbolsTests.Metadata.DynamicAttribute.dll");
private static byte[] s_invalidCharactersInAssemblyName;
public static byte[] InvalidCharactersInAssemblyName => ResourceLoader.GetOrCreateResource(ref s_invalidCharactersInAssemblyName, "SymbolsTests.Metadata.InvalidCharactersInAssemblyName.dll");
private static byte[] s_invalidPublicKey;
public static byte[] InvalidPublicKey => ResourceLoader.GetOrCreateResource(ref s_invalidPublicKey, "SymbolsTests.Metadata.InvalidPublicKey.dll");
private static byte[] s_MDTestAttributeApplicationLib;
public static byte[] MDTestAttributeApplicationLib => ResourceLoader.GetOrCreateResource(ref s_MDTestAttributeApplicationLib, "SymbolsTests.Metadata.MDTestAttributeApplicationLib.dll");
private static byte[] s_MDTestAttributeDefLib;
public static byte[] MDTestAttributeDefLib => ResourceLoader.GetOrCreateResource(ref s_MDTestAttributeDefLib, "SymbolsTests.Metadata.MDTestAttributeDefLib.dll");
private static byte[] s_mscorlibNamespacesAndTypes;
public static byte[] MscorlibNamespacesAndTypes => ResourceLoader.GetOrCreateResource(ref s_mscorlibNamespacesAndTypes, "SymbolsTests.Metadata.MscorlibNamespacesAndTypes.bsl");
private static byte[] s_publicAndPrivateFlags;
public static byte[] PublicAndPrivateFlags => ResourceLoader.GetOrCreateResource(ref s_publicAndPrivateFlags, "SymbolsTests.Metadata.public-and-private.dll");
}
public static class Methods
{
private static byte[] s_byRefReturn;
public static byte[] ByRefReturn => ResourceLoader.GetOrCreateResource(ref s_byRefReturn, "SymbolsTests.Methods.ByRefReturn.dll");
private static byte[] s_CSMethods;
public static byte[] CSMethods => ResourceLoader.GetOrCreateResource(ref s_CSMethods, "SymbolsTests.Methods.CSMethods.dll");
private static byte[] s_ILMethods;
public static byte[] ILMethods => ResourceLoader.GetOrCreateResource(ref s_ILMethods, "SymbolsTests.Methods.ILMethods.dll");
private static byte[] s_VBMethods;
public static byte[] VBMethods => ResourceLoader.GetOrCreateResource(ref s_VBMethods, "SymbolsTests.Methods.VBMethods.dll");
}
public static class MissingTypes
{
private static byte[] s_CL2;
public static byte[] CL2 => ResourceLoader.GetOrCreateResource(ref s_CL2, "SymbolsTests.MissingTypes.CL2.dll");
private static byte[] s_CL3;
public static byte[] CL3 => ResourceLoader.GetOrCreateResource(ref s_CL3, "SymbolsTests.MissingTypes.CL3.dll");
private static string s_CL3_VB;
public static string CL3_VB => ResourceLoader.GetOrCreateResource(ref s_CL3_VB, "SymbolsTests.MissingTypes.CL3.vb");
private static byte[] s_MDMissingType;
public static byte[] MDMissingType => ResourceLoader.GetOrCreateResource(ref s_MDMissingType, "SymbolsTests.MissingTypes.MDMissingType.dll");
private static byte[] s_MDMissingTypeLib;
public static byte[] MDMissingTypeLib => ResourceLoader.GetOrCreateResource(ref s_MDMissingTypeLib, "SymbolsTests.MissingTypes.MDMissingTypeLib.dll");
private static byte[] s_MDMissingTypeLib_New;
public static byte[] MDMissingTypeLib_New => ResourceLoader.GetOrCreateResource(ref s_MDMissingTypeLib_New, "SymbolsTests.MissingTypes.MDMissingTypeLib_New.dll");
private static byte[] s_missingTypesEquality1;
public static byte[] MissingTypesEquality1 => ResourceLoader.GetOrCreateResource(ref s_missingTypesEquality1, "SymbolsTests.MissingTypes.MissingTypesEquality1.dll");
private static byte[] s_missingTypesEquality2;
public static byte[] MissingTypesEquality2 => ResourceLoader.GetOrCreateResource(ref s_missingTypesEquality2, "SymbolsTests.MissingTypes.MissingTypesEquality2.dll");
}
public static class MultiModule
{
private static byte[] s_consumer;
public static byte[] Consumer => ResourceLoader.GetOrCreateResource(ref s_consumer, "SymbolsTests.MultiModule.Consumer.dll");
private static byte[] s_mod2;
public static byte[] mod2 => ResourceLoader.GetOrCreateResource(ref s_mod2, "SymbolsTests.MultiModule.mod2.netmodule");
private static byte[] s_mod3;
public static byte[] mod3 => ResourceLoader.GetOrCreateResource(ref s_mod3, "SymbolsTests.MultiModule.mod3.netmodule");
private static byte[] s_multiModuleDll;
public static byte[] MultiModuleDll => ResourceLoader.GetOrCreateResource(ref s_multiModuleDll, "SymbolsTests.MultiModule.MultiModule.dll");
}
public static class MultiTargeting
{
private static byte[] s_source1Module;
public static byte[] Source1Module => ResourceLoader.GetOrCreateResource(ref s_source1Module, "SymbolsTests.MultiTargeting.Source1Module.netmodule");
private static byte[] s_source3Module;
public static byte[] Source3Module => ResourceLoader.GetOrCreateResource(ref s_source3Module, "SymbolsTests.MultiTargeting.Source3Module.netmodule");
private static byte[] s_source4Module;
public static byte[] Source4Module => ResourceLoader.GetOrCreateResource(ref s_source4Module, "SymbolsTests.MultiTargeting.Source4Module.netmodule");
private static byte[] s_source5Module;
public static byte[] Source5Module => ResourceLoader.GetOrCreateResource(ref s_source5Module, "SymbolsTests.MultiTargeting.Source5Module.netmodule");
private static byte[] s_source7Module;
public static byte[] Source7Module => ResourceLoader.GetOrCreateResource(ref s_source7Module, "SymbolsTests.MultiTargeting.Source7Module.netmodule");
}
public static class netModule
{
private static byte[] s_crossRefLib;
public static byte[] CrossRefLib => ResourceLoader.GetOrCreateResource(ref s_crossRefLib, "SymbolsTests.netModule.CrossRefLib.dll");
private static byte[] s_crossRefModule1;
public static byte[] CrossRefModule1 => ResourceLoader.GetOrCreateResource(ref s_crossRefModule1, "SymbolsTests.netModule.CrossRefModule1.netmodule");
private static byte[] s_crossRefModule2;
public static byte[] CrossRefModule2 => ResourceLoader.GetOrCreateResource(ref s_crossRefModule2, "SymbolsTests.netModule.CrossRefModule2.netmodule");
private static byte[] s_hash_module;
public static byte[] hash_module => ResourceLoader.GetOrCreateResource(ref s_hash_module, "SymbolsTests.netModule.hash_module.netmodule");
private static byte[] s_netModule1;
public static byte[] netModule1 => ResourceLoader.GetOrCreateResource(ref s_netModule1, "SymbolsTests.netModule.netModule1.netmodule");
private static byte[] s_netModule2;
public static byte[] netModule2 => ResourceLoader.GetOrCreateResource(ref s_netModule2, "SymbolsTests.netModule.netModule2.netmodule");
private static byte[] s_x64COFF;
public static byte[] x64COFF => ResourceLoader.GetOrCreateResource(ref s_x64COFF, "SymbolsTests.netModule.x64COFF.obj");
}
public static class NoPia
{
private static byte[] s_A;
public static byte[] A => ResourceLoader.GetOrCreateResource(ref s_A, "SymbolsTests.NoPia.A.dll");
private static byte[] s_B;
public static byte[] B => ResourceLoader.GetOrCreateResource(ref s_B, "SymbolsTests.NoPia.B.dll");
private static byte[] s_C;
public static byte[] C => ResourceLoader.GetOrCreateResource(ref s_C, "SymbolsTests.NoPia.C.dll");
private static byte[] s_D;
public static byte[] D => ResourceLoader.GetOrCreateResource(ref s_D, "SymbolsTests.NoPia.D.dll");
private static byte[] s_externalAsm1;
public static byte[] ExternalAsm1 => ResourceLoader.GetOrCreateResource(ref s_externalAsm1, "SymbolsTests.NoPia.ExternalAsm1.dll");
private static byte[] s_generalPia;
public static byte[] GeneralPia => ResourceLoader.GetOrCreateResource(ref s_generalPia, "SymbolsTests.NoPia.GeneralPia.dll");
private static byte[] s_generalPiaCopy;
public static byte[] GeneralPiaCopy => ResourceLoader.GetOrCreateResource(ref s_generalPiaCopy, "SymbolsTests.NoPia.GeneralPiaCopy.dll");
private static byte[] s_library1;
public static byte[] Library1 => ResourceLoader.GetOrCreateResource(ref s_library1, "SymbolsTests.NoPia.Library1.dll");
private static byte[] s_library2;
public static byte[] Library2 => ResourceLoader.GetOrCreateResource(ref s_library2, "SymbolsTests.NoPia.Library2.dll");
private static byte[] s_localTypes1;
public static byte[] LocalTypes1 => ResourceLoader.GetOrCreateResource(ref s_localTypes1, "SymbolsTests.NoPia.LocalTypes1.dll");
private static byte[] s_localTypes2;
public static byte[] LocalTypes2 => ResourceLoader.GetOrCreateResource(ref s_localTypes2, "SymbolsTests.NoPia.LocalTypes2.dll");
private static byte[] s_localTypes3;
public static byte[] LocalTypes3 => ResourceLoader.GetOrCreateResource(ref s_localTypes3, "SymbolsTests.NoPia.LocalTypes3.dll");
private static byte[] s_missingPIAAttributes;
public static byte[] MissingPIAAttributes => ResourceLoader.GetOrCreateResource(ref s_missingPIAAttributes, "SymbolsTests.NoPia.MissingPIAAttributes.dll");
private static byte[] s_noPIAGenerics1_Asm1;
public static byte[] NoPIAGenerics1_Asm1 => ResourceLoader.GetOrCreateResource(ref s_noPIAGenerics1_Asm1, "SymbolsTests.NoPia.NoPIAGenerics1-Asm1.dll");
private static byte[] s_pia1;
public static byte[] Pia1 => ResourceLoader.GetOrCreateResource(ref s_pia1, "SymbolsTests.NoPia.Pia1.dll");
private static byte[] s_pia1Copy;
public static byte[] Pia1Copy => ResourceLoader.GetOrCreateResource(ref s_pia1Copy, "SymbolsTests.NoPia.Pia1Copy.dll");
private static byte[] s_pia2;
public static byte[] Pia2 => ResourceLoader.GetOrCreateResource(ref s_pia2, "SymbolsTests.NoPia.Pia2.dll");
private static byte[] s_pia3;
public static byte[] Pia3 => ResourceLoader.GetOrCreateResource(ref s_pia3, "SymbolsTests.NoPia.Pia3.dll");
private static byte[] s_pia4;
public static byte[] Pia4 => ResourceLoader.GetOrCreateResource(ref s_pia4, "SymbolsTests.NoPia.Pia4.dll");
private static byte[] s_pia5;
public static byte[] Pia5 => ResourceLoader.GetOrCreateResource(ref s_pia5, "SymbolsTests.NoPia.Pia5.dll");
private static byte[] s_parametersWithoutNames;
public static byte[] ParametersWithoutNames => ResourceLoader.GetOrCreateResource(ref s_parametersWithoutNames, "SymbolsTests.NoPia.ParametersWithoutNames.dll");
}
}
namespace TestResources.SymbolsTests.RetargetingCycle
{
public static class RetV1
{
private static byte[] s_classA;
public static byte[] ClassA => ResourceLoader.GetOrCreateResource(ref s_classA, "SymbolsTests.RetargetingCycle.V1.ClassA.dll");
private static byte[] s_classB;
public static byte[] ClassB => ResourceLoader.GetOrCreateResource(ref s_classB, "SymbolsTests.RetargetingCycle.V1.ClassB.netmodule");
}
public static class RetV2
{
private static byte[] s_classA;
public static byte[] ClassA => ResourceLoader.GetOrCreateResource(ref s_classA, "SymbolsTests.RetargetingCycle.V2.ClassA.dll");
private static byte[] s_classB;
public static byte[] ClassB => ResourceLoader.GetOrCreateResource(ref s_classB, "SymbolsTests.RetargetingCycle.V2.ClassB.dll");
}
}
namespace TestResources.SymbolsTests
{
public static class TypeForwarders
{
private static byte[] s_forwarded;
public static byte[] Forwarded => ResourceLoader.GetOrCreateResource(ref s_forwarded, "SymbolsTests.TypeForwarders.Forwarded.netmodule");
private static byte[] s_typeForwarder;
public static byte[] TypeForwarder => ResourceLoader.GetOrCreateResource(ref s_typeForwarder, "SymbolsTests.TypeForwarders.TypeForwarder.dll");
private static byte[] s_typeForwarderBase;
public static byte[] TypeForwarderBase => ResourceLoader.GetOrCreateResource(ref s_typeForwarderBase, "SymbolsTests.TypeForwarders.TypeForwarderBase.dll");
private static byte[] s_typeForwarderLib;
public static byte[] TypeForwarderLib => ResourceLoader.GetOrCreateResource(ref s_typeForwarderLib, "SymbolsTests.TypeForwarders.TypeForwarderLib.dll");
}
public static class V1
{
private static byte[] s_MTTestLib1;
public static byte[] MTTestLib1 => ResourceLoader.GetOrCreateResource(ref s_MTTestLib1, "SymbolsTests.V1.MTTestLib1.Dll");
private static string s_MTTestLib1_V1;
public static string MTTestLib1_V1 => ResourceLoader.GetOrCreateResource(ref s_MTTestLib1_V1, "SymbolsTests.V1.MTTestLib1_V1.vb");
private static byte[] s_MTTestLib2;
public static byte[] MTTestLib2 => ResourceLoader.GetOrCreateResource(ref s_MTTestLib2, "SymbolsTests.V1.MTTestLib2.Dll");
private static string s_MTTestLib2_V1;
public static string MTTestLib2_V1 => ResourceLoader.GetOrCreateResource(ref s_MTTestLib2_V1, "SymbolsTests.V1.MTTestLib2_V1.vb");
private static byte[] s_MTTestModule1;
public static byte[] MTTestModule1 => ResourceLoader.GetOrCreateResource(ref s_MTTestModule1, "SymbolsTests.V1.MTTestModule1.netmodule");
private static byte[] s_MTTestModule2;
public static byte[] MTTestModule2 => ResourceLoader.GetOrCreateResource(ref s_MTTestModule2, "SymbolsTests.V1.MTTestModule2.netmodule");
}
public static class V2
{
private static byte[] s_MTTestLib1;
public static byte[] MTTestLib1 => ResourceLoader.GetOrCreateResource(ref s_MTTestLib1, "SymbolsTests.V2.MTTestLib1.Dll");
private static string s_MTTestLib1_V2;
public static string MTTestLib1_V2 => ResourceLoader.GetOrCreateResource(ref s_MTTestLib1_V2, "SymbolsTests.V2.MTTestLib1_V2.vb");
private static byte[] s_MTTestLib3;
public static byte[] MTTestLib3 => ResourceLoader.GetOrCreateResource(ref s_MTTestLib3, "SymbolsTests.V2.MTTestLib3.Dll");
private static string s_MTTestLib3_V2;
public static string MTTestLib3_V2 => ResourceLoader.GetOrCreateResource(ref s_MTTestLib3_V2, "SymbolsTests.V2.MTTestLib3_V2.vb");
private static byte[] s_MTTestModule1;
public static byte[] MTTestModule1 => ResourceLoader.GetOrCreateResource(ref s_MTTestModule1, "SymbolsTests.V2.MTTestModule1.netmodule");
private static byte[] s_MTTestModule3;
public static byte[] MTTestModule3 => ResourceLoader.GetOrCreateResource(ref s_MTTestModule3, "SymbolsTests.V2.MTTestModule3.netmodule");
}
public static class V3
{
private static byte[] s_MTTestLib1;
public static byte[] MTTestLib1 => ResourceLoader.GetOrCreateResource(ref s_MTTestLib1, "SymbolsTests.V3.MTTestLib1.Dll");
private static string s_MTTestLib1_V3;
public static string MTTestLib1_V3 => ResourceLoader.GetOrCreateResource(ref s_MTTestLib1_V3, "SymbolsTests.V3.MTTestLib1_V3.vb");
private static byte[] s_MTTestLib4;
public static byte[] MTTestLib4 => ResourceLoader.GetOrCreateResource(ref s_MTTestLib4, "SymbolsTests.V3.MTTestLib4.Dll");
private static string s_MTTestLib4_V3;
public static string MTTestLib4_V3 => ResourceLoader.GetOrCreateResource(ref s_MTTestLib4_V3, "SymbolsTests.V3.MTTestLib4_V3.vb");
private static byte[] s_MTTestModule1;
public static byte[] MTTestModule1 => ResourceLoader.GetOrCreateResource(ref s_MTTestModule1, "SymbolsTests.V3.MTTestModule1.netmodule");
private static byte[] s_MTTestModule4;
public static byte[] MTTestModule4 => ResourceLoader.GetOrCreateResource(ref s_MTTestModule4, "SymbolsTests.V3.MTTestModule4.netmodule");
}
public static class WithEvents
{
private static byte[] s_simpleWithEvents;
public static byte[] SimpleWithEvents => ResourceLoader.GetOrCreateResource(ref s_simpleWithEvents, "SymbolsTests.WithEvents.SimpleWithEvents.dll");
}
}
namespace TestResources
{
public static class WinRt
{
private static byte[] s_W1;
public static byte[] W1 => ResourceLoader.GetOrCreateResource(ref s_W1, "WinRt.W1.winmd");
private static byte[] s_W2;
public static byte[] W2 => ResourceLoader.GetOrCreateResource(ref s_W2, "WinRt.W2.winmd");
private static byte[] s_WB;
public static byte[] WB => ResourceLoader.GetOrCreateResource(ref s_WB, "WinRt.WB.winmd");
private static byte[] s_WB_Version1;
public static byte[] WB_Version1 => ResourceLoader.GetOrCreateResource(ref s_WB_Version1, "WinRt.WB_Version1.winmd");
private static byte[] s_WImpl;
public static byte[] WImpl => ResourceLoader.GetOrCreateResource(ref s_WImpl, "WinRt.WImpl.winmd");
private static byte[] s_windows_dump;
public static byte[] Windows_dump => ResourceLoader.GetOrCreateResource(ref s_windows_dump, "WinRt.Windows.ildump");
private static byte[] s_windows_Languages_WinRTTest;
public static byte[] Windows_Languages_WinRTTest => ResourceLoader.GetOrCreateResource(ref s_windows_Languages_WinRTTest, "WinRt.Windows.Languages.WinRTTest.winmd");
private static byte[] s_windows;
public static byte[] Windows => ResourceLoader.GetOrCreateResource(ref s_windows, "WinRt.Windows.winmd");
private static byte[] s_winMDPrefixing_dump;
public static byte[] WinMDPrefixing_dump => ResourceLoader.GetOrCreateResource(ref s_winMDPrefixing_dump, "WinRt.WinMDPrefixing.ildump");
private static byte[] s_winMDPrefixing;
public static byte[] WinMDPrefixing => ResourceLoader.GetOrCreateResource(ref s_winMDPrefixing, "WinRt.WinMDPrefixing.winmd");
}
}
| // 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.
#nullable disable
namespace TestResources
{
public static class DiagnosticTests
{
private static byte[] s_badresfile;
public static byte[] badresfile => ResourceLoader.GetOrCreateResource(ref s_badresfile, "DiagnosticTests.badresfile.res");
private static byte[] s_errTestLib01;
public static byte[] ErrTestLib01 => ResourceLoader.GetOrCreateResource(ref s_errTestLib01, "DiagnosticTests.ErrTestLib01.dll");
private static byte[] s_errTestLib02;
public static byte[] ErrTestLib02 => ResourceLoader.GetOrCreateResource(ref s_errTestLib02, "DiagnosticTests.ErrTestLib02.dll");
private static byte[] s_errTestLib11;
public static byte[] ErrTestLib11 => ResourceLoader.GetOrCreateResource(ref s_errTestLib11, "DiagnosticTests.ErrTestLib11.dll");
private static byte[] s_errTestMod01;
public static byte[] ErrTestMod01 => ResourceLoader.GetOrCreateResource(ref s_errTestMod01, "DiagnosticTests.ErrTestMod01.netmodule");
private static byte[] s_errTestMod02;
public static byte[] ErrTestMod02 => ResourceLoader.GetOrCreateResource(ref s_errTestMod02, "DiagnosticTests.ErrTestMod02.netmodule");
}
public static class Basic
{
private static byte[] s_members;
public static byte[] Members => ResourceLoader.GetOrCreateResource(ref s_members, "MetadataTests.Members.dll");
private static byte[] s_nativeApp;
public static byte[] NativeApp => ResourceLoader.GetOrCreateResource(ref s_nativeApp, "MetadataTests.NativeApp.exe");
}
public static class ExpressionCompiler
{
private static byte[] s_empty;
public static byte[] Empty => ResourceLoader.GetOrCreateResource(ref s_empty, "ExpressionCompiler.Empty.dll");
private static byte[] s_libraryA;
public static byte[] LibraryA => ResourceLoader.GetOrCreateResource(ref s_libraryA, "ExpressionCompiler.LibraryA.winmd");
private static byte[] s_libraryB;
public static byte[] LibraryB => ResourceLoader.GetOrCreateResource(ref s_libraryB, "ExpressionCompiler.LibraryB.winmd");
private static byte[] s_noValidTables;
public static byte[] NoValidTables => ResourceLoader.GetOrCreateResource(ref s_noValidTables, "ExpressionCompiler.NoValidTables.metadata");
private static byte[] s_windows;
public static byte[] Windows => ResourceLoader.GetOrCreateResource(ref s_windows, "ExpressionCompiler.Windows.winmd");
private static byte[] s_windowsData;
public static byte[] WindowsData => ResourceLoader.GetOrCreateResource(ref s_windowsData, "ExpressionCompiler.Windows.Data.winmd");
private static byte[] s_windowsStorage;
public static byte[] WindowsStorage => ResourceLoader.GetOrCreateResource(ref s_windowsStorage, "ExpressionCompiler.Windows.Storage.winmd");
}
}
namespace TestResources.MetadataTests
{
public static class InterfaceAndClass
{
private static byte[] s_CSClasses01;
public static byte[] CSClasses01 => ResourceLoader.GetOrCreateResource(ref s_CSClasses01, "MetadataTests.InterfaceAndClass.CSClasses01.dll");
private static byte[] s_CSInterfaces01;
public static byte[] CSInterfaces01 => ResourceLoader.GetOrCreateResource(ref s_CSInterfaces01, "MetadataTests.InterfaceAndClass.CSInterfaces01.dll");
private static byte[] s_VBClasses01;
public static byte[] VBClasses01 => ResourceLoader.GetOrCreateResource(ref s_VBClasses01, "MetadataTests.InterfaceAndClass.VBClasses01.dll");
private static byte[] s_VBClasses02;
public static byte[] VBClasses02 => ResourceLoader.GetOrCreateResource(ref s_VBClasses02, "MetadataTests.InterfaceAndClass.VBClasses02.dll");
private static byte[] s_VBInterfaces01;
public static byte[] VBInterfaces01 => ResourceLoader.GetOrCreateResource(ref s_VBInterfaces01, "MetadataTests.InterfaceAndClass.VBInterfaces01.dll");
}
public static class Interop
{
private static byte[] s_indexerWithByRefParam;
public static byte[] IndexerWithByRefParam => ResourceLoader.GetOrCreateResource(ref s_indexerWithByRefParam, "MetadataTests.Interop.IndexerWithByRefParam.dll");
private static byte[] s_interop_Mock01;
public static byte[] Interop_Mock01 => ResourceLoader.GetOrCreateResource(ref s_interop_Mock01, "MetadataTests.Interop.Interop.Mock01.dll");
private static byte[] s_interop_Mock01_Impl;
public static byte[] Interop_Mock01_Impl => ResourceLoader.GetOrCreateResource(ref s_interop_Mock01_Impl, "MetadataTests.Interop.Interop.Mock01.Impl.dll");
}
public static class Invalid
{
private static byte[] s_classLayout;
public static byte[] ClassLayout => ResourceLoader.GetOrCreateResource(ref s_classLayout, "MetadataTests.Invalid.ClassLayout.dll");
private static byte[] s_customAttributeTableUnsorted;
public static byte[] CustomAttributeTableUnsorted => ResourceLoader.GetOrCreateResource(ref s_customAttributeTableUnsorted, "MetadataTests.Invalid.CustomAttributeTableUnsorted.dll");
private static byte[] s_emptyModuleTable;
public static byte[] EmptyModuleTable => ResourceLoader.GetOrCreateResource(ref s_emptyModuleTable, "MetadataTests.Invalid.EmptyModuleTable.netmodule");
private static byte[] s_incorrectCustomAssemblyTableSize_TooManyMethodSpecs;
public static byte[] IncorrectCustomAssemblyTableSize_TooManyMethodSpecs => ResourceLoader.GetOrCreateResource(ref s_incorrectCustomAssemblyTableSize_TooManyMethodSpecs, "MetadataTests.Invalid.IncorrectCustomAssemblyTableSize_TooManyMethodSpecs.dll");
private static byte[] s_invalidDynamicAttributeArgs;
public static byte[] InvalidDynamicAttributeArgs => ResourceLoader.GetOrCreateResource(ref s_invalidDynamicAttributeArgs, "MetadataTests.Invalid.InvalidDynamicAttributeArgs.dll");
private static byte[] s_invalidFuncDelegateName;
public static byte[] InvalidFuncDelegateName => ResourceLoader.GetOrCreateResource(ref s_invalidFuncDelegateName, "MetadataTests.Invalid.InvalidFuncDelegateName.dll");
private static byte[] s_invalidGenericType;
public static byte[] InvalidGenericType => ResourceLoader.GetOrCreateResource(ref s_invalidGenericType, "MetadataTests.Invalid.InvalidGenericType.dll");
private static byte[] s_invalidModuleName;
public static byte[] InvalidModuleName => ResourceLoader.GetOrCreateResource(ref s_invalidModuleName, "MetadataTests.Invalid.InvalidModuleName.dll");
private static byte[] s_longTypeFormInSignature;
public static byte[] LongTypeFormInSignature => ResourceLoader.GetOrCreateResource(ref s_longTypeFormInSignature, "MetadataTests.Invalid.LongTypeFormInSignature.dll");
private static string s_manyMethodSpecs;
public static string ManyMethodSpecs => ResourceLoader.GetOrCreateResource(ref s_manyMethodSpecs, "MetadataTests.Invalid.ManyMethodSpecs.vb");
private static byte[] s_obfuscated;
public static byte[] Obfuscated => ResourceLoader.GetOrCreateResource(ref s_obfuscated, "MetadataTests.Invalid.Obfuscated.dll");
private static byte[] s_obfuscated2;
public static byte[] Obfuscated2 => ResourceLoader.GetOrCreateResource(ref s_obfuscated2, "MetadataTests.Invalid.Obfuscated2.dll");
public static class Signatures
{
private static byte[] s_signatureCycle2;
public static byte[] SignatureCycle2 => ResourceLoader.GetOrCreateResource(ref s_signatureCycle2, "MetadataTests.Invalid.Signatures.SignatureCycle2.exe");
private static byte[] s_typeSpecInWrongPlace;
public static byte[] TypeSpecInWrongPlace => ResourceLoader.GetOrCreateResource(ref s_typeSpecInWrongPlace, "MetadataTests.Invalid.Signatures.TypeSpecInWrongPlace.exe");
}
}
public static class NetModule01
{
private static byte[] s_appCS;
public static byte[] AppCS => ResourceLoader.GetOrCreateResource(ref s_appCS, "MetadataTests.NetModule01.AppCS.exe");
private static byte[] s_moduleCS00;
public static byte[] ModuleCS00 => ResourceLoader.GetOrCreateResource(ref s_moduleCS00, "MetadataTests.NetModule01.ModuleCS00.mod");
private static byte[] s_moduleCS01;
public static byte[] ModuleCS01 => ResourceLoader.GetOrCreateResource(ref s_moduleCS01, "MetadataTests.NetModule01.ModuleCS01.mod");
private static byte[] s_moduleVB01;
public static byte[] ModuleVB01 => ResourceLoader.GetOrCreateResource(ref s_moduleVB01, "MetadataTests.NetModule01.ModuleVB01.mod");
}
}
namespace TestResources.NetFX
{
public static class aacorlib_v15_0_3928
{
private static string s_aacorlib_v15_0_3928_cs;
public static string aacorlib_v15_0_3928_cs => ResourceLoader.GetOrCreateResource(ref s_aacorlib_v15_0_3928_cs, "NetFX.aacorlib.aacorlib.v15.0.3928.cs");
}
public static class Minimal
{
private static byte[] s_mincorlib;
public static byte[] mincorlib => ResourceLoader.GetOrCreateResource(ref s_mincorlib, "NetFX.Minimal.mincorlib.dll");
private static byte[] s_minasync;
public static byte[] minasync => ResourceLoader.GetOrCreateResource(ref s_minasync, "NetFX.Minimal.minasync.dll");
private static byte[] s_minasynccorlib;
public static byte[] minasynccorlib => ResourceLoader.GetOrCreateResource(ref s_minasynccorlib, "NetFX.Minimal.minasynccorlib.dll");
}
public static class ValueTuple
{
private static byte[] s_tuplelib;
public static byte[] tuplelib => ResourceLoader.GetOrCreateResource(ref s_tuplelib, "NetFX.ValueTuple.System.ValueTuple.dll");
private static string s_tuplelib_cs;
public static string tuplelib_cs => ResourceLoader.GetOrCreateResource(ref s_tuplelib_cs, "NetFX.ValueTuple.ValueTuple.cs");
private static string s_tupleAttributes_cs;
public static string tupleattributes_cs => ResourceLoader.GetOrCreateResource(ref s_tupleAttributes_cs, "NetFX.ValueTuple.TupleElementNamesAttribute.cs");
}
}
namespace TestResources
{
public static class PerfTests
{
private static string s_CSPerfTest;
public static string CSPerfTest => ResourceLoader.GetOrCreateResource(ref s_CSPerfTest, "PerfTests.CSPerfTest.cs");
private static string s_VBPerfTest;
public static string VBPerfTest => ResourceLoader.GetOrCreateResource(ref s_VBPerfTest, "PerfTests.VBPerfTest.vb");
}
public static class General
{
private static byte[] s_bigVisitor;
public static byte[] BigVisitor => ResourceLoader.GetOrCreateResource(ref s_bigVisitor, "SymbolsTests.BigVisitor.dll");
private static byte[] s_delegateByRefParamArray;
public static byte[] DelegateByRefParamArray => ResourceLoader.GetOrCreateResource(ref s_delegateByRefParamArray, "SymbolsTests.Delegates.DelegateByRefParamArray.dll");
private static byte[] s_delegatesWithoutInvoke;
public static byte[] DelegatesWithoutInvoke => ResourceLoader.GetOrCreateResource(ref s_delegatesWithoutInvoke, "SymbolsTests.Delegates.DelegatesWithoutInvoke.dll");
private static byte[] s_shiftJisSource;
public static byte[] ShiftJisSource => ResourceLoader.GetOrCreateResource(ref s_shiftJisSource, "Encoding.sjis.cs");
private static byte[] s_events;
public static byte[] Events => ResourceLoader.GetOrCreateResource(ref s_events, "SymbolsTests.Events.dll");
private static byte[] s_CSharpExplicitInterfaceImplementation;
public static byte[] CSharpExplicitInterfaceImplementation => ResourceLoader.GetOrCreateResource(ref s_CSharpExplicitInterfaceImplementation, "SymbolsTests.ExplicitInterfaceImplementation.CSharpExplicitInterfaceImplementation.dll");
private static byte[] s_CSharpExplicitInterfaceImplementationEvents;
public static byte[] CSharpExplicitInterfaceImplementationEvents => ResourceLoader.GetOrCreateResource(ref s_CSharpExplicitInterfaceImplementationEvents, "SymbolsTests.ExplicitInterfaceImplementation.CSharpExplicitInterfaceImplementationEvents.dll");
private static byte[] s_CSharpExplicitInterfaceImplementationProperties;
public static byte[] CSharpExplicitInterfaceImplementationProperties => ResourceLoader.GetOrCreateResource(ref s_CSharpExplicitInterfaceImplementationProperties, "SymbolsTests.ExplicitInterfaceImplementation.CSharpExplicitInterfaceImplementationProperties.dll");
private static byte[] s_ILExplicitInterfaceImplementation;
public static byte[] ILExplicitInterfaceImplementation => ResourceLoader.GetOrCreateResource(ref s_ILExplicitInterfaceImplementation, "SymbolsTests.ExplicitInterfaceImplementation.ILExplicitInterfaceImplementation.dll");
private static byte[] s_ILExplicitInterfaceImplementationProperties;
public static byte[] ILExplicitInterfaceImplementationProperties => ResourceLoader.GetOrCreateResource(ref s_ILExplicitInterfaceImplementationProperties, "SymbolsTests.ExplicitInterfaceImplementation.ILExplicitInterfaceImplementationProperties.dll");
private static byte[] s_FSharpTestLibrary;
public static byte[] FSharpTestLibrary => ResourceLoader.GetOrCreateResource(ref s_FSharpTestLibrary, "SymbolsTests.FSharpTestLibrary.dll");
private static byte[] s_indexers;
public static byte[] Indexers => ResourceLoader.GetOrCreateResource(ref s_indexers, "SymbolsTests.Indexers.dll");
private static byte[] s_inheritIComparable;
public static byte[] InheritIComparable => ResourceLoader.GetOrCreateResource(ref s_inheritIComparable, "SymbolsTests.InheritIComparable.dll");
private static byte[] s_MDTestLib1;
public static byte[] MDTestLib1 => ResourceLoader.GetOrCreateResource(ref s_MDTestLib1, "SymbolsTests.MDTestLib1.dll");
private static byte[] s_MDTestLib2;
public static byte[] MDTestLib2 => ResourceLoader.GetOrCreateResource(ref s_MDTestLib2, "SymbolsTests.MDTestLib2.dll");
private static byte[] s_nativeCOFFResources;
public static byte[] nativeCOFFResources => ResourceLoader.GetOrCreateResource(ref s_nativeCOFFResources, "SymbolsTests.nativeCOFFResources.obj");
private static byte[] s_properties;
public static byte[] Properties => ResourceLoader.GetOrCreateResource(ref s_properties, "SymbolsTests.Properties.dll");
private static byte[] s_propertiesWithByRef;
public static byte[] PropertiesWithByRef => ResourceLoader.GetOrCreateResource(ref s_propertiesWithByRef, "SymbolsTests.PropertiesWithByRef.dll");
private static byte[] s_regress40025DLL;
public static byte[] Regress40025DLL => ResourceLoader.GetOrCreateResource(ref s_regress40025DLL, "SymbolsTests.Regress40025DLL.dll");
private static byte[] s_snKey;
public static byte[] snKey => ResourceLoader.GetOrCreateResource(ref s_snKey, "SymbolsTests.snKey.snk");
private static byte[] s_snKey2;
public static byte[] snKey2 => ResourceLoader.GetOrCreateResource(ref s_snKey2, "SymbolsTests.snKey2.snk");
private static byte[] s_snPublicKey;
public static byte[] snPublicKey => ResourceLoader.GetOrCreateResource(ref s_snPublicKey, "SymbolsTests.snPublicKey.snk");
private static byte[] s_snPublicKey2;
public static byte[] snPublicKey2 => ResourceLoader.GetOrCreateResource(ref s_snPublicKey2, "SymbolsTests.snPublicKey2.snk");
private static byte[] s_snMaxSizeKey;
public static byte[] snMaxSizeKey => ResourceLoader.GetOrCreateResource(ref s_snMaxSizeKey, "SymbolsTests.snMaxSizeKey.snk");
private static byte[] s_snMaxSizePublicKey;
public static byte[] snMaxSizePublicKey => ResourceLoader.GetOrCreateResource(ref s_snMaxSizePublicKey, "SymbolsTests.snMaxSizePublicKey.snk");
public static string snMaxSizePublicKeyString => "002400000480000014080000060200000024000052534131004000000100010079bb5332224912" +
"5411d2b44dd63b137e1b452899a7e7f626917328ff9e25c728e3e3b503ba34deab31d1f1ae1558" +
"8c4bda69eccea5b13e4a4e10b39fc2fd9f05d1ba728beb8365bad6b6da9adc653836d3ff12b9a6" +
"98900c3f593cf088b2504ec949489b6f837e76fe84ddd30ccedce1d836e5b8fb149b8e9e0b8b8f" +
"bc2cdaee0e76eb549270c4df104accb72530113f431d88982ae69ed75e09530d6951722b60342e" +
"b1f5dd5babacdb365dd71597680c50fe85bce823ee902ab3377e7eef8f96168f8c8a1e8264ba94" +
"481f5208e4c21208ea312bc1a34bd0e615b39ce8948c4a4d2c0a48b0bc901dfc0519afc378f859" +
"5a77375e6c265e1c38bdc7dbf7c4d07d36b67ac94464fe5c26aed915f1c035756d0f3363fce751" +
"0f12459060f417ab5df610ffca60e6dd739dc750189f23a47716c75a7a8e3363b198f05093d2a0" +
"c9debafbfca3d682c5ea3ed578118d9dc7d0f8828cad1c03ede009d774585b9665e0c8d7325805" +
"faba80796f668f79c92b9a195bc7530bb8ecaaba07a7cfdb70c46b96ca613102b1a674bfc742fa" +
"9562704edb78063db818c0675c9bd8c18d203fc4d5bc2685003bc6c136caf07a202578cb85480d" +
"50f6187b88fb733a2f4ce200bbda68c4ef47483a3530ae8403cb38253a06e2e9385b6d3ae9a718" +
"2ba7a23f03499cec1c92ae06dde6b304c025d23466ebbbac9e06b5d7eb932fc009bc1803d03571" +
"0ec7bce4a6176b407ffdc9a5b55a3ff444609172a146bf76ae40759634e8224ba2882371808f44" +
"59a37f8e69115424947818f19ff6609a715f550e33de0307195fe1e526c57efc7212d6cb561dd8" +
"33cb8c28ae9dc32a4bc0f775887001a5ec36cf63e5b2aa9989d3fa29ebf57e4fa89a206a32e75b" +
"cac3c2f26c3267ec1b7433d4a3b90bc01563ddbffffe586ccfb8ee59af34e3127ebf99036427e0" +
"9c107d47c1e885a032065dce6dd646305bf84fb9123392c89794318e2fdffd5eaa62d1e52d29b9" +
"4e484f2fb73fea0487bbdaa1790e79fc0e09372c6187c742c8a3f160d09818f51dc58f71ff1a1e" +
"d955d9b373bfe92e09eac22241c2b96ce0213aa266f21aae95489921269bffdf5c0a0794716daf" +
"8b5daa3a496004297b3a25c6472027f4b6f9fd82d4e297546faa6ac31579a30b3da1d6c6f04125" +
"667868b536b9d9ebd767e4d1cabbaeb977ec0738dab3b599fe63ea0ec622261d90c3c0c1ebc1ab" +
"631b2162284a9659e961c541aab1658853a9a6501e73f11c9c27b8e9bf41f03187dab5909d8433" +
"499f9dfaec2a2c907e39bf1683c75c882e469e79aba05d597a24db33479fac758f5bdc4cbd79df" +
"03ec1e403f231bfb81ff9db7ee4cfe084f5c187729cc9f072d7a710651ea15f0e43f330e321723" +
"21554d7bf9fd784d18a80a13509818286616d4a7251e2c57f1c257aa0c57bd75da0b0e01532ad5" +
"17de450733f8379a9db8c9f12ac77b65215d44b40eebb513ec9ddc9537f7811eb5283386422d90" +
"6d26077608a1f506e966426d40cc5e61e2d7e888586c85050ec29eff79116c42c9714ad6672441" +
"03a9e79af9b330825ff186b19a791b60eca8776539ca2759f9dbbd87d07f3dac38b814ae9707e4" +
"73ee52e10b3e8d8344bc06287a9c6c58ab36658b4a6ab48ae2e6d08d748b35868c5207aab08311" +
"91f451595d0104968050ae1c13e0d619fa766cd90821732b9fbcc429815606704633515cbe5ad5" +
"e33a28690534748e15413c65d9a370b12946a36796aa4d8e5b471675a3471439e133476981e21e" +
"9a4dfeae52f657a5fe3ab6cd6ad8aabc09bd5d9af77226c6cfbe01fb38546b5c0b8b825e03bda1" +
"3d85403765bd5a6cbed19fd09674fd691d732328948f5ab07e03d7f919eee0ac23f6de7d49ae44" +
"f15f8459683ab792270945ee2807158a5e6898cb912cbe3b0b6820565045a41699d0a5e3b89319" +
"fb921008e18bb1c28557600c33cf2c299a79213834cb9ec72ba6402699c381060cfebaa3faf52d" +
"9b2f1b68c3cc0db79ff47b293853b80ec4198c7fe099077f876f2d6c26305cab1c9de8bb8daae4" +
"22e1ef7c5c76949c8d27fde90281781eef364cc001d0916108d6c0ace740521ec549d912fbaf71" +
"68bd37f790b46282684030dcdc2d52cb41d4b763adfc701a1d392166d4b3269ab30fb83a4fd183" +
"4771e0ea24680c09f55413750b082787e4bb301e107c34cfab1cc88b7d68489602cb8e46bd73c9" +
"6c8de8af5285f919e93cc6251df057443460a15d432e130510f8adbaa8d28c574db7d9ef6fb947" +
"b70e274d93cfaa47d00f3318643a08815c10975722324037504d7f0e3902393d5327bc0467ea5b" +
"d555ba0671ca3873486038abeccc6d48a11c6e3ffb2acca285a53641a02233bb7e7c76ab38acf6" +
"759b985e22b18da77932c0c04217798d1473ebf41061d8c006c9479b34745fbea8a1761000d16f" +
"414a544a7dc4a5a346871981d1ed3fe4dfcb8494e95643b8bae2e13bbfcb5a432c2dfd481e1d61" +
"bab2bcc0d7140fe9b472d25112b2e241c3026a7468560ce3ed582d6872b041680bff3998d51afc" +
"a45094e3e1982510fe8573ac2d3ab596d9d0c6b43a5f72c6046f24c2ac457fd440d6f8d4dd0b71" +
"399d0c1aa366e7a86c57ba5235d327da1245b5ecdf0b3e0e81a0418a5743f3fe98ef6c9236dce0" +
"2463c798af2b239f6ddf2e5a5ffa198151c2ffbf932b7357e80e858c9ddb81fe8223897af61cae" +
"c44ae4f07e686b1d721fa78b39c7934179786592472f8739fb90fd5ae41e118fafbb30bd7b02c3" +
"cf3def669d830f4dcdf863919c1ee6c3b68a4d66a74af3088592a4055b54738804034d134c5a92" +
"e47395955d222b04472da50de86f931084653e4b0f91ffccef2c777c80d92683f8f87b6b60733d" +
"73b0035501dd2adba2bbdf6697";
private static byte[] s_CSharpErrors;
public static byte[] CSharpErrors => ResourceLoader.GetOrCreateResource(ref s_CSharpErrors, "SymbolsTests.UseSiteErrors.CSharpErrors.dll");
private static byte[] s_ILErrors;
public static byte[] ILErrors => ResourceLoader.GetOrCreateResource(ref s_ILErrors, "SymbolsTests.UseSiteErrors.ILErrors.dll");
private static byte[] s_unavailable;
public static byte[] Unavailable => ResourceLoader.GetOrCreateResource(ref s_unavailable, "SymbolsTests.UseSiteErrors.Unavailable.dll");
private static byte[] s_VBConversions;
public static byte[] VBConversions => ResourceLoader.GetOrCreateResource(ref s_VBConversions, "SymbolsTests.VBConversions.dll");
private static byte[] s_culture_AR_SA;
public static byte[] Culture_AR_SA => ResourceLoader.GetOrCreateResource(ref s_culture_AR_SA, "SymbolsTests.Versioning.AR_SA.Culture.dll");
private static byte[] s_culture_EN_US;
public static byte[] Culture_EN_US => ResourceLoader.GetOrCreateResource(ref s_culture_EN_US, "SymbolsTests.Versioning.EN_US.Culture.dll");
private static byte[] s_C1;
public static byte[] C1 => ResourceLoader.GetOrCreateResource(ref s_C1, "SymbolsTests.Versioning.V1.C.dll");
private static byte[] s_C2;
public static byte[] C2 => ResourceLoader.GetOrCreateResource(ref s_C2, "SymbolsTests.Versioning.V2.C.dll");
private static byte[] s_with_Spaces;
public static byte[] With_Spaces => ResourceLoader.GetOrCreateResource(ref s_with_Spaces, "SymbolsTests.With Spaces.dll");
private static byte[] s_with_SpacesModule;
public static byte[] With_SpacesModule => ResourceLoader.GetOrCreateResource(ref s_with_SpacesModule, "SymbolsTests.With Spaces.netmodule");
}
}
namespace TestResources.SymbolsTests
{
public static class CorLibrary
{
private static byte[] s_fakeMsCorLib;
public static byte[] FakeMsCorLib => ResourceLoader.GetOrCreateResource(ref s_fakeMsCorLib, "SymbolsTests.CorLibrary.FakeMsCorLib.dll");
private static byte[] s_guidTest2;
public static byte[] GuidTest2 => ResourceLoader.GetOrCreateResource(ref s_guidTest2, "SymbolsTests.CorLibrary.GuidTest2.exe");
private static byte[] s_noMsCorLibRef;
public static byte[] NoMsCorLibRef => ResourceLoader.GetOrCreateResource(ref s_noMsCorLibRef, "SymbolsTests.CorLibrary.NoMsCorLibRef.dll");
}
public static class CustomModifiers
{
private static byte[] s_cppCli;
public static byte[] CppCli => ResourceLoader.GetOrCreateResource(ref s_cppCli, "SymbolsTests.CustomModifiers.CppCli.dll");
private static byte[] s_modifiers;
public static byte[] Modifiers => ResourceLoader.GetOrCreateResource(ref s_modifiers, "SymbolsTests.CustomModifiers.Modifiers.dll");
private static byte[] s_modifiersModule;
public static byte[] ModifiersModule => ResourceLoader.GetOrCreateResource(ref s_modifiersModule, "SymbolsTests.CustomModifiers.Modifiers.netmodule");
private static byte[] s_modoptTests;
public static byte[] ModoptTests => ResourceLoader.GetOrCreateResource(ref s_modoptTests, "SymbolsTests.CustomModifiers.ModoptTests.dll");
private static byte[] s_genericMethodWithModifiers;
public static byte[] GenericMethodWithModifiers => ResourceLoader.GetOrCreateResource(ref s_genericMethodWithModifiers, "SymbolsTests.CustomModifiers.GenericMethodWithModifiers.dll");
}
public static class Cyclic
{
private static byte[] s_cyclic1;
public static byte[] Cyclic1 => ResourceLoader.GetOrCreateResource(ref s_cyclic1, "SymbolsTests.Cyclic.Cyclic1.dll");
private static byte[] s_cyclic2;
public static byte[] Cyclic2 => ResourceLoader.GetOrCreateResource(ref s_cyclic2, "SymbolsTests.Cyclic.Cyclic2.dll");
}
public static class CyclicInheritance
{
private static byte[] s_class1;
public static byte[] Class1 => ResourceLoader.GetOrCreateResource(ref s_class1, "SymbolsTests.CyclicInheritance.Class1.dll");
private static byte[] s_class2;
public static byte[] Class2 => ResourceLoader.GetOrCreateResource(ref s_class2, "SymbolsTests.CyclicInheritance.Class2.dll");
private static byte[] s_class3;
public static byte[] Class3 => ResourceLoader.GetOrCreateResource(ref s_class3, "SymbolsTests.CyclicInheritance.Class3.dll");
}
public static class CyclicStructure
{
private static byte[] s_cycledstructs;
public static byte[] cycledstructs => ResourceLoader.GetOrCreateResource(ref s_cycledstructs, "SymbolsTests.CyclicStructure.cycledstructs.dll");
}
public static class DifferByCase
{
private static byte[] s_consumer;
public static byte[] Consumer => ResourceLoader.GetOrCreateResource(ref s_consumer, "SymbolsTests.DifferByCase.Consumer.dll");
private static byte[] s_csharpCaseSen;
public static byte[] CsharpCaseSen => ResourceLoader.GetOrCreateResource(ref s_csharpCaseSen, "SymbolsTests.DifferByCase.CsharpCaseSen.dll");
private static byte[] s_CSharpDifferCaseOverloads;
public static byte[] CSharpDifferCaseOverloads => ResourceLoader.GetOrCreateResource(ref s_CSharpDifferCaseOverloads, "SymbolsTests.DifferByCase.CSharpDifferCaseOverloads.dll");
private static byte[] s_typeAndNamespaceDifferByCase;
public static byte[] TypeAndNamespaceDifferByCase => ResourceLoader.GetOrCreateResource(ref s_typeAndNamespaceDifferByCase, "SymbolsTests.DifferByCase.TypeAndNamespaceDifferByCase.dll");
}
public static class Fields
{
private static byte[] s_constantFields;
public static byte[] ConstantFields => ResourceLoader.GetOrCreateResource(ref s_constantFields, "SymbolsTests.Fields.ConstantFields.dll");
private static byte[] s_CSFields;
public static byte[] CSFields => ResourceLoader.GetOrCreateResource(ref s_CSFields, "SymbolsTests.Fields.CSFields.dll");
private static byte[] s_VBFields;
public static byte[] VBFields => ResourceLoader.GetOrCreateResource(ref s_VBFields, "SymbolsTests.Fields.VBFields.dll");
}
public static class Interface
{
private static byte[] s_MDInterfaceMapping;
public static byte[] MDInterfaceMapping => ResourceLoader.GetOrCreateResource(ref s_MDInterfaceMapping, "SymbolsTests.Interface.MDInterfaceMapping.dll");
private static byte[] s_staticMethodInInterface;
public static byte[] StaticMethodInInterface => ResourceLoader.GetOrCreateResource(ref s_staticMethodInInterface, "SymbolsTests.Interface.StaticMethodInInterface.dll");
}
public static class Metadata
{
private static byte[] s_attributeInterop01;
public static byte[] AttributeInterop01 => ResourceLoader.GetOrCreateResource(ref s_attributeInterop01, "SymbolsTests.Metadata.AttributeInterop01.dll");
private static byte[] s_attributeInterop02;
public static byte[] AttributeInterop02 => ResourceLoader.GetOrCreateResource(ref s_attributeInterop02, "SymbolsTests.Metadata.AttributeInterop02.dll");
private static byte[] s_attributeTestDef01;
public static byte[] AttributeTestDef01 => ResourceLoader.GetOrCreateResource(ref s_attributeTestDef01, "SymbolsTests.Metadata.AttributeTestDef01.dll");
private static byte[] s_attributeTestLib01;
public static byte[] AttributeTestLib01 => ResourceLoader.GetOrCreateResource(ref s_attributeTestLib01, "SymbolsTests.Metadata.AttributeTestLib01.dll");
private static byte[] s_dynamicAttribute;
public static byte[] DynamicAttribute => ResourceLoader.GetOrCreateResource(ref s_dynamicAttribute, "SymbolsTests.Metadata.DynamicAttribute.dll");
private static byte[] s_invalidCharactersInAssemblyName;
public static byte[] InvalidCharactersInAssemblyName => ResourceLoader.GetOrCreateResource(ref s_invalidCharactersInAssemblyName, "SymbolsTests.Metadata.InvalidCharactersInAssemblyName.dll");
private static byte[] s_invalidPublicKey;
public static byte[] InvalidPublicKey => ResourceLoader.GetOrCreateResource(ref s_invalidPublicKey, "SymbolsTests.Metadata.InvalidPublicKey.dll");
private static byte[] s_MDTestAttributeApplicationLib;
public static byte[] MDTestAttributeApplicationLib => ResourceLoader.GetOrCreateResource(ref s_MDTestAttributeApplicationLib, "SymbolsTests.Metadata.MDTestAttributeApplicationLib.dll");
private static byte[] s_MDTestAttributeDefLib;
public static byte[] MDTestAttributeDefLib => ResourceLoader.GetOrCreateResource(ref s_MDTestAttributeDefLib, "SymbolsTests.Metadata.MDTestAttributeDefLib.dll");
private static byte[] s_mscorlibNamespacesAndTypes;
public static byte[] MscorlibNamespacesAndTypes => ResourceLoader.GetOrCreateResource(ref s_mscorlibNamespacesAndTypes, "SymbolsTests.Metadata.MscorlibNamespacesAndTypes.bsl");
private static byte[] s_publicAndPrivateFlags;
public static byte[] PublicAndPrivateFlags => ResourceLoader.GetOrCreateResource(ref s_publicAndPrivateFlags, "SymbolsTests.Metadata.public-and-private.dll");
}
public static class Methods
{
private static byte[] s_byRefReturn;
public static byte[] ByRefReturn => ResourceLoader.GetOrCreateResource(ref s_byRefReturn, "SymbolsTests.Methods.ByRefReturn.dll");
private static byte[] s_CSMethods;
public static byte[] CSMethods => ResourceLoader.GetOrCreateResource(ref s_CSMethods, "SymbolsTests.Methods.CSMethods.dll");
private static byte[] s_ILMethods;
public static byte[] ILMethods => ResourceLoader.GetOrCreateResource(ref s_ILMethods, "SymbolsTests.Methods.ILMethods.dll");
private static byte[] s_VBMethods;
public static byte[] VBMethods => ResourceLoader.GetOrCreateResource(ref s_VBMethods, "SymbolsTests.Methods.VBMethods.dll");
}
public static class MissingTypes
{
private static byte[] s_CL2;
public static byte[] CL2 => ResourceLoader.GetOrCreateResource(ref s_CL2, "SymbolsTests.MissingTypes.CL2.dll");
private static byte[] s_CL3;
public static byte[] CL3 => ResourceLoader.GetOrCreateResource(ref s_CL3, "SymbolsTests.MissingTypes.CL3.dll");
private static string s_CL3_VB;
public static string CL3_VB => ResourceLoader.GetOrCreateResource(ref s_CL3_VB, "SymbolsTests.MissingTypes.CL3.vb");
private static byte[] s_MDMissingType;
public static byte[] MDMissingType => ResourceLoader.GetOrCreateResource(ref s_MDMissingType, "SymbolsTests.MissingTypes.MDMissingType.dll");
private static byte[] s_MDMissingTypeLib;
public static byte[] MDMissingTypeLib => ResourceLoader.GetOrCreateResource(ref s_MDMissingTypeLib, "SymbolsTests.MissingTypes.MDMissingTypeLib.dll");
private static byte[] s_MDMissingTypeLib_New;
public static byte[] MDMissingTypeLib_New => ResourceLoader.GetOrCreateResource(ref s_MDMissingTypeLib_New, "SymbolsTests.MissingTypes.MDMissingTypeLib_New.dll");
private static byte[] s_missingTypesEquality1;
public static byte[] MissingTypesEquality1 => ResourceLoader.GetOrCreateResource(ref s_missingTypesEquality1, "SymbolsTests.MissingTypes.MissingTypesEquality1.dll");
private static byte[] s_missingTypesEquality2;
public static byte[] MissingTypesEquality2 => ResourceLoader.GetOrCreateResource(ref s_missingTypesEquality2, "SymbolsTests.MissingTypes.MissingTypesEquality2.dll");
}
public static class MultiModule
{
private static byte[] s_consumer;
public static byte[] Consumer => ResourceLoader.GetOrCreateResource(ref s_consumer, "SymbolsTests.MultiModule.Consumer.dll");
private static byte[] s_mod2;
public static byte[] mod2 => ResourceLoader.GetOrCreateResource(ref s_mod2, "SymbolsTests.MultiModule.mod2.netmodule");
private static byte[] s_mod3;
public static byte[] mod3 => ResourceLoader.GetOrCreateResource(ref s_mod3, "SymbolsTests.MultiModule.mod3.netmodule");
private static byte[] s_multiModuleDll;
public static byte[] MultiModuleDll => ResourceLoader.GetOrCreateResource(ref s_multiModuleDll, "SymbolsTests.MultiModule.MultiModule.dll");
}
public static class MultiTargeting
{
private static byte[] s_source1Module;
public static byte[] Source1Module => ResourceLoader.GetOrCreateResource(ref s_source1Module, "SymbolsTests.MultiTargeting.Source1Module.netmodule");
private static byte[] s_source3Module;
public static byte[] Source3Module => ResourceLoader.GetOrCreateResource(ref s_source3Module, "SymbolsTests.MultiTargeting.Source3Module.netmodule");
private static byte[] s_source4Module;
public static byte[] Source4Module => ResourceLoader.GetOrCreateResource(ref s_source4Module, "SymbolsTests.MultiTargeting.Source4Module.netmodule");
private static byte[] s_source5Module;
public static byte[] Source5Module => ResourceLoader.GetOrCreateResource(ref s_source5Module, "SymbolsTests.MultiTargeting.Source5Module.netmodule");
private static byte[] s_source7Module;
public static byte[] Source7Module => ResourceLoader.GetOrCreateResource(ref s_source7Module, "SymbolsTests.MultiTargeting.Source7Module.netmodule");
}
public static class netModule
{
private static byte[] s_crossRefLib;
public static byte[] CrossRefLib => ResourceLoader.GetOrCreateResource(ref s_crossRefLib, "SymbolsTests.netModule.CrossRefLib.dll");
private static byte[] s_crossRefModule1;
public static byte[] CrossRefModule1 => ResourceLoader.GetOrCreateResource(ref s_crossRefModule1, "SymbolsTests.netModule.CrossRefModule1.netmodule");
private static byte[] s_crossRefModule2;
public static byte[] CrossRefModule2 => ResourceLoader.GetOrCreateResource(ref s_crossRefModule2, "SymbolsTests.netModule.CrossRefModule2.netmodule");
private static byte[] s_hash_module;
public static byte[] hash_module => ResourceLoader.GetOrCreateResource(ref s_hash_module, "SymbolsTests.netModule.hash_module.netmodule");
private static byte[] s_netModule1;
public static byte[] netModule1 => ResourceLoader.GetOrCreateResource(ref s_netModule1, "SymbolsTests.netModule.netModule1.netmodule");
private static byte[] s_netModule2;
public static byte[] netModule2 => ResourceLoader.GetOrCreateResource(ref s_netModule2, "SymbolsTests.netModule.netModule2.netmodule");
private static byte[] s_x64COFF;
public static byte[] x64COFF => ResourceLoader.GetOrCreateResource(ref s_x64COFF, "SymbolsTests.netModule.x64COFF.obj");
}
public static class NoPia
{
private static byte[] s_A;
public static byte[] A => ResourceLoader.GetOrCreateResource(ref s_A, "SymbolsTests.NoPia.A.dll");
private static byte[] s_B;
public static byte[] B => ResourceLoader.GetOrCreateResource(ref s_B, "SymbolsTests.NoPia.B.dll");
private static byte[] s_C;
public static byte[] C => ResourceLoader.GetOrCreateResource(ref s_C, "SymbolsTests.NoPia.C.dll");
private static byte[] s_D;
public static byte[] D => ResourceLoader.GetOrCreateResource(ref s_D, "SymbolsTests.NoPia.D.dll");
private static byte[] s_externalAsm1;
public static byte[] ExternalAsm1 => ResourceLoader.GetOrCreateResource(ref s_externalAsm1, "SymbolsTests.NoPia.ExternalAsm1.dll");
private static byte[] s_generalPia;
public static byte[] GeneralPia => ResourceLoader.GetOrCreateResource(ref s_generalPia, "SymbolsTests.NoPia.GeneralPia.dll");
private static byte[] s_generalPiaCopy;
public static byte[] GeneralPiaCopy => ResourceLoader.GetOrCreateResource(ref s_generalPiaCopy, "SymbolsTests.NoPia.GeneralPiaCopy.dll");
private static byte[] s_library1;
public static byte[] Library1 => ResourceLoader.GetOrCreateResource(ref s_library1, "SymbolsTests.NoPia.Library1.dll");
private static byte[] s_library2;
public static byte[] Library2 => ResourceLoader.GetOrCreateResource(ref s_library2, "SymbolsTests.NoPia.Library2.dll");
private static byte[] s_localTypes1;
public static byte[] LocalTypes1 => ResourceLoader.GetOrCreateResource(ref s_localTypes1, "SymbolsTests.NoPia.LocalTypes1.dll");
private static byte[] s_localTypes2;
public static byte[] LocalTypes2 => ResourceLoader.GetOrCreateResource(ref s_localTypes2, "SymbolsTests.NoPia.LocalTypes2.dll");
private static byte[] s_localTypes3;
public static byte[] LocalTypes3 => ResourceLoader.GetOrCreateResource(ref s_localTypes3, "SymbolsTests.NoPia.LocalTypes3.dll");
private static byte[] s_missingPIAAttributes;
public static byte[] MissingPIAAttributes => ResourceLoader.GetOrCreateResource(ref s_missingPIAAttributes, "SymbolsTests.NoPia.MissingPIAAttributes.dll");
private static byte[] s_noPIAGenerics1_Asm1;
public static byte[] NoPIAGenerics1_Asm1 => ResourceLoader.GetOrCreateResource(ref s_noPIAGenerics1_Asm1, "SymbolsTests.NoPia.NoPIAGenerics1-Asm1.dll");
private static byte[] s_pia1;
public static byte[] Pia1 => ResourceLoader.GetOrCreateResource(ref s_pia1, "SymbolsTests.NoPia.Pia1.dll");
private static byte[] s_pia1Copy;
public static byte[] Pia1Copy => ResourceLoader.GetOrCreateResource(ref s_pia1Copy, "SymbolsTests.NoPia.Pia1Copy.dll");
private static byte[] s_pia2;
public static byte[] Pia2 => ResourceLoader.GetOrCreateResource(ref s_pia2, "SymbolsTests.NoPia.Pia2.dll");
private static byte[] s_pia3;
public static byte[] Pia3 => ResourceLoader.GetOrCreateResource(ref s_pia3, "SymbolsTests.NoPia.Pia3.dll");
private static byte[] s_pia4;
public static byte[] Pia4 => ResourceLoader.GetOrCreateResource(ref s_pia4, "SymbolsTests.NoPia.Pia4.dll");
private static byte[] s_pia5;
public static byte[] Pia5 => ResourceLoader.GetOrCreateResource(ref s_pia5, "SymbolsTests.NoPia.Pia5.dll");
private static byte[] s_parametersWithoutNames;
public static byte[] ParametersWithoutNames => ResourceLoader.GetOrCreateResource(ref s_parametersWithoutNames, "SymbolsTests.NoPia.ParametersWithoutNames.dll");
}
}
namespace TestResources.SymbolsTests.RetargetingCycle
{
public static class RetV1
{
private static byte[] s_classA;
public static byte[] ClassA => ResourceLoader.GetOrCreateResource(ref s_classA, "SymbolsTests.RetargetingCycle.V1.ClassA.dll");
private static byte[] s_classB;
public static byte[] ClassB => ResourceLoader.GetOrCreateResource(ref s_classB, "SymbolsTests.RetargetingCycle.V1.ClassB.netmodule");
}
public static class RetV2
{
private static byte[] s_classA;
public static byte[] ClassA => ResourceLoader.GetOrCreateResource(ref s_classA, "SymbolsTests.RetargetingCycle.V2.ClassA.dll");
private static byte[] s_classB;
public static byte[] ClassB => ResourceLoader.GetOrCreateResource(ref s_classB, "SymbolsTests.RetargetingCycle.V2.ClassB.dll");
}
}
namespace TestResources.SymbolsTests
{
public static class TypeForwarders
{
private static byte[] s_forwarded;
public static byte[] Forwarded => ResourceLoader.GetOrCreateResource(ref s_forwarded, "SymbolsTests.TypeForwarders.Forwarded.netmodule");
private static byte[] s_typeForwarder;
public static byte[] TypeForwarder => ResourceLoader.GetOrCreateResource(ref s_typeForwarder, "SymbolsTests.TypeForwarders.TypeForwarder.dll");
private static byte[] s_typeForwarderBase;
public static byte[] TypeForwarderBase => ResourceLoader.GetOrCreateResource(ref s_typeForwarderBase, "SymbolsTests.TypeForwarders.TypeForwarderBase.dll");
private static byte[] s_typeForwarderLib;
public static byte[] TypeForwarderLib => ResourceLoader.GetOrCreateResource(ref s_typeForwarderLib, "SymbolsTests.TypeForwarders.TypeForwarderLib.dll");
}
public static class V1
{
private static byte[] s_MTTestLib1;
public static byte[] MTTestLib1 => ResourceLoader.GetOrCreateResource(ref s_MTTestLib1, "SymbolsTests.V1.MTTestLib1.Dll");
private static string s_MTTestLib1_V1;
public static string MTTestLib1_V1 => ResourceLoader.GetOrCreateResource(ref s_MTTestLib1_V1, "SymbolsTests.V1.MTTestLib1_V1.vb");
private static byte[] s_MTTestLib2;
public static byte[] MTTestLib2 => ResourceLoader.GetOrCreateResource(ref s_MTTestLib2, "SymbolsTests.V1.MTTestLib2.Dll");
private static string s_MTTestLib2_V1;
public static string MTTestLib2_V1 => ResourceLoader.GetOrCreateResource(ref s_MTTestLib2_V1, "SymbolsTests.V1.MTTestLib2_V1.vb");
private static byte[] s_MTTestModule1;
public static byte[] MTTestModule1 => ResourceLoader.GetOrCreateResource(ref s_MTTestModule1, "SymbolsTests.V1.MTTestModule1.netmodule");
private static byte[] s_MTTestModule2;
public static byte[] MTTestModule2 => ResourceLoader.GetOrCreateResource(ref s_MTTestModule2, "SymbolsTests.V1.MTTestModule2.netmodule");
}
public static class V2
{
private static byte[] s_MTTestLib1;
public static byte[] MTTestLib1 => ResourceLoader.GetOrCreateResource(ref s_MTTestLib1, "SymbolsTests.V2.MTTestLib1.Dll");
private static string s_MTTestLib1_V2;
public static string MTTestLib1_V2 => ResourceLoader.GetOrCreateResource(ref s_MTTestLib1_V2, "SymbolsTests.V2.MTTestLib1_V2.vb");
private static byte[] s_MTTestLib3;
public static byte[] MTTestLib3 => ResourceLoader.GetOrCreateResource(ref s_MTTestLib3, "SymbolsTests.V2.MTTestLib3.Dll");
private static string s_MTTestLib3_V2;
public static string MTTestLib3_V2 => ResourceLoader.GetOrCreateResource(ref s_MTTestLib3_V2, "SymbolsTests.V2.MTTestLib3_V2.vb");
private static byte[] s_MTTestModule1;
public static byte[] MTTestModule1 => ResourceLoader.GetOrCreateResource(ref s_MTTestModule1, "SymbolsTests.V2.MTTestModule1.netmodule");
private static byte[] s_MTTestModule3;
public static byte[] MTTestModule3 => ResourceLoader.GetOrCreateResource(ref s_MTTestModule3, "SymbolsTests.V2.MTTestModule3.netmodule");
}
public static class V3
{
private static byte[] s_MTTestLib1;
public static byte[] MTTestLib1 => ResourceLoader.GetOrCreateResource(ref s_MTTestLib1, "SymbolsTests.V3.MTTestLib1.Dll");
private static string s_MTTestLib1_V3;
public static string MTTestLib1_V3 => ResourceLoader.GetOrCreateResource(ref s_MTTestLib1_V3, "SymbolsTests.V3.MTTestLib1_V3.vb");
private static byte[] s_MTTestLib4;
public static byte[] MTTestLib4 => ResourceLoader.GetOrCreateResource(ref s_MTTestLib4, "SymbolsTests.V3.MTTestLib4.Dll");
private static string s_MTTestLib4_V3;
public static string MTTestLib4_V3 => ResourceLoader.GetOrCreateResource(ref s_MTTestLib4_V3, "SymbolsTests.V3.MTTestLib4_V3.vb");
private static byte[] s_MTTestModule1;
public static byte[] MTTestModule1 => ResourceLoader.GetOrCreateResource(ref s_MTTestModule1, "SymbolsTests.V3.MTTestModule1.netmodule");
private static byte[] s_MTTestModule4;
public static byte[] MTTestModule4 => ResourceLoader.GetOrCreateResource(ref s_MTTestModule4, "SymbolsTests.V3.MTTestModule4.netmodule");
}
public static class WithEvents
{
private static byte[] s_simpleWithEvents;
public static byte[] SimpleWithEvents => ResourceLoader.GetOrCreateResource(ref s_simpleWithEvents, "SymbolsTests.WithEvents.SimpleWithEvents.dll");
}
}
namespace TestResources
{
public static class WinRt
{
private static byte[] s_W1;
public static byte[] W1 => ResourceLoader.GetOrCreateResource(ref s_W1, "WinRt.W1.winmd");
private static byte[] s_W2;
public static byte[] W2 => ResourceLoader.GetOrCreateResource(ref s_W2, "WinRt.W2.winmd");
private static byte[] s_WB;
public static byte[] WB => ResourceLoader.GetOrCreateResource(ref s_WB, "WinRt.WB.winmd");
private static byte[] s_WB_Version1;
public static byte[] WB_Version1 => ResourceLoader.GetOrCreateResource(ref s_WB_Version1, "WinRt.WB_Version1.winmd");
private static byte[] s_WImpl;
public static byte[] WImpl => ResourceLoader.GetOrCreateResource(ref s_WImpl, "WinRt.WImpl.winmd");
private static byte[] s_windows_dump;
public static byte[] Windows_dump => ResourceLoader.GetOrCreateResource(ref s_windows_dump, "WinRt.Windows.ildump");
private static byte[] s_windows_Languages_WinRTTest;
public static byte[] Windows_Languages_WinRTTest => ResourceLoader.GetOrCreateResource(ref s_windows_Languages_WinRTTest, "WinRt.Windows.Languages.WinRTTest.winmd");
private static byte[] s_windows;
public static byte[] Windows => ResourceLoader.GetOrCreateResource(ref s_windows, "WinRt.Windows.winmd");
private static byte[] s_winMDPrefixing_dump;
public static byte[] WinMDPrefixing_dump => ResourceLoader.GetOrCreateResource(ref s_winMDPrefixing_dump, "WinRt.WinMDPrefixing.ildump");
private static byte[] s_winMDPrefixing;
public static byte[] WinMDPrefixing => ResourceLoader.GetOrCreateResource(ref s_winMDPrefixing, "WinRt.WinMDPrefixing.winmd");
}
}
| 1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/VisualStudio/CSharp/Test/ProjectSystemShim/CPS/CSharpReferencesTests.cs | // 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.
#nullable disable
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.CodeAnalysis.UnitTests;
using Microsoft.VisualStudio.LanguageServices.ProjectSystem;
using Microsoft.VisualStudio.LanguageServices.UnitTests.ProjectSystemShim.Framework;
using Roslyn.Test.Utilities;
using Xunit;
namespace Roslyn.VisualStudio.CSharp.UnitTests.ProjectSystemShim.CPS
{
using static CSharpHelpers;
[UseExportProvider]
public class CSharpReferenceTests
{
[WpfFact]
[Trait(Traits.Feature, Traits.Features.ProjectSystemShims)]
public async Task AddRemoveProjectAndMetadataReference_CPS()
{
using var environment = new TestEnvironment();
var project1 = await CreateCSharpCPSProjectAsync(environment, "project1", commandLineArguments: @"/out:c:\project1.dll");
var project2 = await CreateCSharpCPSProjectAsync(environment, "project2", commandLineArguments: @"/out:c:\project2.dll");
var project3 = await CreateCSharpCPSProjectAsync(environment, "project3", commandLineArguments: @"/out:c:\project3.dll");
var project4 = await CreateCSharpCPSProjectAsync(environment, "project4");
// Add project reference
project3.AddProjectReference(project1, new MetadataReferenceProperties());
// Add project reference as metadata reference: since this is known to be the output path of project1, the metadata reference is converted to a project reference
project3.AddMetadataReference(@"c:\project2.dll", new MetadataReferenceProperties());
// Add project reference with no output path
project3.AddProjectReference(project4, new MetadataReferenceProperties());
// Add metadata reference
var metadaRefFilePath = @"c:\someAssembly.dll";
project3.AddMetadataReference(metadaRefFilePath, new MetadataReferenceProperties(embedInteropTypes: true));
IEnumerable<ProjectReference> GetProject3ProjectReferences()
{
return environment.Workspace
.CurrentSolution.GetProject(project3.Id).ProjectReferences;
}
IEnumerable<PortableExecutableReference> GetProject3MetadataReferences()
{
return environment.Workspace.CurrentSolution.GetProject(project3.Id)
.MetadataReferences
.Cast<PortableExecutableReference>();
}
Assert.True(GetProject3ProjectReferences().Any(pr => pr.ProjectId == project1.Id));
Assert.True(GetProject3ProjectReferences().Any(pr => pr.ProjectId == project2.Id));
Assert.True(GetProject3ProjectReferences().Any(pr => pr.ProjectId == project4.Id));
Assert.True(GetProject3MetadataReferences().Any(mr => mr.FilePath == metadaRefFilePath));
// Change output path for project reference and verify the reference.
((IWorkspaceProjectContext)project4).BinOutputPath = @"C:\project4.dll";
Assert.Equal(@"C:\project4.dll", project4.BinOutputPath);
Assert.True(GetProject3ProjectReferences().Any(pr => pr.ProjectId == project4.Id));
// Remove project reference
project3.RemoveProjectReference(project1);
// Remove project reference as metadata reference: since this is known to be the output path of project1, the metadata reference is converted to a project reference
project3.RemoveMetadataReference(@"c:\project2.dll");
// Remove metadata reference
project3.RemoveMetadataReference(metadaRefFilePath);
Assert.False(GetProject3ProjectReferences().Any(pr => pr.ProjectId == project1.Id));
Assert.False(GetProject3ProjectReferences().Any(pr => pr.ProjectId == project2.Id));
Assert.False(GetProject3MetadataReferences().Any(mr => mr.FilePath == metadaRefFilePath));
project1.Dispose();
project2.Dispose();
project4.Dispose();
project3.Dispose();
}
[WpfFact]
[Trait(Traits.Feature, Traits.Features.ProjectSystemShims)]
public async Task RemoveProjectConvertsProjectReferencesBack()
{
using var environment = new TestEnvironment();
var project1 = await CreateCSharpCPSProjectAsync(environment, "project1", commandLineArguments: @"/out:c:\project1.dll");
var project2 = await CreateCSharpCPSProjectAsync(environment, "project2");
// Add project reference as metadata reference: since this is known to be the output path of project1, the metadata reference is converted to a project reference
project2.AddMetadataReference(@"c:\project1.dll", new MetadataReferenceProperties());
Assert.Single(environment.Workspace.CurrentSolution.GetProject(project2.Id).AllProjectReferences);
// Remove project1. project2's reference should have been converted back
project1.Dispose();
Assert.Empty(environment.Workspace.CurrentSolution.GetProject(project2.Id).AllProjectReferences);
Assert.Single(environment.Workspace.CurrentSolution.GetProject(project2.Id).MetadataReferences);
project2.Dispose();
}
[WpfFact]
[WorkItem(461967, "https://devdiv.visualstudio.com/DevDiv/_workitems/edit/461967")]
[WorkItem(727173, "https://devdiv.visualstudio.com/DevDiv/_workitems/edit/727173")]
[Trait(Traits.Feature, Traits.Features.ProjectSystemShims)]
public async Task AddingMetadataReferenceToProjectThatCannotCompileInTheIdeKeepsMetadataReference()
{
using var environment = new TestEnvironment(typeof(NoCompilationLanguageServiceFactory));
var project1 = await CreateCSharpCPSProjectAsync(environment, "project1", commandLineArguments: @"/out:c:\project1.dll");
var project2 = await CreateNonCompilableProjectAsync(environment, "project2", @"C:\project2.fsproj");
project2.BinOutputPath = "c:\\project2.dll";
project1.AddMetadataReference(project2.BinOutputPath, MetadataReferenceProperties.Assembly);
// We should not have converted that to a project reference, because we would have no way to produce the compilation
Assert.Empty(environment.Workspace.CurrentSolution.GetProject(project1.Id).AllProjectReferences);
project2.Dispose();
project1.Dispose();
}
[WpfFact]
[Trait(Traits.Feature, Traits.Features.ProjectSystemShims)]
public async Task AddRemoveAnalyzerReference_CPS()
{
using var environment = new TestEnvironment();
using var project = await CreateCSharpCPSProjectAsync(environment, "project1");
// Add analyzer reference
var analyzerAssemblyFullPath = @"c:\someAssembly.dll";
bool AnalyzersContainsAnalyzer()
{
return environment.Workspace.CurrentSolution.Projects.Single()
.AnalyzerReferences.Cast<AnalyzerReference>()
.Any(a => a.FullPath == analyzerAssemblyFullPath);
}
project.AddAnalyzerReference(analyzerAssemblyFullPath);
Assert.True(AnalyzersContainsAnalyzer());
// Remove analyzer reference
project.RemoveAnalyzerReference(analyzerAssemblyFullPath);
Assert.False(AnalyzersContainsAnalyzer());
}
}
}
| // 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.
#nullable disable
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.CodeAnalysis.UnitTests;
using Microsoft.VisualStudio.LanguageServices.ProjectSystem;
using Microsoft.VisualStudio.LanguageServices.UnitTests.ProjectSystemShim.Framework;
using Roslyn.Test.Utilities;
using Xunit;
namespace Roslyn.VisualStudio.CSharp.UnitTests.ProjectSystemShim.CPS
{
using static CSharpHelpers;
[UseExportProvider]
public class CSharpReferenceTests
{
[WpfFact]
[Trait(Traits.Feature, Traits.Features.ProjectSystemShims)]
public async Task AddRemoveProjectAndMetadataReference_CPS()
{
using var environment = new TestEnvironment();
var project1 = await CreateCSharpCPSProjectAsync(environment, "project1", commandLineArguments: @"/out:c:\project1.dll");
var project2 = await CreateCSharpCPSProjectAsync(environment, "project2", commandLineArguments: @"/out:c:\project2.dll");
var project3 = await CreateCSharpCPSProjectAsync(environment, "project3", commandLineArguments: @"/out:c:\project3.dll");
var project4 = await CreateCSharpCPSProjectAsync(environment, "project4");
// Add project reference
project3.AddProjectReference(project1, new MetadataReferenceProperties());
// Add project reference as metadata reference: since this is known to be the output path of project1, the metadata reference is converted to a project reference
project3.AddMetadataReference(@"c:\project2.dll", new MetadataReferenceProperties());
// Add project reference with no output path
project3.AddProjectReference(project4, new MetadataReferenceProperties());
// Add metadata reference
var metadaRefFilePath = @"c:\someAssembly.dll";
project3.AddMetadataReference(metadaRefFilePath, new MetadataReferenceProperties(embedInteropTypes: true));
IEnumerable<ProjectReference> GetProject3ProjectReferences()
{
return environment.Workspace
.CurrentSolution.GetProject(project3.Id).ProjectReferences;
}
IEnumerable<PortableExecutableReference> GetProject3MetadataReferences()
{
return environment.Workspace.CurrentSolution.GetProject(project3.Id)
.MetadataReferences
.Cast<PortableExecutableReference>();
}
Assert.True(GetProject3ProjectReferences().Any(pr => pr.ProjectId == project1.Id));
Assert.True(GetProject3ProjectReferences().Any(pr => pr.ProjectId == project2.Id));
Assert.True(GetProject3ProjectReferences().Any(pr => pr.ProjectId == project4.Id));
Assert.True(GetProject3MetadataReferences().Any(mr => mr.FilePath == metadaRefFilePath));
// Change output path for project reference and verify the reference.
((IWorkspaceProjectContext)project4).BinOutputPath = @"C:\project4.dll";
Assert.Equal(@"C:\project4.dll", project4.BinOutputPath);
Assert.True(GetProject3ProjectReferences().Any(pr => pr.ProjectId == project4.Id));
// Remove project reference
project3.RemoveProjectReference(project1);
// Remove project reference as metadata reference: since this is known to be the output path of project1, the metadata reference is converted to a project reference
project3.RemoveMetadataReference(@"c:\project2.dll");
// Remove metadata reference
project3.RemoveMetadataReference(metadaRefFilePath);
Assert.False(GetProject3ProjectReferences().Any(pr => pr.ProjectId == project1.Id));
Assert.False(GetProject3ProjectReferences().Any(pr => pr.ProjectId == project2.Id));
Assert.False(GetProject3MetadataReferences().Any(mr => mr.FilePath == metadaRefFilePath));
project1.Dispose();
project2.Dispose();
project4.Dispose();
project3.Dispose();
}
[WpfFact]
[Trait(Traits.Feature, Traits.Features.ProjectSystemShims)]
public async Task RemoveProjectConvertsProjectReferencesBack()
{
using var environment = new TestEnvironment();
var project1 = await CreateCSharpCPSProjectAsync(environment, "project1", commandLineArguments: @"/out:c:\project1.dll");
var project2 = await CreateCSharpCPSProjectAsync(environment, "project2");
// Add project reference as metadata reference: since this is known to be the output path of project1, the metadata reference is converted to a project reference
project2.AddMetadataReference(@"c:\project1.dll", new MetadataReferenceProperties());
Assert.Single(environment.Workspace.CurrentSolution.GetProject(project2.Id).AllProjectReferences);
// Remove project1. project2's reference should have been converted back
project1.Dispose();
Assert.Empty(environment.Workspace.CurrentSolution.GetProject(project2.Id).AllProjectReferences);
Assert.Single(environment.Workspace.CurrentSolution.GetProject(project2.Id).MetadataReferences);
project2.Dispose();
}
[WpfFact]
[WorkItem(461967, "https://devdiv.visualstudio.com/DevDiv/_workitems/edit/461967")]
[WorkItem(727173, "https://devdiv.visualstudio.com/DevDiv/_workitems/edit/727173")]
[Trait(Traits.Feature, Traits.Features.ProjectSystemShims)]
public async Task AddingMetadataReferenceToProjectThatCannotCompileInTheIdeKeepsMetadataReference()
{
using var environment = new TestEnvironment(typeof(NoCompilationLanguageServiceFactory));
var project1 = await CreateCSharpCPSProjectAsync(environment, "project1", commandLineArguments: @"/out:c:\project1.dll");
var project2 = await CreateNonCompilableProjectAsync(environment, "project2", @"C:\project2.fsproj");
project2.BinOutputPath = "c:\\project2.dll";
project1.AddMetadataReference(project2.BinOutputPath, MetadataReferenceProperties.Assembly);
// We should not have converted that to a project reference, because we would have no way to produce the compilation
Assert.Empty(environment.Workspace.CurrentSolution.GetProject(project1.Id).AllProjectReferences);
project2.Dispose();
project1.Dispose();
}
[WpfFact]
[Trait(Traits.Feature, Traits.Features.ProjectSystemShims)]
public async Task AddRemoveAnalyzerReference_CPS()
{
using var environment = new TestEnvironment();
using var project = await CreateCSharpCPSProjectAsync(environment, "project1");
// Add analyzer reference
using var tempRoot = new TempRoot();
var analyzerAssemblyFullPath = tempRoot.CreateFile().Path;
bool AnalyzersContainsAnalyzer()
{
return environment.Workspace.CurrentSolution.Projects.Single()
.AnalyzerReferences.Cast<AnalyzerReference>()
.Any(a => a.FullPath == analyzerAssemblyFullPath);
}
project.AddAnalyzerReference(analyzerAssemblyFullPath);
Assert.True(AnalyzersContainsAnalyzer());
// Remove analyzer reference
project.RemoveAnalyzerReference(analyzerAssemblyFullPath);
Assert.False(AnalyzersContainsAnalyzer());
}
}
}
| 1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/VisualStudio/Core/Test.Next/Remote/SnapshotSerializationTests.cs | // 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.
#nullable disable
using System;
using System.Collections.Immutable;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeStyle;
using Microsoft.CodeAnalysis.CSharp.CodeStyle;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Remote;
using Microsoft.CodeAnalysis.Remote.Testing;
using Microsoft.CodeAnalysis.Serialization;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.CodeAnalysis.Text;
using Microsoft.CodeAnalysis.UnitTests;
using Roslyn.Test.Utilities;
using Roslyn.Test.Utilities.TestGenerators;
using Roslyn.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.Remote.UnitTests
{
[UseExportProvider]
public class SnapshotSerializationTests
{
private static Workspace CreateWorkspace(Type[] additionalParts = null)
=> new AdhocWorkspace(FeaturesTestCompositions.Features.AddParts(additionalParts).WithTestHostParts(TestHost.OutOfProcess).GetHostServices());
internal static Solution CreateFullSolution(Workspace workspace)
{
var solution = workspace.CurrentSolution;
var languages = ImmutableHashSet.Create(LanguageNames.CSharp, LanguageNames.VisualBasic);
var solutionOptions = solution.Workspace.Services.GetRequiredService<IOptionService>().GetSerializableOptionsSnapshot(languages);
solution = solution.WithOptions(solutionOptions);
var csCode = "class A { }";
var project1 = solution.AddProject("Project", "Project.dll", LanguageNames.CSharp);
var document1 = project1.AddDocument("Document1", SourceText.From(csCode));
var vbCode = "Class B\r\nEnd Class";
var project2 = document1.Project.Solution.AddProject("Project2", "Project2.dll", LanguageNames.VisualBasic);
var document2 = project2.AddDocument("Document2", SourceText.From(vbCode));
solution = document2.Project.Solution.GetRequiredProject(project1.Id)
.AddProjectReference(new ProjectReference(project2.Id, ImmutableArray.Create("test")))
.AddMetadataReference(MetadataReference.CreateFromFile(typeof(object).Assembly.Location))
.AddAnalyzerReference(new AnalyzerFileReference(Path.Combine(TempRoot.Root, "path1"), new TestAnalyzerAssemblyLoader()))
.AddAdditionalDocument("Additional", SourceText.From("hello"), ImmutableArray.Create("test"), @".\Add").Project.Solution;
return solution
.WithAnalyzerReferences(new[] { new AnalyzerFileReference(Path.Combine(TempRoot.Root, "path2"), new TestAnalyzerAssemblyLoader()) })
.AddAnalyzerConfigDocuments(
ImmutableArray.Create(
DocumentInfo.Create(
DocumentId.CreateNewId(project1.Id),
".editorconfig",
loader: TextLoader.From(TextAndVersion.Create(SourceText.From("root = true"), VersionStamp.Create())))));
}
[Fact]
public async Task CreateSolutionSnapshotId_Empty()
{
using var workspace = CreateWorkspace();
var solution = workspace.CurrentSolution;
var validator = new SerializationValidator(workspace.Services);
using var scope = await validator.AssetStorage.StoreAssetsAsync(solution, CancellationToken.None).ConfigureAwait(false);
var checksum = scope.SolutionInfo.SolutionChecksum;
var solutionSyncObject = await validator.AssetStorage.GetAssetAsync(scope.SolutionInfo.ScopeId, checksum, CancellationToken.None).ConfigureAwait(false);
await validator.VerifySynchronizationObjectInServiceAsync(solutionSyncObject).ConfigureAwait(false);
var solutionObject = await validator.GetValueAsync<SolutionStateChecksums>(checksum).ConfigureAwait(false);
await validator.VerifyChecksumInServiceAsync(solutionObject.Attributes, WellKnownSynchronizationKind.SolutionAttributes).ConfigureAwait(false);
await validator.VerifyChecksumInServiceAsync(solutionObject.Options, WellKnownSynchronizationKind.OptionSet).ConfigureAwait(false);
var projectsSyncObject = await validator.AssetStorage.GetAssetAsync(scope.SolutionInfo.ScopeId, solutionObject.Projects.Checksum, CancellationToken.None).ConfigureAwait(false);
await validator.VerifySynchronizationObjectInServiceAsync(projectsSyncObject).ConfigureAwait(false);
Assert.Equal(0, solutionObject.Projects.Count);
}
[Fact]
public async Task CreateSolutionSnapshotId_Empty_Serialization()
{
using var workspace = CreateWorkspace();
var solution = workspace.CurrentSolution;
var validator = new SerializationValidator(workspace.Services);
using var scope = await validator.AssetStorage.StoreAssetsAsync(solution, CancellationToken.None).ConfigureAwait(false);
await validator.VerifySolutionStateSerializationAsync(solution, scope.SolutionInfo.SolutionChecksum).ConfigureAwait(false);
}
[Fact]
public async Task CreateSolutionSnapshotId_Project()
{
using var workspace = CreateWorkspace();
var solution = workspace.CurrentSolution;
var project = solution.AddProject("Project", "Project.dll", LanguageNames.CSharp);
var validator = new SerializationValidator(workspace.Services);
using var scope = await validator.AssetStorage.StoreAssetsAsync(project.Solution, CancellationToken.None).ConfigureAwait(false);
var checksum = scope.SolutionInfo.SolutionChecksum;
var solutionSyncObject = await validator.AssetStorage.GetAssetAsync(scope.SolutionInfo.ScopeId, checksum, CancellationToken.None).ConfigureAwait(false);
await validator.VerifySynchronizationObjectInServiceAsync(solutionSyncObject).ConfigureAwait(false);
var solutionObject = await validator.GetValueAsync<SolutionStateChecksums>(checksum).ConfigureAwait(false);
await validator.VerifyChecksumInServiceAsync(solutionObject.Attributes, WellKnownSynchronizationKind.SolutionAttributes);
await validator.VerifyChecksumInServiceAsync(solutionObject.Options, WellKnownSynchronizationKind.OptionSet);
var projectSyncObject = await validator.AssetStorage.GetAssetAsync(scope.SolutionInfo.ScopeId, solutionObject.Projects.Checksum, CancellationToken.None).ConfigureAwait(false);
await validator.VerifySynchronizationObjectInServiceAsync(projectSyncObject).ConfigureAwait(false);
Assert.Equal(1, solutionObject.Projects.Count);
await validator.VerifySnapshotInServiceAsync(validator.ToProjectObjects(solutionObject.Projects)[0], 0, 0, 0, 0, 0).ConfigureAwait(false);
}
[Fact]
public async Task CreateSolutionSnapshotId_Project_Serialization()
{
using var workspace = CreateWorkspace();
var project = workspace.CurrentSolution.AddProject("Project", "Project.dll", LanguageNames.CSharp);
var validator = new SerializationValidator(workspace.Services);
using var snapshot = await validator.AssetStorage.StoreAssetsAsync(project.Solution, CancellationToken.None).ConfigureAwait(false);
await validator.VerifySolutionStateSerializationAsync(project.Solution, snapshot.SolutionInfo.SolutionChecksum).ConfigureAwait(false);
}
[Fact]
public async Task CreateSolutionSnapshotId()
{
var code = "class A { }";
using var workspace = CreateWorkspace();
var document = workspace.CurrentSolution.AddProject("Project", "Project.dll", LanguageNames.CSharp).AddDocument("Document", SourceText.From(code));
var validator = new SerializationValidator(workspace.Services);
using var scope = await validator.AssetStorage.StoreAssetsAsync(document.Project.Solution, CancellationToken.None).ConfigureAwait(false);
var syncObject = await validator.AssetStorage.GetAssetAsync(scope.SolutionInfo.ScopeId, scope.SolutionInfo.SolutionChecksum, CancellationToken.None).ConfigureAwait(false);
var solutionObject = await validator.GetValueAsync<SolutionStateChecksums>(syncObject.Checksum).ConfigureAwait(false);
await validator.VerifySynchronizationObjectInServiceAsync(syncObject).ConfigureAwait(false);
await validator.VerifyChecksumInServiceAsync(solutionObject.Attributes, WellKnownSynchronizationKind.SolutionAttributes).ConfigureAwait(false);
await validator.VerifyChecksumInServiceAsync(solutionObject.Options, WellKnownSynchronizationKind.OptionSet).ConfigureAwait(false);
await validator.VerifyChecksumInServiceAsync(solutionObject.Projects.Checksum, WellKnownSynchronizationKind.ChecksumCollection).ConfigureAwait(false);
Assert.Equal(1, solutionObject.Projects.Count);
await validator.VerifySnapshotInServiceAsync(validator.ToProjectObjects(solutionObject.Projects)[0], 1, 0, 0, 0, 0).ConfigureAwait(false);
}
[Fact]
public async Task CreateSolutionSnapshotId_Serialization()
{
var code = "class A { }";
using var workspace = CreateWorkspace();
var solution = workspace.CurrentSolution;
var document = solution.AddProject("Project", "Project.dll", LanguageNames.CSharp).AddDocument("Document", SourceText.From(code));
var validator = new SerializationValidator(workspace.Services);
using var scope = await validator.AssetStorage.StoreAssetsAsync(document.Project.Solution, CancellationToken.None).ConfigureAwait(false);
await validator.VerifySolutionStateSerializationAsync(document.Project.Solution, scope.SolutionInfo.SolutionChecksum).ConfigureAwait(false);
}
[Fact]
public async Task CreateSolutionSnapshotId_Full()
{
using var workspace = CreateWorkspace();
var solution = CreateFullSolution(workspace);
var firstProjectChecksum = await solution.GetProject(solution.ProjectIds[0]).State.GetChecksumAsync(CancellationToken.None);
var secondProjectChecksum = await solution.GetProject(solution.ProjectIds[1]).State.GetChecksumAsync(CancellationToken.None);
var validator = new SerializationValidator(workspace.Services);
using var scope = await validator.AssetStorage.StoreAssetsAsync(solution, CancellationToken.None).ConfigureAwait(false);
var syncObject = await validator.AssetStorage.GetAssetAsync(scope.SolutionInfo.ScopeId, scope.SolutionInfo.SolutionChecksum, CancellationToken.None).ConfigureAwait(false);
var solutionObject = await validator.GetValueAsync<SolutionStateChecksums>(syncObject.Checksum).ConfigureAwait(false);
await validator.VerifySynchronizationObjectInServiceAsync(syncObject).ConfigureAwait(false);
await validator.VerifyChecksumInServiceAsync(solutionObject.Attributes, WellKnownSynchronizationKind.SolutionAttributes).ConfigureAwait(false);
await validator.VerifyChecksumInServiceAsync(solutionObject.Options, WellKnownSynchronizationKind.OptionSet).ConfigureAwait(false);
await validator.VerifyChecksumInServiceAsync(solutionObject.Projects.Checksum, WellKnownSynchronizationKind.ChecksumCollection).ConfigureAwait(false);
Assert.Equal(2, solutionObject.Projects.Count);
var projects = validator.ToProjectObjects(solutionObject.Projects);
await validator.VerifySnapshotInServiceAsync(projects.Where(p => p.Checksum == firstProjectChecksum).First(), 1, 1, 1, 1, 1).ConfigureAwait(false);
await validator.VerifySnapshotInServiceAsync(projects.Where(p => p.Checksum == secondProjectChecksum).First(), 1, 0, 0, 0, 0).ConfigureAwait(false);
}
[Fact]
public async Task CreateSolutionSnapshotId_Full_Serialization()
{
using var workspace = CreateWorkspace();
var solution = CreateFullSolution(workspace);
var validator = new SerializationValidator(workspace.Services);
using var scope = await validator.AssetStorage.StoreAssetsAsync(solution, CancellationToken.None).ConfigureAwait(false);
await validator.VerifySolutionStateSerializationAsync(solution, scope.SolutionInfo.SolutionChecksum).ConfigureAwait(false);
}
[Fact]
public async Task CreateSolutionSnapshotId_Full_Asset_Serialization()
{
using var workspace = CreateWorkspace();
var solution = CreateFullSolution(workspace);
var validator = new SerializationValidator(workspace.Services);
using var scope = await validator.AssetStorage.StoreAssetsAsync(solution, CancellationToken.None).ConfigureAwait(false);
var solutionObject = await validator.GetValueAsync<SolutionStateChecksums>(scope.SolutionInfo.SolutionChecksum);
await validator.VerifyAssetAsync(solutionObject).ConfigureAwait(false);
}
[Fact]
public async Task CreateSolutionSnapshotId_Full_Asset_Serialization_Desktop()
{
using var workspace = CreateWorkspace();
var solution = CreateFullSolution(workspace);
var validator = new SerializationValidator(workspace.Services);
using var scope = await validator.AssetStorage.StoreAssetsAsync(solution, CancellationToken.None).ConfigureAwait(false);
var solutionObject = await validator.GetValueAsync<SolutionStateChecksums>(scope.SolutionInfo.SolutionChecksum);
await validator.VerifyAssetAsync(solutionObject).ConfigureAwait(false);
}
[Fact]
public async Task CreateSolutionSnapshotId_Duplicate()
{
using var workspace = CreateWorkspace();
var solution = CreateFullSolution(workspace);
// this is just data, one can hold the id outside of using statement. but
// one can't get asset using checksum from the id.
SolutionStateChecksums solutionId1;
SolutionStateChecksums solutionId2;
var validator = new SerializationValidator(workspace.Services);
using (var scope1 = await validator.AssetStorage.StoreAssetsAsync(solution, CancellationToken.None).ConfigureAwait(false))
{
solutionId1 = await validator.GetValueAsync<SolutionStateChecksums>(scope1.SolutionInfo.SolutionChecksum).ConfigureAwait(false);
}
using (var scope2 = await validator.AssetStorage.StoreAssetsAsync(solution, CancellationToken.None).ConfigureAwait(false))
{
solutionId2 = await validator.GetValueAsync<SolutionStateChecksums>(scope2.SolutionInfo.SolutionChecksum).ConfigureAwait(false);
}
// once pinned snapshot scope is released, there is no way to get back to asset.
// catch Exception because it will throw 2 different exception based on release or debug (ExceptionUtilities.UnexpectedValue)
Assert.ThrowsAny<Exception>(() => validator.SolutionStateEqual(solutionId1, solutionId2));
}
[Fact]
public void MetadataReference_RoundTrip_Test()
{
using var workspace = CreateWorkspace();
var reference = MetadataReference.CreateFromFile(typeof(object).Assembly.Location);
var serializer = workspace.Services.GetService<ISerializerService>();
var assetFromFile = new SolutionAsset(serializer.CreateChecksum(reference, CancellationToken.None), reference);
var assetFromStorage = CloneAsset(serializer, assetFromFile);
_ = CloneAsset(serializer, assetFromStorage);
}
[Fact]
public async Task Workspace_RoundTrip_Test()
{
using var workspace = CreateWorkspace();
var solution = CreateFullSolution(workspace);
var validator = new SerializationValidator(workspace.Services);
var scope1 = await validator.AssetStorage.StoreAssetsAsync(solution, CancellationToken.None).ConfigureAwait(false);
// recover solution from given snapshot
var recovered = await validator.GetSolutionAsync(scope1).ConfigureAwait(false);
var solutionObject1 = await validator.GetValueAsync<SolutionStateChecksums>(scope1.SolutionInfo.SolutionChecksum).ConfigureAwait(false);
// create new snapshot from recovered solution
using var scope2 = await validator.AssetStorage.StoreAssetsAsync(recovered, CancellationToken.None).ConfigureAwait(false);
// verify asset created by recovered solution is good
var solutionObject2 = await validator.GetValueAsync<SolutionStateChecksums>(scope2.SolutionInfo.SolutionChecksum).ConfigureAwait(false);
await validator.VerifyAssetAsync(solutionObject2).ConfigureAwait(false);
// verify snapshots created from original solution and recovered solution are same
validator.SolutionStateEqual(solutionObject1, solutionObject2);
// recover new solution from recovered solution
var roundtrip = await validator.GetSolutionAsync(scope2).ConfigureAwait(false);
// create new snapshot from round tripped solution
using var scope3 = await validator.AssetStorage.StoreAssetsAsync(roundtrip, CancellationToken.None).ConfigureAwait(false);
// verify asset created by rount trip solution is good
var solutionObject3 = await validator.GetValueAsync<SolutionStateChecksums>(scope3.SolutionInfo.SolutionChecksum).ConfigureAwait(false);
await validator.VerifyAssetAsync(solutionObject3).ConfigureAwait(false);
// verify snapshots created from original solution and round trip solution are same.
validator.SolutionStateEqual(solutionObject2, solutionObject3);
}
[Fact]
public async Task Workspace_RoundTrip_Test_Desktop()
{
using var workspace = CreateWorkspace();
var solution = CreateFullSolution(workspace);
var validator = new SerializationValidator(workspace.Services);
var scope1 = await validator.AssetStorage.StoreAssetsAsync(solution, CancellationToken.None).ConfigureAwait(false);
// recover solution from given snapshot
var recovered = await validator.GetSolutionAsync(scope1).ConfigureAwait(false);
var solutionObject1 = await validator.GetValueAsync<SolutionStateChecksums>(scope1.SolutionInfo.SolutionChecksum).ConfigureAwait(false);
// create new snapshot from recovered solution
using var scope2 = await validator.AssetStorage.StoreAssetsAsync(recovered, CancellationToken.None).ConfigureAwait(false);
// verify asset created by recovered solution is good
var solutionObject2 = await validator.GetValueAsync<SolutionStateChecksums>(scope2.SolutionInfo.SolutionChecksum).ConfigureAwait(false);
await validator.VerifyAssetAsync(solutionObject2).ConfigureAwait(false);
// verify snapshots created from original solution and recovered solution are same
validator.SolutionStateEqual(solutionObject1, solutionObject2);
scope1.Dispose();
// recover new solution from recovered solution
var roundtrip = await validator.GetSolutionAsync(scope2).ConfigureAwait(false);
// create new snapshot from round tripped solution
using var scope3 = await validator.AssetStorage.StoreAssetsAsync(roundtrip, CancellationToken.None).ConfigureAwait(false);
// verify asset created by rount trip solution is good
var solutionObject3 = await validator.GetValueAsync<SolutionStateChecksums>(scope3.SolutionInfo.SolutionChecksum).ConfigureAwait(false);
await validator.VerifyAssetAsync(solutionObject3).ConfigureAwait(false);
// verify snapshots created from original solution and round trip solution are same.
validator.SolutionStateEqual(solutionObject2, solutionObject3);
}
[Fact]
public async Task OptionSet_Serialization()
{
using var workspace = CreateWorkspace()
.CurrentSolution.AddProject("Project1", "Project.dll", LanguageNames.CSharp)
.Solution.AddProject("Project2", "Project2.dll", LanguageNames.VisualBasic)
.Solution.Workspace;
await VerifyOptionSetsAsync(workspace, _ => { }).ConfigureAwait(false);
}
[Fact]
public async Task OptionSet_Serialization_CustomValue()
{
using var workspace = CreateWorkspace();
var newQualifyFieldAccessValue = new CodeStyleOption2<bool>(false, NotificationOption2.Error);
var newQualifyMethodAccessValue = new CodeStyleOption2<bool>(true, NotificationOption2.Warning);
var newVarWhenTypeIsApparentValue = new CodeStyleOption2<bool>(false, NotificationOption2.Suggestion);
var newPreferIntrinsicPredefinedTypeKeywordInMemberAccessValue = new CodeStyleOption2<bool>(true, NotificationOption2.Silent);
workspace.TryApplyChanges(workspace.CurrentSolution.WithOptions(workspace.Options
.WithChangedOption(CodeStyleOptions2.QualifyFieldAccess, LanguageNames.CSharp, newQualifyFieldAccessValue)
.WithChangedOption(CodeStyleOptions2.QualifyMethodAccess, LanguageNames.VisualBasic, newQualifyMethodAccessValue)
.WithChangedOption(CSharpCodeStyleOptions.VarWhenTypeIsApparent, newVarWhenTypeIsApparentValue)
.WithChangedOption(CodeStyleOptions2.PreferIntrinsicPredefinedTypeKeywordInMemberAccess, LanguageNames.VisualBasic, newPreferIntrinsicPredefinedTypeKeywordInMemberAccessValue)));
var validator = new SerializationValidator(workspace.Services);
await VerifyOptionSetsAsync(workspace, VerifyOptions).ConfigureAwait(false);
void VerifyOptions(OptionSet options)
{
var actualQualifyFieldAccessValue = options.GetOption(CodeStyleOptions2.QualifyFieldAccess, LanguageNames.CSharp);
Assert.Equal(newQualifyFieldAccessValue, actualQualifyFieldAccessValue);
var actualQualifyMethodAccessValue = options.GetOption(CodeStyleOptions2.QualifyMethodAccess, LanguageNames.VisualBasic);
Assert.Equal(newQualifyMethodAccessValue, actualQualifyMethodAccessValue);
var actualVarWhenTypeIsApparentValue = options.GetOption(CSharpCodeStyleOptions.VarWhenTypeIsApparent);
Assert.Equal(newVarWhenTypeIsApparentValue, actualVarWhenTypeIsApparentValue);
var actualPreferIntrinsicPredefinedTypeKeywordInMemberAccessValue = options.GetOption(CodeStyleOptions2.PreferIntrinsicPredefinedTypeKeywordInMemberAccess, LanguageNames.VisualBasic);
Assert.Equal(newPreferIntrinsicPredefinedTypeKeywordInMemberAccessValue, actualPreferIntrinsicPredefinedTypeKeywordInMemberAccessValue);
}
}
[Fact]
public void Missing_Metadata_Serialization_Test()
{
using var workspace = CreateWorkspace();
var serializer = workspace.Services.GetService<ISerializerService>();
var reference = new MissingMetadataReference();
// make sure this doesn't throw
var assetFromFile = new SolutionAsset(serializer.CreateChecksum(reference, CancellationToken.None), reference);
var assetFromStorage = CloneAsset(serializer, assetFromFile);
_ = CloneAsset(serializer, assetFromStorage);
}
[Fact]
public void Missing_Analyzer_Serialization_Test()
{
using var workspace = CreateWorkspace();
var serializer = workspace.Services.GetService<ISerializerService>();
var reference = new AnalyzerFileReference(Path.Combine(TempRoot.Root, "missing_reference"), new MissingAnalyzerLoader());
// make sure this doesn't throw
var assetFromFile = new SolutionAsset(serializer.CreateChecksum(reference, CancellationToken.None), reference);
var assetFromStorage = CloneAsset(serializer, assetFromFile);
_ = CloneAsset(serializer, assetFromStorage);
}
[Fact]
public void Missing_Analyzer_Serialization_Desktop_Test()
{
using var workspace = CreateWorkspace();
var serializer = workspace.Services.GetService<ISerializerService>();
var reference = new AnalyzerFileReference(Path.Combine(TempRoot.Root, "missing_reference"), new MissingAnalyzerLoader());
// make sure this doesn't throw
var assetFromFile = new SolutionAsset(serializer.CreateChecksum(reference, CancellationToken.None), reference);
var assetFromStorage = CloneAsset(serializer, assetFromFile);
_ = CloneAsset(serializer, assetFromStorage);
}
[Fact]
public void RoundTrip_Analyzer_Serialization_Test()
{
using var tempRoot = new TempRoot();
using var workspace = CreateWorkspace();
var serializer = workspace.Services.GetService<ISerializerService>();
// actually shadow copy content
var location = typeof(object).Assembly.Location;
var file = tempRoot.CreateFile("shadow", "dll");
file.CopyContentFrom(location);
var reference = new AnalyzerFileReference(location, new MockShadowCopyAnalyzerAssemblyLoader(ImmutableDictionary<string, string>.Empty.Add(location, file.Path)));
// make sure this doesn't throw
var assetFromFile = new SolutionAsset(serializer.CreateChecksum(reference, CancellationToken.None), reference);
var assetFromStorage = CloneAsset(serializer, assetFromFile);
_ = CloneAsset(serializer, assetFromStorage);
}
[Fact]
public void RoundTrip_Analyzer_Serialization_Desktop_Test()
{
using var tempRoot = new TempRoot();
using var workspace = CreateWorkspace();
var serializer = workspace.Services.GetService<ISerializerService>();
// actually shadow copy content
var location = typeof(object).Assembly.Location;
var file = tempRoot.CreateFile("shadow", "dll");
file.CopyContentFrom(location);
var reference = new AnalyzerFileReference(location, new MockShadowCopyAnalyzerAssemblyLoader(ImmutableDictionary<string, string>.Empty.Add(location, file.Path)));
// make sure this doesn't throw
var assetFromFile = new SolutionAsset(serializer.CreateChecksum(reference, CancellationToken.None), reference);
var assetFromStorage = CloneAsset(serializer, assetFromFile);
_ = CloneAsset(serializer, assetFromStorage);
}
[Fact]
public void ShadowCopied_Analyzer_Serialization_Desktop_Test()
{
using var tempRoot = new TempRoot();
using var workspace = CreateWorkspace();
var reference = CreateShadowCopiedAnalyzerReference(tempRoot);
var serializer = workspace.Services.GetService<ISerializerService>();
// make sure this doesn't throw
var assetFromFile = new SolutionAsset(serializer.CreateChecksum(reference, CancellationToken.None), reference);
// this will verify serialized analyzer reference return same checksum as the original one
_ = CloneAsset(serializer, assetFromFile);
}
[Fact]
[WorkItem(1107294, "https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1107294")]
public async Task SnapshotWithIdenticalAnalyzerFiles()
{
using var workspace = CreateWorkspace();
var project = workspace.CurrentSolution.AddProject("Project", "Project.dll", LanguageNames.CSharp);
using var temp = new TempRoot();
var dir = temp.CreateDirectory();
// create two analyzer assembly files whose content is identical but path is different:
var file1 = dir.CreateFile("analyzer1.dll").WriteAllBytes(TestResources.AnalyzerTests.FaultyAnalyzer);
var file2 = dir.CreateFile("analyzer2.dll").WriteAllBytes(TestResources.AnalyzerTests.FaultyAnalyzer);
var analyzer1 = new AnalyzerFileReference(file1.Path, TestAnalyzerAssemblyLoader.LoadNotImplemented);
var analyzer2 = new AnalyzerFileReference(file2.Path, TestAnalyzerAssemblyLoader.LoadNotImplemented);
project = project.AddAnalyzerReferences(new[] { analyzer1, analyzer2 });
var validator = new SerializationValidator(workspace.Services);
using var snapshot = await validator.AssetStorage.StoreAssetsAsync(project.Solution, CancellationToken.None).ConfigureAwait(false);
var recovered = await validator.GetSolutionAsync(snapshot).ConfigureAwait(false);
AssertEx.Equal(new[] { file1.Path, file2.Path }, recovered.GetProject(project.Id).AnalyzerReferences.Select(r => r.FullPath));
}
[Fact]
public async Task SnapshotWithMissingReferencesTest()
{
using var workspace = CreateWorkspace();
var project = workspace.CurrentSolution.AddProject("Project", "Project.dll", LanguageNames.CSharp);
var metadata = new MissingMetadataReference();
var analyzer = new AnalyzerFileReference(Path.Combine(TempRoot.Root, "missing_reference"), new MissingAnalyzerLoader());
project = project.AddMetadataReference(metadata);
project = project.AddAnalyzerReference(analyzer);
var validator = new SerializationValidator(workspace.Services);
using var snapshot = await validator.AssetStorage.StoreAssetsAsync(project.Solution, CancellationToken.None).ConfigureAwait(false);
// this shouldn't throw
var recovered = await validator.GetSolutionAsync(snapshot).ConfigureAwait(false);
}
[Fact]
public async Task UnknownLanguageTest()
{
using var workspace = CreateWorkspace(new[] { typeof(NoCompilationLanguageServiceFactory) });
var project = workspace.CurrentSolution.AddProject("Project", "Project.dll", NoCompilationConstants.LanguageName);
var validator = new SerializationValidator(workspace.Services);
using var snapshot = await validator.AssetStorage.StoreAssetsAsync(project.Solution, CancellationToken.None).ConfigureAwait(false);
// this shouldn't throw
var recovered = await validator.GetSolutionAsync(snapshot).ConfigureAwait(false);
}
[Fact, WorkItem(44791, "https://github.com/dotnet/roslyn/issues/44791")]
public async Task UnknownLanguageOptionsTest()
{
using var workspace = CreateWorkspace(new[] { typeof(NoCompilationLanguageServiceFactory) });
var project = workspace.CurrentSolution.AddProject("Project", "Project.dll", NoCompilationConstants.LanguageName)
.Solution.AddProject("Project2", "Project2.dll", LanguageNames.CSharp);
workspace.TryApplyChanges(project.Solution);
await VerifyOptionSetsAsync(workspace, verifyOptionValues: _ => { });
}
[Fact]
public async Task EmptyAssetChecksumTest()
{
var document = CreateWorkspace().CurrentSolution.AddProject("empty", "empty", LanguageNames.CSharp).AddDocument("empty", SourceText.From(""));
var serializer = document.Project.Solution.Workspace.Services.GetService<ISerializerService>();
var source = serializer.CreateChecksum(await document.GetTextAsync().ConfigureAwait(false), CancellationToken.None);
var metadata = serializer.CreateChecksum(new MissingMetadataReference(), CancellationToken.None);
var analyzer = serializer.CreateChecksum(new AnalyzerFileReference(Path.Combine(TempRoot.Root, "missing"), new MissingAnalyzerLoader()), CancellationToken.None);
Assert.NotEqual(source, metadata);
Assert.NotEqual(source, analyzer);
Assert.NotEqual(metadata, analyzer);
}
[Fact]
public async Task VBParseOptionsInCompilationOptions()
{
var project = CreateWorkspace().CurrentSolution.AddProject("empty", "empty", LanguageNames.VisualBasic);
project = project.WithCompilationOptions(
((VisualBasic.VisualBasicCompilationOptions)project.CompilationOptions).WithParseOptions((VisualBasic.VisualBasicParseOptions)project.ParseOptions));
var checksum = await project.State.GetChecksumAsync(CancellationToken.None).ConfigureAwait(false);
Assert.NotNull(checksum);
}
[Fact]
public async Task TestMetadataXmlDocComment()
{
using var tempRoot = new TempRoot();
// get original assembly location
var mscorlibLocation = typeof(object).Assembly.Location;
// set up dll and xml doc content
var tempDir = tempRoot.CreateDirectory();
var tempCorlib = tempDir.CopyFile(mscorlibLocation);
var tempCorlibXml = tempDir.CreateFile(Path.ChangeExtension(tempCorlib.Path, "xml"));
tempCorlibXml.WriteAllText(@"<?xml version=""1.0"" encoding=""utf-8""?>
<doc>
<assembly>
<name>mscorlib</name>
</assembly>
<members>
<member name=""T:System.Object"">
<summary>Supports all classes in the .NET Framework class hierarchy and provides low-level services to derived classes. This is the ultimate base class of all classes in the .NET Framework; it is the root of the type hierarchy.To browse the .NET Framework source code for this type, see the Reference Source.</summary>
</member>
</members>
</doc>");
using var workspace = CreateWorkspace();
var solution = workspace.CurrentSolution
.AddProject("Project", "Project.dll", LanguageNames.CSharp)
.AddMetadataReference(MetadataReference.CreateFromFile(tempCorlib.Path))
.Solution;
var validator = new SerializationValidator(workspace.Services);
using var scope = await validator.AssetStorage.StoreAssetsAsync(solution, CancellationToken.None);
// recover solution from given snapshot
var recovered = await validator.GetSolutionAsync(scope);
var compilation = await recovered.Projects.First().GetCompilationAsync(CancellationToken.None);
var objectType = compilation.GetTypeByMetadataName("System.Object");
var xmlDocComment = objectType.GetDocumentationCommentXml();
Assert.False(string.IsNullOrEmpty(xmlDocComment));
}
[Fact]
public void TestEncodingSerialization()
{
using var workspace = CreateWorkspace();
var serializer = workspace.Services.GetService<ISerializerService>();
// test with right serializable encoding
var sourceText = SourceText.From("Hello", Encoding.UTF8);
using (var stream = SerializableBytes.CreateWritableStream())
{
using var context = SolutionReplicationContext.Create();
using (var objectWriter = new ObjectWriter(stream, leaveOpen: true))
{
serializer.Serialize(sourceText, objectWriter, context, CancellationToken.None);
}
stream.Position = 0;
using var objectReader = ObjectReader.TryGetReader(stream);
var newText = serializer.Deserialize<SourceText>(sourceText.GetWellKnownSynchronizationKind(), objectReader, CancellationToken.None);
Assert.Equal(sourceText.ToString(), newText.ToString());
}
// test with wrong encoding that doesn't support serialization
sourceText = SourceText.From("Hello", new NotSerializableEncoding());
using (var stream = SerializableBytes.CreateWritableStream())
{
using var context = SolutionReplicationContext.Create();
using (var objectWriter = new ObjectWriter(stream, leaveOpen: true))
{
serializer.Serialize(sourceText, objectWriter, context, CancellationToken.None);
}
stream.Position = 0;
using var objectReader = ObjectReader.TryGetReader(stream);
var newText = serializer.Deserialize<SourceText>(sourceText.GetWellKnownSynchronizationKind(), objectReader, CancellationToken.None);
Assert.Equal(sourceText.ToString(), newText.ToString());
}
}
[Fact]
public void TestCompilationOptions_NullableAndImport()
{
var csharpOptions = CSharp.CSharpCompilation.Create("dummy").Options.WithNullableContextOptions(NullableContextOptions.Warnings).WithMetadataImportOptions(MetadataImportOptions.All);
var vbOptions = VisualBasic.VisualBasicCompilation.Create("dummy").Options.WithMetadataImportOptions(MetadataImportOptions.Internal);
using var workspace = CreateWorkspace();
var serializer = workspace.Services.GetService<ISerializerService>();
VerifyOptions(csharpOptions);
VerifyOptions(vbOptions);
void VerifyOptions(CompilationOptions originalOptions)
{
using var stream = SerializableBytes.CreateWritableStream();
using var context = SolutionReplicationContext.Create();
using (var objectWriter = new ObjectWriter(stream, leaveOpen: true))
{
serializer.Serialize(originalOptions, objectWriter, context, CancellationToken.None);
}
stream.Position = 0;
using var objectReader = ObjectReader.TryGetReader(stream);
var recoveredOptions = serializer.Deserialize<CompilationOptions>(originalOptions.GetWellKnownSynchronizationKind(), objectReader, CancellationToken.None);
var original = serializer.CreateChecksum(originalOptions, CancellationToken.None);
var recovered = serializer.CreateChecksum(recoveredOptions, CancellationToken.None);
Assert.Equal(original, recovered);
}
}
private static async Task VerifyOptionSetsAsync(Workspace workspace, Action<OptionSet> verifyOptionValues)
{
var solution = workspace.CurrentSolution;
verifyOptionValues(workspace.Options);
verifyOptionValues(solution.Options);
var validator = new SerializationValidator(workspace.Services);
using var scope = await validator.AssetStorage.StoreAssetsAsync(solution, CancellationToken.None).ConfigureAwait(false);
var checksum = scope.SolutionInfo.SolutionChecksum;
var solutionObject = await validator.GetValueAsync<SolutionStateChecksums>(checksum).ConfigureAwait(false);
await validator.VerifyChecksumInServiceAsync(solutionObject.Attributes, WellKnownSynchronizationKind.SolutionAttributes);
await validator.VerifyChecksumInServiceAsync(solutionObject.Options, WellKnownSynchronizationKind.OptionSet);
var recoveredSolution = await validator.GetSolutionAsync(scope);
// option should be exactly same
Assert.Equal(0, recoveredSolution.Options.GetChangedOptions(workspace.Options).Count());
verifyOptionValues(workspace.Options);
verifyOptionValues(recoveredSolution.Options);
// checksum for recovered solution should be the same.
using var recoveredScope = await validator.AssetStorage.StoreAssetsAsync(recoveredSolution, CancellationToken.None).ConfigureAwait(false);
var recoveredChecksum = recoveredScope.SolutionInfo.SolutionChecksum;
Assert.Equal(checksum, recoveredChecksum);
}
private static SolutionAsset CloneAsset(ISerializerService serializer, SolutionAsset asset)
{
using var stream = SerializableBytes.CreateWritableStream();
using var context = SolutionReplicationContext.Create();
using (var writer = new ObjectWriter(stream, leaveOpen: true))
{
serializer.Serialize(asset.Value, writer, context, CancellationToken.None);
}
stream.Position = 0;
using var reader = ObjectReader.TryGetReader(stream);
var recovered = serializer.Deserialize<object>(asset.Kind, reader, CancellationToken.None);
var assetFromStorage = new SolutionAsset(serializer.CreateChecksum(recovered, CancellationToken.None), recovered);
Assert.Equal(asset.Checksum, assetFromStorage.Checksum);
return assetFromStorage;
}
private static AnalyzerFileReference CreateShadowCopiedAnalyzerReference(TempRoot tempRoot)
{
// use 2 different files as shadow copied content
var original = typeof(AdhocWorkspace).Assembly.Location;
var shadow = tempRoot.CreateFile("shadow", "dll");
shadow.CopyContentFrom(typeof(object).Assembly.Location);
return new AnalyzerFileReference(original, new MockShadowCopyAnalyzerAssemblyLoader(ImmutableDictionary<string, string>.Empty.Add(original, shadow.Path)));
}
private class MissingAnalyzerLoader : AnalyzerAssemblyLoader
{
protected override Assembly LoadFromPathImpl(string fullPath)
=> throw new FileNotFoundException(fullPath);
}
private class MissingMetadataReference : PortableExecutableReference
{
public MissingMetadataReference()
: base(MetadataReferenceProperties.Assembly, "missing_reference", XmlDocumentationProvider.Default)
{
}
protected override DocumentationProvider CreateDocumentationProvider()
=> null;
protected override Metadata GetMetadataImpl()
=> throw new FileNotFoundException("can't find");
protected override PortableExecutableReference WithPropertiesImpl(MetadataReferenceProperties properties)
=> this;
}
private class MockShadowCopyAnalyzerAssemblyLoader : IAnalyzerAssemblyLoader
{
private readonly ImmutableDictionary<string, string> _map;
public MockShadowCopyAnalyzerAssemblyLoader(ImmutableDictionary<string, string> map)
=> _map = map;
public void AddDependencyLocation(string fullPath)
{
}
public Assembly LoadFromPath(string fullPath)
=> Assembly.LoadFrom(_map[fullPath]);
}
private class NotSerializableEncoding : Encoding
{
private readonly Encoding _real = Encoding.UTF8;
public override string WebName => _real.WebName;
public override int GetByteCount(char[] chars, int index, int count) => _real.GetByteCount(chars, index, count);
public override int GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex) => GetBytes(chars, charIndex, charCount, bytes, byteIndex);
public override int GetCharCount(byte[] bytes, int index, int count) => GetCharCount(bytes, index, count);
public override int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex) => GetChars(bytes, byteIndex, byteCount, chars, charIndex);
public override int GetMaxByteCount(int charCount) => GetMaxByteCount(charCount);
public override int GetMaxCharCount(int byteCount) => GetMaxCharCount(byteCount);
}
}
}
| // 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.
#nullable disable
using System;
using System.Collections.Immutable;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeStyle;
using Microsoft.CodeAnalysis.CSharp.CodeStyle;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Remote;
using Microsoft.CodeAnalysis.Remote.Testing;
using Microsoft.CodeAnalysis.Serialization;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.CodeAnalysis.Text;
using Microsoft.CodeAnalysis.UnitTests;
using Roslyn.Test.Utilities;
using Roslyn.Test.Utilities.TestGenerators;
using Roslyn.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.Remote.UnitTests
{
[CollectionDefinition(Name)]
public class AssemblyLoadTestFixtureCollection : ICollectionFixture<AssemblyLoadTestFixture>
{
public const string Name = nameof(AssemblyLoadTestFixtureCollection);
private AssemblyLoadTestFixtureCollection() { }
}
[Collection(AssemblyLoadTestFixtureCollection.Name)]
[UseExportProvider]
public class SnapshotSerializationTests
{
private readonly AssemblyLoadTestFixture _testFixture;
public SnapshotSerializationTests(AssemblyLoadTestFixture testFixture)
{
_testFixture = testFixture;
}
private static Workspace CreateWorkspace(Type[] additionalParts = null)
=> new AdhocWorkspace(FeaturesTestCompositions.Features.AddParts(additionalParts).WithTestHostParts(TestHost.OutOfProcess).GetHostServices());
internal static Solution CreateFullSolution(Workspace workspace)
{
var solution = workspace.CurrentSolution;
var languages = ImmutableHashSet.Create(LanguageNames.CSharp, LanguageNames.VisualBasic);
var solutionOptions = solution.Workspace.Services.GetRequiredService<IOptionService>().GetSerializableOptionsSnapshot(languages);
solution = solution.WithOptions(solutionOptions);
var csCode = "class A { }";
var project1 = solution.AddProject("Project", "Project.dll", LanguageNames.CSharp);
var document1 = project1.AddDocument("Document1", SourceText.From(csCode));
var vbCode = "Class B\r\nEnd Class";
var project2 = document1.Project.Solution.AddProject("Project2", "Project2.dll", LanguageNames.VisualBasic);
var document2 = project2.AddDocument("Document2", SourceText.From(vbCode));
solution = document2.Project.Solution.GetRequiredProject(project1.Id)
.AddProjectReference(new ProjectReference(project2.Id, ImmutableArray.Create("test")))
.AddMetadataReference(MetadataReference.CreateFromFile(typeof(object).Assembly.Location))
.AddAnalyzerReference(new AnalyzerFileReference(Path.Combine(TempRoot.Root, "path1"), new TestAnalyzerAssemblyLoader()))
.AddAdditionalDocument("Additional", SourceText.From("hello"), ImmutableArray.Create("test"), @".\Add").Project.Solution;
return solution
.WithAnalyzerReferences(new[] { new AnalyzerFileReference(Path.Combine(TempRoot.Root, "path2"), new TestAnalyzerAssemblyLoader()) })
.AddAnalyzerConfigDocuments(
ImmutableArray.Create(
DocumentInfo.Create(
DocumentId.CreateNewId(project1.Id),
".editorconfig",
loader: TextLoader.From(TextAndVersion.Create(SourceText.From("root = true"), VersionStamp.Create())))));
}
[Fact]
public async Task CreateSolutionSnapshotId_Empty()
{
using var workspace = CreateWorkspace();
var solution = workspace.CurrentSolution;
var validator = new SerializationValidator(workspace.Services);
using var scope = await validator.AssetStorage.StoreAssetsAsync(solution, CancellationToken.None).ConfigureAwait(false);
var checksum = scope.SolutionInfo.SolutionChecksum;
var solutionSyncObject = await validator.AssetStorage.GetAssetAsync(scope.SolutionInfo.ScopeId, checksum, CancellationToken.None).ConfigureAwait(false);
await validator.VerifySynchronizationObjectInServiceAsync(solutionSyncObject).ConfigureAwait(false);
var solutionObject = await validator.GetValueAsync<SolutionStateChecksums>(checksum).ConfigureAwait(false);
await validator.VerifyChecksumInServiceAsync(solutionObject.Attributes, WellKnownSynchronizationKind.SolutionAttributes).ConfigureAwait(false);
await validator.VerifyChecksumInServiceAsync(solutionObject.Options, WellKnownSynchronizationKind.OptionSet).ConfigureAwait(false);
var projectsSyncObject = await validator.AssetStorage.GetAssetAsync(scope.SolutionInfo.ScopeId, solutionObject.Projects.Checksum, CancellationToken.None).ConfigureAwait(false);
await validator.VerifySynchronizationObjectInServiceAsync(projectsSyncObject).ConfigureAwait(false);
Assert.Equal(0, solutionObject.Projects.Count);
}
[Fact]
public async Task CreateSolutionSnapshotId_Empty_Serialization()
{
using var workspace = CreateWorkspace();
var solution = workspace.CurrentSolution;
var validator = new SerializationValidator(workspace.Services);
using var scope = await validator.AssetStorage.StoreAssetsAsync(solution, CancellationToken.None).ConfigureAwait(false);
await validator.VerifySolutionStateSerializationAsync(solution, scope.SolutionInfo.SolutionChecksum).ConfigureAwait(false);
}
[Fact]
public async Task CreateSolutionSnapshotId_Project()
{
using var workspace = CreateWorkspace();
var solution = workspace.CurrentSolution;
var project = solution.AddProject("Project", "Project.dll", LanguageNames.CSharp);
var validator = new SerializationValidator(workspace.Services);
using var scope = await validator.AssetStorage.StoreAssetsAsync(project.Solution, CancellationToken.None).ConfigureAwait(false);
var checksum = scope.SolutionInfo.SolutionChecksum;
var solutionSyncObject = await validator.AssetStorage.GetAssetAsync(scope.SolutionInfo.ScopeId, checksum, CancellationToken.None).ConfigureAwait(false);
await validator.VerifySynchronizationObjectInServiceAsync(solutionSyncObject).ConfigureAwait(false);
var solutionObject = await validator.GetValueAsync<SolutionStateChecksums>(checksum).ConfigureAwait(false);
await validator.VerifyChecksumInServiceAsync(solutionObject.Attributes, WellKnownSynchronizationKind.SolutionAttributes);
await validator.VerifyChecksumInServiceAsync(solutionObject.Options, WellKnownSynchronizationKind.OptionSet);
var projectSyncObject = await validator.AssetStorage.GetAssetAsync(scope.SolutionInfo.ScopeId, solutionObject.Projects.Checksum, CancellationToken.None).ConfigureAwait(false);
await validator.VerifySynchronizationObjectInServiceAsync(projectSyncObject).ConfigureAwait(false);
Assert.Equal(1, solutionObject.Projects.Count);
await validator.VerifySnapshotInServiceAsync(validator.ToProjectObjects(solutionObject.Projects)[0], 0, 0, 0, 0, 0).ConfigureAwait(false);
}
[Fact]
public async Task CreateSolutionSnapshotId_Project_Serialization()
{
using var workspace = CreateWorkspace();
var project = workspace.CurrentSolution.AddProject("Project", "Project.dll", LanguageNames.CSharp);
var validator = new SerializationValidator(workspace.Services);
using var snapshot = await validator.AssetStorage.StoreAssetsAsync(project.Solution, CancellationToken.None).ConfigureAwait(false);
await validator.VerifySolutionStateSerializationAsync(project.Solution, snapshot.SolutionInfo.SolutionChecksum).ConfigureAwait(false);
}
[Fact]
public async Task CreateSolutionSnapshotId()
{
var code = "class A { }";
using var workspace = CreateWorkspace();
var document = workspace.CurrentSolution.AddProject("Project", "Project.dll", LanguageNames.CSharp).AddDocument("Document", SourceText.From(code));
var validator = new SerializationValidator(workspace.Services);
using var scope = await validator.AssetStorage.StoreAssetsAsync(document.Project.Solution, CancellationToken.None).ConfigureAwait(false);
var syncObject = await validator.AssetStorage.GetAssetAsync(scope.SolutionInfo.ScopeId, scope.SolutionInfo.SolutionChecksum, CancellationToken.None).ConfigureAwait(false);
var solutionObject = await validator.GetValueAsync<SolutionStateChecksums>(syncObject.Checksum).ConfigureAwait(false);
await validator.VerifySynchronizationObjectInServiceAsync(syncObject).ConfigureAwait(false);
await validator.VerifyChecksumInServiceAsync(solutionObject.Attributes, WellKnownSynchronizationKind.SolutionAttributes).ConfigureAwait(false);
await validator.VerifyChecksumInServiceAsync(solutionObject.Options, WellKnownSynchronizationKind.OptionSet).ConfigureAwait(false);
await validator.VerifyChecksumInServiceAsync(solutionObject.Projects.Checksum, WellKnownSynchronizationKind.ChecksumCollection).ConfigureAwait(false);
Assert.Equal(1, solutionObject.Projects.Count);
await validator.VerifySnapshotInServiceAsync(validator.ToProjectObjects(solutionObject.Projects)[0], 1, 0, 0, 0, 0).ConfigureAwait(false);
}
[Fact]
public async Task CreateSolutionSnapshotId_Serialization()
{
var code = "class A { }";
using var workspace = CreateWorkspace();
var solution = workspace.CurrentSolution;
var document = solution.AddProject("Project", "Project.dll", LanguageNames.CSharp).AddDocument("Document", SourceText.From(code));
var validator = new SerializationValidator(workspace.Services);
using var scope = await validator.AssetStorage.StoreAssetsAsync(document.Project.Solution, CancellationToken.None).ConfigureAwait(false);
await validator.VerifySolutionStateSerializationAsync(document.Project.Solution, scope.SolutionInfo.SolutionChecksum).ConfigureAwait(false);
}
[Fact]
public async Task CreateSolutionSnapshotId_Full()
{
using var workspace = CreateWorkspace();
var solution = CreateFullSolution(workspace);
var firstProjectChecksum = await solution.GetProject(solution.ProjectIds[0]).State.GetChecksumAsync(CancellationToken.None);
var secondProjectChecksum = await solution.GetProject(solution.ProjectIds[1]).State.GetChecksumAsync(CancellationToken.None);
var validator = new SerializationValidator(workspace.Services);
using var scope = await validator.AssetStorage.StoreAssetsAsync(solution, CancellationToken.None).ConfigureAwait(false);
var syncObject = await validator.AssetStorage.GetAssetAsync(scope.SolutionInfo.ScopeId, scope.SolutionInfo.SolutionChecksum, CancellationToken.None).ConfigureAwait(false);
var solutionObject = await validator.GetValueAsync<SolutionStateChecksums>(syncObject.Checksum).ConfigureAwait(false);
await validator.VerifySynchronizationObjectInServiceAsync(syncObject).ConfigureAwait(false);
await validator.VerifyChecksumInServiceAsync(solutionObject.Attributes, WellKnownSynchronizationKind.SolutionAttributes).ConfigureAwait(false);
await validator.VerifyChecksumInServiceAsync(solutionObject.Options, WellKnownSynchronizationKind.OptionSet).ConfigureAwait(false);
await validator.VerifyChecksumInServiceAsync(solutionObject.Projects.Checksum, WellKnownSynchronizationKind.ChecksumCollection).ConfigureAwait(false);
Assert.Equal(2, solutionObject.Projects.Count);
var projects = validator.ToProjectObjects(solutionObject.Projects);
await validator.VerifySnapshotInServiceAsync(projects.Where(p => p.Checksum == firstProjectChecksum).First(), 1, 1, 1, 1, 1).ConfigureAwait(false);
await validator.VerifySnapshotInServiceAsync(projects.Where(p => p.Checksum == secondProjectChecksum).First(), 1, 0, 0, 0, 0).ConfigureAwait(false);
}
[Fact]
public async Task CreateSolutionSnapshotId_Full_Serialization()
{
using var workspace = CreateWorkspace();
var solution = CreateFullSolution(workspace);
var validator = new SerializationValidator(workspace.Services);
using var scope = await validator.AssetStorage.StoreAssetsAsync(solution, CancellationToken.None).ConfigureAwait(false);
await validator.VerifySolutionStateSerializationAsync(solution, scope.SolutionInfo.SolutionChecksum).ConfigureAwait(false);
}
[Fact]
public async Task CreateSolutionSnapshotId_Full_Asset_Serialization()
{
using var workspace = CreateWorkspace();
var solution = CreateFullSolution(workspace);
var validator = new SerializationValidator(workspace.Services);
using var scope = await validator.AssetStorage.StoreAssetsAsync(solution, CancellationToken.None).ConfigureAwait(false);
var solutionObject = await validator.GetValueAsync<SolutionStateChecksums>(scope.SolutionInfo.SolutionChecksum);
await validator.VerifyAssetAsync(solutionObject).ConfigureAwait(false);
}
[Fact]
public async Task CreateSolutionSnapshotId_Full_Asset_Serialization_Desktop()
{
using var workspace = CreateWorkspace();
var solution = CreateFullSolution(workspace);
var validator = new SerializationValidator(workspace.Services);
using var scope = await validator.AssetStorage.StoreAssetsAsync(solution, CancellationToken.None).ConfigureAwait(false);
var solutionObject = await validator.GetValueAsync<SolutionStateChecksums>(scope.SolutionInfo.SolutionChecksum);
await validator.VerifyAssetAsync(solutionObject).ConfigureAwait(false);
}
[Fact]
public async Task CreateSolutionSnapshotId_Duplicate()
{
using var workspace = CreateWorkspace();
var solution = CreateFullSolution(workspace);
// this is just data, one can hold the id outside of using statement. but
// one can't get asset using checksum from the id.
SolutionStateChecksums solutionId1;
SolutionStateChecksums solutionId2;
var validator = new SerializationValidator(workspace.Services);
using (var scope1 = await validator.AssetStorage.StoreAssetsAsync(solution, CancellationToken.None).ConfigureAwait(false))
{
solutionId1 = await validator.GetValueAsync<SolutionStateChecksums>(scope1.SolutionInfo.SolutionChecksum).ConfigureAwait(false);
}
using (var scope2 = await validator.AssetStorage.StoreAssetsAsync(solution, CancellationToken.None).ConfigureAwait(false))
{
solutionId2 = await validator.GetValueAsync<SolutionStateChecksums>(scope2.SolutionInfo.SolutionChecksum).ConfigureAwait(false);
}
// once pinned snapshot scope is released, there is no way to get back to asset.
// catch Exception because it will throw 2 different exception based on release or debug (ExceptionUtilities.UnexpectedValue)
Assert.ThrowsAny<Exception>(() => validator.SolutionStateEqual(solutionId1, solutionId2));
}
[Fact]
public void MetadataReference_RoundTrip_Test()
{
using var workspace = CreateWorkspace();
var reference = MetadataReference.CreateFromFile(typeof(object).Assembly.Location);
var serializer = workspace.Services.GetService<ISerializerService>();
var assetFromFile = new SolutionAsset(serializer.CreateChecksum(reference, CancellationToken.None), reference);
var assetFromStorage = CloneAsset(serializer, assetFromFile);
_ = CloneAsset(serializer, assetFromStorage);
}
[Fact]
public async Task Workspace_RoundTrip_Test()
{
using var workspace = CreateWorkspace();
var solution = CreateFullSolution(workspace);
var validator = new SerializationValidator(workspace.Services);
var scope1 = await validator.AssetStorage.StoreAssetsAsync(solution, CancellationToken.None).ConfigureAwait(false);
// recover solution from given snapshot
var recovered = await validator.GetSolutionAsync(scope1).ConfigureAwait(false);
var solutionObject1 = await validator.GetValueAsync<SolutionStateChecksums>(scope1.SolutionInfo.SolutionChecksum).ConfigureAwait(false);
// create new snapshot from recovered solution
using var scope2 = await validator.AssetStorage.StoreAssetsAsync(recovered, CancellationToken.None).ConfigureAwait(false);
// verify asset created by recovered solution is good
var solutionObject2 = await validator.GetValueAsync<SolutionStateChecksums>(scope2.SolutionInfo.SolutionChecksum).ConfigureAwait(false);
await validator.VerifyAssetAsync(solutionObject2).ConfigureAwait(false);
// verify snapshots created from original solution and recovered solution are same
validator.SolutionStateEqual(solutionObject1, solutionObject2);
// recover new solution from recovered solution
var roundtrip = await validator.GetSolutionAsync(scope2).ConfigureAwait(false);
// create new snapshot from round tripped solution
using var scope3 = await validator.AssetStorage.StoreAssetsAsync(roundtrip, CancellationToken.None).ConfigureAwait(false);
// verify asset created by rount trip solution is good
var solutionObject3 = await validator.GetValueAsync<SolutionStateChecksums>(scope3.SolutionInfo.SolutionChecksum).ConfigureAwait(false);
await validator.VerifyAssetAsync(solutionObject3).ConfigureAwait(false);
// verify snapshots created from original solution and round trip solution are same.
validator.SolutionStateEqual(solutionObject2, solutionObject3);
}
[Fact]
public async Task Workspace_RoundTrip_Test_Desktop()
{
using var workspace = CreateWorkspace();
var solution = CreateFullSolution(workspace);
var validator = new SerializationValidator(workspace.Services);
var scope1 = await validator.AssetStorage.StoreAssetsAsync(solution, CancellationToken.None).ConfigureAwait(false);
// recover solution from given snapshot
var recovered = await validator.GetSolutionAsync(scope1).ConfigureAwait(false);
var solutionObject1 = await validator.GetValueAsync<SolutionStateChecksums>(scope1.SolutionInfo.SolutionChecksum).ConfigureAwait(false);
// create new snapshot from recovered solution
using var scope2 = await validator.AssetStorage.StoreAssetsAsync(recovered, CancellationToken.None).ConfigureAwait(false);
// verify asset created by recovered solution is good
var solutionObject2 = await validator.GetValueAsync<SolutionStateChecksums>(scope2.SolutionInfo.SolutionChecksum).ConfigureAwait(false);
await validator.VerifyAssetAsync(solutionObject2).ConfigureAwait(false);
// verify snapshots created from original solution and recovered solution are same
validator.SolutionStateEqual(solutionObject1, solutionObject2);
scope1.Dispose();
// recover new solution from recovered solution
var roundtrip = await validator.GetSolutionAsync(scope2).ConfigureAwait(false);
// create new snapshot from round tripped solution
using var scope3 = await validator.AssetStorage.StoreAssetsAsync(roundtrip, CancellationToken.None).ConfigureAwait(false);
// verify asset created by rount trip solution is good
var solutionObject3 = await validator.GetValueAsync<SolutionStateChecksums>(scope3.SolutionInfo.SolutionChecksum).ConfigureAwait(false);
await validator.VerifyAssetAsync(solutionObject3).ConfigureAwait(false);
// verify snapshots created from original solution and round trip solution are same.
validator.SolutionStateEqual(solutionObject2, solutionObject3);
}
[Fact]
public async Task OptionSet_Serialization()
{
using var workspace = CreateWorkspace()
.CurrentSolution.AddProject("Project1", "Project.dll", LanguageNames.CSharp)
.Solution.AddProject("Project2", "Project2.dll", LanguageNames.VisualBasic)
.Solution.Workspace;
await VerifyOptionSetsAsync(workspace, _ => { }).ConfigureAwait(false);
}
[Fact]
public async Task OptionSet_Serialization_CustomValue()
{
using var workspace = CreateWorkspace();
var newQualifyFieldAccessValue = new CodeStyleOption2<bool>(false, NotificationOption2.Error);
var newQualifyMethodAccessValue = new CodeStyleOption2<bool>(true, NotificationOption2.Warning);
var newVarWhenTypeIsApparentValue = new CodeStyleOption2<bool>(false, NotificationOption2.Suggestion);
var newPreferIntrinsicPredefinedTypeKeywordInMemberAccessValue = new CodeStyleOption2<bool>(true, NotificationOption2.Silent);
workspace.TryApplyChanges(workspace.CurrentSolution.WithOptions(workspace.Options
.WithChangedOption(CodeStyleOptions2.QualifyFieldAccess, LanguageNames.CSharp, newQualifyFieldAccessValue)
.WithChangedOption(CodeStyleOptions2.QualifyMethodAccess, LanguageNames.VisualBasic, newQualifyMethodAccessValue)
.WithChangedOption(CSharpCodeStyleOptions.VarWhenTypeIsApparent, newVarWhenTypeIsApparentValue)
.WithChangedOption(CodeStyleOptions2.PreferIntrinsicPredefinedTypeKeywordInMemberAccess, LanguageNames.VisualBasic, newPreferIntrinsicPredefinedTypeKeywordInMemberAccessValue)));
var validator = new SerializationValidator(workspace.Services);
await VerifyOptionSetsAsync(workspace, VerifyOptions).ConfigureAwait(false);
void VerifyOptions(OptionSet options)
{
var actualQualifyFieldAccessValue = options.GetOption(CodeStyleOptions2.QualifyFieldAccess, LanguageNames.CSharp);
Assert.Equal(newQualifyFieldAccessValue, actualQualifyFieldAccessValue);
var actualQualifyMethodAccessValue = options.GetOption(CodeStyleOptions2.QualifyMethodAccess, LanguageNames.VisualBasic);
Assert.Equal(newQualifyMethodAccessValue, actualQualifyMethodAccessValue);
var actualVarWhenTypeIsApparentValue = options.GetOption(CSharpCodeStyleOptions.VarWhenTypeIsApparent);
Assert.Equal(newVarWhenTypeIsApparentValue, actualVarWhenTypeIsApparentValue);
var actualPreferIntrinsicPredefinedTypeKeywordInMemberAccessValue = options.GetOption(CodeStyleOptions2.PreferIntrinsicPredefinedTypeKeywordInMemberAccess, LanguageNames.VisualBasic);
Assert.Equal(newPreferIntrinsicPredefinedTypeKeywordInMemberAccessValue, actualPreferIntrinsicPredefinedTypeKeywordInMemberAccessValue);
}
}
[Fact]
public void Missing_Metadata_Serialization_Test()
{
using var workspace = CreateWorkspace();
var serializer = workspace.Services.GetService<ISerializerService>();
var reference = new MissingMetadataReference();
// make sure this doesn't throw
var assetFromFile = new SolutionAsset(serializer.CreateChecksum(reference, CancellationToken.None), reference);
var assetFromStorage = CloneAsset(serializer, assetFromFile);
_ = CloneAsset(serializer, assetFromStorage);
}
[Fact]
public void Missing_Analyzer_Serialization_Test()
{
using var workspace = CreateWorkspace();
var serializer = workspace.Services.GetService<ISerializerService>();
var reference = new AnalyzerFileReference(Path.Combine(TempRoot.Root, "missing_reference"), new MissingAnalyzerLoader());
// make sure this doesn't throw
var assetFromFile = new SolutionAsset(serializer.CreateChecksum(reference, CancellationToken.None), reference);
var assetFromStorage = CloneAsset(serializer, assetFromFile);
_ = CloneAsset(serializer, assetFromStorage);
}
[Fact]
public void Missing_Analyzer_Serialization_Desktop_Test()
{
using var workspace = CreateWorkspace();
var serializer = workspace.Services.GetService<ISerializerService>();
var reference = new AnalyzerFileReference(Path.Combine(TempRoot.Root, "missing_reference"), new MissingAnalyzerLoader());
// make sure this doesn't throw
var assetFromFile = new SolutionAsset(serializer.CreateChecksum(reference, CancellationToken.None), reference);
var assetFromStorage = CloneAsset(serializer, assetFromFile);
_ = CloneAsset(serializer, assetFromStorage);
}
[Fact]
public void RoundTrip_Analyzer_Serialization_Test()
{
using var tempRoot = new TempRoot();
using var workspace = CreateWorkspace();
var serializer = workspace.Services.GetService<ISerializerService>();
// actually shadow copy content
var location = typeof(object).Assembly.Location;
var file = tempRoot.CreateFile("shadow", "dll");
file.CopyContentFrom(location);
var reference = new AnalyzerFileReference(location, new MockShadowCopyAnalyzerAssemblyLoader(ImmutableDictionary<string, string>.Empty.Add(location, file.Path)));
// make sure this doesn't throw
var assetFromFile = new SolutionAsset(serializer.CreateChecksum(reference, CancellationToken.None), reference);
var assetFromStorage = CloneAsset(serializer, assetFromFile);
_ = CloneAsset(serializer, assetFromStorage);
}
[Fact]
public void RoundTrip_Analyzer_Serialization_Desktop_Test()
{
using var tempRoot = new TempRoot();
using var workspace = CreateWorkspace();
var serializer = workspace.Services.GetService<ISerializerService>();
// actually shadow copy content
var location = typeof(object).Assembly.Location;
var file = tempRoot.CreateFile("shadow", "dll");
file.CopyContentFrom(location);
var reference = new AnalyzerFileReference(location, new MockShadowCopyAnalyzerAssemblyLoader(ImmutableDictionary<string, string>.Empty.Add(location, file.Path)));
// make sure this doesn't throw
var assetFromFile = new SolutionAsset(serializer.CreateChecksum(reference, CancellationToken.None), reference);
var assetFromStorage = CloneAsset(serializer, assetFromFile);
_ = CloneAsset(serializer, assetFromStorage);
}
[Fact]
public void ShadowCopied_Analyzer_Serialization_Desktop_Test()
{
using var tempRoot = new TempRoot();
using var workspace = CreateWorkspace();
var reference = CreateShadowCopiedAnalyzerReference(tempRoot);
var serializer = workspace.Services.GetService<ISerializerService>();
// make sure this doesn't throw
var assetFromFile = new SolutionAsset(serializer.CreateChecksum(reference, CancellationToken.None), reference);
// this will verify serialized analyzer reference return same checksum as the original one
_ = CloneAsset(serializer, assetFromFile);
}
[Fact]
[WorkItem(1107294, "https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1107294")]
public async Task SnapshotWithIdenticalAnalyzerFiles()
{
using var workspace = CreateWorkspace();
var project = workspace.CurrentSolution.AddProject("Project", "Project.dll", LanguageNames.CSharp);
using var temp = new TempRoot();
var dir = temp.CreateDirectory();
// create two analyzer assembly files whose content is identical but path is different:
var file1 = dir.CreateFile("analyzer1.dll").CopyContentFrom(_testFixture.FaultyAnalyzer.Path);
var file2 = dir.CreateFile("analyzer2.dll").CopyContentFrom(_testFixture.FaultyAnalyzer.Path);
var analyzer1 = new AnalyzerFileReference(file1.Path, TestAnalyzerAssemblyLoader.LoadNotImplemented);
var analyzer2 = new AnalyzerFileReference(file2.Path, TestAnalyzerAssemblyLoader.LoadNotImplemented);
project = project.AddAnalyzerReferences(new[] { analyzer1, analyzer2 });
var validator = new SerializationValidator(workspace.Services);
using var snapshot = await validator.AssetStorage.StoreAssetsAsync(project.Solution, CancellationToken.None).ConfigureAwait(false);
var recovered = await validator.GetSolutionAsync(snapshot).ConfigureAwait(false);
AssertEx.Equal(new[] { file1.Path, file2.Path }, recovered.GetProject(project.Id).AnalyzerReferences.Select(r => r.FullPath));
}
[Fact]
public async Task SnapshotWithMissingReferencesTest()
{
using var workspace = CreateWorkspace();
var project = workspace.CurrentSolution.AddProject("Project", "Project.dll", LanguageNames.CSharp);
var metadata = new MissingMetadataReference();
var analyzer = new AnalyzerFileReference(Path.Combine(TempRoot.Root, "missing_reference"), new MissingAnalyzerLoader());
project = project.AddMetadataReference(metadata);
project = project.AddAnalyzerReference(analyzer);
var validator = new SerializationValidator(workspace.Services);
using var snapshot = await validator.AssetStorage.StoreAssetsAsync(project.Solution, CancellationToken.None).ConfigureAwait(false);
// this shouldn't throw
var recovered = await validator.GetSolutionAsync(snapshot).ConfigureAwait(false);
}
[Fact]
public async Task UnknownLanguageTest()
{
using var workspace = CreateWorkspace(new[] { typeof(NoCompilationLanguageServiceFactory) });
var project = workspace.CurrentSolution.AddProject("Project", "Project.dll", NoCompilationConstants.LanguageName);
var validator = new SerializationValidator(workspace.Services);
using var snapshot = await validator.AssetStorage.StoreAssetsAsync(project.Solution, CancellationToken.None).ConfigureAwait(false);
// this shouldn't throw
var recovered = await validator.GetSolutionAsync(snapshot).ConfigureAwait(false);
}
[Fact, WorkItem(44791, "https://github.com/dotnet/roslyn/issues/44791")]
public async Task UnknownLanguageOptionsTest()
{
using var workspace = CreateWorkspace(new[] { typeof(NoCompilationLanguageServiceFactory) });
var project = workspace.CurrentSolution.AddProject("Project", "Project.dll", NoCompilationConstants.LanguageName)
.Solution.AddProject("Project2", "Project2.dll", LanguageNames.CSharp);
workspace.TryApplyChanges(project.Solution);
await VerifyOptionSetsAsync(workspace, verifyOptionValues: _ => { });
}
[Fact]
public async Task EmptyAssetChecksumTest()
{
var document = CreateWorkspace().CurrentSolution.AddProject("empty", "empty", LanguageNames.CSharp).AddDocument("empty", SourceText.From(""));
var serializer = document.Project.Solution.Workspace.Services.GetService<ISerializerService>();
var source = serializer.CreateChecksum(await document.GetTextAsync().ConfigureAwait(false), CancellationToken.None);
var metadata = serializer.CreateChecksum(new MissingMetadataReference(), CancellationToken.None);
var analyzer = serializer.CreateChecksum(new AnalyzerFileReference(Path.Combine(TempRoot.Root, "missing"), new MissingAnalyzerLoader()), CancellationToken.None);
Assert.NotEqual(source, metadata);
Assert.NotEqual(source, analyzer);
Assert.NotEqual(metadata, analyzer);
}
[Fact]
public async Task VBParseOptionsInCompilationOptions()
{
var project = CreateWorkspace().CurrentSolution.AddProject("empty", "empty", LanguageNames.VisualBasic);
project = project.WithCompilationOptions(
((VisualBasic.VisualBasicCompilationOptions)project.CompilationOptions).WithParseOptions((VisualBasic.VisualBasicParseOptions)project.ParseOptions));
var checksum = await project.State.GetChecksumAsync(CancellationToken.None).ConfigureAwait(false);
Assert.NotNull(checksum);
}
[Fact]
public async Task TestMetadataXmlDocComment()
{
using var tempRoot = new TempRoot();
// get original assembly location
var mscorlibLocation = typeof(object).Assembly.Location;
// set up dll and xml doc content
var tempDir = tempRoot.CreateDirectory();
var tempCorlib = tempDir.CopyFile(mscorlibLocation);
var tempCorlibXml = tempDir.CreateFile(Path.ChangeExtension(tempCorlib.Path, "xml"));
tempCorlibXml.WriteAllText(@"<?xml version=""1.0"" encoding=""utf-8""?>
<doc>
<assembly>
<name>mscorlib</name>
</assembly>
<members>
<member name=""T:System.Object"">
<summary>Supports all classes in the .NET Framework class hierarchy and provides low-level services to derived classes. This is the ultimate base class of all classes in the .NET Framework; it is the root of the type hierarchy.To browse the .NET Framework source code for this type, see the Reference Source.</summary>
</member>
</members>
</doc>");
using var workspace = CreateWorkspace();
var solution = workspace.CurrentSolution
.AddProject("Project", "Project.dll", LanguageNames.CSharp)
.AddMetadataReference(MetadataReference.CreateFromFile(tempCorlib.Path))
.Solution;
var validator = new SerializationValidator(workspace.Services);
using var scope = await validator.AssetStorage.StoreAssetsAsync(solution, CancellationToken.None);
// recover solution from given snapshot
var recovered = await validator.GetSolutionAsync(scope);
var compilation = await recovered.Projects.First().GetCompilationAsync(CancellationToken.None);
var objectType = compilation.GetTypeByMetadataName("System.Object");
var xmlDocComment = objectType.GetDocumentationCommentXml();
Assert.False(string.IsNullOrEmpty(xmlDocComment));
}
[Fact]
public void TestEncodingSerialization()
{
using var workspace = CreateWorkspace();
var serializer = workspace.Services.GetService<ISerializerService>();
// test with right serializable encoding
var sourceText = SourceText.From("Hello", Encoding.UTF8);
using (var stream = SerializableBytes.CreateWritableStream())
{
using var context = SolutionReplicationContext.Create();
using (var objectWriter = new ObjectWriter(stream, leaveOpen: true))
{
serializer.Serialize(sourceText, objectWriter, context, CancellationToken.None);
}
stream.Position = 0;
using var objectReader = ObjectReader.TryGetReader(stream);
var newText = serializer.Deserialize<SourceText>(sourceText.GetWellKnownSynchronizationKind(), objectReader, CancellationToken.None);
Assert.Equal(sourceText.ToString(), newText.ToString());
}
// test with wrong encoding that doesn't support serialization
sourceText = SourceText.From("Hello", new NotSerializableEncoding());
using (var stream = SerializableBytes.CreateWritableStream())
{
using var context = SolutionReplicationContext.Create();
using (var objectWriter = new ObjectWriter(stream, leaveOpen: true))
{
serializer.Serialize(sourceText, objectWriter, context, CancellationToken.None);
}
stream.Position = 0;
using var objectReader = ObjectReader.TryGetReader(stream);
var newText = serializer.Deserialize<SourceText>(sourceText.GetWellKnownSynchronizationKind(), objectReader, CancellationToken.None);
Assert.Equal(sourceText.ToString(), newText.ToString());
}
}
[Fact]
public void TestCompilationOptions_NullableAndImport()
{
var csharpOptions = CSharp.CSharpCompilation.Create("dummy").Options.WithNullableContextOptions(NullableContextOptions.Warnings).WithMetadataImportOptions(MetadataImportOptions.All);
var vbOptions = VisualBasic.VisualBasicCompilation.Create("dummy").Options.WithMetadataImportOptions(MetadataImportOptions.Internal);
using var workspace = CreateWorkspace();
var serializer = workspace.Services.GetService<ISerializerService>();
VerifyOptions(csharpOptions);
VerifyOptions(vbOptions);
void VerifyOptions(CompilationOptions originalOptions)
{
using var stream = SerializableBytes.CreateWritableStream();
using var context = SolutionReplicationContext.Create();
using (var objectWriter = new ObjectWriter(stream, leaveOpen: true))
{
serializer.Serialize(originalOptions, objectWriter, context, CancellationToken.None);
}
stream.Position = 0;
using var objectReader = ObjectReader.TryGetReader(stream);
var recoveredOptions = serializer.Deserialize<CompilationOptions>(originalOptions.GetWellKnownSynchronizationKind(), objectReader, CancellationToken.None);
var original = serializer.CreateChecksum(originalOptions, CancellationToken.None);
var recovered = serializer.CreateChecksum(recoveredOptions, CancellationToken.None);
Assert.Equal(original, recovered);
}
}
private static async Task VerifyOptionSetsAsync(Workspace workspace, Action<OptionSet> verifyOptionValues)
{
var solution = workspace.CurrentSolution;
verifyOptionValues(workspace.Options);
verifyOptionValues(solution.Options);
var validator = new SerializationValidator(workspace.Services);
using var scope = await validator.AssetStorage.StoreAssetsAsync(solution, CancellationToken.None).ConfigureAwait(false);
var checksum = scope.SolutionInfo.SolutionChecksum;
var solutionObject = await validator.GetValueAsync<SolutionStateChecksums>(checksum).ConfigureAwait(false);
await validator.VerifyChecksumInServiceAsync(solutionObject.Attributes, WellKnownSynchronizationKind.SolutionAttributes);
await validator.VerifyChecksumInServiceAsync(solutionObject.Options, WellKnownSynchronizationKind.OptionSet);
var recoveredSolution = await validator.GetSolutionAsync(scope);
// option should be exactly same
Assert.Equal(0, recoveredSolution.Options.GetChangedOptions(workspace.Options).Count());
verifyOptionValues(workspace.Options);
verifyOptionValues(recoveredSolution.Options);
// checksum for recovered solution should be the same.
using var recoveredScope = await validator.AssetStorage.StoreAssetsAsync(recoveredSolution, CancellationToken.None).ConfigureAwait(false);
var recoveredChecksum = recoveredScope.SolutionInfo.SolutionChecksum;
Assert.Equal(checksum, recoveredChecksum);
}
private static SolutionAsset CloneAsset(ISerializerService serializer, SolutionAsset asset)
{
using var stream = SerializableBytes.CreateWritableStream();
using var context = SolutionReplicationContext.Create();
using (var writer = new ObjectWriter(stream, leaveOpen: true))
{
serializer.Serialize(asset.Value, writer, context, CancellationToken.None);
}
stream.Position = 0;
using var reader = ObjectReader.TryGetReader(stream);
var recovered = serializer.Deserialize<object>(asset.Kind, reader, CancellationToken.None);
var assetFromStorage = new SolutionAsset(serializer.CreateChecksum(recovered, CancellationToken.None), recovered);
Assert.Equal(asset.Checksum, assetFromStorage.Checksum);
return assetFromStorage;
}
private static AnalyzerFileReference CreateShadowCopiedAnalyzerReference(TempRoot tempRoot)
{
// use 2 different files as shadow copied content
var original = typeof(AdhocWorkspace).Assembly.Location;
var shadow = tempRoot.CreateFile("shadow", "dll");
shadow.CopyContentFrom(typeof(object).Assembly.Location);
return new AnalyzerFileReference(original, new MockShadowCopyAnalyzerAssemblyLoader(ImmutableDictionary<string, string>.Empty.Add(original, shadow.Path)));
}
private class MissingAnalyzerLoader : AnalyzerAssemblyLoader
{
protected override Assembly LoadFromPathImpl(string fullPath)
=> throw new FileNotFoundException(fullPath);
}
private class MissingMetadataReference : PortableExecutableReference
{
public MissingMetadataReference()
: base(MetadataReferenceProperties.Assembly, "missing_reference", XmlDocumentationProvider.Default)
{
}
protected override DocumentationProvider CreateDocumentationProvider()
=> null;
protected override Metadata GetMetadataImpl()
=> throw new FileNotFoundException("can't find");
protected override PortableExecutableReference WithPropertiesImpl(MetadataReferenceProperties properties)
=> this;
}
private class MockShadowCopyAnalyzerAssemblyLoader : IAnalyzerAssemblyLoader
{
private readonly ImmutableDictionary<string, string> _map;
public MockShadowCopyAnalyzerAssemblyLoader(ImmutableDictionary<string, string> map)
=> _map = map;
public void AddDependencyLocation(string fullPath)
{
}
public Assembly LoadFromPath(string fullPath)
=> Assembly.LoadFrom(_map[fullPath]);
}
private class NotSerializableEncoding : Encoding
{
private readonly Encoding _real = Encoding.UTF8;
public override string WebName => _real.WebName;
public override int GetByteCount(char[] chars, int index, int count) => _real.GetByteCount(chars, index, count);
public override int GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex) => GetBytes(chars, charIndex, charCount, bytes, byteIndex);
public override int GetCharCount(byte[] bytes, int index, int count) => GetCharCount(bytes, index, count);
public override int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex) => GetChars(bytes, byteIndex, byteCount, chars, charIndex);
public override int GetMaxByteCount(int charCount) => GetMaxByteCount(charCount);
public override int GetMaxCharCount(int byteCount) => GetMaxCharCount(byteCount);
}
}
}
| 1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/VisualStudio/Core/Test/ProjectSystemShim/VisualStudioAnalyzerTests.vb | ' 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.
Imports System.IO
Imports System.Reflection
Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.Diagnostics
Imports Microsoft.CodeAnalysis.Editor.UnitTests
Imports Microsoft.CodeAnalysis.Editor.UnitTests.Diagnostics
Imports Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces
Imports Microsoft.CodeAnalysis.Test.Utilities
Imports Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem
Imports Microsoft.VisualStudio.LanguageServices.Implementation.TaskList
Imports Roslyn.Test.Utilities
Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.ProjectSystemShim
<UseExportProvider>
Public Class VisualStudioAnalyzerTests
Private Shared ReadOnly s_compositionWithMockDiagnosticUpdateSourceRegistrationService As TestComposition = EditorTestCompositions.EditorFeatures _
.AddExcludedPartTypes(GetType(IDiagnosticUpdateSourceRegistrationService)) _
.AddParts(GetType(MockDiagnosticUpdateSourceRegistrationService))
<WpfFact, Trait(Traits.Feature, Traits.Features.Diagnostics)>
Public Sub GetReferenceCalledMultipleTimes()
Dim composition = s_compositionWithMockDiagnosticUpdateSourceRegistrationService
Dim exportProvider = composition.ExportProviderFactory.CreateExportProvider()
Using workspace = New TestWorkspace(composition:=composition)
Dim lazyWorkspace = New Lazy(Of VisualStudioWorkspaceImpl)(
Function()
Return Nothing
End Function)
Dim registrationService = Assert.IsType(Of MockDiagnosticUpdateSourceRegistrationService)(exportProvider.GetExportedValue(Of IDiagnosticUpdateSourceRegistrationService)())
Dim hostDiagnosticUpdateSource = New HostDiagnosticUpdateSource(lazyWorkspace, registrationService)
Using analyzer = New VisualStudioAnalyzer("C:\Goo\Bar.dll", hostDiagnosticUpdateSource, ProjectId.CreateNewId(), LanguageNames.VisualBasic)
Dim reference1 = analyzer.GetReference()
Dim reference2 = analyzer.GetReference()
Assert.True(Object.ReferenceEquals(reference1, reference2))
End Using
End Using
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.Diagnostics)>
Public Sub AnalyzerErrorsAreUpdated()
Dim composition = s_compositionWithMockDiagnosticUpdateSourceRegistrationService
Dim exportProvider = composition.ExportProviderFactory.CreateExportProvider()
Dim lazyWorkspace = New Lazy(Of VisualStudioWorkspaceImpl)(
Function()
Return Nothing
End Function)
Dim registrationService = Assert.IsType(Of MockDiagnosticUpdateSourceRegistrationService)(exportProvider.GetExportedValue(Of IDiagnosticUpdateSourceRegistrationService)())
Dim hostDiagnosticUpdateSource = New HostDiagnosticUpdateSource(lazyWorkspace, registrationService)
Dim file = Path.GetTempFileName()
Using workspace = New TestWorkspace(composition:=composition)
Dim eventHandler = New EventHandlers(file, workspace)
AddHandler hostDiagnosticUpdateSource.DiagnosticsUpdated, AddressOf eventHandler.DiagnosticAddedTest
Using analyzer = New VisualStudioAnalyzer(file, hostDiagnosticUpdateSource, ProjectId.CreateNewId(), LanguageNames.VisualBasic)
Dim reference = analyzer.GetReference()
reference.GetAnalyzers(LanguageNames.VisualBasic)
RemoveHandler hostDiagnosticUpdateSource.DiagnosticsUpdated, AddressOf eventHandler.DiagnosticAddedTest
AddHandler hostDiagnosticUpdateSource.DiagnosticsUpdated, AddressOf eventHandler.DiagnosticRemovedTest
End Using
IO.File.Delete(file)
End Using
End Sub
Private Class EventHandlers
Public File As String
Private ReadOnly _workspace As Workspace
Public Sub New(file As String, workspace As Workspace)
Me.File = file
_workspace = workspace
End Sub
Public Sub DiagnosticAddedTest(o As Object, e As DiagnosticsUpdatedArgs)
Dim diagnostics = e.GetPushDiagnostics(_workspace, InternalDiagnosticsOptions.NormalDiagnosticMode)
Assert.Equal(1, diagnostics.Length)
Dim diagnostic As DiagnosticData = diagnostics.First()
Assert.Equal("BC42378", diagnostic.Id)
Assert.Contains(File, diagnostic.Message, StringComparison.Ordinal)
End Sub
Public Sub DiagnosticRemovedTest(o As Object, e As DiagnosticsUpdatedArgs)
Dim diagnostics = e.GetPushDiagnostics(_workspace, InternalDiagnosticsOptions.NormalDiagnosticMode)
Assert.Equal(0, diagnostics.Length)
End Sub
End Class
Private Class MockAnalyzerAssemblyLoader
Implements IAnalyzerAssemblyLoader
Public Sub AddDependencyLocation(fullPath As String) Implements IAnalyzerAssemblyLoader.AddDependencyLocation
Throw New NotImplementedException()
End Sub
Public Function LoadFromPath(fullPath As String) As Assembly Implements IAnalyzerAssemblyLoader.LoadFromPath
Throw New NotImplementedException()
End Function
End Class
End Class
End Namespace
| ' 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.
Imports System.IO
Imports System.Reflection
Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.Diagnostics
Imports Microsoft.CodeAnalysis.Editor.UnitTests
Imports Microsoft.CodeAnalysis.Editor.UnitTests.Diagnostics
Imports Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces
Imports Microsoft.CodeAnalysis.Test.Utilities
Imports Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem
Imports Microsoft.VisualStudio.LanguageServices.Implementation.TaskList
Imports Roslyn.Test.Utilities
Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.ProjectSystemShim
<UseExportProvider>
Public Class VisualStudioAnalyzerTests
Private Shared ReadOnly s_compositionWithMockDiagnosticUpdateSourceRegistrationService As TestComposition = EditorTestCompositions.EditorFeatures _
.AddExcludedPartTypes(GetType(IDiagnosticUpdateSourceRegistrationService)) _
.AddParts(GetType(MockDiagnosticUpdateSourceRegistrationService))
<WpfFact, Trait(Traits.Feature, Traits.Features.Diagnostics)>
Public Sub GetReferenceCalledMultipleTimes()
Dim composition = s_compositionWithMockDiagnosticUpdateSourceRegistrationService
Dim exportProvider = composition.ExportProviderFactory.CreateExportProvider()
Using workspace = New TestWorkspace(composition:=composition)
Dim lazyWorkspace = New Lazy(Of VisualStudioWorkspaceImpl)(
Function()
Return Nothing
End Function)
Dim registrationService = Assert.IsType(Of MockDiagnosticUpdateSourceRegistrationService)(exportProvider.GetExportedValue(Of IDiagnosticUpdateSourceRegistrationService)())
Dim hostDiagnosticUpdateSource = New HostDiagnosticUpdateSource(lazyWorkspace, registrationService)
Using tempRoot = New TempRoot(), analyzer = New VisualStudioAnalyzer(tempRoot.CreateFile().Path, hostDiagnosticUpdateSource, ProjectId.CreateNewId(), LanguageNames.VisualBasic)
Dim reference1 = analyzer.GetReference()
Dim reference2 = analyzer.GetReference()
Assert.True(Object.ReferenceEquals(reference1, reference2))
End Using
End Using
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.Diagnostics)>
Public Sub AnalyzerErrorsAreUpdated()
Dim composition = s_compositionWithMockDiagnosticUpdateSourceRegistrationService
Dim exportProvider = composition.ExportProviderFactory.CreateExportProvider()
Dim lazyWorkspace = New Lazy(Of VisualStudioWorkspaceImpl)(
Function()
Return Nothing
End Function)
Dim registrationService = Assert.IsType(Of MockDiagnosticUpdateSourceRegistrationService)(exportProvider.GetExportedValue(Of IDiagnosticUpdateSourceRegistrationService)())
Dim hostDiagnosticUpdateSource = New HostDiagnosticUpdateSource(lazyWorkspace, registrationService)
Dim file = Path.GetTempFileName()
Using workspace = New TestWorkspace(composition:=composition)
Dim eventHandler = New EventHandlers(file, workspace)
AddHandler hostDiagnosticUpdateSource.DiagnosticsUpdated, AddressOf eventHandler.DiagnosticAddedTest
Using analyzer = New VisualStudioAnalyzer(file, hostDiagnosticUpdateSource, ProjectId.CreateNewId(), LanguageNames.VisualBasic)
Dim reference = analyzer.GetReference()
reference.GetAnalyzers(LanguageNames.VisualBasic)
RemoveHandler hostDiagnosticUpdateSource.DiagnosticsUpdated, AddressOf eventHandler.DiagnosticAddedTest
AddHandler hostDiagnosticUpdateSource.DiagnosticsUpdated, AddressOf eventHandler.DiagnosticRemovedTest
End Using
IO.File.Delete(file)
End Using
End Sub
Private Class EventHandlers
Public File As String
Private ReadOnly _workspace As Workspace
Public Sub New(file As String, workspace As Workspace)
Me.File = file
_workspace = workspace
End Sub
Public Sub DiagnosticAddedTest(o As Object, e As DiagnosticsUpdatedArgs)
Dim diagnostics = e.GetPushDiagnostics(_workspace, InternalDiagnosticsOptions.NormalDiagnosticMode)
Assert.Equal(1, diagnostics.Length)
Dim diagnostic As DiagnosticData = diagnostics.First()
Assert.Equal("BC42378", diagnostic.Id)
Assert.Contains(File, diagnostic.Message, StringComparison.Ordinal)
End Sub
Public Sub DiagnosticRemovedTest(o As Object, e As DiagnosticsUpdatedArgs)
Dim diagnostics = e.GetPushDiagnostics(_workspace, InternalDiagnosticsOptions.NormalDiagnosticMode)
Assert.Equal(0, diagnostics.Length)
End Sub
End Class
Private Class MockAnalyzerAssemblyLoader
Implements IAnalyzerAssemblyLoader
Public Sub AddDependencyLocation(fullPath As String) Implements IAnalyzerAssemblyLoader.AddDependencyLocation
Throw New NotImplementedException()
End Sub
Public Function LoadFromPath(fullPath As String) As Assembly Implements IAnalyzerAssemblyLoader.LoadFromPath
Throw New NotImplementedException()
End Function
End Class
End Class
End Namespace
| 1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Workspaces/Remote/ServiceHub/Host/RemoteAnalyzerAssemblyLoaderService.cs | // 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.Composition;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Host.Mef;
namespace Microsoft.CodeAnalysis.Remote.Diagnostics
{
/// <summary>
/// Customizes the path where to store shadow-copies of analyzer assemblies.
/// </summary>
[ExportWorkspaceService(typeof(IAnalyzerAssemblyLoaderProvider), WorkspaceKind.RemoteWorkspace), Shared]
internal sealed class RemoteAnalyzerAssemblyLoaderService : IAnalyzerAssemblyLoaderProvider
{
private readonly RemoteAnalyzerAssemblyLoader _loader;
private readonly ShadowCopyAnalyzerAssemblyLoader _shadowCopyLoader;
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public RemoteAnalyzerAssemblyLoaderService()
{
var baseDirectory = Path.GetDirectoryName(Path.GetFullPath(typeof(RemoteAnalyzerAssemblyLoader).GetTypeInfo().Assembly.Location));
Debug.Assert(baseDirectory != null);
_loader = new(baseDirectory);
_shadowCopyLoader = new(Path.Combine(Path.GetTempPath(), "VS", "AnalyzerAssemblyLoader"));
}
public IAnalyzerAssemblyLoader GetLoader(in AnalyzerAssemblyLoaderOptions options)
=> options.ShadowCopy ? _shadowCopyLoader : _loader;
// For analyzers shipped in Roslyn, different set of assemblies might be used when running
// in-proc and OOP e.g. in-proc (VS) running on desktop clr and OOP running on ServiceHub .Net6
// host. We need to make sure to use the ones from the same location as the remote.
private class RemoteAnalyzerAssemblyLoader : DefaultAnalyzerAssemblyLoader
{
private readonly string _baseDirectory;
protected override Assembly LoadImpl(string fullPath)
=> base.LoadImpl(FixPath(fullPath));
public RemoteAnalyzerAssemblyLoader(string baseDirectory)
{
_baseDirectory = baseDirectory;
}
private string FixPath(string fullPath)
{
var fixedPath = Path.GetFullPath(Path.Combine(_baseDirectory, Path.GetFileName(fullPath)));
return File.Exists(fixedPath) ? fixedPath : fullPath;
}
}
}
}
| // 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.Composition;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Host.Mef;
namespace Microsoft.CodeAnalysis.Remote.Diagnostics
{
/// <summary>
/// Customizes the path where to store shadow-copies of analyzer assemblies.
/// </summary>
[ExportWorkspaceService(typeof(IAnalyzerAssemblyLoaderProvider), WorkspaceKind.RemoteWorkspace), Shared]
internal sealed class RemoteAnalyzerAssemblyLoaderService : IAnalyzerAssemblyLoaderProvider
{
private readonly RemoteAnalyzerAssemblyLoader _loader;
private readonly ShadowCopyAnalyzerAssemblyLoader _shadowCopyLoader;
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public RemoteAnalyzerAssemblyLoaderService()
{
var baseDirectory = Path.GetDirectoryName(Path.GetFullPath(typeof(RemoteAnalyzerAssemblyLoader).GetTypeInfo().Assembly.Location));
Debug.Assert(baseDirectory != null);
_loader = new(baseDirectory);
_shadowCopyLoader = new(Path.Combine(Path.GetTempPath(), "VS", "AnalyzerAssemblyLoader"));
}
public IAnalyzerAssemblyLoader GetLoader(in AnalyzerAssemblyLoaderOptions options)
=> options.ShadowCopy ? _shadowCopyLoader : _loader;
// For analyzers shipped in Roslyn, different set of assemblies might be used when running
// in-proc and OOP e.g. in-proc (VS) running on desktop clr and OOP running on ServiceHub .Net6
// host. We need to make sure to use the ones from the same location as the remote.
private sealed class RemoteAnalyzerAssemblyLoader : DefaultAnalyzerAssemblyLoader
{
private readonly string _baseDirectory;
public RemoteAnalyzerAssemblyLoader(string baseDirectory)
{
_baseDirectory = baseDirectory;
}
protected override string GetPathToLoad(string fullPath)
{
var fixedPath = Path.GetFullPath(Path.Combine(_baseDirectory, Path.GetFileName(fullPath)));
return File.Exists(fixedPath) ? fixedPath : fullPath;
}
}
}
}
| 1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/EditorFeatures/CSharpTest/InlineMethod/CSharpInlineMethodTests_CrossLanguage.cs | // 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.
#nullable disable
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeRefactorings;
using Microsoft.CodeAnalysis.CSharp.CodeRefactorings.InlineMethod;
using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.CodeRefactorings;
using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces;
using Microsoft.CodeAnalysis.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.InlineMethod
{
[Trait(Traits.Feature, Traits.Features.CodeActionsInlineMethod)]
public class CSharpInlineMethodTests_CrossLanguage : AbstractCSharpCodeActionTest
{
protected override CodeRefactoringProvider CreateCodeRefactoringProvider(Workspace workspace, TestParameters parameters)
=> ((TestWorkspace)workspace).ExportProvider.GetExportedValue<CSharpInlineMethodRefactoringProvider>();
private async Task TestNoActionIsProvided(string initialMarkup)
{
var workspace = CreateWorkspaceFromOptions(initialMarkup, default);
var (actions, _) = await GetCodeActionsAsync(workspace, default).ConfigureAwait(false);
Assert.True(actions.IsEmpty);
}
// Because this issue: https://github.com/dotnet/roslyn-sdk/issues/464
// it is hard to test cross language scenario.
// After it is resolved then this test should be merged to the other test class
[Fact]
public async Task TestCrossLanguageInline()
{
var input = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""CSAssembly"" CommonReferences=""true"">
<ProjectReference>VBAssembly</ProjectReference>
<Document>
using VBAssembly;
public class TestClass
{
public void Caller()
{
var x = new VBClass();
x.C[||]allee();
}
}
</Document>
</Project>
<Project Language=""Visual Basic"" AssemblyName=""VBAssembly"" CommonReferences=""true"">
<Document>
Public Class VBClass
Private Sub Callee()
End Sub
End Class
</Document>
</Project>
</Workspace>";
await TestNoActionIsProvided(input);
}
}
}
| // 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.
#nullable disable
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeRefactorings;
using Microsoft.CodeAnalysis.CSharp.CodeRefactorings.InlineMethod;
using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.CodeRefactorings;
using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces;
using Microsoft.CodeAnalysis.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.InlineMethod
{
[Trait(Traits.Feature, Traits.Features.CodeActionsInlineMethod)]
public class CSharpInlineMethodTests_CrossLanguage : AbstractCSharpCodeActionTest
{
protected override CodeRefactoringProvider CreateCodeRefactoringProvider(Workspace workspace, TestParameters parameters)
=> ((TestWorkspace)workspace).ExportProvider.GetExportedValue<CSharpInlineMethodRefactoringProvider>();
private async Task TestNoActionIsProvided(string initialMarkup)
{
var workspace = CreateWorkspaceFromOptions(initialMarkup, default);
var (actions, _) = await GetCodeActionsAsync(workspace, default).ConfigureAwait(false);
Assert.True(actions.IsEmpty);
}
// Because this issue: https://github.com/dotnet/roslyn-sdk/issues/464
// it is hard to test cross language scenario.
// After it is resolved then this test should be merged to the other test class
[Fact]
public async Task TestCrossLanguageInline()
{
var input = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""CSAssembly"" CommonReferences=""true"">
<ProjectReference>VBAssembly</ProjectReference>
<Document>
using VBAssembly;
public class TestClass
{
public void Caller()
{
var x = new VBClass();
x.C[||]allee();
}
}
</Document>
</Project>
<Project Language=""Visual Basic"" AssemblyName=""VBAssembly"" CommonReferences=""true"">
<Document>
Public Class VBClass
Private Sub Callee()
End Sub
End Class
</Document>
</Project>
</Workspace>";
await TestNoActionIsProvided(input);
}
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Features/CSharp/Portable/Formatting/CSharpNewDocumentFormattingService.cs | // 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.Collections.Generic;
using System.Composition;
using System.Linq;
using Microsoft.CodeAnalysis.Formatting;
using Microsoft.CodeAnalysis.Host.Mef;
namespace Microsoft.CodeAnalysis.CSharp.Formatting
{
[ExportLanguageService(typeof(INewDocumentFormattingService), LanguageNames.CSharp)]
[Shared]
internal class CSharpNewDocumentFormattingService : AbstractNewDocumentFormattingService
{
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public CSharpNewDocumentFormattingService([ImportMany] IEnumerable<Lazy<INewDocumentFormattingProvider, LanguageMetadata>> providers)
: base(providers)
{
}
protected override string Language => LanguageNames.CSharp;
}
}
| // 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.Collections.Generic;
using System.Composition;
using System.Linq;
using Microsoft.CodeAnalysis.Formatting;
using Microsoft.CodeAnalysis.Host.Mef;
namespace Microsoft.CodeAnalysis.CSharp.Formatting
{
[ExportLanguageService(typeof(INewDocumentFormattingService), LanguageNames.CSharp)]
[Shared]
internal class CSharpNewDocumentFormattingService : AbstractNewDocumentFormattingService
{
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public CSharpNewDocumentFormattingService([ImportMany] IEnumerable<Lazy<INewDocumentFormattingProvider, LanguageMetadata>> providers)
: base(providers)
{
}
protected override string Language => LanguageNames.CSharp;
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/EditorFeatures/CSharpTest2/Recommendations/ShortKeywordRecommenderTests.cs | // 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.
#nullable disable
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Completion.Providers;
using Microsoft.CodeAnalysis.Test.Utilities;
using Roslyn.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Recommendations
{
public class ShortKeywordRecommenderTests : KeywordRecommenderTests
{
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAtRoot_Interactive()
{
await VerifyKeywordAsync(SourceCodeKind.Script,
@"$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterClass_Interactive()
{
await VerifyKeywordAsync(SourceCodeKind.Script,
@"class C { }
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterGlobalStatement_Interactive()
{
await VerifyKeywordAsync(SourceCodeKind.Script,
@"System.Console.WriteLine();
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterGlobalVariableDeclaration_Interactive()
{
await VerifyKeywordAsync(SourceCodeKind.Script,
@"int i = 0;
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotInUsingAlias()
{
await VerifyAbsenceAsync(
@"using Goo = $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotInGlobalUsingAlias()
{
await VerifyAbsenceAsync(
@"global using Goo = $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterStackAlloc()
{
await VerifyKeywordAsync(
@"class C {
int* goo = stackalloc $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInFixedStatement()
{
await VerifyKeywordAsync(
@"fixed ($$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInDelegateReturnType()
{
await VerifyKeywordAsync(
@"public delegate $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInCastType()
{
await VerifyKeywordAsync(AddInsideMethod(
@"var str = (($$"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInCastType2()
{
await VerifyKeywordAsync(AddInsideMethod(
@"var str = (($$)items) as string;"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterConstInMemberContext()
{
await VerifyKeywordAsync(
@"class C {
const $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterRefInMemberContext()
{
await VerifyKeywordAsync(
@"class C {
ref $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterRefReadonlyInMemberContext()
{
await VerifyKeywordAsync(
@"class C {
ref readonly $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterConstInStatementContext()
{
await VerifyKeywordAsync(AddInsideMethod(
@"const $$"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterRefInStatementContext()
{
await VerifyKeywordAsync(AddInsideMethod(
@"ref $$"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterRefReadonlyInStatementContext()
{
await VerifyKeywordAsync(AddInsideMethod(
@"ref readonly $$"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterConstLocalDeclaration()
{
await VerifyKeywordAsync(AddInsideMethod(
@"const $$ int local;"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterRefLocalDeclaration()
{
await VerifyKeywordAsync(AddInsideMethod(
@"ref $$ int local;"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterRefReadonlyLocalDeclaration()
{
await VerifyKeywordAsync(AddInsideMethod(
@"ref readonly $$ int local;"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterRefLocalFunction()
{
await VerifyKeywordAsync(AddInsideMethod(
@"ref $$ int Function();"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterRefReadonlyLocalFunction()
{
await VerifyKeywordAsync(AddInsideMethod(
@"ref readonly $$ int Function();"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterRefExpression()
{
await VerifyKeywordAsync(AddInsideMethod(
@"ref int x = ref $$"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInEmptyStatement()
{
await VerifyKeywordAsync(AddInsideMethod(
@"$$"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestEnumBaseTypes()
{
await VerifyKeywordAsync(
@"enum E : $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInGenericType1()
{
await VerifyKeywordAsync(AddInsideMethod(
@"IList<$$"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInGenericType2()
{
await VerifyKeywordAsync(AddInsideMethod(
@"IList<int,$$"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInGenericType3()
{
await VerifyKeywordAsync(AddInsideMethod(
@"IList<int[],$$"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInGenericType4()
{
await VerifyKeywordAsync(AddInsideMethod(
@"IList<IGoo<int?,byte*>,$$"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotInBaseList()
{
await VerifyAbsenceAsync(
@"class C : $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInGenericType_InBaseList()
{
await VerifyKeywordAsync(
@"class C : IList<$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterIs()
{
await VerifyKeywordAsync(AddInsideMethod(
@"var v = goo is $$"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterAs()
{
await VerifyKeywordAsync(AddInsideMethod(
@"var v = goo as $$"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterMethod()
{
await VerifyKeywordAsync(
@"class C {
void Goo() {}
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterField()
{
await VerifyKeywordAsync(
@"class C {
int i;
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterProperty()
{
await VerifyKeywordAsync(
@"class C {
int i { get; }
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterNestedAttribute()
{
await VerifyKeywordAsync(
@"class C {
[goo]
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInsideStruct()
{
await VerifyKeywordAsync(
@"struct S {
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInsideInterface()
{
await VerifyKeywordAsync(
@"interface I {
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInsideClass()
{
await VerifyKeywordAsync(
@"class C {
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotAfterPartial()
=> await VerifyAbsenceAsync(@"partial $$");
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotAfterNestedPartial()
{
await VerifyAbsenceAsync(
@"class C {
partial $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterNestedAbstract()
{
await VerifyKeywordAsync(
@"class C {
abstract $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterNestedInternal()
{
await VerifyKeywordAsync(
@"class C {
internal $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterNestedStaticPublic()
{
await VerifyKeywordAsync(
@"class C {
static public $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterNestedPublicStatic()
{
await VerifyKeywordAsync(
@"class C {
public static $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterVirtualPublic()
{
await VerifyKeywordAsync(
@"class C {
virtual public $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterNestedPublic()
{
await VerifyKeywordAsync(
@"class C {
public $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterNestedPrivate()
{
await VerifyKeywordAsync(
@"class C {
private $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterNestedProtected()
{
await VerifyKeywordAsync(
@"class C {
protected $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterNestedSealed()
{
await VerifyKeywordAsync(
@"class C {
sealed $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterNestedStatic()
{
await VerifyKeywordAsync(
@"class C {
static $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInLocalVariableDeclaration()
{
await VerifyKeywordAsync(AddInsideMethod(
@"$$"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInForVariableDeclaration()
{
await VerifyKeywordAsync(AddInsideMethod(
@"for ($$"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInForeachVariableDeclaration()
{
await VerifyKeywordAsync(AddInsideMethod(
@"foreach ($$"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInUsingVariableDeclaration()
{
await VerifyKeywordAsync(AddInsideMethod(
@"using ($$"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInFromVariableDeclaration()
{
await VerifyKeywordAsync(AddInsideMethod(
@"var q = from $$"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInJoinVariableDeclaration()
{
await VerifyKeywordAsync(AddInsideMethod(
@"var q = from a in b
join $$"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterMethodOpenParen()
{
await VerifyKeywordAsync(
@"class C {
void Goo($$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterMethodComma()
{
await VerifyKeywordAsync(
@"class C {
void Goo(int i, $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterMethodAttribute()
{
await VerifyKeywordAsync(
@"class C {
void Goo(int i, [Goo]$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterConstructorOpenParen()
{
await VerifyKeywordAsync(
@"class C {
public C($$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterConstructorComma()
{
await VerifyKeywordAsync(
@"class C {
public C(int i, $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterConstructorAttribute()
{
await VerifyKeywordAsync(
@"class C {
public C(int i, [Goo]$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterDelegateOpenParen()
{
await VerifyKeywordAsync(
@"delegate void D($$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterDelegateComma()
{
await VerifyKeywordAsync(
@"delegate void D(int i, $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterDelegateAttribute()
{
await VerifyKeywordAsync(
@"delegate void D(int i, [Goo]$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterThis()
{
await VerifyKeywordAsync(
@"static class C {
public static void Goo(this $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterRef()
{
await VerifyKeywordAsync(
@"class C {
void Goo(ref $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterOut()
{
await VerifyKeywordAsync(
@"class C {
void Goo(out $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterLambdaRef()
{
await VerifyKeywordAsync(
@"class C {
void Goo() {
System.Func<int, int> f = (ref $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterLambdaOut()
{
await VerifyKeywordAsync(
@"class C {
void Goo() {
System.Func<int, int> f = (out $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterParams()
{
await VerifyKeywordAsync(
@"class C {
void Goo(params $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInImplicitOperator()
{
await VerifyKeywordAsync(
@"class C {
public static implicit operator $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInExplicitOperator()
{
await VerifyKeywordAsync(
@"class C {
public static explicit operator $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterIndexerBracket()
{
await VerifyKeywordAsync(
@"class C {
int this[$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterIndexerBracketComma()
{
await VerifyKeywordAsync(
@"class C {
int this[int i, $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterNewInExpression()
{
await VerifyKeywordAsync(AddInsideMethod(
@"new $$"));
}
[WorkItem(538804, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538804")]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInTypeOf()
{
await VerifyKeywordAsync(AddInsideMethod(
@"typeof($$"));
}
[WorkItem(538804, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538804")]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInDefault()
{
await VerifyKeywordAsync(AddInsideMethod(
@"default($$"));
}
[WorkItem(538804, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538804")]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInSizeOf()
{
await VerifyKeywordAsync(AddInsideMethod(
@"sizeof($$"));
}
[WorkItem(544219, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544219")]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotInObjectInitializerMemberContext()
{
await VerifyAbsenceAsync(@"
class C
{
public int x, y;
void M()
{
var c = new C { x = 2, y = 3, $$");
}
[WorkItem(546938, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546938")]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInCrefContext()
{
await VerifyKeywordAsync(@"
class Program
{
/// <see cref=""$$"">
static void Main(string[] args)
{
}
}");
}
[WorkItem(546955, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546955")]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInCrefContextNotAfterDot()
{
await VerifyAbsenceAsync(@"
/// <see cref=""System.$$"" />
class C { }
");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotAfterAsyncAsType()
=> await VerifyAbsenceAsync(@"class c { async async $$ }");
[WorkItem(1468, "https://github.com/dotnet/roslyn/issues/1468")]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotInCrefTypeParameter()
{
await VerifyAbsenceAsync(@"
using System;
/// <see cref=""List{$$}"" />
class C { }
");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task Preselection()
{
await VerifyKeywordAsync(@"
class Program
{
static void Main(string[] args)
{
Helper($$)
}
static void Helper(short x) { }
}
");
}
[WorkItem(14127, "https://github.com/dotnet/roslyn/issues/14127")]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInTupleWithinType()
{
await VerifyKeywordAsync(@"
class Program
{
($$
}");
}
[WorkItem(14127, "https://github.com/dotnet/roslyn/issues/14127")]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInTupleWithinMember()
{
await VerifyKeywordAsync(@"
class Program
{
void Method()
{
($$
}
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInFunctionPointerType()
{
await VerifyKeywordAsync(@"
class C
{
delegate*<$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInFunctionPointerTypeAfterComma()
{
await VerifyKeywordAsync(@"
class C
{
delegate*<int, $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInFunctionPointerTypeAfterModifier()
{
await VerifyKeywordAsync(@"
class C
{
delegate*<ref $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotAfterDelegateAsterisk()
{
await VerifyAbsenceAsync(@"
class C
{
delegate*$$");
}
[WorkItem(53585, "https://github.com/dotnet/roslyn/issues/53585")]
[Theory, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
[ClassData(typeof(TheoryDataKeywordsIndicatingLocalFunction))]
public async Task TestAfterKeywordIndicatingLocalFunction(string keyword)
{
await VerifyKeywordAsync(AddInsideMethod($@"
{keyword} $$"));
}
}
}
| // 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.
#nullable disable
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Completion.Providers;
using Microsoft.CodeAnalysis.Test.Utilities;
using Roslyn.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Recommendations
{
public class ShortKeywordRecommenderTests : KeywordRecommenderTests
{
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAtRoot_Interactive()
{
await VerifyKeywordAsync(SourceCodeKind.Script,
@"$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterClass_Interactive()
{
await VerifyKeywordAsync(SourceCodeKind.Script,
@"class C { }
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterGlobalStatement_Interactive()
{
await VerifyKeywordAsync(SourceCodeKind.Script,
@"System.Console.WriteLine();
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterGlobalVariableDeclaration_Interactive()
{
await VerifyKeywordAsync(SourceCodeKind.Script,
@"int i = 0;
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotInUsingAlias()
{
await VerifyAbsenceAsync(
@"using Goo = $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotInGlobalUsingAlias()
{
await VerifyAbsenceAsync(
@"global using Goo = $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterStackAlloc()
{
await VerifyKeywordAsync(
@"class C {
int* goo = stackalloc $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInFixedStatement()
{
await VerifyKeywordAsync(
@"fixed ($$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInDelegateReturnType()
{
await VerifyKeywordAsync(
@"public delegate $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInCastType()
{
await VerifyKeywordAsync(AddInsideMethod(
@"var str = (($$"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInCastType2()
{
await VerifyKeywordAsync(AddInsideMethod(
@"var str = (($$)items) as string;"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterConstInMemberContext()
{
await VerifyKeywordAsync(
@"class C {
const $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterRefInMemberContext()
{
await VerifyKeywordAsync(
@"class C {
ref $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterRefReadonlyInMemberContext()
{
await VerifyKeywordAsync(
@"class C {
ref readonly $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterConstInStatementContext()
{
await VerifyKeywordAsync(AddInsideMethod(
@"const $$"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterRefInStatementContext()
{
await VerifyKeywordAsync(AddInsideMethod(
@"ref $$"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterRefReadonlyInStatementContext()
{
await VerifyKeywordAsync(AddInsideMethod(
@"ref readonly $$"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterConstLocalDeclaration()
{
await VerifyKeywordAsync(AddInsideMethod(
@"const $$ int local;"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterRefLocalDeclaration()
{
await VerifyKeywordAsync(AddInsideMethod(
@"ref $$ int local;"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterRefReadonlyLocalDeclaration()
{
await VerifyKeywordAsync(AddInsideMethod(
@"ref readonly $$ int local;"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterRefLocalFunction()
{
await VerifyKeywordAsync(AddInsideMethod(
@"ref $$ int Function();"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterRefReadonlyLocalFunction()
{
await VerifyKeywordAsync(AddInsideMethod(
@"ref readonly $$ int Function();"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterRefExpression()
{
await VerifyKeywordAsync(AddInsideMethod(
@"ref int x = ref $$"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInEmptyStatement()
{
await VerifyKeywordAsync(AddInsideMethod(
@"$$"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestEnumBaseTypes()
{
await VerifyKeywordAsync(
@"enum E : $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInGenericType1()
{
await VerifyKeywordAsync(AddInsideMethod(
@"IList<$$"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInGenericType2()
{
await VerifyKeywordAsync(AddInsideMethod(
@"IList<int,$$"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInGenericType3()
{
await VerifyKeywordAsync(AddInsideMethod(
@"IList<int[],$$"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInGenericType4()
{
await VerifyKeywordAsync(AddInsideMethod(
@"IList<IGoo<int?,byte*>,$$"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotInBaseList()
{
await VerifyAbsenceAsync(
@"class C : $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInGenericType_InBaseList()
{
await VerifyKeywordAsync(
@"class C : IList<$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterIs()
{
await VerifyKeywordAsync(AddInsideMethod(
@"var v = goo is $$"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterAs()
{
await VerifyKeywordAsync(AddInsideMethod(
@"var v = goo as $$"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterMethod()
{
await VerifyKeywordAsync(
@"class C {
void Goo() {}
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterField()
{
await VerifyKeywordAsync(
@"class C {
int i;
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterProperty()
{
await VerifyKeywordAsync(
@"class C {
int i { get; }
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterNestedAttribute()
{
await VerifyKeywordAsync(
@"class C {
[goo]
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInsideStruct()
{
await VerifyKeywordAsync(
@"struct S {
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInsideInterface()
{
await VerifyKeywordAsync(
@"interface I {
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInsideClass()
{
await VerifyKeywordAsync(
@"class C {
$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotAfterPartial()
=> await VerifyAbsenceAsync(@"partial $$");
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotAfterNestedPartial()
{
await VerifyAbsenceAsync(
@"class C {
partial $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterNestedAbstract()
{
await VerifyKeywordAsync(
@"class C {
abstract $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterNestedInternal()
{
await VerifyKeywordAsync(
@"class C {
internal $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterNestedStaticPublic()
{
await VerifyKeywordAsync(
@"class C {
static public $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterNestedPublicStatic()
{
await VerifyKeywordAsync(
@"class C {
public static $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterVirtualPublic()
{
await VerifyKeywordAsync(
@"class C {
virtual public $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterNestedPublic()
{
await VerifyKeywordAsync(
@"class C {
public $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterNestedPrivate()
{
await VerifyKeywordAsync(
@"class C {
private $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterNestedProtected()
{
await VerifyKeywordAsync(
@"class C {
protected $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterNestedSealed()
{
await VerifyKeywordAsync(
@"class C {
sealed $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterNestedStatic()
{
await VerifyKeywordAsync(
@"class C {
static $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInLocalVariableDeclaration()
{
await VerifyKeywordAsync(AddInsideMethod(
@"$$"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInForVariableDeclaration()
{
await VerifyKeywordAsync(AddInsideMethod(
@"for ($$"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInForeachVariableDeclaration()
{
await VerifyKeywordAsync(AddInsideMethod(
@"foreach ($$"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInUsingVariableDeclaration()
{
await VerifyKeywordAsync(AddInsideMethod(
@"using ($$"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInFromVariableDeclaration()
{
await VerifyKeywordAsync(AddInsideMethod(
@"var q = from $$"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInJoinVariableDeclaration()
{
await VerifyKeywordAsync(AddInsideMethod(
@"var q = from a in b
join $$"));
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterMethodOpenParen()
{
await VerifyKeywordAsync(
@"class C {
void Goo($$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterMethodComma()
{
await VerifyKeywordAsync(
@"class C {
void Goo(int i, $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterMethodAttribute()
{
await VerifyKeywordAsync(
@"class C {
void Goo(int i, [Goo]$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterConstructorOpenParen()
{
await VerifyKeywordAsync(
@"class C {
public C($$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterConstructorComma()
{
await VerifyKeywordAsync(
@"class C {
public C(int i, $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterConstructorAttribute()
{
await VerifyKeywordAsync(
@"class C {
public C(int i, [Goo]$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterDelegateOpenParen()
{
await VerifyKeywordAsync(
@"delegate void D($$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterDelegateComma()
{
await VerifyKeywordAsync(
@"delegate void D(int i, $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterDelegateAttribute()
{
await VerifyKeywordAsync(
@"delegate void D(int i, [Goo]$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterThis()
{
await VerifyKeywordAsync(
@"static class C {
public static void Goo(this $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterRef()
{
await VerifyKeywordAsync(
@"class C {
void Goo(ref $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterOut()
{
await VerifyKeywordAsync(
@"class C {
void Goo(out $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterLambdaRef()
{
await VerifyKeywordAsync(
@"class C {
void Goo() {
System.Func<int, int> f = (ref $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterLambdaOut()
{
await VerifyKeywordAsync(
@"class C {
void Goo() {
System.Func<int, int> f = (out $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterParams()
{
await VerifyKeywordAsync(
@"class C {
void Goo(params $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInImplicitOperator()
{
await VerifyKeywordAsync(
@"class C {
public static implicit operator $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInExplicitOperator()
{
await VerifyKeywordAsync(
@"class C {
public static explicit operator $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterIndexerBracket()
{
await VerifyKeywordAsync(
@"class C {
int this[$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterIndexerBracketComma()
{
await VerifyKeywordAsync(
@"class C {
int this[int i, $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestAfterNewInExpression()
{
await VerifyKeywordAsync(AddInsideMethod(
@"new $$"));
}
[WorkItem(538804, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538804")]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInTypeOf()
{
await VerifyKeywordAsync(AddInsideMethod(
@"typeof($$"));
}
[WorkItem(538804, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538804")]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInDefault()
{
await VerifyKeywordAsync(AddInsideMethod(
@"default($$"));
}
[WorkItem(538804, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538804")]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInSizeOf()
{
await VerifyKeywordAsync(AddInsideMethod(
@"sizeof($$"));
}
[WorkItem(544219, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544219")]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotInObjectInitializerMemberContext()
{
await VerifyAbsenceAsync(@"
class C
{
public int x, y;
void M()
{
var c = new C { x = 2, y = 3, $$");
}
[WorkItem(546938, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546938")]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInCrefContext()
{
await VerifyKeywordAsync(@"
class Program
{
/// <see cref=""$$"">
static void Main(string[] args)
{
}
}");
}
[WorkItem(546955, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546955")]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInCrefContextNotAfterDot()
{
await VerifyAbsenceAsync(@"
/// <see cref=""System.$$"" />
class C { }
");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotAfterAsyncAsType()
=> await VerifyAbsenceAsync(@"class c { async async $$ }");
[WorkItem(1468, "https://github.com/dotnet/roslyn/issues/1468")]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotInCrefTypeParameter()
{
await VerifyAbsenceAsync(@"
using System;
/// <see cref=""List{$$}"" />
class C { }
");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task Preselection()
{
await VerifyKeywordAsync(@"
class Program
{
static void Main(string[] args)
{
Helper($$)
}
static void Helper(short x) { }
}
");
}
[WorkItem(14127, "https://github.com/dotnet/roslyn/issues/14127")]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInTupleWithinType()
{
await VerifyKeywordAsync(@"
class Program
{
($$
}");
}
[WorkItem(14127, "https://github.com/dotnet/roslyn/issues/14127")]
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInTupleWithinMember()
{
await VerifyKeywordAsync(@"
class Program
{
void Method()
{
($$
}
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInFunctionPointerType()
{
await VerifyKeywordAsync(@"
class C
{
delegate*<$$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInFunctionPointerTypeAfterComma()
{
await VerifyKeywordAsync(@"
class C
{
delegate*<int, $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestInFunctionPointerTypeAfterModifier()
{
await VerifyKeywordAsync(@"
class C
{
delegate*<ref $$");
}
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
public async Task TestNotAfterDelegateAsterisk()
{
await VerifyAbsenceAsync(@"
class C
{
delegate*$$");
}
[WorkItem(53585, "https://github.com/dotnet/roslyn/issues/53585")]
[Theory, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
[ClassData(typeof(TheoryDataKeywordsIndicatingLocalFunction))]
public async Task TestAfterKeywordIndicatingLocalFunction(string keyword)
{
await VerifyKeywordAsync(AddInsideMethod($@"
{keyword} $$"));
}
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Workspaces/CoreTest/UtilityTest/FilePathUtilitiesTests.cs | // 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.
#nullable disable
using Roslyn.Test.Utilities;
using Roslyn.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.UnitTests
{
public sealed class FilePathUtilitiesTests
{
[Fact]
[WorkItem(1579, "https://github.com/dotnet/roslyn/issues/1579")]
public void GetRelativePath_SameDirectory()
{
var baseDirectory = @"C:\Alpha\Beta\Gamma";
var fullPath = @"C:\Alpha\Beta\Gamma\Doc.txt";
var result = PathUtilities.GetRelativePath(baseDirectory, fullPath);
Assert.Equal(expected: @"Doc.txt", actual: result);
}
[Fact]
[WorkItem(1579, "https://github.com/dotnet/roslyn/issues/1579")]
public void GetRelativePath_NestedOneLevelDown()
{
var baseDirectory = @"C:\Alpha\Beta\Gamma";
var fullPath = @"C:\Alpha\Beta\Gamma\Delta\Doc.txt";
var result = PathUtilities.GetRelativePath(baseDirectory, fullPath);
Assert.Equal(expected: @"Delta\Doc.txt", actual: result);
}
[Fact]
[WorkItem(1579, "https://github.com/dotnet/roslyn/issues/1579")]
public void GetRelativePath_NestedTwoLevelsDown()
{
var baseDirectory = @"C:\Alpha\Beta\Gamma";
var fullPath = @"C:\Alpha\Beta\Gamma\Delta\Epsilon\Doc.txt";
var result = PathUtilities.GetRelativePath(baseDirectory, fullPath);
Assert.Equal(expected: @"Delta\Epsilon\Doc.txt", actual: result);
}
[Fact]
[WorkItem(1579, "https://github.com/dotnet/roslyn/issues/1579")]
public void GetRelativePath_UpOneLevel()
{
var baseDirectory = @"C:\Alpha\Beta\Gamma";
var fullPath = @"C:\Alpha\Beta\Doc.txt";
var result = PathUtilities.GetRelativePath(baseDirectory, fullPath);
Assert.Equal(expected: @"..\Doc.txt", actual: result);
}
[Fact]
[WorkItem(1579, "https://github.com/dotnet/roslyn/issues/1579")]
public void GetRelativePath_UpTwoLevels()
{
var baseDirectory = @"C:\Alpha\Beta\Gamma";
var fullPath = @"C:\Alpha\Doc.txt";
var result = PathUtilities.GetRelativePath(baseDirectory, fullPath);
Assert.Equal(expected: @"..\..\Doc.txt", actual: result);
}
[Fact]
[WorkItem(1579, "https://github.com/dotnet/roslyn/issues/1579")]
public void GetRelativePath_UpTwoLevelsAndThenDown()
{
var baseDirectory = @"C:\Alpha\Beta\Gamma";
var fullPath = @"C:\Alpha\Phi\Omega\Doc.txt";
var result = PathUtilities.GetRelativePath(baseDirectory, fullPath);
Assert.Equal(expected: @"..\..\Phi\Omega\Doc.txt", actual: result);
}
[Fact]
[WorkItem(1579, "https://github.com/dotnet/roslyn/issues/1579")]
public void GetRelativePath_OnADifferentDrive()
{
var baseDirectory = @"C:\Alpha\Beta\Gamma";
var fullPath = @"D:\Alpha\Beta\Gamma\Doc.txt";
var result = PathUtilities.GetRelativePath(baseDirectory, fullPath);
Assert.Equal(expected: @"D:\Alpha\Beta\Gamma\Doc.txt", actual: result);
}
[Fact]
[WorkItem(4660, "https://github.com/dotnet/roslyn/issues/4660")]
public void GetRelativePath_WithBaseDirectoryMatchingIncompletePortionOfFullPath()
{
var baseDirectory = @"C:\Alpha\Beta";
var fullPath = @"C:\Alpha\Beta2\Gamma";
var result = PathUtilities.GetRelativePath(baseDirectory, fullPath);
Assert.Equal(expected: @"..\Beta2\Gamma", actual: result);
}
}
}
| // 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.
#nullable disable
using Roslyn.Test.Utilities;
using Roslyn.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.UnitTests
{
public sealed class FilePathUtilitiesTests
{
[Fact]
[WorkItem(1579, "https://github.com/dotnet/roslyn/issues/1579")]
public void GetRelativePath_SameDirectory()
{
var baseDirectory = @"C:\Alpha\Beta\Gamma";
var fullPath = @"C:\Alpha\Beta\Gamma\Doc.txt";
var result = PathUtilities.GetRelativePath(baseDirectory, fullPath);
Assert.Equal(expected: @"Doc.txt", actual: result);
}
[Fact]
[WorkItem(1579, "https://github.com/dotnet/roslyn/issues/1579")]
public void GetRelativePath_NestedOneLevelDown()
{
var baseDirectory = @"C:\Alpha\Beta\Gamma";
var fullPath = @"C:\Alpha\Beta\Gamma\Delta\Doc.txt";
var result = PathUtilities.GetRelativePath(baseDirectory, fullPath);
Assert.Equal(expected: @"Delta\Doc.txt", actual: result);
}
[Fact]
[WorkItem(1579, "https://github.com/dotnet/roslyn/issues/1579")]
public void GetRelativePath_NestedTwoLevelsDown()
{
var baseDirectory = @"C:\Alpha\Beta\Gamma";
var fullPath = @"C:\Alpha\Beta\Gamma\Delta\Epsilon\Doc.txt";
var result = PathUtilities.GetRelativePath(baseDirectory, fullPath);
Assert.Equal(expected: @"Delta\Epsilon\Doc.txt", actual: result);
}
[Fact]
[WorkItem(1579, "https://github.com/dotnet/roslyn/issues/1579")]
public void GetRelativePath_UpOneLevel()
{
var baseDirectory = @"C:\Alpha\Beta\Gamma";
var fullPath = @"C:\Alpha\Beta\Doc.txt";
var result = PathUtilities.GetRelativePath(baseDirectory, fullPath);
Assert.Equal(expected: @"..\Doc.txt", actual: result);
}
[Fact]
[WorkItem(1579, "https://github.com/dotnet/roslyn/issues/1579")]
public void GetRelativePath_UpTwoLevels()
{
var baseDirectory = @"C:\Alpha\Beta\Gamma";
var fullPath = @"C:\Alpha\Doc.txt";
var result = PathUtilities.GetRelativePath(baseDirectory, fullPath);
Assert.Equal(expected: @"..\..\Doc.txt", actual: result);
}
[Fact]
[WorkItem(1579, "https://github.com/dotnet/roslyn/issues/1579")]
public void GetRelativePath_UpTwoLevelsAndThenDown()
{
var baseDirectory = @"C:\Alpha\Beta\Gamma";
var fullPath = @"C:\Alpha\Phi\Omega\Doc.txt";
var result = PathUtilities.GetRelativePath(baseDirectory, fullPath);
Assert.Equal(expected: @"..\..\Phi\Omega\Doc.txt", actual: result);
}
[Fact]
[WorkItem(1579, "https://github.com/dotnet/roslyn/issues/1579")]
public void GetRelativePath_OnADifferentDrive()
{
var baseDirectory = @"C:\Alpha\Beta\Gamma";
var fullPath = @"D:\Alpha\Beta\Gamma\Doc.txt";
var result = PathUtilities.GetRelativePath(baseDirectory, fullPath);
Assert.Equal(expected: @"D:\Alpha\Beta\Gamma\Doc.txt", actual: result);
}
[Fact]
[WorkItem(4660, "https://github.com/dotnet/roslyn/issues/4660")]
public void GetRelativePath_WithBaseDirectoryMatchingIncompletePortionOfFullPath()
{
var baseDirectory = @"C:\Alpha\Beta";
var fullPath = @"C:\Alpha\Beta2\Gamma";
var result = PathUtilities.GetRelativePath(baseDirectory, fullPath);
Assert.Equal(expected: @"..\Beta2\Gamma", actual: result);
}
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/EditorFeatures/CSharpTest/AutomaticCompletion/AutomaticBraceCompletionTests.cs | // 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.
#nullable disable
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using Microsoft.CodeAnalysis.BraceCompletion;
using Microsoft.CodeAnalysis.CSharp.Formatting;
using Microsoft.CodeAnalysis.Editor.UnitTests.AutomaticCompletion;
using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces;
using Microsoft.CodeAnalysis.Formatting;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Test.Utilities;
using Xunit;
using static Microsoft.CodeAnalysis.BraceCompletion.AbstractBraceCompletionService;
using static Microsoft.CodeAnalysis.CSharp.BraceCompletion.CurlyBraceCompletionService;
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.AutomaticCompletion
{
public class AutomaticBraceCompletionTests : AbstractAutomaticBraceCompletionTests
{
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void WithExpressionBracesSameLine()
{
var code = @"
class C
{
void M(C c)
{
c = c with $$
}
}";
var expected = @"
class C
{
void M(C c)
{
c = c with { }
}
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
CheckText(session.Session, expected);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
[WorkItem(47381, "https://github.com/dotnet/roslyn/issues/47381")]
public void ImplicitObjectCreationExpressionBracesSameLine()
{
var code = @"
class C
{
void M(C c)
{
c = new() $$
}
}";
var expected = @"
class C
{
void M(C c)
{
c = new() { }
}
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
CheckText(session.Session, expected);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void WithExpressionBracesSameLine_Enter()
{
var code = @"
class C
{
void M(C c)
{
c = c with $$
}
}";
var expected = @"
class C
{
void M(C c)
{
c = c with
{
}
}
}";
using var session = CreateSession(code);
CheckStart(session.Session);
CheckReturn(session.Session, 12, expected);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void Creation()
{
using var session = CreateSession("$$");
Assert.NotNull(session);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void InvalidLocation_String()
{
var code = @"class C
{
string s = ""$$
}";
using var session = CreateSession(code);
Assert.Null(session);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void InvalidLocation_String2()
{
var code = @"class C
{
string s = @""
$$
}";
using var session = CreateSession(code);
Assert.Null(session);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void ValidLocation_InterpolatedString1()
{
var code = @"class C
{
string s = $""$$
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void ValidLocation_InterpolatedString2()
{
var code = @"class C
{
string s = $@""$$
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void ValidLocation_InterpolatedString3()
{
var code = @"class C
{
string x = ""goo""
string s = $""{x} $$
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void ValidLocation_InterpolatedString4()
{
var code = @"class C
{
string x = ""goo""
string s = $@""{x} $$
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void ValidLocation_InterpolatedString5()
{
var code = @"class C
{
string s = $""{{$$
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void ValidLocation_InterpolatedString6()
{
var code = @"class C
{
string s = $""{}$$
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void ValidLocation_InterpolatedString7()
{
var code = @"class C
{
string s = $""{}$$
}";
var expected = @"class C
{
string s = $""{}{
}
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
CheckReturn(session.Session, 0, expected);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void InvalidLocation_InterpolatedString1()
{
var code = @"class C
{
string s = @""$$
}";
using var session = CreateSession(code);
Assert.Null(session);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void InvalidLocation_InterpolatedString2()
{
var code = @"class C
{
string s = ""$$
}";
using var session = CreateSession(code);
Assert.Null(session);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void InvalidLocation_Comment()
{
var code = @"class C
{
//$$
}";
using var session = CreateSession(code);
Assert.Null(session);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void InvalidLocation_Comment2()
{
var code = @"class C
{
/* $$
}";
using var session = CreateSession(code);
Assert.Null(session);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void InvalidLocation_Comment3()
{
var code = @"class C
{
/// $$
}";
using var session = CreateSession(code);
Assert.Null(session);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void InvalidLocation_Comment4()
{
var code = @"class C
{
/** $$
}";
using var session = CreateSession(code);
Assert.Null(session);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void MultiLine_Comment()
{
var code = @"class C
{
void Method()
{
/* */$$
}
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void MultiLine_DocComment()
{
var code = @"class C
{
void Method()
{
/** */$$
}
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void String1()
{
var code = @"class C
{
void Method()
{
var s = """"$$
}
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void String2()
{
var code = @"class C
{
void Method()
{
var s = @""""$$
}
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void Class_OpenBrace()
{
var code = @"class C $$";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void Class_Delete()
{
var code = @"class C $$";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
CheckBackspace(session.Session);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void Class_Tab()
{
var code = @"class C $$";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
CheckTab(session.Session);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void Class_CloseBrace()
{
var code = @"class C $$";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
CheckOverType(session.Session);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void Method_OpenBrace_Multiple()
{
var code = @"class C
{
void Method() { $$
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void Class_OpenBrace_Enter()
{
var code = @"class C $$";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
CheckReturn(session.Session, 4);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
[WorkItem(47438, "https://github.com/dotnet/roslyn/issues/47438")]
public void WithExpression()
{
var code = @"
record C
{
void M()
{
_ = this with $$
}
}";
var expectedBeforeReturn = @"
record C
{
void M()
{
_ = this with { }
}
}";
var expectedAfterReturn = @"
record C
{
void M()
{
_ = this with
{
}
}
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
CheckText(session.Session, expectedBeforeReturn);
CheckReturn(session.Session, 12, expectedAfterReturn);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void RecursivePattern()
{
var code = @"
class C
{
void M()
{
_ = this is $$
}
}";
var expectedBeforeReturn = @"
class C
{
void M()
{
_ = this is { }
}
}";
var expectedAfterReturn = @"
class C
{
void M()
{
_ = this is
{
}
}
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
CheckText(session.Session, expectedBeforeReturn);
CheckReturn(session.Session, 12, expectedAfterReturn);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void RecursivePattern_Nested()
{
var code = @"
class C
{
void M()
{
_ = this is { Name: $$ }
}
}";
var expectedBeforeReturn = @"
class C
{
void M()
{
_ = this is { Name: { } }
}
}";
var expectedAfterReturn = @"
class C
{
void M()
{
_ = this is { Name:
{
} }
}
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
CheckText(session.Session, expectedBeforeReturn);
CheckReturn(session.Session, 12, expectedAfterReturn);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void RecursivePattern_Parentheses1()
{
var code = @"
class C
{
void M()
{
_ = this is { Name: $$ }
}
}";
var expected = @"
class C
{
void M()
{
_ = this is { Name: () }
}
}";
using var session = CreateSession(TestWorkspace.CreateCSharp(code), '(', ')');
Assert.NotNull(session);
CheckStart(session.Session);
CheckText(session.Session, expected);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void RecursivePattern_Parentheses2()
{
var code = @"
class C
{
void M()
{
_ = this is { Name: { Length: (> 3) and $$ } }
}
}";
var expected = @"
class C
{
void M()
{
_ = this is { Name: { Length: (> 3) and () } }
}
}";
using var session = CreateSession(TestWorkspace.CreateCSharp(code), '(', ')');
Assert.NotNull(session);
CheckStart(session.Session);
CheckText(session.Session, expected);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void RecursivePattern_FollowedByInvocation()
{
var code = @"
class C
{
void M()
{
_ = this is $$
M();
}
}";
var expectedBeforeReturn = @"
class C
{
void M()
{
_ = this is { }
M();
}
}";
var expectedAfterReturn = @"
class C
{
void M()
{
_ = this is
{
}
M();
}
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
CheckText(session.Session, expectedBeforeReturn);
CheckReturn(session.Session, 12, expectedAfterReturn);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void RecursivePattern_WithInvocation_FollowedByInvocation()
{
var code = @"
class C
{
void M()
{
_ = this is (1, 2) $$
M();
}
}";
var expectedBeforeReturn = @"
class C
{
void M()
{
_ = this is (1, 2) { }
M();
}
}";
var expectedAfterReturn = @"
class C
{
void M()
{
_ = this is (1, 2)
{
}
M();
}
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
CheckText(session.Session, expectedBeforeReturn);
CheckReturn(session.Session, 12, expectedAfterReturn);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void SwitchExpression()
{
var code = @"
class C
{
void M()
{
_ = this switch $$
}
}";
var expectedBeforeReturn = @"
class C
{
void M()
{
_ = this switch { }
}
}";
var expectedAfterReturn = @"
class C
{
void M()
{
_ = this switch
{
}
}
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
CheckText(session.Session, expectedBeforeReturn);
CheckReturn(session.Session, 12, expectedAfterReturn);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void Class_ObjectInitializer_OpenBrace_Enter()
{
var code = @"using System.Collections.Generic;
class C
{
List<C> list = new List<C>
{
new C $$
};
}";
var expected = @"using System.Collections.Generic;
class C
{
List<C> list = new List<C>
{
new C
{
}
};
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
CheckReturn(session.Session, 12, expected);
}
[WorkItem(1070773, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1070773")]
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void Collection_Initializer_OpenBraceOnSameLine_Enter()
{
var code = @"using System.Collections.Generic;
class C
{
public void man()
{
List<C> list = new List<C> $$
}
}";
var expected = @"using System.Collections.Generic;
class C
{
public void man()
{
List<C> list = new List<C> {
}
}
}";
var optionSet = new Dictionary<OptionKey2, object>
{
{ CSharpFormattingOptions2.NewLinesForBracesInObjectCollectionArrayInitializers, false }
};
using var session = CreateSession(code, optionSet);
Assert.NotNull(session);
CheckStart(session.Session);
CheckReturn(session.Session, 12, expected);
}
[WorkItem(1070773, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1070773")]
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void Collection_Initializer_OpenBraceOnDifferentLine_Enter()
{
var code = @"using System.Collections.Generic;
class C
{
public void man()
{
List<C> list = new List<C> $$
}
}";
var expected = @"using System.Collections.Generic;
class C
{
public void man()
{
List<C> list = new List<C>
{
}
}
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
CheckReturn(session.Session, 12, expected);
}
[WorkItem(1070773, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1070773")]
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void Object_Initializer_OpenBraceOnSameLine_Enter()
{
var code = @"class C
{
public void man()
{
var goo = new Goo $$
}
}
class Goo
{
public int bar;
}";
var expected = @"class C
{
public void man()
{
var goo = new Goo {
}
}
}
class Goo
{
public int bar;
}";
var optionSet = new Dictionary<OptionKey2, object>
{
{ CSharpFormattingOptions2.NewLinesForBracesInObjectCollectionArrayInitializers, false }
};
using var session = CreateSession(code, optionSet);
Assert.NotNull(session);
CheckStart(session.Session);
CheckReturn(session.Session, 12, expected);
}
[WorkItem(1070773, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1070773")]
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void Object_Initializer_OpenBraceOnDifferentLine_Enter()
{
var code = @"class C
{
public void man()
{
var goo = new Goo $$
}
}
class Goo
{
public int bar;
}";
var expected = @"class C
{
public void man()
{
var goo = new Goo
{
}
}
}
class Goo
{
public int bar;
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
CheckReturn(session.Session, 12, expected);
}
[WorkItem(1070773, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1070773")]
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void ArrayImplicit_Initializer_OpenBraceOnSameLine_Enter()
{
var code = @"class C
{
public void man()
{
int[] arr = $$
}
}";
var expected = @"class C
{
public void man()
{
int[] arr = {
}
}
}";
var optionSet = new Dictionary<OptionKey2, object>
{
{ CSharpFormattingOptions2.NewLinesForBracesInObjectCollectionArrayInitializers, false }
};
using var session = CreateSession(code, optionSet);
Assert.NotNull(session);
CheckStart(session.Session);
CheckReturn(session.Session, 12, expected);
}
[WorkItem(1070773, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1070773")]
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void ArrayImplicit_Initializer_OpenBraceOnDifferentLine_Enter()
{
var code = @"class C
{
public void man()
{
int[] arr = $$
}
}";
var expected = @"class C
{
public void man()
{
int[] arr =
{
}
}
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
CheckReturn(session.Session, 12, expected);
}
[WorkItem(1070773, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1070773")]
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void ArrayExplicit1_Initializer_OpenBraceOnSameLine_Enter()
{
var code = @"class C
{
public void man()
{
int[] arr = new[] $$
}
}";
var expected = @"class C
{
public void man()
{
int[] arr = new[] {
}
}
}";
var optionSet = new Dictionary<OptionKey2, object>
{
{ CSharpFormattingOptions2.NewLinesForBracesInObjectCollectionArrayInitializers, false }
};
using var session = CreateSession(code, optionSet);
Assert.NotNull(session);
CheckStart(session.Session);
CheckReturn(session.Session, 12, expected);
}
[WorkItem(1070773, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1070773")]
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void ArrayExplicit1_Initializer_OpenBraceOnDifferentLine_Enter()
{
var code = @"class C
{
public void man()
{
int[] arr = new[] $$
}
}";
var expected = @"class C
{
public void man()
{
int[] arr = new[]
{
}
}
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
CheckReturn(session.Session, 12, expected);
}
[WorkItem(1070773, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1070773")]
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void ArrayExplicit2_Initializer_OpenBraceOnSameLine_Enter()
{
var code = @"class C
{
public void man()
{
int[] arr = new int[] $$
}
}";
var expected = @"class C
{
public void man()
{
int[] arr = new int[] {
}
}
}";
var optionSet = new Dictionary<OptionKey2, object>
{
{ CSharpFormattingOptions2.NewLinesForBracesInObjectCollectionArrayInitializers, false }
};
using var session = CreateSession(code, optionSet);
Assert.NotNull(session);
CheckStart(session.Session);
CheckReturn(session.Session, 12, expected);
}
[WorkItem(1070773, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1070773")]
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void ArrayExplicit2_Initializer_OpenBraceOnDifferentLine_Enter()
{
var code = @"class C
{
public void man()
{
int[] arr = new int[] $$
}
}";
var expected = @"class C
{
public void man()
{
int[] arr = new int[]
{
}
}
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
CheckReturn(session.Session, 12, expected);
}
[WorkItem(3447, "https://github.com/dotnet/roslyn/issues/3447")]
[WorkItem(850540, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/850540")]
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void BlockIndentationWithAutomaticBraceFormattingDisabled()
{
var code = @"class C
{
public void X()
$$
}";
var expected = @"class C
{
public void X()
{}
}";
var expectedAfterReturn = @"class C
{
public void X()
{
}
}";
var optionSet = new Dictionary<OptionKey2, object>
{
{ new OptionKey2(BraceCompletionOptions.AutoFormattingOnCloseBrace, LanguageNames.CSharp), false },
{ new OptionKey2(FormattingOptions2.SmartIndent, LanguageNames.CSharp), FormattingOptions.IndentStyle.Block }
};
using var session = CreateSession(code, optionSet);
Assert.NotNull(session);
CheckStart(session.Session);
Assert.Equal(expected, session.Session.SubjectBuffer.CurrentSnapshot.GetText());
CheckReturn(session.Session, 4, expectedAfterReturn);
}
[WorkItem(2224, "https://github.com/dotnet/roslyn/issues/2224")]
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void NoSmartOrBlockIndentationWithAutomaticBraceFormattingDisabled()
{
var code = @"namespace NS1
{
public class C1
$$
}";
var expected = @"namespace NS1
{
public class C1
{ }
}";
var optionSet = new Dictionary<OptionKey2, object>
{
{ new OptionKey2(FormattingOptions2.SmartIndent, LanguageNames.CSharp), FormattingOptions.IndentStyle.None }
};
using var session = CreateSession(code, optionSet);
Assert.NotNull(session);
CheckStart(session.Session);
Assert.Equal(expected, session.Session.SubjectBuffer.CurrentSnapshot.GetText());
}
[WorkItem(2330, "https://github.com/dotnet/roslyn/issues/2330")]
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void BlockIndentationWithAutomaticBraceFormatting()
{
var code = @"namespace NS1
{
public class C1
$$
}";
var expected = @"namespace NS1
{
public class C1
{ }
}";
var expectedAfterReturn = @"namespace NS1
{
public class C1
{
}
}";
var optionSet = new Dictionary<OptionKey2, object>
{
{ new OptionKey2(FormattingOptions2.SmartIndent, LanguageNames.CSharp), FormattingOptions.IndentStyle.Block }
};
using var session = CreateSession(code, optionSet);
Assert.NotNull(session);
CheckStart(session.Session);
Assert.Equal(expected, session.Session.SubjectBuffer.CurrentSnapshot.GetText());
CheckReturn(session.Session, 8, expectedAfterReturn);
}
[WorkItem(2330, "https://github.com/dotnet/roslyn/issues/2330")]
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void BlockIndentationWithAutomaticBraceFormattingSecondSet()
{
var code = @"namespace NS1
{
public class C1
{ public class C2 $$
}
}";
var expected = @"namespace NS1
{
public class C1
{ public class C2 { }
}
}";
var expectedAfterReturn = @"namespace NS1
{
public class C1
{ public class C2 {
}
}
}";
var optionSet = new Dictionary<OptionKey2, object>
{
{ new OptionKey2(FormattingOptions2.SmartIndent, LanguageNames.CSharp), FormattingOptions.IndentStyle.Block }
};
using var session = CreateSession(code, optionSet);
Assert.NotNull(session);
CheckStart(session.Session);
Assert.Equal(expected, session.Session.SubjectBuffer.CurrentSnapshot.GetText());
CheckReturn(session.Session, 8, expectedAfterReturn);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void DoesNotFormatInsideBracePairInInitializers()
{
var code = @"class C
{
void M()
{
var x = new int[]$$
}
}";
var expected = @"class C
{
void M()
{
var x = new int[] {}
}
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
CheckText(session.Session, expected);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void DoesNotFormatOnReturnWithNonWhitespaceInBetween()
{
var code = @"class C $$";
var expected = @"class C { dd
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
Type(session.Session, "dd");
CheckReturn(session.Session, 0, expected);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void CurlyBraceFormattingInsideLambdaInsideInterpolation()
{
var code = @"class C
{
void M(string[] args)
{
var s = $""{ args.Select(a => $$)}""
}
}";
var expectedAfterStart = @"class C
{
void M(string[] args)
{
var s = $""{ args.Select(a => { })}""
}
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
Assert.Equal(expectedAfterStart, session.Session.SubjectBuffer.CurrentSnapshot.GetText());
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void CurlyBraceFormatting_DoesNotAddNewLineWhenAlreadyExists()
{
var code = @"class C $$";
var expected = @"class C
{
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
// Sneakily insert a new line between the braces.
var buffer = session.Session.SubjectBuffer;
buffer.Insert(10, Environment.NewLine);
CheckReturn(session.Session, 4, expected);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void CurlyBraceFormatting_InsertsCorrectNewLine()
{
var code = @"class C $$";
var optionSet = new Dictionary<OptionKey2, object>
{
{ new OptionKey2(FormattingOptions2.NewLine, LanguageNames.CSharp), "\r" }
};
using var session = CreateSession(code, optionSet);
Assert.NotNull(session);
CheckStart(session.Session);
CheckReturn(session.Session, 4, result: "class C\r{\r\r}");
}
internal static Holder CreateSession(string code, Dictionary<OptionKey2, object> optionSet = null)
{
return CreateSession(
TestWorkspace.CreateCSharp(code),
CurlyBrace.OpenCharacter, CurlyBrace.CloseCharacter, optionSet);
}
}
}
| // 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.
#nullable disable
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using Microsoft.CodeAnalysis.BraceCompletion;
using Microsoft.CodeAnalysis.CSharp.Formatting;
using Microsoft.CodeAnalysis.Editor.UnitTests.AutomaticCompletion;
using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces;
using Microsoft.CodeAnalysis.Formatting;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Test.Utilities;
using Xunit;
using static Microsoft.CodeAnalysis.BraceCompletion.AbstractBraceCompletionService;
using static Microsoft.CodeAnalysis.CSharp.BraceCompletion.CurlyBraceCompletionService;
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.AutomaticCompletion
{
public class AutomaticBraceCompletionTests : AbstractAutomaticBraceCompletionTests
{
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void WithExpressionBracesSameLine()
{
var code = @"
class C
{
void M(C c)
{
c = c with $$
}
}";
var expected = @"
class C
{
void M(C c)
{
c = c with { }
}
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
CheckText(session.Session, expected);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
[WorkItem(47381, "https://github.com/dotnet/roslyn/issues/47381")]
public void ImplicitObjectCreationExpressionBracesSameLine()
{
var code = @"
class C
{
void M(C c)
{
c = new() $$
}
}";
var expected = @"
class C
{
void M(C c)
{
c = new() { }
}
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
CheckText(session.Session, expected);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void WithExpressionBracesSameLine_Enter()
{
var code = @"
class C
{
void M(C c)
{
c = c with $$
}
}";
var expected = @"
class C
{
void M(C c)
{
c = c with
{
}
}
}";
using var session = CreateSession(code);
CheckStart(session.Session);
CheckReturn(session.Session, 12, expected);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void Creation()
{
using var session = CreateSession("$$");
Assert.NotNull(session);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void InvalidLocation_String()
{
var code = @"class C
{
string s = ""$$
}";
using var session = CreateSession(code);
Assert.Null(session);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void InvalidLocation_String2()
{
var code = @"class C
{
string s = @""
$$
}";
using var session = CreateSession(code);
Assert.Null(session);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void ValidLocation_InterpolatedString1()
{
var code = @"class C
{
string s = $""$$
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void ValidLocation_InterpolatedString2()
{
var code = @"class C
{
string s = $@""$$
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void ValidLocation_InterpolatedString3()
{
var code = @"class C
{
string x = ""goo""
string s = $""{x} $$
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void ValidLocation_InterpolatedString4()
{
var code = @"class C
{
string x = ""goo""
string s = $@""{x} $$
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void ValidLocation_InterpolatedString5()
{
var code = @"class C
{
string s = $""{{$$
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void ValidLocation_InterpolatedString6()
{
var code = @"class C
{
string s = $""{}$$
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void ValidLocation_InterpolatedString7()
{
var code = @"class C
{
string s = $""{}$$
}";
var expected = @"class C
{
string s = $""{}{
}
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
CheckReturn(session.Session, 0, expected);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void InvalidLocation_InterpolatedString1()
{
var code = @"class C
{
string s = @""$$
}";
using var session = CreateSession(code);
Assert.Null(session);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void InvalidLocation_InterpolatedString2()
{
var code = @"class C
{
string s = ""$$
}";
using var session = CreateSession(code);
Assert.Null(session);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void InvalidLocation_Comment()
{
var code = @"class C
{
//$$
}";
using var session = CreateSession(code);
Assert.Null(session);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void InvalidLocation_Comment2()
{
var code = @"class C
{
/* $$
}";
using var session = CreateSession(code);
Assert.Null(session);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void InvalidLocation_Comment3()
{
var code = @"class C
{
/// $$
}";
using var session = CreateSession(code);
Assert.Null(session);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void InvalidLocation_Comment4()
{
var code = @"class C
{
/** $$
}";
using var session = CreateSession(code);
Assert.Null(session);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void MultiLine_Comment()
{
var code = @"class C
{
void Method()
{
/* */$$
}
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void MultiLine_DocComment()
{
var code = @"class C
{
void Method()
{
/** */$$
}
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void String1()
{
var code = @"class C
{
void Method()
{
var s = """"$$
}
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void String2()
{
var code = @"class C
{
void Method()
{
var s = @""""$$
}
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void Class_OpenBrace()
{
var code = @"class C $$";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void Class_Delete()
{
var code = @"class C $$";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
CheckBackspace(session.Session);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void Class_Tab()
{
var code = @"class C $$";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
CheckTab(session.Session);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void Class_CloseBrace()
{
var code = @"class C $$";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
CheckOverType(session.Session);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void Method_OpenBrace_Multiple()
{
var code = @"class C
{
void Method() { $$
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void Class_OpenBrace_Enter()
{
var code = @"class C $$";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
CheckReturn(session.Session, 4);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
[WorkItem(47438, "https://github.com/dotnet/roslyn/issues/47438")]
public void WithExpression()
{
var code = @"
record C
{
void M()
{
_ = this with $$
}
}";
var expectedBeforeReturn = @"
record C
{
void M()
{
_ = this with { }
}
}";
var expectedAfterReturn = @"
record C
{
void M()
{
_ = this with
{
}
}
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
CheckText(session.Session, expectedBeforeReturn);
CheckReturn(session.Session, 12, expectedAfterReturn);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void RecursivePattern()
{
var code = @"
class C
{
void M()
{
_ = this is $$
}
}";
var expectedBeforeReturn = @"
class C
{
void M()
{
_ = this is { }
}
}";
var expectedAfterReturn = @"
class C
{
void M()
{
_ = this is
{
}
}
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
CheckText(session.Session, expectedBeforeReturn);
CheckReturn(session.Session, 12, expectedAfterReturn);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void RecursivePattern_Nested()
{
var code = @"
class C
{
void M()
{
_ = this is { Name: $$ }
}
}";
var expectedBeforeReturn = @"
class C
{
void M()
{
_ = this is { Name: { } }
}
}";
var expectedAfterReturn = @"
class C
{
void M()
{
_ = this is { Name:
{
} }
}
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
CheckText(session.Session, expectedBeforeReturn);
CheckReturn(session.Session, 12, expectedAfterReturn);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void RecursivePattern_Parentheses1()
{
var code = @"
class C
{
void M()
{
_ = this is { Name: $$ }
}
}";
var expected = @"
class C
{
void M()
{
_ = this is { Name: () }
}
}";
using var session = CreateSession(TestWorkspace.CreateCSharp(code), '(', ')');
Assert.NotNull(session);
CheckStart(session.Session);
CheckText(session.Session, expected);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void RecursivePattern_Parentheses2()
{
var code = @"
class C
{
void M()
{
_ = this is { Name: { Length: (> 3) and $$ } }
}
}";
var expected = @"
class C
{
void M()
{
_ = this is { Name: { Length: (> 3) and () } }
}
}";
using var session = CreateSession(TestWorkspace.CreateCSharp(code), '(', ')');
Assert.NotNull(session);
CheckStart(session.Session);
CheckText(session.Session, expected);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void RecursivePattern_FollowedByInvocation()
{
var code = @"
class C
{
void M()
{
_ = this is $$
M();
}
}";
var expectedBeforeReturn = @"
class C
{
void M()
{
_ = this is { }
M();
}
}";
var expectedAfterReturn = @"
class C
{
void M()
{
_ = this is
{
}
M();
}
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
CheckText(session.Session, expectedBeforeReturn);
CheckReturn(session.Session, 12, expectedAfterReturn);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void RecursivePattern_WithInvocation_FollowedByInvocation()
{
var code = @"
class C
{
void M()
{
_ = this is (1, 2) $$
M();
}
}";
var expectedBeforeReturn = @"
class C
{
void M()
{
_ = this is (1, 2) { }
M();
}
}";
var expectedAfterReturn = @"
class C
{
void M()
{
_ = this is (1, 2)
{
}
M();
}
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
CheckText(session.Session, expectedBeforeReturn);
CheckReturn(session.Session, 12, expectedAfterReturn);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void SwitchExpression()
{
var code = @"
class C
{
void M()
{
_ = this switch $$
}
}";
var expectedBeforeReturn = @"
class C
{
void M()
{
_ = this switch { }
}
}";
var expectedAfterReturn = @"
class C
{
void M()
{
_ = this switch
{
}
}
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
CheckText(session.Session, expectedBeforeReturn);
CheckReturn(session.Session, 12, expectedAfterReturn);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void Class_ObjectInitializer_OpenBrace_Enter()
{
var code = @"using System.Collections.Generic;
class C
{
List<C> list = new List<C>
{
new C $$
};
}";
var expected = @"using System.Collections.Generic;
class C
{
List<C> list = new List<C>
{
new C
{
}
};
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
CheckReturn(session.Session, 12, expected);
}
[WorkItem(1070773, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1070773")]
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void Collection_Initializer_OpenBraceOnSameLine_Enter()
{
var code = @"using System.Collections.Generic;
class C
{
public void man()
{
List<C> list = new List<C> $$
}
}";
var expected = @"using System.Collections.Generic;
class C
{
public void man()
{
List<C> list = new List<C> {
}
}
}";
var optionSet = new Dictionary<OptionKey2, object>
{
{ CSharpFormattingOptions2.NewLinesForBracesInObjectCollectionArrayInitializers, false }
};
using var session = CreateSession(code, optionSet);
Assert.NotNull(session);
CheckStart(session.Session);
CheckReturn(session.Session, 12, expected);
}
[WorkItem(1070773, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1070773")]
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void Collection_Initializer_OpenBraceOnDifferentLine_Enter()
{
var code = @"using System.Collections.Generic;
class C
{
public void man()
{
List<C> list = new List<C> $$
}
}";
var expected = @"using System.Collections.Generic;
class C
{
public void man()
{
List<C> list = new List<C>
{
}
}
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
CheckReturn(session.Session, 12, expected);
}
[WorkItem(1070773, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1070773")]
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void Object_Initializer_OpenBraceOnSameLine_Enter()
{
var code = @"class C
{
public void man()
{
var goo = new Goo $$
}
}
class Goo
{
public int bar;
}";
var expected = @"class C
{
public void man()
{
var goo = new Goo {
}
}
}
class Goo
{
public int bar;
}";
var optionSet = new Dictionary<OptionKey2, object>
{
{ CSharpFormattingOptions2.NewLinesForBracesInObjectCollectionArrayInitializers, false }
};
using var session = CreateSession(code, optionSet);
Assert.NotNull(session);
CheckStart(session.Session);
CheckReturn(session.Session, 12, expected);
}
[WorkItem(1070773, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1070773")]
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void Object_Initializer_OpenBraceOnDifferentLine_Enter()
{
var code = @"class C
{
public void man()
{
var goo = new Goo $$
}
}
class Goo
{
public int bar;
}";
var expected = @"class C
{
public void man()
{
var goo = new Goo
{
}
}
}
class Goo
{
public int bar;
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
CheckReturn(session.Session, 12, expected);
}
[WorkItem(1070773, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1070773")]
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void ArrayImplicit_Initializer_OpenBraceOnSameLine_Enter()
{
var code = @"class C
{
public void man()
{
int[] arr = $$
}
}";
var expected = @"class C
{
public void man()
{
int[] arr = {
}
}
}";
var optionSet = new Dictionary<OptionKey2, object>
{
{ CSharpFormattingOptions2.NewLinesForBracesInObjectCollectionArrayInitializers, false }
};
using var session = CreateSession(code, optionSet);
Assert.NotNull(session);
CheckStart(session.Session);
CheckReturn(session.Session, 12, expected);
}
[WorkItem(1070773, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1070773")]
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void ArrayImplicit_Initializer_OpenBraceOnDifferentLine_Enter()
{
var code = @"class C
{
public void man()
{
int[] arr = $$
}
}";
var expected = @"class C
{
public void man()
{
int[] arr =
{
}
}
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
CheckReturn(session.Session, 12, expected);
}
[WorkItem(1070773, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1070773")]
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void ArrayExplicit1_Initializer_OpenBraceOnSameLine_Enter()
{
var code = @"class C
{
public void man()
{
int[] arr = new[] $$
}
}";
var expected = @"class C
{
public void man()
{
int[] arr = new[] {
}
}
}";
var optionSet = new Dictionary<OptionKey2, object>
{
{ CSharpFormattingOptions2.NewLinesForBracesInObjectCollectionArrayInitializers, false }
};
using var session = CreateSession(code, optionSet);
Assert.NotNull(session);
CheckStart(session.Session);
CheckReturn(session.Session, 12, expected);
}
[WorkItem(1070773, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1070773")]
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void ArrayExplicit1_Initializer_OpenBraceOnDifferentLine_Enter()
{
var code = @"class C
{
public void man()
{
int[] arr = new[] $$
}
}";
var expected = @"class C
{
public void man()
{
int[] arr = new[]
{
}
}
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
CheckReturn(session.Session, 12, expected);
}
[WorkItem(1070773, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1070773")]
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void ArrayExplicit2_Initializer_OpenBraceOnSameLine_Enter()
{
var code = @"class C
{
public void man()
{
int[] arr = new int[] $$
}
}";
var expected = @"class C
{
public void man()
{
int[] arr = new int[] {
}
}
}";
var optionSet = new Dictionary<OptionKey2, object>
{
{ CSharpFormattingOptions2.NewLinesForBracesInObjectCollectionArrayInitializers, false }
};
using var session = CreateSession(code, optionSet);
Assert.NotNull(session);
CheckStart(session.Session);
CheckReturn(session.Session, 12, expected);
}
[WorkItem(1070773, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1070773")]
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void ArrayExplicit2_Initializer_OpenBraceOnDifferentLine_Enter()
{
var code = @"class C
{
public void man()
{
int[] arr = new int[] $$
}
}";
var expected = @"class C
{
public void man()
{
int[] arr = new int[]
{
}
}
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
CheckReturn(session.Session, 12, expected);
}
[WorkItem(3447, "https://github.com/dotnet/roslyn/issues/3447")]
[WorkItem(850540, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/850540")]
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void BlockIndentationWithAutomaticBraceFormattingDisabled()
{
var code = @"class C
{
public void X()
$$
}";
var expected = @"class C
{
public void X()
{}
}";
var expectedAfterReturn = @"class C
{
public void X()
{
}
}";
var optionSet = new Dictionary<OptionKey2, object>
{
{ new OptionKey2(BraceCompletionOptions.AutoFormattingOnCloseBrace, LanguageNames.CSharp), false },
{ new OptionKey2(FormattingOptions2.SmartIndent, LanguageNames.CSharp), FormattingOptions.IndentStyle.Block }
};
using var session = CreateSession(code, optionSet);
Assert.NotNull(session);
CheckStart(session.Session);
Assert.Equal(expected, session.Session.SubjectBuffer.CurrentSnapshot.GetText());
CheckReturn(session.Session, 4, expectedAfterReturn);
}
[WorkItem(2224, "https://github.com/dotnet/roslyn/issues/2224")]
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void NoSmartOrBlockIndentationWithAutomaticBraceFormattingDisabled()
{
var code = @"namespace NS1
{
public class C1
$$
}";
var expected = @"namespace NS1
{
public class C1
{ }
}";
var optionSet = new Dictionary<OptionKey2, object>
{
{ new OptionKey2(FormattingOptions2.SmartIndent, LanguageNames.CSharp), FormattingOptions.IndentStyle.None }
};
using var session = CreateSession(code, optionSet);
Assert.NotNull(session);
CheckStart(session.Session);
Assert.Equal(expected, session.Session.SubjectBuffer.CurrentSnapshot.GetText());
}
[WorkItem(2330, "https://github.com/dotnet/roslyn/issues/2330")]
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void BlockIndentationWithAutomaticBraceFormatting()
{
var code = @"namespace NS1
{
public class C1
$$
}";
var expected = @"namespace NS1
{
public class C1
{ }
}";
var expectedAfterReturn = @"namespace NS1
{
public class C1
{
}
}";
var optionSet = new Dictionary<OptionKey2, object>
{
{ new OptionKey2(FormattingOptions2.SmartIndent, LanguageNames.CSharp), FormattingOptions.IndentStyle.Block }
};
using var session = CreateSession(code, optionSet);
Assert.NotNull(session);
CheckStart(session.Session);
Assert.Equal(expected, session.Session.SubjectBuffer.CurrentSnapshot.GetText());
CheckReturn(session.Session, 8, expectedAfterReturn);
}
[WorkItem(2330, "https://github.com/dotnet/roslyn/issues/2330")]
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void BlockIndentationWithAutomaticBraceFormattingSecondSet()
{
var code = @"namespace NS1
{
public class C1
{ public class C2 $$
}
}";
var expected = @"namespace NS1
{
public class C1
{ public class C2 { }
}
}";
var expectedAfterReturn = @"namespace NS1
{
public class C1
{ public class C2 {
}
}
}";
var optionSet = new Dictionary<OptionKey2, object>
{
{ new OptionKey2(FormattingOptions2.SmartIndent, LanguageNames.CSharp), FormattingOptions.IndentStyle.Block }
};
using var session = CreateSession(code, optionSet);
Assert.NotNull(session);
CheckStart(session.Session);
Assert.Equal(expected, session.Session.SubjectBuffer.CurrentSnapshot.GetText());
CheckReturn(session.Session, 8, expectedAfterReturn);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void DoesNotFormatInsideBracePairInInitializers()
{
var code = @"class C
{
void M()
{
var x = new int[]$$
}
}";
var expected = @"class C
{
void M()
{
var x = new int[] {}
}
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
CheckText(session.Session, expected);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void DoesNotFormatOnReturnWithNonWhitespaceInBetween()
{
var code = @"class C $$";
var expected = @"class C { dd
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
Type(session.Session, "dd");
CheckReturn(session.Session, 0, expected);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void CurlyBraceFormattingInsideLambdaInsideInterpolation()
{
var code = @"class C
{
void M(string[] args)
{
var s = $""{ args.Select(a => $$)}""
}
}";
var expectedAfterStart = @"class C
{
void M(string[] args)
{
var s = $""{ args.Select(a => { })}""
}
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
Assert.Equal(expectedAfterStart, session.Session.SubjectBuffer.CurrentSnapshot.GetText());
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void CurlyBraceFormatting_DoesNotAddNewLineWhenAlreadyExists()
{
var code = @"class C $$";
var expected = @"class C
{
}";
using var session = CreateSession(code);
Assert.NotNull(session);
CheckStart(session.Session);
// Sneakily insert a new line between the braces.
var buffer = session.Session.SubjectBuffer;
buffer.Insert(10, Environment.NewLine);
CheckReturn(session.Session, 4, expected);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
public void CurlyBraceFormatting_InsertsCorrectNewLine()
{
var code = @"class C $$";
var optionSet = new Dictionary<OptionKey2, object>
{
{ new OptionKey2(FormattingOptions2.NewLine, LanguageNames.CSharp), "\r" }
};
using var session = CreateSession(code, optionSet);
Assert.NotNull(session);
CheckStart(session.Session);
CheckReturn(session.Session, 4, result: "class C\r{\r\r}");
}
internal static Holder CreateSession(string code, Dictionary<OptionKey2, object> optionSet = null)
{
return CreateSession(
TestWorkspace.CreateCSharp(code),
CurlyBrace.OpenCharacter, CurlyBrace.CloseCharacter, optionSet);
}
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Compilers/Core/Portable/CodeGen/SwitchStringJumpTableEmitter.cs | // 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.Collections.Generic;
using System.Diagnostics;
using System.Reflection.Metadata;
using Microsoft.CodeAnalysis.Emit;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.CodeGen
{
// HashBucket used when emitting hash table based string switch.
// Each hash bucket contains the list of "<string constant, label>" key-value pairs
// having identical hash value.
using HashBucket = List<KeyValuePair<ConstantValue, object>>;
internal struct SwitchStringJumpTableEmitter
{
private readonly ILBuilder _builder;
/// <summary>
/// Switch key for the jump table
/// </summary>
private readonly LocalOrParameter _key;
/// <summary>
/// Switch case labels
/// </summary>
private readonly KeyValuePair<ConstantValue, object>[] _caseLabels;
/// <summary>
/// Fall through label for the jump table
/// </summary>
private readonly object _fallThroughLabel;
/// <summary>
/// Delegate to emit string compare call and conditional branch based on the compare result.
/// </summary>
/// <param name="key">Key to compare</param>
/// <param name="stringConstant">Case constant to compare the key against</param>
/// <param name="targetLabel">Target label to branch to if key = stringConstant</param>
public delegate void EmitStringCompareAndBranch(LocalOrParameter key, ConstantValue stringConstant, object targetLabel);
/// <summary>
/// Delegate to compute string hash code.
/// This piece is language-specific because VB treats "" and null as equal while C# does not.
/// </summary>
public delegate uint GetStringHashCode(string? key);
/// <summary>
/// Delegate to emit string compare call
/// </summary>
private readonly EmitStringCompareAndBranch _emitStringCondBranchDelegate;
/// <summary>
/// Delegate to emit string hash
/// </summary>
private readonly GetStringHashCode _computeStringHashcodeDelegate;
/// <summary>
/// Local storing the key hash value, used for emitting hash table based string switch.
/// </summary>
private readonly LocalDefinition? _keyHash;
internal SwitchStringJumpTableEmitter(
ILBuilder builder,
LocalOrParameter key,
KeyValuePair<ConstantValue, object>[] caseLabels,
object fallThroughLabel,
LocalDefinition? keyHash,
EmitStringCompareAndBranch emitStringCondBranchDelegate,
GetStringHashCode computeStringHashcodeDelegate)
{
Debug.Assert(caseLabels.Length > 0);
RoslynDebug.Assert(emitStringCondBranchDelegate != null);
_builder = builder;
_key = key;
_caseLabels = caseLabels;
_fallThroughLabel = fallThroughLabel;
_keyHash = keyHash;
_emitStringCondBranchDelegate = emitStringCondBranchDelegate;
_computeStringHashcodeDelegate = computeStringHashcodeDelegate;
}
internal void EmitJumpTable()
{
Debug.Assert(_keyHash == null || ShouldGenerateHashTableSwitch(_caseLabels.Length));
if (_keyHash != null)
{
EmitHashTableSwitch();
}
else
{
EmitNonHashTableSwitch(_caseLabels);
}
}
private void EmitHashTableSwitch()
{
// Hash value for the key must have already been computed and loaded into keyHash
Debug.Assert(_keyHash != null);
// Compute hash value for each case label constant and store the hash buckets
// into a dictionary indexed by hash value.
Dictionary<uint, HashBucket> stringHashMap = ComputeStringHashMap(
_caseLabels,
_computeStringHashcodeDelegate);
// Emit conditional jumps to hash buckets.
// EmitHashBucketJumpTable returns a map from hashValues to hashBucketLabels.
Dictionary<uint, object> hashBucketLabelsMap = EmitHashBucketJumpTable(stringHashMap);
// Emit hash buckets
foreach (var kvPair in stringHashMap)
{
// hashBucketLabel:
// Emit direct string comparisons for each case label in hash bucket
_builder.MarkLabel(hashBucketLabelsMap[kvPair.Key]);
HashBucket hashBucket = kvPair.Value;
this.EmitNonHashTableSwitch(hashBucket.ToArray());
}
}
// Emits conditional jumps to hash buckets, returning a map from hashValues to hashBucketLabels.
private Dictionary<uint, object> EmitHashBucketJumpTable(Dictionary<uint, HashBucket> stringHashMap)
{
int count = stringHashMap.Count;
var hashBucketLabelsMap = new Dictionary<uint, object>(count);
var jumpTableLabels = new KeyValuePair<ConstantValue, object>[count];
int i = 0;
foreach (uint hashValue in stringHashMap.Keys)
{
ConstantValue hashConstant = ConstantValue.Create(hashValue);
object hashBucketLabel = new object();
jumpTableLabels[i] = new KeyValuePair<ConstantValue, object>(hashConstant, hashBucketLabel);
hashBucketLabelsMap[hashValue] = hashBucketLabel;
i++;
}
// Emit conditional jumps to hash buckets by using an integral switch jump table based on keyHash.
var hashBucketJumpTableEmitter = new SwitchIntegralJumpTableEmitter(
builder: _builder,
caseLabels: jumpTableLabels,
fallThroughLabel: _fallThroughLabel,
keyTypeCode: Cci.PrimitiveTypeCode.UInt32,
key: _keyHash);
hashBucketJumpTableEmitter.EmitJumpTable();
return hashBucketLabelsMap;
}
private void EmitNonHashTableSwitch(KeyValuePair<ConstantValue, object>[] labels)
{
// Direct string comparison for each case label
foreach (var kvPair in labels)
{
this.EmitCondBranchForStringSwitch(kvPair.Key, kvPair.Value);
}
_builder.EmitBranch(ILOpCode.Br, _fallThroughLabel);
}
private void EmitCondBranchForStringSwitch(ConstantValue stringConstant, object targetLabel)
{
RoslynDebug.Assert(stringConstant != null &&
(stringConstant.IsString || stringConstant.IsNull));
RoslynDebug.Assert(targetLabel != null);
_emitStringCondBranchDelegate(_key, stringConstant, targetLabel);
}
// Compute hash value for each case label constant and store the hash buckets
// into a dictionary indexed by hash value.
private static Dictionary<uint, HashBucket> ComputeStringHashMap(
KeyValuePair<ConstantValue, object>[] caseLabels,
GetStringHashCode computeStringHashcodeDelegate)
{
RoslynDebug.Assert(caseLabels != null);
var stringHashMap = new Dictionary<uint, HashBucket>(caseLabels.Length);
foreach (var kvPair in caseLabels)
{
ConstantValue stringConstant = kvPair.Key;
Debug.Assert(stringConstant.IsNull || stringConstant.IsString);
uint hash = computeStringHashcodeDelegate((string?)stringConstant.Value);
HashBucket? bucket;
if (!stringHashMap.TryGetValue(hash, out bucket))
{
bucket = new HashBucket();
stringHashMap.Add(hash, bucket);
}
Debug.Assert(!bucket.Contains(kvPair));
bucket.Add(kvPair);
}
return stringHashMap;
}
internal static bool ShouldGenerateHashTableSwitch(CommonPEModuleBuilder module, int labelsCount)
{
return module.SupportsPrivateImplClass && ShouldGenerateHashTableSwitch(labelsCount);
}
private static bool ShouldGenerateHashTableSwitch(int labelsCount)
{
// Heuristic used by Dev10 compiler for emitting string switch:
// Generate hash table based string switch jump table
// if we have at least 7 case labels. Otherwise emit
// direct string comparisons with each case label constant.
return labelsCount >= 7;
}
}
}
| // 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.Collections.Generic;
using System.Diagnostics;
using System.Reflection.Metadata;
using Microsoft.CodeAnalysis.Emit;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.CodeGen
{
// HashBucket used when emitting hash table based string switch.
// Each hash bucket contains the list of "<string constant, label>" key-value pairs
// having identical hash value.
using HashBucket = List<KeyValuePair<ConstantValue, object>>;
internal struct SwitchStringJumpTableEmitter
{
private readonly ILBuilder _builder;
/// <summary>
/// Switch key for the jump table
/// </summary>
private readonly LocalOrParameter _key;
/// <summary>
/// Switch case labels
/// </summary>
private readonly KeyValuePair<ConstantValue, object>[] _caseLabels;
/// <summary>
/// Fall through label for the jump table
/// </summary>
private readonly object _fallThroughLabel;
/// <summary>
/// Delegate to emit string compare call and conditional branch based on the compare result.
/// </summary>
/// <param name="key">Key to compare</param>
/// <param name="stringConstant">Case constant to compare the key against</param>
/// <param name="targetLabel">Target label to branch to if key = stringConstant</param>
public delegate void EmitStringCompareAndBranch(LocalOrParameter key, ConstantValue stringConstant, object targetLabel);
/// <summary>
/// Delegate to compute string hash code.
/// This piece is language-specific because VB treats "" and null as equal while C# does not.
/// </summary>
public delegate uint GetStringHashCode(string? key);
/// <summary>
/// Delegate to emit string compare call
/// </summary>
private readonly EmitStringCompareAndBranch _emitStringCondBranchDelegate;
/// <summary>
/// Delegate to emit string hash
/// </summary>
private readonly GetStringHashCode _computeStringHashcodeDelegate;
/// <summary>
/// Local storing the key hash value, used for emitting hash table based string switch.
/// </summary>
private readonly LocalDefinition? _keyHash;
internal SwitchStringJumpTableEmitter(
ILBuilder builder,
LocalOrParameter key,
KeyValuePair<ConstantValue, object>[] caseLabels,
object fallThroughLabel,
LocalDefinition? keyHash,
EmitStringCompareAndBranch emitStringCondBranchDelegate,
GetStringHashCode computeStringHashcodeDelegate)
{
Debug.Assert(caseLabels.Length > 0);
RoslynDebug.Assert(emitStringCondBranchDelegate != null);
_builder = builder;
_key = key;
_caseLabels = caseLabels;
_fallThroughLabel = fallThroughLabel;
_keyHash = keyHash;
_emitStringCondBranchDelegate = emitStringCondBranchDelegate;
_computeStringHashcodeDelegate = computeStringHashcodeDelegate;
}
internal void EmitJumpTable()
{
Debug.Assert(_keyHash == null || ShouldGenerateHashTableSwitch(_caseLabels.Length));
if (_keyHash != null)
{
EmitHashTableSwitch();
}
else
{
EmitNonHashTableSwitch(_caseLabels);
}
}
private void EmitHashTableSwitch()
{
// Hash value for the key must have already been computed and loaded into keyHash
Debug.Assert(_keyHash != null);
// Compute hash value for each case label constant and store the hash buckets
// into a dictionary indexed by hash value.
Dictionary<uint, HashBucket> stringHashMap = ComputeStringHashMap(
_caseLabels,
_computeStringHashcodeDelegate);
// Emit conditional jumps to hash buckets.
// EmitHashBucketJumpTable returns a map from hashValues to hashBucketLabels.
Dictionary<uint, object> hashBucketLabelsMap = EmitHashBucketJumpTable(stringHashMap);
// Emit hash buckets
foreach (var kvPair in stringHashMap)
{
// hashBucketLabel:
// Emit direct string comparisons for each case label in hash bucket
_builder.MarkLabel(hashBucketLabelsMap[kvPair.Key]);
HashBucket hashBucket = kvPair.Value;
this.EmitNonHashTableSwitch(hashBucket.ToArray());
}
}
// Emits conditional jumps to hash buckets, returning a map from hashValues to hashBucketLabels.
private Dictionary<uint, object> EmitHashBucketJumpTable(Dictionary<uint, HashBucket> stringHashMap)
{
int count = stringHashMap.Count;
var hashBucketLabelsMap = new Dictionary<uint, object>(count);
var jumpTableLabels = new KeyValuePair<ConstantValue, object>[count];
int i = 0;
foreach (uint hashValue in stringHashMap.Keys)
{
ConstantValue hashConstant = ConstantValue.Create(hashValue);
object hashBucketLabel = new object();
jumpTableLabels[i] = new KeyValuePair<ConstantValue, object>(hashConstant, hashBucketLabel);
hashBucketLabelsMap[hashValue] = hashBucketLabel;
i++;
}
// Emit conditional jumps to hash buckets by using an integral switch jump table based on keyHash.
var hashBucketJumpTableEmitter = new SwitchIntegralJumpTableEmitter(
builder: _builder,
caseLabels: jumpTableLabels,
fallThroughLabel: _fallThroughLabel,
keyTypeCode: Cci.PrimitiveTypeCode.UInt32,
key: _keyHash);
hashBucketJumpTableEmitter.EmitJumpTable();
return hashBucketLabelsMap;
}
private void EmitNonHashTableSwitch(KeyValuePair<ConstantValue, object>[] labels)
{
// Direct string comparison for each case label
foreach (var kvPair in labels)
{
this.EmitCondBranchForStringSwitch(kvPair.Key, kvPair.Value);
}
_builder.EmitBranch(ILOpCode.Br, _fallThroughLabel);
}
private void EmitCondBranchForStringSwitch(ConstantValue stringConstant, object targetLabel)
{
RoslynDebug.Assert(stringConstant != null &&
(stringConstant.IsString || stringConstant.IsNull));
RoslynDebug.Assert(targetLabel != null);
_emitStringCondBranchDelegate(_key, stringConstant, targetLabel);
}
// Compute hash value for each case label constant and store the hash buckets
// into a dictionary indexed by hash value.
private static Dictionary<uint, HashBucket> ComputeStringHashMap(
KeyValuePair<ConstantValue, object>[] caseLabels,
GetStringHashCode computeStringHashcodeDelegate)
{
RoslynDebug.Assert(caseLabels != null);
var stringHashMap = new Dictionary<uint, HashBucket>(caseLabels.Length);
foreach (var kvPair in caseLabels)
{
ConstantValue stringConstant = kvPair.Key;
Debug.Assert(stringConstant.IsNull || stringConstant.IsString);
uint hash = computeStringHashcodeDelegate((string?)stringConstant.Value);
HashBucket? bucket;
if (!stringHashMap.TryGetValue(hash, out bucket))
{
bucket = new HashBucket();
stringHashMap.Add(hash, bucket);
}
Debug.Assert(!bucket.Contains(kvPair));
bucket.Add(kvPair);
}
return stringHashMap;
}
internal static bool ShouldGenerateHashTableSwitch(CommonPEModuleBuilder module, int labelsCount)
{
return module.SupportsPrivateImplClass && ShouldGenerateHashTableSwitch(labelsCount);
}
private static bool ShouldGenerateHashTableSwitch(int labelsCount)
{
// Heuristic used by Dev10 compiler for emitting string switch:
// Generate hash table based string switch jump table
// if we have at least 7 case labels. Otherwise emit
// direct string comparisons with each case label constant.
return labelsCount >= 7;
}
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Features/Core/Portable/RQName/Nodes/RQConstructor.cs | // 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.Collections.Generic;
namespace Microsoft.CodeAnalysis.Features.RQName.Nodes
{
internal class RQConstructor : RQMethodBase
{
public RQConstructor(
RQUnconstructedType containingType,
RQMethodPropertyOrEventName memberName,
int typeParameterCount,
IList<RQParameter> parameters)
: base(containingType, memberName, typeParameterCount, parameters)
{
}
}
}
| // 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.Collections.Generic;
namespace Microsoft.CodeAnalysis.Features.RQName.Nodes
{
internal class RQConstructor : RQMethodBase
{
public RQConstructor(
RQUnconstructedType containingType,
RQMethodPropertyOrEventName memberName,
int typeParameterCount,
IList<RQParameter> parameters)
: base(containingType, memberName, typeParameterCount, parameters)
{
}
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Workspaces/Core/Portable/Log/AggregateLogger.cs | // 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.
#nullable disable
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using System.Threading;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Internal.Log
{
/// <summary>
/// a logger that aggregate multiple loggers
/// </summary>
internal sealed class AggregateLogger : ILogger
{
private readonly ImmutableArray<ILogger> _loggers;
public static AggregateLogger Create(params ILogger[] loggers)
{
var set = new HashSet<ILogger>();
// flatten loggers
foreach (var logger in loggers.WhereNotNull())
{
if (logger is AggregateLogger aggregateLogger)
{
set.UnionWith(aggregateLogger._loggers);
continue;
}
set.Add(logger);
}
return new AggregateLogger(set.ToImmutableArray());
}
public static ILogger AddOrReplace(ILogger newLogger, ILogger oldLogger, Func<ILogger, bool> predicate)
{
if (newLogger == null)
{
return oldLogger;
}
if (oldLogger == null)
{
return newLogger;
}
var aggregateLogger = oldLogger as AggregateLogger;
if (aggregateLogger == null)
{
// replace old logger with new logger
if (predicate(oldLogger))
{
// this might not aggregate logger
return newLogger;
}
// merge two
return new AggregateLogger(ImmutableArray.Create(newLogger, oldLogger));
}
var set = new HashSet<ILogger>();
foreach (var logger in aggregateLogger._loggers)
{
// replace this logger with new logger
if (predicate(logger))
{
set.Add(newLogger);
continue;
}
// add old one back
set.Add(logger);
}
// add new logger. if we already added one, this will be ignored.
set.Add(newLogger);
return new AggregateLogger(set.ToImmutableArray());
}
public static ILogger Remove(ILogger logger, Func<ILogger, bool> predicate)
{
var aggregateLogger = logger as AggregateLogger;
if (aggregateLogger == null)
{
// remove the logger
if (predicate(logger))
{
return null;
}
return logger;
}
// filter out loggers
var set = aggregateLogger._loggers.Where(l => !predicate(l)).ToSet();
if (set.Count == 1)
{
return set.Single();
}
return new AggregateLogger(set.ToImmutableArray());
}
private AggregateLogger(ImmutableArray<ILogger> loggers)
=> _loggers = loggers;
public bool IsEnabled(FunctionId functionId)
=> true;
public void Log(FunctionId functionId, LogMessage logMessage)
{
for (var i = 0; i < _loggers.Length; i++)
{
var logger = _loggers[i];
if (!logger.IsEnabled(functionId))
{
continue;
}
logger.Log(functionId, logMessage);
}
}
public void LogBlockStart(FunctionId functionId, LogMessage logMessage, int uniquePairId, CancellationToken cancellationToken)
{
for (var i = 0; i < _loggers.Length; i++)
{
var logger = _loggers[i];
if (!logger.IsEnabled(functionId))
{
continue;
}
logger.LogBlockStart(functionId, logMessage, uniquePairId, cancellationToken);
}
}
public void LogBlockEnd(FunctionId functionId, LogMessage logMessage, int uniquePairId, int delta, CancellationToken cancellationToken)
{
for (var i = 0; i < _loggers.Length; i++)
{
var logger = _loggers[i];
if (!logger.IsEnabled(functionId))
{
continue;
}
logger.LogBlockEnd(functionId, logMessage, uniquePairId, delta, cancellationToken);
}
}
}
}
| // 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.
#nullable disable
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using System.Threading;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Internal.Log
{
/// <summary>
/// a logger that aggregate multiple loggers
/// </summary>
internal sealed class AggregateLogger : ILogger
{
private readonly ImmutableArray<ILogger> _loggers;
public static AggregateLogger Create(params ILogger[] loggers)
{
var set = new HashSet<ILogger>();
// flatten loggers
foreach (var logger in loggers.WhereNotNull())
{
if (logger is AggregateLogger aggregateLogger)
{
set.UnionWith(aggregateLogger._loggers);
continue;
}
set.Add(logger);
}
return new AggregateLogger(set.ToImmutableArray());
}
public static ILogger AddOrReplace(ILogger newLogger, ILogger oldLogger, Func<ILogger, bool> predicate)
{
if (newLogger == null)
{
return oldLogger;
}
if (oldLogger == null)
{
return newLogger;
}
var aggregateLogger = oldLogger as AggregateLogger;
if (aggregateLogger == null)
{
// replace old logger with new logger
if (predicate(oldLogger))
{
// this might not aggregate logger
return newLogger;
}
// merge two
return new AggregateLogger(ImmutableArray.Create(newLogger, oldLogger));
}
var set = new HashSet<ILogger>();
foreach (var logger in aggregateLogger._loggers)
{
// replace this logger with new logger
if (predicate(logger))
{
set.Add(newLogger);
continue;
}
// add old one back
set.Add(logger);
}
// add new logger. if we already added one, this will be ignored.
set.Add(newLogger);
return new AggregateLogger(set.ToImmutableArray());
}
public static ILogger Remove(ILogger logger, Func<ILogger, bool> predicate)
{
var aggregateLogger = logger as AggregateLogger;
if (aggregateLogger == null)
{
// remove the logger
if (predicate(logger))
{
return null;
}
return logger;
}
// filter out loggers
var set = aggregateLogger._loggers.Where(l => !predicate(l)).ToSet();
if (set.Count == 1)
{
return set.Single();
}
return new AggregateLogger(set.ToImmutableArray());
}
private AggregateLogger(ImmutableArray<ILogger> loggers)
=> _loggers = loggers;
public bool IsEnabled(FunctionId functionId)
=> true;
public void Log(FunctionId functionId, LogMessage logMessage)
{
for (var i = 0; i < _loggers.Length; i++)
{
var logger = _loggers[i];
if (!logger.IsEnabled(functionId))
{
continue;
}
logger.Log(functionId, logMessage);
}
}
public void LogBlockStart(FunctionId functionId, LogMessage logMessage, int uniquePairId, CancellationToken cancellationToken)
{
for (var i = 0; i < _loggers.Length; i++)
{
var logger = _loggers[i];
if (!logger.IsEnabled(functionId))
{
continue;
}
logger.LogBlockStart(functionId, logMessage, uniquePairId, cancellationToken);
}
}
public void LogBlockEnd(FunctionId functionId, LogMessage logMessage, int uniquePairId, int delta, CancellationToken cancellationToken)
{
for (var i = 0; i < _loggers.Length; i++)
{
var logger = _loggers[i];
if (!logger.IsEnabled(functionId))
{
continue;
}
logger.LogBlockEnd(functionId, logMessage, uniquePairId, delta, cancellationToken);
}
}
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Features/Core/Portable/Completion/CompletionProviderMetadata.cs | // 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.
#nullable disable
using System.Collections.Generic;
using Microsoft.CodeAnalysis.Host.Mef;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Completion.Providers
{
internal sealed class CompletionProviderMetadata : OrderableLanguageMetadata
{
public string[] Roles { get; }
public CompletionProviderMetadata(IDictionary<string, object> data)
: base(data)
{
Roles = (string[])data.GetValueOrDefault("Roles")
?? (string[])data.GetValueOrDefault("TextViewRoles");
}
}
}
| // 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.
#nullable disable
using System.Collections.Generic;
using Microsoft.CodeAnalysis.Host.Mef;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Completion.Providers
{
internal sealed class CompletionProviderMetadata : OrderableLanguageMetadata
{
public string[] Roles { get; }
public CompletionProviderMetadata(IDictionary<string, object> data)
: base(data)
{
Roles = (string[])data.GetValueOrDefault("Roles")
?? (string[])data.GetValueOrDefault("TextViewRoles");
}
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Compilers/Core/Portable/MetadataReader/LocalSlotConstraints.cs | // 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;
namespace Microsoft.CodeAnalysis
{
[Flags]
internal enum LocalSlotConstraints : byte
{
None = 0,
ByRef = 1,
Pinned = 2,
}
}
| // 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;
namespace Microsoft.CodeAnalysis
{
[Flags]
internal enum LocalSlotConstraints : byte
{
None = 0,
ByRef = 1,
Pinned = 2,
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Features/LanguageServer/Protocol/Extensions/Extensions.cs | // 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.Collections.Immutable;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.FindUsages;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Microsoft.CodeAnalysis.Text;
using Microsoft.VisualStudio.LanguageServer.Protocol;
using Microsoft.VisualStudio.Text.Adornments;
namespace Microsoft.CodeAnalysis.LanguageServer
{
internal static class Extensions
{
public static Uri GetURI(this TextDocument document)
{
return ProtocolConversions.GetUriFromFilePath(document.FilePath);
}
public static ImmutableArray<Document> GetDocuments(this Solution solution, Uri documentUri)
=> GetDocuments(solution, documentUri, clientName: null, logger: null);
public static ImmutableArray<Document> GetDocuments(this Solution solution, Uri documentUri, string? clientName)
=> GetDocuments(solution, documentUri, clientName, logger: null);
public static ImmutableArray<Document> GetDocuments(this Solution solution, Uri documentUri, string? clientName, ILspLogger? logger)
{
var documentIds = GetDocumentIds(solution, documentUri);
var documents = documentIds.SelectAsArray(id => solution.GetRequiredDocument(id));
return FilterDocumentsByClientName(documents, clientName, logger);
}
public static ImmutableArray<DocumentId> GetDocumentIds(this Solution solution, Uri documentUri)
{
// TODO: we need to normalize this. but for now, we check both absolute and local path
// right now, based on who calls this, solution might has "/" or "\\" as directory
// separator
var documentIds = solution.GetDocumentIdsWithFilePath(documentUri.AbsolutePath);
if (!documentIds.Any())
{
documentIds = solution.GetDocumentIdsWithFilePath(documentUri.LocalPath);
}
return documentIds;
}
private static ImmutableArray<Document> FilterDocumentsByClientName(ImmutableArray<Document> documents, string? clientName, ILspLogger? logger)
{
// If we don't have a client name, then we're done filtering
if (clientName == null)
{
return documents;
}
// We have a client name, so we need to filter to only documents that match that name
return documents.WhereAsArray(document =>
{
var documentPropertiesService = document.Services.GetService<DocumentPropertiesService>();
// When a client name is specified, only return documents that have a matching client name.
// Allows the razor lsp server to return results only for razor documents.
// This workaround should be removed when https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1106064/
// is fixed (so that the razor language server is only asked about razor buffers).
var documentClientName = documentPropertiesService?.DiagnosticsLspClientName;
var clientNameMatch = Equals(documentClientName, clientName);
if (!clientNameMatch && logger is not null)
{
logger.TraceInformation($"Found matching document but it's client name '{documentClientName}' is not a match.");
}
return clientNameMatch;
});
}
public static Document? GetDocument(this Solution solution, TextDocumentIdentifier documentIdentifier)
=> solution.GetDocument(documentIdentifier, clientName: null);
public static Document? GetDocument(this Solution solution, TextDocumentIdentifier documentIdentifier, string? clientName)
{
var documents = solution.GetDocuments(documentIdentifier.Uri, clientName, logger: null);
if (documents.Length == 0)
{
return null;
}
return documents.FindDocumentInProjectContext(documentIdentifier);
}
public static Document FindDocumentInProjectContext(this ImmutableArray<Document> documents, TextDocumentIdentifier documentIdentifier)
{
if (documents.Length > 1)
{
// We have more than one document; try to find the one that matches the right context
if (documentIdentifier is VSTextDocumentIdentifier vsDocumentIdentifier && vsDocumentIdentifier.ProjectContext != null)
{
var projectId = ProtocolConversions.ProjectContextToProjectId(vsDocumentIdentifier.ProjectContext);
var matchingDocument = documents.FirstOrDefault(d => d.Project.Id == projectId);
if (matchingDocument != null)
{
return matchingDocument;
}
}
else
{
// We were not passed a project context. This can happen when the LSP powered NavBar is not enabled.
// This branch should be removed when we're using the LSP based navbar in all scenarios.
var solution = documents.First().Project.Solution;
// Lookup which of the linked documents is currently active in the workspace.
var documentIdInCurrentContext = solution.Workspace.GetDocumentIdInCurrentContext(documents.First().Id);
return solution.GetRequiredDocument(documentIdInCurrentContext);
}
}
// We either have only one document or have multiple, but none of them matched our context. In the
// latter case, we'll just return the first one arbitrarily since this might just be some temporary mis-sync
// of client and server state.
return documents[0];
}
public static async Task<int> GetPositionFromLinePositionAsync(this TextDocument document, LinePosition linePosition, CancellationToken cancellationToken)
{
var text = await document.GetTextAsync(cancellationToken).ConfigureAwait(false);
return text.Lines.GetPosition(linePosition);
}
public static bool HasVisualStudioLspCapability(this ClientCapabilities? clientCapabilities)
{
if (clientCapabilities is VSInternalClientCapabilities vsClientCapabilities)
{
return vsClientCapabilities.SupportsVisualStudioExtensions;
}
return false;
}
public static bool HasCompletionListDataCapability(this ClientCapabilities clientCapabilities)
{
if (!TryGetVSCompletionListSetting(clientCapabilities, out var completionListSetting))
{
return false;
}
return completionListSetting.Data;
}
public static bool HasCompletionListCommitCharactersCapability(this ClientCapabilities clientCapabilities)
{
if (!TryGetVSCompletionListSetting(clientCapabilities, out var completionListSetting))
{
return false;
}
return completionListSetting.CommitCharacters;
}
public static string GetMarkdownLanguageName(this Document document)
{
switch (document.Project.Language)
{
case LanguageNames.CSharp:
return "csharp";
case LanguageNames.VisualBasic:
return "vb";
case LanguageNames.FSharp:
return "fsharp";
case "TypeScript":
return "typescript";
default:
throw new ArgumentException(string.Format("Document project language {0} is not valid", document.Project.Language));
}
}
public static ClassifiedTextElement GetClassifiedText(this DefinitionItem definition)
=> new ClassifiedTextElement(definition.DisplayParts.Select(part => new ClassifiedTextRun(part.Tag.ToClassificationTypeName(), part.Text)));
public static bool IsRazorDocument(this Document document)
{
// Only razor docs have an ISpanMappingService, so we can use the presence of that to determine if this doc
// belongs to them.
var spanMapper = document.Services.GetService<ISpanMappingService>();
return spanMapper != null;
}
private static bool TryGetVSCompletionListSetting(ClientCapabilities clientCapabilities, [NotNullWhen(returnValue: true)] out VSInternalCompletionListSetting? completionListSetting)
{
if (clientCapabilities is not VSInternalClientCapabilities vsClientCapabilities)
{
completionListSetting = null;
return false;
}
var textDocumentCapability = vsClientCapabilities.TextDocument;
if (textDocumentCapability == null)
{
completionListSetting = null;
return false;
}
if (textDocumentCapability.Completion is not VSInternalCompletionSetting vsCompletionSetting)
{
completionListSetting = null;
return false;
}
completionListSetting = vsCompletionSetting.CompletionList;
if (completionListSetting == null)
{
return false;
}
return true;
}
}
}
| // 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.Collections.Immutable;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.FindUsages;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Microsoft.CodeAnalysis.Text;
using Microsoft.VisualStudio.LanguageServer.Protocol;
using Microsoft.VisualStudio.Text.Adornments;
namespace Microsoft.CodeAnalysis.LanguageServer
{
internal static class Extensions
{
public static Uri GetURI(this TextDocument document)
{
return ProtocolConversions.GetUriFromFilePath(document.FilePath);
}
public static ImmutableArray<Document> GetDocuments(this Solution solution, Uri documentUri)
=> GetDocuments(solution, documentUri, clientName: null, logger: null);
public static ImmutableArray<Document> GetDocuments(this Solution solution, Uri documentUri, string? clientName)
=> GetDocuments(solution, documentUri, clientName, logger: null);
public static ImmutableArray<Document> GetDocuments(this Solution solution, Uri documentUri, string? clientName, ILspLogger? logger)
{
var documentIds = GetDocumentIds(solution, documentUri);
var documents = documentIds.SelectAsArray(id => solution.GetRequiredDocument(id));
return FilterDocumentsByClientName(documents, clientName, logger);
}
public static ImmutableArray<DocumentId> GetDocumentIds(this Solution solution, Uri documentUri)
{
// TODO: we need to normalize this. but for now, we check both absolute and local path
// right now, based on who calls this, solution might has "/" or "\\" as directory
// separator
var documentIds = solution.GetDocumentIdsWithFilePath(documentUri.AbsolutePath);
if (!documentIds.Any())
{
documentIds = solution.GetDocumentIdsWithFilePath(documentUri.LocalPath);
}
return documentIds;
}
private static ImmutableArray<Document> FilterDocumentsByClientName(ImmutableArray<Document> documents, string? clientName, ILspLogger? logger)
{
// If we don't have a client name, then we're done filtering
if (clientName == null)
{
return documents;
}
// We have a client name, so we need to filter to only documents that match that name
return documents.WhereAsArray(document =>
{
var documentPropertiesService = document.Services.GetService<DocumentPropertiesService>();
// When a client name is specified, only return documents that have a matching client name.
// Allows the razor lsp server to return results only for razor documents.
// This workaround should be removed when https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1106064/
// is fixed (so that the razor language server is only asked about razor buffers).
var documentClientName = documentPropertiesService?.DiagnosticsLspClientName;
var clientNameMatch = Equals(documentClientName, clientName);
if (!clientNameMatch && logger is not null)
{
logger.TraceInformation($"Found matching document but it's client name '{documentClientName}' is not a match.");
}
return clientNameMatch;
});
}
public static Document? GetDocument(this Solution solution, TextDocumentIdentifier documentIdentifier)
=> solution.GetDocument(documentIdentifier, clientName: null);
public static Document? GetDocument(this Solution solution, TextDocumentIdentifier documentIdentifier, string? clientName)
{
var documents = solution.GetDocuments(documentIdentifier.Uri, clientName, logger: null);
if (documents.Length == 0)
{
return null;
}
return documents.FindDocumentInProjectContext(documentIdentifier);
}
public static Document FindDocumentInProjectContext(this ImmutableArray<Document> documents, TextDocumentIdentifier documentIdentifier)
{
if (documents.Length > 1)
{
// We have more than one document; try to find the one that matches the right context
if (documentIdentifier is VSTextDocumentIdentifier vsDocumentIdentifier && vsDocumentIdentifier.ProjectContext != null)
{
var projectId = ProtocolConversions.ProjectContextToProjectId(vsDocumentIdentifier.ProjectContext);
var matchingDocument = documents.FirstOrDefault(d => d.Project.Id == projectId);
if (matchingDocument != null)
{
return matchingDocument;
}
}
else
{
// We were not passed a project context. This can happen when the LSP powered NavBar is not enabled.
// This branch should be removed when we're using the LSP based navbar in all scenarios.
var solution = documents.First().Project.Solution;
// Lookup which of the linked documents is currently active in the workspace.
var documentIdInCurrentContext = solution.Workspace.GetDocumentIdInCurrentContext(documents.First().Id);
return solution.GetRequiredDocument(documentIdInCurrentContext);
}
}
// We either have only one document or have multiple, but none of them matched our context. In the
// latter case, we'll just return the first one arbitrarily since this might just be some temporary mis-sync
// of client and server state.
return documents[0];
}
public static async Task<int> GetPositionFromLinePositionAsync(this TextDocument document, LinePosition linePosition, CancellationToken cancellationToken)
{
var text = await document.GetTextAsync(cancellationToken).ConfigureAwait(false);
return text.Lines.GetPosition(linePosition);
}
public static bool HasVisualStudioLspCapability(this ClientCapabilities? clientCapabilities)
{
if (clientCapabilities is VSInternalClientCapabilities vsClientCapabilities)
{
return vsClientCapabilities.SupportsVisualStudioExtensions;
}
return false;
}
public static bool HasCompletionListDataCapability(this ClientCapabilities clientCapabilities)
{
if (!TryGetVSCompletionListSetting(clientCapabilities, out var completionListSetting))
{
return false;
}
return completionListSetting.Data;
}
public static bool HasCompletionListCommitCharactersCapability(this ClientCapabilities clientCapabilities)
{
if (!TryGetVSCompletionListSetting(clientCapabilities, out var completionListSetting))
{
return false;
}
return completionListSetting.CommitCharacters;
}
public static string GetMarkdownLanguageName(this Document document)
{
switch (document.Project.Language)
{
case LanguageNames.CSharp:
return "csharp";
case LanguageNames.VisualBasic:
return "vb";
case LanguageNames.FSharp:
return "fsharp";
case "TypeScript":
return "typescript";
default:
throw new ArgumentException(string.Format("Document project language {0} is not valid", document.Project.Language));
}
}
public static ClassifiedTextElement GetClassifiedText(this DefinitionItem definition)
=> new ClassifiedTextElement(definition.DisplayParts.Select(part => new ClassifiedTextRun(part.Tag.ToClassificationTypeName(), part.Text)));
public static bool IsRazorDocument(this Document document)
{
// Only razor docs have an ISpanMappingService, so we can use the presence of that to determine if this doc
// belongs to them.
var spanMapper = document.Services.GetService<ISpanMappingService>();
return spanMapper != null;
}
private static bool TryGetVSCompletionListSetting(ClientCapabilities clientCapabilities, [NotNullWhen(returnValue: true)] out VSInternalCompletionListSetting? completionListSetting)
{
if (clientCapabilities is not VSInternalClientCapabilities vsClientCapabilities)
{
completionListSetting = null;
return false;
}
var textDocumentCapability = vsClientCapabilities.TextDocument;
if (textDocumentCapability == null)
{
completionListSetting = null;
return false;
}
if (textDocumentCapability.Completion is not VSInternalCompletionSetting vsCompletionSetting)
{
completionListSetting = null;
return false;
}
completionListSetting = vsCompletionSetting.CompletionList;
if (completionListSetting == null)
{
return false;
}
return true;
}
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Features/Core/Portable/ExtractInterface/ExtractInterfaceOptionsResult.cs | // 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.
#nullable disable
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.ExtractInterface
{
internal class ExtractInterfaceOptionsResult
{
public enum ExtractLocation
{
SameFile,
NewFile
}
public static readonly ExtractInterfaceOptionsResult Cancelled = new(isCancelled: true);
public bool IsCancelled { get; }
public ImmutableArray<ISymbol> IncludedMembers { get; }
public string InterfaceName { get; }
public string FileName { get; }
public ExtractLocation Location { get; }
public ExtractInterfaceOptionsResult(bool isCancelled, ImmutableArray<ISymbol> includedMembers, string interfaceName, string fileName, ExtractLocation location)
{
IsCancelled = isCancelled;
IncludedMembers = includedMembers;
InterfaceName = interfaceName;
Location = location;
FileName = fileName;
}
private ExtractInterfaceOptionsResult(bool isCancelled)
=> IsCancelled = isCancelled;
}
}
| // 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.
#nullable disable
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.ExtractInterface
{
internal class ExtractInterfaceOptionsResult
{
public enum ExtractLocation
{
SameFile,
NewFile
}
public static readonly ExtractInterfaceOptionsResult Cancelled = new(isCancelled: true);
public bool IsCancelled { get; }
public ImmutableArray<ISymbol> IncludedMembers { get; }
public string InterfaceName { get; }
public string FileName { get; }
public ExtractLocation Location { get; }
public ExtractInterfaceOptionsResult(bool isCancelled, ImmutableArray<ISymbol> includedMembers, string interfaceName, string fileName, ExtractLocation location)
{
IsCancelled = isCancelled;
IncludedMembers = includedMembers;
InterfaceName = interfaceName;
Location = location;
FileName = fileName;
}
private ExtractInterfaceOptionsResult(bool isCancelled)
=> IsCancelled = isCancelled;
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/Rules/Operations/AlignTokensOperation.cs | // 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.Collections.Generic;
using System.Diagnostics;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Formatting.Rules
{
/// <summary>
/// align first tokens on lines among the given tokens to the base token
/// </summary>
internal sealed class AlignTokensOperation
{
internal AlignTokensOperation(SyntaxToken baseToken, IEnumerable<SyntaxToken> tokens, AlignTokensOption option)
{
Contract.ThrowIfNull(tokens);
Debug.Assert(!tokens.IsEmpty());
this.Option = option;
this.BaseToken = baseToken;
this.Tokens = tokens;
}
public SyntaxToken BaseToken { get; }
public IEnumerable<SyntaxToken> Tokens { get; }
public AlignTokensOption Option { get; }
}
}
| // 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.Collections.Generic;
using System.Diagnostics;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Formatting.Rules
{
/// <summary>
/// align first tokens on lines among the given tokens to the base token
/// </summary>
internal sealed class AlignTokensOperation
{
internal AlignTokensOperation(SyntaxToken baseToken, IEnumerable<SyntaxToken> tokens, AlignTokensOption option)
{
Contract.ThrowIfNull(tokens);
Debug.Assert(!tokens.IsEmpty());
this.Option = option;
this.BaseToken = baseToken;
this.Tokens = tokens;
}
public SyntaxToken BaseToken { get; }
public IEnumerable<SyntaxToken> Tokens { get; }
public AlignTokensOption Option { get; }
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Features/Core/Portable/CodeRefactorings/MoveType/AbstractMoveTypeService.State.cs | // 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.
#nullable disable
using System.IO;
using System.Linq;
using System.Threading;
using Microsoft.CodeAnalysis.LanguageServices;
using Microsoft.CodeAnalysis.Shared.Extensions;
namespace Microsoft.CodeAnalysis.CodeRefactorings.MoveType
{
internal abstract partial class AbstractMoveTypeService<TService, TTypeDeclarationSyntax, TNamespaceDeclarationSyntax, TMemberDeclarationSyntax, TCompilationUnitSyntax>
{
private class State
{
public SemanticDocument SemanticDocument { get; }
public TTypeDeclarationSyntax TypeNode { get; set; }
public string TypeName { get; set; }
public string DocumentNameWithoutExtension { get; set; }
public bool IsDocumentNameAValidIdentifier { get; set; }
private State(SemanticDocument document)
=> SemanticDocument = document;
internal static State Generate(
SemanticDocument document, TTypeDeclarationSyntax typeDeclaration,
CancellationToken cancellationToken)
{
var state = new State(document);
if (!state.TryInitialize(typeDeclaration, cancellationToken))
{
return null;
}
return state;
}
private bool TryInitialize(
TTypeDeclarationSyntax typeDeclaration,
CancellationToken cancellationToken)
{
if (cancellationToken.IsCancellationRequested)
{
return false;
}
var tree = SemanticDocument.SyntaxTree;
var root = SemanticDocument.Root;
var syntaxFacts = SemanticDocument.Document.GetLanguageService<ISyntaxFactsService>();
// compiler declared types, anonymous types, types defined in metadata should be filtered out.
if (SemanticDocument.SemanticModel.GetDeclaredSymbol(typeDeclaration, cancellationToken) is not INamedTypeSymbol typeSymbol ||
typeSymbol.Locations.Any(loc => loc.IsInMetadata) ||
typeSymbol.IsAnonymousType ||
typeSymbol.IsImplicitlyDeclared ||
typeSymbol.Name == string.Empty)
{
return false;
}
TypeNode = typeDeclaration;
TypeName = typeSymbol.Name;
DocumentNameWithoutExtension = Path.GetFileNameWithoutExtension(SemanticDocument.Document.Name);
IsDocumentNameAValidIdentifier = syntaxFacts.IsValidIdentifier(DocumentNameWithoutExtension);
return true;
}
}
}
}
| // 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.
#nullable disable
using System.IO;
using System.Linq;
using System.Threading;
using Microsoft.CodeAnalysis.LanguageServices;
using Microsoft.CodeAnalysis.Shared.Extensions;
namespace Microsoft.CodeAnalysis.CodeRefactorings.MoveType
{
internal abstract partial class AbstractMoveTypeService<TService, TTypeDeclarationSyntax, TNamespaceDeclarationSyntax, TMemberDeclarationSyntax, TCompilationUnitSyntax>
{
private class State
{
public SemanticDocument SemanticDocument { get; }
public TTypeDeclarationSyntax TypeNode { get; set; }
public string TypeName { get; set; }
public string DocumentNameWithoutExtension { get; set; }
public bool IsDocumentNameAValidIdentifier { get; set; }
private State(SemanticDocument document)
=> SemanticDocument = document;
internal static State Generate(
SemanticDocument document, TTypeDeclarationSyntax typeDeclaration,
CancellationToken cancellationToken)
{
var state = new State(document);
if (!state.TryInitialize(typeDeclaration, cancellationToken))
{
return null;
}
return state;
}
private bool TryInitialize(
TTypeDeclarationSyntax typeDeclaration,
CancellationToken cancellationToken)
{
if (cancellationToken.IsCancellationRequested)
{
return false;
}
var tree = SemanticDocument.SyntaxTree;
var root = SemanticDocument.Root;
var syntaxFacts = SemanticDocument.Document.GetLanguageService<ISyntaxFactsService>();
// compiler declared types, anonymous types, types defined in metadata should be filtered out.
if (SemanticDocument.SemanticModel.GetDeclaredSymbol(typeDeclaration, cancellationToken) is not INamedTypeSymbol typeSymbol ||
typeSymbol.Locations.Any(loc => loc.IsInMetadata) ||
typeSymbol.IsAnonymousType ||
typeSymbol.IsImplicitlyDeclared ||
typeSymbol.Name == string.Empty)
{
return false;
}
TypeNode = typeDeclaration;
TypeName = typeSymbol.Name;
DocumentNameWithoutExtension = Path.GetFileNameWithoutExtension(SemanticDocument.Document.Name);
IsDocumentNameAValidIdentifier = syntaxFacts.IsValidIdentifier(DocumentNameWithoutExtension);
return true;
}
}
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/VisualStudio/Core/Test/CodeModel/AbstractCodeStructTests.vb | ' 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.
Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel
Public MustInherit Class AbstractCodeStructTests
Inherits AbstractCodeElementTests(Of EnvDTE80.CodeStruct2)
Protected Overrides Function GetStartPointFunc(codeElement As EnvDTE80.CodeStruct2) As Func(Of EnvDTE.vsCMPart, EnvDTE.TextPoint)
Return Function(part) codeElement.GetStartPoint(part)
End Function
Protected Overrides Function GetEndPointFunc(codeElement As EnvDTE80.CodeStruct2) As Func(Of EnvDTE.vsCMPart, EnvDTE.TextPoint)
Return Function(part) codeElement.GetEndPoint(part)
End Function
Protected Overrides Function GetAccess(codeElement As EnvDTE80.CodeStruct2) As EnvDTE.vsCMAccess
Return codeElement.Access
End Function
Protected Overrides Function GetAttributes(codeElement As EnvDTE80.CodeStruct2) As EnvDTE.CodeElements
Return codeElement.Attributes
End Function
Protected Overrides Function GetBases(codeElement As EnvDTE80.CodeStruct2) As EnvDTE.CodeElements
Return codeElement.Bases
End Function
Protected Overrides Function GetComment(codeElement As EnvDTE80.CodeStruct2) As String
Return codeElement.Comment
End Function
Protected Overrides Function GetDataTypeKind(codeElement As EnvDTE80.CodeStruct2) As EnvDTE80.vsCMDataTypeKind
Return codeElement.DataTypeKind
End Function
Protected Overrides Function GetDocComment(codeElement As EnvDTE80.CodeStruct2) As String
Return codeElement.DocComment
End Function
Protected Overrides Function GetFullName(codeElement As EnvDTE80.CodeStruct2) As String
Return codeElement.FullName
End Function
Protected Overrides Function GetImplementedInterfaces(codeElement As EnvDTE80.CodeStruct2) As EnvDTE.CodeElements
Return codeElement.ImplementedInterfaces
End Function
Protected Overrides Function GetKind(codeElement As EnvDTE80.CodeStruct2) As EnvDTE.vsCMElement
Return codeElement.Kind
End Function
Protected Overrides Function GetName(codeElement As EnvDTE80.CodeStruct2) As String
Return codeElement.Name
End Function
Protected Overrides Function GetParent(codeElement As EnvDTE80.CodeStruct2) As Object
Return codeElement.Parent
End Function
Protected Overrides Function GetParts(codeElement As EnvDTE80.CodeStruct2) As EnvDTE.CodeElements
Return codeElement.Parts
End Function
Protected Overrides Function AddFunction(codeElement As EnvDTE80.CodeStruct2, data As FunctionData) As EnvDTE.CodeFunction
Return codeElement.AddFunction(data.Name, data.Kind, data.Type, data.Position, data.Access, data.Location)
End Function
Protected Overrides Function AddAttribute(codeElement As EnvDTE80.CodeStruct2, data As AttributeData) As EnvDTE.CodeAttribute
Return codeElement.AddAttribute(data.Name, data.Value, data.Position)
End Function
Protected Overrides Function GetNameSetter(codeElement As EnvDTE80.CodeStruct2) As Action(Of String)
Return Sub(name) codeElement.Name = name
End Function
Protected Overrides Function AddImplementedInterface(codeElement As EnvDTE80.CodeStruct2, base As Object, position As Object) As EnvDTE.CodeInterface
Return codeElement.AddImplementedInterface(base, position)
End Function
Protected Overrides Sub RemoveImplementedInterface(codeElement As EnvDTE80.CodeStruct2, element As Object)
codeElement.RemoveInterface(element)
End Sub
End Class
End Namespace
| ' 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.
Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel
Public MustInherit Class AbstractCodeStructTests
Inherits AbstractCodeElementTests(Of EnvDTE80.CodeStruct2)
Protected Overrides Function GetStartPointFunc(codeElement As EnvDTE80.CodeStruct2) As Func(Of EnvDTE.vsCMPart, EnvDTE.TextPoint)
Return Function(part) codeElement.GetStartPoint(part)
End Function
Protected Overrides Function GetEndPointFunc(codeElement As EnvDTE80.CodeStruct2) As Func(Of EnvDTE.vsCMPart, EnvDTE.TextPoint)
Return Function(part) codeElement.GetEndPoint(part)
End Function
Protected Overrides Function GetAccess(codeElement As EnvDTE80.CodeStruct2) As EnvDTE.vsCMAccess
Return codeElement.Access
End Function
Protected Overrides Function GetAttributes(codeElement As EnvDTE80.CodeStruct2) As EnvDTE.CodeElements
Return codeElement.Attributes
End Function
Protected Overrides Function GetBases(codeElement As EnvDTE80.CodeStruct2) As EnvDTE.CodeElements
Return codeElement.Bases
End Function
Protected Overrides Function GetComment(codeElement As EnvDTE80.CodeStruct2) As String
Return codeElement.Comment
End Function
Protected Overrides Function GetDataTypeKind(codeElement As EnvDTE80.CodeStruct2) As EnvDTE80.vsCMDataTypeKind
Return codeElement.DataTypeKind
End Function
Protected Overrides Function GetDocComment(codeElement As EnvDTE80.CodeStruct2) As String
Return codeElement.DocComment
End Function
Protected Overrides Function GetFullName(codeElement As EnvDTE80.CodeStruct2) As String
Return codeElement.FullName
End Function
Protected Overrides Function GetImplementedInterfaces(codeElement As EnvDTE80.CodeStruct2) As EnvDTE.CodeElements
Return codeElement.ImplementedInterfaces
End Function
Protected Overrides Function GetKind(codeElement As EnvDTE80.CodeStruct2) As EnvDTE.vsCMElement
Return codeElement.Kind
End Function
Protected Overrides Function GetName(codeElement As EnvDTE80.CodeStruct2) As String
Return codeElement.Name
End Function
Protected Overrides Function GetParent(codeElement As EnvDTE80.CodeStruct2) As Object
Return codeElement.Parent
End Function
Protected Overrides Function GetParts(codeElement As EnvDTE80.CodeStruct2) As EnvDTE.CodeElements
Return codeElement.Parts
End Function
Protected Overrides Function AddFunction(codeElement As EnvDTE80.CodeStruct2, data As FunctionData) As EnvDTE.CodeFunction
Return codeElement.AddFunction(data.Name, data.Kind, data.Type, data.Position, data.Access, data.Location)
End Function
Protected Overrides Function AddAttribute(codeElement As EnvDTE80.CodeStruct2, data As AttributeData) As EnvDTE.CodeAttribute
Return codeElement.AddAttribute(data.Name, data.Value, data.Position)
End Function
Protected Overrides Function GetNameSetter(codeElement As EnvDTE80.CodeStruct2) As Action(Of String)
Return Sub(name) codeElement.Name = name
End Function
Protected Overrides Function AddImplementedInterface(codeElement As EnvDTE80.CodeStruct2, base As Object, position As Object) As EnvDTE.CodeInterface
Return codeElement.AddImplementedInterface(base, position)
End Function
Protected Overrides Sub RemoveImplementedInterface(codeElement As EnvDTE80.CodeStruct2, element As Object)
codeElement.RemoveInterface(element)
End Sub
End Class
End Namespace
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Tools/ExternalAccess/Razor/IRazorSpanMappingService.cs | // 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.Collections.Generic;
using System.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Text;
namespace Microsoft.CodeAnalysis.ExternalAccess.Razor
{
internal interface IRazorSpanMappingService
{
Task<ImmutableArray<RazorMappedSpanResult>> MapSpansAsync(Document document, IEnumerable<TextSpan> spans, CancellationToken cancellationToken);
}
}
| // 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.Collections.Generic;
using System.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Text;
namespace Microsoft.CodeAnalysis.ExternalAccess.Razor
{
internal interface IRazorSpanMappingService
{
Task<ImmutableArray<RazorMappedSpanResult>> MapSpansAsync(Document document, IEnumerable<TextSpan> spans, CancellationToken cancellationToken);
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Tools/ExternalAccess/Debugger/Microsoft.CodeAnalysis.ExternalAccess.Debugger.csproj | <?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<RootNamespace>Microsoft.CodeAnalysis.ExternalAccess.Debugger</RootNamespace>
<TargetFramework>netstandard2.0</TargetFramework>
<!-- NuGet -->
<IsPackable>true</IsPackable>
<PackageId>Microsoft.CodeAnalysis.ExternalAccess.Debugger</PackageId>
<PackageDescription>
A supporting package for the Visual Studio debugger:
https://devdiv.visualstudio.com/DevDiv/_git/VS?path=%2Fsrc%2Fdebugger%2FRazor
</PackageDescription>
</PropertyGroup>
<ItemGroup>
<!--
⚠ ONLY VISUAL STUDIO DEBUGGER ASSEMBLIES MAY BE ADDED HERE ⚠
-->
<InternalsVisibleTo Include="VsDebugPresentationPackage" Key="$(VisualStudioDebuggerKey)" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.Buffers" Version="$(SystemBuffersVersion)" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Compilers\Core\Portable\Microsoft.CodeAnalysis.csproj" />
<ProjectReference Include="..\..\..\EditorFeatures\Core\Microsoft.CodeAnalysis.EditorFeatures.csproj" />
<ProjectReference Include="..\..\..\Workspaces\Core\Portable\Microsoft.CodeAnalysis.Workspaces.csproj" />
</ItemGroup>
<ItemGroup>
<PublicAPI Include="PublicAPI.Shipped.txt" />
<PublicAPI Include="PublicAPI.Unshipped.txt" />
</ItemGroup>
</Project> | <?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<RootNamespace>Microsoft.CodeAnalysis.ExternalAccess.Debugger</RootNamespace>
<TargetFramework>netstandard2.0</TargetFramework>
<!-- NuGet -->
<IsPackable>true</IsPackable>
<PackageId>Microsoft.CodeAnalysis.ExternalAccess.Debugger</PackageId>
<PackageDescription>
A supporting package for the Visual Studio debugger:
https://devdiv.visualstudio.com/DevDiv/_git/VS?path=%2Fsrc%2Fdebugger%2FRazor
</PackageDescription>
</PropertyGroup>
<ItemGroup>
<!--
⚠ ONLY VISUAL STUDIO DEBUGGER ASSEMBLIES MAY BE ADDED HERE ⚠
-->
<InternalsVisibleTo Include="VsDebugPresentationPackage" Key="$(VisualStudioDebuggerKey)" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.Buffers" Version="$(SystemBuffersVersion)" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Compilers\Core\Portable\Microsoft.CodeAnalysis.csproj" />
<ProjectReference Include="..\..\..\EditorFeatures\Core\Microsoft.CodeAnalysis.EditorFeatures.csproj" />
<ProjectReference Include="..\..\..\Workspaces\Core\Portable\Microsoft.CodeAnalysis.Workspaces.csproj" />
</ItemGroup>
<ItemGroup>
<PublicAPI Include="PublicAPI.Shipped.txt" />
<PublicAPI Include="PublicAPI.Unshipped.txt" />
</ItemGroup>
</Project> | -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Compilers/Core/Portable/InternalUtilities/ReadOnlyUnmanagedMemoryStream.cs | // 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.IO;
using System.Runtime.InteropServices;
namespace Microsoft.CodeAnalysis
{
internal sealed class ReadOnlyUnmanagedMemoryStream : Stream
{
private readonly object _memoryOwner;
private readonly IntPtr _data;
private readonly int _length;
private int _position;
public ReadOnlyUnmanagedMemoryStream(object memoryOwner, IntPtr data, int length)
{
_memoryOwner = memoryOwner;
_data = data;
_length = length;
}
public override unsafe int ReadByte()
{
if (_position == _length)
{
return -1;
}
return ((byte*)_data)[_position++];
}
public override int Read(byte[] buffer, int offset, int count)
{
int bytesRead = Math.Min(count, _length - _position);
Marshal.Copy(_data + _position, buffer, offset, bytesRead);
_position += bytesRead;
return bytesRead;
}
public override void Flush()
{
}
public override bool CanRead
{
get
{
return true;
}
}
public override bool CanSeek
{
get
{
return true;
}
}
public override bool CanWrite
{
get
{
return false;
}
}
public override long Length
{
get
{
return _length;
}
}
public override long Position
{
get
{
return _position;
}
set
{
Seek(value, SeekOrigin.Begin);
}
}
public override long Seek(long offset, SeekOrigin origin)
{
long target;
try
{
switch (origin)
{
case SeekOrigin.Begin:
target = offset;
break;
case SeekOrigin.Current:
target = checked(offset + _position);
break;
case SeekOrigin.End:
target = checked(offset + _length);
break;
default:
throw new ArgumentOutOfRangeException(nameof(origin));
}
}
catch (OverflowException)
{
throw new ArgumentOutOfRangeException(nameof(offset));
}
if (target < 0 || target >= _length)
{
throw new ArgumentOutOfRangeException(nameof(offset));
}
_position = (int)target;
return target;
}
public override void SetLength(long value)
{
throw new NotSupportedException();
}
public override void Write(byte[] buffer, int offset, int count)
{
throw new NotSupportedException();
}
}
}
| // 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.IO;
using System.Runtime.InteropServices;
namespace Microsoft.CodeAnalysis
{
internal sealed class ReadOnlyUnmanagedMemoryStream : Stream
{
private readonly object _memoryOwner;
private readonly IntPtr _data;
private readonly int _length;
private int _position;
public ReadOnlyUnmanagedMemoryStream(object memoryOwner, IntPtr data, int length)
{
_memoryOwner = memoryOwner;
_data = data;
_length = length;
}
public override unsafe int ReadByte()
{
if (_position == _length)
{
return -1;
}
return ((byte*)_data)[_position++];
}
public override int Read(byte[] buffer, int offset, int count)
{
int bytesRead = Math.Min(count, _length - _position);
Marshal.Copy(_data + _position, buffer, offset, bytesRead);
_position += bytesRead;
return bytesRead;
}
public override void Flush()
{
}
public override bool CanRead
{
get
{
return true;
}
}
public override bool CanSeek
{
get
{
return true;
}
}
public override bool CanWrite
{
get
{
return false;
}
}
public override long Length
{
get
{
return _length;
}
}
public override long Position
{
get
{
return _position;
}
set
{
Seek(value, SeekOrigin.Begin);
}
}
public override long Seek(long offset, SeekOrigin origin)
{
long target;
try
{
switch (origin)
{
case SeekOrigin.Begin:
target = offset;
break;
case SeekOrigin.Current:
target = checked(offset + _position);
break;
case SeekOrigin.End:
target = checked(offset + _length);
break;
default:
throw new ArgumentOutOfRangeException(nameof(origin));
}
}
catch (OverflowException)
{
throw new ArgumentOutOfRangeException(nameof(offset));
}
if (target < 0 || target >= _length)
{
throw new ArgumentOutOfRangeException(nameof(offset));
}
_position = (int)target;
return target;
}
public override void SetLength(long value)
{
throw new NotSupportedException();
}
public override void Write(byte[] buffer, int offset, int count)
{
throw new NotSupportedException();
}
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Workspaces/CoreTestUtilities/WorkspaceExtensions.cs | // 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.Collections.Generic;
using System.Linq;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Test.Utilities;
namespace Microsoft.CodeAnalysis.UnitTests
{
public static partial class WorkspaceExtensions
{
public static DocumentId AddDocument(this Workspace workspace, ProjectId projectId, IEnumerable<string> folders, string name, SourceText initialText, SourceCodeKind sourceCodeKind = SourceCodeKind.Regular)
{
var id = projectId.CreateDocumentId(name, folders);
var oldSolution = workspace.CurrentSolution;
var newSolution = oldSolution.AddDocument(id, name, initialText, folders).GetDocument(id)!.WithSourceCodeKind(sourceCodeKind).Project.Solution;
workspace.TryApplyChanges(newSolution);
return id;
}
public static void RemoveDocument(this Workspace workspace, DocumentId documentId)
{
var oldSolution = workspace.CurrentSolution;
var newSolution = oldSolution.RemoveDocument(documentId);
workspace.TryApplyChanges(newSolution);
}
public static void UpdateDocument(this Workspace workspace, DocumentId documentId, SourceText newText)
{
var oldSolution = workspace.CurrentSolution;
var newSolution = oldSolution.WithDocumentText(documentId, newText);
workspace.TryApplyChanges(newSolution);
}
/// <summary>
/// Create a new DocumentId based on a name and optional folders
/// </summary>
public static DocumentId CreateDocumentId(this ProjectId projectId, string name, IEnumerable<string>? folders = null)
{
if (folders != null)
{
var uniqueName = string.Join("/", folders) + "/" + name;
return DocumentId.CreateNewId(projectId, uniqueName);
}
else
{
return DocumentId.CreateNewId(projectId, name);
}
}
public static IEnumerable<Project> GetProjectsByName(this Solution solution, string name)
=> solution.Projects.Where(p => string.Compare(p.Name, name, StringComparison.OrdinalIgnoreCase) == 0);
internal static EventWaiter VerifyWorkspaceChangedEvent(this Workspace workspace, Action<WorkspaceChangeEventArgs> action)
{
var wew = new EventWaiter();
workspace.WorkspaceChanged += wew.Wrap<WorkspaceChangeEventArgs>((sender, args) => action(args));
return wew;
}
}
}
| // 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.Collections.Generic;
using System.Linq;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Test.Utilities;
namespace Microsoft.CodeAnalysis.UnitTests
{
public static partial class WorkspaceExtensions
{
public static DocumentId AddDocument(this Workspace workspace, ProjectId projectId, IEnumerable<string> folders, string name, SourceText initialText, SourceCodeKind sourceCodeKind = SourceCodeKind.Regular)
{
var id = projectId.CreateDocumentId(name, folders);
var oldSolution = workspace.CurrentSolution;
var newSolution = oldSolution.AddDocument(id, name, initialText, folders).GetDocument(id)!.WithSourceCodeKind(sourceCodeKind).Project.Solution;
workspace.TryApplyChanges(newSolution);
return id;
}
public static void RemoveDocument(this Workspace workspace, DocumentId documentId)
{
var oldSolution = workspace.CurrentSolution;
var newSolution = oldSolution.RemoveDocument(documentId);
workspace.TryApplyChanges(newSolution);
}
public static void UpdateDocument(this Workspace workspace, DocumentId documentId, SourceText newText)
{
var oldSolution = workspace.CurrentSolution;
var newSolution = oldSolution.WithDocumentText(documentId, newText);
workspace.TryApplyChanges(newSolution);
}
/// <summary>
/// Create a new DocumentId based on a name and optional folders
/// </summary>
public static DocumentId CreateDocumentId(this ProjectId projectId, string name, IEnumerable<string>? folders = null)
{
if (folders != null)
{
var uniqueName = string.Join("/", folders) + "/" + name;
return DocumentId.CreateNewId(projectId, uniqueName);
}
else
{
return DocumentId.CreateNewId(projectId, name);
}
}
public static IEnumerable<Project> GetProjectsByName(this Solution solution, string name)
=> solution.Projects.Where(p => string.Compare(p.Name, name, StringComparison.OrdinalIgnoreCase) == 0);
internal static EventWaiter VerifyWorkspaceChangedEvent(this Workspace workspace, Action<WorkspaceChangeEventArgs> action)
{
var wew = new EventWaiter();
workspace.WorkspaceChanged += wew.Wrap<WorkspaceChangeEventArgs>((sender, args) => action(args));
return wew;
}
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Compilers/Core/MSBuildTask/IAnalyzerConfigFilesHostObject.cs | // 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.Runtime.InteropServices;
using Microsoft.Build.Framework;
namespace Microsoft.CodeAnalysis.BuildTasks
{
[ComImport]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
[Guid("31891ED8-BEB5-43BF-A90D-9E7E1CE9BA84")]
public interface IAnalyzerConfigFilesHostObject
{
bool SetAnalyzerConfigFiles(ITaskItem[]? analyzerConfigFiles);
bool SetPotentialAnalyzerConfigFiles(ITaskItem[]? potentialAnalyzerConfigfiles);
}
}
| // 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.Runtime.InteropServices;
using Microsoft.Build.Framework;
namespace Microsoft.CodeAnalysis.BuildTasks
{
[ComImport]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
[Guid("31891ED8-BEB5-43BF-A90D-9E7E1CE9BA84")]
public interface IAnalyzerConfigFilesHostObject
{
bool SetAnalyzerConfigFiles(ITaskItem[]? analyzerConfigFiles);
bool SetPotentialAnalyzerConfigFiles(ITaskItem[]? potentialAnalyzerConfigfiles);
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/EditorFeatures/CSharpTest/KeywordHighlighting/AbstractCSharpKeywordHighlighterTests.cs | // 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.
#nullable disable
using System.Collections.Generic;
using Microsoft.CodeAnalysis.Editor.UnitTests.KeywordHighlighting;
using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces;
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.KeywordHighlighting
{
public abstract class AbstractCSharpKeywordHighlighterTests
: AbstractKeywordHighlighterTests
{
protected override TestWorkspace CreateWorkspaceFromFile(string code, ParseOptions options)
=> TestWorkspace.CreateCSharp(code, options, composition: Composition);
protected override IEnumerable<ParseOptions> GetOptions()
{
yield return Options.Regular;
yield return Options.Script;
}
}
}
| // 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.
#nullable disable
using System.Collections.Generic;
using Microsoft.CodeAnalysis.Editor.UnitTests.KeywordHighlighting;
using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces;
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.KeywordHighlighting
{
public abstract class AbstractCSharpKeywordHighlighterTests
: AbstractKeywordHighlighterTests
{
protected override TestWorkspace CreateWorkspaceFromFile(string code, ParseOptions options)
=> TestWorkspace.CreateCSharp(code, options, composition: Composition);
protected override IEnumerable<ParseOptions> GetOptions()
{
yield return Options.Regular;
yield return Options.Script;
}
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/VisualStudio/CSharp/Impl/ProjectSystemShim/Interop/ICSNameTable.cs | // 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.
#nullable disable
using System.Runtime.InteropServices;
namespace Microsoft.VisualStudio.LanguageServices.CSharp.ProjectSystemShim.Interop
{
[ComImport]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
[Guid("A1DEA584-FEB7-4ba5-ACC1-0C0EB3EAF016")]
internal interface ICSNameTable
{
// members not ported
}
}
| // 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.
#nullable disable
using System.Runtime.InteropServices;
namespace Microsoft.VisualStudio.LanguageServices.CSharp.ProjectSystemShim.Interop
{
[ComImport]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
[Guid("A1DEA584-FEB7-4ba5-ACC1-0C0EB3EAF016")]
internal interface ICSNameTable
{
// members not ported
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/Rewriters/PlaceholderLocalRewriter.cs | // 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.
#nullable disable
using Microsoft.CodeAnalysis.CSharp.Symbols;
using System.Collections.Generic;
using System.Diagnostics;
namespace Microsoft.CodeAnalysis.CSharp.ExpressionEvaluator
{
internal sealed class PlaceholderLocalRewriter : BoundTreeRewriterWithStackGuardWithoutRecursionOnTheLeftOfBinaryOperator
{
internal static BoundNode Rewrite(CSharpCompilation compilation, EENamedTypeSymbol container, HashSet<LocalSymbol> declaredLocals, BoundNode node, DiagnosticBag diagnostics)
{
var rewriter = new PlaceholderLocalRewriter(compilation, container, declaredLocals, diagnostics);
return rewriter.Visit(node);
}
private readonly CSharpCompilation _compilation;
private readonly EENamedTypeSymbol _container;
private readonly HashSet<LocalSymbol> _declaredLocals;
private readonly DiagnosticBag _diagnostics;
private PlaceholderLocalRewriter(CSharpCompilation compilation, EENamedTypeSymbol container, HashSet<LocalSymbol> declaredLocals, DiagnosticBag diagnostics)
{
_compilation = compilation;
_container = container;
_declaredLocals = declaredLocals;
_diagnostics = diagnostics;
}
public override BoundNode VisitLocal(BoundLocal node)
{
var result = RewriteLocal(node);
Debug.Assert(TypeSymbol.Equals(result.Type, node.Type, TypeCompareKind.ConsiderEverything2));
return result;
}
private BoundExpression RewriteLocal(BoundLocal node)
{
var local = node.LocalSymbol;
var placeholder = local as PlaceholderLocalSymbol;
if ((object)placeholder != null)
{
return placeholder.RewriteLocal(_compilation, _container, node.Syntax, _diagnostics);
}
if (_declaredLocals.Contains(local))
{
return ObjectIdLocalSymbol.RewriteLocal(_compilation, _container, node.Syntax, local);
}
return node;
}
}
}
| // 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.
#nullable disable
using Microsoft.CodeAnalysis.CSharp.Symbols;
using System.Collections.Generic;
using System.Diagnostics;
namespace Microsoft.CodeAnalysis.CSharp.ExpressionEvaluator
{
internal sealed class PlaceholderLocalRewriter : BoundTreeRewriterWithStackGuardWithoutRecursionOnTheLeftOfBinaryOperator
{
internal static BoundNode Rewrite(CSharpCompilation compilation, EENamedTypeSymbol container, HashSet<LocalSymbol> declaredLocals, BoundNode node, DiagnosticBag diagnostics)
{
var rewriter = new PlaceholderLocalRewriter(compilation, container, declaredLocals, diagnostics);
return rewriter.Visit(node);
}
private readonly CSharpCompilation _compilation;
private readonly EENamedTypeSymbol _container;
private readonly HashSet<LocalSymbol> _declaredLocals;
private readonly DiagnosticBag _diagnostics;
private PlaceholderLocalRewriter(CSharpCompilation compilation, EENamedTypeSymbol container, HashSet<LocalSymbol> declaredLocals, DiagnosticBag diagnostics)
{
_compilation = compilation;
_container = container;
_declaredLocals = declaredLocals;
_diagnostics = diagnostics;
}
public override BoundNode VisitLocal(BoundLocal node)
{
var result = RewriteLocal(node);
Debug.Assert(TypeSymbol.Equals(result.Type, node.Type, TypeCompareKind.ConsiderEverything2));
return result;
}
private BoundExpression RewriteLocal(BoundLocal node)
{
var local = node.LocalSymbol;
var placeholder = local as PlaceholderLocalSymbol;
if ((object)placeholder != null)
{
return placeholder.RewriteLocal(_compilation, _container, node.Syntax, _diagnostics);
}
if (_declaredLocals.Contains(local))
{
return ObjectIdLocalSymbol.RewriteLocal(_compilation, _container, node.Syntax, local);
}
return node;
}
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/EditorFeatures/Core.Wpf/Peek/PeekHelpers.cs | // 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.
#nullable disable
using System.IO;
using System.Threading;
using Microsoft.CodeAnalysis.LanguageServices;
using Microsoft.CodeAnalysis.Text;
using Microsoft.VisualStudio.Language.Intellisense;
namespace Microsoft.CodeAnalysis.Editor.Implementation.Peek
{
internal static class PeekHelpers
{
internal static IDocumentPeekResult CreateDocumentPeekResult(string filePath, LinePositionSpan identifierLocation, LinePositionSpan entityOfInterestSpan, IPeekResultFactory peekResultFactory)
{
var fileName = Path.GetFileName(filePath);
var label = string.Format("{0} - ({1}, {2})", fileName, identifierLocation.Start.Line + 1, identifierLocation.Start.Character + 1);
var displayInfo = new PeekResultDisplayInfo(label: label, labelTooltip: filePath, title: fileName, titleTooltip: filePath);
return CreateDocumentPeekResult(
filePath,
identifierLocation,
entityOfInterestSpan,
displayInfo,
peekResultFactory,
isReadOnly: false);
}
internal static IDocumentPeekResult CreateDocumentPeekResult(string filePath, LinePositionSpan identifierLocation, LinePositionSpan entityOfInterestSpan, PeekResultDisplayInfo displayInfo, IPeekResultFactory peekResultFactory, bool isReadOnly)
{
return peekResultFactory.Create(
displayInfo,
filePath: filePath,
startLine: entityOfInterestSpan.Start.Line,
startIndex: entityOfInterestSpan.Start.Character,
endLine: entityOfInterestSpan.End.Line,
endIndex: entityOfInterestSpan.End.Character,
idLine: identifierLocation.Start.Line,
idIndex: identifierLocation.Start.Character,
isReadOnly: isReadOnly);
}
internal static LinePositionSpan GetEntityOfInterestSpan(ISymbol symbol, Workspace workspace, Location identifierLocation, CancellationToken cancellationToken)
{
// This is called on a background thread, but since we don't have proper asynchrony we must block
var root = identifierLocation.SourceTree.GetRoot(cancellationToken);
var node = root.FindToken(identifierLocation.SourceSpan.Start).Parent;
var syntaxFactsService = workspace.Services.GetLanguageServices(root.Language).GetService<ISyntaxFactsService>();
switch (symbol.Kind)
{
case SymbolKind.Event:
case SymbolKind.Field:
case SymbolKind.Method:
case SymbolKind.Property:
node = node.FirstAncestorOrSelf<SyntaxNode, ISyntaxFactsService>((node, syntaxFactsService) => syntaxFactsService.IsMethodLevelMember(node), syntaxFactsService) ?? node;
break;
case SymbolKind.NamedType:
case SymbolKind.Namespace:
node = node.FirstAncestorOrSelf<SyntaxNode, ISyntaxFactsService>((node, syntaxFactsService) => syntaxFactsService.IsTopLevelNodeWithMembers(node), syntaxFactsService) ?? node;
break;
}
return identifierLocation.SourceTree.GetLocation(node.Span).GetLineSpan().Span;
}
}
}
| // 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.
#nullable disable
using System.IO;
using System.Threading;
using Microsoft.CodeAnalysis.LanguageServices;
using Microsoft.CodeAnalysis.Text;
using Microsoft.VisualStudio.Language.Intellisense;
namespace Microsoft.CodeAnalysis.Editor.Implementation.Peek
{
internal static class PeekHelpers
{
internal static IDocumentPeekResult CreateDocumentPeekResult(string filePath, LinePositionSpan identifierLocation, LinePositionSpan entityOfInterestSpan, IPeekResultFactory peekResultFactory)
{
var fileName = Path.GetFileName(filePath);
var label = string.Format("{0} - ({1}, {2})", fileName, identifierLocation.Start.Line + 1, identifierLocation.Start.Character + 1);
var displayInfo = new PeekResultDisplayInfo(label: label, labelTooltip: filePath, title: fileName, titleTooltip: filePath);
return CreateDocumentPeekResult(
filePath,
identifierLocation,
entityOfInterestSpan,
displayInfo,
peekResultFactory,
isReadOnly: false);
}
internal static IDocumentPeekResult CreateDocumentPeekResult(string filePath, LinePositionSpan identifierLocation, LinePositionSpan entityOfInterestSpan, PeekResultDisplayInfo displayInfo, IPeekResultFactory peekResultFactory, bool isReadOnly)
{
return peekResultFactory.Create(
displayInfo,
filePath: filePath,
startLine: entityOfInterestSpan.Start.Line,
startIndex: entityOfInterestSpan.Start.Character,
endLine: entityOfInterestSpan.End.Line,
endIndex: entityOfInterestSpan.End.Character,
idLine: identifierLocation.Start.Line,
idIndex: identifierLocation.Start.Character,
isReadOnly: isReadOnly);
}
internal static LinePositionSpan GetEntityOfInterestSpan(ISymbol symbol, Workspace workspace, Location identifierLocation, CancellationToken cancellationToken)
{
// This is called on a background thread, but since we don't have proper asynchrony we must block
var root = identifierLocation.SourceTree.GetRoot(cancellationToken);
var node = root.FindToken(identifierLocation.SourceSpan.Start).Parent;
var syntaxFactsService = workspace.Services.GetLanguageServices(root.Language).GetService<ISyntaxFactsService>();
switch (symbol.Kind)
{
case SymbolKind.Event:
case SymbolKind.Field:
case SymbolKind.Method:
case SymbolKind.Property:
node = node.FirstAncestorOrSelf<SyntaxNode, ISyntaxFactsService>((node, syntaxFactsService) => syntaxFactsService.IsMethodLevelMember(node), syntaxFactsService) ?? node;
break;
case SymbolKind.NamedType:
case SymbolKind.Namespace:
node = node.FirstAncestorOrSelf<SyntaxNode, ISyntaxFactsService>((node, syntaxFactsService) => syntaxFactsService.IsTopLevelNodeWithMembers(node), syntaxFactsService) ?? node;
break;
}
return identifierLocation.SourceTree.GetLocation(node.Span).GetLineSpan().Span;
}
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/EditorFeatures/Core/Shared/Utilities/VirtualTreePoint.cs | // 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.Collections.Immutable;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Editor.Shared.Utilities
{
internal struct VirtualTreePoint : IComparable<VirtualTreePoint>, IEquatable<VirtualTreePoint>
{
private readonly SyntaxTree _tree;
private readonly SourceText _text;
private readonly int _position;
private readonly int _virtualSpaces;
public VirtualTreePoint(SyntaxTree tree, SourceText text, int position, int virtualSpaces = 0)
{
Contract.ThrowIfNull(tree);
Contract.ThrowIfFalse(position >= 0 && position <= tree.Length);
Contract.ThrowIfFalse(virtualSpaces >= 0);
_tree = tree;
_text = text;
_position = position;
_virtualSpaces = virtualSpaces;
}
public static bool operator !=(VirtualTreePoint left, VirtualTreePoint right)
=> !(left == right);
public static bool operator <(VirtualTreePoint left, VirtualTreePoint right)
=> left.CompareTo(right) < 0;
public static bool operator <=(VirtualTreePoint left, VirtualTreePoint right)
=> left.CompareTo(right) <= 0;
public static bool operator ==(VirtualTreePoint left, VirtualTreePoint right)
=> object.Equals(left, right);
public static bool operator >(VirtualTreePoint left, VirtualTreePoint right)
=> left.CompareTo(right) > 0;
public static bool operator >=(VirtualTreePoint left, VirtualTreePoint right)
=> left.CompareTo(right) >= 0;
public bool IsInVirtualSpace
{
get { return _virtualSpaces != 0; }
}
public int Position => _position;
public int VirtualSpaces => _virtualSpaces;
public SourceText Text => _text;
public SyntaxTree Tree => _tree;
public int CompareTo(VirtualTreePoint other)
{
if (Text != other.Text)
{
throw new InvalidOperationException(EditorFeaturesResources.Can_t_compare_positions_from_different_text_snapshots);
}
return ComparerWithState.CompareTo(this, other, s_comparers);
}
private static readonly ImmutableArray<Func<VirtualTreePoint, IComparable>> s_comparers =
ImmutableArray.Create<Func<VirtualTreePoint, IComparable>>(p => p.Position, prop => prop.VirtualSpaces);
public bool Equals(VirtualTreePoint other)
=> CompareTo(other) == 0;
public override bool Equals(object? obj)
=> (obj is VirtualTreePoint) && Equals((VirtualTreePoint)obj);
public override int GetHashCode()
=> Text.GetHashCode() ^ Position.GetHashCode() ^ VirtualSpaces.GetHashCode();
public override string ToString()
=> $"VirtualTreePoint {{ Tree: '{Tree}', Text: '{Text}', Position: '{Position}', VirtualSpaces '{VirtualSpaces}' }}";
public TextLine GetContainingLine()
=> Text.Lines.GetLineFromPosition(Position);
}
}
| // 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.Collections.Immutable;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Editor.Shared.Utilities
{
internal struct VirtualTreePoint : IComparable<VirtualTreePoint>, IEquatable<VirtualTreePoint>
{
private readonly SyntaxTree _tree;
private readonly SourceText _text;
private readonly int _position;
private readonly int _virtualSpaces;
public VirtualTreePoint(SyntaxTree tree, SourceText text, int position, int virtualSpaces = 0)
{
Contract.ThrowIfNull(tree);
Contract.ThrowIfFalse(position >= 0 && position <= tree.Length);
Contract.ThrowIfFalse(virtualSpaces >= 0);
_tree = tree;
_text = text;
_position = position;
_virtualSpaces = virtualSpaces;
}
public static bool operator !=(VirtualTreePoint left, VirtualTreePoint right)
=> !(left == right);
public static bool operator <(VirtualTreePoint left, VirtualTreePoint right)
=> left.CompareTo(right) < 0;
public static bool operator <=(VirtualTreePoint left, VirtualTreePoint right)
=> left.CompareTo(right) <= 0;
public static bool operator ==(VirtualTreePoint left, VirtualTreePoint right)
=> object.Equals(left, right);
public static bool operator >(VirtualTreePoint left, VirtualTreePoint right)
=> left.CompareTo(right) > 0;
public static bool operator >=(VirtualTreePoint left, VirtualTreePoint right)
=> left.CompareTo(right) >= 0;
public bool IsInVirtualSpace
{
get { return _virtualSpaces != 0; }
}
public int Position => _position;
public int VirtualSpaces => _virtualSpaces;
public SourceText Text => _text;
public SyntaxTree Tree => _tree;
public int CompareTo(VirtualTreePoint other)
{
if (Text != other.Text)
{
throw new InvalidOperationException(EditorFeaturesResources.Can_t_compare_positions_from_different_text_snapshots);
}
return ComparerWithState.CompareTo(this, other, s_comparers);
}
private static readonly ImmutableArray<Func<VirtualTreePoint, IComparable>> s_comparers =
ImmutableArray.Create<Func<VirtualTreePoint, IComparable>>(p => p.Position, prop => prop.VirtualSpaces);
public bool Equals(VirtualTreePoint other)
=> CompareTo(other) == 0;
public override bool Equals(object? obj)
=> (obj is VirtualTreePoint) && Equals((VirtualTreePoint)obj);
public override int GetHashCode()
=> Text.GetHashCode() ^ Position.GetHashCode() ^ VirtualSpaces.GetHashCode();
public override string ToString()
=> $"VirtualTreePoint {{ Tree: '{Tree}', Text: '{Text}', Position: '{Position}', VirtualSpaces '{VirtualSpaces}' }}";
public TextLine GetContainingLine()
=> Text.Lines.GetLineFromPosition(Position);
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Analyzers/VisualBasic/Tests/UpdateLegacySuppressions/UpdateLegacySuppressionsTests.vb | ' 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.
Imports Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions
Imports Microsoft.CodeAnalysis.RemoveUnnecessarySuppressions
Imports VerifyVB = Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions.VisualBasicCodeFixVerifier(Of
Microsoft.CodeAnalysis.VisualBasic.RemoveUnnecessarySuppressions.VisualBasicRemoveUnnecessaryAttributeSuppressionsDiagnosticAnalyzer,
Microsoft.CodeAnalysis.UpdateLegacySuppressions.UpdateLegacySuppressionsCodeFixProvider)
Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.UpdateLegacySuppressions
<Trait(Traits.Feature, Traits.Features.CodeActionsUpdateLegacySuppressions)>
<WorkItem(44362, "https://github.com/dotnet/roslyn/issues/44362")>
Public Class UpdateLegacySuppressionsTests
<Theory, CombinatorialData>
Public Sub TestStandardProperty([property] As AnalyzerProperty)
VerifyVB.VerifyStandardProperty([property])
End Sub
<Theory>
<InlineData("namespace", "N", "~N:N")>
<InlineData("type", "N.C+D", "~T:N.C.D")>
<InlineData("member", "N.C.#F", "~F:N.C.F")>
<InlineData("member", "N.C.#P", "~P:N.C.P")>
<InlineData("member", "N.C.#M", "~M:N.C.M")>
<InlineData("member", "N.C.#M2(!!0)", "~M:N.C.M2``1(``0)~System.Int32")>
<InlineData("member", "e:N.C.#E", "~E:N.C.E")>
Public Async Function LegacySuppressions(scope As String, target As String, fixedTarget As String) As Task
Dim input = $"
<Assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""Id: Title"", Scope:=""{scope}"", Target:={{|#0:""{target}""|}})>
Namespace N
Class C
Private F As Integer
Public Property P As Integer
Public Sub M()
End Sub
Public Function M2(Of T)(tParam As T) As Integer
Return 0
End Function
Public Event E As System.EventHandler(Of Integer)
Class D
End Class
End Class
End Namespace
"
Dim expectedDiagnostic = VerifyVB.Diagnostic(AbstractRemoveUnnecessaryAttributeSuppressionsDiagnosticAnalyzer.LegacyFormatTargetDescriptor).
WithLocation(0).
WithArguments(target)
Dim fixedCode = $"
<Assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""Id: Title"", Scope:=""{scope}"", Target:=""{fixedTarget}"")>
Namespace N
Class C
Private F As Integer
Public Property P As Integer
Public Sub M()
End Sub
Public Function M2(Of T)(tParam As T) As Integer
Return 0
End Function
Public Event E As System.EventHandler(Of Integer)
Class D
End Class
End Class
End Namespace
"
Await VerifyVB.VerifyCodeFixAsync(input, expectedDiagnostic, fixedCode)
End Function
End Class
End Namespace
| ' 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.
Imports Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions
Imports Microsoft.CodeAnalysis.RemoveUnnecessarySuppressions
Imports VerifyVB = Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions.VisualBasicCodeFixVerifier(Of
Microsoft.CodeAnalysis.VisualBasic.RemoveUnnecessarySuppressions.VisualBasicRemoveUnnecessaryAttributeSuppressionsDiagnosticAnalyzer,
Microsoft.CodeAnalysis.UpdateLegacySuppressions.UpdateLegacySuppressionsCodeFixProvider)
Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.UpdateLegacySuppressions
<Trait(Traits.Feature, Traits.Features.CodeActionsUpdateLegacySuppressions)>
<WorkItem(44362, "https://github.com/dotnet/roslyn/issues/44362")>
Public Class UpdateLegacySuppressionsTests
<Theory, CombinatorialData>
Public Sub TestStandardProperty([property] As AnalyzerProperty)
VerifyVB.VerifyStandardProperty([property])
End Sub
<Theory>
<InlineData("namespace", "N", "~N:N")>
<InlineData("type", "N.C+D", "~T:N.C.D")>
<InlineData("member", "N.C.#F", "~F:N.C.F")>
<InlineData("member", "N.C.#P", "~P:N.C.P")>
<InlineData("member", "N.C.#M", "~M:N.C.M")>
<InlineData("member", "N.C.#M2(!!0)", "~M:N.C.M2``1(``0)~System.Int32")>
<InlineData("member", "e:N.C.#E", "~E:N.C.E")>
Public Async Function LegacySuppressions(scope As String, target As String, fixedTarget As String) As Task
Dim input = $"
<Assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""Id: Title"", Scope:=""{scope}"", Target:={{|#0:""{target}""|}})>
Namespace N
Class C
Private F As Integer
Public Property P As Integer
Public Sub M()
End Sub
Public Function M2(Of T)(tParam As T) As Integer
Return 0
End Function
Public Event E As System.EventHandler(Of Integer)
Class D
End Class
End Class
End Namespace
"
Dim expectedDiagnostic = VerifyVB.Diagnostic(AbstractRemoveUnnecessaryAttributeSuppressionsDiagnosticAnalyzer.LegacyFormatTargetDescriptor).
WithLocation(0).
WithArguments(target)
Dim fixedCode = $"
<Assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""Id: Title"", Scope:=""{scope}"", Target:=""{fixedTarget}"")>
Namespace N
Class C
Private F As Integer
Public Property P As Integer
Public Sub M()
End Sub
Public Function M2(Of T)(tParam As T) As Integer
Return 0
End Function
Public Event E As System.EventHandler(Of Integer)
Class D
End Class
End Class
End Namespace
"
Await VerifyVB.VerifyCodeFixAsync(input, expectedDiagnostic, fixedCode)
End Function
End Class
End Namespace
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/EditorFeatures/Test/EditAndContinue/RudeEditDiagnosticTests.cs | // 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.
#nullable disable
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.EditAndContinue.UnitTests
{
public class RudeEditDiagnosticTests
{
[Fact]
public void ToDiagnostic()
{
var tree = SyntaxFactory.ParseCompilationUnit("class C { }").SyntaxTree;
var syntaxNode = tree.GetRoot();
// most rude edits have a single argument, list those that have different count:
var arg0 = new HashSet<RudeEditKind>()
{
RudeEditKind.ActiveStatementUpdate,
RudeEditKind.PartiallyExecutedActiveStatementUpdate,
RudeEditKind.UpdateExceptionHandlerOfActiveTry,
RudeEditKind.UpdateTryOrCatchWithActiveFinally,
RudeEditKind.UpdateCatchHandlerAroundActiveStatement,
RudeEditKind.FieldKindUpdate,
RudeEditKind.TypeKindUpdate,
RudeEditKind.AccessorKindUpdate,
RudeEditKind.DeclareLibraryUpdate,
RudeEditKind.DeclareAliasUpdate,
RudeEditKind.InsertDllImport,
RudeEditKind.GenericMethodUpdate,
RudeEditKind.GenericTypeUpdate,
RudeEditKind.ExperimentalFeaturesEnabled,
RudeEditKind.AwaitStatementUpdate,
RudeEditKind.InsertFile,
RudeEditKind.InsertConstructorToTypeWithInitializersWithLambdas,
RudeEditKind.UpdatingStateMachineMethodAroundActiveStatement,
RudeEditKind.SwitchBetweenLambdaAndLocalFunction,
RudeEditKind.InsertMethodWithExplicitInterfaceSpecifier,
RudeEditKind.NotSupportedByRuntime,
RudeEditKind.MakeMethodAsync,
RudeEditKind.MakeMethodIterator,
RudeEditKind.ChangeImplicitMainReturnType
};
var arg2 = new HashSet<RudeEditKind>()
{
RudeEditKind.InsertIntoStruct,
RudeEditKind.InsertIntoStruct,
RudeEditKind.ChangingCapturedVariableType,
RudeEditKind.AccessingCapturedVariableInLambda,
RudeEditKind.NotAccessingCapturedVariableInLambda,
RudeEditKind.RenamingCapturedVariable,
RudeEditKind.ChangingStateMachineShape,
RudeEditKind.InternalError,
RudeEditKind.MemberBodyInternalError,
};
var arg3 = new HashSet<RudeEditKind>()
{
RudeEditKind.InsertLambdaWithMultiScopeCapture,
RudeEditKind.DeleteLambdaWithMultiScopeCapture,
};
var allKinds = Enum.GetValues(typeof(RudeEditKind)).Cast<RudeEditKind>();
foreach (var kind in allKinds)
{
if (kind == RudeEditKind.None)
{
continue;
}
if (arg0.Contains(kind))
{
var re = new RudeEditDiagnostic(kind, TextSpan.FromBounds(1, 2));
var d = re.ToDiagnostic(tree);
Assert.False(d.GetMessage().Contains("{"), kind.ToString());
}
else if (arg2.Contains(kind))
{
var re = new RudeEditDiagnostic(kind, TextSpan.FromBounds(1, 2), syntaxNode, new[] { "<1>", "<2>" });
var d = re.ToDiagnostic(tree);
Assert.True(d.GetMessage().Contains("<1>"), kind.ToString());
Assert.True(d.GetMessage().Contains("<2>"), kind.ToString());
Assert.False(d.GetMessage().Contains("{"), kind.ToString());
}
else if (arg3.Contains(kind))
{
var re = new RudeEditDiagnostic(kind, TextSpan.FromBounds(1, 2), syntaxNode, new[] { "<1>", "<2>", "<3>" });
var d = re.ToDiagnostic(tree);
Assert.True(d.GetMessage().Contains("<1>"), kind.ToString());
Assert.True(d.GetMessage().Contains("<2>"), kind.ToString());
Assert.True(d.GetMessage().Contains("<3>"), kind.ToString());
Assert.False(d.GetMessage().Contains("{"), kind.ToString());
}
else
{
var re = new RudeEditDiagnostic(kind, TextSpan.FromBounds(1, 2), syntaxNode, new[] { "<1>" });
var d = re.ToDiagnostic(tree);
Assert.True(d.GetMessage().Contains("<1>"), kind.ToString());
Assert.False(d.GetMessage().Contains("{"), kind.ToString());
}
}
// check that all values are unique:
AssertEx.Equal(allKinds, allKinds.Distinct());
}
}
}
| // 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.
#nullable disable
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.EditAndContinue.UnitTests
{
public class RudeEditDiagnosticTests
{
[Fact]
public void ToDiagnostic()
{
var tree = SyntaxFactory.ParseCompilationUnit("class C { }").SyntaxTree;
var syntaxNode = tree.GetRoot();
// most rude edits have a single argument, list those that have different count:
var arg0 = new HashSet<RudeEditKind>()
{
RudeEditKind.ActiveStatementUpdate,
RudeEditKind.PartiallyExecutedActiveStatementUpdate,
RudeEditKind.UpdateExceptionHandlerOfActiveTry,
RudeEditKind.UpdateTryOrCatchWithActiveFinally,
RudeEditKind.UpdateCatchHandlerAroundActiveStatement,
RudeEditKind.FieldKindUpdate,
RudeEditKind.TypeKindUpdate,
RudeEditKind.AccessorKindUpdate,
RudeEditKind.DeclareLibraryUpdate,
RudeEditKind.DeclareAliasUpdate,
RudeEditKind.InsertDllImport,
RudeEditKind.GenericMethodUpdate,
RudeEditKind.GenericTypeUpdate,
RudeEditKind.ExperimentalFeaturesEnabled,
RudeEditKind.AwaitStatementUpdate,
RudeEditKind.InsertFile,
RudeEditKind.InsertConstructorToTypeWithInitializersWithLambdas,
RudeEditKind.UpdatingStateMachineMethodAroundActiveStatement,
RudeEditKind.SwitchBetweenLambdaAndLocalFunction,
RudeEditKind.InsertMethodWithExplicitInterfaceSpecifier,
RudeEditKind.NotSupportedByRuntime,
RudeEditKind.MakeMethodAsync,
RudeEditKind.MakeMethodIterator,
RudeEditKind.ChangeImplicitMainReturnType
};
var arg2 = new HashSet<RudeEditKind>()
{
RudeEditKind.InsertIntoStruct,
RudeEditKind.InsertIntoStruct,
RudeEditKind.ChangingCapturedVariableType,
RudeEditKind.AccessingCapturedVariableInLambda,
RudeEditKind.NotAccessingCapturedVariableInLambda,
RudeEditKind.RenamingCapturedVariable,
RudeEditKind.ChangingStateMachineShape,
RudeEditKind.InternalError,
RudeEditKind.MemberBodyInternalError,
};
var arg3 = new HashSet<RudeEditKind>()
{
RudeEditKind.InsertLambdaWithMultiScopeCapture,
RudeEditKind.DeleteLambdaWithMultiScopeCapture,
};
var allKinds = Enum.GetValues(typeof(RudeEditKind)).Cast<RudeEditKind>();
foreach (var kind in allKinds)
{
if (kind == RudeEditKind.None)
{
continue;
}
if (arg0.Contains(kind))
{
var re = new RudeEditDiagnostic(kind, TextSpan.FromBounds(1, 2));
var d = re.ToDiagnostic(tree);
Assert.False(d.GetMessage().Contains("{"), kind.ToString());
}
else if (arg2.Contains(kind))
{
var re = new RudeEditDiagnostic(kind, TextSpan.FromBounds(1, 2), syntaxNode, new[] { "<1>", "<2>" });
var d = re.ToDiagnostic(tree);
Assert.True(d.GetMessage().Contains("<1>"), kind.ToString());
Assert.True(d.GetMessage().Contains("<2>"), kind.ToString());
Assert.False(d.GetMessage().Contains("{"), kind.ToString());
}
else if (arg3.Contains(kind))
{
var re = new RudeEditDiagnostic(kind, TextSpan.FromBounds(1, 2), syntaxNode, new[] { "<1>", "<2>", "<3>" });
var d = re.ToDiagnostic(tree);
Assert.True(d.GetMessage().Contains("<1>"), kind.ToString());
Assert.True(d.GetMessage().Contains("<2>"), kind.ToString());
Assert.True(d.GetMessage().Contains("<3>"), kind.ToString());
Assert.False(d.GetMessage().Contains("{"), kind.ToString());
}
else
{
var re = new RudeEditDiagnostic(kind, TextSpan.FromBounds(1, 2), syntaxNode, new[] { "<1>" });
var d = re.ToDiagnostic(tree);
Assert.True(d.GetMessage().Contains("<1>"), kind.ToString());
Assert.False(d.GetMessage().Contains("{"), kind.ToString());
}
}
// check that all values are unique:
AssertEx.Equal(allKinds, allKinds.Distinct());
}
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/GeneratedCodeRecognition/AbstractGeneratedCodeRecognitionService.cs | // 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.
#nullable disable
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.LanguageServices;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.GeneratedCodeRecognition
{
internal abstract class AbstractGeneratedCodeRecognitionService : IGeneratedCodeRecognitionService
{
#if !CODE_STYLE
public bool IsGeneratedCode(Document document, CancellationToken cancellationToken)
{
var syntaxTree = document.GetSyntaxTreeSynchronously(cancellationToken);
return IsGeneratedCode(syntaxTree, document, cancellationToken);
}
#endif
public async Task<bool> IsGeneratedCodeAsync(Document document, CancellationToken cancellationToken)
{
var syntaxTree = await document.GetSyntaxTreeAsync(cancellationToken).ConfigureAwait(false);
return IsGeneratedCode(syntaxTree, document, cancellationToken);
}
private static bool IsGeneratedCode(SyntaxTree syntaxTree, Document document, CancellationToken cancellationToken)
{
var syntaxFacts = document.GetLanguageService<ISyntaxFactsService>();
return syntaxTree.IsGeneratedCode(document.Project.AnalyzerOptions, syntaxFacts, cancellationToken);
}
}
}
| // 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.
#nullable disable
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.LanguageServices;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.GeneratedCodeRecognition
{
internal abstract class AbstractGeneratedCodeRecognitionService : IGeneratedCodeRecognitionService
{
#if !CODE_STYLE
public bool IsGeneratedCode(Document document, CancellationToken cancellationToken)
{
var syntaxTree = document.GetSyntaxTreeSynchronously(cancellationToken);
return IsGeneratedCode(syntaxTree, document, cancellationToken);
}
#endif
public async Task<bool> IsGeneratedCodeAsync(Document document, CancellationToken cancellationToken)
{
var syntaxTree = await document.GetSyntaxTreeAsync(cancellationToken).ConfigureAwait(false);
return IsGeneratedCode(syntaxTree, document, cancellationToken);
}
private static bool IsGeneratedCode(SyntaxTree syntaxTree, Document document, CancellationToken cancellationToken)
{
var syntaxFacts = document.GetLanguageService<ISyntaxFactsService>();
return syntaxTree.IsGeneratedCode(document.Project.AnalyzerOptions, syntaxFacts, cancellationToken);
}
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/VisualStudio/Core/Impl/CodeModel/Collections/ExternalParameterCollection.cs | // 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.
#nullable disable
using System.Collections.Immutable;
using System.Runtime.InteropServices;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel.ExternalElements;
using Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel.Interop;
using Microsoft.VisualStudio.LanguageServices.Implementation.Interop;
namespace Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel.Collections
{
[ComVisible(true)]
[ComDefaultInterface(typeof(ICodeElements))]
public sealed class ExternalParameterCollection : AbstractCodeElementCollection
{
internal static EnvDTE.CodeElements Create(
CodeModelState state,
AbstractExternalCodeMember parent,
ProjectId projectId)
{
var collection = new ExternalParameterCollection(state, parent, projectId);
return (EnvDTE.CodeElements)ComAggregate.CreateAggregatedObject(collection);
}
private readonly ProjectId _projectId;
private ExternalParameterCollection(
CodeModelState state,
AbstractExternalCodeMember parent,
ProjectId projectId)
: base(state, parent)
{
_projectId = projectId;
}
private AbstractExternalCodeMember ParentElement
{
get { return (AbstractExternalCodeMember)this.Parent; }
}
private ImmutableArray<IParameterSymbol> GetParameters()
{
var symbol = this.ParentElement.LookupSymbol();
return symbol.GetParameters();
}
protected override bool TryGetItemByIndex(int index, out EnvDTE.CodeElement element)
{
var parameters = GetParameters();
if (index < parameters.Length)
{
element = (EnvDTE.CodeElement)ExternalCodeParameter.Create(this.State, _projectId, parameters[index], this.ParentElement);
return true;
}
element = null;
return false;
}
protected override bool TryGetItemByName(string name, out EnvDTE.CodeElement element)
{
var parameters = GetParameters();
var index = parameters.IndexOf(p => p.Name == name);
if (index >= 0 && index < parameters.Length)
{
element = (EnvDTE.CodeElement)ExternalCodeParameter.Create(this.State, _projectId, parameters[index], this.ParentElement);
return true;
}
element = null;
return false;
}
public override int Count
{
get
{
var parameters = GetParameters();
return parameters.Length;
}
}
}
}
| // 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.
#nullable disable
using System.Collections.Immutable;
using System.Runtime.InteropServices;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel.ExternalElements;
using Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel.Interop;
using Microsoft.VisualStudio.LanguageServices.Implementation.Interop;
namespace Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel.Collections
{
[ComVisible(true)]
[ComDefaultInterface(typeof(ICodeElements))]
public sealed class ExternalParameterCollection : AbstractCodeElementCollection
{
internal static EnvDTE.CodeElements Create(
CodeModelState state,
AbstractExternalCodeMember parent,
ProjectId projectId)
{
var collection = new ExternalParameterCollection(state, parent, projectId);
return (EnvDTE.CodeElements)ComAggregate.CreateAggregatedObject(collection);
}
private readonly ProjectId _projectId;
private ExternalParameterCollection(
CodeModelState state,
AbstractExternalCodeMember parent,
ProjectId projectId)
: base(state, parent)
{
_projectId = projectId;
}
private AbstractExternalCodeMember ParentElement
{
get { return (AbstractExternalCodeMember)this.Parent; }
}
private ImmutableArray<IParameterSymbol> GetParameters()
{
var symbol = this.ParentElement.LookupSymbol();
return symbol.GetParameters();
}
protected override bool TryGetItemByIndex(int index, out EnvDTE.CodeElement element)
{
var parameters = GetParameters();
if (index < parameters.Length)
{
element = (EnvDTE.CodeElement)ExternalCodeParameter.Create(this.State, _projectId, parameters[index], this.ParentElement);
return true;
}
element = null;
return false;
}
protected override bool TryGetItemByName(string name, out EnvDTE.CodeElement element)
{
var parameters = GetParameters();
var index = parameters.IndexOf(p => p.Name == name);
if (index >= 0 && index < parameters.Length)
{
element = (EnvDTE.CodeElement)ExternalCodeParameter.Create(this.State, _projectId, parameters[index], this.ParentElement);
return true;
}
element = null;
return false;
}
public override int Count
{
get
{
var parameters = GetParameters();
return parameters.Length;
}
}
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Workspaces/VisualBasic/Portable/Simplification/Reducers/VisualBasicMiscellaneousReducer.Rewriter.vb | ' 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.
Imports System.Threading
Imports Microsoft.CodeAnalysis.PooledObjects
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic.Simplification
Partial Friend Class VisualBasicMiscellaneousReducer
Private Class Rewriter
Inherits AbstractReductionRewriter
Public Sub New(pool As ObjectPool(Of IReductionRewriter))
MyBase.New(pool)
End Sub
Public Overrides Function VisitInvocationExpression(node As InvocationExpressionSyntax) As SyntaxNode
CancellationToken.ThrowIfCancellationRequested()
Return SimplifyExpression(
node,
newNode:=MyBase.VisitInvocationExpression(node),
simplifier:=s_simplifyInvocationExpression)
End Function
Public Overrides Function VisitObjectCreationExpression(node As ObjectCreationExpressionSyntax) As SyntaxNode
CancellationToken.ThrowIfCancellationRequested()
Return SimplifyExpression(
node,
newNode:=MyBase.VisitObjectCreationExpression(node),
simplifier:=s_simplifyObjectCreationExpression)
End Function
Public Overrides Function VisitParameter(node As ParameterSyntax) As SyntaxNode
CancellationToken.ThrowIfCancellationRequested()
Return SimplifyNode(
node,
newNode:=MyBase.VisitParameter(node),
parentNode:=node.Parent,
simplifyFunc:=s_simplifyParameter)
End Function
End Class
End Class
End Namespace
| ' 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.
Imports System.Threading
Imports Microsoft.CodeAnalysis.PooledObjects
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic.Simplification
Partial Friend Class VisualBasicMiscellaneousReducer
Private Class Rewriter
Inherits AbstractReductionRewriter
Public Sub New(pool As ObjectPool(Of IReductionRewriter))
MyBase.New(pool)
End Sub
Public Overrides Function VisitInvocationExpression(node As InvocationExpressionSyntax) As SyntaxNode
CancellationToken.ThrowIfCancellationRequested()
Return SimplifyExpression(
node,
newNode:=MyBase.VisitInvocationExpression(node),
simplifier:=s_simplifyInvocationExpression)
End Function
Public Overrides Function VisitObjectCreationExpression(node As ObjectCreationExpressionSyntax) As SyntaxNode
CancellationToken.ThrowIfCancellationRequested()
Return SimplifyExpression(
node,
newNode:=MyBase.VisitObjectCreationExpression(node),
simplifier:=s_simplifyObjectCreationExpression)
End Function
Public Overrides Function VisitParameter(node As ParameterSyntax) As SyntaxNode
CancellationToken.ThrowIfCancellationRequested()
Return SimplifyNode(
node,
newNode:=MyBase.VisitParameter(node),
parentNode:=node.Parent,
simplifyFunc:=s_simplifyParameter)
End Function
End Class
End Class
End Namespace
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/EditorFeatures/CSharpTest/Completion/CompletionServiceTests.cs | // 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.
#nullable disable
using Microsoft.CodeAnalysis.Completion;
using Microsoft.CodeAnalysis.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Completion
{
[UseExportProvider]
public class CompletionServiceTests
{
[Fact, Trait(Traits.Feature, Traits.Features.Completion)]
public void AcquireCompletionService()
{
var workspace = new AdhocWorkspace();
var document = workspace
.AddProject("TestProject", LanguageNames.CSharp)
.AddDocument("TestDocument.cs", "");
var service = CompletionService.GetService(document);
Assert.NotNull(service);
}
}
}
| // 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.
#nullable disable
using Microsoft.CodeAnalysis.Completion;
using Microsoft.CodeAnalysis.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Completion
{
[UseExportProvider]
public class CompletionServiceTests
{
[Fact, Trait(Traits.Feature, Traits.Features.Completion)]
public void AcquireCompletionService()
{
var workspace = new AdhocWorkspace();
var document = workspace
.AddProject("TestProject", LanguageNames.CSharp)
.AddDocument("TestDocument.cs", "");
var service = CompletionService.GetService(document);
Assert.NotNull(service);
}
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Tools/IdeCoreBenchmarks/FormatterBenchmarks.cs | // 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.
#nullable disable
using System;
using System.Collections.Immutable;
using System.IO;
using System.Threading;
using BenchmarkDotNet.Attributes;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp.Formatting;
using Microsoft.CodeAnalysis.Formatting;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Options;
namespace IdeCoreBenchmarks
{
[MemoryDiagnoser]
public class FormatterBenchmarks
{
private readonly int _iterationCount = 5;
private Document _document;
private OptionSet _options;
[GlobalSetup]
public void GlobalSetup()
{
var roslynRoot = Environment.GetEnvironmentVariable(Program.RoslynRootPathEnvVariableName);
var csFilePath = Path.Combine(roslynRoot, @"src\Compilers\CSharp\Portable\Generated\Syntax.xml.Syntax.Generated.cs");
if (!File.Exists(csFilePath))
{
throw new ArgumentException();
}
// Remove some newlines
var text = File.ReadAllText(csFilePath).Replace("<auto-generated />", "")
.Replace($"{{{Environment.NewLine}{Environment.NewLine}", "{")
.Replace($"}}{Environment.NewLine}{Environment.NewLine}", "}")
.Replace($"{{{Environment.NewLine}", "{")
.Replace($"}}{Environment.NewLine}", "}")
.Replace($";{Environment.NewLine}", ";");
var projectId = ProjectId.CreateNewId();
var documentId = DocumentId.CreateNewId(projectId);
var solution = new AdhocWorkspace().CurrentSolution
.AddProject(projectId, "ProjectName", "AssemblyName", LanguageNames.CSharp)
.AddDocument(documentId, "DocumentName", text);
var document = solution.GetDocument(documentId);
var root = document.GetSyntaxRootAsync(CancellationToken.None).Result.WithAdditionalAnnotations(Formatter.Annotation);
solution = solution.WithDocumentSyntaxRoot(documentId, root);
_document = solution.GetDocument(documentId);
_options = _document.GetOptionsAsync().Result
.WithChangedOption(CSharpFormattingOptions.NewLinesForBracesInTypes, true)
.WithChangedOption(CSharpFormattingOptions.WrappingKeepStatementsOnSingleLine, false)
.WithChangedOption(CSharpFormattingOptions.WrappingPreserveSingleLine, false);
}
[Benchmark]
public void FormatSyntaxNode()
{
for (int i = 0; i < _iterationCount; ++i)
{
var formattedDoc = Formatter.FormatAsync(_document, Formatter.Annotation, _options, CancellationToken.None).Result;
var formattedRoot = formattedDoc.GetSyntaxRootAsync(CancellationToken.None).Result;
_ = formattedRoot.DescendantNodesAndSelf().ToImmutableArray();
}
}
}
}
| // 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.
#nullable disable
using System;
using System.Collections.Immutable;
using System.IO;
using System.Threading;
using BenchmarkDotNet.Attributes;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp.Formatting;
using Microsoft.CodeAnalysis.Formatting;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Options;
namespace IdeCoreBenchmarks
{
[MemoryDiagnoser]
public class FormatterBenchmarks
{
private readonly int _iterationCount = 5;
private Document _document;
private OptionSet _options;
[GlobalSetup]
public void GlobalSetup()
{
var roslynRoot = Environment.GetEnvironmentVariable(Program.RoslynRootPathEnvVariableName);
var csFilePath = Path.Combine(roslynRoot, @"src\Compilers\CSharp\Portable\Generated\Syntax.xml.Syntax.Generated.cs");
if (!File.Exists(csFilePath))
{
throw new ArgumentException();
}
// Remove some newlines
var text = File.ReadAllText(csFilePath).Replace("<auto-generated />", "")
.Replace($"{{{Environment.NewLine}{Environment.NewLine}", "{")
.Replace($"}}{Environment.NewLine}{Environment.NewLine}", "}")
.Replace($"{{{Environment.NewLine}", "{")
.Replace($"}}{Environment.NewLine}", "}")
.Replace($";{Environment.NewLine}", ";");
var projectId = ProjectId.CreateNewId();
var documentId = DocumentId.CreateNewId(projectId);
var solution = new AdhocWorkspace().CurrentSolution
.AddProject(projectId, "ProjectName", "AssemblyName", LanguageNames.CSharp)
.AddDocument(documentId, "DocumentName", text);
var document = solution.GetDocument(documentId);
var root = document.GetSyntaxRootAsync(CancellationToken.None).Result.WithAdditionalAnnotations(Formatter.Annotation);
solution = solution.WithDocumentSyntaxRoot(documentId, root);
_document = solution.GetDocument(documentId);
_options = _document.GetOptionsAsync().Result
.WithChangedOption(CSharpFormattingOptions.NewLinesForBracesInTypes, true)
.WithChangedOption(CSharpFormattingOptions.WrappingKeepStatementsOnSingleLine, false)
.WithChangedOption(CSharpFormattingOptions.WrappingPreserveSingleLine, false);
}
[Benchmark]
public void FormatSyntaxNode()
{
for (int i = 0; i < _iterationCount; ++i)
{
var formattedDoc = Formatter.FormatAsync(_document, Formatter.Annotation, _options, CancellationToken.None).Result;
var formattedRoot = formattedDoc.GetSyntaxRootAsync(CancellationToken.None).Result;
_ = formattedRoot.DescendantNodesAndSelf().ToImmutableArray();
}
}
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Features/Core/Portable/DocumentIdSpan.cs | // 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.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Text;
namespace Microsoft.CodeAnalysis
{
/// <summary>
/// Lightweight analog to <see cref="DocumentSpan"/> that should be used in features that care about
/// pointing at a particular location in a <see cref="Document"/> but do not want to root a potentially
/// very stale <see cref="Solution"/> snapshot that may keep around a lot of memory in a host.
/// </summary>
internal readonly struct DocumentIdSpan
{
private readonly Workspace _workspace;
private readonly DocumentId _documentId;
public readonly TextSpan SourceSpan;
public DocumentIdSpan(DocumentSpan documentSpan)
{
_workspace = documentSpan.Document.Project.Solution.Workspace;
_documentId = documentSpan.Document.Id;
SourceSpan = documentSpan.SourceSpan;
}
public async Task<DocumentSpan?> TryRehydrateAsync(CancellationToken cancellationToken)
{
var solution = _workspace.CurrentSolution;
var document = await solution.GetDocumentAsync(_documentId, includeSourceGenerated: true, cancellationToken).ConfigureAwait(false);
return document == null ? null : new DocumentSpan(document, SourceSpan);
}
}
}
| // 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.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Text;
namespace Microsoft.CodeAnalysis
{
/// <summary>
/// Lightweight analog to <see cref="DocumentSpan"/> that should be used in features that care about
/// pointing at a particular location in a <see cref="Document"/> but do not want to root a potentially
/// very stale <see cref="Solution"/> snapshot that may keep around a lot of memory in a host.
/// </summary>
internal readonly struct DocumentIdSpan
{
private readonly Workspace _workspace;
private readonly DocumentId _documentId;
public readonly TextSpan SourceSpan;
public DocumentIdSpan(DocumentSpan documentSpan)
{
_workspace = documentSpan.Document.Project.Solution.Workspace;
_documentId = documentSpan.Document.Id;
SourceSpan = documentSpan.SourceSpan;
}
public async Task<DocumentSpan?> TryRehydrateAsync(CancellationToken cancellationToken)
{
var solution = _workspace.CurrentSolution;
var document = await solution.GetDocumentAsync(_documentId, includeSourceGenerated: true, cancellationToken).ConfigureAwait(false);
return document == null ? null : new DocumentSpan(document, SourceSpan);
}
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Features/VisualBasic/Portable/IntroduceVariable/VisualBasicIntroduceVariableService.Rewriter.vb | ' 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.
Imports Microsoft.CodeAnalysis.Simplification
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic.IntroduceVariable
Partial Friend Class VisualBasicIntroduceVariableService
Private Class Rewriter
Inherits VisualBasicSyntaxRewriter
Private ReadOnly _replacementAnnotation As New SyntaxAnnotation
Private ReadOnly _replacementNode As SyntaxNode
Private ReadOnly _matches As ISet(Of ExpressionSyntax)
Private Sub New(replacementNode As SyntaxNode, matches As ISet(Of ExpressionSyntax))
_replacementNode = replacementNode
_matches = matches
End Sub
Public Overrides Function Visit(node As SyntaxNode) As SyntaxNode
Dim expression = TryCast(node, ExpressionSyntax)
If expression IsNot Nothing AndAlso _matches.Contains(expression) Then
Return _replacementNode _
.WithLeadingTrivia(expression.GetLeadingTrivia()) _
.WithTrailingTrivia(expression.GetTrailingTrivia()) _
.WithAdditionalAnnotations(_replacementAnnotation)
End If
Return MyBase.Visit(node)
End Function
Public Overrides Function VisitParenthesizedExpression(node As ParenthesizedExpressionSyntax) As SyntaxNode
Dim newNode = MyBase.VisitParenthesizedExpression(node)
If node IsNot newNode AndAlso newNode.IsKind(SyntaxKind.ParenthesizedExpression) Then
Dim parenthesizedExpression = DirectCast(newNode, ParenthesizedExpressionSyntax)
Dim innerExpression = parenthesizedExpression.OpenParenToken.GetNextToken().Parent
If innerExpression.HasAnnotation(_replacementAnnotation) AndAlso innerExpression.Equals(parenthesizedExpression.Expression) Then
Return newNode.WithAdditionalAnnotations(Simplifier.Annotation)
End If
End If
Return newNode
End Function
Public Overloads Shared Function Visit(node As SyntaxNode, replacementNode As SyntaxNode, matches As ISet(Of ExpressionSyntax)) As SyntaxNode
Return New Rewriter(replacementNode, matches).Visit(node)
End Function
End Class
End Class
End Namespace
| ' 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.
Imports Microsoft.CodeAnalysis.Simplification
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic.IntroduceVariable
Partial Friend Class VisualBasicIntroduceVariableService
Private Class Rewriter
Inherits VisualBasicSyntaxRewriter
Private ReadOnly _replacementAnnotation As New SyntaxAnnotation
Private ReadOnly _replacementNode As SyntaxNode
Private ReadOnly _matches As ISet(Of ExpressionSyntax)
Private Sub New(replacementNode As SyntaxNode, matches As ISet(Of ExpressionSyntax))
_replacementNode = replacementNode
_matches = matches
End Sub
Public Overrides Function Visit(node As SyntaxNode) As SyntaxNode
Dim expression = TryCast(node, ExpressionSyntax)
If expression IsNot Nothing AndAlso _matches.Contains(expression) Then
Return _replacementNode _
.WithLeadingTrivia(expression.GetLeadingTrivia()) _
.WithTrailingTrivia(expression.GetTrailingTrivia()) _
.WithAdditionalAnnotations(_replacementAnnotation)
End If
Return MyBase.Visit(node)
End Function
Public Overrides Function VisitParenthesizedExpression(node As ParenthesizedExpressionSyntax) As SyntaxNode
Dim newNode = MyBase.VisitParenthesizedExpression(node)
If node IsNot newNode AndAlso newNode.IsKind(SyntaxKind.ParenthesizedExpression) Then
Dim parenthesizedExpression = DirectCast(newNode, ParenthesizedExpressionSyntax)
Dim innerExpression = parenthesizedExpression.OpenParenToken.GetNextToken().Parent
If innerExpression.HasAnnotation(_replacementAnnotation) AndAlso innerExpression.Equals(parenthesizedExpression.Expression) Then
Return newNode.WithAdditionalAnnotations(Simplifier.Annotation)
End If
End If
Return newNode
End Function
Public Overloads Shared Function Visit(node As SyntaxNode, replacementNode As SyntaxNode, matches As ISet(Of ExpressionSyntax)) As SyntaxNode
Return New Rewriter(replacementNode, matches).Visit(node)
End Function
End Class
End Class
End Namespace
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzerItem/AnalyzerItem.BrowseObject.cs | // 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.
#nullable disable
using System.ComponentModel;
namespace Microsoft.VisualStudio.LanguageServices.Implementation.SolutionExplorer
{
internal partial class AnalyzerItem
{
internal class BrowseObject : LocalizableProperties
{
private readonly AnalyzerItem _analyzerItem;
public BrowseObject(AnalyzerItem analyzerItem)
{
_analyzerItem = analyzerItem;
}
[BrowseObjectDisplayName(nameof(SolutionExplorerShim.Name))]
public string Name
{
get
{
return _analyzerItem.AnalyzerReference.Display;
}
}
[BrowseObjectDisplayName(nameof(SolutionExplorerShim.Path))]
public string Path
{
get
{
return _analyzerItem.AnalyzerReference.FullPath;
}
}
public override string GetClassName()
{
return SolutionExplorerShim.Analyzer_Properties;
}
public override string GetComponentName()
{
return _analyzerItem.Text;
}
[Browsable(false)]
public AnalyzerItem AnalyzerItem
{
get { return _analyzerItem; }
}
}
}
}
| // 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.
#nullable disable
using System.ComponentModel;
namespace Microsoft.VisualStudio.LanguageServices.Implementation.SolutionExplorer
{
internal partial class AnalyzerItem
{
internal class BrowseObject : LocalizableProperties
{
private readonly AnalyzerItem _analyzerItem;
public BrowseObject(AnalyzerItem analyzerItem)
{
_analyzerItem = analyzerItem;
}
[BrowseObjectDisplayName(nameof(SolutionExplorerShim.Name))]
public string Name
{
get
{
return _analyzerItem.AnalyzerReference.Display;
}
}
[BrowseObjectDisplayName(nameof(SolutionExplorerShim.Path))]
public string Path
{
get
{
return _analyzerItem.AnalyzerReference.FullPath;
}
}
public override string GetClassName()
{
return SolutionExplorerShim.Analyzer_Properties;
}
public override string GetComponentName()
{
return _analyzerItem.Text;
}
[Browsable(false)]
public AnalyzerItem AnalyzerItem
{
get { return _analyzerItem; }
}
}
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Compilers/Core/Portable/PEWriter/LocalScope.cs | // 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.Collections.Immutable;
using System.Diagnostics;
using System.Linq;
using Microsoft.CodeAnalysis;
namespace Microsoft.Cci
{
/// <summary>
/// A range of CLR IL operations that comprise a lexical scope.
/// </summary>
internal struct LocalScope
{
/// <summary>
/// The offset of the first operation in the scope.
/// </summary>
public readonly int StartOffset;
/// <summary>
/// The offset of the first operation outside of the scope, or the method body length.
/// </summary>
public readonly int EndOffset;
private readonly ImmutableArray<ILocalDefinition> _constants;
private readonly ImmutableArray<ILocalDefinition> _locals;
internal LocalScope(int offset, int endOffset, ImmutableArray<ILocalDefinition> constants, ImmutableArray<ILocalDefinition> locals)
{
Debug.Assert(!locals.Any(l => l.Name == null));
Debug.Assert(!constants.Any(c => c.Name == null));
Debug.Assert(offset >= 0);
Debug.Assert(endOffset > offset);
StartOffset = offset;
EndOffset = endOffset;
_constants = constants;
_locals = locals;
}
public int Length => EndOffset - StartOffset;
/// <summary>
/// Returns zero or more local constant definitions that are local to the given scope.
/// </summary>
public ImmutableArray<ILocalDefinition> Constants => _constants.NullToEmpty();
/// <summary>
/// Returns zero or more local variable definitions that are local to the given scope.
/// </summary>
public ImmutableArray<ILocalDefinition> Variables => _locals.NullToEmpty();
}
}
| // 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.Collections.Immutable;
using System.Diagnostics;
using System.Linq;
using Microsoft.CodeAnalysis;
namespace Microsoft.Cci
{
/// <summary>
/// A range of CLR IL operations that comprise a lexical scope.
/// </summary>
internal struct LocalScope
{
/// <summary>
/// The offset of the first operation in the scope.
/// </summary>
public readonly int StartOffset;
/// <summary>
/// The offset of the first operation outside of the scope, or the method body length.
/// </summary>
public readonly int EndOffset;
private readonly ImmutableArray<ILocalDefinition> _constants;
private readonly ImmutableArray<ILocalDefinition> _locals;
internal LocalScope(int offset, int endOffset, ImmutableArray<ILocalDefinition> constants, ImmutableArray<ILocalDefinition> locals)
{
Debug.Assert(!locals.Any(l => l.Name == null));
Debug.Assert(!constants.Any(c => c.Name == null));
Debug.Assert(offset >= 0);
Debug.Assert(endOffset > offset);
StartOffset = offset;
EndOffset = endOffset;
_constants = constants;
_locals = locals;
}
public int Length => EndOffset - StartOffset;
/// <summary>
/// Returns zero or more local constant definitions that are local to the given scope.
/// </summary>
public ImmutableArray<ILocalDefinition> Constants => _constants.NullToEmpty();
/// <summary>
/// Returns zero or more local variable definitions that are local to the given scope.
/// </summary>
public ImmutableArray<ILocalDefinition> Variables => _locals.NullToEmpty();
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Compilers/VisualBasic/Portable/Compilation/DocumentationComments/DocumentationCommentCompiler.Includes.vb | ' 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.
Imports System.Collections.Immutable
Imports System.Globalization
Imports System.IO
Imports System.Runtime.InteropServices
Imports System.Threading
Imports System.Xml
Imports System.Xml.Linq
Imports Microsoft.CodeAnalysis.Collections
Imports Microsoft.CodeAnalysis.PooledObjects
Imports Microsoft.CodeAnalysis.VisualBasic
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports Microsoft.CodeAnalysis.Text
Namespace Microsoft.CodeAnalysis.VisualBasic
Partial Public Class VisualBasicCompilation
Partial Friend Class DocumentationCommentCompiler
Inherits VisualBasicSymbolVisitor
Private Class IncludeElementExpander
Private ReadOnly _symbol As Symbol
Private ReadOnly _tagsSupport As WellKnownTagsSupport
Private ReadOnly _sourceIncludeElementNodes As ArrayBuilder(Of XmlNodeSyntax)
Private ReadOnly _compilation As VisualBasicCompilation
Private ReadOnly _tree As SyntaxTree
Private ReadOnly _onlyDiagnosticsFromTree As SyntaxTree
Private ReadOnly _filterSpanWithinTree As TextSpan?
Private ReadOnly _diagnostics As BindingDiagnosticBag
Private ReadOnly _cancellationToken As CancellationToken
Private _binders As Dictionary(Of DocumentationCommentBinder.BinderType, Binder) = Nothing
Private _nextSourceIncludeElementIndex As Integer
Private _inProgressIncludeElementNodes As HashSet(Of Location)
Private _includedFileCache As DocumentationCommentIncludeCache
Private Sub New(symbol As Symbol,
sourceIncludeElementNodes As ArrayBuilder(Of XmlNodeSyntax),
compilation As VisualBasicCompilation,
includedFileCache As DocumentationCommentIncludeCache,
onlyDiagnosticsFromTree As SyntaxTree,
filterSpanWithinTree As TextSpan?,
diagnostics As BindingDiagnosticBag,
cancellationToken As CancellationToken)
Me._symbol = symbol
Me._tagsSupport = New WellKnownTagsSupport(symbol)
Me._sourceIncludeElementNodes = sourceIncludeElementNodes
Me._compilation = compilation
Me._onlyDiagnosticsFromTree = onlyDiagnosticsFromTree
Me._filterSpanWithinTree = filterSpanWithinTree
Me._diagnostics = diagnostics
Me._cancellationToken = cancellationToken
Me._tree = If(sourceIncludeElementNodes Is Nothing OrElse
sourceIncludeElementNodes.Count = 0,
Nothing,
sourceIncludeElementNodes(0).SyntaxTree)
Me._includedFileCache = includedFileCache
Me._nextSourceIncludeElementIndex = 0
End Sub
Private Structure WellKnownTagsSupport
Public ReadOnly ExceptionSupported As Boolean
Public ReadOnly ReturnsSupported As Boolean
Public ReadOnly ParamAndParamRefSupported As Boolean
Public ReadOnly ValueSupported As Boolean
Public ReadOnly TypeParamSupported As Boolean
Public ReadOnly TypeParamRefSupported As Boolean
Public ReadOnly IsDeclareMethod As Boolean
Public ReadOnly IsWriteOnlyProperty As Boolean
Public ReadOnly SymbolName As String
Public Sub New(symbol As Symbol)
Me.ExceptionSupported = False
Me.ReturnsSupported = False
Me.ParamAndParamRefSupported = False
Me.ValueSupported = False
Me.TypeParamSupported = False
Me.TypeParamRefSupported = False
Me.IsDeclareMethod = False
Me.IsWriteOnlyProperty = False
Me.SymbolName = GetSymbolName(symbol)
Select Case symbol.Kind
Case SymbolKind.Field
Me.TypeParamRefSupported = True
Case SymbolKind.Event
Me.ExceptionSupported = True
Me.ParamAndParamRefSupported = True
Me.TypeParamRefSupported = True
Case SymbolKind.Method
Dim method = DirectCast(symbol, MethodSymbol)
Me.IsDeclareMethod = method.MethodKind = MethodKind.DeclareMethod
Me.ExceptionSupported = True
Me.ParamAndParamRefSupported = True
Me.TypeParamSupported = Not Me.IsDeclareMethod AndAlso method.MethodKind <> MethodKind.UserDefinedOperator
Me.TypeParamRefSupported = True
If Not method.IsSub Then
Me.ReturnsSupported = True
End If
Case SymbolKind.NamedType
Dim namedType = DirectCast(symbol, NamedTypeSymbol)
Dim invokeMethod As MethodSymbol = namedType.DelegateInvokeMethod
If namedType.TypeKind = TYPEKIND.Delegate Then
If invokeMethod IsNot Nothing AndAlso Not invokeMethod.IsSub Then
Me.ReturnsSupported = True
Else
Me.SymbolName = "delegate sub"
End If
End If
Me.ParamAndParamRefSupported = namedType.TypeKind = TYPEKIND.Delegate
Me.TypeParamSupported = namedType.TypeKind <> TYPEKIND.Enum AndAlso namedType.TypeKind <> TYPEKIND.Module
Me.TypeParamRefSupported = namedType.TypeKind <> TYPEKIND.Module
Case SymbolKind.Property
Dim prop = DirectCast(symbol, PropertySymbol)
Me.ExceptionSupported = True
Me.ParamAndParamRefSupported = True
Me.TypeParamRefSupported = True
Me.ValueSupported = True
Me.IsWriteOnlyProperty = prop.IsWriteOnly
Me.ReturnsSupported = Not Me.IsWriteOnlyProperty
Case Else
Throw ExceptionUtilities.UnexpectedValue(symbol.Kind)
End Select
End Sub
End Structure
Friend Shared Function ProcessIncludes(unprocessed As String,
memberSymbol As Symbol,
sourceIncludeElementNodes As ArrayBuilder(Of XmlNodeSyntax),
compilation As VisualBasicCompilation,
onlyDiagnosticsFromTree As SyntaxTree,
filterSpanWithinTree As TextSpan?,
ByRef includedFileCache As DocumentationCommentIncludeCache,
diagnostics As BindingDiagnosticBag,
cancellationToken As CancellationToken) As String
' If there are no include elements, then there's nothing to expand.
'
' NOTE: Following C# implementation we avoid parsing/printing of the xml
' in this case, which might differ in terms of printed whitespaces
' if we compare to the result of parse/print scenario
If sourceIncludeElementNodes Is Nothing Then
Return unprocessed
End If
Debug.Assert(sourceIncludeElementNodes.Count > 0)
Dim doc As XDocument
Try
' NOTE: XDocument.Parse seems to do a better job of preserving whitespace than XElement.Parse.
doc = XDocument.Parse(unprocessed, LoadOptions.PreserveWhitespace)
Catch ex As XmlException
Return unprocessed
End Try
Dim pooled As PooledStringBuilder = PooledStringBuilder.GetInstance()
Using writer As New StringWriter(pooled.Builder, CultureInfo.InvariantCulture)
cancellationToken.ThrowIfCancellationRequested()
Dim expander = New IncludeElementExpander(memberSymbol,
sourceIncludeElementNodes,
compilation,
includedFileCache,
onlyDiagnosticsFromTree,
filterSpanWithinTree,
diagnostics,
cancellationToken)
For Each node In expander.Rewrite(doc, currentXmlFilePath:=Nothing, originatingSyntax:=Nothing)
cancellationToken.ThrowIfCancellationRequested()
writer.Write(node)
Next
Debug.Assert(expander._nextSourceIncludeElementIndex = expander._sourceIncludeElementNodes.Count)
includedFileCache = expander._includedFileCache
End Using
Return pooled.ToStringAndFree()
End Function
Private ReadOnly Property ProduceDiagnostics As Boolean
Get
Return Me._tree.ReportDocumentationCommentDiagnostics
End Get
End Property
Private ReadOnly Property ProduceXmlDiagnostics As Boolean
Get
Return Me._tree.ReportDocumentationCommentDiagnostics AndAlso Me._onlyDiagnosticsFromTree Is Nothing
End Get
End Property
Private ReadOnly Property [Module] As SourceModuleSymbol
Get
Return DirectCast(Me._compilation.SourceModule, SourceModuleSymbol)
End Get
End Property
Private Function GetOrCreateBinder(type As DocumentationCommentBinder.BinderType) As Binder
If Me._binders Is Nothing Then
Me._binders = New Dictionary(Of DocumentationCommentBinder.BinderType, Binder)()
End If
Dim result As Binder = Nothing
If Not Me._binders.TryGetValue(type, result) Then
Debug.Assert(Me._tree IsNot Nothing)
result = CreateDocumentationCommentBinderForSymbol(Me.Module, Me._symbol, Me._tree, type)
Me._binders.Add(type, result)
End If
Return result
End Function
''' <remarks>
''' Rewrites nodes in <paramref name="nodes"/>, which Is a snapshot of nodes from the original document.
''' We're mutating the tree as we rewrite, so it's important to grab a snapshot of the
''' nodes that we're going to reparent before we enumerate them.
''' </remarks>
Private Function RewriteMany(nodes As XNode(), currentXmlFilePath As String, originatingSyntax As XmlNodeSyntax) As XNode()
Debug.Assert(nodes IsNot Nothing)
Dim builder As ArrayBuilder(Of XNode) = Nothing
For Each child In nodes
If builder Is Nothing Then
builder = ArrayBuilder(Of XNode).GetInstance()
End If
builder.AddRange(Rewrite(child, currentXmlFilePath, originatingSyntax))
Next
' Nodes returned by this method are going to be attached to a new parent, so it's
' important that they don't already have parents. If a node with a parent is
' attached to a new parent, it is copied and its annotations are dropped.
Debug.Assert(builder Is Nothing OrElse builder.All(Function(node) node.Parent Is Nothing))
Return If(builder Is Nothing, Array.Empty(Of XNode)(), builder.ToArrayAndFree())
End Function
Private Function Rewrite(node As XNode, currentXmlFilePath As String, originatingSyntax As XmlNodeSyntax) As XNode()
Me._cancellationToken.ThrowIfCancellationRequested()
Dim commentMessage As String = Nothing
If node.NodeType = XmlNodeType.Element Then
Dim element = DirectCast(node, XElement)
If ElementNameIs(element, DocumentationCommentXmlNames.IncludeElementName) Then
Dim rewritten As XNode() = RewriteIncludeElement(element, currentXmlFilePath, originatingSyntax, commentMessage)
If rewritten IsNot Nothing Then
Return rewritten
End If
End If
End If
Dim container = TryCast(node, XContainer)
If container Is Nothing Then
Debug.Assert(commentMessage Is Nothing, "How did we get an error comment for a non-container?")
Return New XNode() {node.Copy(copyAttributeAnnotations:=True)}
End If
Dim oldNodes As IEnumerable(Of XNode) = container.Nodes
' Do this after grabbing the nodes, so we don't see copies of them.
container = container.Copy(copyAttributeAnnotations:=True)
' WARN: don't use node after this point - use container since it's already been copied.
If oldNodes IsNot Nothing Then
Dim rewritten As XNode() = RewriteMany(oldNodes.ToArray(), currentXmlFilePath, originatingSyntax)
container.ReplaceNodes(rewritten)
End If
' NOTE: we only care if we're included text - otherwise we've already processed the cref/name.
If container.NodeType = XmlNodeType.Element AndAlso originatingSyntax IsNot Nothing Then
Debug.Assert(currentXmlFilePath IsNot Nothing)
Dim element = DirectCast(container, XElement)
Dim elementName As XName = element.Name
Dim binderType As DocumentationCommentBinder.BinderType = DocumentationCommentBinder.BinderType.None
Dim elementIsException As Boolean = False ' To support WRN_XMLDocExceptionTagWithoutCRef
' Check element first for well-known names
If ElementNameIs(element, DocumentationCommentXmlNames.ExceptionElementName) Then
If Not Me._tagsSupport.ExceptionSupported Then
commentMessage = GenerateDiagnostic(XmlLocation.Create(element, currentXmlFilePath),
ERRID.WRN_XMLDocIllegalTagOnElement2,
elementName.LocalName,
Me._tagsSupport.SymbolName)
Else
elementIsException = True
End If
ElseIf ElementNameIs(element, DocumentationCommentXmlNames.ReturnsElementName) Then
If Not Me._tagsSupport.ReturnsSupported Then
' NOTE: different messages in two cases:
If Me._tagsSupport.IsDeclareMethod Then
commentMessage = GenerateDiagnostic(XmlLocation.Create(element, currentXmlFilePath), ERRID.WRN_XMLDocReturnsOnADeclareSub)
ElseIf Me._tagsSupport.IsWriteOnlyProperty Then
commentMessage = GenerateDiagnostic(XmlLocation.Create(element, currentXmlFilePath), ERRID.WRN_XMLDocReturnsOnWriteOnlyProperty)
Else
commentMessage = GenerateDiagnostic(XmlLocation.Create(element, currentXmlFilePath),
ERRID.WRN_XMLDocIllegalTagOnElement2,
elementName.LocalName,
Me._tagsSupport.SymbolName)
End If
End If
ElseIf ElementNameIs(element, DocumentationCommentXmlNames.ParameterElementName) OrElse
ElementNameIs(element, DocumentationCommentXmlNames.ParameterReferenceElementName) Then
binderType = DocumentationCommentBinder.BinderType.NameInParamOrParamRef
If Not Me._tagsSupport.ParamAndParamRefSupported Then
commentMessage = GenerateDiagnostic(XmlLocation.Create(element, currentXmlFilePath),
ERRID.WRN_XMLDocIllegalTagOnElement2,
elementName.LocalName,
Me._tagsSupport.SymbolName)
End If
ElseIf ElementNameIs(element, DocumentationCommentXmlNames.ValueElementName) Then
If Not Me._tagsSupport.ValueSupported Then
commentMessage = GenerateDiagnostic(XmlLocation.Create(element, currentXmlFilePath),
ERRID.WRN_XMLDocIllegalTagOnElement2,
elementName.LocalName,
Me._tagsSupport.SymbolName)
End If
ElseIf ElementNameIs(element, DocumentationCommentXmlNames.TypeParameterElementName) Then
binderType = DocumentationCommentBinder.BinderType.NameInTypeParam
If Not Me._tagsSupport.TypeParamSupported Then
commentMessage = GenerateDiagnostic(XmlLocation.Create(element, currentXmlFilePath),
ERRID.WRN_XMLDocIllegalTagOnElement2,
elementName.LocalName,
Me._tagsSupport.SymbolName)
End If
ElseIf ElementNameIs(element, DocumentationCommentXmlNames.TypeParameterReferenceElementName) Then
binderType = DocumentationCommentBinder.BinderType.NameInTypeParamRef
If Not Me._tagsSupport.TypeParamRefSupported Then
commentMessage = GenerateDiagnostic(XmlLocation.Create(element, currentXmlFilePath),
ERRID.WRN_XMLDocIllegalTagOnElement2,
elementName.LocalName,
Me._tagsSupport.SymbolName)
End If
End If
If commentMessage Is Nothing Then
Dim nameAttribute As XAttribute = Nothing
Dim seenCref As Boolean = False
For Each attribute In element.Attributes
If AttributeNameIs(attribute, DocumentationCommentXmlNames.CrefAttributeName) Then
' NOTE: 'cref=' errors are ignored, because the reference is marked with "?:..."
BindAndReplaceCref(attribute, currentXmlFilePath)
seenCref = True
ElseIf AttributeNameIs(attribute, DocumentationCommentXmlNames.NameAttributeName) Then
nameAttribute = attribute
End If
Next
' After processing 'special' attributes, we need to either bind 'name'
' attribute value or, if the element was 'exception', and 'cref' was not found,
' report WRN_XMLDocExceptionTagWithoutCRef
If elementIsException Then
If Not seenCref Then
commentMessage = GenerateDiagnostic(XmlLocation.Create(element, currentXmlFilePath), ERRID.WRN_XMLDocExceptionTagWithoutCRef)
End If
ElseIf binderType <> DocumentationCommentBinder.BinderType.None Then
Debug.Assert(binderType <> DocumentationCommentBinder.BinderType.Cref)
If nameAttribute Is Nothing Then
' Report missing 'name' attribute
commentMessage = GenerateDiagnostic(XmlLocation.Create(element, currentXmlFilePath),
If(binderType = DocumentationCommentBinder.BinderType.NameInParamOrParamRef,
ERRID.WRN_XMLDocParamTagWithoutName,
ERRID.WRN_XMLDocGenericParamTagWithoutName))
Else
' Bind the value of 'name' attribute
commentMessage = BindName(nameAttribute,
elementName.LocalName,
binderType,
If(binderType = DocumentationCommentBinder.BinderType.NameInParamOrParamRef, ERRID.WRN_XMLDocBadParamTag2, ERRID.WRN_XMLDocBadGenericParamTag2),
currentXmlFilePath)
End If
End If
End If
End If
If commentMessage Is Nothing Then
Return New XNode() {container}
Else
Return New XNode() {New XComment(commentMessage), container}
End If
End Function
Private Shared Function ElementNameIs(element As XElement, name As String) As Boolean
Return String.IsNullOrEmpty(element.Name.NamespaceName) AndAlso
DocumentationCommentXmlNames.ElementEquals(element.Name.LocalName, name, True)
End Function
Private Shared Function AttributeNameIs(attribute As XAttribute, name As String) As Boolean
Return String.IsNullOrEmpty(attribute.Name.NamespaceName) AndAlso
DocumentationCommentXmlNames.AttributeEquals(attribute.Name.LocalName, name)
End Function
Private Function RewriteIncludeElement(includeElement As XElement, currentXmlFilePath As String, originatingSyntax As XmlNodeSyntax, <Out> ByRef commentMessage As String) As XNode()
Dim location As location = GetIncludeElementLocation(includeElement, currentXmlFilePath, originatingSyntax)
Debug.Assert(originatingSyntax IsNot Nothing)
If Not AddIncludeElementLocation(location) Then
' NOTE: these must exist since we're already processed this node elsewhere in the call stack.
Dim fileAttr As XAttribute = includeElement.Attribute(XName.Get(DocumentationCommentXmlNames.FileAttributeName))
Dim pathAttr As XAttribute = includeElement.Attribute(XName.Get(DocumentationCommentXmlNames.PathAttributeName))
commentMessage = GenerateDiagnostic(location, ERRID.WRN_XMLDocInvalidXMLFragment, fileAttr.Value, pathAttr.Value)
' Don't inspect the children - we're already in a cycle.
Return New XNode() {New XComment(commentMessage)}
End If
Try
Dim fileAttr As XAttribute = includeElement.Attribute(XName.Get(DocumentationCommentXmlNames.FileAttributeName))
Dim pathAttr As XAttribute = includeElement.Attribute(XName.Get(DocumentationCommentXmlNames.PathAttributeName))
Dim hasFileAttribute As Boolean = fileAttr IsNot Nothing
Dim hasPathAttribute As Boolean = pathAttr IsNot Nothing
If Not hasFileAttribute OrElse Not hasPathAttribute Then
' 'file' or 'path' attribute missing
If Not hasFileAttribute Then
commentMessage = GenerateDiagnostic(location, ERRID.WRN_XMLMissingFileOrPathAttribute1, DocumentationCommentXmlNames.FileAttributeName)
End If
If Not hasPathAttribute Then
commentMessage = If(commentMessage Is Nothing, "", commentMessage & " ") &
GenerateDiagnostic(location, ERRID.WRN_XMLMissingFileOrPathAttribute1, DocumentationCommentXmlNames.PathAttributeName)
End If
Return New XNode() {New XComment(commentMessage)}
End If
Dim xpathValue As String = pathAttr.Value
Dim filePathValue As String = fileAttr.Value
Dim resolver = _compilation.Options.XmlReferenceResolver
If resolver Is Nothing Then
commentMessage = GenerateDiagnostic(True, location, ERRID.WRN_XMLDocBadFormedXML, filePathValue, xpathValue, New CodeAnalysisResourcesLocalizableErrorArgument(NameOf(CodeAnalysisResources.XmlReferencesNotSupported)))
Return New XNode() {New XComment(commentMessage)}
End If
Dim resolvedFilePath As String = resolver.ResolveReference(filePathValue, currentXmlFilePath)
If resolvedFilePath Is Nothing Then
commentMessage = GenerateDiagnostic(True, location, ERRID.WRN_XMLDocBadFormedXML, filePathValue, xpathValue, New CodeAnalysisResourcesLocalizableErrorArgument(NameOf(CodeAnalysisResources.FileNotFound)))
Return New XNode() {New XComment(commentMessage)}
End If
If _includedFileCache Is Nothing Then
_includedFileCache = New DocumentationCommentIncludeCache(_compilation.Options.XmlReferenceResolver)
End If
Try
Dim doc As XDocument
Try
doc = _includedFileCache.GetOrMakeDocument(resolvedFilePath)
Catch e As IOException
commentMessage = GenerateDiagnostic(True, location, ERRID.WRN_XMLDocBadFormedXML, filePathValue, xpathValue, e.Message)
Return New XNode() {New XComment(commentMessage)}
End Try
Debug.Assert(doc IsNot Nothing)
Dim errorMessage As String = Nothing
Dim invalidXPath As Boolean = False
Dim loadedElements As XElement() = XmlUtilities.TrySelectElements(doc, xpathValue, errorMessage, invalidXPath)
If loadedElements Is Nothing Then
commentMessage = GenerateDiagnostic(True, location, ERRID.WRN_XMLDocInvalidXMLFragment, xpathValue, filePathValue)
Return New XNode() {New XComment(commentMessage)}
End If
If loadedElements IsNot Nothing AndAlso loadedElements.Length > 0 Then
' change the current XML file path for nodes contained in the document
Dim result As XNode() = RewriteMany(loadedElements, resolvedFilePath, originatingSyntax)
' The elements could be rewritten away if they are includes that refer to invalid
' (but existing and accessible) XML files. If this occurs, behave as if we
' had failed to find any XPath results.
If result.Length > 0 Then
' NOTE: in this case, we do NOT visit the children of the include element -
' they are dropped.
commentMessage = Nothing
Return result
End If
End If
' Nothing was found
commentMessage = GenerateDiagnostic(True, location, ERRID.WRN_XMLDocInvalidXMLFragment, xpathValue, filePathValue)
Return New XNode() {New XComment(commentMessage)}
Catch ex As XmlException
commentMessage = GenerateDiagnostic(True, location, ERRID.WRN_XMLDocInvalidXMLFragment, xpathValue, filePathValue)
Return New XNode() {New XComment(commentMessage)}
End Try
Finally
RemoveIncludeElementLocation(location)
End Try
End Function
Private Function ShouldProcessLocation(loc As Location) As Boolean
Return Me._onlyDiagnosticsFromTree Is Nothing OrElse
loc.Kind = LocationKind.SourceFile AndAlso DirectCast(loc, SourceLocation).SourceTree Is Me._onlyDiagnosticsFromTree AndAlso
(Not Me._filterSpanWithinTree.HasValue OrElse Me._filterSpanWithinTree.Value.Contains(loc.SourceSpan))
End Function
Private Function GenerateDiagnostic(suppressDiagnostic As Boolean, loc As Location, id As ERRID, ParamArray arguments As Object()) As String
Dim info As DiagnosticInfo = ErrorFactory.ErrorInfo(id, arguments)
If Not suppressDiagnostic AndAlso Me.ProduceDiagnostics AndAlso ShouldProcessLocation(loc) Then
Me._diagnostics.Add(New VBDiagnostic(info, loc))
End If
Return info.ToString()
End Function
Private Function GenerateDiagnostic(loc As Location, id As ERRID, ParamArray arguments As Object()) As String
Return GenerateDiagnostic(False, loc, id, arguments)
End Function
Private Function AddIncludeElementLocation(location As Location) As Boolean
If Me._inProgressIncludeElementNodes Is Nothing Then
Me._inProgressIncludeElementNodes = New HashSet(Of location)()
End If
Return Me._inProgressIncludeElementNodes.Add(location)
End Function
Private Function RemoveIncludeElementLocation(location As Location) As Boolean
Debug.Assert(Me._inProgressIncludeElementNodes IsNot Nothing)
Dim result As Boolean = Me._inProgressIncludeElementNodes.Remove(location)
Debug.Assert(result)
Return result
End Function
Private Function GetIncludeElementLocation(includeElement As XElement, ByRef currentXmlFilePath As String, ByRef originatingSyntax As XmlNodeSyntax) As Location
Dim location As location = includeElement.Annotation(Of location)()
If location IsNot Nothing Then
Return location
End If
' If we are not in an XML file, then we must be in a source file. Since we're traversing the XML tree in the same
' order as the DocumentationCommentWalker, we can access the elements of includeElementNodes in order.
If currentXmlFilePath Is Nothing Then
Debug.Assert(_nextSourceIncludeElementIndex < _sourceIncludeElementNodes.Count)
Debug.Assert(originatingSyntax Is Nothing)
originatingSyntax = _sourceIncludeElementNodes(_nextSourceIncludeElementIndex)
location = originatingSyntax.GetLocation()
Me._nextSourceIncludeElementIndex += 1
includeElement.AddAnnotation(location)
currentXmlFilePath = location.GetLineSpan().Path
Else
location = XmlLocation.Create(includeElement, currentXmlFilePath)
End If
Debug.Assert(location IsNot Nothing)
Return location
End Function
Private Sub BindAndReplaceCref(attribute As XAttribute, currentXmlFilePath As String)
Debug.Assert(currentXmlFilePath IsNot Nothing)
Dim attributeText As String = attribute.ToString()
' note, the parent element name does not matter
Dim attr As BaseXmlAttributeSyntax = SyntaxFactory.ParseDocCommentAttributeAsStandAloneEntity(attributeText, parentElementName:="")
' NOTE: we don't expect any *syntax* errors on the parsed xml
' attribute, or otherwise why xml parsed didn't throw?
Debug.Assert(attr IsNot Nothing)
Select Case attr.Kind
Case SyntaxKind.XmlCrefAttribute
Dim binder As binder = Me.GetOrCreateBinder(DocumentationCommentBinder.BinderType.Cref)
Dim reference As CrefReferenceSyntax = DirectCast(attr, XmlCrefAttributeSyntax).Reference
Dim useSiteInfo = binder.GetNewCompoundUseSiteInfo(_diagnostics)
Dim diagnostics = BindingDiagnosticBag.GetInstance(_diagnostics)
Dim bindResult As ImmutableArray(Of Symbol) = binder.BindInsideCrefAttributeValue(reference, preserveAliases:=False,
diagnosticBag:=diagnostics, useSiteInfo:=useSiteInfo)
_diagnostics.AddDependencies(diagnostics)
_diagnostics.AddDependencies(useSiteInfo)
Dim errorLocations = diagnostics.DiagnosticBag.ToReadOnly().SelectAsArray(Function(x) x.Location).WhereAsArray(Function(x) x IsNot Nothing)
diagnostics.Free()
If Me.ProduceXmlDiagnostics AndAlso Not useSiteInfo.Diagnostics.IsNullOrEmpty Then
ProcessErrorLocations(XmlLocation.Create(attribute, currentXmlFilePath), Nothing, useSiteInfo, errorLocations, Nothing)
End If
If bindResult.IsDefaultOrEmpty Then
If Me.ProduceXmlDiagnostics Then
ProcessErrorLocations(XmlLocation.Create(attribute, currentXmlFilePath), reference.ToFullString().TrimEnd(), useSiteInfo, errorLocations, ERRID.WRN_XMLDocCrefAttributeNotFound1)
End If
attribute.Value = "?:" + attribute.Value
Else
' The following mimics handling 'cref' attributes in source documentation
' comment, see DocumentationCommentWalker for details
' Some symbols found may not support doc-comment-ids, we just filter
' those out, from the rest we take the symbol with 'smallest' location
Dim symbolCommentId As String = Nothing
Dim smallestSymbol As Symbol = Nothing
Dim errid As ERRID = errid.WRN_XMLDocCrefAttributeNotFound1
For Each symbol In bindResult
If symbol.Kind = SymbolKind.TypeParameter Then
errid = errid.WRN_XMLDocCrefToTypeParameter
Continue For
End If
Dim id As String = symbol.OriginalDefinition.GetDocumentationCommentId()
If id IsNot Nothing Then
' Override only if this is the first id or the new symbol's location wins;
' note that we want to ignore the cases when there are more than one symbol
' can be found by the name, just deterministically choose which one to use
If symbolCommentId Is Nothing OrElse
Me._compilation.CompareSourceLocations(
smallestSymbol.Locations(0), symbol.Locations(0)) > 0 Then
symbolCommentId = id
smallestSymbol = symbol
End If
End If
Next
If symbolCommentId Is Nothing Then
If Me.ProduceXmlDiagnostics Then
ProcessErrorLocations(XmlLocation.Create(attribute, currentXmlFilePath), reference.ToString(), Nothing, errorLocations, errid)
End If
attribute.Value = "?:" + attribute.Value
Else
' Replace value with id
attribute.Value = symbolCommentId
_diagnostics.AddAssembliesUsedByCrefTarget(smallestSymbol.OriginalDefinition)
End If
End If
Case SyntaxKind.XmlAttribute
' 'cref=' attribute can land here for two reasons:
' (a) the value is represented in a form "X:SOME-ID-STRING", or
' (b) the value between '"' is not a valid NameSyntax
'
' in both cases we want just to put the result into documentation XML.
'
' In the second case we also generate a diagnostic and add '!:' in from
' of the value indicating wrong id, and generate a diagnostic
Dim value As String = attribute.Value.Trim()
If value.Length < 2 OrElse value(0) = ":"c OrElse value(1) <> ":"c Then
' Case (b) from above
If Me.ProduceXmlDiagnostics Then
Me._diagnostics.Add(ERRID.WRN_XMLDocCrefAttributeNotFound1, XmlLocation.Create(attribute, currentXmlFilePath), value)
End If
attribute.Value = "?:" + value
End If
Case Else
Throw ExceptionUtilities.UnexpectedValue(attr.Kind)
End Select
End Sub
Private Sub ProcessErrorLocations(currentXmlLocation As XmlLocation, referenceName As String, useSiteInfo As CompoundUseSiteInfo(Of AssemblySymbol), errorLocations As ImmutableArray(Of Location), errid As Nullable(Of ERRID))
If errorLocations.Length = 0 Then
If useSiteInfo.Diagnostics IsNot Nothing Then
Me._diagnostics.AddDiagnostics(currentXmlLocation, useSiteInfo)
ElseIf errid.HasValue Then
Me._diagnostics.Add(errid.Value, currentXmlLocation, referenceName)
End If
ElseIf errid.HasValue Then
For Each location In errorLocations
Me._diagnostics.Add(errid.Value, location, referenceName)
Next
Else
For Each location In errorLocations
Me._diagnostics.AddDiagnostics(location, useSiteInfo)
Next
End If
End Sub
Private Function BindName(attribute As XAttribute,
elementName As String,
type As DocumentationCommentBinder.BinderType,
badNameValueError As ERRID,
currentXmlFilePath As String) As String
Debug.Assert(type = DocumentationCommentBinder.BinderType.NameInParamOrParamRef OrElse
type = DocumentationCommentBinder.BinderType.NameInTypeParamRef OrElse
type = DocumentationCommentBinder.BinderType.NameInTypeParam)
Debug.Assert(currentXmlFilePath IsNot Nothing)
Dim commentMessage As String = Nothing
Dim attributeText As String = attribute.ToString()
Dim attributeValue As String = attribute.Value.Trim()
Dim attr As BaseXmlAttributeSyntax =
SyntaxFactory.ParseDocCommentAttributeAsStandAloneEntity(
attributeText, elementName) ' note, the element name does not matter
' NOTE: we don't expect any *syntax* errors on the parsed xml
' attribute, or otherwise why xml parsed didn't throw?
Debug.Assert(attr IsNot Nothing)
Debug.Assert(Not attr.ContainsDiagnostics)
Select Case attr.Kind
Case SyntaxKind.XmlNameAttribute
Dim binder As binder = Me.GetOrCreateBinder(type)
Dim identifier As IdentifierNameSyntax = DirectCast(attr, XmlNameAttributeSyntax).Reference
Dim useSiteInfo = binder.GetNewCompoundUseSiteInfo(Me._diagnostics)
Dim bindResult As ImmutableArray(Of Symbol) = binder.BindXmlNameAttributeValue(identifier, useSiteInfo)
Me._diagnostics.AddDependencies(useSiteInfo)
If Me.ProduceDiagnostics AndAlso Not useSiteInfo.Diagnostics.IsNullOrEmpty Then
Dim loc As Location = XmlLocation.Create(attribute, currentXmlFilePath)
If ShouldProcessLocation(loc) Then
Me._diagnostics.AddDiagnostics(loc, useSiteInfo)
End If
End If
If bindResult.IsDefaultOrEmpty Then
commentMessage = GenerateDiagnostic(XmlLocation.Create(attribute, currentXmlFilePath), badNameValueError, attributeValue, Me._tagsSupport.SymbolName)
End If
Case SyntaxKind.XmlAttribute
' 'name=' attribute can get here if parsing of identifier went wrong, we need to generate a diagnostic
commentMessage = GenerateDiagnostic(XmlLocation.Create(attribute, currentXmlFilePath), badNameValueError, attributeValue, Me._tagsSupport.SymbolName)
Case Else
Throw ExceptionUtilities.UnexpectedValue(attr.Kind)
End Select
Return commentMessage
End Function
End Class
End Class
End Class
End Namespace
| ' 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.
Imports System.Collections.Immutable
Imports System.Globalization
Imports System.IO
Imports System.Runtime.InteropServices
Imports System.Threading
Imports System.Xml
Imports System.Xml.Linq
Imports Microsoft.CodeAnalysis.Collections
Imports Microsoft.CodeAnalysis.PooledObjects
Imports Microsoft.CodeAnalysis.VisualBasic
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports Microsoft.CodeAnalysis.Text
Namespace Microsoft.CodeAnalysis.VisualBasic
Partial Public Class VisualBasicCompilation
Partial Friend Class DocumentationCommentCompiler
Inherits VisualBasicSymbolVisitor
Private Class IncludeElementExpander
Private ReadOnly _symbol As Symbol
Private ReadOnly _tagsSupport As WellKnownTagsSupport
Private ReadOnly _sourceIncludeElementNodes As ArrayBuilder(Of XmlNodeSyntax)
Private ReadOnly _compilation As VisualBasicCompilation
Private ReadOnly _tree As SyntaxTree
Private ReadOnly _onlyDiagnosticsFromTree As SyntaxTree
Private ReadOnly _filterSpanWithinTree As TextSpan?
Private ReadOnly _diagnostics As BindingDiagnosticBag
Private ReadOnly _cancellationToken As CancellationToken
Private _binders As Dictionary(Of DocumentationCommentBinder.BinderType, Binder) = Nothing
Private _nextSourceIncludeElementIndex As Integer
Private _inProgressIncludeElementNodes As HashSet(Of Location)
Private _includedFileCache As DocumentationCommentIncludeCache
Private Sub New(symbol As Symbol,
sourceIncludeElementNodes As ArrayBuilder(Of XmlNodeSyntax),
compilation As VisualBasicCompilation,
includedFileCache As DocumentationCommentIncludeCache,
onlyDiagnosticsFromTree As SyntaxTree,
filterSpanWithinTree As TextSpan?,
diagnostics As BindingDiagnosticBag,
cancellationToken As CancellationToken)
Me._symbol = symbol
Me._tagsSupport = New WellKnownTagsSupport(symbol)
Me._sourceIncludeElementNodes = sourceIncludeElementNodes
Me._compilation = compilation
Me._onlyDiagnosticsFromTree = onlyDiagnosticsFromTree
Me._filterSpanWithinTree = filterSpanWithinTree
Me._diagnostics = diagnostics
Me._cancellationToken = cancellationToken
Me._tree = If(sourceIncludeElementNodes Is Nothing OrElse
sourceIncludeElementNodes.Count = 0,
Nothing,
sourceIncludeElementNodes(0).SyntaxTree)
Me._includedFileCache = includedFileCache
Me._nextSourceIncludeElementIndex = 0
End Sub
Private Structure WellKnownTagsSupport
Public ReadOnly ExceptionSupported As Boolean
Public ReadOnly ReturnsSupported As Boolean
Public ReadOnly ParamAndParamRefSupported As Boolean
Public ReadOnly ValueSupported As Boolean
Public ReadOnly TypeParamSupported As Boolean
Public ReadOnly TypeParamRefSupported As Boolean
Public ReadOnly IsDeclareMethod As Boolean
Public ReadOnly IsWriteOnlyProperty As Boolean
Public ReadOnly SymbolName As String
Public Sub New(symbol As Symbol)
Me.ExceptionSupported = False
Me.ReturnsSupported = False
Me.ParamAndParamRefSupported = False
Me.ValueSupported = False
Me.TypeParamSupported = False
Me.TypeParamRefSupported = False
Me.IsDeclareMethod = False
Me.IsWriteOnlyProperty = False
Me.SymbolName = GetSymbolName(symbol)
Select Case symbol.Kind
Case SymbolKind.Field
Me.TypeParamRefSupported = True
Case SymbolKind.Event
Me.ExceptionSupported = True
Me.ParamAndParamRefSupported = True
Me.TypeParamRefSupported = True
Case SymbolKind.Method
Dim method = DirectCast(symbol, MethodSymbol)
Me.IsDeclareMethod = method.MethodKind = MethodKind.DeclareMethod
Me.ExceptionSupported = True
Me.ParamAndParamRefSupported = True
Me.TypeParamSupported = Not Me.IsDeclareMethod AndAlso method.MethodKind <> MethodKind.UserDefinedOperator
Me.TypeParamRefSupported = True
If Not method.IsSub Then
Me.ReturnsSupported = True
End If
Case SymbolKind.NamedType
Dim namedType = DirectCast(symbol, NamedTypeSymbol)
Dim invokeMethod As MethodSymbol = namedType.DelegateInvokeMethod
If namedType.TypeKind = TYPEKIND.Delegate Then
If invokeMethod IsNot Nothing AndAlso Not invokeMethod.IsSub Then
Me.ReturnsSupported = True
Else
Me.SymbolName = "delegate sub"
End If
End If
Me.ParamAndParamRefSupported = namedType.TypeKind = TYPEKIND.Delegate
Me.TypeParamSupported = namedType.TypeKind <> TYPEKIND.Enum AndAlso namedType.TypeKind <> TYPEKIND.Module
Me.TypeParamRefSupported = namedType.TypeKind <> TYPEKIND.Module
Case SymbolKind.Property
Dim prop = DirectCast(symbol, PropertySymbol)
Me.ExceptionSupported = True
Me.ParamAndParamRefSupported = True
Me.TypeParamRefSupported = True
Me.ValueSupported = True
Me.IsWriteOnlyProperty = prop.IsWriteOnly
Me.ReturnsSupported = Not Me.IsWriteOnlyProperty
Case Else
Throw ExceptionUtilities.UnexpectedValue(symbol.Kind)
End Select
End Sub
End Structure
Friend Shared Function ProcessIncludes(unprocessed As String,
memberSymbol As Symbol,
sourceIncludeElementNodes As ArrayBuilder(Of XmlNodeSyntax),
compilation As VisualBasicCompilation,
onlyDiagnosticsFromTree As SyntaxTree,
filterSpanWithinTree As TextSpan?,
ByRef includedFileCache As DocumentationCommentIncludeCache,
diagnostics As BindingDiagnosticBag,
cancellationToken As CancellationToken) As String
' If there are no include elements, then there's nothing to expand.
'
' NOTE: Following C# implementation we avoid parsing/printing of the xml
' in this case, which might differ in terms of printed whitespaces
' if we compare to the result of parse/print scenario
If sourceIncludeElementNodes Is Nothing Then
Return unprocessed
End If
Debug.Assert(sourceIncludeElementNodes.Count > 0)
Dim doc As XDocument
Try
' NOTE: XDocument.Parse seems to do a better job of preserving whitespace than XElement.Parse.
doc = XDocument.Parse(unprocessed, LoadOptions.PreserveWhitespace)
Catch ex As XmlException
Return unprocessed
End Try
Dim pooled As PooledStringBuilder = PooledStringBuilder.GetInstance()
Using writer As New StringWriter(pooled.Builder, CultureInfo.InvariantCulture)
cancellationToken.ThrowIfCancellationRequested()
Dim expander = New IncludeElementExpander(memberSymbol,
sourceIncludeElementNodes,
compilation,
includedFileCache,
onlyDiagnosticsFromTree,
filterSpanWithinTree,
diagnostics,
cancellationToken)
For Each node In expander.Rewrite(doc, currentXmlFilePath:=Nothing, originatingSyntax:=Nothing)
cancellationToken.ThrowIfCancellationRequested()
writer.Write(node)
Next
Debug.Assert(expander._nextSourceIncludeElementIndex = expander._sourceIncludeElementNodes.Count)
includedFileCache = expander._includedFileCache
End Using
Return pooled.ToStringAndFree()
End Function
Private ReadOnly Property ProduceDiagnostics As Boolean
Get
Return Me._tree.ReportDocumentationCommentDiagnostics
End Get
End Property
Private ReadOnly Property ProduceXmlDiagnostics As Boolean
Get
Return Me._tree.ReportDocumentationCommentDiagnostics AndAlso Me._onlyDiagnosticsFromTree Is Nothing
End Get
End Property
Private ReadOnly Property [Module] As SourceModuleSymbol
Get
Return DirectCast(Me._compilation.SourceModule, SourceModuleSymbol)
End Get
End Property
Private Function GetOrCreateBinder(type As DocumentationCommentBinder.BinderType) As Binder
If Me._binders Is Nothing Then
Me._binders = New Dictionary(Of DocumentationCommentBinder.BinderType, Binder)()
End If
Dim result As Binder = Nothing
If Not Me._binders.TryGetValue(type, result) Then
Debug.Assert(Me._tree IsNot Nothing)
result = CreateDocumentationCommentBinderForSymbol(Me.Module, Me._symbol, Me._tree, type)
Me._binders.Add(type, result)
End If
Return result
End Function
''' <remarks>
''' Rewrites nodes in <paramref name="nodes"/>, which Is a snapshot of nodes from the original document.
''' We're mutating the tree as we rewrite, so it's important to grab a snapshot of the
''' nodes that we're going to reparent before we enumerate them.
''' </remarks>
Private Function RewriteMany(nodes As XNode(), currentXmlFilePath As String, originatingSyntax As XmlNodeSyntax) As XNode()
Debug.Assert(nodes IsNot Nothing)
Dim builder As ArrayBuilder(Of XNode) = Nothing
For Each child In nodes
If builder Is Nothing Then
builder = ArrayBuilder(Of XNode).GetInstance()
End If
builder.AddRange(Rewrite(child, currentXmlFilePath, originatingSyntax))
Next
' Nodes returned by this method are going to be attached to a new parent, so it's
' important that they don't already have parents. If a node with a parent is
' attached to a new parent, it is copied and its annotations are dropped.
Debug.Assert(builder Is Nothing OrElse builder.All(Function(node) node.Parent Is Nothing))
Return If(builder Is Nothing, Array.Empty(Of XNode)(), builder.ToArrayAndFree())
End Function
Private Function Rewrite(node As XNode, currentXmlFilePath As String, originatingSyntax As XmlNodeSyntax) As XNode()
Me._cancellationToken.ThrowIfCancellationRequested()
Dim commentMessage As String = Nothing
If node.NodeType = XmlNodeType.Element Then
Dim element = DirectCast(node, XElement)
If ElementNameIs(element, DocumentationCommentXmlNames.IncludeElementName) Then
Dim rewritten As XNode() = RewriteIncludeElement(element, currentXmlFilePath, originatingSyntax, commentMessage)
If rewritten IsNot Nothing Then
Return rewritten
End If
End If
End If
Dim container = TryCast(node, XContainer)
If container Is Nothing Then
Debug.Assert(commentMessage Is Nothing, "How did we get an error comment for a non-container?")
Return New XNode() {node.Copy(copyAttributeAnnotations:=True)}
End If
Dim oldNodes As IEnumerable(Of XNode) = container.Nodes
' Do this after grabbing the nodes, so we don't see copies of them.
container = container.Copy(copyAttributeAnnotations:=True)
' WARN: don't use node after this point - use container since it's already been copied.
If oldNodes IsNot Nothing Then
Dim rewritten As XNode() = RewriteMany(oldNodes.ToArray(), currentXmlFilePath, originatingSyntax)
container.ReplaceNodes(rewritten)
End If
' NOTE: we only care if we're included text - otherwise we've already processed the cref/name.
If container.NodeType = XmlNodeType.Element AndAlso originatingSyntax IsNot Nothing Then
Debug.Assert(currentXmlFilePath IsNot Nothing)
Dim element = DirectCast(container, XElement)
Dim elementName As XName = element.Name
Dim binderType As DocumentationCommentBinder.BinderType = DocumentationCommentBinder.BinderType.None
Dim elementIsException As Boolean = False ' To support WRN_XMLDocExceptionTagWithoutCRef
' Check element first for well-known names
If ElementNameIs(element, DocumentationCommentXmlNames.ExceptionElementName) Then
If Not Me._tagsSupport.ExceptionSupported Then
commentMessage = GenerateDiagnostic(XmlLocation.Create(element, currentXmlFilePath),
ERRID.WRN_XMLDocIllegalTagOnElement2,
elementName.LocalName,
Me._tagsSupport.SymbolName)
Else
elementIsException = True
End If
ElseIf ElementNameIs(element, DocumentationCommentXmlNames.ReturnsElementName) Then
If Not Me._tagsSupport.ReturnsSupported Then
' NOTE: different messages in two cases:
If Me._tagsSupport.IsDeclareMethod Then
commentMessage = GenerateDiagnostic(XmlLocation.Create(element, currentXmlFilePath), ERRID.WRN_XMLDocReturnsOnADeclareSub)
ElseIf Me._tagsSupport.IsWriteOnlyProperty Then
commentMessage = GenerateDiagnostic(XmlLocation.Create(element, currentXmlFilePath), ERRID.WRN_XMLDocReturnsOnWriteOnlyProperty)
Else
commentMessage = GenerateDiagnostic(XmlLocation.Create(element, currentXmlFilePath),
ERRID.WRN_XMLDocIllegalTagOnElement2,
elementName.LocalName,
Me._tagsSupport.SymbolName)
End If
End If
ElseIf ElementNameIs(element, DocumentationCommentXmlNames.ParameterElementName) OrElse
ElementNameIs(element, DocumentationCommentXmlNames.ParameterReferenceElementName) Then
binderType = DocumentationCommentBinder.BinderType.NameInParamOrParamRef
If Not Me._tagsSupport.ParamAndParamRefSupported Then
commentMessage = GenerateDiagnostic(XmlLocation.Create(element, currentXmlFilePath),
ERRID.WRN_XMLDocIllegalTagOnElement2,
elementName.LocalName,
Me._tagsSupport.SymbolName)
End If
ElseIf ElementNameIs(element, DocumentationCommentXmlNames.ValueElementName) Then
If Not Me._tagsSupport.ValueSupported Then
commentMessage = GenerateDiagnostic(XmlLocation.Create(element, currentXmlFilePath),
ERRID.WRN_XMLDocIllegalTagOnElement2,
elementName.LocalName,
Me._tagsSupport.SymbolName)
End If
ElseIf ElementNameIs(element, DocumentationCommentXmlNames.TypeParameterElementName) Then
binderType = DocumentationCommentBinder.BinderType.NameInTypeParam
If Not Me._tagsSupport.TypeParamSupported Then
commentMessage = GenerateDiagnostic(XmlLocation.Create(element, currentXmlFilePath),
ERRID.WRN_XMLDocIllegalTagOnElement2,
elementName.LocalName,
Me._tagsSupport.SymbolName)
End If
ElseIf ElementNameIs(element, DocumentationCommentXmlNames.TypeParameterReferenceElementName) Then
binderType = DocumentationCommentBinder.BinderType.NameInTypeParamRef
If Not Me._tagsSupport.TypeParamRefSupported Then
commentMessage = GenerateDiagnostic(XmlLocation.Create(element, currentXmlFilePath),
ERRID.WRN_XMLDocIllegalTagOnElement2,
elementName.LocalName,
Me._tagsSupport.SymbolName)
End If
End If
If commentMessage Is Nothing Then
Dim nameAttribute As XAttribute = Nothing
Dim seenCref As Boolean = False
For Each attribute In element.Attributes
If AttributeNameIs(attribute, DocumentationCommentXmlNames.CrefAttributeName) Then
' NOTE: 'cref=' errors are ignored, because the reference is marked with "?:..."
BindAndReplaceCref(attribute, currentXmlFilePath)
seenCref = True
ElseIf AttributeNameIs(attribute, DocumentationCommentXmlNames.NameAttributeName) Then
nameAttribute = attribute
End If
Next
' After processing 'special' attributes, we need to either bind 'name'
' attribute value or, if the element was 'exception', and 'cref' was not found,
' report WRN_XMLDocExceptionTagWithoutCRef
If elementIsException Then
If Not seenCref Then
commentMessage = GenerateDiagnostic(XmlLocation.Create(element, currentXmlFilePath), ERRID.WRN_XMLDocExceptionTagWithoutCRef)
End If
ElseIf binderType <> DocumentationCommentBinder.BinderType.None Then
Debug.Assert(binderType <> DocumentationCommentBinder.BinderType.Cref)
If nameAttribute Is Nothing Then
' Report missing 'name' attribute
commentMessage = GenerateDiagnostic(XmlLocation.Create(element, currentXmlFilePath),
If(binderType = DocumentationCommentBinder.BinderType.NameInParamOrParamRef,
ERRID.WRN_XMLDocParamTagWithoutName,
ERRID.WRN_XMLDocGenericParamTagWithoutName))
Else
' Bind the value of 'name' attribute
commentMessage = BindName(nameAttribute,
elementName.LocalName,
binderType,
If(binderType = DocumentationCommentBinder.BinderType.NameInParamOrParamRef, ERRID.WRN_XMLDocBadParamTag2, ERRID.WRN_XMLDocBadGenericParamTag2),
currentXmlFilePath)
End If
End If
End If
End If
If commentMessage Is Nothing Then
Return New XNode() {container}
Else
Return New XNode() {New XComment(commentMessage), container}
End If
End Function
Private Shared Function ElementNameIs(element As XElement, name As String) As Boolean
Return String.IsNullOrEmpty(element.Name.NamespaceName) AndAlso
DocumentationCommentXmlNames.ElementEquals(element.Name.LocalName, name, True)
End Function
Private Shared Function AttributeNameIs(attribute As XAttribute, name As String) As Boolean
Return String.IsNullOrEmpty(attribute.Name.NamespaceName) AndAlso
DocumentationCommentXmlNames.AttributeEquals(attribute.Name.LocalName, name)
End Function
Private Function RewriteIncludeElement(includeElement As XElement, currentXmlFilePath As String, originatingSyntax As XmlNodeSyntax, <Out> ByRef commentMessage As String) As XNode()
Dim location As location = GetIncludeElementLocation(includeElement, currentXmlFilePath, originatingSyntax)
Debug.Assert(originatingSyntax IsNot Nothing)
If Not AddIncludeElementLocation(location) Then
' NOTE: these must exist since we're already processed this node elsewhere in the call stack.
Dim fileAttr As XAttribute = includeElement.Attribute(XName.Get(DocumentationCommentXmlNames.FileAttributeName))
Dim pathAttr As XAttribute = includeElement.Attribute(XName.Get(DocumentationCommentXmlNames.PathAttributeName))
commentMessage = GenerateDiagnostic(location, ERRID.WRN_XMLDocInvalidXMLFragment, fileAttr.Value, pathAttr.Value)
' Don't inspect the children - we're already in a cycle.
Return New XNode() {New XComment(commentMessage)}
End If
Try
Dim fileAttr As XAttribute = includeElement.Attribute(XName.Get(DocumentationCommentXmlNames.FileAttributeName))
Dim pathAttr As XAttribute = includeElement.Attribute(XName.Get(DocumentationCommentXmlNames.PathAttributeName))
Dim hasFileAttribute As Boolean = fileAttr IsNot Nothing
Dim hasPathAttribute As Boolean = pathAttr IsNot Nothing
If Not hasFileAttribute OrElse Not hasPathAttribute Then
' 'file' or 'path' attribute missing
If Not hasFileAttribute Then
commentMessage = GenerateDiagnostic(location, ERRID.WRN_XMLMissingFileOrPathAttribute1, DocumentationCommentXmlNames.FileAttributeName)
End If
If Not hasPathAttribute Then
commentMessage = If(commentMessage Is Nothing, "", commentMessage & " ") &
GenerateDiagnostic(location, ERRID.WRN_XMLMissingFileOrPathAttribute1, DocumentationCommentXmlNames.PathAttributeName)
End If
Return New XNode() {New XComment(commentMessage)}
End If
Dim xpathValue As String = pathAttr.Value
Dim filePathValue As String = fileAttr.Value
Dim resolver = _compilation.Options.XmlReferenceResolver
If resolver Is Nothing Then
commentMessage = GenerateDiagnostic(True, location, ERRID.WRN_XMLDocBadFormedXML, filePathValue, xpathValue, New CodeAnalysisResourcesLocalizableErrorArgument(NameOf(CodeAnalysisResources.XmlReferencesNotSupported)))
Return New XNode() {New XComment(commentMessage)}
End If
Dim resolvedFilePath As String = resolver.ResolveReference(filePathValue, currentXmlFilePath)
If resolvedFilePath Is Nothing Then
commentMessage = GenerateDiagnostic(True, location, ERRID.WRN_XMLDocBadFormedXML, filePathValue, xpathValue, New CodeAnalysisResourcesLocalizableErrorArgument(NameOf(CodeAnalysisResources.FileNotFound)))
Return New XNode() {New XComment(commentMessage)}
End If
If _includedFileCache Is Nothing Then
_includedFileCache = New DocumentationCommentIncludeCache(_compilation.Options.XmlReferenceResolver)
End If
Try
Dim doc As XDocument
Try
doc = _includedFileCache.GetOrMakeDocument(resolvedFilePath)
Catch e As IOException
commentMessage = GenerateDiagnostic(True, location, ERRID.WRN_XMLDocBadFormedXML, filePathValue, xpathValue, e.Message)
Return New XNode() {New XComment(commentMessage)}
End Try
Debug.Assert(doc IsNot Nothing)
Dim errorMessage As String = Nothing
Dim invalidXPath As Boolean = False
Dim loadedElements As XElement() = XmlUtilities.TrySelectElements(doc, xpathValue, errorMessage, invalidXPath)
If loadedElements Is Nothing Then
commentMessage = GenerateDiagnostic(True, location, ERRID.WRN_XMLDocInvalidXMLFragment, xpathValue, filePathValue)
Return New XNode() {New XComment(commentMessage)}
End If
If loadedElements IsNot Nothing AndAlso loadedElements.Length > 0 Then
' change the current XML file path for nodes contained in the document
Dim result As XNode() = RewriteMany(loadedElements, resolvedFilePath, originatingSyntax)
' The elements could be rewritten away if they are includes that refer to invalid
' (but existing and accessible) XML files. If this occurs, behave as if we
' had failed to find any XPath results.
If result.Length > 0 Then
' NOTE: in this case, we do NOT visit the children of the include element -
' they are dropped.
commentMessage = Nothing
Return result
End If
End If
' Nothing was found
commentMessage = GenerateDiagnostic(True, location, ERRID.WRN_XMLDocInvalidXMLFragment, xpathValue, filePathValue)
Return New XNode() {New XComment(commentMessage)}
Catch ex As XmlException
commentMessage = GenerateDiagnostic(True, location, ERRID.WRN_XMLDocInvalidXMLFragment, xpathValue, filePathValue)
Return New XNode() {New XComment(commentMessage)}
End Try
Finally
RemoveIncludeElementLocation(location)
End Try
End Function
Private Function ShouldProcessLocation(loc As Location) As Boolean
Return Me._onlyDiagnosticsFromTree Is Nothing OrElse
loc.Kind = LocationKind.SourceFile AndAlso DirectCast(loc, SourceLocation).SourceTree Is Me._onlyDiagnosticsFromTree AndAlso
(Not Me._filterSpanWithinTree.HasValue OrElse Me._filterSpanWithinTree.Value.Contains(loc.SourceSpan))
End Function
Private Function GenerateDiagnostic(suppressDiagnostic As Boolean, loc As Location, id As ERRID, ParamArray arguments As Object()) As String
Dim info As DiagnosticInfo = ErrorFactory.ErrorInfo(id, arguments)
If Not suppressDiagnostic AndAlso Me.ProduceDiagnostics AndAlso ShouldProcessLocation(loc) Then
Me._diagnostics.Add(New VBDiagnostic(info, loc))
End If
Return info.ToString()
End Function
Private Function GenerateDiagnostic(loc As Location, id As ERRID, ParamArray arguments As Object()) As String
Return GenerateDiagnostic(False, loc, id, arguments)
End Function
Private Function AddIncludeElementLocation(location As Location) As Boolean
If Me._inProgressIncludeElementNodes Is Nothing Then
Me._inProgressIncludeElementNodes = New HashSet(Of location)()
End If
Return Me._inProgressIncludeElementNodes.Add(location)
End Function
Private Function RemoveIncludeElementLocation(location As Location) As Boolean
Debug.Assert(Me._inProgressIncludeElementNodes IsNot Nothing)
Dim result As Boolean = Me._inProgressIncludeElementNodes.Remove(location)
Debug.Assert(result)
Return result
End Function
Private Function GetIncludeElementLocation(includeElement As XElement, ByRef currentXmlFilePath As String, ByRef originatingSyntax As XmlNodeSyntax) As Location
Dim location As location = includeElement.Annotation(Of location)()
If location IsNot Nothing Then
Return location
End If
' If we are not in an XML file, then we must be in a source file. Since we're traversing the XML tree in the same
' order as the DocumentationCommentWalker, we can access the elements of includeElementNodes in order.
If currentXmlFilePath Is Nothing Then
Debug.Assert(_nextSourceIncludeElementIndex < _sourceIncludeElementNodes.Count)
Debug.Assert(originatingSyntax Is Nothing)
originatingSyntax = _sourceIncludeElementNodes(_nextSourceIncludeElementIndex)
location = originatingSyntax.GetLocation()
Me._nextSourceIncludeElementIndex += 1
includeElement.AddAnnotation(location)
currentXmlFilePath = location.GetLineSpan().Path
Else
location = XmlLocation.Create(includeElement, currentXmlFilePath)
End If
Debug.Assert(location IsNot Nothing)
Return location
End Function
Private Sub BindAndReplaceCref(attribute As XAttribute, currentXmlFilePath As String)
Debug.Assert(currentXmlFilePath IsNot Nothing)
Dim attributeText As String = attribute.ToString()
' note, the parent element name does not matter
Dim attr As BaseXmlAttributeSyntax = SyntaxFactory.ParseDocCommentAttributeAsStandAloneEntity(attributeText, parentElementName:="")
' NOTE: we don't expect any *syntax* errors on the parsed xml
' attribute, or otherwise why xml parsed didn't throw?
Debug.Assert(attr IsNot Nothing)
Select Case attr.Kind
Case SyntaxKind.XmlCrefAttribute
Dim binder As binder = Me.GetOrCreateBinder(DocumentationCommentBinder.BinderType.Cref)
Dim reference As CrefReferenceSyntax = DirectCast(attr, XmlCrefAttributeSyntax).Reference
Dim useSiteInfo = binder.GetNewCompoundUseSiteInfo(_diagnostics)
Dim diagnostics = BindingDiagnosticBag.GetInstance(_diagnostics)
Dim bindResult As ImmutableArray(Of Symbol) = binder.BindInsideCrefAttributeValue(reference, preserveAliases:=False,
diagnosticBag:=diagnostics, useSiteInfo:=useSiteInfo)
_diagnostics.AddDependencies(diagnostics)
_diagnostics.AddDependencies(useSiteInfo)
Dim errorLocations = diagnostics.DiagnosticBag.ToReadOnly().SelectAsArray(Function(x) x.Location).WhereAsArray(Function(x) x IsNot Nothing)
diagnostics.Free()
If Me.ProduceXmlDiagnostics AndAlso Not useSiteInfo.Diagnostics.IsNullOrEmpty Then
ProcessErrorLocations(XmlLocation.Create(attribute, currentXmlFilePath), Nothing, useSiteInfo, errorLocations, Nothing)
End If
If bindResult.IsDefaultOrEmpty Then
If Me.ProduceXmlDiagnostics Then
ProcessErrorLocations(XmlLocation.Create(attribute, currentXmlFilePath), reference.ToFullString().TrimEnd(), useSiteInfo, errorLocations, ERRID.WRN_XMLDocCrefAttributeNotFound1)
End If
attribute.Value = "?:" + attribute.Value
Else
' The following mimics handling 'cref' attributes in source documentation
' comment, see DocumentationCommentWalker for details
' Some symbols found may not support doc-comment-ids, we just filter
' those out, from the rest we take the symbol with 'smallest' location
Dim symbolCommentId As String = Nothing
Dim smallestSymbol As Symbol = Nothing
Dim errid As ERRID = errid.WRN_XMLDocCrefAttributeNotFound1
For Each symbol In bindResult
If symbol.Kind = SymbolKind.TypeParameter Then
errid = errid.WRN_XMLDocCrefToTypeParameter
Continue For
End If
Dim id As String = symbol.OriginalDefinition.GetDocumentationCommentId()
If id IsNot Nothing Then
' Override only if this is the first id or the new symbol's location wins;
' note that we want to ignore the cases when there are more than one symbol
' can be found by the name, just deterministically choose which one to use
If symbolCommentId Is Nothing OrElse
Me._compilation.CompareSourceLocations(
smallestSymbol.Locations(0), symbol.Locations(0)) > 0 Then
symbolCommentId = id
smallestSymbol = symbol
End If
End If
Next
If symbolCommentId Is Nothing Then
If Me.ProduceXmlDiagnostics Then
ProcessErrorLocations(XmlLocation.Create(attribute, currentXmlFilePath), reference.ToString(), Nothing, errorLocations, errid)
End If
attribute.Value = "?:" + attribute.Value
Else
' Replace value with id
attribute.Value = symbolCommentId
_diagnostics.AddAssembliesUsedByCrefTarget(smallestSymbol.OriginalDefinition)
End If
End If
Case SyntaxKind.XmlAttribute
' 'cref=' attribute can land here for two reasons:
' (a) the value is represented in a form "X:SOME-ID-STRING", or
' (b) the value between '"' is not a valid NameSyntax
'
' in both cases we want just to put the result into documentation XML.
'
' In the second case we also generate a diagnostic and add '!:' in from
' of the value indicating wrong id, and generate a diagnostic
Dim value As String = attribute.Value.Trim()
If value.Length < 2 OrElse value(0) = ":"c OrElse value(1) <> ":"c Then
' Case (b) from above
If Me.ProduceXmlDiagnostics Then
Me._diagnostics.Add(ERRID.WRN_XMLDocCrefAttributeNotFound1, XmlLocation.Create(attribute, currentXmlFilePath), value)
End If
attribute.Value = "?:" + value
End If
Case Else
Throw ExceptionUtilities.UnexpectedValue(attr.Kind)
End Select
End Sub
Private Sub ProcessErrorLocations(currentXmlLocation As XmlLocation, referenceName As String, useSiteInfo As CompoundUseSiteInfo(Of AssemblySymbol), errorLocations As ImmutableArray(Of Location), errid As Nullable(Of ERRID))
If errorLocations.Length = 0 Then
If useSiteInfo.Diagnostics IsNot Nothing Then
Me._diagnostics.AddDiagnostics(currentXmlLocation, useSiteInfo)
ElseIf errid.HasValue Then
Me._diagnostics.Add(errid.Value, currentXmlLocation, referenceName)
End If
ElseIf errid.HasValue Then
For Each location In errorLocations
Me._diagnostics.Add(errid.Value, location, referenceName)
Next
Else
For Each location In errorLocations
Me._diagnostics.AddDiagnostics(location, useSiteInfo)
Next
End If
End Sub
Private Function BindName(attribute As XAttribute,
elementName As String,
type As DocumentationCommentBinder.BinderType,
badNameValueError As ERRID,
currentXmlFilePath As String) As String
Debug.Assert(type = DocumentationCommentBinder.BinderType.NameInParamOrParamRef OrElse
type = DocumentationCommentBinder.BinderType.NameInTypeParamRef OrElse
type = DocumentationCommentBinder.BinderType.NameInTypeParam)
Debug.Assert(currentXmlFilePath IsNot Nothing)
Dim commentMessage As String = Nothing
Dim attributeText As String = attribute.ToString()
Dim attributeValue As String = attribute.Value.Trim()
Dim attr As BaseXmlAttributeSyntax =
SyntaxFactory.ParseDocCommentAttributeAsStandAloneEntity(
attributeText, elementName) ' note, the element name does not matter
' NOTE: we don't expect any *syntax* errors on the parsed xml
' attribute, or otherwise why xml parsed didn't throw?
Debug.Assert(attr IsNot Nothing)
Debug.Assert(Not attr.ContainsDiagnostics)
Select Case attr.Kind
Case SyntaxKind.XmlNameAttribute
Dim binder As binder = Me.GetOrCreateBinder(type)
Dim identifier As IdentifierNameSyntax = DirectCast(attr, XmlNameAttributeSyntax).Reference
Dim useSiteInfo = binder.GetNewCompoundUseSiteInfo(Me._diagnostics)
Dim bindResult As ImmutableArray(Of Symbol) = binder.BindXmlNameAttributeValue(identifier, useSiteInfo)
Me._diagnostics.AddDependencies(useSiteInfo)
If Me.ProduceDiagnostics AndAlso Not useSiteInfo.Diagnostics.IsNullOrEmpty Then
Dim loc As Location = XmlLocation.Create(attribute, currentXmlFilePath)
If ShouldProcessLocation(loc) Then
Me._diagnostics.AddDiagnostics(loc, useSiteInfo)
End If
End If
If bindResult.IsDefaultOrEmpty Then
commentMessage = GenerateDiagnostic(XmlLocation.Create(attribute, currentXmlFilePath), badNameValueError, attributeValue, Me._tagsSupport.SymbolName)
End If
Case SyntaxKind.XmlAttribute
' 'name=' attribute can get here if parsing of identifier went wrong, we need to generate a diagnostic
commentMessage = GenerateDiagnostic(XmlLocation.Create(attribute, currentXmlFilePath), badNameValueError, attributeValue, Me._tagsSupport.SymbolName)
Case Else
Throw ExceptionUtilities.UnexpectedValue(attr.Kind)
End Select
Return commentMessage
End Function
End Class
End Class
End Class
End Namespace
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Compilers/Core/Portable/Syntax/LineMapping.cs | // 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.Text;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis
{
/// <summary>
/// Represents a line mapping defined by a single line mapping directive (<c>#line</c> in C# or <c>#ExternalSource</c> in VB).
/// </summary>
public readonly struct LineMapping : IEquatable<LineMapping>
{
/// <summary>
/// The span in the syntax tree containing the line mapping directive.
/// </summary>
public readonly LinePositionSpan Span { get; }
/// <summary>
/// The optional offset in the syntax tree for the line immediately following an enhanced <c>#line</c> directive in C#.
/// </summary>
public readonly int? CharacterOffset { get; }
/// <summary>
/// If the line mapping directive maps the span into an explicitly specified file the <see cref="FileLinePositionSpan.HasMappedPath"/> is true.
/// If the path is not mapped <see cref="FileLinePositionSpan.Path"/> is empty and <see cref="FileLinePositionSpan.HasMappedPath"/> is false.
/// If the line mapping directive marks hidden code <see cref="FileLinePositionSpan.IsValid"/> is false.
/// </summary>
public readonly FileLinePositionSpan MappedSpan { get; }
public LineMapping(LinePositionSpan span, int? characterOffset, FileLinePositionSpan mappedSpan)
{
Span = span;
CharacterOffset = characterOffset;
MappedSpan = mappedSpan;
}
/// <summary>
/// True if the line mapping marks hidden code.
/// </summary>
public bool IsHidden
=> !MappedSpan.IsValid;
public override bool Equals(object? obj)
=> obj is LineMapping other && Equals(other);
public bool Equals(LineMapping other)
=> Span.Equals(other.Span) && CharacterOffset.Equals(other.CharacterOffset) && MappedSpan.Equals(other.MappedSpan);
public override int GetHashCode()
=> Hash.Combine(Hash.Combine(Span.GetHashCode(), CharacterOffset.GetHashCode()), MappedSpan.GetHashCode());
public static bool operator ==(LineMapping left, LineMapping right)
=> left.Equals(right);
public static bool operator !=(LineMapping left, LineMapping right)
=> !(left == right);
public override string? ToString()
{
var builder = new StringBuilder();
builder.Append(Span);
if (CharacterOffset.HasValue)
{
builder.Append(",");
builder.Append(CharacterOffset.GetValueOrDefault());
}
builder.Append(" -> ");
builder.Append(MappedSpan);
return builder.ToString();
}
}
}
| // 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.Text;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis
{
/// <summary>
/// Represents a line mapping defined by a single line mapping directive (<c>#line</c> in C# or <c>#ExternalSource</c> in VB).
/// </summary>
public readonly struct LineMapping : IEquatable<LineMapping>
{
/// <summary>
/// The span in the syntax tree containing the line mapping directive.
/// </summary>
public readonly LinePositionSpan Span { get; }
/// <summary>
/// The optional offset in the syntax tree for the line immediately following an enhanced <c>#line</c> directive in C#.
/// </summary>
public readonly int? CharacterOffset { get; }
/// <summary>
/// If the line mapping directive maps the span into an explicitly specified file the <see cref="FileLinePositionSpan.HasMappedPath"/> is true.
/// If the path is not mapped <see cref="FileLinePositionSpan.Path"/> is empty and <see cref="FileLinePositionSpan.HasMappedPath"/> is false.
/// If the line mapping directive marks hidden code <see cref="FileLinePositionSpan.IsValid"/> is false.
/// </summary>
public readonly FileLinePositionSpan MappedSpan { get; }
public LineMapping(LinePositionSpan span, int? characterOffset, FileLinePositionSpan mappedSpan)
{
Span = span;
CharacterOffset = characterOffset;
MappedSpan = mappedSpan;
}
/// <summary>
/// True if the line mapping marks hidden code.
/// </summary>
public bool IsHidden
=> !MappedSpan.IsValid;
public override bool Equals(object? obj)
=> obj is LineMapping other && Equals(other);
public bool Equals(LineMapping other)
=> Span.Equals(other.Span) && CharacterOffset.Equals(other.CharacterOffset) && MappedSpan.Equals(other.MappedSpan);
public override int GetHashCode()
=> Hash.Combine(Hash.Combine(Span.GetHashCode(), CharacterOffset.GetHashCode()), MappedSpan.GetHashCode());
public static bool operator ==(LineMapping left, LineMapping right)
=> left.Equals(right);
public static bool operator !=(LineMapping left, LineMapping right)
=> !(left == right);
public override string? ToString()
{
var builder = new StringBuilder();
builder.Append(Span);
if (CharacterOffset.HasValue)
{
builder.Append(",");
builder.Append(CharacterOffset.GetValueOrDefault());
}
builder.Append(" -> ");
builder.Append(MappedSpan);
return builder.ToString();
}
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/EditorFeatures/Core/Implementation/IntelliSense/IController.cs | // 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.
#nullable disable
using System.Runtime.CompilerServices;
using Microsoft.CodeAnalysis.Shared.TestHooks;
namespace Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense
{
internal interface IController<TModel>
{
void OnModelUpdated(TModel result, bool updateController);
IAsyncToken BeginAsyncOperation(string name = "", object tag = null, [CallerFilePath] string filePath = "", [CallerLineNumber] int lineNumber = 0);
void StopModelComputation();
}
}
| // 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.
#nullable disable
using System.Runtime.CompilerServices;
using Microsoft.CodeAnalysis.Shared.TestHooks;
namespace Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense
{
internal interface IController<TModel>
{
void OnModelUpdated(TModel result, bool updateController);
IAsyncToken BeginAsyncOperation(string name = "", object tag = null, [CallerFilePath] string filePath = "", [CallerLineNumber] int lineNumber = 0);
void StopModelComputation();
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Utilities/UsingsAndExternAliasesOrganizer.cs | // 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.Collections.Generic;
using System.Linq;
using Microsoft.CodeAnalysis.CSharp.Extensions;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.CSharp.Utilities
{
internal static partial class UsingsAndExternAliasesOrganizer
{
private static readonly SyntaxTrivia s_newLine = SyntaxFactory.CarriageReturnLineFeed;
public static void Organize(
SyntaxList<ExternAliasDirectiveSyntax> externAliasList,
SyntaxList<UsingDirectiveSyntax> usingList,
bool placeSystemNamespaceFirst, bool separateGroups,
out SyntaxList<ExternAliasDirectiveSyntax> organizedExternAliasList,
out SyntaxList<UsingDirectiveSyntax> organizedUsingList)
{
OrganizeWorker(
externAliasList, usingList, placeSystemNamespaceFirst,
out organizedExternAliasList, out organizedUsingList);
if (separateGroups)
{
if (organizedExternAliasList.Count > 0 && organizedUsingList.Count > 0)
{
var firstUsing = organizedUsingList[0];
if (!firstUsing.GetLeadingTrivia().Any(t => t.IsEndOfLine()))
{
var newFirstUsing = firstUsing.WithPrependedLeadingTrivia(s_newLine);
organizedUsingList = organizedUsingList.Replace(firstUsing, newFirstUsing);
}
}
for (var i = 1; i < organizedUsingList.Count; i++)
{
var lastUsing = organizedUsingList[i - 1];
var currentUsing = organizedUsingList[i];
if (NeedsGrouping(lastUsing, currentUsing) &&
!currentUsing.GetLeadingTrivia().Any(t => t.IsEndOfLine()))
{
var newCurrentUsing = currentUsing.WithPrependedLeadingTrivia(s_newLine);
organizedUsingList = organizedUsingList.Replace(currentUsing, newCurrentUsing);
}
}
}
}
public static bool NeedsGrouping(
UsingDirectiveSyntax using1,
UsingDirectiveSyntax using2)
{
var directive1IsUsingStatic = using1.StaticKeyword.IsKind(SyntaxKind.StaticKeyword);
var directive2IsUsingStatic = using2.StaticKeyword.IsKind(SyntaxKind.StaticKeyword);
var directive1IsAlias = using1.Alias != null;
var directive2IsAlias = using2.Alias != null;
var directive1IsNamespace = !directive1IsUsingStatic && !directive1IsAlias;
var directive2IsNamespace = !directive2IsUsingStatic && !directive2IsAlias;
if (directive1IsAlias && directive2IsAlias)
{
return false;
}
if (directive1IsUsingStatic && directive2IsUsingStatic)
{
return false;
}
if (directive1IsNamespace && directive2IsNamespace)
{
// Both normal usings. Place them in groups if their first namespace
// component differs.
var name1 = using1.Name.GetFirstToken().ValueText;
var name2 = using2.Name.GetFirstToken().ValueText;
return name1 != name2;
}
// They have different types, definitely put them into new groups.
return true;
}
private static void OrganizeWorker(
SyntaxList<ExternAliasDirectiveSyntax> externAliasList,
SyntaxList<UsingDirectiveSyntax> usingList,
bool placeSystemNamespaceFirst,
out SyntaxList<ExternAliasDirectiveSyntax> organizedExternAliasList,
out SyntaxList<UsingDirectiveSyntax> organizedUsingList)
{
if (externAliasList.Count > 0 || usingList.Count > 0)
{
// Merge the list of usings and externs into one list.
// order them in the order that they were originally in the
// file.
var initialList = usingList.Cast<SyntaxNode>()
.Concat(externAliasList)
.OrderBy(n => n.SpanStart).ToList();
if (!initialList.SpansPreprocessorDirective())
{
// If there is a banner comment that precedes the nodes,
// then remove it and store it for later.
initialList[0] = initialList[0].GetNodeWithoutLeadingBannerAndPreprocessorDirectives(out var leadingTrivia);
var comparer = placeSystemNamespaceFirst
? UsingsAndExternAliasesDirectiveComparer.SystemFirstInstance
: UsingsAndExternAliasesDirectiveComparer.NormalInstance;
var finalList = initialList.OrderBy(comparer).ToList();
// Check if sorting the list actually changed anything. If not, then we don't
// need to make any changes to the file.
if (!finalList.SequenceEqual(initialList))
{
// Make sure newlines are correct between nodes.
EnsureNewLines(finalList);
// Reattach the banner.
finalList[0] = finalList[0].WithPrependedLeadingTrivia(leadingTrivia);
// Now split out the externs and usings back into two separate lists.
organizedExternAliasList = finalList.Where(t => t is ExternAliasDirectiveSyntax)
.Cast<ExternAliasDirectiveSyntax>()
.ToSyntaxList();
organizedUsingList = finalList.Where(t => t is UsingDirectiveSyntax)
.Cast<UsingDirectiveSyntax>()
.ToSyntaxList();
return;
}
}
}
organizedExternAliasList = externAliasList;
organizedUsingList = usingList;
}
private static void EnsureNewLines(IList<SyntaxNode> list)
{
// First, make sure that every node (except the last one) ends with
// a newline.
for (var i = 0; i < list.Count - 1; i++)
{
var node = list[i];
var trailingTrivia = node.GetTrailingTrivia();
if (!trailingTrivia.Any() || trailingTrivia.Last().Kind() != SyntaxKind.EndOfLineTrivia)
{
list[i] = node.WithTrailingTrivia(trailingTrivia.Concat(s_newLine));
}
}
// Now, make sure that every node (except the first one) does *not*
// start with newlines.
for (var i = 1; i < list.Count; i++)
{
var node = list[i];
list[i] = TrimLeadingNewLines(node);
}
list[0] = TrimLeadingNewLines(list[0]);
}
private static SyntaxNode TrimLeadingNewLines(SyntaxNode node)
=> node.WithLeadingTrivia(node.GetLeadingTrivia().SkipWhile(t => t.Kind() == SyntaxKind.EndOfLineTrivia));
}
}
| // 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.Collections.Generic;
using System.Linq;
using Microsoft.CodeAnalysis.CSharp.Extensions;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.CSharp.Utilities
{
internal static partial class UsingsAndExternAliasesOrganizer
{
private static readonly SyntaxTrivia s_newLine = SyntaxFactory.CarriageReturnLineFeed;
public static void Organize(
SyntaxList<ExternAliasDirectiveSyntax> externAliasList,
SyntaxList<UsingDirectiveSyntax> usingList,
bool placeSystemNamespaceFirst, bool separateGroups,
out SyntaxList<ExternAliasDirectiveSyntax> organizedExternAliasList,
out SyntaxList<UsingDirectiveSyntax> organizedUsingList)
{
OrganizeWorker(
externAliasList, usingList, placeSystemNamespaceFirst,
out organizedExternAliasList, out organizedUsingList);
if (separateGroups)
{
if (organizedExternAliasList.Count > 0 && organizedUsingList.Count > 0)
{
var firstUsing = organizedUsingList[0];
if (!firstUsing.GetLeadingTrivia().Any(t => t.IsEndOfLine()))
{
var newFirstUsing = firstUsing.WithPrependedLeadingTrivia(s_newLine);
organizedUsingList = organizedUsingList.Replace(firstUsing, newFirstUsing);
}
}
for (var i = 1; i < organizedUsingList.Count; i++)
{
var lastUsing = organizedUsingList[i - 1];
var currentUsing = organizedUsingList[i];
if (NeedsGrouping(lastUsing, currentUsing) &&
!currentUsing.GetLeadingTrivia().Any(t => t.IsEndOfLine()))
{
var newCurrentUsing = currentUsing.WithPrependedLeadingTrivia(s_newLine);
organizedUsingList = organizedUsingList.Replace(currentUsing, newCurrentUsing);
}
}
}
}
public static bool NeedsGrouping(
UsingDirectiveSyntax using1,
UsingDirectiveSyntax using2)
{
var directive1IsUsingStatic = using1.StaticKeyword.IsKind(SyntaxKind.StaticKeyword);
var directive2IsUsingStatic = using2.StaticKeyword.IsKind(SyntaxKind.StaticKeyword);
var directive1IsAlias = using1.Alias != null;
var directive2IsAlias = using2.Alias != null;
var directive1IsNamespace = !directive1IsUsingStatic && !directive1IsAlias;
var directive2IsNamespace = !directive2IsUsingStatic && !directive2IsAlias;
if (directive1IsAlias && directive2IsAlias)
{
return false;
}
if (directive1IsUsingStatic && directive2IsUsingStatic)
{
return false;
}
if (directive1IsNamespace && directive2IsNamespace)
{
// Both normal usings. Place them in groups if their first namespace
// component differs.
var name1 = using1.Name.GetFirstToken().ValueText;
var name2 = using2.Name.GetFirstToken().ValueText;
return name1 != name2;
}
// They have different types, definitely put them into new groups.
return true;
}
private static void OrganizeWorker(
SyntaxList<ExternAliasDirectiveSyntax> externAliasList,
SyntaxList<UsingDirectiveSyntax> usingList,
bool placeSystemNamespaceFirst,
out SyntaxList<ExternAliasDirectiveSyntax> organizedExternAliasList,
out SyntaxList<UsingDirectiveSyntax> organizedUsingList)
{
if (externAliasList.Count > 0 || usingList.Count > 0)
{
// Merge the list of usings and externs into one list.
// order them in the order that they were originally in the
// file.
var initialList = usingList.Cast<SyntaxNode>()
.Concat(externAliasList)
.OrderBy(n => n.SpanStart).ToList();
if (!initialList.SpansPreprocessorDirective())
{
// If there is a banner comment that precedes the nodes,
// then remove it and store it for later.
initialList[0] = initialList[0].GetNodeWithoutLeadingBannerAndPreprocessorDirectives(out var leadingTrivia);
var comparer = placeSystemNamespaceFirst
? UsingsAndExternAliasesDirectiveComparer.SystemFirstInstance
: UsingsAndExternAliasesDirectiveComparer.NormalInstance;
var finalList = initialList.OrderBy(comparer).ToList();
// Check if sorting the list actually changed anything. If not, then we don't
// need to make any changes to the file.
if (!finalList.SequenceEqual(initialList))
{
// Make sure newlines are correct between nodes.
EnsureNewLines(finalList);
// Reattach the banner.
finalList[0] = finalList[0].WithPrependedLeadingTrivia(leadingTrivia);
// Now split out the externs and usings back into two separate lists.
organizedExternAliasList = finalList.Where(t => t is ExternAliasDirectiveSyntax)
.Cast<ExternAliasDirectiveSyntax>()
.ToSyntaxList();
organizedUsingList = finalList.Where(t => t is UsingDirectiveSyntax)
.Cast<UsingDirectiveSyntax>()
.ToSyntaxList();
return;
}
}
}
organizedExternAliasList = externAliasList;
organizedUsingList = usingList;
}
private static void EnsureNewLines(IList<SyntaxNode> list)
{
// First, make sure that every node (except the last one) ends with
// a newline.
for (var i = 0; i < list.Count - 1; i++)
{
var node = list[i];
var trailingTrivia = node.GetTrailingTrivia();
if (!trailingTrivia.Any() || trailingTrivia.Last().Kind() != SyntaxKind.EndOfLineTrivia)
{
list[i] = node.WithTrailingTrivia(trailingTrivia.Concat(s_newLine));
}
}
// Now, make sure that every node (except the first one) does *not*
// start with newlines.
for (var i = 1; i < list.Count; i++)
{
var node = list[i];
list[i] = TrimLeadingNewLines(node);
}
list[0] = TrimLeadingNewLines(list[0]);
}
private static SyntaxNode TrimLeadingNewLines(SyntaxNode node)
=> node.WithLeadingTrivia(node.GetLeadingTrivia().SkipWhile(t => t.Kind() == SyntaxKind.EndOfLineTrivia));
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Features/CSharp/Portable/CodeFixes/Iterator/CSharpChangeToIEnumerableCodeFixProvider.cs | // 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.
#nullable disable
using System.Collections;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Composition;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeActions;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.CodeFixes.Iterator;
using Microsoft.CodeAnalysis.CSharp.Extensions;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.CSharp.CodeFixes.Iterator
{
[ExportCodeFixProvider(LanguageNames.CSharp, Name = PredefinedCodeFixProviderNames.ChangeReturnType), Shared]
internal class CSharpChangeToIEnumerableCodeFixProvider : AbstractIteratorCodeFixProvider
{
/// <summary>
/// CS1624: The body of 'x' cannot be an iterator block because 'y' is not an iterator interface type
/// </summary>
private const string CS1624 = nameof(CS1624);
[ImportingConstructor]
[SuppressMessage("RoslynDiagnosticsReliability", "RS0033:Importing constructor should be [Obsolete]", Justification = "Used in test code: https://github.com/dotnet/roslyn/issues/42814")]
public CSharpChangeToIEnumerableCodeFixProvider()
{
}
public override ImmutableArray<string> FixableDiagnosticIds
{
get { return ImmutableArray.Create(CS1624); }
}
protected override async Task<CodeAction> GetCodeFixAsync(SyntaxNode root, SyntaxNode node, Document document, Diagnostic diagnostics, CancellationToken cancellationToken)
{
var model = await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false);
var methodSymbol = model.GetDeclaredSymbol(node, cancellationToken) as IMethodSymbol;
// IMethod symbol can either be a regular method or an accessor
if (methodSymbol?.ReturnType == null || methodSymbol.ReturnsVoid)
{
return null;
}
var type = methodSymbol.ReturnType;
if (!TryGetIEnumerableSymbols(model, out var ienumerableSymbol, out var ienumerableGenericSymbol))
{
return null;
}
if (type.InheritsFromOrEquals(ienumerableSymbol, includeInterfaces: true))
{
var arity = type.GetArity();
if (arity == 1)
{
var typeArg = type.GetTypeArguments().First();
ienumerableGenericSymbol = ienumerableGenericSymbol.Construct(typeArg);
}
else if (arity == 0 && type is IArrayTypeSymbol)
{
ienumerableGenericSymbol = ienumerableGenericSymbol.Construct((type as IArrayTypeSymbol).ElementType);
}
else
{
return null;
}
}
else
{
ienumerableGenericSymbol = ienumerableGenericSymbol.Construct(type);
}
var newReturnType = ienumerableGenericSymbol.GenerateTypeSyntax();
Document newDocument = null;
var newMethodDeclarationSyntax = (node as MethodDeclarationSyntax)?.WithReturnType(newReturnType);
if (newMethodDeclarationSyntax != null)
{
newDocument = document.WithSyntaxRoot(root.ReplaceNode(node, newMethodDeclarationSyntax));
}
var newOperator = (node as OperatorDeclarationSyntax)?.WithReturnType(newReturnType);
if (newOperator != null)
{
newDocument = document.WithSyntaxRoot(root.ReplaceNode(node, newOperator));
}
var oldAccessor = (node?.Parent?.Parent as PropertyDeclarationSyntax);
if (oldAccessor != null)
{
newDocument = document.WithSyntaxRoot(root.ReplaceNode(oldAccessor, oldAccessor.WithType(newReturnType)));
}
var oldIndexer = (node?.Parent?.Parent as IndexerDeclarationSyntax);
if (oldIndexer != null)
{
newDocument = document.WithSyntaxRoot(root.ReplaceNode(oldIndexer, oldIndexer.WithType(newReturnType)));
}
if (newDocument == null)
{
return null;
}
return new MyCodeAction(
string.Format(CSharpFeaturesResources.Change_return_type_from_0_to_1,
type.ToMinimalDisplayString(model, node.SpanStart),
ienumerableGenericSymbol.ToMinimalDisplayString(model, node.SpanStart)), newDocument);
}
private static bool TryGetIEnumerableSymbols(SemanticModel model, out INamedTypeSymbol ienumerableSymbol, out INamedTypeSymbol ienumerableGenericSymbol)
{
ienumerableSymbol = model.Compilation.GetTypeByMetadataName(typeof(IEnumerable).FullName);
ienumerableGenericSymbol = model.Compilation.GetTypeByMetadataName(typeof(IEnumerable<>).FullName);
if (ienumerableGenericSymbol == null ||
ienumerableSymbol == null)
{
return false;
}
return true;
}
private class MyCodeAction : CodeAction.DocumentChangeAction
{
public MyCodeAction(string title, Document newDocument)
: base(title, c => Task.FromResult(newDocument), title)
{
}
}
}
}
| // 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.
#nullable disable
using System.Collections;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Composition;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeActions;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.CodeFixes.Iterator;
using Microsoft.CodeAnalysis.CSharp.Extensions;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.CSharp.CodeFixes.Iterator
{
[ExportCodeFixProvider(LanguageNames.CSharp, Name = PredefinedCodeFixProviderNames.ChangeReturnType), Shared]
internal class CSharpChangeToIEnumerableCodeFixProvider : AbstractIteratorCodeFixProvider
{
/// <summary>
/// CS1624: The body of 'x' cannot be an iterator block because 'y' is not an iterator interface type
/// </summary>
private const string CS1624 = nameof(CS1624);
[ImportingConstructor]
[SuppressMessage("RoslynDiagnosticsReliability", "RS0033:Importing constructor should be [Obsolete]", Justification = "Used in test code: https://github.com/dotnet/roslyn/issues/42814")]
public CSharpChangeToIEnumerableCodeFixProvider()
{
}
public override ImmutableArray<string> FixableDiagnosticIds
{
get { return ImmutableArray.Create(CS1624); }
}
protected override async Task<CodeAction> GetCodeFixAsync(SyntaxNode root, SyntaxNode node, Document document, Diagnostic diagnostics, CancellationToken cancellationToken)
{
var model = await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false);
var methodSymbol = model.GetDeclaredSymbol(node, cancellationToken) as IMethodSymbol;
// IMethod symbol can either be a regular method or an accessor
if (methodSymbol?.ReturnType == null || methodSymbol.ReturnsVoid)
{
return null;
}
var type = methodSymbol.ReturnType;
if (!TryGetIEnumerableSymbols(model, out var ienumerableSymbol, out var ienumerableGenericSymbol))
{
return null;
}
if (type.InheritsFromOrEquals(ienumerableSymbol, includeInterfaces: true))
{
var arity = type.GetArity();
if (arity == 1)
{
var typeArg = type.GetTypeArguments().First();
ienumerableGenericSymbol = ienumerableGenericSymbol.Construct(typeArg);
}
else if (arity == 0 && type is IArrayTypeSymbol)
{
ienumerableGenericSymbol = ienumerableGenericSymbol.Construct((type as IArrayTypeSymbol).ElementType);
}
else
{
return null;
}
}
else
{
ienumerableGenericSymbol = ienumerableGenericSymbol.Construct(type);
}
var newReturnType = ienumerableGenericSymbol.GenerateTypeSyntax();
Document newDocument = null;
var newMethodDeclarationSyntax = (node as MethodDeclarationSyntax)?.WithReturnType(newReturnType);
if (newMethodDeclarationSyntax != null)
{
newDocument = document.WithSyntaxRoot(root.ReplaceNode(node, newMethodDeclarationSyntax));
}
var newOperator = (node as OperatorDeclarationSyntax)?.WithReturnType(newReturnType);
if (newOperator != null)
{
newDocument = document.WithSyntaxRoot(root.ReplaceNode(node, newOperator));
}
var oldAccessor = (node?.Parent?.Parent as PropertyDeclarationSyntax);
if (oldAccessor != null)
{
newDocument = document.WithSyntaxRoot(root.ReplaceNode(oldAccessor, oldAccessor.WithType(newReturnType)));
}
var oldIndexer = (node?.Parent?.Parent as IndexerDeclarationSyntax);
if (oldIndexer != null)
{
newDocument = document.WithSyntaxRoot(root.ReplaceNode(oldIndexer, oldIndexer.WithType(newReturnType)));
}
if (newDocument == null)
{
return null;
}
return new MyCodeAction(
string.Format(CSharpFeaturesResources.Change_return_type_from_0_to_1,
type.ToMinimalDisplayString(model, node.SpanStart),
ienumerableGenericSymbol.ToMinimalDisplayString(model, node.SpanStart)), newDocument);
}
private static bool TryGetIEnumerableSymbols(SemanticModel model, out INamedTypeSymbol ienumerableSymbol, out INamedTypeSymbol ienumerableGenericSymbol)
{
ienumerableSymbol = model.Compilation.GetTypeByMetadataName(typeof(IEnumerable).FullName);
ienumerableGenericSymbol = model.Compilation.GetTypeByMetadataName(typeof(IEnumerable<>).FullName);
if (ienumerableGenericSymbol == null ||
ienumerableSymbol == null)
{
return false;
}
return true;
}
private class MyCodeAction : CodeAction.DocumentChangeAction
{
public MyCodeAction(string title, Document newDocument)
: base(title, c => Task.FromResult(newDocument), title)
{
}
}
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenMultiDimensionalArray.vb | ' 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.
Imports Microsoft.CodeAnalysis.Test.Utilities
Imports Roslyn.Test.Utilities
Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests
Public Class CodeGenMultiDimensionalArray
Inherits BasicTestBase
<Fact()>
Public Sub MultiDimensionalArrayCreateWithInitializer()
CompileAndVerify(
<compilation>
<file name="a.vb">
public Module A
Public Sub Main()
Dim arr As Integer(,) = New Integer(1, 2) {{1, 2, 3}, {1, 2, 3}}
System.Console.Write(arr(1, 1))
End Sub
End Module
</file>
</compilation>, options:=TestOptions.ReleaseExe.WithModuleName("MODULE"),
expectedOutput:="2").
VerifyIL("A.Main",
<![CDATA[
{
// Code size 31 (0x1f)
.maxstack 3
IL_0000: ldc.i4.2
IL_0001: ldc.i4.3
IL_0002: newobj "Integer(*,*)..ctor"
IL_0007: dup
IL_0008: ldtoken "<PrivateImplementationDetails>.__StaticArrayInitTypeSize=24 <PrivateImplementationDetails>.618A09BD4B017EFD77C1C5CEA9D47D21EC52DDDEE4892C2A026D588E54AE8F19"
IL_000d: call "Sub System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(System.Array, System.RuntimeFieldHandle)"
IL_0012: ldc.i4.1
IL_0013: ldc.i4.1
IL_0014: call "Integer(*,*).Get"
IL_0019: call "Sub System.Console.Write(Integer)"
IL_001e: ret
}
]]>)
End Sub
<Fact()>
Public Sub MultiDimensionalArrayCreateWithInitializer001()
CompileAndVerify(
<compilation>
<file name="a.vb">
public Module A
Public Sub Main()
Dim arr As Integer(,) = New Integer(1, 2) {{1, 2, 3}, {1, Integer.Parse("42"), 3}}
System.Console.Write(arr(1, 1))
End Sub
End Module
</file>
</compilation>, options:=TestOptions.ReleaseExe.WithModuleName("MODULE"),
expectedOutput:="42").
VerifyIL("A.Main",
<![CDATA[
{
// Code size 49 (0x31)
.maxstack 5
IL_0000: ldc.i4.2
IL_0001: ldc.i4.3
IL_0002: newobj "Integer(*,*)..ctor"
IL_0007: dup
IL_0008: ldtoken "<PrivateImplementationDetails>.__StaticArrayInitTypeSize=24 <PrivateImplementationDetails>.70DE168CE7BA89AB94AD130FD8CB2C588B408E6B5C7FA55F4B322158684A1362"
IL_000d: call "Sub System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(System.Array, System.RuntimeFieldHandle)"
IL_0012: dup
IL_0013: ldc.i4.1
IL_0014: ldc.i4.1
IL_0015: ldstr "42"
IL_001a: call "Function Integer.Parse(String) As Integer"
IL_001f: call "Integer(*,*).Set"
IL_0024: ldc.i4.1
IL_0025: ldc.i4.1
IL_0026: call "Integer(*,*).Get"
IL_002b: call "Sub System.Console.Write(Integer)"
IL_0030: ret
}
]]>)
End Sub
<Fact()>
Public Sub MultiDimensionalArrayCreateWithInitializer002()
CompileAndVerify(
<compilation>
<file name="a.vb">
public Module A
Public Sub Main()
Dim arr As Integer(,) = New Integer(1, 2) {{Integer.Parse("1"), Integer.Parse("2"), Integer.Parse("3")}, {Integer.Parse("4"), Integer.Parse("5"), Integer.Parse("6")}}
System.Console.Write(arr(1, 1))
End Sub
End Module
</file>
</compilation>,
expectedOutput:="5").
VerifyIL("A.Main",
<![CDATA[
{
// Code size 128 (0x80)
.maxstack 5
IL_0000: ldc.i4.2
IL_0001: ldc.i4.3
IL_0002: newobj "Integer(*,*)..ctor"
IL_0007: dup
IL_0008: ldc.i4.0
IL_0009: ldc.i4.0
IL_000a: ldstr "1"
IL_000f: call "Function Integer.Parse(String) As Integer"
IL_0014: call "Integer(*,*).Set"
IL_0019: dup
IL_001a: ldc.i4.0
IL_001b: ldc.i4.1
IL_001c: ldstr "2"
IL_0021: call "Function Integer.Parse(String) As Integer"
IL_0026: call "Integer(*,*).Set"
IL_002b: dup
IL_002c: ldc.i4.0
IL_002d: ldc.i4.2
IL_002e: ldstr "3"
IL_0033: call "Function Integer.Parse(String) As Integer"
IL_0038: call "Integer(*,*).Set"
IL_003d: dup
IL_003e: ldc.i4.1
IL_003f: ldc.i4.0
IL_0040: ldstr "4"
IL_0045: call "Function Integer.Parse(String) As Integer"
IL_004a: call "Integer(*,*).Set"
IL_004f: dup
IL_0050: ldc.i4.1
IL_0051: ldc.i4.1
IL_0052: ldstr "5"
IL_0057: call "Function Integer.Parse(String) As Integer"
IL_005c: call "Integer(*,*).Set"
IL_0061: dup
IL_0062: ldc.i4.1
IL_0063: ldc.i4.2
IL_0064: ldstr "6"
IL_0069: call "Function Integer.Parse(String) As Integer"
IL_006e: call "Integer(*,*).Set"
IL_0073: ldc.i4.1
IL_0074: ldc.i4.1
IL_0075: call "Integer(*,*).Get"
IL_007a: call "Sub System.Console.Write(Integer)"
IL_007f: ret
}
]]>)
End Sub
<Fact()>
Public Sub MultiDimensionalArrayCreateWithInitializer003()
CompileAndVerify(
<compilation>
<file name="a.vb">
Public Module A
Public Sub Main()
Dim arr As Integer(,) = New Integer(1, -1) {{}, {}}
System.Console.Write(arr.Length)
End Sub
End Module
</file>
</compilation>,
expectedOutput:="0").
VerifyIL("A.Main",
<![CDATA[
{
// Code size 18 (0x12)
.maxstack 2
IL_0000: ldc.i4.2
IL_0001: ldc.i4.0
IL_0002: newobj "Integer(*,*)..ctor"
IL_0007: callvirt "Function System.Array.get_Length() As Integer"
IL_000c: call "Sub System.Console.Write(Integer)"
IL_0011: ret
}
]]>)
End Sub
<Fact()>
Public Sub MultiDimensionalArrayCreateWithInitializer004()
CompileAndVerify(
<compilation>
<file name="a.vb">
Public Module A
Public Sub Main()
Dim arr As Integer(,) = New Integer(-1, -1) {}
System.Console.Write(arr.Length)
End Sub
End Module
</file>
</compilation>,
expectedOutput:="0").
VerifyIL("A.Main",
<![CDATA[
{
// Code size 18 (0x12)
.maxstack 2
IL_0000: ldc.i4.0
IL_0001: ldc.i4.0
IL_0002: newobj "Integer(*,*)..ctor"
IL_0007: callvirt "Function System.Array.get_Length() As Integer"
IL_000c: call "Sub System.Console.Write(Integer)"
IL_0011: ret
}
]]>)
End Sub
<Fact()>
Public Sub MultiDimensionalArrayCreate()
CompileAndVerify(
<compilation>
<file name="a.vb">
public Module A
Public Sub Main()
Dim arr As Integer(,) = New Integer(1,2) {}
System.Console.Write(arr.Length)
End Sub
End Module
</file>
</compilation>,
expectedOutput:="6").
VerifyIL("A.Main",
<![CDATA[
{
// Code size 18 (0x12)
.maxstack 2
IL_0000: ldc.i4.2
IL_0001: ldc.i4.3
IL_0002: newobj "Integer(*,*)..ctor"
IL_0007: callvirt "Function System.Array.get_Length() As Integer"
IL_000c: call "Sub System.Console.Write(Integer)"
IL_0011: ret
}
]]>)
End Sub
<Fact()>
Public Sub MultiDimensionalArrayCreateGeneric()
CompileAndVerify(
<compilation>
<file name="a.vb">
public Module A
Public Sub Main()
goo(Of String)()
c1(Of Long).goo()
End Sub
Class c1(Of T)
Public Shared Sub goo()
Dim arr As T(,) = New T(1, 2) {}
System.Console.Write(arr.Length)
End Sub
End Class
Public Sub goo(Of T)()
Dim arr As T(,) = New T(1, 2) {}
System.Console.Write(arr.Length)
End Sub
End Module
</file>
</compilation>,
expectedOutput:="66").
VerifyIL("A.goo(Of T)()",
<![CDATA[
{
// Code size 18 (0x12)
.maxstack 2
IL_0000: ldc.i4.2
IL_0001: ldc.i4.3
IL_0002: newobj "T(*,*)..ctor"
IL_0007: callvirt "Function System.Array.get_Length() As Integer"
IL_000c: call "Sub System.Console.Write(Integer)"
IL_0011: ret
}
]]>)
End Sub
<Fact()>
Public Sub MultiDimensionalArrayGetSetAddress()
CompileAndVerify(
<compilation>
<file name="a.vb">
public Module A
Public Sub Main()
goo(Of String)("hello")
c1(Of Long).goo(123)
End Sub
Class c1(Of T)
Public Shared Sub goo(e as T)
Dim arr As T(,) = New T(2, 3) {}
arr(1, 2) = e
System.Console.Write(arr(1, 2).ToString)
Dim v as T = arr(1, 2)
System.Console.Write(v.ToString)
End Sub
End Class
Public Sub goo(Of T)(e as T)
Dim arr As T(,) = New T(2, 3) {}
arr(1, 2) = e
System.Console.Write(arr(1, 2).ToString)
Dim v as T = arr(1, 2)
System.Console.Write(v.ToString)
End Sub
End Module
</file>
</compilation>,
expectedOutput:="hellohello123123").
VerifyIL("A.goo(Of T)(T)",
<![CDATA[
{
// Code size 69 (0x45)
.maxstack 5
.locals init (T V_0) //v
IL_0000: ldc.i4.3
IL_0001: ldc.i4.4
IL_0002: newobj "T(*,*)..ctor"
IL_0007: dup
IL_0008: ldc.i4.1
IL_0009: ldc.i4.2
IL_000a: ldarg.0
IL_000b: call "T(*,*).Set"
IL_0010: dup
IL_0011: ldc.i4.1
IL_0012: ldc.i4.2
IL_0013: readonly.
IL_0015: call "T(*,*).Address"
IL_001a: constrained. "T"
IL_0020: callvirt "Function Object.ToString() As String"
IL_0025: call "Sub System.Console.Write(String)"
IL_002a: ldc.i4.1
IL_002b: ldc.i4.2
IL_002c: call "T(*,*).Get"
IL_0031: stloc.0
IL_0032: ldloca.s V_0
IL_0034: constrained. "T"
IL_003a: callvirt "Function Object.ToString() As String"
IL_003f: call "Sub System.Console.Write(String)"
IL_0044: ret
}
]]>)
End Sub
<WorkItem(542259, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542259")>
<Fact>
Public Sub MixMultiAndJaggedArray()
CompileAndVerify(
<compilation>
<file name="a.vb">
Imports System
Module Module1
Sub Main()
Dim x = New Exception(,,) {}
Dim y = New Exception(,,) {{{}}}
Dim z = New Exception(,)() {}
End Sub
End Module
</file>
</compilation>).VerifyDiagnostics()
End Sub
' Declaration multi- dimensional array
<Fact>
Public Sub DeclarationmultiDimensionalArray()
CompileAndVerify(
<compilation>
<file name="a.vb">
Imports System
Module Module1
Sub Main()
Dim myArray1 As Integer(,) = New Integer(-1, -1) {}
Dim myArray2 As Integer(,) = New Integer(3, 1) {}
Dim myArray3 As Integer(,,) = New Integer(3, 1, 2) {}
Dim myArray4 As Integer(,) = New Integer(2147483646, 2147483646) {}
Dim myArray5 As Integer(,) = New Integer(2147483648UI - 1, 2147483648UI - 1) {}
End Sub
End Module
</file>
</compilation>).VerifyIL("Module1.Main", <![CDATA[
{
// Code size 58 (0x3a)
.maxstack 3
IL_0000: ldc.i4.0
IL_0001: ldc.i4.0
IL_0002: newobj "Integer(*,*)..ctor"
IL_0007: pop
IL_0008: ldc.i4.4
IL_0009: ldc.i4.2
IL_000a: newobj "Integer(*,*)..ctor"
IL_000f: pop
IL_0010: ldc.i4.4
IL_0011: ldc.i4.2
IL_0012: ldc.i4.3
IL_0013: newobj "Integer(*,*,*)..ctor"
IL_0018: pop
IL_0019: ldc.i4 0x7fffffff
IL_001e: ldc.i4 0x7fffffff
IL_0023: newobj "Integer(*,*)..ctor"
IL_0028: pop
IL_0029: ldc.i4 0x80000000
IL_002e: ldc.i4 0x80000000
IL_0033: newobj "Integer(*,*)..ctor"
IL_0038: pop
IL_0039: ret
}
]]>)
End Sub
' Declaration multi- dimensional array
<Fact>
Public Sub DeclarationmultiDimensionalArray_1()
CompileAndVerify(
<compilation>
<file name="a.vb">
Imports System
Module Module1
Sub Main()
Dim myArray6 As Integer(,,,,) = Nothing
myArray6 = New Integer(4, 5, 8, 3, 6) {}
End Sub
End Module
</file>
</compilation>).VerifyIL("Module1.Main", <![CDATA[
{
// Code size 13 (0xd)
.maxstack 5
IL_0000: ldc.i4.5
IL_0001: ldc.i4.6
IL_0002: ldc.i4.s 9
IL_0004: ldc.i4.4
IL_0005: ldc.i4.7
IL_0006: newobj "Integer(*,*,*,*,*)..ctor"
IL_000b: pop
IL_000c: ret
}
]]>)
End Sub
' Declaration multi- dimensional array
<Fact>
Public Sub DeclarationmultiDimensionalArray_2()
CompileAndVerify(
<compilation>
<file name="a.vb">
Imports System
Module Module1
Private Delegate Sub myDelegate(myString As String)
Sub Main()
Dim myArray1 As myInterface(,) = New myInterface(3, 1) {}
Dim myArray2 As myDelegate(,) = New myDelegate(3, 1) {}
Dim myArray3 = New Integer(Number.One, Number.Two) {}
End Sub
End Module
Interface myInterface
End Interface
Enum Number
One
Two
End Enum
</file>
</compilation>).VerifyIL("Module1.Main", <![CDATA[
{
// Code size 25 (0x19)
.maxstack 2
IL_0000: ldc.i4.4
IL_0001: ldc.i4.2
IL_0002: newobj "myInterface(*,*)..ctor"
IL_0007: pop
IL_0008: ldc.i4.4
IL_0009: ldc.i4.2
IL_000a: newobj "Module1.myDelegate(*,*)..ctor"
IL_000f: pop
IL_0010: ldc.i4.1
IL_0011: ldc.i4.2
IL_0012: newobj "Integer(*,*)..ctor"
IL_0017: pop
IL_0018: ret
}
]]>)
End Sub
' Declaration multi- dimensional array
<Fact>
Public Sub DeclarationmultiDimensionalArray_3()
CompileAndVerify(
<compilation>
<file name="a.vb">
Class C1
Public Shared Sub Main()
Dim myLength As Integer = 3
Dim arr As Integer(,) = New Integer(myLength, 1) {}
End Sub
Private Class A
Private x As Integer = 1
Private arr As Integer(,) = New Integer(x, 4) {}
End Class
End Class
</file>
</compilation>).VerifyIL("C1.Main", <![CDATA[
{
// Code size 11 (0xb)
.maxstack 2
IL_0000: ldc.i4.3
IL_0001: ldc.i4.1
IL_0002: add.ovf
IL_0003: ldc.i4.2
IL_0004: newobj "Integer(*,*)..ctor"
IL_0009: pop
IL_000a: ret
}
]]>)
End Sub
' Declaration multi- dimensional array
<Fact>
Public Sub DeclarationmultiDimensionalArray_5()
CompileAndVerify(
<compilation>
<file name="a.vb">
Imports System
Module Module1
Sub Main()
Dim myArray8 As Integer(,) = New Integer(-1, 4) {}
Dim arrDouble#(,) = New Double(1, 2) {}
Dim arrDecimal@(,) = New Decimal(1, 2) {}
Dim arrString$(,) = New String(1, 2) {}
Dim arrInteger%(,) = New Integer(1, 2) {}
Dim arrLong&(,) = New Long(1, 2) {}
Dim arrSingle!(,) = New Single(1, 2) {}
End Sub
End Module
</file>
</compilation>).VerifyIL("Module1.Main", <![CDATA[
{
// Code size 57 (0x39)
.maxstack 2
IL_0000: ldc.i4.0
IL_0001: ldc.i4.5
IL_0002: newobj "Integer(*,*)..ctor"
IL_0007: pop
IL_0008: ldc.i4.2
IL_0009: ldc.i4.3
IL_000a: newobj "Double(*,*)..ctor"
IL_000f: pop
IL_0010: ldc.i4.2
IL_0011: ldc.i4.3
IL_0012: newobj "Decimal(*,*)..ctor"
IL_0017: pop
IL_0018: ldc.i4.2
IL_0019: ldc.i4.3
IL_001a: newobj "String(*,*)..ctor"
IL_001f: pop
IL_0020: ldc.i4.2
IL_0021: ldc.i4.3
IL_0022: newobj "Integer(*,*)..ctor"
IL_0027: pop
IL_0028: ldc.i4.2
IL_0029: ldc.i4.3
IL_002a: newobj "Long(*,*)..ctor"
IL_002f: pop
IL_0030: ldc.i4.2
IL_0031: ldc.i4.3
IL_0032: newobj "Single(*,*)..ctor"
IL_0037: pop
IL_0038: ret
}
]]>)
End Sub
' Initialize multi- dimensional array
<ConditionalFact(GetType(WindowsDesktopOnly), Reason:="https://github.com/dotnet/roslyn/issues/28044")>
Public Sub InitializemultiDimensionalArray()
CompileAndVerify(
<compilation>
<file name="a.vb">
Option Infer On
Imports System
Imports Microsoft.VisualBasic.Information
Module Module1
Sub Main()
Dim myArray1 As Integer(,,) = {{{0, 1}, {2, 3}}, {{4, 5}, {6, 7}}}
Dim myArray2 As Single(,) = New Single(2, 1) {{CSng(1.0), CSng(2.0)}, {CSng(3.0), CSng(4.0)}, {CSng(5.0), CSng(6.0)}}
Dim myArray3 As Long(,) = New Long(,) {{1, 2}, {3, 4}, {5, 6}}
Dim myArray4 As Char(,)
myArray4 = New Char(2, 1) {{"1"c, "2"c}, {"3"c, "4"c}, {"5"c, "6"c}}
Dim myArray5 As Decimal(,)
myArray5 = New Decimal(,) {{CDec(1.0), CDec(2.0)}, {CDec(3.0), CDec(4.0)}, {CDec(5.0), CDec(6.0)}}
Dim myArray6 As Integer(,) = New Integer(-1, -1) {}
Dim myArray7 As Integer(,) = New Integer(,) {{}}
Dim myArray8 As Integer(,,) = New Integer(,,) {{{}}}
Dim myArray9 As String(,) = New String(2, 1) {{"a"c, "b"c}, {"c"c, "d"c}, {"e"c, "f"c}}
Console.WriteLine(UBound(myArray1, 1))
Console.WriteLine(UBound(myArray1, 2))
Console.WriteLine(UBound(myArray1, 3))
Console.WriteLine(UBound(myArray2, 1))
Console.WriteLine(UBound(myArray2, 2))
Console.WriteLine(UBound(myArray3, 1))
Console.WriteLine(UBound(myArray3, 2))
Console.WriteLine(UBound(myArray4, 1))
Console.WriteLine(UBound(myArray4, 2))
Console.WriteLine(UBound(myArray5, 1))
Console.WriteLine(UBound(myArray5, 2))
Console.WriteLine(UBound(myArray6, 1))
Console.WriteLine(UBound(myArray6, 2))
Console.WriteLine(UBound(myArray7, 1))
Console.WriteLine(UBound(myArray7, 2))
Console.WriteLine(UBound(myArray8, 1))
Console.WriteLine(UBound(myArray8, 2))
Console.WriteLine(UBound(myArray8, 3))
Console.WriteLine(UBound(myArray9, 1))
Console.WriteLine(UBound(myArray9, 2))
End Sub
End Module
</file>
</compilation>, expectedOutput:=<![CDATA[1
1
1
2
1
2
1
2
1
2
1
-1
-1
0
-1
0
0
-1
2
1]]>)
End Sub
' Use different kinds of var as index upper bound
<Fact>
Public Sub DifferentVarAsBound()
CompileAndVerify(
<compilation>
<file name="a.vb">
Option Infer On
Imports Microsoft.VisualBasic.Information
Module Module1
Property prop As Integer
Sub Main(args As String())
Dim arr1(3, prop) As Integer
Dim arr2(3, fun()) As Integer
Dim x = fun()
Dim arr3(x, 1) As Integer
Dim z() As Integer
Dim y() As Integer
Dim replyCounts(,) As Short = New Short(UBound(z, 1), UBound(y, 1)) {}
End Sub
Function fun() As Integer
Return 3
End Function
Sub goo(x As Integer)
Dim arr1(3, x) As Integer
End Sub
End Module
</file>
</compilation>).VerifyIL("Module1.Main", <![CDATA[
{
// Code size 67 (0x43)
.maxstack 3
.locals init (Integer() V_0, //z
Integer() V_1) //y
IL_0000: ldc.i4.4
IL_0001: call "Function Module1.get_prop() As Integer"
IL_0006: ldc.i4.1
IL_0007: add.ovf
IL_0008: newobj "Integer(*,*)..ctor"
IL_000d: pop
IL_000e: ldc.i4.4
IL_000f: call "Function Module1.fun() As Integer"
IL_0014: ldc.i4.1
IL_0015: add.ovf
IL_0016: newobj "Integer(*,*)..ctor"
IL_001b: pop
IL_001c: call "Function Module1.fun() As Integer"
IL_0021: ldc.i4.1
IL_0022: add.ovf
IL_0023: ldc.i4.2
IL_0024: newobj "Integer(*,*)..ctor"
IL_0029: pop
IL_002a: ldloc.0
IL_002b: ldc.i4.1
IL_002c: call "Function Microsoft.VisualBasic.Information.UBound(System.Array, Integer) As Integer"
IL_0031: ldc.i4.1
IL_0032: add.ovf
IL_0033: ldloc.1
IL_0034: ldc.i4.1
IL_0035: call "Function Microsoft.VisualBasic.Information.UBound(System.Array, Integer) As Integer"
IL_003a: ldc.i4.1
IL_003b: add.ovf
IL_003c: newobj "Short(*,*)..ctor"
IL_0041: pop
IL_0042: ret
}
]]>)
End Sub
' Specify lower bound and up bound for multi-dimensional array
<Fact>
Public Sub SpecifyLowerAndUpBound()
CompileAndVerify(
<compilation>
<file name="a.vb">
Module Module1
Property prop As Integer
Sub Main(args As String())
Dim arr1(0 To 0, 0 To -1) As Integer
End Sub
End Module
</file>
</compilation>).VerifyIL("Module1.Main", <![CDATA[
{
// Code size 9 (0x9)
.maxstack 2
IL_0000: ldc.i4.1
IL_0001: ldc.i4.0
IL_0002: newobj "Integer(*,*)..ctor"
IL_0007: pop
IL_0008: ret
}
]]>)
End Sub
' Array creation expression can be part of an anonymous object creation expression
<ConditionalFact(GetType(WindowsDesktopOnly), Reason:="https://github.com/dotnet/roslyn/issues/28044")>
Public Sub ArrayCreateAsAnonymous()
CompileAndVerify(
<compilation>
<file name="a.vb">
Option Infer On
Imports System
Imports Microsoft.VisualBasic.Information
Module Module1
Sub Main(args As String())
Dim a0 = New With {
Key.b4 = New Integer(1, 2) {}, _
Key.b5 = New Integer(1, 1) {{1, 2}, {2, 3}},
Key.b6 = New Integer()() {New Integer(1) {}, New Integer(2) {}},
Key.b7 = New Integer(2)() {},
Key.b8 = New Integer(1)() {New Integer(0) {}, New Integer(1) {}},
Key.b9 = New Integer() {1, 2, 3},
Key.b10 = New Integer(,) {{1, 2}, {2, 3}}
}
Console.WriteLine(UBound(a0.b4, 1))
Console.WriteLine(UBound(a0.b4, 2))
Console.WriteLine(UBound(a0.b5, 1))
Console.WriteLine(UBound(a0.b5, 2))
Console.WriteLine(UBound(a0.b6, 1))
Console.WriteLine(UBound(a0.b7, 1))
Console.WriteLine(UBound(a0.b8, 1))
Console.WriteLine(UBound(a0.b9, 1))
Console.WriteLine(UBound(a0.b10, 1))
Console.WriteLine(UBound(a0.b10, 2))
End Sub
End Module
</file>
</compilation>, expectedOutput:=<![CDATA[1
2
1
1
1
2
1
2
1
1]]>)
End Sub
' Accessing an array's 0th element should work fine
<WorkItem(528752, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/528752")>
<Fact>
Public Sub AccessZero()
CompileAndVerify(
<compilation>
<file name="a.vb">
Imports System
Module Module1
Sub Main(args As String())
Dim arr As Integer(,) = New Integer(4, 4) {}
arr(0, 0) = 5
Console.WriteLine(arr(0, 0))
End Sub
End Module
</file>
</compilation>, expectedOutput:=<![CDATA[5]]>).VerifyIL("Module1.Main", <![CDATA[
{
// Code size 29 (0x1d)
.maxstack 5
IL_0000: ldc.i4.5
IL_0001: ldc.i4.5
IL_0002: newobj "Integer(*,*)..ctor"
IL_0007: dup
IL_0008: ldc.i4.0
IL_0009: ldc.i4.0
IL_000a: ldc.i4.5
IL_000b: call "Integer(*,*).Set"
IL_0010: ldc.i4.0
IL_0011: ldc.i4.0
IL_0012: call "Integer(*,*).Get"
IL_0017: call "Sub System.Console.WriteLine(Integer)"
IL_001c: ret
}
]]>)
End Sub
' Accessing an array's maxlength element should work fine
<WorkItem(528752, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/528752")>
<Fact>
Public Sub AccessMaxLength()
CompileAndVerify(
<compilation>
<file name="a.vb">
Imports System
Module Module1
Sub Main(args As String())
Dim arr As Integer(,) = New Integer(4, 3) {}
arr(4, 3) = 5
Console.WriteLine(arr(4, 3))
End Sub
End Module
</file>
</compilation>, expectedOutput:=<![CDATA[5]]>).VerifyIL("Module1.Main", <![CDATA[
{
// Code size 29 (0x1d)
.maxstack 5
IL_0000: ldc.i4.5
IL_0001: ldc.i4.4
IL_0002: newobj "Integer(*,*)..ctor"
IL_0007: dup
IL_0008: ldc.i4.4
IL_0009: ldc.i4.3
IL_000a: ldc.i4.5
IL_000b: call "Integer(*,*).Set"
IL_0010: ldc.i4.4
IL_0011: ldc.i4.3
IL_0012: call "Integer(*,*).Get"
IL_0017: call "Sub System.Console.WriteLine(Integer)"
IL_001c: ret
}
]]>)
End Sub
' Accessing an array's -1 element should throw an exception
<WorkItem(528752, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/528752")>
<Fact>
Public Sub AccessLessThanMin()
CompileAndVerify(
<compilation>
<file name="a.vb">
Imports System
Module Module1
Sub Main(args As String())
Dim arr As Integer(,) = New Integer(4, 4) {}
Try
arr(-1, 1) = 5
arr(1, -1) = 5
arr(-1, -1) = 5
Catch generatedExceptionName As System.IndexOutOfRangeException
End Try
End Sub
End Module
</file>
</compilation>).VerifyIL("Module1.Main", <![CDATA[
{
// Code size 52 (0x34)
.maxstack 4
.locals init (Integer(,) V_0, //arr
System.IndexOutOfRangeException V_1) //generatedExceptionName
IL_0000: ldc.i4.5
IL_0001: ldc.i4.5
IL_0002: newobj "Integer(*,*)..ctor"
IL_0007: stloc.0
.try
{
IL_0008: ldloc.0
IL_0009: ldc.i4.m1
IL_000a: ldc.i4.1
IL_000b: ldc.i4.5
IL_000c: call "Integer(*,*).Set"
IL_0011: ldloc.0
IL_0012: ldc.i4.1
IL_0013: ldc.i4.m1
IL_0014: ldc.i4.5
IL_0015: call "Integer(*,*).Set"
IL_001a: ldloc.0
IL_001b: ldc.i4.m1
IL_001c: ldc.i4.m1
IL_001d: ldc.i4.5
IL_001e: call "Integer(*,*).Set"
IL_0023: leave.s IL_0033
}
catch System.IndexOutOfRangeException
{
IL_0025: dup
IL_0026: call "Sub Microsoft.VisualBasic.CompilerServices.ProjectData.SetProjectError(System.Exception)"
IL_002b: stloc.1
IL_002c: call "Sub Microsoft.VisualBasic.CompilerServices.ProjectData.ClearProjectError()"
IL_0031: leave.s IL_0033
}
IL_0033: ret
}
]]>)
End Sub
' Accessing an array's maxlength+1 element should throw an exception
<WorkItem(528752, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/528752")>
<Fact>
Public Sub AccessGreaterThanMax()
CompileAndVerify(
<compilation>
<file name="a.vb">
Imports System
Module Module1
Sub Main(args As String())
Dim arr As Integer(,) = New Integer(4, 3) {}
Try
arr(5, 3) = 5
arr(4, 4) = 5
arr(5, 4) = 5
Catch
End Try
End Sub
End Module
</file>
</compilation>).VerifyIL("Module1.Main", <![CDATA[
{
// Code size 50 (0x32)
.maxstack 4
.locals init (Integer(,) V_0) //arr
IL_0000: ldc.i4.5
IL_0001: ldc.i4.4
IL_0002: newobj "Integer(*,*)..ctor"
IL_0007: stloc.0
.try
{
IL_0008: ldloc.0
IL_0009: ldc.i4.5
IL_000a: ldc.i4.3
IL_000b: ldc.i4.5
IL_000c: call "Integer(*,*).Set"
IL_0011: ldloc.0
IL_0012: ldc.i4.4
IL_0013: ldc.i4.4
IL_0014: ldc.i4.5
IL_0015: call "Integer(*,*).Set"
IL_001a: ldloc.0
IL_001b: ldc.i4.5
IL_001c: ldc.i4.4
IL_001d: ldc.i4.5
IL_001e: call "Integer(*,*).Set"
IL_0023: leave.s IL_0031
}
catch System.Exception
{
IL_0025: call "Sub Microsoft.VisualBasic.CompilerServices.ProjectData.SetProjectError(System.Exception)"
IL_002a: call "Sub Microsoft.VisualBasic.CompilerServices.ProjectData.ClearProjectError()"
IL_002f: leave.s IL_0031
}
IL_0031: ret
}
]]>)
End Sub
' Accessing an array's index with a variable of type int, short, byte should work
<WorkItem(528752, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/528752")>
<Fact>
Public Sub AccessWithDifferentType()
CompileAndVerify(
<compilation>
<file name="a.vb">
Option Infer On
Imports System
Module Module1
Sub Main(args As String())
Dim arr As Integer(,) = New Integer(4, 4) {}
Dim idx As Integer = 2
Dim idx1 As Byte = 1
Dim idx3 As Short = 4
Dim idx4 = 2.0
Dim idx5 As Long = 3L
arr(idx, 3) = 100
arr(idx1, 3) = 100
arr(idx3, 3) = 100
arr(cint(idx4), 3) = 100
arr(cint(idx5), 3) = 100
End Sub
End Module
</file>
</compilation>).VerifyIL("Module1.Main", <![CDATA[
{
// Code size 85 (0x55)
.maxstack 5
.locals init (Integer V_0, //idx
Byte V_1, //idx1
Short V_2, //idx3
Double V_3, //idx4
Long V_4) //idx5
IL_0000: ldc.i4.5
IL_0001: ldc.i4.5
IL_0002: newobj "Integer(*,*)..ctor"
IL_0007: ldc.i4.2
IL_0008: stloc.0
IL_0009: ldc.i4.1
IL_000a: stloc.1
IL_000b: ldc.i4.4
IL_000c: stloc.2
IL_000d: ldc.r8 2
IL_0016: stloc.3
IL_0017: ldc.i4.3
IL_0018: conv.i8
IL_0019: stloc.s V_4
IL_001b: dup
IL_001c: ldloc.0
IL_001d: ldc.i4.3
IL_001e: ldc.i4.s 100
IL_0020: call "Integer(*,*).Set"
IL_0025: dup
IL_0026: ldloc.1
IL_0027: ldc.i4.3
IL_0028: ldc.i4.s 100
IL_002a: call "Integer(*,*).Set"
IL_002f: dup
IL_0030: ldloc.2
IL_0031: ldc.i4.3
IL_0032: ldc.i4.s 100
IL_0034: call "Integer(*,*).Set"
IL_0039: dup
IL_003a: ldloc.3
IL_003b: call "Function System.Math.Round(Double) As Double"
IL_0040: conv.ovf.i4
IL_0041: ldc.i4.3
IL_0042: ldc.i4.s 100
IL_0044: call "Integer(*,*).Set"
IL_0049: ldloc.s V_4
IL_004b: conv.ovf.i4
IL_004c: ldc.i4.3
IL_004d: ldc.i4.s 100
IL_004f: call "Integer(*,*).Set"
IL_0054: ret
}
]]>)
End Sub
' Passing an element to a function as a byVal or byRef parameter should work
<WorkItem(528752, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/528752")>
<Fact>
Public Sub ArrayAsArgument()
CompileAndVerify(
<compilation>
<file name="a.vb">
Imports System
Module Module1
Sub Main(args As String())
Dim arr As Integer(,) = New Integer(,) {{1, 2}}
ElementTaker((arr(0, 1)))
Console.WriteLine(arr(0, 1))
ElementTaker(arr(0, 1))
Console.WriteLine(arr(0, 1))
End Sub
Public Function ElementTaker(ByRef val As Integer) As Integer
val = val + 5
Return val
End Function
End Module
</file>
</compilation>, expectedOutput:=<![CDATA[2
7]]>).VerifyIL("Module1.Main", <![CDATA[
{
// Code size 82 (0x52)
.maxstack 5
.locals init (Integer V_0)
IL_0000: ldc.i4.1
IL_0001: ldc.i4.2
IL_0002: newobj "Integer(*,*)..ctor"
IL_0007: dup
IL_0008: ldc.i4.0
IL_0009: ldc.i4.0
IL_000a: ldc.i4.1
IL_000b: call "Integer(*,*).Set"
IL_0010: dup
IL_0011: ldc.i4.0
IL_0012: ldc.i4.1
IL_0013: ldc.i4.2
IL_0014: call "Integer(*,*).Set"
IL_0019: dup
IL_001a: ldc.i4.0
IL_001b: ldc.i4.1
IL_001c: call "Integer(*,*).Get"
IL_0021: stloc.0
IL_0022: ldloca.s V_0
IL_0024: call "Function Module1.ElementTaker(ByRef Integer) As Integer"
IL_0029: pop
IL_002a: dup
IL_002b: ldc.i4.0
IL_002c: ldc.i4.1
IL_002d: call "Integer(*,*).Get"
IL_0032: call "Sub System.Console.WriteLine(Integer)"
IL_0037: dup
IL_0038: ldc.i4.0
IL_0039: ldc.i4.1
IL_003a: call "Integer(*,*).Address"
IL_003f: call "Function Module1.ElementTaker(ByRef Integer) As Integer"
IL_0044: pop
IL_0045: ldc.i4.0
IL_0046: ldc.i4.1
IL_0047: call "Integer(*,*).Get"
IL_004c: call "Sub System.Console.WriteLine(Integer)"
IL_0051: ret
}
]]>)
End Sub
' Passing an element to a function as a byVal or byRef parameter should work
<WorkItem(528752, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/528752")>
<Fact>
Public Sub ArrayAsArgument_1()
CompileAndVerify(
<compilation>
<file name="a.vb">
Imports System
Module Module1
Sub Main(args As String())
Dim arr As Integer(,) = New Integer(,) {{1, 2}}
ElementTaker(arr(0, 1))
Console.WriteLine(arr(0, 1))
End Sub
Public Function ElementTaker(ByVal val As Integer) As Integer
val = 5
Return val
End Function
End Module
</file>
</compilation>, expectedOutput:=<![CDATA[2]]>).VerifyIL("Module1.Main", <![CDATA[
{
// Code size 52 (0x34)
.maxstack 5
IL_0000: ldc.i4.1
IL_0001: ldc.i4.2
IL_0002: newobj "Integer(*,*)..ctor"
IL_0007: dup
IL_0008: ldc.i4.0
IL_0009: ldc.i4.0
IL_000a: ldc.i4.1
IL_000b: call "Integer(*,*).Set"
IL_0010: dup
IL_0011: ldc.i4.0
IL_0012: ldc.i4.1
IL_0013: ldc.i4.2
IL_0014: call "Integer(*,*).Set"
IL_0019: dup
IL_001a: ldc.i4.0
IL_001b: ldc.i4.1
IL_001c: call "Integer(*,*).Get"
IL_0021: call "Function Module1.ElementTaker(Integer) As Integer"
IL_0026: pop
IL_0027: ldc.i4.0
IL_0028: ldc.i4.1
IL_0029: call "Integer(*,*).Get"
IL_002e: call "Sub System.Console.WriteLine(Integer)"
IL_0033: ret
}
]]>)
End Sub
' Assigning nothing to an array variable
<WorkItem(528752, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/528752")>
<Fact>
Public Sub AssignNothingToArray()
CompileAndVerify(
<compilation>
<file name="a.vb">
Imports System
Module Module1
Public Sub Main()
Dim arr As Integer(,) = New Integer(0, 1) {{1, 2}}
Dim arr1 As Integer(,) = Nothing
arr = Nothing
arr(0, 1) = 3
arr1(0, 1) = 3
End Sub
End Module
</file>
</compilation>).VerifyIL("Module1.Main", <![CDATA[
{
// Code size 45 (0x2d)
.maxstack 5
IL_0000: ldc.i4.1
IL_0001: ldc.i4.2
IL_0002: newobj "Integer(*,*)..ctor"
IL_0007: dup
IL_0008: ldc.i4.0
IL_0009: ldc.i4.0
IL_000a: ldc.i4.1
IL_000b: call "Integer(*,*).Set"
IL_0010: dup
IL_0011: ldc.i4.0
IL_0012: ldc.i4.1
IL_0013: ldc.i4.2
IL_0014: call "Integer(*,*).Set"
IL_0019: pop
IL_001a: ldnull
IL_001b: ldnull
IL_001c: ldc.i4.0
IL_001d: ldc.i4.1
IL_001e: ldc.i4.3
IL_001f: call "Integer(*,*).Set"
IL_0024: ldc.i4.0
IL_0025: ldc.i4.1
IL_0026: ldc.i4.3
IL_0027: call "Integer(*,*).Set"
IL_002c: ret
}
]]>)
End Sub
' Assigning a smaller array to a bigger array or vice versa should work
<ConditionalFact(GetType(WindowsDesktopOnly), Reason:="https://github.com/dotnet/roslyn/issues/28044")>
Public Sub AssignArrayToArray()
CompileAndVerify(
<compilation>
<file name="a.vb">
Imports System
Imports Microsoft.VisualBasic.Information
Module Program
Public Sub Main()
Dim arr1 As Integer(,) = New Integer(4, 1) {{1, 2}, {3, 4}, {5, 6}, {8, 9}, {100, 1210}}
Dim arr2 As Integer(,) = New Integer(2, 1) {{6, 7}, {8, 1}, {2, 12}}
arr1 = arr2
Dim arr3 As Integer(,) = New Integer(1, 1) {{6, 7}, {9, 8}}
Dim arr4 As Integer(,) = New Integer(2, 2) {{1, 2, 3}, {4, 5, 6}, {8, 0, 2}}
arr3 = arr4
Console.WriteLine(UBound(arr1, 1))
Console.WriteLine(UBound(arr1, 2))
Console.WriteLine(UBound(arr2, 1))
Console.WriteLine(UBound(arr2, 2))
Console.WriteLine(UBound(arr3, 1))
Console.WriteLine(UBound(arr3, 2))
Console.WriteLine(UBound(arr4, 1))
Console.WriteLine(UBound(arr4, 2))
End Sub
End Module
</file>
</compilation>, expectedOutput:=<![CDATA[2
1
2
1
2
2
2
2]]>)
End Sub
' Access index by enum
<WorkItem(528752, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/528752")>
<Fact>
Public Sub AccessIndexByEnum()
CompileAndVerify(
<compilation>
<file name="a.vb">
Imports System
Module Module1
Public Sub Main()
Dim cube As Integer(,) = New Integer(1, 2) {}
cube(Number.One, Number.Two) = 1
Console.WriteLine(cube(Number.One, Number.Two))
End Sub
End Module
Enum Number
One
Two
End Enum
</file>
</compilation>, expectedOutput:=<![CDATA[1]]>).VerifyIL("Module1.Main", <![CDATA[
{
// Code size 29 (0x1d)
.maxstack 5
IL_0000: ldc.i4.2
IL_0001: ldc.i4.3
IL_0002: newobj "Integer(*,*)..ctor"
IL_0007: dup
IL_0008: ldc.i4.0
IL_0009: ldc.i4.1
IL_000a: ldc.i4.1
IL_000b: call "Integer(*,*).Set"
IL_0010: ldc.i4.0
IL_0011: ldc.i4.1
IL_0012: call "Integer(*,*).Get"
IL_0017: call "Sub System.Console.WriteLine(Integer)"
IL_001c: ret
}
]]>)
End Sub
' Assigning a struct variable to an element should work
<WorkItem(528752, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/528752")>
<Fact>
Public Sub AssigningStructToElement()
CompileAndVerify(
<compilation>
<file name="a.vb">
Imports System
Module Module1
Public Sub Main()
Dim arr As myStruct(,) = New myStruct(2, 1) {}
Dim ms As myStruct
ms.x = 4
ms.y = 5
arr(2, 0) = ms
End Sub
End Module
Structure myStruct
Public x As Integer
Public y As Integer
End Structure
</file>
</compilation>).VerifyIL("Module1.Main", <![CDATA[
{
// Code size 32 (0x20)
.maxstack 4
.locals init (myStruct V_0) //ms
IL_0000: ldc.i4.3
IL_0001: ldc.i4.2
IL_0002: newobj "myStruct(*,*)..ctor"
IL_0007: ldloca.s V_0
IL_0009: ldc.i4.4
IL_000a: stfld "myStruct.x As Integer"
IL_000f: ldloca.s V_0
IL_0011: ldc.i4.5
IL_0012: stfld "myStruct.y As Integer"
IL_0017: ldc.i4.2
IL_0018: ldc.i4.0
IL_0019: ldloc.0
IL_001a: call "myStruct(*,*).Set"
IL_001f: ret
}
]]>)
End Sub
' Using foreach on a multi-dimensional array
<WorkItem(528752, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/528752")>
<Fact>
Public Sub ForEachMultiDimensionalArray()
CompileAndVerify(
<compilation>
<file name="a.vb">
Imports System
Module Module1
Public Sub Main()
Dim arr As Integer(,,) = New Integer(,,) {{{1, 2}, {4, 5}}}
For Each i As Integer In arr
Console.WriteLine(i)
Next
End Sub
End Module
</file>
</compilation>, expectedOutput:=<![CDATA[1
2
4
5]]>)
End Sub
' Overload method by different dimension of array
<Fact>
Public Sub OverloadByDiffDimensionArray()
CompileAndVerify(
<compilation>
<file name="a.vb">
Module Program
Sub Main(args As String())
End Sub
Sub goo(ByRef arg(,,) As Integer)
End Sub
Sub goo(ByRef arg(,) As Integer)
End Sub
Sub goo(ByRef arg() As Integer)
End Sub
End Module
</file>
</compilation>).VerifyDiagnostics()
End Sub
' Multi-dimensional array args could not as entry point
<Fact()>
Public Sub MultidimensionalArgsAsEntryPoint()
CompileAndVerify(
<compilation>
<file name="a.vb">
Class B
Public Shared Sub Main(args As String(,))
End Sub
Public Shared Sub Main()
End Sub
End Class
Class M1
Public Shared Sub Main(args As String(,))
End Sub
End Class
</file>
</compilation>).VerifyDiagnostics()
End Sub
' Declare multi-dimensional and Jagged array
<ConditionalFact(GetType(WindowsDesktopOnly), Reason:="https://github.com/dotnet/roslyn/issues/28044")>
Public Sub MixedArray()
CompileAndVerify(
<compilation>
<file name="a.vb">
Imports Microsoft.VisualBasic.Information
Class program
Public Shared Sub Main()
Dim x = New Integer(,)() {}
Dim y(,)() As Byte = New Byte(,)() {{New Byte() {2, 1, 3}}, {New Byte() {3, 0}}}
System.Console.WriteLine(UBound(y, 1))
System.Console.WriteLine(UBound(y, 2))
End Sub
End Class
</file>
</compilation>, expectedOutput:=<![CDATA[1
0]]>)
End Sub
' Parse an Attribute instance that takes a generic type with a generic argument that is a multi-dimensional array
<Fact>
Public Sub Generic()
CompileAndVerify(
<compilation>
<file name="a.vb">
Imports System
<TypeAttribute(GetType(Program(Of [String])(,)))> _
Public Class Goo
End Class
Class Program(Of T)
End Class
Class TypeAttribute
Inherits Attribute
Public Sub New(value As Type)
End Sub
End Class
</file>
</compilation>).VerifyDiagnostics()
End Sub
<Fact()>
Public Sub MDArrayTypeRef()
Dim csCompilation = CreateCSharpCompilation("CS",
<![CDATA[
public class A
{
public static readonly string[,] dummy = new string[2, 2] { { "", "M" }, { "S", "SM" } };
}]]>,
compilationOptions:=New Microsoft.CodeAnalysis.CSharp.CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary))
csCompilation.VerifyDiagnostics()
Dim vbCompilation = CreateVisualBasicCompilation("VB",
<![CDATA[
Module Module1
Sub Main()
Dim x = A.dummy
System.Console.Writeline(x(1,1))
End Sub
End Module]]>,
compilationOptions:=New VisualBasicCompilationOptions(OutputKind.ConsoleApplication),
referencedCompilations:={csCompilation})
Dim vbVerifier = CompileAndVerify(vbCompilation,
expectedOutput:=<![CDATA[
SM
]]>)
vbVerifier.VerifyDiagnostics()
End Sub
End Class
End Namespace
| ' 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.
Imports Microsoft.CodeAnalysis.Test.Utilities
Imports Roslyn.Test.Utilities
Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests
Public Class CodeGenMultiDimensionalArray
Inherits BasicTestBase
<Fact()>
Public Sub MultiDimensionalArrayCreateWithInitializer()
CompileAndVerify(
<compilation>
<file name="a.vb">
public Module A
Public Sub Main()
Dim arr As Integer(,) = New Integer(1, 2) {{1, 2, 3}, {1, 2, 3}}
System.Console.Write(arr(1, 1))
End Sub
End Module
</file>
</compilation>, options:=TestOptions.ReleaseExe.WithModuleName("MODULE"),
expectedOutput:="2").
VerifyIL("A.Main",
<![CDATA[
{
// Code size 31 (0x1f)
.maxstack 3
IL_0000: ldc.i4.2
IL_0001: ldc.i4.3
IL_0002: newobj "Integer(*,*)..ctor"
IL_0007: dup
IL_0008: ldtoken "<PrivateImplementationDetails>.__StaticArrayInitTypeSize=24 <PrivateImplementationDetails>.618A09BD4B017EFD77C1C5CEA9D47D21EC52DDDEE4892C2A026D588E54AE8F19"
IL_000d: call "Sub System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(System.Array, System.RuntimeFieldHandle)"
IL_0012: ldc.i4.1
IL_0013: ldc.i4.1
IL_0014: call "Integer(*,*).Get"
IL_0019: call "Sub System.Console.Write(Integer)"
IL_001e: ret
}
]]>)
End Sub
<Fact()>
Public Sub MultiDimensionalArrayCreateWithInitializer001()
CompileAndVerify(
<compilation>
<file name="a.vb">
public Module A
Public Sub Main()
Dim arr As Integer(,) = New Integer(1, 2) {{1, 2, 3}, {1, Integer.Parse("42"), 3}}
System.Console.Write(arr(1, 1))
End Sub
End Module
</file>
</compilation>, options:=TestOptions.ReleaseExe.WithModuleName("MODULE"),
expectedOutput:="42").
VerifyIL("A.Main",
<![CDATA[
{
// Code size 49 (0x31)
.maxstack 5
IL_0000: ldc.i4.2
IL_0001: ldc.i4.3
IL_0002: newobj "Integer(*,*)..ctor"
IL_0007: dup
IL_0008: ldtoken "<PrivateImplementationDetails>.__StaticArrayInitTypeSize=24 <PrivateImplementationDetails>.70DE168CE7BA89AB94AD130FD8CB2C588B408E6B5C7FA55F4B322158684A1362"
IL_000d: call "Sub System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(System.Array, System.RuntimeFieldHandle)"
IL_0012: dup
IL_0013: ldc.i4.1
IL_0014: ldc.i4.1
IL_0015: ldstr "42"
IL_001a: call "Function Integer.Parse(String) As Integer"
IL_001f: call "Integer(*,*).Set"
IL_0024: ldc.i4.1
IL_0025: ldc.i4.1
IL_0026: call "Integer(*,*).Get"
IL_002b: call "Sub System.Console.Write(Integer)"
IL_0030: ret
}
]]>)
End Sub
<Fact()>
Public Sub MultiDimensionalArrayCreateWithInitializer002()
CompileAndVerify(
<compilation>
<file name="a.vb">
public Module A
Public Sub Main()
Dim arr As Integer(,) = New Integer(1, 2) {{Integer.Parse("1"), Integer.Parse("2"), Integer.Parse("3")}, {Integer.Parse("4"), Integer.Parse("5"), Integer.Parse("6")}}
System.Console.Write(arr(1, 1))
End Sub
End Module
</file>
</compilation>,
expectedOutput:="5").
VerifyIL("A.Main",
<![CDATA[
{
// Code size 128 (0x80)
.maxstack 5
IL_0000: ldc.i4.2
IL_0001: ldc.i4.3
IL_0002: newobj "Integer(*,*)..ctor"
IL_0007: dup
IL_0008: ldc.i4.0
IL_0009: ldc.i4.0
IL_000a: ldstr "1"
IL_000f: call "Function Integer.Parse(String) As Integer"
IL_0014: call "Integer(*,*).Set"
IL_0019: dup
IL_001a: ldc.i4.0
IL_001b: ldc.i4.1
IL_001c: ldstr "2"
IL_0021: call "Function Integer.Parse(String) As Integer"
IL_0026: call "Integer(*,*).Set"
IL_002b: dup
IL_002c: ldc.i4.0
IL_002d: ldc.i4.2
IL_002e: ldstr "3"
IL_0033: call "Function Integer.Parse(String) As Integer"
IL_0038: call "Integer(*,*).Set"
IL_003d: dup
IL_003e: ldc.i4.1
IL_003f: ldc.i4.0
IL_0040: ldstr "4"
IL_0045: call "Function Integer.Parse(String) As Integer"
IL_004a: call "Integer(*,*).Set"
IL_004f: dup
IL_0050: ldc.i4.1
IL_0051: ldc.i4.1
IL_0052: ldstr "5"
IL_0057: call "Function Integer.Parse(String) As Integer"
IL_005c: call "Integer(*,*).Set"
IL_0061: dup
IL_0062: ldc.i4.1
IL_0063: ldc.i4.2
IL_0064: ldstr "6"
IL_0069: call "Function Integer.Parse(String) As Integer"
IL_006e: call "Integer(*,*).Set"
IL_0073: ldc.i4.1
IL_0074: ldc.i4.1
IL_0075: call "Integer(*,*).Get"
IL_007a: call "Sub System.Console.Write(Integer)"
IL_007f: ret
}
]]>)
End Sub
<Fact()>
Public Sub MultiDimensionalArrayCreateWithInitializer003()
CompileAndVerify(
<compilation>
<file name="a.vb">
Public Module A
Public Sub Main()
Dim arr As Integer(,) = New Integer(1, -1) {{}, {}}
System.Console.Write(arr.Length)
End Sub
End Module
</file>
</compilation>,
expectedOutput:="0").
VerifyIL("A.Main",
<![CDATA[
{
// Code size 18 (0x12)
.maxstack 2
IL_0000: ldc.i4.2
IL_0001: ldc.i4.0
IL_0002: newobj "Integer(*,*)..ctor"
IL_0007: callvirt "Function System.Array.get_Length() As Integer"
IL_000c: call "Sub System.Console.Write(Integer)"
IL_0011: ret
}
]]>)
End Sub
<Fact()>
Public Sub MultiDimensionalArrayCreateWithInitializer004()
CompileAndVerify(
<compilation>
<file name="a.vb">
Public Module A
Public Sub Main()
Dim arr As Integer(,) = New Integer(-1, -1) {}
System.Console.Write(arr.Length)
End Sub
End Module
</file>
</compilation>,
expectedOutput:="0").
VerifyIL("A.Main",
<![CDATA[
{
// Code size 18 (0x12)
.maxstack 2
IL_0000: ldc.i4.0
IL_0001: ldc.i4.0
IL_0002: newobj "Integer(*,*)..ctor"
IL_0007: callvirt "Function System.Array.get_Length() As Integer"
IL_000c: call "Sub System.Console.Write(Integer)"
IL_0011: ret
}
]]>)
End Sub
<Fact()>
Public Sub MultiDimensionalArrayCreate()
CompileAndVerify(
<compilation>
<file name="a.vb">
public Module A
Public Sub Main()
Dim arr As Integer(,) = New Integer(1,2) {}
System.Console.Write(arr.Length)
End Sub
End Module
</file>
</compilation>,
expectedOutput:="6").
VerifyIL("A.Main",
<![CDATA[
{
// Code size 18 (0x12)
.maxstack 2
IL_0000: ldc.i4.2
IL_0001: ldc.i4.3
IL_0002: newobj "Integer(*,*)..ctor"
IL_0007: callvirt "Function System.Array.get_Length() As Integer"
IL_000c: call "Sub System.Console.Write(Integer)"
IL_0011: ret
}
]]>)
End Sub
<Fact()>
Public Sub MultiDimensionalArrayCreateGeneric()
CompileAndVerify(
<compilation>
<file name="a.vb">
public Module A
Public Sub Main()
goo(Of String)()
c1(Of Long).goo()
End Sub
Class c1(Of T)
Public Shared Sub goo()
Dim arr As T(,) = New T(1, 2) {}
System.Console.Write(arr.Length)
End Sub
End Class
Public Sub goo(Of T)()
Dim arr As T(,) = New T(1, 2) {}
System.Console.Write(arr.Length)
End Sub
End Module
</file>
</compilation>,
expectedOutput:="66").
VerifyIL("A.goo(Of T)()",
<![CDATA[
{
// Code size 18 (0x12)
.maxstack 2
IL_0000: ldc.i4.2
IL_0001: ldc.i4.3
IL_0002: newobj "T(*,*)..ctor"
IL_0007: callvirt "Function System.Array.get_Length() As Integer"
IL_000c: call "Sub System.Console.Write(Integer)"
IL_0011: ret
}
]]>)
End Sub
<Fact()>
Public Sub MultiDimensionalArrayGetSetAddress()
CompileAndVerify(
<compilation>
<file name="a.vb">
public Module A
Public Sub Main()
goo(Of String)("hello")
c1(Of Long).goo(123)
End Sub
Class c1(Of T)
Public Shared Sub goo(e as T)
Dim arr As T(,) = New T(2, 3) {}
arr(1, 2) = e
System.Console.Write(arr(1, 2).ToString)
Dim v as T = arr(1, 2)
System.Console.Write(v.ToString)
End Sub
End Class
Public Sub goo(Of T)(e as T)
Dim arr As T(,) = New T(2, 3) {}
arr(1, 2) = e
System.Console.Write(arr(1, 2).ToString)
Dim v as T = arr(1, 2)
System.Console.Write(v.ToString)
End Sub
End Module
</file>
</compilation>,
expectedOutput:="hellohello123123").
VerifyIL("A.goo(Of T)(T)",
<![CDATA[
{
// Code size 69 (0x45)
.maxstack 5
.locals init (T V_0) //v
IL_0000: ldc.i4.3
IL_0001: ldc.i4.4
IL_0002: newobj "T(*,*)..ctor"
IL_0007: dup
IL_0008: ldc.i4.1
IL_0009: ldc.i4.2
IL_000a: ldarg.0
IL_000b: call "T(*,*).Set"
IL_0010: dup
IL_0011: ldc.i4.1
IL_0012: ldc.i4.2
IL_0013: readonly.
IL_0015: call "T(*,*).Address"
IL_001a: constrained. "T"
IL_0020: callvirt "Function Object.ToString() As String"
IL_0025: call "Sub System.Console.Write(String)"
IL_002a: ldc.i4.1
IL_002b: ldc.i4.2
IL_002c: call "T(*,*).Get"
IL_0031: stloc.0
IL_0032: ldloca.s V_0
IL_0034: constrained. "T"
IL_003a: callvirt "Function Object.ToString() As String"
IL_003f: call "Sub System.Console.Write(String)"
IL_0044: ret
}
]]>)
End Sub
<WorkItem(542259, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542259")>
<Fact>
Public Sub MixMultiAndJaggedArray()
CompileAndVerify(
<compilation>
<file name="a.vb">
Imports System
Module Module1
Sub Main()
Dim x = New Exception(,,) {}
Dim y = New Exception(,,) {{{}}}
Dim z = New Exception(,)() {}
End Sub
End Module
</file>
</compilation>).VerifyDiagnostics()
End Sub
' Declaration multi- dimensional array
<Fact>
Public Sub DeclarationmultiDimensionalArray()
CompileAndVerify(
<compilation>
<file name="a.vb">
Imports System
Module Module1
Sub Main()
Dim myArray1 As Integer(,) = New Integer(-1, -1) {}
Dim myArray2 As Integer(,) = New Integer(3, 1) {}
Dim myArray3 As Integer(,,) = New Integer(3, 1, 2) {}
Dim myArray4 As Integer(,) = New Integer(2147483646, 2147483646) {}
Dim myArray5 As Integer(,) = New Integer(2147483648UI - 1, 2147483648UI - 1) {}
End Sub
End Module
</file>
</compilation>).VerifyIL("Module1.Main", <![CDATA[
{
// Code size 58 (0x3a)
.maxstack 3
IL_0000: ldc.i4.0
IL_0001: ldc.i4.0
IL_0002: newobj "Integer(*,*)..ctor"
IL_0007: pop
IL_0008: ldc.i4.4
IL_0009: ldc.i4.2
IL_000a: newobj "Integer(*,*)..ctor"
IL_000f: pop
IL_0010: ldc.i4.4
IL_0011: ldc.i4.2
IL_0012: ldc.i4.3
IL_0013: newobj "Integer(*,*,*)..ctor"
IL_0018: pop
IL_0019: ldc.i4 0x7fffffff
IL_001e: ldc.i4 0x7fffffff
IL_0023: newobj "Integer(*,*)..ctor"
IL_0028: pop
IL_0029: ldc.i4 0x80000000
IL_002e: ldc.i4 0x80000000
IL_0033: newobj "Integer(*,*)..ctor"
IL_0038: pop
IL_0039: ret
}
]]>)
End Sub
' Declaration multi- dimensional array
<Fact>
Public Sub DeclarationmultiDimensionalArray_1()
CompileAndVerify(
<compilation>
<file name="a.vb">
Imports System
Module Module1
Sub Main()
Dim myArray6 As Integer(,,,,) = Nothing
myArray6 = New Integer(4, 5, 8, 3, 6) {}
End Sub
End Module
</file>
</compilation>).VerifyIL("Module1.Main", <![CDATA[
{
// Code size 13 (0xd)
.maxstack 5
IL_0000: ldc.i4.5
IL_0001: ldc.i4.6
IL_0002: ldc.i4.s 9
IL_0004: ldc.i4.4
IL_0005: ldc.i4.7
IL_0006: newobj "Integer(*,*,*,*,*)..ctor"
IL_000b: pop
IL_000c: ret
}
]]>)
End Sub
' Declaration multi- dimensional array
<Fact>
Public Sub DeclarationmultiDimensionalArray_2()
CompileAndVerify(
<compilation>
<file name="a.vb">
Imports System
Module Module1
Private Delegate Sub myDelegate(myString As String)
Sub Main()
Dim myArray1 As myInterface(,) = New myInterface(3, 1) {}
Dim myArray2 As myDelegate(,) = New myDelegate(3, 1) {}
Dim myArray3 = New Integer(Number.One, Number.Two) {}
End Sub
End Module
Interface myInterface
End Interface
Enum Number
One
Two
End Enum
</file>
</compilation>).VerifyIL("Module1.Main", <![CDATA[
{
// Code size 25 (0x19)
.maxstack 2
IL_0000: ldc.i4.4
IL_0001: ldc.i4.2
IL_0002: newobj "myInterface(*,*)..ctor"
IL_0007: pop
IL_0008: ldc.i4.4
IL_0009: ldc.i4.2
IL_000a: newobj "Module1.myDelegate(*,*)..ctor"
IL_000f: pop
IL_0010: ldc.i4.1
IL_0011: ldc.i4.2
IL_0012: newobj "Integer(*,*)..ctor"
IL_0017: pop
IL_0018: ret
}
]]>)
End Sub
' Declaration multi- dimensional array
<Fact>
Public Sub DeclarationmultiDimensionalArray_3()
CompileAndVerify(
<compilation>
<file name="a.vb">
Class C1
Public Shared Sub Main()
Dim myLength As Integer = 3
Dim arr As Integer(,) = New Integer(myLength, 1) {}
End Sub
Private Class A
Private x As Integer = 1
Private arr As Integer(,) = New Integer(x, 4) {}
End Class
End Class
</file>
</compilation>).VerifyIL("C1.Main", <![CDATA[
{
// Code size 11 (0xb)
.maxstack 2
IL_0000: ldc.i4.3
IL_0001: ldc.i4.1
IL_0002: add.ovf
IL_0003: ldc.i4.2
IL_0004: newobj "Integer(*,*)..ctor"
IL_0009: pop
IL_000a: ret
}
]]>)
End Sub
' Declaration multi- dimensional array
<Fact>
Public Sub DeclarationmultiDimensionalArray_5()
CompileAndVerify(
<compilation>
<file name="a.vb">
Imports System
Module Module1
Sub Main()
Dim myArray8 As Integer(,) = New Integer(-1, 4) {}
Dim arrDouble#(,) = New Double(1, 2) {}
Dim arrDecimal@(,) = New Decimal(1, 2) {}
Dim arrString$(,) = New String(1, 2) {}
Dim arrInteger%(,) = New Integer(1, 2) {}
Dim arrLong&(,) = New Long(1, 2) {}
Dim arrSingle!(,) = New Single(1, 2) {}
End Sub
End Module
</file>
</compilation>).VerifyIL("Module1.Main", <![CDATA[
{
// Code size 57 (0x39)
.maxstack 2
IL_0000: ldc.i4.0
IL_0001: ldc.i4.5
IL_0002: newobj "Integer(*,*)..ctor"
IL_0007: pop
IL_0008: ldc.i4.2
IL_0009: ldc.i4.3
IL_000a: newobj "Double(*,*)..ctor"
IL_000f: pop
IL_0010: ldc.i4.2
IL_0011: ldc.i4.3
IL_0012: newobj "Decimal(*,*)..ctor"
IL_0017: pop
IL_0018: ldc.i4.2
IL_0019: ldc.i4.3
IL_001a: newobj "String(*,*)..ctor"
IL_001f: pop
IL_0020: ldc.i4.2
IL_0021: ldc.i4.3
IL_0022: newobj "Integer(*,*)..ctor"
IL_0027: pop
IL_0028: ldc.i4.2
IL_0029: ldc.i4.3
IL_002a: newobj "Long(*,*)..ctor"
IL_002f: pop
IL_0030: ldc.i4.2
IL_0031: ldc.i4.3
IL_0032: newobj "Single(*,*)..ctor"
IL_0037: pop
IL_0038: ret
}
]]>)
End Sub
' Initialize multi- dimensional array
<ConditionalFact(GetType(WindowsDesktopOnly), Reason:="https://github.com/dotnet/roslyn/issues/28044")>
Public Sub InitializemultiDimensionalArray()
CompileAndVerify(
<compilation>
<file name="a.vb">
Option Infer On
Imports System
Imports Microsoft.VisualBasic.Information
Module Module1
Sub Main()
Dim myArray1 As Integer(,,) = {{{0, 1}, {2, 3}}, {{4, 5}, {6, 7}}}
Dim myArray2 As Single(,) = New Single(2, 1) {{CSng(1.0), CSng(2.0)}, {CSng(3.0), CSng(4.0)}, {CSng(5.0), CSng(6.0)}}
Dim myArray3 As Long(,) = New Long(,) {{1, 2}, {3, 4}, {5, 6}}
Dim myArray4 As Char(,)
myArray4 = New Char(2, 1) {{"1"c, "2"c}, {"3"c, "4"c}, {"5"c, "6"c}}
Dim myArray5 As Decimal(,)
myArray5 = New Decimal(,) {{CDec(1.0), CDec(2.0)}, {CDec(3.0), CDec(4.0)}, {CDec(5.0), CDec(6.0)}}
Dim myArray6 As Integer(,) = New Integer(-1, -1) {}
Dim myArray7 As Integer(,) = New Integer(,) {{}}
Dim myArray8 As Integer(,,) = New Integer(,,) {{{}}}
Dim myArray9 As String(,) = New String(2, 1) {{"a"c, "b"c}, {"c"c, "d"c}, {"e"c, "f"c}}
Console.WriteLine(UBound(myArray1, 1))
Console.WriteLine(UBound(myArray1, 2))
Console.WriteLine(UBound(myArray1, 3))
Console.WriteLine(UBound(myArray2, 1))
Console.WriteLine(UBound(myArray2, 2))
Console.WriteLine(UBound(myArray3, 1))
Console.WriteLine(UBound(myArray3, 2))
Console.WriteLine(UBound(myArray4, 1))
Console.WriteLine(UBound(myArray4, 2))
Console.WriteLine(UBound(myArray5, 1))
Console.WriteLine(UBound(myArray5, 2))
Console.WriteLine(UBound(myArray6, 1))
Console.WriteLine(UBound(myArray6, 2))
Console.WriteLine(UBound(myArray7, 1))
Console.WriteLine(UBound(myArray7, 2))
Console.WriteLine(UBound(myArray8, 1))
Console.WriteLine(UBound(myArray8, 2))
Console.WriteLine(UBound(myArray8, 3))
Console.WriteLine(UBound(myArray9, 1))
Console.WriteLine(UBound(myArray9, 2))
End Sub
End Module
</file>
</compilation>, expectedOutput:=<![CDATA[1
1
1
2
1
2
1
2
1
2
1
-1
-1
0
-1
0
0
-1
2
1]]>)
End Sub
' Use different kinds of var as index upper bound
<Fact>
Public Sub DifferentVarAsBound()
CompileAndVerify(
<compilation>
<file name="a.vb">
Option Infer On
Imports Microsoft.VisualBasic.Information
Module Module1
Property prop As Integer
Sub Main(args As String())
Dim arr1(3, prop) As Integer
Dim arr2(3, fun()) As Integer
Dim x = fun()
Dim arr3(x, 1) As Integer
Dim z() As Integer
Dim y() As Integer
Dim replyCounts(,) As Short = New Short(UBound(z, 1), UBound(y, 1)) {}
End Sub
Function fun() As Integer
Return 3
End Function
Sub goo(x As Integer)
Dim arr1(3, x) As Integer
End Sub
End Module
</file>
</compilation>).VerifyIL("Module1.Main", <![CDATA[
{
// Code size 67 (0x43)
.maxstack 3
.locals init (Integer() V_0, //z
Integer() V_1) //y
IL_0000: ldc.i4.4
IL_0001: call "Function Module1.get_prop() As Integer"
IL_0006: ldc.i4.1
IL_0007: add.ovf
IL_0008: newobj "Integer(*,*)..ctor"
IL_000d: pop
IL_000e: ldc.i4.4
IL_000f: call "Function Module1.fun() As Integer"
IL_0014: ldc.i4.1
IL_0015: add.ovf
IL_0016: newobj "Integer(*,*)..ctor"
IL_001b: pop
IL_001c: call "Function Module1.fun() As Integer"
IL_0021: ldc.i4.1
IL_0022: add.ovf
IL_0023: ldc.i4.2
IL_0024: newobj "Integer(*,*)..ctor"
IL_0029: pop
IL_002a: ldloc.0
IL_002b: ldc.i4.1
IL_002c: call "Function Microsoft.VisualBasic.Information.UBound(System.Array, Integer) As Integer"
IL_0031: ldc.i4.1
IL_0032: add.ovf
IL_0033: ldloc.1
IL_0034: ldc.i4.1
IL_0035: call "Function Microsoft.VisualBasic.Information.UBound(System.Array, Integer) As Integer"
IL_003a: ldc.i4.1
IL_003b: add.ovf
IL_003c: newobj "Short(*,*)..ctor"
IL_0041: pop
IL_0042: ret
}
]]>)
End Sub
' Specify lower bound and up bound for multi-dimensional array
<Fact>
Public Sub SpecifyLowerAndUpBound()
CompileAndVerify(
<compilation>
<file name="a.vb">
Module Module1
Property prop As Integer
Sub Main(args As String())
Dim arr1(0 To 0, 0 To -1) As Integer
End Sub
End Module
</file>
</compilation>).VerifyIL("Module1.Main", <![CDATA[
{
// Code size 9 (0x9)
.maxstack 2
IL_0000: ldc.i4.1
IL_0001: ldc.i4.0
IL_0002: newobj "Integer(*,*)..ctor"
IL_0007: pop
IL_0008: ret
}
]]>)
End Sub
' Array creation expression can be part of an anonymous object creation expression
<ConditionalFact(GetType(WindowsDesktopOnly), Reason:="https://github.com/dotnet/roslyn/issues/28044")>
Public Sub ArrayCreateAsAnonymous()
CompileAndVerify(
<compilation>
<file name="a.vb">
Option Infer On
Imports System
Imports Microsoft.VisualBasic.Information
Module Module1
Sub Main(args As String())
Dim a0 = New With {
Key.b4 = New Integer(1, 2) {}, _
Key.b5 = New Integer(1, 1) {{1, 2}, {2, 3}},
Key.b6 = New Integer()() {New Integer(1) {}, New Integer(2) {}},
Key.b7 = New Integer(2)() {},
Key.b8 = New Integer(1)() {New Integer(0) {}, New Integer(1) {}},
Key.b9 = New Integer() {1, 2, 3},
Key.b10 = New Integer(,) {{1, 2}, {2, 3}}
}
Console.WriteLine(UBound(a0.b4, 1))
Console.WriteLine(UBound(a0.b4, 2))
Console.WriteLine(UBound(a0.b5, 1))
Console.WriteLine(UBound(a0.b5, 2))
Console.WriteLine(UBound(a0.b6, 1))
Console.WriteLine(UBound(a0.b7, 1))
Console.WriteLine(UBound(a0.b8, 1))
Console.WriteLine(UBound(a0.b9, 1))
Console.WriteLine(UBound(a0.b10, 1))
Console.WriteLine(UBound(a0.b10, 2))
End Sub
End Module
</file>
</compilation>, expectedOutput:=<![CDATA[1
2
1
1
1
2
1
2
1
1]]>)
End Sub
' Accessing an array's 0th element should work fine
<WorkItem(528752, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/528752")>
<Fact>
Public Sub AccessZero()
CompileAndVerify(
<compilation>
<file name="a.vb">
Imports System
Module Module1
Sub Main(args As String())
Dim arr As Integer(,) = New Integer(4, 4) {}
arr(0, 0) = 5
Console.WriteLine(arr(0, 0))
End Sub
End Module
</file>
</compilation>, expectedOutput:=<![CDATA[5]]>).VerifyIL("Module1.Main", <![CDATA[
{
// Code size 29 (0x1d)
.maxstack 5
IL_0000: ldc.i4.5
IL_0001: ldc.i4.5
IL_0002: newobj "Integer(*,*)..ctor"
IL_0007: dup
IL_0008: ldc.i4.0
IL_0009: ldc.i4.0
IL_000a: ldc.i4.5
IL_000b: call "Integer(*,*).Set"
IL_0010: ldc.i4.0
IL_0011: ldc.i4.0
IL_0012: call "Integer(*,*).Get"
IL_0017: call "Sub System.Console.WriteLine(Integer)"
IL_001c: ret
}
]]>)
End Sub
' Accessing an array's maxlength element should work fine
<WorkItem(528752, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/528752")>
<Fact>
Public Sub AccessMaxLength()
CompileAndVerify(
<compilation>
<file name="a.vb">
Imports System
Module Module1
Sub Main(args As String())
Dim arr As Integer(,) = New Integer(4, 3) {}
arr(4, 3) = 5
Console.WriteLine(arr(4, 3))
End Sub
End Module
</file>
</compilation>, expectedOutput:=<![CDATA[5]]>).VerifyIL("Module1.Main", <![CDATA[
{
// Code size 29 (0x1d)
.maxstack 5
IL_0000: ldc.i4.5
IL_0001: ldc.i4.4
IL_0002: newobj "Integer(*,*)..ctor"
IL_0007: dup
IL_0008: ldc.i4.4
IL_0009: ldc.i4.3
IL_000a: ldc.i4.5
IL_000b: call "Integer(*,*).Set"
IL_0010: ldc.i4.4
IL_0011: ldc.i4.3
IL_0012: call "Integer(*,*).Get"
IL_0017: call "Sub System.Console.WriteLine(Integer)"
IL_001c: ret
}
]]>)
End Sub
' Accessing an array's -1 element should throw an exception
<WorkItem(528752, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/528752")>
<Fact>
Public Sub AccessLessThanMin()
CompileAndVerify(
<compilation>
<file name="a.vb">
Imports System
Module Module1
Sub Main(args As String())
Dim arr As Integer(,) = New Integer(4, 4) {}
Try
arr(-1, 1) = 5
arr(1, -1) = 5
arr(-1, -1) = 5
Catch generatedExceptionName As System.IndexOutOfRangeException
End Try
End Sub
End Module
</file>
</compilation>).VerifyIL("Module1.Main", <![CDATA[
{
// Code size 52 (0x34)
.maxstack 4
.locals init (Integer(,) V_0, //arr
System.IndexOutOfRangeException V_1) //generatedExceptionName
IL_0000: ldc.i4.5
IL_0001: ldc.i4.5
IL_0002: newobj "Integer(*,*)..ctor"
IL_0007: stloc.0
.try
{
IL_0008: ldloc.0
IL_0009: ldc.i4.m1
IL_000a: ldc.i4.1
IL_000b: ldc.i4.5
IL_000c: call "Integer(*,*).Set"
IL_0011: ldloc.0
IL_0012: ldc.i4.1
IL_0013: ldc.i4.m1
IL_0014: ldc.i4.5
IL_0015: call "Integer(*,*).Set"
IL_001a: ldloc.0
IL_001b: ldc.i4.m1
IL_001c: ldc.i4.m1
IL_001d: ldc.i4.5
IL_001e: call "Integer(*,*).Set"
IL_0023: leave.s IL_0033
}
catch System.IndexOutOfRangeException
{
IL_0025: dup
IL_0026: call "Sub Microsoft.VisualBasic.CompilerServices.ProjectData.SetProjectError(System.Exception)"
IL_002b: stloc.1
IL_002c: call "Sub Microsoft.VisualBasic.CompilerServices.ProjectData.ClearProjectError()"
IL_0031: leave.s IL_0033
}
IL_0033: ret
}
]]>)
End Sub
' Accessing an array's maxlength+1 element should throw an exception
<WorkItem(528752, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/528752")>
<Fact>
Public Sub AccessGreaterThanMax()
CompileAndVerify(
<compilation>
<file name="a.vb">
Imports System
Module Module1
Sub Main(args As String())
Dim arr As Integer(,) = New Integer(4, 3) {}
Try
arr(5, 3) = 5
arr(4, 4) = 5
arr(5, 4) = 5
Catch
End Try
End Sub
End Module
</file>
</compilation>).VerifyIL("Module1.Main", <![CDATA[
{
// Code size 50 (0x32)
.maxstack 4
.locals init (Integer(,) V_0) //arr
IL_0000: ldc.i4.5
IL_0001: ldc.i4.4
IL_0002: newobj "Integer(*,*)..ctor"
IL_0007: stloc.0
.try
{
IL_0008: ldloc.0
IL_0009: ldc.i4.5
IL_000a: ldc.i4.3
IL_000b: ldc.i4.5
IL_000c: call "Integer(*,*).Set"
IL_0011: ldloc.0
IL_0012: ldc.i4.4
IL_0013: ldc.i4.4
IL_0014: ldc.i4.5
IL_0015: call "Integer(*,*).Set"
IL_001a: ldloc.0
IL_001b: ldc.i4.5
IL_001c: ldc.i4.4
IL_001d: ldc.i4.5
IL_001e: call "Integer(*,*).Set"
IL_0023: leave.s IL_0031
}
catch System.Exception
{
IL_0025: call "Sub Microsoft.VisualBasic.CompilerServices.ProjectData.SetProjectError(System.Exception)"
IL_002a: call "Sub Microsoft.VisualBasic.CompilerServices.ProjectData.ClearProjectError()"
IL_002f: leave.s IL_0031
}
IL_0031: ret
}
]]>)
End Sub
' Accessing an array's index with a variable of type int, short, byte should work
<WorkItem(528752, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/528752")>
<Fact>
Public Sub AccessWithDifferentType()
CompileAndVerify(
<compilation>
<file name="a.vb">
Option Infer On
Imports System
Module Module1
Sub Main(args As String())
Dim arr As Integer(,) = New Integer(4, 4) {}
Dim idx As Integer = 2
Dim idx1 As Byte = 1
Dim idx3 As Short = 4
Dim idx4 = 2.0
Dim idx5 As Long = 3L
arr(idx, 3) = 100
arr(idx1, 3) = 100
arr(idx3, 3) = 100
arr(cint(idx4), 3) = 100
arr(cint(idx5), 3) = 100
End Sub
End Module
</file>
</compilation>).VerifyIL("Module1.Main", <![CDATA[
{
// Code size 85 (0x55)
.maxstack 5
.locals init (Integer V_0, //idx
Byte V_1, //idx1
Short V_2, //idx3
Double V_3, //idx4
Long V_4) //idx5
IL_0000: ldc.i4.5
IL_0001: ldc.i4.5
IL_0002: newobj "Integer(*,*)..ctor"
IL_0007: ldc.i4.2
IL_0008: stloc.0
IL_0009: ldc.i4.1
IL_000a: stloc.1
IL_000b: ldc.i4.4
IL_000c: stloc.2
IL_000d: ldc.r8 2
IL_0016: stloc.3
IL_0017: ldc.i4.3
IL_0018: conv.i8
IL_0019: stloc.s V_4
IL_001b: dup
IL_001c: ldloc.0
IL_001d: ldc.i4.3
IL_001e: ldc.i4.s 100
IL_0020: call "Integer(*,*).Set"
IL_0025: dup
IL_0026: ldloc.1
IL_0027: ldc.i4.3
IL_0028: ldc.i4.s 100
IL_002a: call "Integer(*,*).Set"
IL_002f: dup
IL_0030: ldloc.2
IL_0031: ldc.i4.3
IL_0032: ldc.i4.s 100
IL_0034: call "Integer(*,*).Set"
IL_0039: dup
IL_003a: ldloc.3
IL_003b: call "Function System.Math.Round(Double) As Double"
IL_0040: conv.ovf.i4
IL_0041: ldc.i4.3
IL_0042: ldc.i4.s 100
IL_0044: call "Integer(*,*).Set"
IL_0049: ldloc.s V_4
IL_004b: conv.ovf.i4
IL_004c: ldc.i4.3
IL_004d: ldc.i4.s 100
IL_004f: call "Integer(*,*).Set"
IL_0054: ret
}
]]>)
End Sub
' Passing an element to a function as a byVal or byRef parameter should work
<WorkItem(528752, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/528752")>
<Fact>
Public Sub ArrayAsArgument()
CompileAndVerify(
<compilation>
<file name="a.vb">
Imports System
Module Module1
Sub Main(args As String())
Dim arr As Integer(,) = New Integer(,) {{1, 2}}
ElementTaker((arr(0, 1)))
Console.WriteLine(arr(0, 1))
ElementTaker(arr(0, 1))
Console.WriteLine(arr(0, 1))
End Sub
Public Function ElementTaker(ByRef val As Integer) As Integer
val = val + 5
Return val
End Function
End Module
</file>
</compilation>, expectedOutput:=<![CDATA[2
7]]>).VerifyIL("Module1.Main", <![CDATA[
{
// Code size 82 (0x52)
.maxstack 5
.locals init (Integer V_0)
IL_0000: ldc.i4.1
IL_0001: ldc.i4.2
IL_0002: newobj "Integer(*,*)..ctor"
IL_0007: dup
IL_0008: ldc.i4.0
IL_0009: ldc.i4.0
IL_000a: ldc.i4.1
IL_000b: call "Integer(*,*).Set"
IL_0010: dup
IL_0011: ldc.i4.0
IL_0012: ldc.i4.1
IL_0013: ldc.i4.2
IL_0014: call "Integer(*,*).Set"
IL_0019: dup
IL_001a: ldc.i4.0
IL_001b: ldc.i4.1
IL_001c: call "Integer(*,*).Get"
IL_0021: stloc.0
IL_0022: ldloca.s V_0
IL_0024: call "Function Module1.ElementTaker(ByRef Integer) As Integer"
IL_0029: pop
IL_002a: dup
IL_002b: ldc.i4.0
IL_002c: ldc.i4.1
IL_002d: call "Integer(*,*).Get"
IL_0032: call "Sub System.Console.WriteLine(Integer)"
IL_0037: dup
IL_0038: ldc.i4.0
IL_0039: ldc.i4.1
IL_003a: call "Integer(*,*).Address"
IL_003f: call "Function Module1.ElementTaker(ByRef Integer) As Integer"
IL_0044: pop
IL_0045: ldc.i4.0
IL_0046: ldc.i4.1
IL_0047: call "Integer(*,*).Get"
IL_004c: call "Sub System.Console.WriteLine(Integer)"
IL_0051: ret
}
]]>)
End Sub
' Passing an element to a function as a byVal or byRef parameter should work
<WorkItem(528752, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/528752")>
<Fact>
Public Sub ArrayAsArgument_1()
CompileAndVerify(
<compilation>
<file name="a.vb">
Imports System
Module Module1
Sub Main(args As String())
Dim arr As Integer(,) = New Integer(,) {{1, 2}}
ElementTaker(arr(0, 1))
Console.WriteLine(arr(0, 1))
End Sub
Public Function ElementTaker(ByVal val As Integer) As Integer
val = 5
Return val
End Function
End Module
</file>
</compilation>, expectedOutput:=<![CDATA[2]]>).VerifyIL("Module1.Main", <![CDATA[
{
// Code size 52 (0x34)
.maxstack 5
IL_0000: ldc.i4.1
IL_0001: ldc.i4.2
IL_0002: newobj "Integer(*,*)..ctor"
IL_0007: dup
IL_0008: ldc.i4.0
IL_0009: ldc.i4.0
IL_000a: ldc.i4.1
IL_000b: call "Integer(*,*).Set"
IL_0010: dup
IL_0011: ldc.i4.0
IL_0012: ldc.i4.1
IL_0013: ldc.i4.2
IL_0014: call "Integer(*,*).Set"
IL_0019: dup
IL_001a: ldc.i4.0
IL_001b: ldc.i4.1
IL_001c: call "Integer(*,*).Get"
IL_0021: call "Function Module1.ElementTaker(Integer) As Integer"
IL_0026: pop
IL_0027: ldc.i4.0
IL_0028: ldc.i4.1
IL_0029: call "Integer(*,*).Get"
IL_002e: call "Sub System.Console.WriteLine(Integer)"
IL_0033: ret
}
]]>)
End Sub
' Assigning nothing to an array variable
<WorkItem(528752, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/528752")>
<Fact>
Public Sub AssignNothingToArray()
CompileAndVerify(
<compilation>
<file name="a.vb">
Imports System
Module Module1
Public Sub Main()
Dim arr As Integer(,) = New Integer(0, 1) {{1, 2}}
Dim arr1 As Integer(,) = Nothing
arr = Nothing
arr(0, 1) = 3
arr1(0, 1) = 3
End Sub
End Module
</file>
</compilation>).VerifyIL("Module1.Main", <![CDATA[
{
// Code size 45 (0x2d)
.maxstack 5
IL_0000: ldc.i4.1
IL_0001: ldc.i4.2
IL_0002: newobj "Integer(*,*)..ctor"
IL_0007: dup
IL_0008: ldc.i4.0
IL_0009: ldc.i4.0
IL_000a: ldc.i4.1
IL_000b: call "Integer(*,*).Set"
IL_0010: dup
IL_0011: ldc.i4.0
IL_0012: ldc.i4.1
IL_0013: ldc.i4.2
IL_0014: call "Integer(*,*).Set"
IL_0019: pop
IL_001a: ldnull
IL_001b: ldnull
IL_001c: ldc.i4.0
IL_001d: ldc.i4.1
IL_001e: ldc.i4.3
IL_001f: call "Integer(*,*).Set"
IL_0024: ldc.i4.0
IL_0025: ldc.i4.1
IL_0026: ldc.i4.3
IL_0027: call "Integer(*,*).Set"
IL_002c: ret
}
]]>)
End Sub
' Assigning a smaller array to a bigger array or vice versa should work
<ConditionalFact(GetType(WindowsDesktopOnly), Reason:="https://github.com/dotnet/roslyn/issues/28044")>
Public Sub AssignArrayToArray()
CompileAndVerify(
<compilation>
<file name="a.vb">
Imports System
Imports Microsoft.VisualBasic.Information
Module Program
Public Sub Main()
Dim arr1 As Integer(,) = New Integer(4, 1) {{1, 2}, {3, 4}, {5, 6}, {8, 9}, {100, 1210}}
Dim arr2 As Integer(,) = New Integer(2, 1) {{6, 7}, {8, 1}, {2, 12}}
arr1 = arr2
Dim arr3 As Integer(,) = New Integer(1, 1) {{6, 7}, {9, 8}}
Dim arr4 As Integer(,) = New Integer(2, 2) {{1, 2, 3}, {4, 5, 6}, {8, 0, 2}}
arr3 = arr4
Console.WriteLine(UBound(arr1, 1))
Console.WriteLine(UBound(arr1, 2))
Console.WriteLine(UBound(arr2, 1))
Console.WriteLine(UBound(arr2, 2))
Console.WriteLine(UBound(arr3, 1))
Console.WriteLine(UBound(arr3, 2))
Console.WriteLine(UBound(arr4, 1))
Console.WriteLine(UBound(arr4, 2))
End Sub
End Module
</file>
</compilation>, expectedOutput:=<![CDATA[2
1
2
1
2
2
2
2]]>)
End Sub
' Access index by enum
<WorkItem(528752, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/528752")>
<Fact>
Public Sub AccessIndexByEnum()
CompileAndVerify(
<compilation>
<file name="a.vb">
Imports System
Module Module1
Public Sub Main()
Dim cube As Integer(,) = New Integer(1, 2) {}
cube(Number.One, Number.Two) = 1
Console.WriteLine(cube(Number.One, Number.Two))
End Sub
End Module
Enum Number
One
Two
End Enum
</file>
</compilation>, expectedOutput:=<![CDATA[1]]>).VerifyIL("Module1.Main", <![CDATA[
{
// Code size 29 (0x1d)
.maxstack 5
IL_0000: ldc.i4.2
IL_0001: ldc.i4.3
IL_0002: newobj "Integer(*,*)..ctor"
IL_0007: dup
IL_0008: ldc.i4.0
IL_0009: ldc.i4.1
IL_000a: ldc.i4.1
IL_000b: call "Integer(*,*).Set"
IL_0010: ldc.i4.0
IL_0011: ldc.i4.1
IL_0012: call "Integer(*,*).Get"
IL_0017: call "Sub System.Console.WriteLine(Integer)"
IL_001c: ret
}
]]>)
End Sub
' Assigning a struct variable to an element should work
<WorkItem(528752, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/528752")>
<Fact>
Public Sub AssigningStructToElement()
CompileAndVerify(
<compilation>
<file name="a.vb">
Imports System
Module Module1
Public Sub Main()
Dim arr As myStruct(,) = New myStruct(2, 1) {}
Dim ms As myStruct
ms.x = 4
ms.y = 5
arr(2, 0) = ms
End Sub
End Module
Structure myStruct
Public x As Integer
Public y As Integer
End Structure
</file>
</compilation>).VerifyIL("Module1.Main", <![CDATA[
{
// Code size 32 (0x20)
.maxstack 4
.locals init (myStruct V_0) //ms
IL_0000: ldc.i4.3
IL_0001: ldc.i4.2
IL_0002: newobj "myStruct(*,*)..ctor"
IL_0007: ldloca.s V_0
IL_0009: ldc.i4.4
IL_000a: stfld "myStruct.x As Integer"
IL_000f: ldloca.s V_0
IL_0011: ldc.i4.5
IL_0012: stfld "myStruct.y As Integer"
IL_0017: ldc.i4.2
IL_0018: ldc.i4.0
IL_0019: ldloc.0
IL_001a: call "myStruct(*,*).Set"
IL_001f: ret
}
]]>)
End Sub
' Using foreach on a multi-dimensional array
<WorkItem(528752, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/528752")>
<Fact>
Public Sub ForEachMultiDimensionalArray()
CompileAndVerify(
<compilation>
<file name="a.vb">
Imports System
Module Module1
Public Sub Main()
Dim arr As Integer(,,) = New Integer(,,) {{{1, 2}, {4, 5}}}
For Each i As Integer In arr
Console.WriteLine(i)
Next
End Sub
End Module
</file>
</compilation>, expectedOutput:=<![CDATA[1
2
4
5]]>)
End Sub
' Overload method by different dimension of array
<Fact>
Public Sub OverloadByDiffDimensionArray()
CompileAndVerify(
<compilation>
<file name="a.vb">
Module Program
Sub Main(args As String())
End Sub
Sub goo(ByRef arg(,,) As Integer)
End Sub
Sub goo(ByRef arg(,) As Integer)
End Sub
Sub goo(ByRef arg() As Integer)
End Sub
End Module
</file>
</compilation>).VerifyDiagnostics()
End Sub
' Multi-dimensional array args could not as entry point
<Fact()>
Public Sub MultidimensionalArgsAsEntryPoint()
CompileAndVerify(
<compilation>
<file name="a.vb">
Class B
Public Shared Sub Main(args As String(,))
End Sub
Public Shared Sub Main()
End Sub
End Class
Class M1
Public Shared Sub Main(args As String(,))
End Sub
End Class
</file>
</compilation>).VerifyDiagnostics()
End Sub
' Declare multi-dimensional and Jagged array
<ConditionalFact(GetType(WindowsDesktopOnly), Reason:="https://github.com/dotnet/roslyn/issues/28044")>
Public Sub MixedArray()
CompileAndVerify(
<compilation>
<file name="a.vb">
Imports Microsoft.VisualBasic.Information
Class program
Public Shared Sub Main()
Dim x = New Integer(,)() {}
Dim y(,)() As Byte = New Byte(,)() {{New Byte() {2, 1, 3}}, {New Byte() {3, 0}}}
System.Console.WriteLine(UBound(y, 1))
System.Console.WriteLine(UBound(y, 2))
End Sub
End Class
</file>
</compilation>, expectedOutput:=<![CDATA[1
0]]>)
End Sub
' Parse an Attribute instance that takes a generic type with a generic argument that is a multi-dimensional array
<Fact>
Public Sub Generic()
CompileAndVerify(
<compilation>
<file name="a.vb">
Imports System
<TypeAttribute(GetType(Program(Of [String])(,)))> _
Public Class Goo
End Class
Class Program(Of T)
End Class
Class TypeAttribute
Inherits Attribute
Public Sub New(value As Type)
End Sub
End Class
</file>
</compilation>).VerifyDiagnostics()
End Sub
<Fact()>
Public Sub MDArrayTypeRef()
Dim csCompilation = CreateCSharpCompilation("CS",
<![CDATA[
public class A
{
public static readonly string[,] dummy = new string[2, 2] { { "", "M" }, { "S", "SM" } };
}]]>,
compilationOptions:=New Microsoft.CodeAnalysis.CSharp.CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary))
csCompilation.VerifyDiagnostics()
Dim vbCompilation = CreateVisualBasicCompilation("VB",
<![CDATA[
Module Module1
Sub Main()
Dim x = A.dummy
System.Console.Writeline(x(1,1))
End Sub
End Module]]>,
compilationOptions:=New VisualBasicCompilationOptions(OutputKind.ConsoleApplication),
referencedCompilations:={csCompilation})
Dim vbVerifier = CompileAndVerify(vbCompilation,
expectedOutput:=<![CDATA[
SM
]]>)
vbVerifier.VerifyDiagnostics()
End Sub
End Class
End Namespace
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Compilers/Test/Core/Compilation/FlowAnalysis/BasicBlockReachabilityDataFlowAnalyzer.cs | // 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.
#nullable disable
using System.Diagnostics;
using System.Threading;
namespace Microsoft.CodeAnalysis.FlowAnalysis
{
internal sealed class BasicBlockReachabilityDataFlowAnalyzer : DataFlowAnalyzer<bool>
{
private BitVector _visited = BitVector.Empty;
private BasicBlockReachabilityDataFlowAnalyzer() { }
public static BitVector Run(ControlFlowGraph controlFlowGraph)
{
var analyzer = new BasicBlockReachabilityDataFlowAnalyzer();
_ = CustomDataFlowAnalysis<bool>.Run(controlFlowGraph, analyzer, CancellationToken.None);
return analyzer._visited;
}
// Do not analyze unreachable control flow branches and blocks.
// This way all blocks that are called back to be analyzed in AnalyzeBlock are reachable
// and the remaining blocks are unreachable.
public override bool AnalyzeUnreachableBlocks => false;
public override bool AnalyzeBlock(BasicBlock basicBlock, CancellationToken cancellationToken)
{
SetCurrentAnalysisData(basicBlock, isReachable: true, cancellationToken);
return true;
}
public override bool AnalyzeNonConditionalBranch(BasicBlock basicBlock, bool currentIsReachable, CancellationToken cancellationToken)
{
// Feasibility of control flow branches is analyzed by the core CustomDataFlowAnalysis
// walker. If it identifies a branch as infeasible, it never invokes
// this callback.
// Assert that we are on a reachable control flow path, and retain the current reachability.
Debug.Assert(currentIsReachable);
return currentIsReachable;
}
public override (bool fallThroughSuccessorData, bool conditionalSuccessorData) AnalyzeConditionalBranch(
BasicBlock basicBlock,
bool currentIsReachable,
CancellationToken cancellationToken)
{
// Feasibility of control flow branches is analyzed by the core CustomDataFlowAnalysis
// walker. If it identifies a branch as infeasible, it never invokes
// this callback.
// Assert that we are on a reachable control flow path, and retain the current reachability
// for both the destination blocks.
Debug.Assert(currentIsReachable);
return (currentIsReachable, currentIsReachable);
}
public override void SetCurrentAnalysisData(BasicBlock basicBlock, bool isReachable, CancellationToken cancellationToken)
{
_visited[basicBlock.Ordinal] = isReachable;
}
public override bool GetCurrentAnalysisData(BasicBlock basicBlock) => _visited[basicBlock.Ordinal];
// A basic block is considered unreachable by default.
public override bool GetEmptyAnalysisData() => false;
// Destination block is reachable if either of the predecessor blocks are reachable.
public override bool Merge(bool predecessor1IsReachable, bool predecessor2IsReachable, CancellationToken cancellationToken)
=> predecessor1IsReachable || predecessor2IsReachable;
public override bool IsEqual(bool isReachable1, bool isReachable2)
=> isReachable1 == isReachable2;
}
}
| // 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.
#nullable disable
using System.Diagnostics;
using System.Threading;
namespace Microsoft.CodeAnalysis.FlowAnalysis
{
internal sealed class BasicBlockReachabilityDataFlowAnalyzer : DataFlowAnalyzer<bool>
{
private BitVector _visited = BitVector.Empty;
private BasicBlockReachabilityDataFlowAnalyzer() { }
public static BitVector Run(ControlFlowGraph controlFlowGraph)
{
var analyzer = new BasicBlockReachabilityDataFlowAnalyzer();
_ = CustomDataFlowAnalysis<bool>.Run(controlFlowGraph, analyzer, CancellationToken.None);
return analyzer._visited;
}
// Do not analyze unreachable control flow branches and blocks.
// This way all blocks that are called back to be analyzed in AnalyzeBlock are reachable
// and the remaining blocks are unreachable.
public override bool AnalyzeUnreachableBlocks => false;
public override bool AnalyzeBlock(BasicBlock basicBlock, CancellationToken cancellationToken)
{
SetCurrentAnalysisData(basicBlock, isReachable: true, cancellationToken);
return true;
}
public override bool AnalyzeNonConditionalBranch(BasicBlock basicBlock, bool currentIsReachable, CancellationToken cancellationToken)
{
// Feasibility of control flow branches is analyzed by the core CustomDataFlowAnalysis
// walker. If it identifies a branch as infeasible, it never invokes
// this callback.
// Assert that we are on a reachable control flow path, and retain the current reachability.
Debug.Assert(currentIsReachable);
return currentIsReachable;
}
public override (bool fallThroughSuccessorData, bool conditionalSuccessorData) AnalyzeConditionalBranch(
BasicBlock basicBlock,
bool currentIsReachable,
CancellationToken cancellationToken)
{
// Feasibility of control flow branches is analyzed by the core CustomDataFlowAnalysis
// walker. If it identifies a branch as infeasible, it never invokes
// this callback.
// Assert that we are on a reachable control flow path, and retain the current reachability
// for both the destination blocks.
Debug.Assert(currentIsReachable);
return (currentIsReachable, currentIsReachable);
}
public override void SetCurrentAnalysisData(BasicBlock basicBlock, bool isReachable, CancellationToken cancellationToken)
{
_visited[basicBlock.Ordinal] = isReachable;
}
public override bool GetCurrentAnalysisData(BasicBlock basicBlock) => _visited[basicBlock.Ordinal];
// A basic block is considered unreachable by default.
public override bool GetEmptyAnalysisData() => false;
// Destination block is reachable if either of the predecessor blocks are reachable.
public override bool Merge(bool predecessor1IsReachable, bool predecessor2IsReachable, CancellationToken cancellationToken)
=> predecessor1IsReachable || predecessor2IsReachable;
public override bool IsEqual(bool isReachable1, bool isReachable2)
=> isReachable1 == isReachable2;
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/EditorFeatures/Core.Wpf/Interactive/InertClassifierProvider.cs | // 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.
#nullable disable
using System;
using System.ComponentModel.Composition;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Text.Shared.Extensions;
using Microsoft.VisualStudio.InteractiveWindow;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Classification;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Utilities;
namespace Microsoft.CodeAnalysis.Editor.Implementation.Interactive
{
/// <summary>
/// A classifier provider that caches the classification results from actual classifiers and
/// stores it on the text buffer so they can be used from that point on. Used for interactive
/// buffers that have been reset but which we still want to look good.
/// </summary>
[Export(typeof(IClassifierProvider))]
[TextViewRole(PredefinedInteractiveTextViewRoles.InteractiveTextViewRole)]
internal partial class InertClassifierProvider : IClassifierProvider
{
private static readonly object s_classificationsKey = new object();
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public InertClassifierProvider()
{
}
public IClassifier GetClassifier(ITextBuffer textBuffer)
=> new InertClassifier(textBuffer);
internal static void CaptureExistingClassificationSpans(
IViewClassifierAggregatorService classifierAggregator, ITextView textView, ITextBuffer textBuffer)
{
// No need to do this more than once.
if (textBuffer.Properties.ContainsProperty(s_classificationsKey))
{
return;
}
// Capture the existing set of classifications and attach them to the buffer as a
// property.
var classifier = classifierAggregator.GetClassifier(textView);
try
{
var classifications = classifier.GetClassificationSpans(textBuffer.CurrentSnapshot.GetFullSpan());
textBuffer.Properties.AddProperty(s_classificationsKey, classifications);
}
finally
{
if (classifier is IDisposable disposable)
{
disposable.Dispose();
}
}
}
}
}
| // 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.
#nullable disable
using System;
using System.ComponentModel.Composition;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Text.Shared.Extensions;
using Microsoft.VisualStudio.InteractiveWindow;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Classification;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Utilities;
namespace Microsoft.CodeAnalysis.Editor.Implementation.Interactive
{
/// <summary>
/// A classifier provider that caches the classification results from actual classifiers and
/// stores it on the text buffer so they can be used from that point on. Used for interactive
/// buffers that have been reset but which we still want to look good.
/// </summary>
[Export(typeof(IClassifierProvider))]
[TextViewRole(PredefinedInteractiveTextViewRoles.InteractiveTextViewRole)]
internal partial class InertClassifierProvider : IClassifierProvider
{
private static readonly object s_classificationsKey = new object();
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public InertClassifierProvider()
{
}
public IClassifier GetClassifier(ITextBuffer textBuffer)
=> new InertClassifier(textBuffer);
internal static void CaptureExistingClassificationSpans(
IViewClassifierAggregatorService classifierAggregator, ITextView textView, ITextBuffer textBuffer)
{
// No need to do this more than once.
if (textBuffer.Properties.ContainsProperty(s_classificationsKey))
{
return;
}
// Capture the existing set of classifications and attach them to the buffer as a
// property.
var classifier = classifierAggregator.GetClassifier(textView);
try
{
var classifications = classifier.GetClassificationSpans(textBuffer.CurrentSnapshot.GetFullSpan());
textBuffer.Properties.AddProperty(s_classificationsKey, classifications);
}
finally
{
if (classifier is IDisposable disposable)
{
disposable.Dispose();
}
}
}
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Compilers/CSharp/Portable/Symbols/Symbol_Attributes.cs | // 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.
#nullable disable
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using Microsoft.CodeAnalysis.CSharp.Symbols;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.PooledObjects;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.CSharp
{
internal partial class Symbol
{
/// <summary>
/// Gets the attributes for this symbol. Returns an empty <see cref="ImmutableArray<AttributeData>"/> if
/// there are no attributes.
/// </summary>
public virtual ImmutableArray<CSharpAttributeData> GetAttributes()
{
Debug.Assert(!(this is IAttributeTargetSymbol)); //such types must override
// Return an empty array by default.
// Sub-classes that can have custom attributes must
// override this method
return ImmutableArray<CSharpAttributeData>.Empty;
}
/// <summary>
/// Gets the attribute target kind corresponding to the symbol kind
/// If attributes cannot be applied to this symbol kind, returns
/// an invalid AttributeTargets value of 0
/// </summary>
/// <returns>AttributeTargets or 0</returns>
internal virtual AttributeTargets GetAttributeTarget()
{
switch (this.Kind)
{
case SymbolKind.Assembly:
return AttributeTargets.Assembly;
case SymbolKind.Field:
return AttributeTargets.Field;
case SymbolKind.Method:
var method = (MethodSymbol)this;
switch (method.MethodKind)
{
case MethodKind.Constructor:
case MethodKind.StaticConstructor:
return AttributeTargets.Constructor;
default:
return AttributeTargets.Method;
}
case SymbolKind.NamedType:
var namedType = (NamedTypeSymbol)this;
switch (namedType.TypeKind)
{
case TypeKind.Class:
return AttributeTargets.Class;
case TypeKind.Delegate:
return AttributeTargets.Delegate;
case TypeKind.Enum:
return AttributeTargets.Enum;
case TypeKind.Interface:
return AttributeTargets.Interface;
case TypeKind.Struct:
return AttributeTargets.Struct;
case TypeKind.TypeParameter:
return AttributeTargets.GenericParameter;
case TypeKind.Submission:
// attributes can't be applied on a submission type:
throw ExceptionUtilities.UnexpectedValue(namedType.TypeKind);
}
break;
case SymbolKind.NetModule:
return AttributeTargets.Module;
case SymbolKind.Parameter:
return AttributeTargets.Parameter;
case SymbolKind.Property:
return AttributeTargets.Property;
case SymbolKind.Event:
return AttributeTargets.Event;
case SymbolKind.TypeParameter:
return AttributeTargets.GenericParameter;
}
return 0;
}
/// <summary>
/// Method to early decode the type of well-known attribute which can be queried during the BindAttributeType phase.
/// This method is called first during attribute binding so that any attributes that affect semantics of type binding
/// can be decoded here.
/// </summary>
/// <remarks>
/// NOTE: If you are early decoding any new well-known attribute, make sure to update PostEarlyDecodeWellKnownAttributeTypes
/// to default initialize this data.
/// </remarks>
internal virtual void EarlyDecodeWellKnownAttributeType(NamedTypeSymbol attributeType, AttributeSyntax attributeSyntax)
{
}
/// <summary>
/// This method is called during attribute binding after EarlyDecodeWellKnownAttributeTypes has been executed.
/// Symbols should default initialize the data for early decoded well-known attributes here.
/// </summary>
internal virtual void PostEarlyDecodeWellKnownAttributeTypes()
{
}
/// <summary>
/// Method to early decode applied well-known attribute which can be queried by the binder.
/// This method is called during attribute binding after we have bound the attribute types for all attributes,
/// but haven't yet bound the attribute arguments/attribute constructor.
/// Early decoding certain well-known attributes enables the binder to use this decoded information on this symbol
/// when binding the attribute arguments/attribute constructor without causing attribute binding cycle.
/// </summary>
internal virtual CSharpAttributeData EarlyDecodeWellKnownAttribute(ref EarlyDecodeWellKnownAttributeArguments<EarlyWellKnownAttributeBinder, NamedTypeSymbol, AttributeSyntax, AttributeLocation> arguments)
{
return null;
}
internal static bool EarlyDecodeDeprecatedOrExperimentalOrObsoleteAttribute(
ref EarlyDecodeWellKnownAttributeArguments<EarlyWellKnownAttributeBinder, NamedTypeSymbol, AttributeSyntax, AttributeLocation> arguments,
out CSharpAttributeData attributeData,
out ObsoleteAttributeData obsoleteData)
{
var type = arguments.AttributeType;
var syntax = arguments.AttributeSyntax;
ObsoleteAttributeKind kind;
if (CSharpAttributeData.IsTargetEarlyAttribute(type, syntax, AttributeDescription.ObsoleteAttribute))
{
kind = ObsoleteAttributeKind.Obsolete;
}
else if (CSharpAttributeData.IsTargetEarlyAttribute(type, syntax, AttributeDescription.DeprecatedAttribute))
{
kind = ObsoleteAttributeKind.Deprecated;
}
else if (CSharpAttributeData.IsTargetEarlyAttribute(type, syntax, AttributeDescription.ExperimentalAttribute))
{
kind = ObsoleteAttributeKind.Experimental;
}
else
{
obsoleteData = null;
attributeData = null;
return false;
}
bool hasAnyDiagnostics;
attributeData = arguments.Binder.GetAttribute(syntax, type, out hasAnyDiagnostics);
if (!attributeData.HasErrors)
{
obsoleteData = attributeData.DecodeObsoleteAttribute(kind);
if (hasAnyDiagnostics)
{
attributeData = null;
}
}
else
{
obsoleteData = null;
attributeData = null;
}
return true;
}
/// <summary>
/// This method is called by the binder when it is finished binding a set of attributes on the symbol so that
/// the symbol can extract data from the attribute arguments and potentially perform validation specific to
/// some well known attributes.
/// <para>
/// NOTE: If we are decoding a well-known attribute that could be queried by the binder, consider decoding it during early decoding pass.
/// </para>
/// </summary>
/// <remarks>
/// <para>
/// Symbol types should override this if they want to handle a specific well-known attribute.
/// If the attribute is of a type that the symbol does not wish to handle, it should delegate back to
/// this (base) method.
/// </para>
/// </remarks>
internal virtual void DecodeWellKnownAttribute(ref DecodeWellKnownAttributeArguments<AttributeSyntax, CSharpAttributeData, AttributeLocation> arguments)
{
}
/// <summary>
/// Called to report attribute related diagnostics after all attributes have been bound and decoded.
/// Called even if there are no attributes.
/// </summary>
/// <remarks>
/// This method is called by the binder from <see cref="LoadAndValidateAttributes"/> after it has finished binding attributes on the symbol,
/// has executed <see cref="DecodeWellKnownAttribute"/> for attributes applied on the symbol and has stored the decoded data in the
/// lazyCustomAttributesBag on the symbol. Bound attributes haven't been stored on the bag yet.
///
/// Post-validation for attributes that is dependent on other attributes can be done here.
///
/// This method should not have any side effects on the symbol, i.e. it SHOULD NOT change the symbol state.
/// </remarks>
/// <param name="boundAttributes">Bound attributes.</param>
/// <param name="allAttributeSyntaxNodes">Syntax nodes of attributes in order they are specified in source, or null if there are no attributes.</param>
/// <param name="diagnostics">Diagnostic bag.</param>
/// <param name="symbolPart">Specific part of the symbol to which the attributes apply, or <see cref="AttributeLocation.None"/> if the attributes apply to the symbol itself.</param>
/// <param name="decodedData">Decoded well-known attribute data, could be null.</param>
internal virtual void PostDecodeWellKnownAttributes(ImmutableArray<CSharpAttributeData> boundAttributes, ImmutableArray<AttributeSyntax> allAttributeSyntaxNodes, BindingDiagnosticBag diagnostics, AttributeLocation symbolPart, WellKnownAttributeData decodedData)
{
}
/// <summary>
/// This method does the following set of operations in the specified order:
/// (1) GetAttributesToBind: Merge attributes from the given attributesSyntaxLists and filter out attributes by attribute target.
/// (2) BindAttributeTypes: Bind all the attribute types to enable early decode of certain well-known attributes by type.
/// (3) EarlyDecodeWellKnownAttributes: Perform early decoding of certain well-known attributes that could be queried by the binder in subsequent steps.
/// (NOTE: This step has the side effect of updating the symbol state based on the data extracted from well known attributes).
/// (4) GetAttributes: Bind the attributes (attribute arguments and constructor) using bound attribute types.
/// (5) DecodeWellKnownAttributes: Decode and validate bound well known attributes.
/// (NOTE: This step has the side effect of updating the symbol state based on the data extracted from well known attributes).
/// (6) StoreBoundAttributesAndDoPostValidation:
/// (a) Store the bound attributes in lazyCustomAttributes in a thread safe manner.
/// (b) Perform some additional post attribute validations, such as
/// 1) Duplicate attributes, attribute usage target validation, etc.
/// 2) Post validation for attributes dependent on other attributes
/// These validations cannot be performed prior to step 6(a) as we might need to
/// perform a GetAttributes() call on a symbol which can introduce a cycle in attribute binding.
/// We avoid this cycle by performing such validations in PostDecodeWellKnownAttributes after lazyCustomAttributes have been set.
/// NOTE: PostDecodeWellKnownAttributes SHOULD NOT change the symbol state.
/// </summary>
/// <remarks>
/// Current design of early decoding well-known attributes doesn't permit decoding attribute arguments/constructor as this can lead to binding cycles.
/// For well-known attributes used by the binder, where we need the decoded arguments, we must handle them specially in one of the following possible ways:
/// (a) Avoid decoding the attribute arguments during binding and delay the corresponding binder tasks to a separate post-pass executed after binding.
/// (b) As the cycles can be caused only when we are binding attribute arguments/constructor, special case the corresponding binder tasks based on the current BinderFlags.
/// </remarks>
/// <param name="attributesSyntaxLists"></param>
/// <param name="lazyCustomAttributesBag"></param>
/// <param name="symbolPart">Specific part of the symbol to which the attributes apply, or <see cref="AttributeLocation.None"/> if the attributes apply to the symbol itself.</param>
/// <param name="earlyDecodingOnly">Indicates that only early decoding should be performed. WARNING: the resulting bag will not be sealed.</param>
/// <param name="binderOpt">Binder to use. If null, <see cref="DeclaringCompilation"/> GetBinderFactory will be used.</param>
/// <param name="attributeMatchesOpt">If specified, only load attributes that match this predicate, and any diagnostics produced will be dropped.</param>
/// <returns>Flag indicating whether lazyCustomAttributes were stored on this thread. Caller should check for this flag and perform NotePartComplete if true.</returns>
internal bool LoadAndValidateAttributes(
OneOrMany<SyntaxList<AttributeListSyntax>> attributesSyntaxLists,
ref CustomAttributesBag<CSharpAttributeData> lazyCustomAttributesBag,
AttributeLocation symbolPart = AttributeLocation.None,
bool earlyDecodingOnly = false,
Binder binderOpt = null,
Func<AttributeSyntax, bool> attributeMatchesOpt = null)
{
var diagnostics = BindingDiagnosticBag.GetInstance();
var compilation = this.DeclaringCompilation;
ImmutableArray<Binder> binders;
ImmutableArray<AttributeSyntax> attributesToBind = this.GetAttributesToBind(attributesSyntaxLists, symbolPart, diagnostics, compilation, attributeMatchesOpt, binderOpt, out binders);
Debug.Assert(!attributesToBind.IsDefault);
ImmutableArray<CSharpAttributeData> boundAttributes;
WellKnownAttributeData wellKnownAttributeData;
if (attributesToBind.Any())
{
Debug.Assert(!binders.IsDefault);
Debug.Assert(binders.Length == attributesToBind.Length);
// Initialize the bag so that data decoded from early attributes can be stored onto it.
if (lazyCustomAttributesBag == null)
{
Interlocked.CompareExchange(ref lazyCustomAttributesBag, new CustomAttributesBag<CSharpAttributeData>(), null);
}
// Bind the attribute types and then early decode them.
int totalAttributesCount = attributesToBind.Length;
var attributeTypesBuilder = new NamedTypeSymbol[totalAttributesCount];
Binder.BindAttributeTypes(binders, attributesToBind, this, attributeTypesBuilder, diagnostics);
for (var i = 0; i < totalAttributesCount; i++)
{
if (attributeTypesBuilder[i].IsGenericType)
{
MessageID.IDS_FeatureGenericAttributes.CheckFeatureAvailability(diagnostics, attributesToBind[i]);
}
}
ImmutableArray<NamedTypeSymbol> boundAttributeTypes = attributeTypesBuilder.AsImmutableOrNull();
this.EarlyDecodeWellKnownAttributeTypes(boundAttributeTypes, attributesToBind);
this.PostEarlyDecodeWellKnownAttributeTypes();
// Bind the attribute in two stages - early and normal.
var attributesBuilder = new CSharpAttributeData[totalAttributesCount];
// Early bind and decode some well-known attributes.
EarlyWellKnownAttributeData earlyData = this.EarlyDecodeWellKnownAttributes(binders, boundAttributeTypes, attributesToBind, symbolPart, attributesBuilder);
Debug.Assert(!attributesBuilder.Contains((attr) => attr != null && attr.HasErrors));
// Store data decoded from early bound well-known attributes.
// TODO: what if this succeeds on another thread, not ours?
lazyCustomAttributesBag.SetEarlyDecodedWellKnownAttributeData(earlyData);
if (earlyDecodingOnly)
{
diagnostics.Free(); //NOTE: dropped.
return false;
}
// Bind attributes.
Binder.GetAttributes(binders, attributesToBind, boundAttributeTypes, attributesBuilder, diagnostics);
boundAttributes = attributesBuilder.AsImmutableOrNull();
// All attributes must be bound by now.
Debug.Assert(!boundAttributes.Any((attr) => attr == null));
// Validate attribute usage and Decode remaining well-known attributes.
wellKnownAttributeData = this.ValidateAttributeUsageAndDecodeWellKnownAttributes(binders, attributesToBind, boundAttributes, diagnostics, symbolPart);
// Store data decoded from remaining well-known attributes.
// TODO: what if this succeeds on another thread but not this thread?
lazyCustomAttributesBag.SetDecodedWellKnownAttributeData(wellKnownAttributeData);
}
else if (earlyDecodingOnly)
{
diagnostics.Free(); //NOTE: dropped.
return false;
}
else
{
boundAttributes = ImmutableArray<CSharpAttributeData>.Empty;
wellKnownAttributeData = null;
Interlocked.CompareExchange(ref lazyCustomAttributesBag, CustomAttributesBag<CSharpAttributeData>.WithEmptyData(), null);
this.PostEarlyDecodeWellKnownAttributeTypes();
}
this.PostDecodeWellKnownAttributes(boundAttributes, attributesToBind, diagnostics, symbolPart, wellKnownAttributeData);
// Store attributes into the bag.
bool lazyAttributesStoredOnThisThread = false;
if (lazyCustomAttributesBag.SetAttributes(boundAttributes))
{
if (attributeMatchesOpt is null)
{
this.RecordPresenceOfBadAttributes(boundAttributes);
AddDeclarationDiagnostics(diagnostics);
}
lazyAttributesStoredOnThisThread = true;
if (lazyCustomAttributesBag.IsEmpty) lazyCustomAttributesBag = CustomAttributesBag<CSharpAttributeData>.Empty;
}
Debug.Assert(lazyCustomAttributesBag.IsSealed);
diagnostics.Free();
return lazyAttributesStoredOnThisThread;
}
private void RecordPresenceOfBadAttributes(ImmutableArray<CSharpAttributeData> boundAttributes)
{
foreach (var attribute in boundAttributes)
{
if (attribute.HasErrors)
{
CSharpCompilation compilation = this.DeclaringCompilation;
Debug.Assert(compilation != null);
((SourceModuleSymbol)compilation.SourceModule).RecordPresenceOfBadAttributes();
break;
}
}
}
/// <summary>
/// Method to merge attributes from the given attributesSyntaxLists and filter out attributes by attribute target.
/// This is the first step in attribute binding.
/// </summary>
/// <remarks>
/// This method can generate diagnostics for few cases where we have an invalid target specifier and the parser hasn't generated the necessary diagnostics.
/// It should not perform any bind operations as it can lead to an attribute binding cycle.
/// </remarks>
private ImmutableArray<AttributeSyntax> GetAttributesToBind(
OneOrMany<SyntaxList<AttributeListSyntax>> attributeDeclarationSyntaxLists,
AttributeLocation symbolPart,
BindingDiagnosticBag diagnostics,
CSharpCompilation compilation,
Func<AttributeSyntax, bool> attributeMatchesOpt,
Binder rootBinderOpt,
out ImmutableArray<Binder> binders)
{
var attributeTarget = (IAttributeTargetSymbol)this;
ArrayBuilder<AttributeSyntax> syntaxBuilder = null;
ArrayBuilder<Binder> bindersBuilder = null;
int attributesToBindCount = 0;
for (int listIndex = 0; listIndex < attributeDeclarationSyntaxLists.Count; listIndex++)
{
var attributeDeclarationSyntaxList = attributeDeclarationSyntaxLists[listIndex];
if (attributeDeclarationSyntaxList.Any())
{
int prevCount = attributesToBindCount;
foreach (var attributeDeclarationSyntax in attributeDeclarationSyntaxList)
{
// We bind the attribute only if it has a matching target for the given ownerSymbol and attributeLocation.
if (MatchAttributeTarget(attributeTarget, symbolPart, attributeDeclarationSyntax.Target, diagnostics))
{
if (syntaxBuilder == null)
{
syntaxBuilder = new ArrayBuilder<AttributeSyntax>();
bindersBuilder = new ArrayBuilder<Binder>();
}
var attributesToBind = attributeDeclarationSyntax.Attributes;
if (attributeMatchesOpt is null)
{
syntaxBuilder.AddRange(attributesToBind);
attributesToBindCount += attributesToBind.Count;
}
else
{
foreach (var attribute in attributesToBind)
{
if (attributeMatchesOpt(attribute))
{
syntaxBuilder.Add(attribute);
attributesToBindCount++;
}
}
}
}
}
if (attributesToBindCount != prevCount)
{
Debug.Assert(attributeDeclarationSyntaxList.Node != null);
Debug.Assert(bindersBuilder != null);
var syntaxTree = attributeDeclarationSyntaxList.Node.SyntaxTree;
var binder = rootBinderOpt ?? compilation.GetBinderFactory(syntaxTree).GetBinder(attributeDeclarationSyntaxList.Node);
binder = new ContextualAttributeBinder(binder, this);
Debug.Assert(!binder.InAttributeArgument || this is MethodSymbol { MethodKind: MethodKind.LambdaMethod }, "Possible cycle in attribute binding");
for (int i = 0; i < attributesToBindCount - prevCount; i++)
{
bindersBuilder.Add(binder);
}
}
}
}
if (syntaxBuilder != null)
{
binders = bindersBuilder.ToImmutableAndFree();
return syntaxBuilder.ToImmutableAndFree();
}
else
{
binders = ImmutableArray<Binder>.Empty;
return ImmutableArray<AttributeSyntax>.Empty;
}
}
private static bool MatchAttributeTarget(IAttributeTargetSymbol attributeTarget, AttributeLocation symbolPart, AttributeTargetSpecifierSyntax targetOpt, BindingDiagnosticBag diagnostics)
{
IAttributeTargetSymbol attributesOwner = attributeTarget.AttributesOwner;
// Determine if the target symbol owns the attribute declaration.
// We need to report diagnostics only once, so do it when visiting attributes for the owner.
bool isOwner = symbolPart == AttributeLocation.None && ReferenceEquals(attributesOwner, attributeTarget);
if (targetOpt == null)
{
// only attributes with an explicit target match if the symbol doesn't own the attributes:
return isOwner;
}
AttributeLocation allowedTargets = attributesOwner.AllowedAttributeLocations;
AttributeLocation explicitTarget = targetOpt.GetAttributeLocation();
if (explicitTarget == AttributeLocation.None)
{
// error: unknown attribute location
if (isOwner)
{
//NOTE: ValueText so that we accept targets like "@return", to match dev10 (DevDiv #2591).
diagnostics.Add(ErrorCode.WRN_InvalidAttributeLocation,
targetOpt.Identifier.GetLocation(), targetOpt.Identifier.ValueText, allowedTargets.ToDisplayString());
}
return false;
}
if ((explicitTarget & allowedTargets) == 0)
{
// error: invalid target for symbol
if (isOwner)
{
if (allowedTargets == AttributeLocation.None)
{
switch (attributeTarget.DefaultAttributeLocation)
{
case AttributeLocation.Assembly:
case AttributeLocation.Module:
// global attributes are disallowed in interactive code:
diagnostics.Add(ErrorCode.ERR_GlobalAttributesNotAllowed, targetOpt.Identifier.GetLocation());
break;
default:
// currently this can't happen
throw ExceptionUtilities.UnexpectedValue(attributeTarget.DefaultAttributeLocation);
}
}
else
{
diagnostics.Add(ErrorCode.WRN_AttributeLocationOnBadDeclaration,
targetOpt.Identifier.GetLocation(), targetOpt.Identifier.ToString(), allowedTargets.ToDisplayString());
}
}
return false;
}
if (symbolPart == AttributeLocation.None)
{
return explicitTarget == attributeTarget.DefaultAttributeLocation;
}
else
{
return explicitTarget == symbolPart;
}
}
/// <summary>
/// Method to early decode certain well-known attributes which can be queried by the binder.
/// This method is called during attribute binding after we have bound the attribute types for all attributes,
/// but haven't yet bound the attribute arguments/attribute constructor.
/// Early decoding certain well-known attributes enables the binder to use this decoded information on this symbol
/// when binding the attribute arguments/attribute constructor without causing attribute binding cycle.
/// </summary>
internal EarlyWellKnownAttributeData EarlyDecodeWellKnownAttributes(
ImmutableArray<Binder> binders,
ImmutableArray<NamedTypeSymbol> boundAttributeTypes,
ImmutableArray<AttributeSyntax> attributesToBind,
AttributeLocation symbolPart,
CSharpAttributeData[] boundAttributesBuilder)
{
Debug.Assert(boundAttributeTypes.Any());
Debug.Assert(attributesToBind.Any());
Debug.Assert(binders.Any());
Debug.Assert(boundAttributesBuilder != null);
Debug.Assert(!boundAttributesBuilder.Contains((attr) => attr != null));
var earlyBinder = new EarlyWellKnownAttributeBinder(binders[0]);
var arguments = new EarlyDecodeWellKnownAttributeArguments<EarlyWellKnownAttributeBinder, NamedTypeSymbol, AttributeSyntax, AttributeLocation>();
arguments.SymbolPart = symbolPart;
for (int i = 0; i < boundAttributeTypes.Length; i++)
{
NamedTypeSymbol boundAttributeType = boundAttributeTypes[i];
if (!boundAttributeType.IsErrorType())
{
if (binders[i] != earlyBinder.Next)
{
earlyBinder = new EarlyWellKnownAttributeBinder(binders[i]);
}
arguments.Binder = earlyBinder;
arguments.AttributeType = boundAttributeType;
arguments.AttributeSyntax = attributesToBind[i];
// Early bind some well-known attributes
CSharpAttributeData earlyBoundAttributeOpt = this.EarlyDecodeWellKnownAttribute(ref arguments);
Debug.Assert(earlyBoundAttributeOpt == null || !earlyBoundAttributeOpt.HasErrors);
boundAttributesBuilder[i] = earlyBoundAttributeOpt;
}
}
return arguments.HasDecodedData ? arguments.DecodedData : null;
}
private void EarlyDecodeWellKnownAttributeTypes(ImmutableArray<NamedTypeSymbol> attributeTypes, ImmutableArray<AttributeSyntax> attributeSyntaxList)
{
Debug.Assert(attributeSyntaxList.Any());
Debug.Assert(attributeTypes.Any());
for (int i = 0; i < attributeTypes.Length; i++)
{
var attributeType = attributeTypes[i];
if (!attributeType.IsErrorType())
{
this.EarlyDecodeWellKnownAttributeType(attributeType, attributeSyntaxList[i]);
}
}
}
/// <summary>
/// This method validates attribute usage for each bound attribute and calls <see cref="DecodeWellKnownAttribute"/>
/// on attributes with valid attribute usage.
/// This method is called by the binder when it is finished binding a set of attributes on the symbol so that
/// the symbol can extract data from the attribute arguments and potentially perform validation specific to
/// some well known attributes.
/// </summary>
private WellKnownAttributeData ValidateAttributeUsageAndDecodeWellKnownAttributes(
ImmutableArray<Binder> binders,
ImmutableArray<AttributeSyntax> attributeSyntaxList,
ImmutableArray<CSharpAttributeData> boundAttributes,
BindingDiagnosticBag diagnostics,
AttributeLocation symbolPart)
{
Debug.Assert(binders.Any());
Debug.Assert(attributeSyntaxList.Any());
Debug.Assert(boundAttributes.Any());
Debug.Assert(binders.Length == boundAttributes.Length);
Debug.Assert(attributeSyntaxList.Length == boundAttributes.Length);
int totalAttributesCount = boundAttributes.Length;
HashSet<NamedTypeSymbol> uniqueAttributeTypes = new HashSet<NamedTypeSymbol>();
var arguments = new DecodeWellKnownAttributeArguments<AttributeSyntax, CSharpAttributeData, AttributeLocation>();
arguments.Diagnostics = diagnostics;
arguments.AttributesCount = totalAttributesCount;
arguments.SymbolPart = symbolPart;
for (int i = 0; i < totalAttributesCount; i++)
{
CSharpAttributeData boundAttribute = boundAttributes[i];
AttributeSyntax attributeSyntax = attributeSyntaxList[i];
Binder binder = binders[i];
// Decode attribute as a possible well-known attribute only if it has no binding errors and has valid AttributeUsage.
if (!boundAttribute.HasErrors && ValidateAttributeUsage(boundAttribute, attributeSyntax, binder.Compilation, symbolPart, diagnostics, uniqueAttributeTypes))
{
arguments.Attribute = boundAttribute;
arguments.AttributeSyntaxOpt = attributeSyntax;
arguments.Index = i;
this.DecodeWellKnownAttribute(ref arguments);
}
}
return arguments.HasDecodedData ? arguments.DecodedData : null;
}
/// <summary>
/// Validate attribute usage target and duplicate attributes.
/// </summary>
/// <param name="attribute">Bound attribute</param>
/// <param name="node">Syntax node for attribute specification</param>
/// <param name="compilation">Compilation</param>
/// <param name="symbolPart">Symbol part to which the attribute has been applied.</param>
/// <param name="diagnostics">Diagnostics</param>
/// <param name="uniqueAttributeTypes">Set of unique attribute types applied to the symbol</param>
private bool ValidateAttributeUsage(
CSharpAttributeData attribute,
AttributeSyntax node,
CSharpCompilation compilation,
AttributeLocation symbolPart,
BindingDiagnosticBag diagnostics,
HashSet<NamedTypeSymbol> uniqueAttributeTypes)
{
Debug.Assert(!attribute.HasErrors);
NamedTypeSymbol attributeType = attribute.AttributeClass;
AttributeUsageInfo attributeUsageInfo = attributeType.GetAttributeUsageInfo();
// Given attribute can't be specified more than once if AllowMultiple is false.
if (!uniqueAttributeTypes.Add(attributeType.OriginalDefinition) && !attributeUsageInfo.AllowMultiple)
{
diagnostics.Add(ErrorCode.ERR_DuplicateAttribute, node.Name.Location, node.GetErrorDisplayName());
return false;
}
// Verify if the attribute type can be applied to given owner symbol.
AttributeTargets attributeTarget;
if (symbolPart == AttributeLocation.Return)
{
// attribute on return type
Debug.Assert(this.Kind == SymbolKind.Method);
attributeTarget = AttributeTargets.ReturnValue;
}
else
{
attributeTarget = this.GetAttributeTarget();
}
if ((attributeTarget & attributeUsageInfo.ValidTargets) == 0)
{
// generate error
diagnostics.Add(ErrorCode.ERR_AttributeOnBadSymbolType, node.Name.Location, node.GetErrorDisplayName(), attributeUsageInfo.GetValidTargetsErrorArgument());
return false;
}
if (attribute.IsSecurityAttribute(compilation))
{
switch (this.Kind)
{
case SymbolKind.Assembly:
case SymbolKind.NamedType:
case SymbolKind.Method:
break;
default:
// CS7070: Security attribute '{0}' is not valid on this declaration type. Security attributes are only valid on assembly, type and method declarations.
diagnostics.Add(ErrorCode.ERR_SecurityAttributeInvalidTarget, node.Name.Location, node.GetErrorDisplayName());
return false;
}
}
return true;
}
/// <summary>
/// Ensure that attributes are bound and the ObsoleteState of this symbol is known.
/// </summary>
internal void ForceCompleteObsoleteAttribute()
{
if (this.ObsoleteState == ThreeState.Unknown)
{
this.GetAttributes();
}
Debug.Assert(this.ObsoleteState != ThreeState.Unknown, "ObsoleteState should be true or false now.");
}
}
}
| // 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.
#nullable disable
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using Microsoft.CodeAnalysis.CSharp.Symbols;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.PooledObjects;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.CSharp
{
internal partial class Symbol
{
/// <summary>
/// Gets the attributes for this symbol. Returns an empty <see cref="ImmutableArray<AttributeData>"/> if
/// there are no attributes.
/// </summary>
public virtual ImmutableArray<CSharpAttributeData> GetAttributes()
{
Debug.Assert(!(this is IAttributeTargetSymbol)); //such types must override
// Return an empty array by default.
// Sub-classes that can have custom attributes must
// override this method
return ImmutableArray<CSharpAttributeData>.Empty;
}
/// <summary>
/// Gets the attribute target kind corresponding to the symbol kind
/// If attributes cannot be applied to this symbol kind, returns
/// an invalid AttributeTargets value of 0
/// </summary>
/// <returns>AttributeTargets or 0</returns>
internal virtual AttributeTargets GetAttributeTarget()
{
switch (this.Kind)
{
case SymbolKind.Assembly:
return AttributeTargets.Assembly;
case SymbolKind.Field:
return AttributeTargets.Field;
case SymbolKind.Method:
var method = (MethodSymbol)this;
switch (method.MethodKind)
{
case MethodKind.Constructor:
case MethodKind.StaticConstructor:
return AttributeTargets.Constructor;
default:
return AttributeTargets.Method;
}
case SymbolKind.NamedType:
var namedType = (NamedTypeSymbol)this;
switch (namedType.TypeKind)
{
case TypeKind.Class:
return AttributeTargets.Class;
case TypeKind.Delegate:
return AttributeTargets.Delegate;
case TypeKind.Enum:
return AttributeTargets.Enum;
case TypeKind.Interface:
return AttributeTargets.Interface;
case TypeKind.Struct:
return AttributeTargets.Struct;
case TypeKind.TypeParameter:
return AttributeTargets.GenericParameter;
case TypeKind.Submission:
// attributes can't be applied on a submission type:
throw ExceptionUtilities.UnexpectedValue(namedType.TypeKind);
}
break;
case SymbolKind.NetModule:
return AttributeTargets.Module;
case SymbolKind.Parameter:
return AttributeTargets.Parameter;
case SymbolKind.Property:
return AttributeTargets.Property;
case SymbolKind.Event:
return AttributeTargets.Event;
case SymbolKind.TypeParameter:
return AttributeTargets.GenericParameter;
}
return 0;
}
/// <summary>
/// Method to early decode the type of well-known attribute which can be queried during the BindAttributeType phase.
/// This method is called first during attribute binding so that any attributes that affect semantics of type binding
/// can be decoded here.
/// </summary>
/// <remarks>
/// NOTE: If you are early decoding any new well-known attribute, make sure to update PostEarlyDecodeWellKnownAttributeTypes
/// to default initialize this data.
/// </remarks>
internal virtual void EarlyDecodeWellKnownAttributeType(NamedTypeSymbol attributeType, AttributeSyntax attributeSyntax)
{
}
/// <summary>
/// This method is called during attribute binding after EarlyDecodeWellKnownAttributeTypes has been executed.
/// Symbols should default initialize the data for early decoded well-known attributes here.
/// </summary>
internal virtual void PostEarlyDecodeWellKnownAttributeTypes()
{
}
/// <summary>
/// Method to early decode applied well-known attribute which can be queried by the binder.
/// This method is called during attribute binding after we have bound the attribute types for all attributes,
/// but haven't yet bound the attribute arguments/attribute constructor.
/// Early decoding certain well-known attributes enables the binder to use this decoded information on this symbol
/// when binding the attribute arguments/attribute constructor without causing attribute binding cycle.
/// </summary>
internal virtual CSharpAttributeData EarlyDecodeWellKnownAttribute(ref EarlyDecodeWellKnownAttributeArguments<EarlyWellKnownAttributeBinder, NamedTypeSymbol, AttributeSyntax, AttributeLocation> arguments)
{
return null;
}
internal static bool EarlyDecodeDeprecatedOrExperimentalOrObsoleteAttribute(
ref EarlyDecodeWellKnownAttributeArguments<EarlyWellKnownAttributeBinder, NamedTypeSymbol, AttributeSyntax, AttributeLocation> arguments,
out CSharpAttributeData attributeData,
out ObsoleteAttributeData obsoleteData)
{
var type = arguments.AttributeType;
var syntax = arguments.AttributeSyntax;
ObsoleteAttributeKind kind;
if (CSharpAttributeData.IsTargetEarlyAttribute(type, syntax, AttributeDescription.ObsoleteAttribute))
{
kind = ObsoleteAttributeKind.Obsolete;
}
else if (CSharpAttributeData.IsTargetEarlyAttribute(type, syntax, AttributeDescription.DeprecatedAttribute))
{
kind = ObsoleteAttributeKind.Deprecated;
}
else if (CSharpAttributeData.IsTargetEarlyAttribute(type, syntax, AttributeDescription.ExperimentalAttribute))
{
kind = ObsoleteAttributeKind.Experimental;
}
else
{
obsoleteData = null;
attributeData = null;
return false;
}
bool hasAnyDiagnostics;
attributeData = arguments.Binder.GetAttribute(syntax, type, out hasAnyDiagnostics);
if (!attributeData.HasErrors)
{
obsoleteData = attributeData.DecodeObsoleteAttribute(kind);
if (hasAnyDiagnostics)
{
attributeData = null;
}
}
else
{
obsoleteData = null;
attributeData = null;
}
return true;
}
/// <summary>
/// This method is called by the binder when it is finished binding a set of attributes on the symbol so that
/// the symbol can extract data from the attribute arguments and potentially perform validation specific to
/// some well known attributes.
/// <para>
/// NOTE: If we are decoding a well-known attribute that could be queried by the binder, consider decoding it during early decoding pass.
/// </para>
/// </summary>
/// <remarks>
/// <para>
/// Symbol types should override this if they want to handle a specific well-known attribute.
/// If the attribute is of a type that the symbol does not wish to handle, it should delegate back to
/// this (base) method.
/// </para>
/// </remarks>
internal virtual void DecodeWellKnownAttribute(ref DecodeWellKnownAttributeArguments<AttributeSyntax, CSharpAttributeData, AttributeLocation> arguments)
{
}
/// <summary>
/// Called to report attribute related diagnostics after all attributes have been bound and decoded.
/// Called even if there are no attributes.
/// </summary>
/// <remarks>
/// This method is called by the binder from <see cref="LoadAndValidateAttributes"/> after it has finished binding attributes on the symbol,
/// has executed <see cref="DecodeWellKnownAttribute"/> for attributes applied on the symbol and has stored the decoded data in the
/// lazyCustomAttributesBag on the symbol. Bound attributes haven't been stored on the bag yet.
///
/// Post-validation for attributes that is dependent on other attributes can be done here.
///
/// This method should not have any side effects on the symbol, i.e. it SHOULD NOT change the symbol state.
/// </remarks>
/// <param name="boundAttributes">Bound attributes.</param>
/// <param name="allAttributeSyntaxNodes">Syntax nodes of attributes in order they are specified in source, or null if there are no attributes.</param>
/// <param name="diagnostics">Diagnostic bag.</param>
/// <param name="symbolPart">Specific part of the symbol to which the attributes apply, or <see cref="AttributeLocation.None"/> if the attributes apply to the symbol itself.</param>
/// <param name="decodedData">Decoded well-known attribute data, could be null.</param>
internal virtual void PostDecodeWellKnownAttributes(ImmutableArray<CSharpAttributeData> boundAttributes, ImmutableArray<AttributeSyntax> allAttributeSyntaxNodes, BindingDiagnosticBag diagnostics, AttributeLocation symbolPart, WellKnownAttributeData decodedData)
{
}
/// <summary>
/// This method does the following set of operations in the specified order:
/// (1) GetAttributesToBind: Merge attributes from the given attributesSyntaxLists and filter out attributes by attribute target.
/// (2) BindAttributeTypes: Bind all the attribute types to enable early decode of certain well-known attributes by type.
/// (3) EarlyDecodeWellKnownAttributes: Perform early decoding of certain well-known attributes that could be queried by the binder in subsequent steps.
/// (NOTE: This step has the side effect of updating the symbol state based on the data extracted from well known attributes).
/// (4) GetAttributes: Bind the attributes (attribute arguments and constructor) using bound attribute types.
/// (5) DecodeWellKnownAttributes: Decode and validate bound well known attributes.
/// (NOTE: This step has the side effect of updating the symbol state based on the data extracted from well known attributes).
/// (6) StoreBoundAttributesAndDoPostValidation:
/// (a) Store the bound attributes in lazyCustomAttributes in a thread safe manner.
/// (b) Perform some additional post attribute validations, such as
/// 1) Duplicate attributes, attribute usage target validation, etc.
/// 2) Post validation for attributes dependent on other attributes
/// These validations cannot be performed prior to step 6(a) as we might need to
/// perform a GetAttributes() call on a symbol which can introduce a cycle in attribute binding.
/// We avoid this cycle by performing such validations in PostDecodeWellKnownAttributes after lazyCustomAttributes have been set.
/// NOTE: PostDecodeWellKnownAttributes SHOULD NOT change the symbol state.
/// </summary>
/// <remarks>
/// Current design of early decoding well-known attributes doesn't permit decoding attribute arguments/constructor as this can lead to binding cycles.
/// For well-known attributes used by the binder, where we need the decoded arguments, we must handle them specially in one of the following possible ways:
/// (a) Avoid decoding the attribute arguments during binding and delay the corresponding binder tasks to a separate post-pass executed after binding.
/// (b) As the cycles can be caused only when we are binding attribute arguments/constructor, special case the corresponding binder tasks based on the current BinderFlags.
/// </remarks>
/// <param name="attributesSyntaxLists"></param>
/// <param name="lazyCustomAttributesBag"></param>
/// <param name="symbolPart">Specific part of the symbol to which the attributes apply, or <see cref="AttributeLocation.None"/> if the attributes apply to the symbol itself.</param>
/// <param name="earlyDecodingOnly">Indicates that only early decoding should be performed. WARNING: the resulting bag will not be sealed.</param>
/// <param name="binderOpt">Binder to use. If null, <see cref="DeclaringCompilation"/> GetBinderFactory will be used.</param>
/// <param name="attributeMatchesOpt">If specified, only load attributes that match this predicate, and any diagnostics produced will be dropped.</param>
/// <returns>Flag indicating whether lazyCustomAttributes were stored on this thread. Caller should check for this flag and perform NotePartComplete if true.</returns>
internal bool LoadAndValidateAttributes(
OneOrMany<SyntaxList<AttributeListSyntax>> attributesSyntaxLists,
ref CustomAttributesBag<CSharpAttributeData> lazyCustomAttributesBag,
AttributeLocation symbolPart = AttributeLocation.None,
bool earlyDecodingOnly = false,
Binder binderOpt = null,
Func<AttributeSyntax, bool> attributeMatchesOpt = null)
{
var diagnostics = BindingDiagnosticBag.GetInstance();
var compilation = this.DeclaringCompilation;
ImmutableArray<Binder> binders;
ImmutableArray<AttributeSyntax> attributesToBind = this.GetAttributesToBind(attributesSyntaxLists, symbolPart, diagnostics, compilation, attributeMatchesOpt, binderOpt, out binders);
Debug.Assert(!attributesToBind.IsDefault);
ImmutableArray<CSharpAttributeData> boundAttributes;
WellKnownAttributeData wellKnownAttributeData;
if (attributesToBind.Any())
{
Debug.Assert(!binders.IsDefault);
Debug.Assert(binders.Length == attributesToBind.Length);
// Initialize the bag so that data decoded from early attributes can be stored onto it.
if (lazyCustomAttributesBag == null)
{
Interlocked.CompareExchange(ref lazyCustomAttributesBag, new CustomAttributesBag<CSharpAttributeData>(), null);
}
// Bind the attribute types and then early decode them.
int totalAttributesCount = attributesToBind.Length;
var attributeTypesBuilder = new NamedTypeSymbol[totalAttributesCount];
Binder.BindAttributeTypes(binders, attributesToBind, this, attributeTypesBuilder, diagnostics);
for (var i = 0; i < totalAttributesCount; i++)
{
if (attributeTypesBuilder[i].IsGenericType)
{
MessageID.IDS_FeatureGenericAttributes.CheckFeatureAvailability(diagnostics, attributesToBind[i]);
}
}
ImmutableArray<NamedTypeSymbol> boundAttributeTypes = attributeTypesBuilder.AsImmutableOrNull();
this.EarlyDecodeWellKnownAttributeTypes(boundAttributeTypes, attributesToBind);
this.PostEarlyDecodeWellKnownAttributeTypes();
// Bind the attribute in two stages - early and normal.
var attributesBuilder = new CSharpAttributeData[totalAttributesCount];
// Early bind and decode some well-known attributes.
EarlyWellKnownAttributeData earlyData = this.EarlyDecodeWellKnownAttributes(binders, boundAttributeTypes, attributesToBind, symbolPart, attributesBuilder);
Debug.Assert(!attributesBuilder.Contains((attr) => attr != null && attr.HasErrors));
// Store data decoded from early bound well-known attributes.
// TODO: what if this succeeds on another thread, not ours?
lazyCustomAttributesBag.SetEarlyDecodedWellKnownAttributeData(earlyData);
if (earlyDecodingOnly)
{
diagnostics.Free(); //NOTE: dropped.
return false;
}
// Bind attributes.
Binder.GetAttributes(binders, attributesToBind, boundAttributeTypes, attributesBuilder, diagnostics);
boundAttributes = attributesBuilder.AsImmutableOrNull();
// All attributes must be bound by now.
Debug.Assert(!boundAttributes.Any((attr) => attr == null));
// Validate attribute usage and Decode remaining well-known attributes.
wellKnownAttributeData = this.ValidateAttributeUsageAndDecodeWellKnownAttributes(binders, attributesToBind, boundAttributes, diagnostics, symbolPart);
// Store data decoded from remaining well-known attributes.
// TODO: what if this succeeds on another thread but not this thread?
lazyCustomAttributesBag.SetDecodedWellKnownAttributeData(wellKnownAttributeData);
}
else if (earlyDecodingOnly)
{
diagnostics.Free(); //NOTE: dropped.
return false;
}
else
{
boundAttributes = ImmutableArray<CSharpAttributeData>.Empty;
wellKnownAttributeData = null;
Interlocked.CompareExchange(ref lazyCustomAttributesBag, CustomAttributesBag<CSharpAttributeData>.WithEmptyData(), null);
this.PostEarlyDecodeWellKnownAttributeTypes();
}
this.PostDecodeWellKnownAttributes(boundAttributes, attributesToBind, diagnostics, symbolPart, wellKnownAttributeData);
// Store attributes into the bag.
bool lazyAttributesStoredOnThisThread = false;
if (lazyCustomAttributesBag.SetAttributes(boundAttributes))
{
if (attributeMatchesOpt is null)
{
this.RecordPresenceOfBadAttributes(boundAttributes);
AddDeclarationDiagnostics(diagnostics);
}
lazyAttributesStoredOnThisThread = true;
if (lazyCustomAttributesBag.IsEmpty) lazyCustomAttributesBag = CustomAttributesBag<CSharpAttributeData>.Empty;
}
Debug.Assert(lazyCustomAttributesBag.IsSealed);
diagnostics.Free();
return lazyAttributesStoredOnThisThread;
}
private void RecordPresenceOfBadAttributes(ImmutableArray<CSharpAttributeData> boundAttributes)
{
foreach (var attribute in boundAttributes)
{
if (attribute.HasErrors)
{
CSharpCompilation compilation = this.DeclaringCompilation;
Debug.Assert(compilation != null);
((SourceModuleSymbol)compilation.SourceModule).RecordPresenceOfBadAttributes();
break;
}
}
}
/// <summary>
/// Method to merge attributes from the given attributesSyntaxLists and filter out attributes by attribute target.
/// This is the first step in attribute binding.
/// </summary>
/// <remarks>
/// This method can generate diagnostics for few cases where we have an invalid target specifier and the parser hasn't generated the necessary diagnostics.
/// It should not perform any bind operations as it can lead to an attribute binding cycle.
/// </remarks>
private ImmutableArray<AttributeSyntax> GetAttributesToBind(
OneOrMany<SyntaxList<AttributeListSyntax>> attributeDeclarationSyntaxLists,
AttributeLocation symbolPart,
BindingDiagnosticBag diagnostics,
CSharpCompilation compilation,
Func<AttributeSyntax, bool> attributeMatchesOpt,
Binder rootBinderOpt,
out ImmutableArray<Binder> binders)
{
var attributeTarget = (IAttributeTargetSymbol)this;
ArrayBuilder<AttributeSyntax> syntaxBuilder = null;
ArrayBuilder<Binder> bindersBuilder = null;
int attributesToBindCount = 0;
for (int listIndex = 0; listIndex < attributeDeclarationSyntaxLists.Count; listIndex++)
{
var attributeDeclarationSyntaxList = attributeDeclarationSyntaxLists[listIndex];
if (attributeDeclarationSyntaxList.Any())
{
int prevCount = attributesToBindCount;
foreach (var attributeDeclarationSyntax in attributeDeclarationSyntaxList)
{
// We bind the attribute only if it has a matching target for the given ownerSymbol and attributeLocation.
if (MatchAttributeTarget(attributeTarget, symbolPart, attributeDeclarationSyntax.Target, diagnostics))
{
if (syntaxBuilder == null)
{
syntaxBuilder = new ArrayBuilder<AttributeSyntax>();
bindersBuilder = new ArrayBuilder<Binder>();
}
var attributesToBind = attributeDeclarationSyntax.Attributes;
if (attributeMatchesOpt is null)
{
syntaxBuilder.AddRange(attributesToBind);
attributesToBindCount += attributesToBind.Count;
}
else
{
foreach (var attribute in attributesToBind)
{
if (attributeMatchesOpt(attribute))
{
syntaxBuilder.Add(attribute);
attributesToBindCount++;
}
}
}
}
}
if (attributesToBindCount != prevCount)
{
Debug.Assert(attributeDeclarationSyntaxList.Node != null);
Debug.Assert(bindersBuilder != null);
var syntaxTree = attributeDeclarationSyntaxList.Node.SyntaxTree;
var binder = rootBinderOpt ?? compilation.GetBinderFactory(syntaxTree).GetBinder(attributeDeclarationSyntaxList.Node);
binder = new ContextualAttributeBinder(binder, this);
Debug.Assert(!binder.InAttributeArgument || this is MethodSymbol { MethodKind: MethodKind.LambdaMethod }, "Possible cycle in attribute binding");
for (int i = 0; i < attributesToBindCount - prevCount; i++)
{
bindersBuilder.Add(binder);
}
}
}
}
if (syntaxBuilder != null)
{
binders = bindersBuilder.ToImmutableAndFree();
return syntaxBuilder.ToImmutableAndFree();
}
else
{
binders = ImmutableArray<Binder>.Empty;
return ImmutableArray<AttributeSyntax>.Empty;
}
}
private static bool MatchAttributeTarget(IAttributeTargetSymbol attributeTarget, AttributeLocation symbolPart, AttributeTargetSpecifierSyntax targetOpt, BindingDiagnosticBag diagnostics)
{
IAttributeTargetSymbol attributesOwner = attributeTarget.AttributesOwner;
// Determine if the target symbol owns the attribute declaration.
// We need to report diagnostics only once, so do it when visiting attributes for the owner.
bool isOwner = symbolPart == AttributeLocation.None && ReferenceEquals(attributesOwner, attributeTarget);
if (targetOpt == null)
{
// only attributes with an explicit target match if the symbol doesn't own the attributes:
return isOwner;
}
AttributeLocation allowedTargets = attributesOwner.AllowedAttributeLocations;
AttributeLocation explicitTarget = targetOpt.GetAttributeLocation();
if (explicitTarget == AttributeLocation.None)
{
// error: unknown attribute location
if (isOwner)
{
//NOTE: ValueText so that we accept targets like "@return", to match dev10 (DevDiv #2591).
diagnostics.Add(ErrorCode.WRN_InvalidAttributeLocation,
targetOpt.Identifier.GetLocation(), targetOpt.Identifier.ValueText, allowedTargets.ToDisplayString());
}
return false;
}
if ((explicitTarget & allowedTargets) == 0)
{
// error: invalid target for symbol
if (isOwner)
{
if (allowedTargets == AttributeLocation.None)
{
switch (attributeTarget.DefaultAttributeLocation)
{
case AttributeLocation.Assembly:
case AttributeLocation.Module:
// global attributes are disallowed in interactive code:
diagnostics.Add(ErrorCode.ERR_GlobalAttributesNotAllowed, targetOpt.Identifier.GetLocation());
break;
default:
// currently this can't happen
throw ExceptionUtilities.UnexpectedValue(attributeTarget.DefaultAttributeLocation);
}
}
else
{
diagnostics.Add(ErrorCode.WRN_AttributeLocationOnBadDeclaration,
targetOpt.Identifier.GetLocation(), targetOpt.Identifier.ToString(), allowedTargets.ToDisplayString());
}
}
return false;
}
if (symbolPart == AttributeLocation.None)
{
return explicitTarget == attributeTarget.DefaultAttributeLocation;
}
else
{
return explicitTarget == symbolPart;
}
}
/// <summary>
/// Method to early decode certain well-known attributes which can be queried by the binder.
/// This method is called during attribute binding after we have bound the attribute types for all attributes,
/// but haven't yet bound the attribute arguments/attribute constructor.
/// Early decoding certain well-known attributes enables the binder to use this decoded information on this symbol
/// when binding the attribute arguments/attribute constructor without causing attribute binding cycle.
/// </summary>
internal EarlyWellKnownAttributeData EarlyDecodeWellKnownAttributes(
ImmutableArray<Binder> binders,
ImmutableArray<NamedTypeSymbol> boundAttributeTypes,
ImmutableArray<AttributeSyntax> attributesToBind,
AttributeLocation symbolPart,
CSharpAttributeData[] boundAttributesBuilder)
{
Debug.Assert(boundAttributeTypes.Any());
Debug.Assert(attributesToBind.Any());
Debug.Assert(binders.Any());
Debug.Assert(boundAttributesBuilder != null);
Debug.Assert(!boundAttributesBuilder.Contains((attr) => attr != null));
var earlyBinder = new EarlyWellKnownAttributeBinder(binders[0]);
var arguments = new EarlyDecodeWellKnownAttributeArguments<EarlyWellKnownAttributeBinder, NamedTypeSymbol, AttributeSyntax, AttributeLocation>();
arguments.SymbolPart = symbolPart;
for (int i = 0; i < boundAttributeTypes.Length; i++)
{
NamedTypeSymbol boundAttributeType = boundAttributeTypes[i];
if (!boundAttributeType.IsErrorType())
{
if (binders[i] != earlyBinder.Next)
{
earlyBinder = new EarlyWellKnownAttributeBinder(binders[i]);
}
arguments.Binder = earlyBinder;
arguments.AttributeType = boundAttributeType;
arguments.AttributeSyntax = attributesToBind[i];
// Early bind some well-known attributes
CSharpAttributeData earlyBoundAttributeOpt = this.EarlyDecodeWellKnownAttribute(ref arguments);
Debug.Assert(earlyBoundAttributeOpt == null || !earlyBoundAttributeOpt.HasErrors);
boundAttributesBuilder[i] = earlyBoundAttributeOpt;
}
}
return arguments.HasDecodedData ? arguments.DecodedData : null;
}
private void EarlyDecodeWellKnownAttributeTypes(ImmutableArray<NamedTypeSymbol> attributeTypes, ImmutableArray<AttributeSyntax> attributeSyntaxList)
{
Debug.Assert(attributeSyntaxList.Any());
Debug.Assert(attributeTypes.Any());
for (int i = 0; i < attributeTypes.Length; i++)
{
var attributeType = attributeTypes[i];
if (!attributeType.IsErrorType())
{
this.EarlyDecodeWellKnownAttributeType(attributeType, attributeSyntaxList[i]);
}
}
}
/// <summary>
/// This method validates attribute usage for each bound attribute and calls <see cref="DecodeWellKnownAttribute"/>
/// on attributes with valid attribute usage.
/// This method is called by the binder when it is finished binding a set of attributes on the symbol so that
/// the symbol can extract data from the attribute arguments and potentially perform validation specific to
/// some well known attributes.
/// </summary>
private WellKnownAttributeData ValidateAttributeUsageAndDecodeWellKnownAttributes(
ImmutableArray<Binder> binders,
ImmutableArray<AttributeSyntax> attributeSyntaxList,
ImmutableArray<CSharpAttributeData> boundAttributes,
BindingDiagnosticBag diagnostics,
AttributeLocation symbolPart)
{
Debug.Assert(binders.Any());
Debug.Assert(attributeSyntaxList.Any());
Debug.Assert(boundAttributes.Any());
Debug.Assert(binders.Length == boundAttributes.Length);
Debug.Assert(attributeSyntaxList.Length == boundAttributes.Length);
int totalAttributesCount = boundAttributes.Length;
HashSet<NamedTypeSymbol> uniqueAttributeTypes = new HashSet<NamedTypeSymbol>();
var arguments = new DecodeWellKnownAttributeArguments<AttributeSyntax, CSharpAttributeData, AttributeLocation>();
arguments.Diagnostics = diagnostics;
arguments.AttributesCount = totalAttributesCount;
arguments.SymbolPart = symbolPart;
for (int i = 0; i < totalAttributesCount; i++)
{
CSharpAttributeData boundAttribute = boundAttributes[i];
AttributeSyntax attributeSyntax = attributeSyntaxList[i];
Binder binder = binders[i];
// Decode attribute as a possible well-known attribute only if it has no binding errors and has valid AttributeUsage.
if (!boundAttribute.HasErrors && ValidateAttributeUsage(boundAttribute, attributeSyntax, binder.Compilation, symbolPart, diagnostics, uniqueAttributeTypes))
{
arguments.Attribute = boundAttribute;
arguments.AttributeSyntaxOpt = attributeSyntax;
arguments.Index = i;
this.DecodeWellKnownAttribute(ref arguments);
}
}
return arguments.HasDecodedData ? arguments.DecodedData : null;
}
/// <summary>
/// Validate attribute usage target and duplicate attributes.
/// </summary>
/// <param name="attribute">Bound attribute</param>
/// <param name="node">Syntax node for attribute specification</param>
/// <param name="compilation">Compilation</param>
/// <param name="symbolPart">Symbol part to which the attribute has been applied.</param>
/// <param name="diagnostics">Diagnostics</param>
/// <param name="uniqueAttributeTypes">Set of unique attribute types applied to the symbol</param>
private bool ValidateAttributeUsage(
CSharpAttributeData attribute,
AttributeSyntax node,
CSharpCompilation compilation,
AttributeLocation symbolPart,
BindingDiagnosticBag diagnostics,
HashSet<NamedTypeSymbol> uniqueAttributeTypes)
{
Debug.Assert(!attribute.HasErrors);
NamedTypeSymbol attributeType = attribute.AttributeClass;
AttributeUsageInfo attributeUsageInfo = attributeType.GetAttributeUsageInfo();
// Given attribute can't be specified more than once if AllowMultiple is false.
if (!uniqueAttributeTypes.Add(attributeType.OriginalDefinition) && !attributeUsageInfo.AllowMultiple)
{
diagnostics.Add(ErrorCode.ERR_DuplicateAttribute, node.Name.Location, node.GetErrorDisplayName());
return false;
}
// Verify if the attribute type can be applied to given owner symbol.
AttributeTargets attributeTarget;
if (symbolPart == AttributeLocation.Return)
{
// attribute on return type
Debug.Assert(this.Kind == SymbolKind.Method);
attributeTarget = AttributeTargets.ReturnValue;
}
else
{
attributeTarget = this.GetAttributeTarget();
}
if ((attributeTarget & attributeUsageInfo.ValidTargets) == 0)
{
// generate error
diagnostics.Add(ErrorCode.ERR_AttributeOnBadSymbolType, node.Name.Location, node.GetErrorDisplayName(), attributeUsageInfo.GetValidTargetsErrorArgument());
return false;
}
if (attribute.IsSecurityAttribute(compilation))
{
switch (this.Kind)
{
case SymbolKind.Assembly:
case SymbolKind.NamedType:
case SymbolKind.Method:
break;
default:
// CS7070: Security attribute '{0}' is not valid on this declaration type. Security attributes are only valid on assembly, type and method declarations.
diagnostics.Add(ErrorCode.ERR_SecurityAttributeInvalidTarget, node.Name.Location, node.GetErrorDisplayName());
return false;
}
}
return true;
}
/// <summary>
/// Ensure that attributes are bound and the ObsoleteState of this symbol is known.
/// </summary>
internal void ForceCompleteObsoleteAttribute()
{
if (this.ObsoleteState == ThreeState.Unknown)
{
this.GetAttributes();
}
Debug.Assert(this.ObsoleteState != ThreeState.Unknown, "ObsoleteState should be true or false now.");
}
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/Workspace/Mef/LanguageMetadata.cs | // 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.
#nullable disable
using System.Collections.Generic;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Host.Mef
{
/// <summary>
/// MEF metadata class used to find exports declared for a specific language.
/// </summary>
internal class LanguageMetadata : ILanguageMetadata
{
public string Language { get; }
public LanguageMetadata(IDictionary<string, object> data)
=> this.Language = (string)data.GetValueOrDefault("Language");
public LanguageMetadata(string language)
=> this.Language = language;
}
}
| // 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.
#nullable disable
using System.Collections.Generic;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Host.Mef
{
/// <summary>
/// MEF metadata class used to find exports declared for a specific language.
/// </summary>
internal class LanguageMetadata : ILanguageMetadata
{
public string Language { get; }
public LanguageMetadata(IDictionary<string, object> data)
=> this.Language = (string)data.GetValueOrDefault("Language");
public LanguageMetadata(string language)
=> this.Language = language;
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/EditorFeatures/CSharpTest/Diagnostics/Configuration/ConfigureCodeStyle/EnumCodeStyleOptionConfigurationTests.cs | // 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.
#nullable disable
using System;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.CodeFixes.Configuration.ConfigureCodeStyle;
using Microsoft.CodeAnalysis.CSharp.RemoveUnusedParametersAndValues;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Editor.UnitTests.Diagnostics;
using Microsoft.CodeAnalysis.Test.Utilities;
using Roslyn.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics.Configuration.ConfigureCodeStyle
{
public abstract partial class EnumCodeStyleOptionConfigurationTests : AbstractSuppressionDiagnosticTest
{
protected internal override string GetLanguage() => LanguageNames.CSharp;
protected override ParseOptions GetScriptOptions() => Options.Script;
internal override Tuple<DiagnosticAnalyzer, IConfigurationFixProvider> CreateDiagnosticProviderAndFixer(Workspace workspace)
{
/*
/// <summary>
/// Assignment preference for unused values from expression statements and assignments.
/// </summary>
internal enum UnusedValuePreference
{
// Unused values must be explicitly assigned to a local variable
// that is never read/used.
UnusedLocalVariable = 1,
// Unused values must be explicitly assigned to a discard '_' variable.
DiscardVariable = 2,
}
*/
return new Tuple<DiagnosticAnalyzer, IConfigurationFixProvider>(
new CSharpRemoveUnusedParametersAndValuesDiagnosticAnalyzer(), new ConfigureCodeStyleOptionCodeFixProvider());
}
public class UnusedLocalVariableConfigurationTests : EnumCodeStyleOptionConfigurationTests
{
protected override int CodeActionIndex => 0;
[ConditionalFact(typeof(IsEnglishLocal)), Trait(Traits.Feature, Traits.Features.CodeActionsConfiguration)]
public async Task ConfigureEditorconfig_Empty_UnusedLocalVariable()
{
var input = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<Document FilePath=""z:\\file.cs"">
class Program1
{
static void Main()
{
// csharp_style_unused_value_assignment_preference = { discard_variable, unused_local_variable }
[|var obj = new Program1();|]
obj = null;
var obj2 = obj;
}
}
</Document>
<AnalyzerConfigDocument FilePath=""z:\\.editorconfig""></AnalyzerConfigDocument>
</Project>
</Workspace>";
var expected = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<Document FilePath=""z:\\file.cs"">
class Program1
{
static void Main()
{
// csharp_style_unused_value_assignment_preference = { discard_variable, unused_local_variable }
var obj = new Program1();
obj = null;
var obj2 = obj;
}
}
</Document>
<AnalyzerConfigDocument FilePath=""z:\\.editorconfig"">[*.cs]
# IDE0059: Unnecessary assignment of a value
csharp_style_unused_value_assignment_preference = unused_local_variable
</AnalyzerConfigDocument>
</Project>
</Workspace>";
await TestInRegularAndScriptAsync(input, expected, CodeActionIndex);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConfiguration)]
public async Task ConfigureEditorconfig_RuleExists_UnusedLocalVariable()
{
var input = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<Document FilePath=""z:\\file.cs"">
class Program1
{
static void Main()
{
// csharp_style_unused_value_assignment_preference = { discard_variable, unused_local_variable }
[|var obj = new Program1();|]
obj = null;
var obj2 = obj;
}
}
</Document>
<AnalyzerConfigDocument FilePath=""z:\\.editorconfig"">[*.cs] # Comment1
csharp_style_unused_value_assignment_preference = discard_variable:suggestion ; Comment2
</AnalyzerConfigDocument>
</Project>
</Workspace>";
var expected = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<Document FilePath=""z:\\file.cs"">
class Program1
{
static void Main()
{
// csharp_style_unused_value_assignment_preference = { discard_variable, unused_local_variable }
var obj = new Program1();
obj = null;
var obj2 = obj;
}
}
</Document>
<AnalyzerConfigDocument FilePath=""z:\\.editorconfig"">[*.cs] # Comment1
csharp_style_unused_value_assignment_preference = unused_local_variable:suggestion ; Comment2
</AnalyzerConfigDocument>
</Project>
</Workspace>";
await TestInRegularAndScriptAsync(input, expected, CodeActionIndex);
}
[ConditionalFact(typeof(IsEnglishLocal)), Trait(Traits.Feature, Traits.Features.CodeActionsConfiguration)]
public async Task ConfigureEditorconfig_RuleExists_DotnetDiagnosticEntry()
{
var input = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<Document FilePath=""z:\\file.cs"">
class Program1
{
static void Main()
{
// csharp_style_unused_value_assignment_preference = { discard_variable, unused_local_variable }
[|var obj = new Program1();|]
obj = null;
var obj2 = obj;
}
}
</Document>
<AnalyzerConfigDocument FilePath=""z:\\.editorconfig"">[*.cs] # Comment1
dotnet_diagnostic.IDE0059.severity = warning ; Comment2
</AnalyzerConfigDocument>
</Project>
</Workspace>";
var expected = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<Document FilePath=""z:\\file.cs"">
class Program1
{
static void Main()
{
// csharp_style_unused_value_assignment_preference = { discard_variable, unused_local_variable }
var obj = new Program1();
obj = null;
var obj2 = obj;
}
}
</Document>
<AnalyzerConfigDocument FilePath=""z:\\.editorconfig"">[*.cs] # Comment1
dotnet_diagnostic.IDE0059.severity = warning ; Comment2
# IDE0059: Unnecessary assignment of a value
csharp_style_unused_value_assignment_preference = unused_local_variable
</AnalyzerConfigDocument>
</Project>
</Workspace>";
await TestInRegularAndScriptAsync(input, expected, CodeActionIndex);
}
[ConditionalFact(typeof(IsEnglishLocal)), Trait(Traits.Feature, Traits.Features.CodeActionsConfiguration)]
public async Task ConfigureEditorconfig_RuleExists_ConflictingDotnetDiagnosticEntry()
{
var input = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<Document FilePath=""z:\\file.cs"">
class Program1
{
static void Main()
{
// csharp_style_unused_value_assignment_preference = { discard_variable, unused_local_variable }
[|var obj = new Program1();|]
obj = null;
var obj2 = obj;
}
}
</Document>
<AnalyzerConfigDocument FilePath=""z:\\.editorconfig"">[*.cs] # Comment1
dotnet_diagnostic.IDE0059.severity = error ; Comment2
csharp_style_unused_value_assignment_preference = discard_variable:suggestion ; Comment3
</AnalyzerConfigDocument>
</Project>
</Workspace>";
var expected = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<Document FilePath=""z:\\file.cs"">
class Program1
{
static void Main()
{
// csharp_style_unused_value_assignment_preference = { discard_variable, unused_local_variable }
var obj = new Program1();
obj = null;
var obj2 = obj;
}
}
</Document>
<AnalyzerConfigDocument FilePath=""z:\\.editorconfig"">[*.cs] # Comment1
dotnet_diagnostic.IDE0059.severity = error ; Comment2
csharp_style_unused_value_assignment_preference = unused_local_variable:suggestion ; Comment3
</AnalyzerConfigDocument>
</Project>
</Workspace>";
await TestInRegularAndScriptAsync(input, expected, CodeActionIndex);
}
[ConditionalFact(typeof(IsEnglishLocal)), Trait(Traits.Feature, Traits.Features.CodeActionsConfiguration)]
public async Task ConfigureEditorconfig_InvalidHeader_UnusedLocalVariable()
{
var input = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<Document FilePath=""z:\\file.cs"">
class Program1
{
static void Main()
{
// csharp_style_unused_value_assignment_preference = { discard_variable, unused_local_variable }
[|var obj = new Program1();|]
obj = null;
var obj2 = obj;
}
}
</Document>
<AnalyzerConfigDocument FilePath=""z:\\.editorconfig"">[*.vb]
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
</AnalyzerConfigDocument>
</Project>
</Workspace>";
var expected = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<Document FilePath=""z:\\file.cs"">
class Program1
{
static void Main()
{
// csharp_style_unused_value_assignment_preference = { discard_variable, unused_local_variable }
var obj = new Program1();
obj = null;
var obj2 = obj;
}
}
</Document>
<AnalyzerConfigDocument FilePath=""z:\\.editorconfig"">[*.vb]
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
[*.cs]
# IDE0059: Unnecessary assignment of a value
csharp_style_unused_value_assignment_preference = unused_local_variable
</AnalyzerConfigDocument>
</Project>
</Workspace>";
await TestInRegularAndScriptAsync(input, expected, CodeActionIndex);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConfiguration)]
public async Task ConfigureEditorconfig_MaintainSeverity_UnusedLocalVariable()
{
var input = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<Document FilePath=""z:\\file.cs"">
class Program1
{
static void Main()
{
// csharp_style_unused_value_assignment_preference = { discard_variable, unused_local_variable }
[|var obj = new Program1();|]
obj = null;
var obj2 = obj;
}
}
</Document>
<AnalyzerConfigDocument FilePath=""z:\\.editorconfig"">[*.{vb,cs}]
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
</AnalyzerConfigDocument>
</Project>
</Workspace>";
var expected = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<Document FilePath=""z:\\file.cs"">
class Program1
{
static void Main()
{
// csharp_style_unused_value_assignment_preference = { discard_variable, unused_local_variable }
var obj = new Program1();
obj = null;
var obj2 = obj;
}
}
</Document>
<AnalyzerConfigDocument FilePath=""z:\\.editorconfig"">[*.{vb,cs}]
csharp_style_unused_value_assignment_preference = unused_local_variable:suggestion
</AnalyzerConfigDocument>
</Project>
</Workspace>";
await TestInRegularAndScriptAsync(input, expected, CodeActionIndex);
}
[ConditionalFact(typeof(IsEnglishLocal)), Trait(Traits.Feature, Traits.Features.CodeActionsConfiguration)]
public async Task ConfigureEditorconfig_InvalidRule_UnusedLocalVariable()
{
var input = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<Document FilePath=""z:\\file.cs"">
class Program1
{
static void Main()
{
// csharp_style_unused_value_assignment_preference = { discard_variable, unused_local_variable }
[|var obj = new Program1();|]
obj = null;
var obj2 = obj;
}
}
</Document>
<AnalyzerConfigDocument FilePath=""z:\\.editorconfig"">[*.cs]
csharp_style_unused_value_assignment_preferencer = discard_variable:suggestion
</AnalyzerConfigDocument>
</Project>
</Workspace>";
var expected = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<Document FilePath=""z:\\file.cs"">
class Program1
{
static void Main()
{
// csharp_style_unused_value_assignment_preference = { discard_variable, unused_local_variable }
var obj = new Program1();
obj = null;
var obj2 = obj;
}
}
</Document>
<AnalyzerConfigDocument FilePath=""z:\\.editorconfig"">[*.cs]
csharp_style_unused_value_assignment_preferencer = discard_variable:suggestion
# IDE0059: Unnecessary assignment of a value
csharp_style_unused_value_assignment_preference = unused_local_variable
</AnalyzerConfigDocument>
</Project>
</Workspace>";
await TestInRegularAndScriptAsync(input, expected, CodeActionIndex);
}
}
public class DiscardVariableConfigurationTests : EnumCodeStyleOptionConfigurationTests
{
protected override int CodeActionIndex => 1;
[ConditionalFact(typeof(IsEnglishLocal)), Trait(Traits.Feature, Traits.Features.CodeActionsConfiguration)]
public async Task ConfigureEditorconfig_Empty_DiscardVariable()
{
var input = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<Document FilePath=""z:\\file.cs"">
class Program1
{
static void Main()
{
// csharp_style_unused_value_assignment_preference = { discard_variable, unused_local_variable }
[|var obj = new Program1();|]
obj = null;
var obj2 = obj;
}
}
</Document>
<AnalyzerConfigDocument FilePath=""z:\\.editorconfig""></AnalyzerConfigDocument>
</Project>
</Workspace>";
var expected = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<Document FilePath=""z:\\file.cs"">
class Program1
{
static void Main()
{
// csharp_style_unused_value_assignment_preference = { discard_variable, unused_local_variable }
var obj = new Program1();
obj = null;
var obj2 = obj;
}
}
</Document>
<AnalyzerConfigDocument FilePath=""z:\\.editorconfig"">[*.cs]
# IDE0059: Unnecessary assignment of a value
csharp_style_unused_value_assignment_preference = discard_variable
</AnalyzerConfigDocument>
</Project>
</Workspace>";
await TestInRegularAndScriptAsync(input, expected, CodeActionIndex);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConfiguration)]
public async Task ConfigureEditorconfig_RuleExists_DiscardVariable()
{
var input = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<Document FilePath=""z:\\file.cs"">
class Program1
{
static void Main()
{
// csharp_style_unused_value_assignment_preference = { discard_variable, unused_local_variable }
[|var obj = new Program1();|]
obj = null;
var obj2 = obj;
}
}
</Document>
<AnalyzerConfigDocument FilePath=""z:\\.editorconfig"">[*.cs]
csharp_style_unused_value_assignment_preference = unused_local_variable:suggestion
</AnalyzerConfigDocument>
</Project>
</Workspace>";
var expected = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<Document FilePath=""z:\\file.cs"">
class Program1
{
static void Main()
{
// csharp_style_unused_value_assignment_preference = { discard_variable, unused_local_variable }
var obj = new Program1();
obj = null;
var obj2 = obj;
}
}
</Document>
<AnalyzerConfigDocument FilePath=""z:\\.editorconfig"">[*.cs]
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
</AnalyzerConfigDocument>
</Project>
</Workspace>";
await TestInRegularAndScriptAsync(input, expected, CodeActionIndex);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConfiguration)]
public async Task ConfigureEditorconfig_RuleExists_DiscardVariable_WithoutSeveritySuffix()
{
var input = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<Document FilePath=""z:\\file.cs"">
class Program1
{
static void Main()
{
// csharp_style_unused_value_assignment_preference = { discard_variable, unused_local_variable }
[|var obj = new Program1();|]
obj = null;
var obj2 = obj;
}
}
</Document>
<AnalyzerConfigDocument FilePath=""z:\\.editorconfig"">[*.cs]
csharp_style_unused_value_assignment_preference = unused_local_variable
</AnalyzerConfigDocument>
</Project>
</Workspace>";
var expected = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<Document FilePath=""z:\\file.cs"">
class Program1
{
static void Main()
{
// csharp_style_unused_value_assignment_preference = { discard_variable, unused_local_variable }
var obj = new Program1();
obj = null;
var obj2 = obj;
}
}
</Document>
<AnalyzerConfigDocument FilePath=""z:\\.editorconfig"">[*.cs]
csharp_style_unused_value_assignment_preference = discard_variable
</AnalyzerConfigDocument>
</Project>
</Workspace>";
await TestInRegularAndScriptAsync(input, expected, CodeActionIndex);
}
[ConditionalFact(typeof(IsEnglishLocal)), Trait(Traits.Feature, Traits.Features.CodeActionsConfiguration)]
public async Task ConfigureEditorconfig_InvalidHeader_DiscardVariable()
{
var input = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<Document FilePath=""z:\\file.cs"">
class Program1
{
static void Main()
{
// csharp_style_unused_value_assignment_preference = { discard_variable, unused_local_variable }
[|var obj = new Program1();|]
obj = null;
var obj2 = obj;
}
}
</Document>
<AnalyzerConfigDocument FilePath=""z:\\.editorconfig"">[*.vb]
csharp_style_unused_value_assignment_preference = unused_local_variable:suggestion
</AnalyzerConfigDocument>
</Project>
</Workspace>";
var expected = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<Document FilePath=""z:\\file.cs"">
class Program1
{
static void Main()
{
// csharp_style_unused_value_assignment_preference = { discard_variable, unused_local_variable }
var obj = new Program1();
obj = null;
var obj2 = obj;
}
}
</Document>
<AnalyzerConfigDocument FilePath=""z:\\.editorconfig"">[*.vb]
csharp_style_unused_value_assignment_preference = unused_local_variable:suggestion
[*.cs]
# IDE0059: Unnecessary assignment of a value
csharp_style_unused_value_assignment_preference = discard_variable
</AnalyzerConfigDocument>
</Project>
</Workspace>";
await TestInRegularAndScriptAsync(input, expected, CodeActionIndex);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConfiguration)]
public async Task ConfigureEditorconfig_MaintainSeverity_DiscardVariable()
{
var input = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<Document FilePath=""z:\\file.cs"">
class Program1
{
static void Main()
{
// csharp_style_unused_value_assignment_preference = { discard_variable, unused_local_variable }
[|var obj = new Program1();|]
obj = null;
var obj2 = obj;
}
}
</Document>
<AnalyzerConfigDocument FilePath=""z:\\.editorconfig"">[*.{vb,cs}]
csharp_style_unused_value_assignment_preference = unused_local_variable:suggestion
</AnalyzerConfigDocument>
</Project>
</Workspace>";
var expected = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<Document FilePath=""z:\\file.cs"">
class Program1
{
static void Main()
{
// csharp_style_unused_value_assignment_preference = { discard_variable, unused_local_variable }
var obj = new Program1();
obj = null;
var obj2 = obj;
}
}
</Document>
<AnalyzerConfigDocument FilePath=""z:\\.editorconfig"">[*.{vb,cs}]
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
</AnalyzerConfigDocument>
</Project>
</Workspace>";
await TestInRegularAndScriptAsync(input, expected, CodeActionIndex);
}
[ConditionalFact(typeof(IsEnglishLocal)), Trait(Traits.Feature, Traits.Features.CodeActionsConfiguration)]
public async Task ConfigureEditorconfig_InvalidRule_DiscardVariable()
{
var input = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<Document FilePath=""z:\\file.cs"">
class Program1
{
static void Main()
{
// csharp_style_unused_value_assignment_preference = { discard_variable, unused_local_variable }
[|var obj = new Program1();|]
obj = null;
var obj2 = obj;
}
}
</Document>
<AnalyzerConfigDocument FilePath=""z:\\.editorconfig"">[*.cs]
csharp_style_unused_value_assignment_preference_error = discard_variable:suggestion
</AnalyzerConfigDocument>
</Project>
</Workspace>";
var expected = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<Document FilePath=""z:\\file.cs"">
class Program1
{
static void Main()
{
// csharp_style_unused_value_assignment_preference = { discard_variable, unused_local_variable }
var obj = new Program1();
obj = null;
var obj2 = obj;
}
}
</Document>
<AnalyzerConfigDocument FilePath=""z:\\.editorconfig"">[*.cs]
csharp_style_unused_value_assignment_preference_error = discard_variable:suggestion
# IDE0059: Unnecessary assignment of a value
csharp_style_unused_value_assignment_preference = discard_variable
</AnalyzerConfigDocument>
</Project>
</Workspace>";
await TestInRegularAndScriptAsync(input, expected, CodeActionIndex);
}
}
}
}
| // 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.
#nullable disable
using System;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.CodeFixes.Configuration.ConfigureCodeStyle;
using Microsoft.CodeAnalysis.CSharp.RemoveUnusedParametersAndValues;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Editor.UnitTests.Diagnostics;
using Microsoft.CodeAnalysis.Test.Utilities;
using Roslyn.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics.Configuration.ConfigureCodeStyle
{
public abstract partial class EnumCodeStyleOptionConfigurationTests : AbstractSuppressionDiagnosticTest
{
protected internal override string GetLanguage() => LanguageNames.CSharp;
protected override ParseOptions GetScriptOptions() => Options.Script;
internal override Tuple<DiagnosticAnalyzer, IConfigurationFixProvider> CreateDiagnosticProviderAndFixer(Workspace workspace)
{
/*
/// <summary>
/// Assignment preference for unused values from expression statements and assignments.
/// </summary>
internal enum UnusedValuePreference
{
// Unused values must be explicitly assigned to a local variable
// that is never read/used.
UnusedLocalVariable = 1,
// Unused values must be explicitly assigned to a discard '_' variable.
DiscardVariable = 2,
}
*/
return new Tuple<DiagnosticAnalyzer, IConfigurationFixProvider>(
new CSharpRemoveUnusedParametersAndValuesDiagnosticAnalyzer(), new ConfigureCodeStyleOptionCodeFixProvider());
}
public class UnusedLocalVariableConfigurationTests : EnumCodeStyleOptionConfigurationTests
{
protected override int CodeActionIndex => 0;
[ConditionalFact(typeof(IsEnglishLocal)), Trait(Traits.Feature, Traits.Features.CodeActionsConfiguration)]
public async Task ConfigureEditorconfig_Empty_UnusedLocalVariable()
{
var input = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<Document FilePath=""z:\\file.cs"">
class Program1
{
static void Main()
{
// csharp_style_unused_value_assignment_preference = { discard_variable, unused_local_variable }
[|var obj = new Program1();|]
obj = null;
var obj2 = obj;
}
}
</Document>
<AnalyzerConfigDocument FilePath=""z:\\.editorconfig""></AnalyzerConfigDocument>
</Project>
</Workspace>";
var expected = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<Document FilePath=""z:\\file.cs"">
class Program1
{
static void Main()
{
// csharp_style_unused_value_assignment_preference = { discard_variable, unused_local_variable }
var obj = new Program1();
obj = null;
var obj2 = obj;
}
}
</Document>
<AnalyzerConfigDocument FilePath=""z:\\.editorconfig"">[*.cs]
# IDE0059: Unnecessary assignment of a value
csharp_style_unused_value_assignment_preference = unused_local_variable
</AnalyzerConfigDocument>
</Project>
</Workspace>";
await TestInRegularAndScriptAsync(input, expected, CodeActionIndex);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConfiguration)]
public async Task ConfigureEditorconfig_RuleExists_UnusedLocalVariable()
{
var input = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<Document FilePath=""z:\\file.cs"">
class Program1
{
static void Main()
{
// csharp_style_unused_value_assignment_preference = { discard_variable, unused_local_variable }
[|var obj = new Program1();|]
obj = null;
var obj2 = obj;
}
}
</Document>
<AnalyzerConfigDocument FilePath=""z:\\.editorconfig"">[*.cs] # Comment1
csharp_style_unused_value_assignment_preference = discard_variable:suggestion ; Comment2
</AnalyzerConfigDocument>
</Project>
</Workspace>";
var expected = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<Document FilePath=""z:\\file.cs"">
class Program1
{
static void Main()
{
// csharp_style_unused_value_assignment_preference = { discard_variable, unused_local_variable }
var obj = new Program1();
obj = null;
var obj2 = obj;
}
}
</Document>
<AnalyzerConfigDocument FilePath=""z:\\.editorconfig"">[*.cs] # Comment1
csharp_style_unused_value_assignment_preference = unused_local_variable:suggestion ; Comment2
</AnalyzerConfigDocument>
</Project>
</Workspace>";
await TestInRegularAndScriptAsync(input, expected, CodeActionIndex);
}
[ConditionalFact(typeof(IsEnglishLocal)), Trait(Traits.Feature, Traits.Features.CodeActionsConfiguration)]
public async Task ConfigureEditorconfig_RuleExists_DotnetDiagnosticEntry()
{
var input = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<Document FilePath=""z:\\file.cs"">
class Program1
{
static void Main()
{
// csharp_style_unused_value_assignment_preference = { discard_variable, unused_local_variable }
[|var obj = new Program1();|]
obj = null;
var obj2 = obj;
}
}
</Document>
<AnalyzerConfigDocument FilePath=""z:\\.editorconfig"">[*.cs] # Comment1
dotnet_diagnostic.IDE0059.severity = warning ; Comment2
</AnalyzerConfigDocument>
</Project>
</Workspace>";
var expected = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<Document FilePath=""z:\\file.cs"">
class Program1
{
static void Main()
{
// csharp_style_unused_value_assignment_preference = { discard_variable, unused_local_variable }
var obj = new Program1();
obj = null;
var obj2 = obj;
}
}
</Document>
<AnalyzerConfigDocument FilePath=""z:\\.editorconfig"">[*.cs] # Comment1
dotnet_diagnostic.IDE0059.severity = warning ; Comment2
# IDE0059: Unnecessary assignment of a value
csharp_style_unused_value_assignment_preference = unused_local_variable
</AnalyzerConfigDocument>
</Project>
</Workspace>";
await TestInRegularAndScriptAsync(input, expected, CodeActionIndex);
}
[ConditionalFact(typeof(IsEnglishLocal)), Trait(Traits.Feature, Traits.Features.CodeActionsConfiguration)]
public async Task ConfigureEditorconfig_RuleExists_ConflictingDotnetDiagnosticEntry()
{
var input = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<Document FilePath=""z:\\file.cs"">
class Program1
{
static void Main()
{
// csharp_style_unused_value_assignment_preference = { discard_variable, unused_local_variable }
[|var obj = new Program1();|]
obj = null;
var obj2 = obj;
}
}
</Document>
<AnalyzerConfigDocument FilePath=""z:\\.editorconfig"">[*.cs] # Comment1
dotnet_diagnostic.IDE0059.severity = error ; Comment2
csharp_style_unused_value_assignment_preference = discard_variable:suggestion ; Comment3
</AnalyzerConfigDocument>
</Project>
</Workspace>";
var expected = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<Document FilePath=""z:\\file.cs"">
class Program1
{
static void Main()
{
// csharp_style_unused_value_assignment_preference = { discard_variable, unused_local_variable }
var obj = new Program1();
obj = null;
var obj2 = obj;
}
}
</Document>
<AnalyzerConfigDocument FilePath=""z:\\.editorconfig"">[*.cs] # Comment1
dotnet_diagnostic.IDE0059.severity = error ; Comment2
csharp_style_unused_value_assignment_preference = unused_local_variable:suggestion ; Comment3
</AnalyzerConfigDocument>
</Project>
</Workspace>";
await TestInRegularAndScriptAsync(input, expected, CodeActionIndex);
}
[ConditionalFact(typeof(IsEnglishLocal)), Trait(Traits.Feature, Traits.Features.CodeActionsConfiguration)]
public async Task ConfigureEditorconfig_InvalidHeader_UnusedLocalVariable()
{
var input = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<Document FilePath=""z:\\file.cs"">
class Program1
{
static void Main()
{
// csharp_style_unused_value_assignment_preference = { discard_variable, unused_local_variable }
[|var obj = new Program1();|]
obj = null;
var obj2 = obj;
}
}
</Document>
<AnalyzerConfigDocument FilePath=""z:\\.editorconfig"">[*.vb]
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
</AnalyzerConfigDocument>
</Project>
</Workspace>";
var expected = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<Document FilePath=""z:\\file.cs"">
class Program1
{
static void Main()
{
// csharp_style_unused_value_assignment_preference = { discard_variable, unused_local_variable }
var obj = new Program1();
obj = null;
var obj2 = obj;
}
}
</Document>
<AnalyzerConfigDocument FilePath=""z:\\.editorconfig"">[*.vb]
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
[*.cs]
# IDE0059: Unnecessary assignment of a value
csharp_style_unused_value_assignment_preference = unused_local_variable
</AnalyzerConfigDocument>
</Project>
</Workspace>";
await TestInRegularAndScriptAsync(input, expected, CodeActionIndex);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConfiguration)]
public async Task ConfigureEditorconfig_MaintainSeverity_UnusedLocalVariable()
{
var input = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<Document FilePath=""z:\\file.cs"">
class Program1
{
static void Main()
{
// csharp_style_unused_value_assignment_preference = { discard_variable, unused_local_variable }
[|var obj = new Program1();|]
obj = null;
var obj2 = obj;
}
}
</Document>
<AnalyzerConfigDocument FilePath=""z:\\.editorconfig"">[*.{vb,cs}]
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
</AnalyzerConfigDocument>
</Project>
</Workspace>";
var expected = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<Document FilePath=""z:\\file.cs"">
class Program1
{
static void Main()
{
// csharp_style_unused_value_assignment_preference = { discard_variable, unused_local_variable }
var obj = new Program1();
obj = null;
var obj2 = obj;
}
}
</Document>
<AnalyzerConfigDocument FilePath=""z:\\.editorconfig"">[*.{vb,cs}]
csharp_style_unused_value_assignment_preference = unused_local_variable:suggestion
</AnalyzerConfigDocument>
</Project>
</Workspace>";
await TestInRegularAndScriptAsync(input, expected, CodeActionIndex);
}
[ConditionalFact(typeof(IsEnglishLocal)), Trait(Traits.Feature, Traits.Features.CodeActionsConfiguration)]
public async Task ConfigureEditorconfig_InvalidRule_UnusedLocalVariable()
{
var input = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<Document FilePath=""z:\\file.cs"">
class Program1
{
static void Main()
{
// csharp_style_unused_value_assignment_preference = { discard_variable, unused_local_variable }
[|var obj = new Program1();|]
obj = null;
var obj2 = obj;
}
}
</Document>
<AnalyzerConfigDocument FilePath=""z:\\.editorconfig"">[*.cs]
csharp_style_unused_value_assignment_preferencer = discard_variable:suggestion
</AnalyzerConfigDocument>
</Project>
</Workspace>";
var expected = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<Document FilePath=""z:\\file.cs"">
class Program1
{
static void Main()
{
// csharp_style_unused_value_assignment_preference = { discard_variable, unused_local_variable }
var obj = new Program1();
obj = null;
var obj2 = obj;
}
}
</Document>
<AnalyzerConfigDocument FilePath=""z:\\.editorconfig"">[*.cs]
csharp_style_unused_value_assignment_preferencer = discard_variable:suggestion
# IDE0059: Unnecessary assignment of a value
csharp_style_unused_value_assignment_preference = unused_local_variable
</AnalyzerConfigDocument>
</Project>
</Workspace>";
await TestInRegularAndScriptAsync(input, expected, CodeActionIndex);
}
}
public class DiscardVariableConfigurationTests : EnumCodeStyleOptionConfigurationTests
{
protected override int CodeActionIndex => 1;
[ConditionalFact(typeof(IsEnglishLocal)), Trait(Traits.Feature, Traits.Features.CodeActionsConfiguration)]
public async Task ConfigureEditorconfig_Empty_DiscardVariable()
{
var input = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<Document FilePath=""z:\\file.cs"">
class Program1
{
static void Main()
{
// csharp_style_unused_value_assignment_preference = { discard_variable, unused_local_variable }
[|var obj = new Program1();|]
obj = null;
var obj2 = obj;
}
}
</Document>
<AnalyzerConfigDocument FilePath=""z:\\.editorconfig""></AnalyzerConfigDocument>
</Project>
</Workspace>";
var expected = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<Document FilePath=""z:\\file.cs"">
class Program1
{
static void Main()
{
// csharp_style_unused_value_assignment_preference = { discard_variable, unused_local_variable }
var obj = new Program1();
obj = null;
var obj2 = obj;
}
}
</Document>
<AnalyzerConfigDocument FilePath=""z:\\.editorconfig"">[*.cs]
# IDE0059: Unnecessary assignment of a value
csharp_style_unused_value_assignment_preference = discard_variable
</AnalyzerConfigDocument>
</Project>
</Workspace>";
await TestInRegularAndScriptAsync(input, expected, CodeActionIndex);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConfiguration)]
public async Task ConfigureEditorconfig_RuleExists_DiscardVariable()
{
var input = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<Document FilePath=""z:\\file.cs"">
class Program1
{
static void Main()
{
// csharp_style_unused_value_assignment_preference = { discard_variable, unused_local_variable }
[|var obj = new Program1();|]
obj = null;
var obj2 = obj;
}
}
</Document>
<AnalyzerConfigDocument FilePath=""z:\\.editorconfig"">[*.cs]
csharp_style_unused_value_assignment_preference = unused_local_variable:suggestion
</AnalyzerConfigDocument>
</Project>
</Workspace>";
var expected = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<Document FilePath=""z:\\file.cs"">
class Program1
{
static void Main()
{
// csharp_style_unused_value_assignment_preference = { discard_variable, unused_local_variable }
var obj = new Program1();
obj = null;
var obj2 = obj;
}
}
</Document>
<AnalyzerConfigDocument FilePath=""z:\\.editorconfig"">[*.cs]
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
</AnalyzerConfigDocument>
</Project>
</Workspace>";
await TestInRegularAndScriptAsync(input, expected, CodeActionIndex);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConfiguration)]
public async Task ConfigureEditorconfig_RuleExists_DiscardVariable_WithoutSeveritySuffix()
{
var input = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<Document FilePath=""z:\\file.cs"">
class Program1
{
static void Main()
{
// csharp_style_unused_value_assignment_preference = { discard_variable, unused_local_variable }
[|var obj = new Program1();|]
obj = null;
var obj2 = obj;
}
}
</Document>
<AnalyzerConfigDocument FilePath=""z:\\.editorconfig"">[*.cs]
csharp_style_unused_value_assignment_preference = unused_local_variable
</AnalyzerConfigDocument>
</Project>
</Workspace>";
var expected = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<Document FilePath=""z:\\file.cs"">
class Program1
{
static void Main()
{
// csharp_style_unused_value_assignment_preference = { discard_variable, unused_local_variable }
var obj = new Program1();
obj = null;
var obj2 = obj;
}
}
</Document>
<AnalyzerConfigDocument FilePath=""z:\\.editorconfig"">[*.cs]
csharp_style_unused_value_assignment_preference = discard_variable
</AnalyzerConfigDocument>
</Project>
</Workspace>";
await TestInRegularAndScriptAsync(input, expected, CodeActionIndex);
}
[ConditionalFact(typeof(IsEnglishLocal)), Trait(Traits.Feature, Traits.Features.CodeActionsConfiguration)]
public async Task ConfigureEditorconfig_InvalidHeader_DiscardVariable()
{
var input = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<Document FilePath=""z:\\file.cs"">
class Program1
{
static void Main()
{
// csharp_style_unused_value_assignment_preference = { discard_variable, unused_local_variable }
[|var obj = new Program1();|]
obj = null;
var obj2 = obj;
}
}
</Document>
<AnalyzerConfigDocument FilePath=""z:\\.editorconfig"">[*.vb]
csharp_style_unused_value_assignment_preference = unused_local_variable:suggestion
</AnalyzerConfigDocument>
</Project>
</Workspace>";
var expected = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<Document FilePath=""z:\\file.cs"">
class Program1
{
static void Main()
{
// csharp_style_unused_value_assignment_preference = { discard_variable, unused_local_variable }
var obj = new Program1();
obj = null;
var obj2 = obj;
}
}
</Document>
<AnalyzerConfigDocument FilePath=""z:\\.editorconfig"">[*.vb]
csharp_style_unused_value_assignment_preference = unused_local_variable:suggestion
[*.cs]
# IDE0059: Unnecessary assignment of a value
csharp_style_unused_value_assignment_preference = discard_variable
</AnalyzerConfigDocument>
</Project>
</Workspace>";
await TestInRegularAndScriptAsync(input, expected, CodeActionIndex);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConfiguration)]
public async Task ConfigureEditorconfig_MaintainSeverity_DiscardVariable()
{
var input = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<Document FilePath=""z:\\file.cs"">
class Program1
{
static void Main()
{
// csharp_style_unused_value_assignment_preference = { discard_variable, unused_local_variable }
[|var obj = new Program1();|]
obj = null;
var obj2 = obj;
}
}
</Document>
<AnalyzerConfigDocument FilePath=""z:\\.editorconfig"">[*.{vb,cs}]
csharp_style_unused_value_assignment_preference = unused_local_variable:suggestion
</AnalyzerConfigDocument>
</Project>
</Workspace>";
var expected = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<Document FilePath=""z:\\file.cs"">
class Program1
{
static void Main()
{
// csharp_style_unused_value_assignment_preference = { discard_variable, unused_local_variable }
var obj = new Program1();
obj = null;
var obj2 = obj;
}
}
</Document>
<AnalyzerConfigDocument FilePath=""z:\\.editorconfig"">[*.{vb,cs}]
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
</AnalyzerConfigDocument>
</Project>
</Workspace>";
await TestInRegularAndScriptAsync(input, expected, CodeActionIndex);
}
[ConditionalFact(typeof(IsEnglishLocal)), Trait(Traits.Feature, Traits.Features.CodeActionsConfiguration)]
public async Task ConfigureEditorconfig_InvalidRule_DiscardVariable()
{
var input = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<Document FilePath=""z:\\file.cs"">
class Program1
{
static void Main()
{
// csharp_style_unused_value_assignment_preference = { discard_variable, unused_local_variable }
[|var obj = new Program1();|]
obj = null;
var obj2 = obj;
}
}
</Document>
<AnalyzerConfigDocument FilePath=""z:\\.editorconfig"">[*.cs]
csharp_style_unused_value_assignment_preference_error = discard_variable:suggestion
</AnalyzerConfigDocument>
</Project>
</Workspace>";
var expected = @"
<Workspace>
<Project Language=""C#"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<Document FilePath=""z:\\file.cs"">
class Program1
{
static void Main()
{
// csharp_style_unused_value_assignment_preference = { discard_variable, unused_local_variable }
var obj = new Program1();
obj = null;
var obj2 = obj;
}
}
</Document>
<AnalyzerConfigDocument FilePath=""z:\\.editorconfig"">[*.cs]
csharp_style_unused_value_assignment_preference_error = discard_variable:suggestion
# IDE0059: Unnecessary assignment of a value
csharp_style_unused_value_assignment_preference = discard_variable
</AnalyzerConfigDocument>
</Project>
</Workspace>";
await TestInRegularAndScriptAsync(input, expected, CodeActionIndex);
}
}
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/EditorFeatures/Core/Implementation/IntelliSense/AsyncCompletion/CommitManagerProvider.cs | // 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.ComponentModel.Composition;
using Microsoft.CodeAnalysis.Editor.Shared.Extensions;
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Utilities;
namespace Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.AsyncCompletion
{
[Export(typeof(IAsyncCompletionCommitManagerProvider))]
[Name("Roslyn Completion Commit Manager")]
[ContentType(ContentTypeNames.RoslynContentType)]
internal class CommitManagerProvider : IAsyncCompletionCommitManagerProvider
{
private readonly IThreadingContext _threadingContext;
private readonly RecentItemsManager _recentItemsManager;
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public CommitManagerProvider(IThreadingContext threadingContext, RecentItemsManager recentItemsManager)
{
_threadingContext = threadingContext;
_recentItemsManager = recentItemsManager;
}
IAsyncCompletionCommitManager? IAsyncCompletionCommitManagerProvider.GetOrCreate(ITextView textView)
{
if (textView.TextBuffer.IsInLspEditorContext())
{
return null;
}
return new CommitManager(textView, _recentItemsManager, _threadingContext);
}
}
}
| // 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.ComponentModel.Composition;
using Microsoft.CodeAnalysis.Editor.Shared.Extensions;
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Utilities;
namespace Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.AsyncCompletion
{
[Export(typeof(IAsyncCompletionCommitManagerProvider))]
[Name("Roslyn Completion Commit Manager")]
[ContentType(ContentTypeNames.RoslynContentType)]
internal class CommitManagerProvider : IAsyncCompletionCommitManagerProvider
{
private readonly IThreadingContext _threadingContext;
private readonly RecentItemsManager _recentItemsManager;
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public CommitManagerProvider(IThreadingContext threadingContext, RecentItemsManager recentItemsManager)
{
_threadingContext = threadingContext;
_recentItemsManager = recentItemsManager;
}
IAsyncCompletionCommitManager? IAsyncCompletionCommitManagerProvider.GetOrCreate(ITextView textView)
{
if (textView.TextBuffer.IsInLspEditorContext())
{
return null;
}
return new CommitManager(textView, _recentItemsManager, _threadingContext);
}
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Compilers/VisualBasic/Portable/Declarations/DeclarationModifiers.vb | ' 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.
Imports System.Runtime.CompilerServices
Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
<Flags()>
Friend Enum DeclarationModifiers
None = 0
[Private] = 1
[Protected] = 1 << 1
[Friend] = 1 << 2
[Public] = 1 << 3
AllAccessibilityModifiers = [Private] Or [Friend] Or [Protected] Or [Public]
[Shared] = 1 << 4
[ReadOnly] = 1 << 5
[WriteOnly] = 1 << 6
AllWriteabilityModifiers = [ReadOnly] Or [WriteOnly]
[Overrides] = 1 << 7
[Overridable] = 1 << 8
[MustOverride] = 1 << 9
[NotOverridable] = 1 << 10
AllOverrideModifiers = [Overridable] Or [MustOverride] Or [NotOverridable]
[Overloads] = 1 << 11
[Shadows] = 1 << 12
AllShadowingModifiers = [Overloads] Or [Shadows]
[Default] = 1 << 13
[WithEvents] = 1 << 14
[Widening] = 1 << 15
[Narrowing] = 1 << 16
AllConversionModifiers = [Widening] Or [Narrowing]
[Partial] = 1 << 17
[MustInherit] = 1 << 18
[NotInheritable] = 1 << 19
Async = 1 << 20
Iterator = 1 << 21
[Dim] = 1 << 22
[Const] = 1 << 23
[Static] = 1 << 24
InvalidInNotInheritableClass = [Overridable] Or [NotOverridable] Or [MustOverride] Or [Default]
InvalidInModule = [Protected] Or [Shared] Or [Default] Or [MustOverride] Or [Overridable] Or [Shadows] Or [Overrides]
InvalidInInterface = AllAccessibilityModifiers Or [Shared]
End Enum
End Namespace
| ' 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.
Imports System.Runtime.CompilerServices
Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
<Flags()>
Friend Enum DeclarationModifiers
None = 0
[Private] = 1
[Protected] = 1 << 1
[Friend] = 1 << 2
[Public] = 1 << 3
AllAccessibilityModifiers = [Private] Or [Friend] Or [Protected] Or [Public]
[Shared] = 1 << 4
[ReadOnly] = 1 << 5
[WriteOnly] = 1 << 6
AllWriteabilityModifiers = [ReadOnly] Or [WriteOnly]
[Overrides] = 1 << 7
[Overridable] = 1 << 8
[MustOverride] = 1 << 9
[NotOverridable] = 1 << 10
AllOverrideModifiers = [Overridable] Or [MustOverride] Or [NotOverridable]
[Overloads] = 1 << 11
[Shadows] = 1 << 12
AllShadowingModifiers = [Overloads] Or [Shadows]
[Default] = 1 << 13
[WithEvents] = 1 << 14
[Widening] = 1 << 15
[Narrowing] = 1 << 16
AllConversionModifiers = [Widening] Or [Narrowing]
[Partial] = 1 << 17
[MustInherit] = 1 << 18
[NotInheritable] = 1 << 19
Async = 1 << 20
Iterator = 1 << 21
[Dim] = 1 << 22
[Const] = 1 << 23
[Static] = 1 << 24
InvalidInNotInheritableClass = [Overridable] Or [NotOverridable] Or [MustOverride] Or [Default]
InvalidInModule = [Protected] Or [Shared] Or [Default] Or [MustOverride] Or [Overridable] Or [Shadows] Or [Overrides]
InvalidInInterface = AllAccessibilityModifiers Or [Shared]
End Enum
End Namespace
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/VisualStudio/Core/Def/Implementation/Library/VsNavInfo/Extensions.cs | // 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.
#nullable disable
using System.Collections.Immutable;
using Microsoft.VisualStudio.Shell.Interop;
namespace Microsoft.VisualStudio.LanguageServices.Implementation.Library.VsNavInfo
{
internal static class Extensions
{
public static void Add(this ImmutableArray<NavInfoNode>.Builder builder, string name, _LIB_LISTTYPE type, bool expandDottedNames)
{
if (name == null)
{
return;
}
if (expandDottedNames)
{
const char separator = '.';
var start = 0;
var separatorPos = name.IndexOf(separator, start);
while (separatorPos >= 0)
{
builder.Add(name.Substring(start, separatorPos - start), type);
start = separatorPos + 1;
separatorPos = name.IndexOf(separator, start);
}
if (start < name.Length)
{
builder.Add(name.Substring(start), type);
}
}
else
{
builder.Add(name, type);
}
}
public static void Add(this ImmutableArray<NavInfoNode>.Builder builder, string name, _LIB_LISTTYPE type)
{
if (string.IsNullOrEmpty(name))
{
return;
}
builder.Add(new NavInfoNode(name, type));
}
}
}
| // 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.
#nullable disable
using System.Collections.Immutable;
using Microsoft.VisualStudio.Shell.Interop;
namespace Microsoft.VisualStudio.LanguageServices.Implementation.Library.VsNavInfo
{
internal static class Extensions
{
public static void Add(this ImmutableArray<NavInfoNode>.Builder builder, string name, _LIB_LISTTYPE type, bool expandDottedNames)
{
if (name == null)
{
return;
}
if (expandDottedNames)
{
const char separator = '.';
var start = 0;
var separatorPos = name.IndexOf(separator, start);
while (separatorPos >= 0)
{
builder.Add(name.Substring(start, separatorPos - start), type);
start = separatorPos + 1;
separatorPos = name.IndexOf(separator, start);
}
if (start < name.Length)
{
builder.Add(name.Substring(start), type);
}
}
else
{
builder.Add(name, type);
}
}
public static void Add(this ImmutableArray<NavInfoNode>.Builder builder, string name, _LIB_LISTTYPE type)
{
if (string.IsNullOrEmpty(name))
{
return;
}
builder.Add(new NavInfoNode(name, type));
}
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Workspaces/SharedUtilitiesAndExtensions/Workspace/VisualBasic/Extensions/ITypeSymbolExtensions.vb | ' 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.
Imports System.Runtime.CompilerServices
Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.Simplification
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic.Extensions
Friend Module ITypeSymbolExtensions
<Extension>
Public Function GenerateExpressionSyntax(typeSymbol As ITypeSymbol) As ExpressionSyntax
Return typeSymbol.Accept(New ExpressionSyntaxGeneratorVisitor(addGlobal:=True)).WithAdditionalAnnotations(Simplifier.Annotation)
End Function
<Extension()>
Public Function GetPredefinedCastKeyword(specialType As SpecialType) As SyntaxKind
Select Case specialType
Case specialType.System_Boolean
Return SyntaxKind.CBoolKeyword
Case specialType.System_Byte
Return SyntaxKind.CByteKeyword
Case specialType.System_Char
Return SyntaxKind.CCharKeyword
Case specialType.System_DateTime
Return SyntaxKind.CDateKeyword
Case specialType.System_Decimal
Return SyntaxKind.CDecKeyword
Case specialType.System_Double
Return SyntaxKind.CDblKeyword
Case specialType.System_Int32
Return SyntaxKind.CIntKeyword
Case specialType.System_Int64
Return SyntaxKind.CLngKeyword
Case specialType.System_Object
Return SyntaxKind.CObjKeyword
Case specialType.System_SByte
Return SyntaxKind.CSByteKeyword
Case specialType.System_Single
Return SyntaxKind.CSngKeyword
Case specialType.System_Int16
Return SyntaxKind.CShortKeyword
Case SpecialType.System_String
Return SyntaxKind.CStrKeyword
Case specialType.System_UInt32
Return SyntaxKind.CUIntKeyword
Case specialType.System_UInt64
Return SyntaxKind.CULngKeyword
Case specialType.System_UInt16
Return SyntaxKind.CUShortKeyword
Case Else
Return SyntaxKind.None
End Select
End Function
<Extension()>
Public Function GetTypeFromPredefinedCastKeyword(compilation As Compilation, castKeyword As SyntaxKind) As ITypeSymbol
Dim specialType As SpecialType
Select Case castKeyword
Case SyntaxKind.CBoolKeyword
specialType = specialType.System_Boolean
Case SyntaxKind.CByteKeyword
specialType = specialType.System_Byte
Case SyntaxKind.CCharKeyword
specialType = specialType.System_Char
Case SyntaxKind.CDateKeyword
specialType = specialType.System_DateTime
Case SyntaxKind.CDecKeyword
specialType = specialType.System_Decimal
Case SyntaxKind.CDblKeyword
specialType = specialType.System_Double
Case SyntaxKind.CIntKeyword
specialType = specialType.System_Int32
Case SyntaxKind.CLngKeyword
specialType = specialType.System_Int64
Case SyntaxKind.CObjKeyword
specialType = specialType.System_Object
Case SyntaxKind.CSByteKeyword
specialType = specialType.System_SByte
Case SyntaxKind.CSngKeyword
specialType = specialType.System_Single
Case SyntaxKind.CStrKeyword
specialType = specialType.System_String
Case SyntaxKind.CShortKeyword
specialType = specialType.System_Int16
Case SyntaxKind.CUIntKeyword
specialType = specialType.System_UInt32
Case SyntaxKind.CULngKeyword
specialType = specialType.System_UInt64
Case SyntaxKind.CUShortKeyword
specialType = specialType.System_UInt16
Case Else
Return Nothing
End Select
Return compilation.GetSpecialType(specialType)
End Function
<Extension>
Public Function IsIntrinsicType(this As ITypeSymbol) As Boolean
Select Case this.SpecialType
Case SpecialType.System_Boolean,
SpecialType.System_Byte,
SpecialType.System_SByte,
SpecialType.System_Int16,
SpecialType.System_UInt16,
SpecialType.System_Int32,
SpecialType.System_UInt32,
SpecialType.System_Int64,
SpecialType.System_UInt64,
SpecialType.System_Single,
SpecialType.System_Double,
SpecialType.System_Decimal,
SpecialType.System_DateTime,
SpecialType.System_Char,
SpecialType.System_String
Return True
Case Else
Return False
End Select
End Function
End Module
End Namespace
| ' 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.
Imports System.Runtime.CompilerServices
Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.Simplification
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic.Extensions
Friend Module ITypeSymbolExtensions
<Extension>
Public Function GenerateExpressionSyntax(typeSymbol As ITypeSymbol) As ExpressionSyntax
Return typeSymbol.Accept(New ExpressionSyntaxGeneratorVisitor(addGlobal:=True)).WithAdditionalAnnotations(Simplifier.Annotation)
End Function
<Extension()>
Public Function GetPredefinedCastKeyword(specialType As SpecialType) As SyntaxKind
Select Case specialType
Case specialType.System_Boolean
Return SyntaxKind.CBoolKeyword
Case specialType.System_Byte
Return SyntaxKind.CByteKeyword
Case specialType.System_Char
Return SyntaxKind.CCharKeyword
Case specialType.System_DateTime
Return SyntaxKind.CDateKeyword
Case specialType.System_Decimal
Return SyntaxKind.CDecKeyword
Case specialType.System_Double
Return SyntaxKind.CDblKeyword
Case specialType.System_Int32
Return SyntaxKind.CIntKeyword
Case specialType.System_Int64
Return SyntaxKind.CLngKeyword
Case specialType.System_Object
Return SyntaxKind.CObjKeyword
Case specialType.System_SByte
Return SyntaxKind.CSByteKeyword
Case specialType.System_Single
Return SyntaxKind.CSngKeyword
Case specialType.System_Int16
Return SyntaxKind.CShortKeyword
Case SpecialType.System_String
Return SyntaxKind.CStrKeyword
Case specialType.System_UInt32
Return SyntaxKind.CUIntKeyword
Case specialType.System_UInt64
Return SyntaxKind.CULngKeyword
Case specialType.System_UInt16
Return SyntaxKind.CUShortKeyword
Case Else
Return SyntaxKind.None
End Select
End Function
<Extension()>
Public Function GetTypeFromPredefinedCastKeyword(compilation As Compilation, castKeyword As SyntaxKind) As ITypeSymbol
Dim specialType As SpecialType
Select Case castKeyword
Case SyntaxKind.CBoolKeyword
specialType = specialType.System_Boolean
Case SyntaxKind.CByteKeyword
specialType = specialType.System_Byte
Case SyntaxKind.CCharKeyword
specialType = specialType.System_Char
Case SyntaxKind.CDateKeyword
specialType = specialType.System_DateTime
Case SyntaxKind.CDecKeyword
specialType = specialType.System_Decimal
Case SyntaxKind.CDblKeyword
specialType = specialType.System_Double
Case SyntaxKind.CIntKeyword
specialType = specialType.System_Int32
Case SyntaxKind.CLngKeyword
specialType = specialType.System_Int64
Case SyntaxKind.CObjKeyword
specialType = specialType.System_Object
Case SyntaxKind.CSByteKeyword
specialType = specialType.System_SByte
Case SyntaxKind.CSngKeyword
specialType = specialType.System_Single
Case SyntaxKind.CStrKeyword
specialType = specialType.System_String
Case SyntaxKind.CShortKeyword
specialType = specialType.System_Int16
Case SyntaxKind.CUIntKeyword
specialType = specialType.System_UInt32
Case SyntaxKind.CULngKeyword
specialType = specialType.System_UInt64
Case SyntaxKind.CUShortKeyword
specialType = specialType.System_UInt16
Case Else
Return Nothing
End Select
Return compilation.GetSpecialType(specialType)
End Function
<Extension>
Public Function IsIntrinsicType(this As ITypeSymbol) As Boolean
Select Case this.SpecialType
Case SpecialType.System_Boolean,
SpecialType.System_Byte,
SpecialType.System_SByte,
SpecialType.System_Int16,
SpecialType.System_UInt16,
SpecialType.System_Int32,
SpecialType.System_UInt32,
SpecialType.System_Int64,
SpecialType.System_UInt64,
SpecialType.System_Single,
SpecialType.System_Double,
SpecialType.System_Decimal,
SpecialType.System_DateTime,
SpecialType.System_Char,
SpecialType.System_String
Return True
Case Else
Return False
End Select
End Function
End Module
End Namespace
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Features/CSharp/Portable/QuickInfo/CSharpQuickInfoSevice.cs | // 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.Composition;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.QuickInfo;
namespace Microsoft.CodeAnalysis.CSharp.QuickInfo
{
[ExportLanguageServiceFactory(typeof(QuickInfoService), LanguageNames.CSharp), Shared]
internal class CSharpQuickInfoServiceFactory : ILanguageServiceFactory
{
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public CSharpQuickInfoServiceFactory()
{
}
public ILanguageService CreateLanguageService(HostLanguageServices languageServices)
=> new CSharpQuickInfoService(languageServices.WorkspaceServices.Workspace);
}
internal class CSharpQuickInfoService : QuickInfoServiceWithProviders
{
internal CSharpQuickInfoService(Workspace workspace)
: base(workspace, LanguageNames.CSharp)
{
}
}
}
| // 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.Composition;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.QuickInfo;
namespace Microsoft.CodeAnalysis.CSharp.QuickInfo
{
[ExportLanguageServiceFactory(typeof(QuickInfoService), LanguageNames.CSharp), Shared]
internal class CSharpQuickInfoServiceFactory : ILanguageServiceFactory
{
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public CSharpQuickInfoServiceFactory()
{
}
public ILanguageService CreateLanguageService(HostLanguageServices languageServices)
=> new CSharpQuickInfoService(languageServices.WorkspaceServices.Workspace);
}
internal class CSharpQuickInfoService : QuickInfoServiceWithProviders
{
internal CSharpQuickInfoService(Workspace workspace)
: base(workspace, LanguageNames.CSharp)
{
}
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Compilers/CSharp/Portable/Symbols/PublicModel/MethodSymbol.cs | // 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.
#nullable disable
using System.Collections.Immutable;
using System.Diagnostics;
using System.Reflection.Metadata;
using System.Threading;
using Microsoft.Cci;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.CSharp.Symbols.PublicModel
{
internal sealed class MethodSymbol : Symbol, IMethodSymbol
{
private readonly Symbols.MethodSymbol _underlying;
private ITypeSymbol _lazyReturnType;
private ImmutableArray<ITypeSymbol> _lazyTypeArguments;
private ITypeSymbol _lazyReceiverType;
public MethodSymbol(Symbols.MethodSymbol underlying)
{
Debug.Assert(underlying is object);
_underlying = underlying;
}
internal override CSharp.Symbol UnderlyingSymbol => _underlying;
internal Symbols.MethodSymbol UnderlyingMethodSymbol => _underlying;
MethodKind IMethodSymbol.MethodKind
{
get
{
switch (_underlying.MethodKind)
{
case MethodKind.AnonymousFunction:
return MethodKind.AnonymousFunction;
case MethodKind.Constructor:
return MethodKind.Constructor;
case MethodKind.Conversion:
return MethodKind.Conversion;
case MethodKind.DelegateInvoke:
return MethodKind.DelegateInvoke;
case MethodKind.Destructor:
return MethodKind.Destructor;
case MethodKind.EventAdd:
return MethodKind.EventAdd;
case MethodKind.EventRemove:
return MethodKind.EventRemove;
case MethodKind.ExplicitInterfaceImplementation:
return MethodKind.ExplicitInterfaceImplementation;
case MethodKind.UserDefinedOperator:
return MethodKind.UserDefinedOperator;
case MethodKind.BuiltinOperator:
return MethodKind.BuiltinOperator;
case MethodKind.Ordinary:
return MethodKind.Ordinary;
case MethodKind.PropertyGet:
return MethodKind.PropertyGet;
case MethodKind.PropertySet:
return MethodKind.PropertySet;
case MethodKind.ReducedExtension:
return MethodKind.ReducedExtension;
case MethodKind.StaticConstructor:
return MethodKind.StaticConstructor;
case MethodKind.LocalFunction:
return MethodKind.LocalFunction;
case MethodKind.FunctionPointerSignature:
return MethodKind.FunctionPointerSignature;
default:
throw ExceptionUtilities.UnexpectedValue(_underlying.MethodKind);
}
}
}
ITypeSymbol IMethodSymbol.ReturnType
{
get
{
if (_lazyReturnType is null)
{
Interlocked.CompareExchange(ref _lazyReturnType, _underlying.ReturnTypeWithAnnotations.GetPublicSymbol(), null);
}
return _lazyReturnType;
}
}
CodeAnalysis.NullableAnnotation IMethodSymbol.ReturnNullableAnnotation
{
get
{
return _underlying.ReturnTypeWithAnnotations.ToPublicAnnotation();
}
}
ImmutableArray<ITypeSymbol> IMethodSymbol.TypeArguments
{
get
{
if (_lazyTypeArguments.IsDefault)
{
ImmutableInterlocked.InterlockedCompareExchange(ref _lazyTypeArguments, _underlying.TypeArgumentsWithAnnotations.GetPublicSymbols(), default);
}
return _lazyTypeArguments;
}
}
ImmutableArray<CodeAnalysis.NullableAnnotation> IMethodSymbol.TypeArgumentNullableAnnotations =>
_underlying.TypeArgumentsWithAnnotations.ToPublicAnnotations();
ImmutableArray<ITypeParameterSymbol> IMethodSymbol.TypeParameters
{
get
{
return _underlying.TypeParameters.GetPublicSymbols();
}
}
ImmutableArray<IParameterSymbol> IMethodSymbol.Parameters
{
get
{
return _underlying.Parameters.GetPublicSymbols();
}
}
IMethodSymbol IMethodSymbol.ConstructedFrom
{
get
{
return _underlying.ConstructedFrom.GetPublicSymbol();
}
}
bool IMethodSymbol.IsReadOnly
{
get
{
return _underlying.IsEffectivelyReadOnly;
}
}
bool IMethodSymbol.IsInitOnly
{
get
{
return _underlying.IsInitOnly;
}
}
IMethodSymbol IMethodSymbol.OriginalDefinition
{
get
{
return _underlying.OriginalDefinition.GetPublicSymbol();
}
}
IMethodSymbol IMethodSymbol.OverriddenMethod
{
get
{
return _underlying.OverriddenMethod.GetPublicSymbol();
}
}
ITypeSymbol IMethodSymbol.ReceiverType
{
get
{
if (_lazyReceiverType is null)
{
Interlocked.CompareExchange(ref _lazyReceiverType, _underlying.ReceiverType?.GetITypeSymbol(_underlying.ReceiverNullableAnnotation), null);
}
return _lazyReceiverType;
}
}
CodeAnalysis.NullableAnnotation IMethodSymbol.ReceiverNullableAnnotation => _underlying.ReceiverNullableAnnotation;
IMethodSymbol IMethodSymbol.ReducedFrom
{
get
{
return _underlying.ReducedFrom.GetPublicSymbol();
}
}
ITypeSymbol IMethodSymbol.GetTypeInferredDuringReduction(ITypeParameterSymbol reducedFromTypeParameter)
{
return _underlying.GetTypeInferredDuringReduction(
reducedFromTypeParameter.EnsureCSharpSymbolOrNull(nameof(reducedFromTypeParameter))).
GetPublicSymbol();
}
IMethodSymbol IMethodSymbol.ReduceExtensionMethod(ITypeSymbol receiverType)
{
return _underlying.ReduceExtensionMethod(
receiverType.EnsureCSharpSymbolOrNull(nameof(receiverType)), compilation: null).
GetPublicSymbol();
}
ImmutableArray<IMethodSymbol> IMethodSymbol.ExplicitInterfaceImplementations
{
get
{
return _underlying.ExplicitInterfaceImplementations.GetPublicSymbols();
}
}
ISymbol IMethodSymbol.AssociatedSymbol
{
get
{
return _underlying.AssociatedSymbol.GetPublicSymbol();
}
}
bool IMethodSymbol.IsGenericMethod
{
get
{
return _underlying.IsGenericMethod;
}
}
bool IMethodSymbol.IsAsync
{
get
{
return _underlying.IsAsync;
}
}
bool IMethodSymbol.HidesBaseMethodsByName
{
get
{
return _underlying.HidesBaseMethodsByName;
}
}
ImmutableArray<CustomModifier> IMethodSymbol.ReturnTypeCustomModifiers
{
get
{
return _underlying.ReturnTypeWithAnnotations.CustomModifiers;
}
}
ImmutableArray<CustomModifier> IMethodSymbol.RefCustomModifiers
{
get
{
return _underlying.RefCustomModifiers;
}
}
ImmutableArray<AttributeData> IMethodSymbol.GetReturnTypeAttributes()
{
return _underlying.GetReturnTypeAttributes().Cast<CSharpAttributeData, AttributeData>();
}
SignatureCallingConvention IMethodSymbol.CallingConvention => _underlying.CallingConvention.ToSignatureConvention();
ImmutableArray<INamedTypeSymbol> IMethodSymbol.UnmanagedCallingConventionTypes => _underlying.UnmanagedCallingConventionTypes.SelectAsArray(t => t.GetPublicSymbol());
IMethodSymbol IMethodSymbol.Construct(params ITypeSymbol[] typeArguments)
{
return _underlying.Construct(ConstructTypeArguments(typeArguments)).GetPublicSymbol();
}
IMethodSymbol IMethodSymbol.Construct(ImmutableArray<ITypeSymbol> typeArguments, ImmutableArray<CodeAnalysis.NullableAnnotation> typeArgumentNullableAnnotations)
{
return _underlying.Construct(ConstructTypeArguments(typeArguments, typeArgumentNullableAnnotations)).GetPublicSymbol();
}
IMethodSymbol IMethodSymbol.PartialImplementationPart
{
get
{
return _underlying.PartialImplementationPart.GetPublicSymbol();
}
}
IMethodSymbol IMethodSymbol.PartialDefinitionPart
{
get
{
return _underlying.PartialDefinitionPart.GetPublicSymbol();
}
}
bool IMethodSymbol.IsPartialDefinition => _underlying.IsPartialDefinition();
INamedTypeSymbol IMethodSymbol.AssociatedAnonymousDelegate
{
get
{
return null;
}
}
int IMethodSymbol.Arity => _underlying.Arity;
bool IMethodSymbol.IsExtensionMethod => _underlying.IsExtensionMethod;
System.Reflection.MethodImplAttributes IMethodSymbol.MethodImplementationFlags => _underlying.ImplementationAttributes;
bool IMethodSymbol.IsVararg => _underlying.IsVararg;
bool IMethodSymbol.IsCheckedBuiltin => _underlying.IsCheckedBuiltin;
bool IMethodSymbol.ReturnsVoid => _underlying.ReturnsVoid;
bool IMethodSymbol.ReturnsByRef => _underlying.ReturnsByRef;
bool IMethodSymbol.ReturnsByRefReadonly => _underlying.ReturnsByRefReadonly;
RefKind IMethodSymbol.RefKind => _underlying.RefKind;
bool IMethodSymbol.IsConditional => _underlying.IsConditional;
DllImportData IMethodSymbol.GetDllImportData() => _underlying.GetDllImportData();
#region ISymbol Members
protected override void Accept(SymbolVisitor visitor)
{
visitor.VisitMethod(this);
}
protected override TResult Accept<TResult>(SymbolVisitor<TResult> visitor)
{
return visitor.VisitMethod(this);
}
#endregion
}
}
| // 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.
#nullable disable
using System.Collections.Immutable;
using System.Diagnostics;
using System.Reflection.Metadata;
using System.Threading;
using Microsoft.Cci;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.CSharp.Symbols.PublicModel
{
internal sealed class MethodSymbol : Symbol, IMethodSymbol
{
private readonly Symbols.MethodSymbol _underlying;
private ITypeSymbol _lazyReturnType;
private ImmutableArray<ITypeSymbol> _lazyTypeArguments;
private ITypeSymbol _lazyReceiverType;
public MethodSymbol(Symbols.MethodSymbol underlying)
{
Debug.Assert(underlying is object);
_underlying = underlying;
}
internal override CSharp.Symbol UnderlyingSymbol => _underlying;
internal Symbols.MethodSymbol UnderlyingMethodSymbol => _underlying;
MethodKind IMethodSymbol.MethodKind
{
get
{
switch (_underlying.MethodKind)
{
case MethodKind.AnonymousFunction:
return MethodKind.AnonymousFunction;
case MethodKind.Constructor:
return MethodKind.Constructor;
case MethodKind.Conversion:
return MethodKind.Conversion;
case MethodKind.DelegateInvoke:
return MethodKind.DelegateInvoke;
case MethodKind.Destructor:
return MethodKind.Destructor;
case MethodKind.EventAdd:
return MethodKind.EventAdd;
case MethodKind.EventRemove:
return MethodKind.EventRemove;
case MethodKind.ExplicitInterfaceImplementation:
return MethodKind.ExplicitInterfaceImplementation;
case MethodKind.UserDefinedOperator:
return MethodKind.UserDefinedOperator;
case MethodKind.BuiltinOperator:
return MethodKind.BuiltinOperator;
case MethodKind.Ordinary:
return MethodKind.Ordinary;
case MethodKind.PropertyGet:
return MethodKind.PropertyGet;
case MethodKind.PropertySet:
return MethodKind.PropertySet;
case MethodKind.ReducedExtension:
return MethodKind.ReducedExtension;
case MethodKind.StaticConstructor:
return MethodKind.StaticConstructor;
case MethodKind.LocalFunction:
return MethodKind.LocalFunction;
case MethodKind.FunctionPointerSignature:
return MethodKind.FunctionPointerSignature;
default:
throw ExceptionUtilities.UnexpectedValue(_underlying.MethodKind);
}
}
}
ITypeSymbol IMethodSymbol.ReturnType
{
get
{
if (_lazyReturnType is null)
{
Interlocked.CompareExchange(ref _lazyReturnType, _underlying.ReturnTypeWithAnnotations.GetPublicSymbol(), null);
}
return _lazyReturnType;
}
}
CodeAnalysis.NullableAnnotation IMethodSymbol.ReturnNullableAnnotation
{
get
{
return _underlying.ReturnTypeWithAnnotations.ToPublicAnnotation();
}
}
ImmutableArray<ITypeSymbol> IMethodSymbol.TypeArguments
{
get
{
if (_lazyTypeArguments.IsDefault)
{
ImmutableInterlocked.InterlockedCompareExchange(ref _lazyTypeArguments, _underlying.TypeArgumentsWithAnnotations.GetPublicSymbols(), default);
}
return _lazyTypeArguments;
}
}
ImmutableArray<CodeAnalysis.NullableAnnotation> IMethodSymbol.TypeArgumentNullableAnnotations =>
_underlying.TypeArgumentsWithAnnotations.ToPublicAnnotations();
ImmutableArray<ITypeParameterSymbol> IMethodSymbol.TypeParameters
{
get
{
return _underlying.TypeParameters.GetPublicSymbols();
}
}
ImmutableArray<IParameterSymbol> IMethodSymbol.Parameters
{
get
{
return _underlying.Parameters.GetPublicSymbols();
}
}
IMethodSymbol IMethodSymbol.ConstructedFrom
{
get
{
return _underlying.ConstructedFrom.GetPublicSymbol();
}
}
bool IMethodSymbol.IsReadOnly
{
get
{
return _underlying.IsEffectivelyReadOnly;
}
}
bool IMethodSymbol.IsInitOnly
{
get
{
return _underlying.IsInitOnly;
}
}
IMethodSymbol IMethodSymbol.OriginalDefinition
{
get
{
return _underlying.OriginalDefinition.GetPublicSymbol();
}
}
IMethodSymbol IMethodSymbol.OverriddenMethod
{
get
{
return _underlying.OverriddenMethod.GetPublicSymbol();
}
}
ITypeSymbol IMethodSymbol.ReceiverType
{
get
{
if (_lazyReceiverType is null)
{
Interlocked.CompareExchange(ref _lazyReceiverType, _underlying.ReceiverType?.GetITypeSymbol(_underlying.ReceiverNullableAnnotation), null);
}
return _lazyReceiverType;
}
}
CodeAnalysis.NullableAnnotation IMethodSymbol.ReceiverNullableAnnotation => _underlying.ReceiverNullableAnnotation;
IMethodSymbol IMethodSymbol.ReducedFrom
{
get
{
return _underlying.ReducedFrom.GetPublicSymbol();
}
}
ITypeSymbol IMethodSymbol.GetTypeInferredDuringReduction(ITypeParameterSymbol reducedFromTypeParameter)
{
return _underlying.GetTypeInferredDuringReduction(
reducedFromTypeParameter.EnsureCSharpSymbolOrNull(nameof(reducedFromTypeParameter))).
GetPublicSymbol();
}
IMethodSymbol IMethodSymbol.ReduceExtensionMethod(ITypeSymbol receiverType)
{
return _underlying.ReduceExtensionMethod(
receiverType.EnsureCSharpSymbolOrNull(nameof(receiverType)), compilation: null).
GetPublicSymbol();
}
ImmutableArray<IMethodSymbol> IMethodSymbol.ExplicitInterfaceImplementations
{
get
{
return _underlying.ExplicitInterfaceImplementations.GetPublicSymbols();
}
}
ISymbol IMethodSymbol.AssociatedSymbol
{
get
{
return _underlying.AssociatedSymbol.GetPublicSymbol();
}
}
bool IMethodSymbol.IsGenericMethod
{
get
{
return _underlying.IsGenericMethod;
}
}
bool IMethodSymbol.IsAsync
{
get
{
return _underlying.IsAsync;
}
}
bool IMethodSymbol.HidesBaseMethodsByName
{
get
{
return _underlying.HidesBaseMethodsByName;
}
}
ImmutableArray<CustomModifier> IMethodSymbol.ReturnTypeCustomModifiers
{
get
{
return _underlying.ReturnTypeWithAnnotations.CustomModifiers;
}
}
ImmutableArray<CustomModifier> IMethodSymbol.RefCustomModifiers
{
get
{
return _underlying.RefCustomModifiers;
}
}
ImmutableArray<AttributeData> IMethodSymbol.GetReturnTypeAttributes()
{
return _underlying.GetReturnTypeAttributes().Cast<CSharpAttributeData, AttributeData>();
}
SignatureCallingConvention IMethodSymbol.CallingConvention => _underlying.CallingConvention.ToSignatureConvention();
ImmutableArray<INamedTypeSymbol> IMethodSymbol.UnmanagedCallingConventionTypes => _underlying.UnmanagedCallingConventionTypes.SelectAsArray(t => t.GetPublicSymbol());
IMethodSymbol IMethodSymbol.Construct(params ITypeSymbol[] typeArguments)
{
return _underlying.Construct(ConstructTypeArguments(typeArguments)).GetPublicSymbol();
}
IMethodSymbol IMethodSymbol.Construct(ImmutableArray<ITypeSymbol> typeArguments, ImmutableArray<CodeAnalysis.NullableAnnotation> typeArgumentNullableAnnotations)
{
return _underlying.Construct(ConstructTypeArguments(typeArguments, typeArgumentNullableAnnotations)).GetPublicSymbol();
}
IMethodSymbol IMethodSymbol.PartialImplementationPart
{
get
{
return _underlying.PartialImplementationPart.GetPublicSymbol();
}
}
IMethodSymbol IMethodSymbol.PartialDefinitionPart
{
get
{
return _underlying.PartialDefinitionPart.GetPublicSymbol();
}
}
bool IMethodSymbol.IsPartialDefinition => _underlying.IsPartialDefinition();
INamedTypeSymbol IMethodSymbol.AssociatedAnonymousDelegate
{
get
{
return null;
}
}
int IMethodSymbol.Arity => _underlying.Arity;
bool IMethodSymbol.IsExtensionMethod => _underlying.IsExtensionMethod;
System.Reflection.MethodImplAttributes IMethodSymbol.MethodImplementationFlags => _underlying.ImplementationAttributes;
bool IMethodSymbol.IsVararg => _underlying.IsVararg;
bool IMethodSymbol.IsCheckedBuiltin => _underlying.IsCheckedBuiltin;
bool IMethodSymbol.ReturnsVoid => _underlying.ReturnsVoid;
bool IMethodSymbol.ReturnsByRef => _underlying.ReturnsByRef;
bool IMethodSymbol.ReturnsByRefReadonly => _underlying.ReturnsByRefReadonly;
RefKind IMethodSymbol.RefKind => _underlying.RefKind;
bool IMethodSymbol.IsConditional => _underlying.IsConditional;
DllImportData IMethodSymbol.GetDllImportData() => _underlying.GetDllImportData();
#region ISymbol Members
protected override void Accept(SymbolVisitor visitor)
{
visitor.VisitMethod(this);
}
protected override TResult Accept<TResult>(SymbolVisitor<TResult> visitor)
{
return visitor.VisitMethod(this);
}
#endregion
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Collections/SimpleIntervalTree.cs | // 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.Collections.Generic;
namespace Microsoft.CodeAnalysis.Shared.Collections
{
internal class SimpleIntervalTree
{
public static SimpleIntervalTree<T, TIntrospector> Create<T, TIntrospector>(in TIntrospector introspector, params T[] values)
where TIntrospector : struct, IIntervalIntrospector<T>
{
return Create(in introspector, (IEnumerable<T>)values);
}
public static SimpleIntervalTree<T, TIntrospector> Create<T, TIntrospector>(in TIntrospector introspector, IEnumerable<T>? values = null)
where TIntrospector : struct, IIntervalIntrospector<T>
{
return new SimpleIntervalTree<T, TIntrospector>(in introspector, values);
}
}
}
| // 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.Collections.Generic;
namespace Microsoft.CodeAnalysis.Shared.Collections
{
internal class SimpleIntervalTree
{
public static SimpleIntervalTree<T, TIntrospector> Create<T, TIntrospector>(in TIntrospector introspector, params T[] values)
where TIntrospector : struct, IIntervalIntrospector<T>
{
return Create(in introspector, (IEnumerable<T>)values);
}
public static SimpleIntervalTree<T, TIntrospector> Create<T, TIntrospector>(in TIntrospector introspector, IEnumerable<T>? values = null)
where TIntrospector : struct, IIntervalIntrospector<T>
{
return new SimpleIntervalTree<T, TIntrospector>(in introspector, values);
}
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/EditorFeatures/CSharpTest/Diagnostics/GenerateEnumMember/GenerateEnumMemberTests.cs | // 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.
#nullable disable
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.CSharp.CodeFixes.GenerateEnumMember;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Test.Utilities;
using Roslyn.Test.Utilities;
using Xunit;
using Xunit.Abstractions;
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics.GenerateEnumMember
{
public class GenerateEnumMemberTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest
{
public GenerateEnumMemberTests(ITestOutputHelper logger)
: base(logger)
{
}
internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace)
=> (null, new GenerateEnumMemberCodeFixProvider());
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestEmptyEnum()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Red|];
}
}
enum Color
{
}",
@"class Program
{
void Main()
{
Color.Red;
}
}
enum Color
{
Red
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestWithSingleMember()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color
{
Red
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color
{
Red,
Blue
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestWithExistingComma()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color
{
Red,
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color
{
Red,
Blue,
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestWithMultipleMembers()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Green|];
}
}
enum Color
{
Red,
Blue
}",
@"class Program
{
void Main()
{
Color.Green;
}
}
enum Color
{
Red,
Blue,
Green
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestWithZero()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color
{
Red = 0
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color
{
Red = 0,
Blue = 1
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestWithIntegralValue()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color
{
Red = 1
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color
{
Red = 1,
Blue = 2
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestWithSingleBitIntegral()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color
{
Red = 2
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color
{
Red = 2,
Blue = 4
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestGenerateIntoGeometricSequence()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color
{
Red = 1,
Yellow = 2,
Green = 4
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color
{
Red = 1,
Yellow = 2,
Green = 4,
Blue = 8
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestWithSimpleSequence1()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color
{
Red = 1,
Green = 2
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color
{
Red = 1,
Green = 2,
Blue = 3
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestWithSimpleSequence2()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color
{
Yellow = 0,
Red = 1,
Green = 2
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color
{
Yellow = 0,
Red = 1,
Green = 2,
Blue = 3
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestWithNonZeroInteger()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color
{
Green = 5
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color
{
Green = 5,
Blue = 6
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestWithLeftShift0()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color
{
Green = 1 << 0
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color
{
Green = 1 << 0,
Blue = 1 << 1
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestWithLeftShift5()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color
{
Green = 1 << 5
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color
{
Green = 1 << 5,
Blue = 1 << 6
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestWithDifferentStyles()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color
{
Red = 2,
Green = 1 << 5
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color
{
Red = 2,
Green = 1 << 5,
Blue = 33
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestBinary()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color
{
Red = 0b01
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color
{
Red = 0b01,
Blue = 0b10
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestHex1()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color
{
Red = 0x1
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color
{
Red = 0x1,
Blue = 0x2
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestHex9()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color
{
Red = 0x9
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color
{
Red = 0x9,
Blue = 0xA
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestHexF()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color
{
Red = 0xF
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color
{
Red = 0xF,
Blue = 0x10
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestGenerateAfterEnumWithIntegerMaxValue()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color
{
Red = int.MaxValue
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color
{
Red = int.MaxValue,
Blue = int.MinValue
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestUnsigned16BitEnums()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color : ushort
{
Red = 65535
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color : ushort
{
Red = 65535,
Blue = 0
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestGenerateEnumMemberOfTypeLong()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color : long
{
Red = long.MaxValue
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color : long
{
Red = long.MaxValue,
Blue = long.MinValue
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestGenerateAfterEnumWithLongMaxValueInBinary()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color : long
{
Red = 0b0111111111111111111111111111111111111111111111111111111111111111
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color : long
{
Red = 0b0111111111111111111111111111111111111111111111111111111111111111,
Blue = 0b1000000000000000000000000000000000000000000000000000000000000000
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestGenerateAfterEnumWithLongMaxValueInHex()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color : long
{
Red = 0x7FFFFFFFFFFFFFFF
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color : long
{
Red = 0x7FFFFFFFFFFFFFFF,
Blue = 0x8000000000000000
}");
}
[WorkItem(528312, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/528312")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestGenerateAfterEnumWithLongMinValueInHex()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color : long
{
Red = 0xFFFFFFFFFFFFFFFF
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color : long
{
Red = 0xFFFFFFFFFFFFFFFF,
Blue
}");
}
[WorkItem(528312, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/528312")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestGenerateAfterPositiveLongInHex()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color : long
{
Red = 0xFFFFFFFFFFFFFFFF,
Green = 0x0
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color : long
{
Red = 0xFFFFFFFFFFFFFFFF,
Green = 0x0,
Blue = 0x1
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestGenerateAfterPositiveLongExprInHex()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color : long
{
Red = 0x414 / 2
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color : long
{
Red = 0x414 / 2,
Blue = 523
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestGenerateAfterEnumWithULongMaxValue()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color : ulong
{
Red = ulong.MaxValue
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color : ulong
{
Red = ulong.MaxValue,
Blue = 0
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestNegativeRangeIn64BitSignedEnums()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color : long
{
Red = -10
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color : long
{
Red = -10,
Blue = -9
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestGenerateWithImplicitValues()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color
{
Red,
Green,
Yellow = -1
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color
{
Red,
Green,
Yellow = -1,
Blue = 2
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestGenerateWithImplicitValues2()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color
{
Red,
Green = 10,
Yellow
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color
{
Red,
Green = 10,
Yellow,
Blue
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestNoExtraneousStatementTerminatorBeforeCommentedMember()
{
await TestInRegularAndScriptAsync(
@"class Program
{
static void Main(string[] args)
{
Color . [|Blue|] ;
}
}
enum Color
{
Red
//Blue
}",
@"class Program
{
static void Main(string[] args)
{
Color . Blue ;
}
}
enum Color
{
Red,
Blue
//Blue
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestNoExtraneousStatementTerminatorBeforeCommentedMember2()
{
await TestInRegularAndScriptAsync(
@"class Program
{
static void Main(string[] args)
{
Color . [|Blue|] ;
}
}
enum Color
{
Red
/*Blue*/
}",
@"class Program
{
static void Main(string[] args)
{
Color . Blue ;
}
}
enum Color
{
Red,
Blue
/*Blue*/
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestGenerateAfterEnumWithMinValue()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color
{
Red = int.MinValue
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color
{
Red = int.MinValue,
Blue = -2147483647
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestGenerateAfterEnumWithMinValuePlusConstant()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color
{
Red = int.MinValue + 100
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color
{
Red = int.MinValue + 100,
Blue = -2147483547
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestGenerateAfterEnumWithByteMaxValue()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color : byte
{
Red = 255
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color : byte
{
Red = 255,
Blue = 0
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestGenerateIntoBitshiftEnum1()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color
{
Red = 1 << 1,
Green = 1 << 2
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color
{
Red = 1 << 1,
Green = 1 << 2,
Blue = 1 << 3
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestGenerateIntoBitshiftEnum2()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color
{
Red = 2 >> 1
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color
{
Red = 2 >> 1,
Blue = 2
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestStandaloneReference()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color
{
Red = int.MinValue,
Green = 1
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color
{
Red = int.MinValue,
Green = 1,
Blue = 2
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestCircularEnumsForErrorTolerance()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Circular.[|C|];
}
}
enum Circular
{
A = B,
B
}",
@"class Program
{
void Main()
{
Circular.C;
}
}
enum Circular
{
A = B,
B,
C
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestEnumWithIncorrectValueForErrorTolerance()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Circular.[|B|];
}
}
enum Circular : byte
{
A = -2
}",
@"class Program
{
void Main()
{
Circular.B;
}
}
enum Circular : byte
{
A = -2,
B
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestGenerateIntoNewEnum()
{
await TestInRegularAndScriptAsync(
@"class B : A
{
void Main()
{
BaseColor.[|Blue|];
}
public new enum BaseColor
{
Yellow = 3
}
}
class A
{
public enum BaseColor
{
Red = 1,
Green = 2
}
}",
@"class B : A
{
void Main()
{
BaseColor.Blue;
}
public new enum BaseColor
{
Yellow = 3,
Blue = 4
}
}
class A
{
public enum BaseColor
{
Red = 1,
Green = 2
}
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestGenerateIntoDerivedEnumMissingNewKeyword()
{
await TestInRegularAndScriptAsync(
@"class B : A
{
void Main()
{
BaseColor.[|Blue|];
}
public enum BaseColor
{
Yellow = 3
}
}
class A
{
public enum BaseColor
{
Red = 1,
Green = 2
}
}",
@"class B : A
{
void Main()
{
BaseColor.Blue;
}
public enum BaseColor
{
Yellow = 3,
Blue = 4
}
}
class A
{
public enum BaseColor
{
Red = 1,
Green = 2
}
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestGenerateIntoBaseEnum()
{
await TestInRegularAndScriptAsync(
@"class B : A
{
void Main()
{
BaseColor.[|Blue|];
}
}
class A
{
public enum BaseColor
{
Red = 1,
Green = 2
}
}",
@"class B : A
{
void Main()
{
BaseColor.Blue;
}
}
class A
{
public enum BaseColor
{
Red = 1,
Green = 2,
Blue = 3
}
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestGenerationWhenMembersShareValues()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color
{
Red,
Green,
Yellow = Green
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color
{
Red,
Green,
Yellow = Green,
Blue = 2
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestInvokeFromAddAssignmentStatement()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
int a = 1;
a += Color.[|Blue|];
}
}
enum Color
{
Red,
Green = 10,
Yellow
}",
@"class Program
{
void Main()
{
int a = 1;
a += Color.Blue;
}
}
enum Color
{
Red,
Green = 10,
Yellow,
Blue
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestFormatting()
{
await TestInRegularAndScriptAsync(
@"class Program
{
static void Main(string[] args)
{
Weekday.[|Tuesday|];
}
}
enum Weekday
{
Monday
}",
@"class Program
{
static void Main(string[] args)
{
Weekday.Tuesday;
}
}
enum Weekday
{
Monday,
Tuesday
}");
}
[WorkItem(540919, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540919")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestKeyword()
{
await TestInRegularAndScriptAsync(
@"class Program
{
static void Main(string[] args)
{
Color.[|@enum|];
}
}
enum Color
{
Red
}",
@"class Program
{
static void Main(string[] args)
{
Color.@enum;
}
}
enum Color
{
Red,
@enum
}");
}
[WorkItem(544333, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544333")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestNotAfterPointer()
{
await TestMissingInRegularAndScriptAsync(
@"struct MyStruct
{
public int MyField;
}
class Program
{
static unsafe void Main(string[] args)
{
MyStruct s = new MyStruct();
MyStruct* ptr = &s;
var i1 = (() => &s)->[|M|];
}
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestMissingOnHiddenEnum()
{
await TestMissingInRegularAndScriptAsync(
@"using System;
enum E
{
#line hidden
}
#line default
class Program
{
void Main()
{
Console.WriteLine(E.[|x|]);
}
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestMissingOnPartiallyHiddenEnum()
{
await TestMissingInRegularAndScriptAsync(
@"using System;
enum E
{
A,
B,
C,
#line hidden
}
#line default
class Program
{
void Main()
{
Console.WriteLine(E.[|x|]);
}
}");
}
[WorkItem(545903, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545903")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestNoOctal()
{
await TestInRegularAndScriptAsync(
@"enum E
{
A = 007,
}
class C
{
E x = E.[|B|];
}",
@"enum E
{
A = 007,
B = 8,
}
class C
{
E x = E.B;
}");
}
[WorkItem(546654, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546654")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestLastValueDoesNotHaveInitializer()
{
await TestInRegularAndScriptAsync(
@"enum E
{
A = 1,
B
}
class Program
{
void Main()
{
E.[|C|] }
}",
@"enum E
{
A = 1,
B,
C
}
class Program
{
void Main()
{
E.C }
}");
}
[WorkItem(49679, "https://github.com/dotnet/roslyn/issues/49679")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestWithLeftShift_Long()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color : long
{
Green = 1L << 0
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color : long
{
Green = 1L << 0,
Blue = 1L << 1
}");
}
[WorkItem(49679, "https://github.com/dotnet/roslyn/issues/49679")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestWithLeftShift_UInt()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color : uint
{
Green = 1u << 0
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color : uint
{
Green = 1u << 0,
Blue = 1u << 1
}");
}
[WorkItem(49679, "https://github.com/dotnet/roslyn/issues/49679")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestWithLeftShift_ULong()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color : ulong
{
Green = 1UL << 0
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color : ulong
{
Green = 1UL << 0,
Blue = 1UL << 1
}");
}
}
}
| // 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.
#nullable disable
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.CSharp.CodeFixes.GenerateEnumMember;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Test.Utilities;
using Roslyn.Test.Utilities;
using Xunit;
using Xunit.Abstractions;
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics.GenerateEnumMember
{
public class GenerateEnumMemberTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest
{
public GenerateEnumMemberTests(ITestOutputHelper logger)
: base(logger)
{
}
internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace)
=> (null, new GenerateEnumMemberCodeFixProvider());
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestEmptyEnum()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Red|];
}
}
enum Color
{
}",
@"class Program
{
void Main()
{
Color.Red;
}
}
enum Color
{
Red
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestWithSingleMember()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color
{
Red
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color
{
Red,
Blue
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestWithExistingComma()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color
{
Red,
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color
{
Red,
Blue,
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestWithMultipleMembers()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Green|];
}
}
enum Color
{
Red,
Blue
}",
@"class Program
{
void Main()
{
Color.Green;
}
}
enum Color
{
Red,
Blue,
Green
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestWithZero()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color
{
Red = 0
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color
{
Red = 0,
Blue = 1
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestWithIntegralValue()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color
{
Red = 1
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color
{
Red = 1,
Blue = 2
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestWithSingleBitIntegral()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color
{
Red = 2
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color
{
Red = 2,
Blue = 4
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestGenerateIntoGeometricSequence()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color
{
Red = 1,
Yellow = 2,
Green = 4
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color
{
Red = 1,
Yellow = 2,
Green = 4,
Blue = 8
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestWithSimpleSequence1()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color
{
Red = 1,
Green = 2
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color
{
Red = 1,
Green = 2,
Blue = 3
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestWithSimpleSequence2()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color
{
Yellow = 0,
Red = 1,
Green = 2
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color
{
Yellow = 0,
Red = 1,
Green = 2,
Blue = 3
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestWithNonZeroInteger()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color
{
Green = 5
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color
{
Green = 5,
Blue = 6
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestWithLeftShift0()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color
{
Green = 1 << 0
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color
{
Green = 1 << 0,
Blue = 1 << 1
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestWithLeftShift5()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color
{
Green = 1 << 5
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color
{
Green = 1 << 5,
Blue = 1 << 6
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestWithDifferentStyles()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color
{
Red = 2,
Green = 1 << 5
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color
{
Red = 2,
Green = 1 << 5,
Blue = 33
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestBinary()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color
{
Red = 0b01
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color
{
Red = 0b01,
Blue = 0b10
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestHex1()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color
{
Red = 0x1
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color
{
Red = 0x1,
Blue = 0x2
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestHex9()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color
{
Red = 0x9
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color
{
Red = 0x9,
Blue = 0xA
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestHexF()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color
{
Red = 0xF
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color
{
Red = 0xF,
Blue = 0x10
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestGenerateAfterEnumWithIntegerMaxValue()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color
{
Red = int.MaxValue
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color
{
Red = int.MaxValue,
Blue = int.MinValue
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestUnsigned16BitEnums()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color : ushort
{
Red = 65535
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color : ushort
{
Red = 65535,
Blue = 0
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestGenerateEnumMemberOfTypeLong()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color : long
{
Red = long.MaxValue
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color : long
{
Red = long.MaxValue,
Blue = long.MinValue
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestGenerateAfterEnumWithLongMaxValueInBinary()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color : long
{
Red = 0b0111111111111111111111111111111111111111111111111111111111111111
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color : long
{
Red = 0b0111111111111111111111111111111111111111111111111111111111111111,
Blue = 0b1000000000000000000000000000000000000000000000000000000000000000
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestGenerateAfterEnumWithLongMaxValueInHex()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color : long
{
Red = 0x7FFFFFFFFFFFFFFF
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color : long
{
Red = 0x7FFFFFFFFFFFFFFF,
Blue = 0x8000000000000000
}");
}
[WorkItem(528312, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/528312")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestGenerateAfterEnumWithLongMinValueInHex()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color : long
{
Red = 0xFFFFFFFFFFFFFFFF
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color : long
{
Red = 0xFFFFFFFFFFFFFFFF,
Blue
}");
}
[WorkItem(528312, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/528312")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestGenerateAfterPositiveLongInHex()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color : long
{
Red = 0xFFFFFFFFFFFFFFFF,
Green = 0x0
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color : long
{
Red = 0xFFFFFFFFFFFFFFFF,
Green = 0x0,
Blue = 0x1
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestGenerateAfterPositiveLongExprInHex()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color : long
{
Red = 0x414 / 2
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color : long
{
Red = 0x414 / 2,
Blue = 523
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestGenerateAfterEnumWithULongMaxValue()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color : ulong
{
Red = ulong.MaxValue
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color : ulong
{
Red = ulong.MaxValue,
Blue = 0
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestNegativeRangeIn64BitSignedEnums()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color : long
{
Red = -10
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color : long
{
Red = -10,
Blue = -9
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestGenerateWithImplicitValues()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color
{
Red,
Green,
Yellow = -1
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color
{
Red,
Green,
Yellow = -1,
Blue = 2
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestGenerateWithImplicitValues2()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color
{
Red,
Green = 10,
Yellow
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color
{
Red,
Green = 10,
Yellow,
Blue
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestNoExtraneousStatementTerminatorBeforeCommentedMember()
{
await TestInRegularAndScriptAsync(
@"class Program
{
static void Main(string[] args)
{
Color . [|Blue|] ;
}
}
enum Color
{
Red
//Blue
}",
@"class Program
{
static void Main(string[] args)
{
Color . Blue ;
}
}
enum Color
{
Red,
Blue
//Blue
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestNoExtraneousStatementTerminatorBeforeCommentedMember2()
{
await TestInRegularAndScriptAsync(
@"class Program
{
static void Main(string[] args)
{
Color . [|Blue|] ;
}
}
enum Color
{
Red
/*Blue*/
}",
@"class Program
{
static void Main(string[] args)
{
Color . Blue ;
}
}
enum Color
{
Red,
Blue
/*Blue*/
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestGenerateAfterEnumWithMinValue()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color
{
Red = int.MinValue
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color
{
Red = int.MinValue,
Blue = -2147483647
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestGenerateAfterEnumWithMinValuePlusConstant()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color
{
Red = int.MinValue + 100
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color
{
Red = int.MinValue + 100,
Blue = -2147483547
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestGenerateAfterEnumWithByteMaxValue()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color : byte
{
Red = 255
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color : byte
{
Red = 255,
Blue = 0
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestGenerateIntoBitshiftEnum1()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color
{
Red = 1 << 1,
Green = 1 << 2
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color
{
Red = 1 << 1,
Green = 1 << 2,
Blue = 1 << 3
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestGenerateIntoBitshiftEnum2()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color
{
Red = 2 >> 1
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color
{
Red = 2 >> 1,
Blue = 2
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestStandaloneReference()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color
{
Red = int.MinValue,
Green = 1
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color
{
Red = int.MinValue,
Green = 1,
Blue = 2
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestCircularEnumsForErrorTolerance()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Circular.[|C|];
}
}
enum Circular
{
A = B,
B
}",
@"class Program
{
void Main()
{
Circular.C;
}
}
enum Circular
{
A = B,
B,
C
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestEnumWithIncorrectValueForErrorTolerance()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Circular.[|B|];
}
}
enum Circular : byte
{
A = -2
}",
@"class Program
{
void Main()
{
Circular.B;
}
}
enum Circular : byte
{
A = -2,
B
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestGenerateIntoNewEnum()
{
await TestInRegularAndScriptAsync(
@"class B : A
{
void Main()
{
BaseColor.[|Blue|];
}
public new enum BaseColor
{
Yellow = 3
}
}
class A
{
public enum BaseColor
{
Red = 1,
Green = 2
}
}",
@"class B : A
{
void Main()
{
BaseColor.Blue;
}
public new enum BaseColor
{
Yellow = 3,
Blue = 4
}
}
class A
{
public enum BaseColor
{
Red = 1,
Green = 2
}
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestGenerateIntoDerivedEnumMissingNewKeyword()
{
await TestInRegularAndScriptAsync(
@"class B : A
{
void Main()
{
BaseColor.[|Blue|];
}
public enum BaseColor
{
Yellow = 3
}
}
class A
{
public enum BaseColor
{
Red = 1,
Green = 2
}
}",
@"class B : A
{
void Main()
{
BaseColor.Blue;
}
public enum BaseColor
{
Yellow = 3,
Blue = 4
}
}
class A
{
public enum BaseColor
{
Red = 1,
Green = 2
}
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestGenerateIntoBaseEnum()
{
await TestInRegularAndScriptAsync(
@"class B : A
{
void Main()
{
BaseColor.[|Blue|];
}
}
class A
{
public enum BaseColor
{
Red = 1,
Green = 2
}
}",
@"class B : A
{
void Main()
{
BaseColor.Blue;
}
}
class A
{
public enum BaseColor
{
Red = 1,
Green = 2,
Blue = 3
}
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestGenerationWhenMembersShareValues()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color
{
Red,
Green,
Yellow = Green
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color
{
Red,
Green,
Yellow = Green,
Blue = 2
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestInvokeFromAddAssignmentStatement()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
int a = 1;
a += Color.[|Blue|];
}
}
enum Color
{
Red,
Green = 10,
Yellow
}",
@"class Program
{
void Main()
{
int a = 1;
a += Color.Blue;
}
}
enum Color
{
Red,
Green = 10,
Yellow,
Blue
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestFormatting()
{
await TestInRegularAndScriptAsync(
@"class Program
{
static void Main(string[] args)
{
Weekday.[|Tuesday|];
}
}
enum Weekday
{
Monday
}",
@"class Program
{
static void Main(string[] args)
{
Weekday.Tuesday;
}
}
enum Weekday
{
Monday,
Tuesday
}");
}
[WorkItem(540919, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540919")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestKeyword()
{
await TestInRegularAndScriptAsync(
@"class Program
{
static void Main(string[] args)
{
Color.[|@enum|];
}
}
enum Color
{
Red
}",
@"class Program
{
static void Main(string[] args)
{
Color.@enum;
}
}
enum Color
{
Red,
@enum
}");
}
[WorkItem(544333, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544333")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestNotAfterPointer()
{
await TestMissingInRegularAndScriptAsync(
@"struct MyStruct
{
public int MyField;
}
class Program
{
static unsafe void Main(string[] args)
{
MyStruct s = new MyStruct();
MyStruct* ptr = &s;
var i1 = (() => &s)->[|M|];
}
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestMissingOnHiddenEnum()
{
await TestMissingInRegularAndScriptAsync(
@"using System;
enum E
{
#line hidden
}
#line default
class Program
{
void Main()
{
Console.WriteLine(E.[|x|]);
}
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestMissingOnPartiallyHiddenEnum()
{
await TestMissingInRegularAndScriptAsync(
@"using System;
enum E
{
A,
B,
C,
#line hidden
}
#line default
class Program
{
void Main()
{
Console.WriteLine(E.[|x|]);
}
}");
}
[WorkItem(545903, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545903")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestNoOctal()
{
await TestInRegularAndScriptAsync(
@"enum E
{
A = 007,
}
class C
{
E x = E.[|B|];
}",
@"enum E
{
A = 007,
B = 8,
}
class C
{
E x = E.B;
}");
}
[WorkItem(546654, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546654")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestLastValueDoesNotHaveInitializer()
{
await TestInRegularAndScriptAsync(
@"enum E
{
A = 1,
B
}
class Program
{
void Main()
{
E.[|C|] }
}",
@"enum E
{
A = 1,
B,
C
}
class Program
{
void Main()
{
E.C }
}");
}
[WorkItem(49679, "https://github.com/dotnet/roslyn/issues/49679")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestWithLeftShift_Long()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color : long
{
Green = 1L << 0
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color : long
{
Green = 1L << 0,
Blue = 1L << 1
}");
}
[WorkItem(49679, "https://github.com/dotnet/roslyn/issues/49679")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestWithLeftShift_UInt()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color : uint
{
Green = 1u << 0
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color : uint
{
Green = 1u << 0,
Blue = 1u << 1
}");
}
[WorkItem(49679, "https://github.com/dotnet/roslyn/issues/49679")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)]
public async Task TestWithLeftShift_ULong()
{
await TestInRegularAndScriptAsync(
@"class Program
{
void Main()
{
Color.[|Blue|];
}
}
enum Color : ulong
{
Green = 1UL << 0
}",
@"class Program
{
void Main()
{
Color.Blue;
}
}
enum Color : ulong
{
Green = 1UL << 0,
Blue = 1UL << 1
}");
}
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Compilers/CSharp/Portable/Symbols/Source/IAttributeTargetSymbol.cs | // 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.
#nullable disable
namespace Microsoft.CodeAnalysis.CSharp.Symbols
{
/// <summary>
/// Implemented by symbols that can be targeted by an attribute declaration (i.e. source symbols).
/// </summary>
internal interface IAttributeTargetSymbol
{
/// <summary>
/// Returns the owner of attributes that apply to this symbol.
/// </summary>
/// <remarks>
/// Attributes for this symbol might be retrieved from attribute list of another (owning) symbol.
/// In that case this property returns that owning symbol, otherwise it returns "this".
/// </remarks>
IAttributeTargetSymbol AttributesOwner { get; }
/// <summary>
/// Returns a bit set of attribute locations applicable to this symbol.
/// </summary>
AttributeLocation AllowedAttributeLocations { get; }
/// <summary>
/// Attribute location corresponding to this symbol.
/// </summary>
/// <remarks>
/// Location of an attribute if an explicit location is not specified via attribute target specification syntax.
/// </remarks>
AttributeLocation DefaultAttributeLocation { get; }
// TODO (tomat):
// Add DecodeWellKnownAttribute, etc.
}
}
| // 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.
#nullable disable
namespace Microsoft.CodeAnalysis.CSharp.Symbols
{
/// <summary>
/// Implemented by symbols that can be targeted by an attribute declaration (i.e. source symbols).
/// </summary>
internal interface IAttributeTargetSymbol
{
/// <summary>
/// Returns the owner of attributes that apply to this symbol.
/// </summary>
/// <remarks>
/// Attributes for this symbol might be retrieved from attribute list of another (owning) symbol.
/// In that case this property returns that owning symbol, otherwise it returns "this".
/// </remarks>
IAttributeTargetSymbol AttributesOwner { get; }
/// <summary>
/// Returns a bit set of attribute locations applicable to this symbol.
/// </summary>
AttributeLocation AllowedAttributeLocations { get; }
/// <summary>
/// Attribute location corresponding to this symbol.
/// </summary>
/// <remarks>
/// Location of an attribute if an explicit location is not specified via attribute target specification syntax.
/// </remarks>
AttributeLocation DefaultAttributeLocation { get; }
// TODO (tomat):
// Add DecodeWellKnownAttribute, etc.
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Compilers/VisualBasic/Test/Symbol/DocumentationComments/PropertyDocumentationCommentTests.vb | ' 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.
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests
Public Class PropertyDocumentationCommentTests
Private ReadOnly _compilation As VisualBasicCompilation
Private ReadOnly _acmeNamespace As NamespaceSymbol
Private ReadOnly _widgetClass As NamedTypeSymbol
Public Sub New()
_compilation = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="PropertyDocumentationCommentTests">
<file name="a.vb">
Namespace Acme
Class Widget
Public Property Width() As Integer
Get
End Get
Set (Value As Integer)
End Set
End Property
Public Default Property Item(i As Integer) As Integer
Get
End Get
Set (Value As Integer)
End Set
End Property
Public Default Property Item(s As String, _
i As Integer) As Integer
Get
End Get
Set (Value As Integer)
End Set
End Property
End Class
End Namespace
</file>
</compilation>)
_acmeNamespace = DirectCast(_compilation.GlobalNamespace.GetMembers("Acme").Single(), NamespaceSymbol)
_widgetClass = DirectCast(_acmeNamespace.GetTypeMembers("Widget").Single(), NamedTypeSymbol)
End Sub
<Fact>
Public Sub TestProperty()
Assert.Equal("P:Acme.Widget.Width",
_widgetClass.GetMembers("Width").Single().GetDocumentationCommentId())
End Sub
<Fact>
Public Sub TestIndexer1()
Assert.Equal("P:Acme.Widget.Item(System.Int32)",
_widgetClass.GetMembers("Item")(0).GetDocumentationCommentId())
End Sub
<Fact>
Public Sub TestIndexer2()
Assert.Equal("P:Acme.Widget.Item(System.String,System.Int32)",
_widgetClass.GetMembers("Item")(1).GetDocumentationCommentId())
End Sub
End Class
End Namespace
| ' 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.
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests
Public Class PropertyDocumentationCommentTests
Private ReadOnly _compilation As VisualBasicCompilation
Private ReadOnly _acmeNamespace As NamespaceSymbol
Private ReadOnly _widgetClass As NamedTypeSymbol
Public Sub New()
_compilation = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="PropertyDocumentationCommentTests">
<file name="a.vb">
Namespace Acme
Class Widget
Public Property Width() As Integer
Get
End Get
Set (Value As Integer)
End Set
End Property
Public Default Property Item(i As Integer) As Integer
Get
End Get
Set (Value As Integer)
End Set
End Property
Public Default Property Item(s As String, _
i As Integer) As Integer
Get
End Get
Set (Value As Integer)
End Set
End Property
End Class
End Namespace
</file>
</compilation>)
_acmeNamespace = DirectCast(_compilation.GlobalNamespace.GetMembers("Acme").Single(), NamespaceSymbol)
_widgetClass = DirectCast(_acmeNamespace.GetTypeMembers("Widget").Single(), NamedTypeSymbol)
End Sub
<Fact>
Public Sub TestProperty()
Assert.Equal("P:Acme.Widget.Width",
_widgetClass.GetMembers("Width").Single().GetDocumentationCommentId())
End Sub
<Fact>
Public Sub TestIndexer1()
Assert.Equal("P:Acme.Widget.Item(System.Int32)",
_widgetClass.GetMembers("Item")(0).GetDocumentationCommentId())
End Sub
<Fact>
Public Sub TestIndexer2()
Assert.Equal("P:Acme.Widget.Item(System.String,System.Int32)",
_widgetClass.GetMembers("Item")(1).GetDocumentationCommentId())
End Sub
End Class
End Namespace
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/EditorFeatures/VisualBasicTest/Recommendations/OnErrorStatements/GoToDestinationsRecommenderTests.vb | ' 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.
Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Recommendations.OnErrorStatements
Public Class GoToDestinationsRecommenderTests
<Fact>
<Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub ZeroAndOneAfterOnErrorGotoTest()
VerifyRecommendationsAreExactly(<MethodBody>On Error Goto |</MethodBody>, "0", "-1")
End Sub
<WorkItem(530953, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530953")>
<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub NotAfterEolTest()
VerifyRecommendationsMissing(
<MethodBody>On Error Goto
|</MethodBody>, "0", "-1")
End Sub
<WorkItem(530953, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530953")>
<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub AfterExplicitLineContinuationTest()
VerifyRecommendationsAreExactly(
<MethodBody>On Error Goto _
|</MethodBody>, "0", "-1")
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub AfterExplicitLineContinuationTestCommentsAfterLineContinuation()
VerifyRecommendationsAreExactly(
<MethodBody>On Error Goto _ ' Test
|</MethodBody>, "0", "-1")
End Sub
End Class
End Namespace
| ' 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.
Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Recommendations.OnErrorStatements
Public Class GoToDestinationsRecommenderTests
<Fact>
<Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub ZeroAndOneAfterOnErrorGotoTest()
VerifyRecommendationsAreExactly(<MethodBody>On Error Goto |</MethodBody>, "0", "-1")
End Sub
<WorkItem(530953, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530953")>
<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub NotAfterEolTest()
VerifyRecommendationsMissing(
<MethodBody>On Error Goto
|</MethodBody>, "0", "-1")
End Sub
<WorkItem(530953, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530953")>
<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub AfterExplicitLineContinuationTest()
VerifyRecommendationsAreExactly(
<MethodBody>On Error Goto _
|</MethodBody>, "0", "-1")
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)>
Public Sub AfterExplicitLineContinuationTestCommentsAfterLineContinuation()
VerifyRecommendationsAreExactly(
<MethodBody>On Error Goto _ ' Test
|</MethodBody>, "0", "-1")
End Sub
End Class
End Namespace
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/EditorFeatures/VisualBasicTest/KeywordHighlighting/MultiLineIfBlockHighlighterTests.vb | ' 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.
Imports Microsoft.CodeAnalysis.Editor.VisualBasic.KeywordHighlighting
Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.KeywordHighlighting
Public Class MultiLineIfBlockHighlighterTests
Inherits AbstractVisualBasicKeywordHighlighterTests
Friend Overrides Function GetHighlighterType() As Type
Return GetType(MultiLineIfBlockHighlighter)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordHighlighting)>
Public Async Function TestMultilineIf1() As Task
Await TestAsync(<Text><![CDATA[
Class C
Sub M()
{|Cursor:[|If|]|} a < b [|Then|]
a = b
[|ElseIf|] DateTime.Now.Ticks Mod 2 = 0
Throw New RandomException
[|Else|]
If a < b Then a = b Else b = a
[|End If|]
End Sub
End Class]]></Text>)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordHighlighting)>
Public Async Function TestMultilineIf2() As Task
Await TestAsync(<Text><![CDATA[
Class C
Sub M()
[|If|] a < b {|Cursor:[|Then|]|}
a = b
[|ElseIf|] DateTime.Now.Ticks Mod 2 = 0
Throw New RandomException
[|Else|]
If a < b Then a = b Else b = a
[|End If|]
End Sub
End Class]]></Text>)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordHighlighting)>
Public Async Function TestMultilineIf3() As Task
Await TestAsync(<Text><![CDATA[
Class C
Sub M()
[|If|] a < b [|Then|]
a = b
{|Cursor:[|ElseIf|]|} DateTime.Now.Ticks Mod 2 = 0
Throw New RandomException
[|Else|]
If a < b Then a = b Else b = a
[|End If|]
End Sub
End Class]]></Text>)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordHighlighting)>
Public Async Function TestMultilineIf4() As Task
Await TestAsync(<Text><![CDATA[
Class C
Sub M()
[|If|] a < b [|Then|]
a = b
[|ElseIf|] DateTime.Now.Ticks Mod 2 = 0
Throw New RandomException
[|{|Cursor:Else|}|]
If a < b Then a = b Else b = a
[|End If|]
End Sub
End Class]]></Text>)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordHighlighting)>
Public Async Function TestMultilineIf5() As Task
Await TestAsync(<Text><![CDATA[
Class C
Sub M()
[|If|] a < b [|Then|]
a = b
[|ElseIf|] DateTime.Now.Ticks Mod 2 = 0
Throw New RandomException
[|Else|]
If a < b Then a = b Else b = a
{|Cursor:[|End If|]|}
End Sub
End Class]]></Text>)
End Function
<WorkItem(542614, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542614")>
<Fact, Trait(Traits.Feature, Traits.Features.KeywordHighlighting)>
Public Async Function TestMultilineIf6() As Task
Await TestAsync(<Text><![CDATA[
Imports System
Module M
Sub C()
Dim x As Integer = 5
[|If|] x < 0 [|Then|]
{|Cursor:[|Else If|]|}
[|End If|]
End Sub
End Module]]></Text>)
End Function
End Class
End Namespace
| ' 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.
Imports Microsoft.CodeAnalysis.Editor.VisualBasic.KeywordHighlighting
Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.KeywordHighlighting
Public Class MultiLineIfBlockHighlighterTests
Inherits AbstractVisualBasicKeywordHighlighterTests
Friend Overrides Function GetHighlighterType() As Type
Return GetType(MultiLineIfBlockHighlighter)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordHighlighting)>
Public Async Function TestMultilineIf1() As Task
Await TestAsync(<Text><![CDATA[
Class C
Sub M()
{|Cursor:[|If|]|} a < b [|Then|]
a = b
[|ElseIf|] DateTime.Now.Ticks Mod 2 = 0
Throw New RandomException
[|Else|]
If a < b Then a = b Else b = a
[|End If|]
End Sub
End Class]]></Text>)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordHighlighting)>
Public Async Function TestMultilineIf2() As Task
Await TestAsync(<Text><![CDATA[
Class C
Sub M()
[|If|] a < b {|Cursor:[|Then|]|}
a = b
[|ElseIf|] DateTime.Now.Ticks Mod 2 = 0
Throw New RandomException
[|Else|]
If a < b Then a = b Else b = a
[|End If|]
End Sub
End Class]]></Text>)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordHighlighting)>
Public Async Function TestMultilineIf3() As Task
Await TestAsync(<Text><![CDATA[
Class C
Sub M()
[|If|] a < b [|Then|]
a = b
{|Cursor:[|ElseIf|]|} DateTime.Now.Ticks Mod 2 = 0
Throw New RandomException
[|Else|]
If a < b Then a = b Else b = a
[|End If|]
End Sub
End Class]]></Text>)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordHighlighting)>
Public Async Function TestMultilineIf4() As Task
Await TestAsync(<Text><![CDATA[
Class C
Sub M()
[|If|] a < b [|Then|]
a = b
[|ElseIf|] DateTime.Now.Ticks Mod 2 = 0
Throw New RandomException
[|{|Cursor:Else|}|]
If a < b Then a = b Else b = a
[|End If|]
End Sub
End Class]]></Text>)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordHighlighting)>
Public Async Function TestMultilineIf5() As Task
Await TestAsync(<Text><![CDATA[
Class C
Sub M()
[|If|] a < b [|Then|]
a = b
[|ElseIf|] DateTime.Now.Ticks Mod 2 = 0
Throw New RandomException
[|Else|]
If a < b Then a = b Else b = a
{|Cursor:[|End If|]|}
End Sub
End Class]]></Text>)
End Function
<WorkItem(542614, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542614")>
<Fact, Trait(Traits.Feature, Traits.Features.KeywordHighlighting)>
Public Async Function TestMultilineIf6() As Task
Await TestAsync(<Text><![CDATA[
Imports System
Module M
Sub C()
Dim x As Integer = 5
[|If|] x < 0 [|Then|]
{|Cursor:[|Else If|]|}
[|End If|]
End Sub
End Module]]></Text>)
End Function
End Class
End Namespace
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Analyzers/VisualBasic/CodeFixes/AddAccessibilityModifiers/VisualBasicAddAccessibilityModifiersCodeFixProvider.vb | ' 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.
Imports System.Composition
Imports Microsoft.CodeAnalysis.AddAccessibilityModifiers
Imports Microsoft.CodeAnalysis.CodeFixes
Imports Microsoft.CodeAnalysis.Host.Mef
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic.AddAccessibilityModifiers
<ExportCodeFixProvider(LanguageNames.VisualBasic, Name:=PredefinedCodeFixProviderNames.AddAccessibilityModifiers), [Shared]>
Friend Class VisualBasicAddAccessibilityModifiersCodeFixProvider
Inherits AbstractAddAccessibilityModifiersCodeFixProvider
<ImportingConstructor>
<Obsolete(MefConstruction.ImportingConstructorMessage, True)>
Public Sub New()
End Sub
Protected Overrides Function MapToDeclarator(declaration As SyntaxNode) As SyntaxNode
If TypeOf declaration Is FieldDeclarationSyntax Then
Return DirectCast(declaration, FieldDeclarationSyntax).Declarators(0).Names(0)
End If
Return declaration
End Function
End Class
End Namespace
| ' 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.
Imports System.Composition
Imports Microsoft.CodeAnalysis.AddAccessibilityModifiers
Imports Microsoft.CodeAnalysis.CodeFixes
Imports Microsoft.CodeAnalysis.Host.Mef
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic.AddAccessibilityModifiers
<ExportCodeFixProvider(LanguageNames.VisualBasic, Name:=PredefinedCodeFixProviderNames.AddAccessibilityModifiers), [Shared]>
Friend Class VisualBasicAddAccessibilityModifiersCodeFixProvider
Inherits AbstractAddAccessibilityModifiersCodeFixProvider
<ImportingConstructor>
<Obsolete(MefConstruction.ImportingConstructorMessage, True)>
Public Sub New()
End Sub
Protected Overrides Function MapToDeclarator(declaration As SyntaxNode) As SyntaxNode
If TypeOf declaration Is FieldDeclarationSyntax Then
Return DirectCast(declaration, FieldDeclarationSyntax).Declarators(0).Names(0)
End If
Return declaration
End Function
End Class
End Namespace
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/VisualStudio/Core/Def/Implementation/AbstractVsTextViewFilter.cs | // 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.
#nullable disable
using System;
using System.Linq;
using System.Threading;
using Microsoft.CodeAnalysis.Debugging;
using Microsoft.CodeAnalysis.Editor;
using Microsoft.CodeAnalysis.Editor.Host;
using Microsoft.CodeAnalysis.Editor.Shared.Extensions;
using Microsoft.CodeAnalysis.ErrorReporting;
using Microsoft.CodeAnalysis.Internal.Log;
using Microsoft.CodeAnalysis.Text;
using Microsoft.CodeAnalysis.Text.Shared.Extensions;
using Microsoft.VisualStudio.ComponentModelHost;
using Microsoft.VisualStudio.LanguageServices.Implementation.Extensions;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.TextManager.Interop;
using Microsoft.VisualStudio.Utilities;
using Roslyn.Utilities;
using TextSpan = Microsoft.VisualStudio.TextManager.Interop.TextSpan;
namespace Microsoft.VisualStudio.LanguageServices.Implementation
{
internal abstract class AbstractVsTextViewFilter : AbstractOleCommandTarget, IVsTextViewFilter
{
public AbstractVsTextViewFilter(
IWpfTextView wpfTextView,
IComponentModel componentModel)
: base(wpfTextView, componentModel)
{
}
int IVsTextViewFilter.GetDataTipText(TextSpan[] pSpan, out string pbstrText)
{
try
{
if (pSpan == null || pSpan.Length != 1)
{
pbstrText = null;
return VSConstants.E_INVALIDARG;
}
return GetDataTipTextImpl(pSpan, out pbstrText);
}
catch (Exception e) when (FatalError.ReportAndCatch(e) && false)
{
throw ExceptionUtilities.Unreachable;
}
}
protected virtual int GetDataTipTextImpl(TextSpan[] pSpan, out string pbstrText)
{
var subjectBuffer = WpfTextView.GetBufferContainingCaret();
if (subjectBuffer == null)
{
pbstrText = null;
return VSConstants.E_FAIL;
}
return GetDataTipTextImpl(subjectBuffer, pSpan, out pbstrText);
}
protected int GetDataTipTextImpl(ITextBuffer subjectBuffer, TextSpan[] pSpan, out string pbstrText)
{
pbstrText = null;
var vsBuffer = EditorAdaptersFactory.GetBufferAdapter(subjectBuffer);
// TODO: broken in REPL
if (vsBuffer == null)
{
return VSConstants.E_FAIL;
}
using (Logger.LogBlock(FunctionId.Debugging_VsLanguageDebugInfo_GetDataTipText, CancellationToken.None))
{
pbstrText = null;
if (pSpan == null || pSpan.Length != 1)
{
return VSConstants.E_INVALIDARG;
}
var result = VSConstants.E_FAIL;
string pbstrTextInternal = null;
var uiThreadOperationExecutor = ComponentModel.GetService<IUIThreadOperationExecutor>();
uiThreadOperationExecutor.Execute(
title: ServicesVSResources.Debugger,
defaultDescription: ServicesVSResources.Getting_DataTip_text,
allowCancellation: true,
showProgress: false,
action: context =>
{
IServiceProvider serviceProvider = ComponentModel.GetService<SVsServiceProvider>();
var debugger = (IVsDebugger)serviceProvider.GetService(typeof(SVsShellDebugger));
var debugMode = new DBGMODE[1];
var cancellationToken = context.UserCancellationToken;
if (ErrorHandler.Succeeded(debugger.GetMode(debugMode)) && debugMode[0] != DBGMODE.DBGMODE_Design)
{
var textSpan = pSpan[0];
var textSnapshot = subjectBuffer.CurrentSnapshot;
var document = textSnapshot.GetOpenDocumentInCurrentContextWithChanges();
if (document != null)
{
var languageDebugInfo = document.Project.LanguageServices.GetService<ILanguageDebugInfoService>();
if (languageDebugInfo != null)
{
var spanOpt = textSnapshot.TryGetSpan(textSpan);
if (spanOpt.HasValue)
{
var dataTipInfo = languageDebugInfo.GetDataTipInfoAsync(document, spanOpt.Value.Start, cancellationToken).WaitAndGetResult(cancellationToken);
if (!dataTipInfo.IsDefault)
{
var resultSpan = dataTipInfo.Span.ToSnapshotSpan(textSnapshot);
var textOpt = dataTipInfo.Text;
pSpan[0] = resultSpan.ToVsTextSpan();
result = debugger.GetDataTipValue((IVsTextLines)vsBuffer, pSpan, textOpt, out pbstrTextInternal);
}
}
}
}
}
});
pbstrText = pbstrTextInternal;
return result;
}
}
int IVsTextViewFilter.GetPairExtents(int iLine, int iIndex, TextSpan[] pSpan)
{
try
{
var result = VSConstants.S_OK;
ComponentModel.GetService<IUIThreadOperationExecutor>().Execute(
"Intellisense",
defaultDescription: "",
allowCancellation: true,
showProgress: false,
action: c => result = GetPairExtentsWorker(iLine, iIndex, pSpan, c.UserCancellationToken));
return result;
}
catch (Exception e) when (FatalError.ReportAndCatch(e) && false)
{
throw ExceptionUtilities.Unreachable;
}
}
private int GetPairExtentsWorker(int iLine, int iIndex, TextSpan[] pSpan, CancellationToken cancellationToken)
{
var braceMatcher = ComponentModel.GetService<IBraceMatchingService>();
return GetPairExtentsWorker(
WpfTextView,
braceMatcher,
iLine,
iIndex,
pSpan,
(VSConstants.VSStd2KCmdID)this.CurrentlyExecutingCommand == VSConstants.VSStd2KCmdID.GOTOBRACE_EXT,
cancellationToken);
}
// Internal for testing purposes
internal static int GetPairExtentsWorker(ITextView textView, IBraceMatchingService braceMatcher, int iLine, int iIndex, TextSpan[] pSpan, bool extendSelection, CancellationToken cancellationToken)
{
pSpan[0].iStartLine = pSpan[0].iEndLine = iLine;
pSpan[0].iStartIndex = pSpan[0].iEndIndex = iIndex;
var pointInViewBuffer = textView.TextSnapshot.GetLineFromLineNumber(iLine).Start + iIndex;
var subjectBuffer = textView.GetBufferContainingCaret();
if (subjectBuffer != null)
{
// PointTrackingMode and PositionAffinity chosen arbitrarily.
var positionInSubjectBuffer = textView.BufferGraph.MapDownToBuffer(pointInViewBuffer, PointTrackingMode.Positive, subjectBuffer, PositionAffinity.Successor);
if (!positionInSubjectBuffer.HasValue)
{
positionInSubjectBuffer = textView.BufferGraph.MapDownToBuffer(pointInViewBuffer, PointTrackingMode.Positive, subjectBuffer, PositionAffinity.Predecessor);
}
if (positionInSubjectBuffer.HasValue)
{
var position = positionInSubjectBuffer.Value;
var document = subjectBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges();
if (document != null)
{
var matchingSpan = braceMatcher.FindMatchingSpanAsync(document, position, cancellationToken).WaitAndGetResult(cancellationToken);
if (matchingSpan.HasValue)
{
var resultsInView = textView.GetSpanInView(matchingSpan.Value.ToSnapshotSpan(subjectBuffer.CurrentSnapshot)).ToList();
if (resultsInView.Count == 1)
{
var vsTextSpan = resultsInView[0].ToVsTextSpan();
// caret is at close parenthesis
if (matchingSpan.Value.Start < position)
{
pSpan[0].iStartLine = vsTextSpan.iStartLine;
pSpan[0].iStartIndex = vsTextSpan.iStartIndex;
// For text selection using goto matching brace, tweak spans to suit the VS editor's behavior.
// The vs editor sets selection for GotoBraceExt (Ctrl + Shift + ]) like so :
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// if (fExtendSelection)
// {
// textSpan.iEndIndex++;
// this.SetSelection(textSpan.iStartLine, textSpan.iStartIndex, textSpan.iEndLine, textSpan.iEndIndex);
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Notice a couple of things: it arbitrarily increments EndIndex by 1 and does nothing similar for StartIndex.
// So, if we're extending selection:
// case a: set EndIndex to left of closing parenthesis -- ^}
// this adjustment is for any of the four cases where caret could be. left or right of open or close parenthesis -- ^{^ ^}^
// case b: set StartIndex to left of opening parenthesis -- ^{
// this adjustment is for cases where caret was originally to the right of the open parenthesis -- {^ }
// if selecting, adjust end position by using the matching opening span that we just computed.
if (extendSelection)
{
// case a.
var closingSpans = braceMatcher.FindMatchingSpanAsync(document, matchingSpan.Value.Start, cancellationToken).WaitAndGetResult(cancellationToken);
var vsClosingSpans = textView.GetSpanInView(closingSpans.Value.ToSnapshotSpan(subjectBuffer.CurrentSnapshot)).ToList().First().ToVsTextSpan();
pSpan[0].iEndIndex = vsClosingSpans.iStartIndex;
}
}
else if (matchingSpan.Value.End > position) // caret is at open parenthesis
{
pSpan[0].iEndLine = vsTextSpan.iEndLine;
pSpan[0].iEndIndex = vsTextSpan.iEndIndex;
// if selecting, adjust start position by using the matching closing span that we computed
if (extendSelection)
{
// case a.
pSpan[0].iEndIndex = vsTextSpan.iStartIndex;
// case b.
var openingSpans = braceMatcher.FindMatchingSpanAsync(document, matchingSpan.Value.End, cancellationToken).WaitAndGetResult(cancellationToken);
var vsOpeningSpans = textView.GetSpanInView(openingSpans.Value.ToSnapshotSpan(subjectBuffer.CurrentSnapshot)).ToList().First().ToVsTextSpan();
pSpan[0].iStartIndex = vsOpeningSpans.iStartIndex;
}
}
}
}
}
}
}
return VSConstants.S_OK;
}
int IVsTextViewFilter.GetWordExtent(int iLine, int iIndex, uint dwFlags, TextSpan[] pSpan)
=> VSConstants.E_NOTIMPL;
}
}
| // 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.
#nullable disable
using System;
using System.Linq;
using System.Threading;
using Microsoft.CodeAnalysis.Debugging;
using Microsoft.CodeAnalysis.Editor;
using Microsoft.CodeAnalysis.Editor.Host;
using Microsoft.CodeAnalysis.Editor.Shared.Extensions;
using Microsoft.CodeAnalysis.ErrorReporting;
using Microsoft.CodeAnalysis.Internal.Log;
using Microsoft.CodeAnalysis.Text;
using Microsoft.CodeAnalysis.Text.Shared.Extensions;
using Microsoft.VisualStudio.ComponentModelHost;
using Microsoft.VisualStudio.LanguageServices.Implementation.Extensions;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.TextManager.Interop;
using Microsoft.VisualStudio.Utilities;
using Roslyn.Utilities;
using TextSpan = Microsoft.VisualStudio.TextManager.Interop.TextSpan;
namespace Microsoft.VisualStudio.LanguageServices.Implementation
{
internal abstract class AbstractVsTextViewFilter : AbstractOleCommandTarget, IVsTextViewFilter
{
public AbstractVsTextViewFilter(
IWpfTextView wpfTextView,
IComponentModel componentModel)
: base(wpfTextView, componentModel)
{
}
int IVsTextViewFilter.GetDataTipText(TextSpan[] pSpan, out string pbstrText)
{
try
{
if (pSpan == null || pSpan.Length != 1)
{
pbstrText = null;
return VSConstants.E_INVALIDARG;
}
return GetDataTipTextImpl(pSpan, out pbstrText);
}
catch (Exception e) when (FatalError.ReportAndCatch(e) && false)
{
throw ExceptionUtilities.Unreachable;
}
}
protected virtual int GetDataTipTextImpl(TextSpan[] pSpan, out string pbstrText)
{
var subjectBuffer = WpfTextView.GetBufferContainingCaret();
if (subjectBuffer == null)
{
pbstrText = null;
return VSConstants.E_FAIL;
}
return GetDataTipTextImpl(subjectBuffer, pSpan, out pbstrText);
}
protected int GetDataTipTextImpl(ITextBuffer subjectBuffer, TextSpan[] pSpan, out string pbstrText)
{
pbstrText = null;
var vsBuffer = EditorAdaptersFactory.GetBufferAdapter(subjectBuffer);
// TODO: broken in REPL
if (vsBuffer == null)
{
return VSConstants.E_FAIL;
}
using (Logger.LogBlock(FunctionId.Debugging_VsLanguageDebugInfo_GetDataTipText, CancellationToken.None))
{
pbstrText = null;
if (pSpan == null || pSpan.Length != 1)
{
return VSConstants.E_INVALIDARG;
}
var result = VSConstants.E_FAIL;
string pbstrTextInternal = null;
var uiThreadOperationExecutor = ComponentModel.GetService<IUIThreadOperationExecutor>();
uiThreadOperationExecutor.Execute(
title: ServicesVSResources.Debugger,
defaultDescription: ServicesVSResources.Getting_DataTip_text,
allowCancellation: true,
showProgress: false,
action: context =>
{
IServiceProvider serviceProvider = ComponentModel.GetService<SVsServiceProvider>();
var debugger = (IVsDebugger)serviceProvider.GetService(typeof(SVsShellDebugger));
var debugMode = new DBGMODE[1];
var cancellationToken = context.UserCancellationToken;
if (ErrorHandler.Succeeded(debugger.GetMode(debugMode)) && debugMode[0] != DBGMODE.DBGMODE_Design)
{
var textSpan = pSpan[0];
var textSnapshot = subjectBuffer.CurrentSnapshot;
var document = textSnapshot.GetOpenDocumentInCurrentContextWithChanges();
if (document != null)
{
var languageDebugInfo = document.Project.LanguageServices.GetService<ILanguageDebugInfoService>();
if (languageDebugInfo != null)
{
var spanOpt = textSnapshot.TryGetSpan(textSpan);
if (spanOpt.HasValue)
{
var dataTipInfo = languageDebugInfo.GetDataTipInfoAsync(document, spanOpt.Value.Start, cancellationToken).WaitAndGetResult(cancellationToken);
if (!dataTipInfo.IsDefault)
{
var resultSpan = dataTipInfo.Span.ToSnapshotSpan(textSnapshot);
var textOpt = dataTipInfo.Text;
pSpan[0] = resultSpan.ToVsTextSpan();
result = debugger.GetDataTipValue((IVsTextLines)vsBuffer, pSpan, textOpt, out pbstrTextInternal);
}
}
}
}
}
});
pbstrText = pbstrTextInternal;
return result;
}
}
int IVsTextViewFilter.GetPairExtents(int iLine, int iIndex, TextSpan[] pSpan)
{
try
{
var result = VSConstants.S_OK;
ComponentModel.GetService<IUIThreadOperationExecutor>().Execute(
"Intellisense",
defaultDescription: "",
allowCancellation: true,
showProgress: false,
action: c => result = GetPairExtentsWorker(iLine, iIndex, pSpan, c.UserCancellationToken));
return result;
}
catch (Exception e) when (FatalError.ReportAndCatch(e) && false)
{
throw ExceptionUtilities.Unreachable;
}
}
private int GetPairExtentsWorker(int iLine, int iIndex, TextSpan[] pSpan, CancellationToken cancellationToken)
{
var braceMatcher = ComponentModel.GetService<IBraceMatchingService>();
return GetPairExtentsWorker(
WpfTextView,
braceMatcher,
iLine,
iIndex,
pSpan,
(VSConstants.VSStd2KCmdID)this.CurrentlyExecutingCommand == VSConstants.VSStd2KCmdID.GOTOBRACE_EXT,
cancellationToken);
}
// Internal for testing purposes
internal static int GetPairExtentsWorker(ITextView textView, IBraceMatchingService braceMatcher, int iLine, int iIndex, TextSpan[] pSpan, bool extendSelection, CancellationToken cancellationToken)
{
pSpan[0].iStartLine = pSpan[0].iEndLine = iLine;
pSpan[0].iStartIndex = pSpan[0].iEndIndex = iIndex;
var pointInViewBuffer = textView.TextSnapshot.GetLineFromLineNumber(iLine).Start + iIndex;
var subjectBuffer = textView.GetBufferContainingCaret();
if (subjectBuffer != null)
{
// PointTrackingMode and PositionAffinity chosen arbitrarily.
var positionInSubjectBuffer = textView.BufferGraph.MapDownToBuffer(pointInViewBuffer, PointTrackingMode.Positive, subjectBuffer, PositionAffinity.Successor);
if (!positionInSubjectBuffer.HasValue)
{
positionInSubjectBuffer = textView.BufferGraph.MapDownToBuffer(pointInViewBuffer, PointTrackingMode.Positive, subjectBuffer, PositionAffinity.Predecessor);
}
if (positionInSubjectBuffer.HasValue)
{
var position = positionInSubjectBuffer.Value;
var document = subjectBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges();
if (document != null)
{
var matchingSpan = braceMatcher.FindMatchingSpanAsync(document, position, cancellationToken).WaitAndGetResult(cancellationToken);
if (matchingSpan.HasValue)
{
var resultsInView = textView.GetSpanInView(matchingSpan.Value.ToSnapshotSpan(subjectBuffer.CurrentSnapshot)).ToList();
if (resultsInView.Count == 1)
{
var vsTextSpan = resultsInView[0].ToVsTextSpan();
// caret is at close parenthesis
if (matchingSpan.Value.Start < position)
{
pSpan[0].iStartLine = vsTextSpan.iStartLine;
pSpan[0].iStartIndex = vsTextSpan.iStartIndex;
// For text selection using goto matching brace, tweak spans to suit the VS editor's behavior.
// The vs editor sets selection for GotoBraceExt (Ctrl + Shift + ]) like so :
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// if (fExtendSelection)
// {
// textSpan.iEndIndex++;
// this.SetSelection(textSpan.iStartLine, textSpan.iStartIndex, textSpan.iEndLine, textSpan.iEndIndex);
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Notice a couple of things: it arbitrarily increments EndIndex by 1 and does nothing similar for StartIndex.
// So, if we're extending selection:
// case a: set EndIndex to left of closing parenthesis -- ^}
// this adjustment is for any of the four cases where caret could be. left or right of open or close parenthesis -- ^{^ ^}^
// case b: set StartIndex to left of opening parenthesis -- ^{
// this adjustment is for cases where caret was originally to the right of the open parenthesis -- {^ }
// if selecting, adjust end position by using the matching opening span that we just computed.
if (extendSelection)
{
// case a.
var closingSpans = braceMatcher.FindMatchingSpanAsync(document, matchingSpan.Value.Start, cancellationToken).WaitAndGetResult(cancellationToken);
var vsClosingSpans = textView.GetSpanInView(closingSpans.Value.ToSnapshotSpan(subjectBuffer.CurrentSnapshot)).ToList().First().ToVsTextSpan();
pSpan[0].iEndIndex = vsClosingSpans.iStartIndex;
}
}
else if (matchingSpan.Value.End > position) // caret is at open parenthesis
{
pSpan[0].iEndLine = vsTextSpan.iEndLine;
pSpan[0].iEndIndex = vsTextSpan.iEndIndex;
// if selecting, adjust start position by using the matching closing span that we computed
if (extendSelection)
{
// case a.
pSpan[0].iEndIndex = vsTextSpan.iStartIndex;
// case b.
var openingSpans = braceMatcher.FindMatchingSpanAsync(document, matchingSpan.Value.End, cancellationToken).WaitAndGetResult(cancellationToken);
var vsOpeningSpans = textView.GetSpanInView(openingSpans.Value.ToSnapshotSpan(subjectBuffer.CurrentSnapshot)).ToList().First().ToVsTextSpan();
pSpan[0].iStartIndex = vsOpeningSpans.iStartIndex;
}
}
}
}
}
}
}
return VSConstants.S_OK;
}
int IVsTextViewFilter.GetWordExtent(int iLine, int iIndex, uint dwFlags, TextSpan[] pSpan)
=> VSConstants.E_NOTIMPL;
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/EditorFeatures/CSharpTest/Diagnostics/PreferFrameworkType/PreferFrameworkTypeTests.cs | // 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.
#nullable disable
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.CodeStyle;
using Microsoft.CodeAnalysis.CSharp.Diagnostics.Analyzers;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions;
using Microsoft.CodeAnalysis.PreferFrameworkType;
using Microsoft.CodeAnalysis.Test.Utilities;
using Xunit;
using Xunit.Abstractions;
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics.PreferFrameworkType
{
public partial class PreferFrameworkTypeTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest
{
public PreferFrameworkTypeTests(ITestOutputHelper logger)
: base(logger)
{
}
internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace)
=> (new CSharpPreferFrameworkTypeDiagnosticAnalyzer(), new PreferFrameworkTypeCodeFixProvider());
private readonly CodeStyleOption2<bool> onWithInfo = new CodeStyleOption2<bool>(true, NotificationOption2.Suggestion);
private readonly CodeStyleOption2<bool> offWithInfo = new CodeStyleOption2<bool>(false, NotificationOption2.Suggestion);
private OptionsCollection NoFrameworkType
=> new OptionsCollection(GetLanguage())
{
{ CodeStyleOptions2.PreferIntrinsicPredefinedTypeKeywordInDeclaration, true, NotificationOption2.Suggestion },
{ CodeStyleOptions2.PreferIntrinsicPredefinedTypeKeywordInMemberAccess, onWithInfo },
};
private OptionsCollection FrameworkTypeEverywhere
=> new OptionsCollection(GetLanguage())
{
{ CodeStyleOptions2.PreferIntrinsicPredefinedTypeKeywordInDeclaration, false, NotificationOption2.Suggestion },
{ CodeStyleOptions2.PreferIntrinsicPredefinedTypeKeywordInMemberAccess, offWithInfo },
};
private OptionsCollection FrameworkTypeInDeclaration
=> new OptionsCollection(GetLanguage())
{
{ CodeStyleOptions2.PreferIntrinsicPredefinedTypeKeywordInDeclaration, false, NotificationOption2.Suggestion },
{ CodeStyleOptions2.PreferIntrinsicPredefinedTypeKeywordInMemberAccess, onWithInfo },
};
private OptionsCollection FrameworkTypeInMemberAccess
=> new OptionsCollection(GetLanguage())
{
{ CodeStyleOptions2.PreferIntrinsicPredefinedTypeKeywordInDeclaration, true, NotificationOption2.Suggestion },
{ CodeStyleOptions2.PreferIntrinsicPredefinedTypeKeywordInMemberAccess, offWithInfo },
};
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task NotWhenOptionsAreNotSet()
{
await TestMissingInRegularAndScriptAsync(
@"using System;
class Program
{
void Method()
{
[|int|] x = 1;
}
}", new TestParameters(options: NoFrameworkType));
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task NotOnDynamic()
{
await TestMissingInRegularAndScriptAsync(
@"using System;
class Program
{
void Method()
{
[|dynamic|] x = 1;
}
}", new TestParameters(options: FrameworkTypeInDeclaration));
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task NotOnSystemVoid()
{
await TestMissingInRegularAndScriptAsync(
@"using System;
class Program
{
[|void|] Method()
{
}
}", new TestParameters(options: FrameworkTypeEverywhere));
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task NotOnUserdefinedType()
{
await TestMissingInRegularAndScriptAsync(
@"using System;
class Program
{
void Method()
{
[|Program|] p;
}
}", new TestParameters(options: FrameworkTypeEverywhere));
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task NotOnFrameworkType()
{
await TestMissingInRegularAndScriptAsync(
@"using System;
class Program
{
void Method()
{
[|Int32|] p;
}
}", new TestParameters(options: FrameworkTypeInDeclaration));
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task NotOnQualifiedTypeSyntax()
{
await TestMissingInRegularAndScriptAsync(
@"class Program
{
void Method()
{
[|System.Int32|] p;
}
}", new TestParameters(options: FrameworkTypeInDeclaration));
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task NotOnFrameworkTypeWithNoPredefinedKeywordEquivalent()
{
await TestMissingInRegularAndScriptAsync(
@"using System;
class Program
{
void Method()
{
[|List|]<int> p;
}
}", new TestParameters(options: FrameworkTypeInDeclaration));
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task NotOnIdentifierThatIsNotTypeSyntax()
{
await TestMissingInRegularAndScriptAsync(
@"using System;
class Program
{
void Method()
{
int [|p|];
}
}", new TestParameters(options: FrameworkTypeInDeclaration));
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task QualifiedReplacementWhenNoUsingFound()
{
var code =
@"class Program
{
[|string|] _myfield = 5;
}";
var expected =
@"class Program
{
System.String _myfield = 5;
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInDeclaration);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task FieldDeclaration()
{
var code =
@"using System;
class Program
{
[|int|] _myfield;
}";
var expected =
@"using System;
class Program
{
Int32 _myfield;
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInDeclaration);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task FieldDeclarationWithInitializer()
{
var code =
@"using System;
class Program
{
[|string|] _myfield = 5;
}";
var expected =
@"using System;
class Program
{
String _myfield = 5;
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInDeclaration);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task DelegateDeclaration()
{
var code =
@"using System;
class Program
{
public delegate [|int|] PerformCalculation(int x, int y);
}";
var expected =
@"using System;
class Program
{
public delegate Int32 PerformCalculation(int x, int y);
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInDeclaration);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task PropertyDeclaration()
{
var code =
@"using System;
class Program
{
public [|long|] MyProperty { get; set; }
}";
var expected =
@"using System;
class Program
{
public Int64 MyProperty { get; set; }
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInDeclaration);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task GenericPropertyDeclaration()
{
var code =
@"using System;
using System.Collections.Generic;
class Program
{
public List<[|long|]> MyProperty { get; set; }
}";
var expected =
@"using System;
using System.Collections.Generic;
class Program
{
public List<Int64> MyProperty { get; set; }
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInDeclaration);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task QualifiedReplacementInGenericTypeParameter()
{
var code =
@"using System.Collections.Generic;
class Program
{
public List<[|long|]> MyProperty { get; set; }
}";
var expected =
@"using System.Collections.Generic;
class Program
{
public List<System.Int64> MyProperty { get; set; }
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInDeclaration);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task MethodDeclarationReturnType()
{
var code =
@"using System;
class Program
{
public [|long|] Method() { }
}";
var expected =
@"using System;
class Program
{
public Int64 Method() { }
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInDeclaration);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task MethodDeclarationParameters()
{
var code =
@"using System;
class Program
{
public void Method([|double|] d) { }
}";
var expected =
@"using System;
class Program
{
public void Method(Double d) { }
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInDeclaration);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task GenericMethodInvocation()
{
var code =
@"using System;
class Program
{
public void Method<T>() { }
public void Test() { Method<[|int|]>(); }
}";
var expected =
@"using System;
class Program
{
public void Method<T>() { }
public void Test() { Method<Int32>(); }
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInDeclaration);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task LocalDeclaration()
{
var code =
@"using System;
class Program
{
void Method()
{
[|int|] f = 5;
}
}";
var expected =
@"using System;
class Program
{
void Method()
{
Int32 f = 5;
}
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInDeclaration);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task MemberAccess()
{
var code =
@"using System;
class Program
{
void Method()
{
Console.Write([|int|].MaxValue);
}
}";
var expected =
@"using System;
class Program
{
void Method()
{
Console.Write(Int32.MaxValue);
}
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInMemberAccess);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task MemberAccess2()
{
var code =
@"using System;
class Program
{
void Method()
{
var x = [|int|].Parse(""1"");
}
}";
var expected =
@"using System;
class Program
{
void Method()
{
var x = Int32.Parse(""1"");
}
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInMemberAccess);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task DocCommentTriviaCrefExpression()
{
var code =
@"using System;
class Program
{
/// <see cref=""[|int|].MaxValue""/>
void Method()
{
}
}";
var expected =
@"using System;
class Program
{
/// <see cref=""Int32.MaxValue""/>
void Method()
{
}
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInMemberAccess);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task DefaultExpression()
{
var code =
@"using System;
class Program
{
void Method()
{
var v = default([|int|]);
}
}";
var expected =
@"using System;
class Program
{
void Method()
{
var v = default(Int32);
}
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInDeclaration);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task TypeOfExpression()
{
var code =
@"using System;
class Program
{
void Method()
{
var v = typeof([|int|]);
}
}";
var expected =
@"using System;
class Program
{
void Method()
{
var v = typeof(Int32);
}
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInDeclaration);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task NameOfExpression()
{
var code =
@"using System;
class Program
{
void Method()
{
var v = nameof([|int|]);
}
}";
var expected =
@"using System;
class Program
{
void Method()
{
var v = nameof(Int32);
}
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInDeclaration);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task FormalParametersWithinLambdaExression()
{
var code =
@"using System;
class Program
{
void Method()
{
Func<int, int> func3 = ([|int|] z) => z + 1;
}
}";
var expected =
@"using System;
class Program
{
void Method()
{
Func<int, int> func3 = (Int32 z) => z + 1;
}
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInDeclaration);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task DelegateMethodExpression()
{
var code =
@"using System;
class Program
{
void Method()
{
Func<int, int> func7 = delegate ([|int|] dx) { return dx + 1; };
}
}";
var expected =
@"using System;
class Program
{
void Method()
{
Func<int, int> func7 = delegate (Int32 dx) { return dx + 1; };
}
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInDeclaration);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task ObjectCreationExpression()
{
var code =
@"using System;
class Program
{
void Method()
{
string s2 = new [|string|]('c', 1);
}
}";
var expected =
@"using System;
class Program
{
void Method()
{
string s2 = new String('c', 1);
}
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInDeclaration);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task ArrayDeclaration()
{
var code =
@"using System;
class Program
{
void Method()
{
[|int|][] k = new int[4];
}
}";
var expected =
@"using System;
class Program
{
void Method()
{
Int32[] k = new int[4];
}
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInDeclaration);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task ArrayInitializer()
{
var code =
@"using System;
class Program
{
void Method()
{
int[] k = new [|int|][] { 1, 2, 3 };
}
}";
var expected =
@"using System;
class Program
{
void Method()
{
int[] k = new Int32[] { 1, 2, 3 };
}
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInDeclaration);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task MultiDimentionalArrayAsGenericTypeParameter()
{
var code =
@"using System;
using System.Collections.Generic;
class Program
{
void Method()
{
List<[|string|][][,][,,,]> a;
}
}";
var expected =
@"using System;
using System.Collections.Generic;
class Program
{
void Method()
{
List<String[][,][,,,]> a;
}
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInDeclaration);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task ForStatement()
{
var code =
@"using System;
class Program
{
void Method()
{
for ([|int|] j = 0; j < 4; j++) { }
}
}";
var expected =
@"using System;
class Program
{
void Method()
{
for (Int32 j = 0; j < 4; j++) { }
}
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInDeclaration);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task ForeachStatement()
{
var code =
@"using System;
class Program
{
void Method()
{
foreach ([|int|] item in new int[] { 1, 2, 3 }) { }
}
}";
var expected =
@"using System;
class Program
{
void Method()
{
foreach (Int32 item in new int[] { 1, 2, 3 }) { }
}
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInDeclaration);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task LeadingTrivia()
{
var code =
@"using System;
class Program
{
void Method()
{
// this is a comment
[|int|] x = 5;
}
}";
var expected =
@"using System;
class Program
{
void Method()
{
// this is a comment
Int32 x = 5;
}
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInDeclaration);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task TrailingTrivia()
{
var code =
@"using System;
class Program
{
void Method()
{
[|int|] /* 2 */ x = 5;
}
}";
var expected =
@"using System;
class Program
{
void Method()
{
Int32 /* 2 */ x = 5;
}
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInDeclaration);
}
}
}
| // 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.
#nullable disable
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.CodeStyle;
using Microsoft.CodeAnalysis.CSharp.Diagnostics.Analyzers;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions;
using Microsoft.CodeAnalysis.PreferFrameworkType;
using Microsoft.CodeAnalysis.Test.Utilities;
using Xunit;
using Xunit.Abstractions;
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics.PreferFrameworkType
{
public partial class PreferFrameworkTypeTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest
{
public PreferFrameworkTypeTests(ITestOutputHelper logger)
: base(logger)
{
}
internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace)
=> (new CSharpPreferFrameworkTypeDiagnosticAnalyzer(), new PreferFrameworkTypeCodeFixProvider());
private readonly CodeStyleOption2<bool> onWithInfo = new CodeStyleOption2<bool>(true, NotificationOption2.Suggestion);
private readonly CodeStyleOption2<bool> offWithInfo = new CodeStyleOption2<bool>(false, NotificationOption2.Suggestion);
private OptionsCollection NoFrameworkType
=> new OptionsCollection(GetLanguage())
{
{ CodeStyleOptions2.PreferIntrinsicPredefinedTypeKeywordInDeclaration, true, NotificationOption2.Suggestion },
{ CodeStyleOptions2.PreferIntrinsicPredefinedTypeKeywordInMemberAccess, onWithInfo },
};
private OptionsCollection FrameworkTypeEverywhere
=> new OptionsCollection(GetLanguage())
{
{ CodeStyleOptions2.PreferIntrinsicPredefinedTypeKeywordInDeclaration, false, NotificationOption2.Suggestion },
{ CodeStyleOptions2.PreferIntrinsicPredefinedTypeKeywordInMemberAccess, offWithInfo },
};
private OptionsCollection FrameworkTypeInDeclaration
=> new OptionsCollection(GetLanguage())
{
{ CodeStyleOptions2.PreferIntrinsicPredefinedTypeKeywordInDeclaration, false, NotificationOption2.Suggestion },
{ CodeStyleOptions2.PreferIntrinsicPredefinedTypeKeywordInMemberAccess, onWithInfo },
};
private OptionsCollection FrameworkTypeInMemberAccess
=> new OptionsCollection(GetLanguage())
{
{ CodeStyleOptions2.PreferIntrinsicPredefinedTypeKeywordInDeclaration, true, NotificationOption2.Suggestion },
{ CodeStyleOptions2.PreferIntrinsicPredefinedTypeKeywordInMemberAccess, offWithInfo },
};
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task NotWhenOptionsAreNotSet()
{
await TestMissingInRegularAndScriptAsync(
@"using System;
class Program
{
void Method()
{
[|int|] x = 1;
}
}", new TestParameters(options: NoFrameworkType));
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task NotOnDynamic()
{
await TestMissingInRegularAndScriptAsync(
@"using System;
class Program
{
void Method()
{
[|dynamic|] x = 1;
}
}", new TestParameters(options: FrameworkTypeInDeclaration));
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task NotOnSystemVoid()
{
await TestMissingInRegularAndScriptAsync(
@"using System;
class Program
{
[|void|] Method()
{
}
}", new TestParameters(options: FrameworkTypeEverywhere));
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task NotOnUserdefinedType()
{
await TestMissingInRegularAndScriptAsync(
@"using System;
class Program
{
void Method()
{
[|Program|] p;
}
}", new TestParameters(options: FrameworkTypeEverywhere));
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task NotOnFrameworkType()
{
await TestMissingInRegularAndScriptAsync(
@"using System;
class Program
{
void Method()
{
[|Int32|] p;
}
}", new TestParameters(options: FrameworkTypeInDeclaration));
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task NotOnQualifiedTypeSyntax()
{
await TestMissingInRegularAndScriptAsync(
@"class Program
{
void Method()
{
[|System.Int32|] p;
}
}", new TestParameters(options: FrameworkTypeInDeclaration));
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task NotOnFrameworkTypeWithNoPredefinedKeywordEquivalent()
{
await TestMissingInRegularAndScriptAsync(
@"using System;
class Program
{
void Method()
{
[|List|]<int> p;
}
}", new TestParameters(options: FrameworkTypeInDeclaration));
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task NotOnIdentifierThatIsNotTypeSyntax()
{
await TestMissingInRegularAndScriptAsync(
@"using System;
class Program
{
void Method()
{
int [|p|];
}
}", new TestParameters(options: FrameworkTypeInDeclaration));
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task QualifiedReplacementWhenNoUsingFound()
{
var code =
@"class Program
{
[|string|] _myfield = 5;
}";
var expected =
@"class Program
{
System.String _myfield = 5;
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInDeclaration);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task FieldDeclaration()
{
var code =
@"using System;
class Program
{
[|int|] _myfield;
}";
var expected =
@"using System;
class Program
{
Int32 _myfield;
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInDeclaration);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task FieldDeclarationWithInitializer()
{
var code =
@"using System;
class Program
{
[|string|] _myfield = 5;
}";
var expected =
@"using System;
class Program
{
String _myfield = 5;
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInDeclaration);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task DelegateDeclaration()
{
var code =
@"using System;
class Program
{
public delegate [|int|] PerformCalculation(int x, int y);
}";
var expected =
@"using System;
class Program
{
public delegate Int32 PerformCalculation(int x, int y);
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInDeclaration);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task PropertyDeclaration()
{
var code =
@"using System;
class Program
{
public [|long|] MyProperty { get; set; }
}";
var expected =
@"using System;
class Program
{
public Int64 MyProperty { get; set; }
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInDeclaration);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task GenericPropertyDeclaration()
{
var code =
@"using System;
using System.Collections.Generic;
class Program
{
public List<[|long|]> MyProperty { get; set; }
}";
var expected =
@"using System;
using System.Collections.Generic;
class Program
{
public List<Int64> MyProperty { get; set; }
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInDeclaration);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task QualifiedReplacementInGenericTypeParameter()
{
var code =
@"using System.Collections.Generic;
class Program
{
public List<[|long|]> MyProperty { get; set; }
}";
var expected =
@"using System.Collections.Generic;
class Program
{
public List<System.Int64> MyProperty { get; set; }
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInDeclaration);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task MethodDeclarationReturnType()
{
var code =
@"using System;
class Program
{
public [|long|] Method() { }
}";
var expected =
@"using System;
class Program
{
public Int64 Method() { }
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInDeclaration);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task MethodDeclarationParameters()
{
var code =
@"using System;
class Program
{
public void Method([|double|] d) { }
}";
var expected =
@"using System;
class Program
{
public void Method(Double d) { }
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInDeclaration);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task GenericMethodInvocation()
{
var code =
@"using System;
class Program
{
public void Method<T>() { }
public void Test() { Method<[|int|]>(); }
}";
var expected =
@"using System;
class Program
{
public void Method<T>() { }
public void Test() { Method<Int32>(); }
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInDeclaration);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task LocalDeclaration()
{
var code =
@"using System;
class Program
{
void Method()
{
[|int|] f = 5;
}
}";
var expected =
@"using System;
class Program
{
void Method()
{
Int32 f = 5;
}
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInDeclaration);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task MemberAccess()
{
var code =
@"using System;
class Program
{
void Method()
{
Console.Write([|int|].MaxValue);
}
}";
var expected =
@"using System;
class Program
{
void Method()
{
Console.Write(Int32.MaxValue);
}
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInMemberAccess);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task MemberAccess2()
{
var code =
@"using System;
class Program
{
void Method()
{
var x = [|int|].Parse(""1"");
}
}";
var expected =
@"using System;
class Program
{
void Method()
{
var x = Int32.Parse(""1"");
}
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInMemberAccess);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task DocCommentTriviaCrefExpression()
{
var code =
@"using System;
class Program
{
/// <see cref=""[|int|].MaxValue""/>
void Method()
{
}
}";
var expected =
@"using System;
class Program
{
/// <see cref=""Int32.MaxValue""/>
void Method()
{
}
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInMemberAccess);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task DefaultExpression()
{
var code =
@"using System;
class Program
{
void Method()
{
var v = default([|int|]);
}
}";
var expected =
@"using System;
class Program
{
void Method()
{
var v = default(Int32);
}
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInDeclaration);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task TypeOfExpression()
{
var code =
@"using System;
class Program
{
void Method()
{
var v = typeof([|int|]);
}
}";
var expected =
@"using System;
class Program
{
void Method()
{
var v = typeof(Int32);
}
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInDeclaration);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task NameOfExpression()
{
var code =
@"using System;
class Program
{
void Method()
{
var v = nameof([|int|]);
}
}";
var expected =
@"using System;
class Program
{
void Method()
{
var v = nameof(Int32);
}
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInDeclaration);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task FormalParametersWithinLambdaExression()
{
var code =
@"using System;
class Program
{
void Method()
{
Func<int, int> func3 = ([|int|] z) => z + 1;
}
}";
var expected =
@"using System;
class Program
{
void Method()
{
Func<int, int> func3 = (Int32 z) => z + 1;
}
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInDeclaration);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task DelegateMethodExpression()
{
var code =
@"using System;
class Program
{
void Method()
{
Func<int, int> func7 = delegate ([|int|] dx) { return dx + 1; };
}
}";
var expected =
@"using System;
class Program
{
void Method()
{
Func<int, int> func7 = delegate (Int32 dx) { return dx + 1; };
}
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInDeclaration);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task ObjectCreationExpression()
{
var code =
@"using System;
class Program
{
void Method()
{
string s2 = new [|string|]('c', 1);
}
}";
var expected =
@"using System;
class Program
{
void Method()
{
string s2 = new String('c', 1);
}
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInDeclaration);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task ArrayDeclaration()
{
var code =
@"using System;
class Program
{
void Method()
{
[|int|][] k = new int[4];
}
}";
var expected =
@"using System;
class Program
{
void Method()
{
Int32[] k = new int[4];
}
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInDeclaration);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task ArrayInitializer()
{
var code =
@"using System;
class Program
{
void Method()
{
int[] k = new [|int|][] { 1, 2, 3 };
}
}";
var expected =
@"using System;
class Program
{
void Method()
{
int[] k = new Int32[] { 1, 2, 3 };
}
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInDeclaration);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task MultiDimentionalArrayAsGenericTypeParameter()
{
var code =
@"using System;
using System.Collections.Generic;
class Program
{
void Method()
{
List<[|string|][][,][,,,]> a;
}
}";
var expected =
@"using System;
using System.Collections.Generic;
class Program
{
void Method()
{
List<String[][,][,,,]> a;
}
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInDeclaration);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task ForStatement()
{
var code =
@"using System;
class Program
{
void Method()
{
for ([|int|] j = 0; j < 4; j++) { }
}
}";
var expected =
@"using System;
class Program
{
void Method()
{
for (Int32 j = 0; j < 4; j++) { }
}
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInDeclaration);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task ForeachStatement()
{
var code =
@"using System;
class Program
{
void Method()
{
foreach ([|int|] item in new int[] { 1, 2, 3 }) { }
}
}";
var expected =
@"using System;
class Program
{
void Method()
{
foreach (Int32 item in new int[] { 1, 2, 3 }) { }
}
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInDeclaration);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task LeadingTrivia()
{
var code =
@"using System;
class Program
{
void Method()
{
// this is a comment
[|int|] x = 5;
}
}";
var expected =
@"using System;
class Program
{
void Method()
{
// this is a comment
Int32 x = 5;
}
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInDeclaration);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseFrameworkType)]
public async Task TrailingTrivia()
{
var code =
@"using System;
class Program
{
void Method()
{
[|int|] /* 2 */ x = 5;
}
}";
var expected =
@"using System;
class Program
{
void Method()
{
Int32 /* 2 */ x = 5;
}
}";
await TestInRegularAndScriptAsync(code, expected, options: FrameworkTypeInDeclaration);
}
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Compilers/Core/Portable/CodeGen/LambdaDebugInfo.cs | // 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.Diagnostics;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.CodeGen
{
/// <summary>
/// Debug information maintained for each lambda.
/// </summary>
/// <remarks>
/// The information is emitted to PDB in Custom Debug Information record for a method containing the lambda.
/// </remarks>
[DebuggerDisplay("{GetDebuggerDisplay(), nq}")]
internal struct LambdaDebugInfo : IEquatable<LambdaDebugInfo>
{
/// <summary>
/// The syntax offset of the syntax node declaring the lambda (lambda expression) or its body (lambda in a query).
/// </summary>
public readonly int SyntaxOffset;
/// <summary>
/// The ordinal of the closure frame the lambda belongs to, or
/// <see cref="StaticClosureOrdinal"/> if the lambda is static, or
/// <see cref="ThisOnlyClosureOrdinal"/> if the lambda is closed over "this" pointer only.
/// </summary>
public readonly int ClosureOrdinal;
public readonly DebugId LambdaId;
public const int StaticClosureOrdinal = -1;
public const int ThisOnlyClosureOrdinal = -2;
public const int MinClosureOrdinal = ThisOnlyClosureOrdinal;
public LambdaDebugInfo(int syntaxOffset, DebugId lambdaId, int closureOrdinal)
{
Debug.Assert(closureOrdinal >= MinClosureOrdinal);
SyntaxOffset = syntaxOffset;
ClosureOrdinal = closureOrdinal;
LambdaId = lambdaId;
}
public bool Equals(LambdaDebugInfo other)
{
return SyntaxOffset == other.SyntaxOffset
&& ClosureOrdinal == other.ClosureOrdinal
&& LambdaId.Equals(other.LambdaId);
}
public override bool Equals(object? obj)
{
return obj is LambdaDebugInfo && Equals((LambdaDebugInfo)obj);
}
public override int GetHashCode()
{
return Hash.Combine(ClosureOrdinal,
Hash.Combine(SyntaxOffset, LambdaId.GetHashCode()));
}
internal string GetDebuggerDisplay()
{
return
ClosureOrdinal == StaticClosureOrdinal ? $"({LambdaId.GetDebuggerDisplay()} @{SyntaxOffset}, static)" :
ClosureOrdinal == ThisOnlyClosureOrdinal ? $"(#{LambdaId.GetDebuggerDisplay()} @{SyntaxOffset}, this)" :
$"({LambdaId.GetDebuggerDisplay()} @{SyntaxOffset} in {ClosureOrdinal})";
}
}
}
| // 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.Diagnostics;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.CodeGen
{
/// <summary>
/// Debug information maintained for each lambda.
/// </summary>
/// <remarks>
/// The information is emitted to PDB in Custom Debug Information record for a method containing the lambda.
/// </remarks>
[DebuggerDisplay("{GetDebuggerDisplay(), nq}")]
internal struct LambdaDebugInfo : IEquatable<LambdaDebugInfo>
{
/// <summary>
/// The syntax offset of the syntax node declaring the lambda (lambda expression) or its body (lambda in a query).
/// </summary>
public readonly int SyntaxOffset;
/// <summary>
/// The ordinal of the closure frame the lambda belongs to, or
/// <see cref="StaticClosureOrdinal"/> if the lambda is static, or
/// <see cref="ThisOnlyClosureOrdinal"/> if the lambda is closed over "this" pointer only.
/// </summary>
public readonly int ClosureOrdinal;
public readonly DebugId LambdaId;
public const int StaticClosureOrdinal = -1;
public const int ThisOnlyClosureOrdinal = -2;
public const int MinClosureOrdinal = ThisOnlyClosureOrdinal;
public LambdaDebugInfo(int syntaxOffset, DebugId lambdaId, int closureOrdinal)
{
Debug.Assert(closureOrdinal >= MinClosureOrdinal);
SyntaxOffset = syntaxOffset;
ClosureOrdinal = closureOrdinal;
LambdaId = lambdaId;
}
public bool Equals(LambdaDebugInfo other)
{
return SyntaxOffset == other.SyntaxOffset
&& ClosureOrdinal == other.ClosureOrdinal
&& LambdaId.Equals(other.LambdaId);
}
public override bool Equals(object? obj)
{
return obj is LambdaDebugInfo && Equals((LambdaDebugInfo)obj);
}
public override int GetHashCode()
{
return Hash.Combine(ClosureOrdinal,
Hash.Combine(SyntaxOffset, LambdaId.GetHashCode()));
}
internal string GetDebuggerDisplay()
{
return
ClosureOrdinal == StaticClosureOrdinal ? $"({LambdaId.GetDebuggerDisplay()} @{SyntaxOffset}, static)" :
ClosureOrdinal == ThisOnlyClosureOrdinal ? $"(#{LambdaId.GetDebuggerDisplay()} @{SyntaxOffset}, this)" :
$"({LambdaId.GetDebuggerDisplay()} @{SyntaxOffset} in {ClosureOrdinal})";
}
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Features/Core/Portable/IntroduceVariable/AbstractIntroduceVariableService.State_Query.cs | // 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.
#nullable disable
using System.Linq;
using System.Threading;
using Microsoft.CodeAnalysis;
namespace Microsoft.CodeAnalysis.IntroduceVariable
{
internal partial class AbstractIntroduceVariableService<TService, TExpressionSyntax, TTypeSyntax, TTypeDeclarationSyntax, TQueryExpressionSyntax, TNameSyntax>
{
private partial class State
{
private bool IsInQueryContext(
CancellationToken cancellationToken)
{
if (!_service.IsInNonFirstQueryClause(Expression))
{
return false;
}
var semanticMap = GetSemanticMap(cancellationToken);
if (!semanticMap.AllReferencedSymbols.Any(s => s is IRangeVariableSymbol))
{
return false;
}
var info = Document.SemanticModel.GetTypeInfo(Expression, cancellationToken);
if (info.Type == null || info.Type.SpecialType == SpecialType.System_Void)
{
return false;
}
return true;
}
}
}
}
| // 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.
#nullable disable
using System.Linq;
using System.Threading;
using Microsoft.CodeAnalysis;
namespace Microsoft.CodeAnalysis.IntroduceVariable
{
internal partial class AbstractIntroduceVariableService<TService, TExpressionSyntax, TTypeSyntax, TTypeDeclarationSyntax, TQueryExpressionSyntax, TNameSyntax>
{
private partial class State
{
private bool IsInQueryContext(
CancellationToken cancellationToken)
{
if (!_service.IsInNonFirstQueryClause(Expression))
{
return false;
}
var semanticMap = GetSemanticMap(cancellationToken);
if (!semanticMap.AllReferencedSymbols.Any(s => s is IRangeVariableSymbol))
{
return false;
}
var info = Document.SemanticModel.GetTypeInfo(Expression, cancellationToken);
if (info.Type == null || info.Type.SpecialType == SpecialType.System_Void)
{
return false;
}
return true;
}
}
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Compilers/Core/CodeAnalysisTest/CachingLookupTests.cs | // 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.
#nullable disable
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using Microsoft.CodeAnalysis.Collections;
using Microsoft.CodeAnalysis.Text;
using Xunit;
namespace Microsoft.CodeAnalysis.UnitTests
{
/// <summary>
/// Tests for CachingLookup.
/// </summary>
public class CachingLookupTests
{
private readonly Random _randomCaseGenerator = new Random(17);
private int[] RandomNumbers(int length, int seed)
{
Random rand = new Random(seed);
int[] result = new int[length];
for (int i = 0; i < length; ++i)
{
result[i] = rand.Next(100, ((length / 10) + 4) * 100);
}
return result;
}
private HashSet<string> Keys(int[] numbers, bool randomCase, IEqualityComparer<string> comparer)
{
var keys = new HashSet<string>(comparer);
foreach (var n in numbers)
{
keys.Add(GetKey(n, randomCase));
}
return keys;
}
private string GetKey(int number, bool randomCase)
{
if (randomCase)
{
bool upper = _randomCaseGenerator.Next(2) == 0;
return (upper ? "AA" : "aa") + Right2Chars(number.ToString());
}
else
{
return "AA" + Right2Chars(number.ToString());
}
}
private ImmutableArray<int> Values(string key, int[] numbers, bool ignoreCase)
{
return (from n in numbers
where string.Equals(GetKey(n, ignoreCase), key, ignoreCase ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal)
select n).ToArray().AsImmutableOrNull();
}
private ILookup<string, int> CreateLookup(int[] numbers, bool randomCase)
{
if (randomCase)
{
return numbers.ToLookup(n => GetKey(n, randomCase), StringComparer.OrdinalIgnoreCase);
}
else
{
return numbers.ToLookup(n => GetKey(n, randomCase), StringComparer.Ordinal);
}
}
private string Right2Chars(string s)
{
return s.Substring(s.Length - 2);
}
private void CheckEqualEnumerable<T>(IEnumerable<T> e1, IEnumerable<T> e2)
{
List<T> l1 = e1.ToList();
List<T> l2 = e2.ToList();
Assert.Equal(l1.Count, l2.Count);
foreach (T item in l1)
{
Assert.Contains(item, l2);
}
foreach (T item in l2)
{
Assert.Contains(item, l1);
}
}
private void CompareLookups1(ILookup<string, int> look1, CachingDictionary<string, int> look2, HashSet<string> keys)
{
foreach (string k in keys)
{
Assert.Equal(look1.Contains(k), look2.Contains(k));
CheckEqualEnumerable(look1[k], look2[k]);
}
foreach (string k in new string[] { "goo", "bar", "banana", "flibber" })
{
Assert.False(look1.Contains(k));
Assert.False(look2.Contains(k));
Assert.Empty(look1[k]);
Assert.Empty(look2[k]);
}
}
private void CompareLookups2(ILookup<string, int> look1, CachingDictionary<string, int> look2, HashSet<string> keys)
{
foreach (string k in look1.Select(g => g.Key))
{
CheckEqualEnumerable(look1[k], look2[k]);
}
foreach (string k in look2.Keys)
{
CheckEqualEnumerable(look1[k], look2[k]);
}
Assert.Equal(look1.Count, look2.Count);
}
private void CompareLookups2(CachingDictionary<string, int> look1, ILookup<string, int> look2, HashSet<string> keys)
{
foreach (string k in look1.Keys)
{
CheckEqualEnumerable(look1[k], look2[k]);
}
foreach (string k in look2.Select(g => g.Key))
{
CheckEqualEnumerable(look1[k], look2[k]);
}
Assert.Equal(look1.Count, look2.Count);
}
[Fact]
public void CachingLookupCorrectResults()
{
StringComparer comparer = StringComparer.Ordinal;
int[] numbers = RandomNumbers(200, 11234);
var dict = new Dictionary<string, ImmutableArray<int>>(comparer);
foreach (string k in Keys(numbers, false, comparer))
{
dict.Add(k, Values(k, numbers, false));
}
var look1 = CreateLookup(numbers, false);
var look2 = new CachingDictionary<string, int>(
s => dict.ContainsKey(s) ? dict[s] : ImmutableArray.Create<int>(),
(c) => Keys(numbers, false, comparer: c), comparer);
CompareLookups1(look1, look2, Keys(numbers, false, comparer));
look1 = CreateLookup(numbers, false);
look2 = new CachingDictionary<string, int>(
s => dict.ContainsKey(s) ? dict[s] : ImmutableArray.Create<int>(),
(c) => Keys(numbers, false, comparer: c), comparer);
CompareLookups2(look1, look2, Keys(numbers, false, comparer));
CompareLookups1(look1, look2, Keys(numbers, false, comparer));
look1 = CreateLookup(numbers, false);
look2 = new CachingDictionary<string, int>(
s => dict.ContainsKey(s) ? dict[s] : ImmutableArray.Create<int>(),
(c) => Keys(numbers, false, comparer: c), comparer);
CompareLookups2(look2, look1, Keys(numbers, false, comparer));
CompareLookups1(look1, look2, Keys(numbers, false, comparer));
}
[Fact]
public void CachingLookupCaseInsensitive()
{
StringComparer comparer = StringComparer.OrdinalIgnoreCase;
int[] numbers = RandomNumbers(300, 719);
var dict = new Dictionary<string, ImmutableArray<int>>(comparer);
foreach (string k in Keys(numbers, false, comparer))
{
dict.Add(k, Values(k, numbers, false));
}
var look1 = CreateLookup(numbers, true);
var look2 = new CachingDictionary<string, int>(
s => dict.ContainsKey(s) ? dict[s] : ImmutableArray.Create<int>(),
(c) => Keys(numbers, true, comparer: c), comparer);
CompareLookups1(look1, look2, Keys(numbers, true, comparer));
look1 = CreateLookup(numbers, true);
look2 = new CachingDictionary<string, int>(
s => dict.ContainsKey(s) ? dict[s] : ImmutableArray.Create<int>(),
(c) => Keys(numbers, true, comparer: c), comparer);
CompareLookups2(look1, look2, Keys(numbers, true, comparer));
CompareLookups1(look1, look2, Keys(numbers, true, comparer));
look1 = CreateLookup(numbers, true);
look2 = new CachingDictionary<string, int>(
s => dict.ContainsKey(s) ? dict[s] : ImmutableArray.Create<int>(),
(c) => Keys(numbers, true, comparer: c), comparer);
CompareLookups2(look2, look1, Keys(numbers, true, comparer));
CompareLookups1(look1, look2, Keys(numbers, true, comparer));
}
[Fact]
public void CachingLookupCaseInsensitiveNoCacheMissingKeys()
{
StringComparer comparer = StringComparer.OrdinalIgnoreCase;
int[] numbers = RandomNumbers(435, 19874);
var dict = new Dictionary<string, ImmutableArray<int>>(comparer);
foreach (string k in Keys(numbers, false, comparer))
{
dict.Add(k, Values(k, numbers, false));
}
var look1 = CreateLookup(numbers, true);
var look2 = new CachingDictionary<string, int>(s => dict.ContainsKey(s) ? dict[s] : ImmutableArray.Create<int>(),
(c) => Keys(numbers, true, comparer: c), comparer);
CompareLookups1(look1, look2, Keys(numbers, true, comparer));
look1 = CreateLookup(numbers, true);
look2 = new CachingDictionary<string, int>(s => dict.ContainsKey(s) ? dict[s] : ImmutableArray.Create<int>(),
(c) => Keys(numbers, true, comparer: c), comparer);
CompareLookups2(look1, look2, Keys(numbers, true, comparer));
CompareLookups1(look1, look2, Keys(numbers, true, comparer));
look1 = CreateLookup(numbers, true);
look2 = new CachingDictionary<string, int>(s => dict.ContainsKey(s) ? dict[s] : ImmutableArray.Create<int>(),
(c) => Keys(numbers, true, comparer: c), comparer);
CompareLookups2(look2, look1, Keys(numbers, true, comparer));
CompareLookups1(look1, look2, Keys(numbers, true, comparer));
}
// Ensure that we are called back exactly once per key.
[Fact]
public void CallExactlyOncePerKey()
{
StringComparer comparer = StringComparer.OrdinalIgnoreCase;
int[] numbers = RandomNumbers(435, 19874);
var dict = new Dictionary<string, ImmutableArray<int>>(comparer);
foreach (string k in Keys(numbers, false, comparer))
{
dict.Add(k, Values(k, numbers, false));
}
HashSet<string> lookedUp = new HashSet<string>(comparer);
bool askedForKeys = false;
var look1 = new CachingDictionary<string, int>(s =>
{
Assert.False(lookedUp.Contains(s));
lookedUp.Add(s);
return dict.ContainsKey(s) ? dict[s] : ImmutableArray.Create<int>();
},
(c) =>
{
Assert.False(askedForKeys);
askedForKeys = true;
return Keys(numbers, true, comparer: c);
}, comparer);
string key1 = GetKey(numbers[0], false);
string key2 = GetKey(numbers[1], false);
string key3 = GetKey(numbers[2], false);
ImmutableArray<int> retval;
retval = look1[key1];
retval = look1[key2];
retval = look1[key3];
retval = look1[key1];
retval = look1[key2];
retval = look1[key3];
retval = look1[key1];
retval = look1[key2];
retval = look1[key3];
retval = look1[key1];
retval = look1[key2];
retval = look1[key3];
}
}
}
| // 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.
#nullable disable
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using Microsoft.CodeAnalysis.Collections;
using Microsoft.CodeAnalysis.Text;
using Xunit;
namespace Microsoft.CodeAnalysis.UnitTests
{
/// <summary>
/// Tests for CachingLookup.
/// </summary>
public class CachingLookupTests
{
private readonly Random _randomCaseGenerator = new Random(17);
private int[] RandomNumbers(int length, int seed)
{
Random rand = new Random(seed);
int[] result = new int[length];
for (int i = 0; i < length; ++i)
{
result[i] = rand.Next(100, ((length / 10) + 4) * 100);
}
return result;
}
private HashSet<string> Keys(int[] numbers, bool randomCase, IEqualityComparer<string> comparer)
{
var keys = new HashSet<string>(comparer);
foreach (var n in numbers)
{
keys.Add(GetKey(n, randomCase));
}
return keys;
}
private string GetKey(int number, bool randomCase)
{
if (randomCase)
{
bool upper = _randomCaseGenerator.Next(2) == 0;
return (upper ? "AA" : "aa") + Right2Chars(number.ToString());
}
else
{
return "AA" + Right2Chars(number.ToString());
}
}
private ImmutableArray<int> Values(string key, int[] numbers, bool ignoreCase)
{
return (from n in numbers
where string.Equals(GetKey(n, ignoreCase), key, ignoreCase ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal)
select n).ToArray().AsImmutableOrNull();
}
private ILookup<string, int> CreateLookup(int[] numbers, bool randomCase)
{
if (randomCase)
{
return numbers.ToLookup(n => GetKey(n, randomCase), StringComparer.OrdinalIgnoreCase);
}
else
{
return numbers.ToLookup(n => GetKey(n, randomCase), StringComparer.Ordinal);
}
}
private string Right2Chars(string s)
{
return s.Substring(s.Length - 2);
}
private void CheckEqualEnumerable<T>(IEnumerable<T> e1, IEnumerable<T> e2)
{
List<T> l1 = e1.ToList();
List<T> l2 = e2.ToList();
Assert.Equal(l1.Count, l2.Count);
foreach (T item in l1)
{
Assert.Contains(item, l2);
}
foreach (T item in l2)
{
Assert.Contains(item, l1);
}
}
private void CompareLookups1(ILookup<string, int> look1, CachingDictionary<string, int> look2, HashSet<string> keys)
{
foreach (string k in keys)
{
Assert.Equal(look1.Contains(k), look2.Contains(k));
CheckEqualEnumerable(look1[k], look2[k]);
}
foreach (string k in new string[] { "goo", "bar", "banana", "flibber" })
{
Assert.False(look1.Contains(k));
Assert.False(look2.Contains(k));
Assert.Empty(look1[k]);
Assert.Empty(look2[k]);
}
}
private void CompareLookups2(ILookup<string, int> look1, CachingDictionary<string, int> look2, HashSet<string> keys)
{
foreach (string k in look1.Select(g => g.Key))
{
CheckEqualEnumerable(look1[k], look2[k]);
}
foreach (string k in look2.Keys)
{
CheckEqualEnumerable(look1[k], look2[k]);
}
Assert.Equal(look1.Count, look2.Count);
}
private void CompareLookups2(CachingDictionary<string, int> look1, ILookup<string, int> look2, HashSet<string> keys)
{
foreach (string k in look1.Keys)
{
CheckEqualEnumerable(look1[k], look2[k]);
}
foreach (string k in look2.Select(g => g.Key))
{
CheckEqualEnumerable(look1[k], look2[k]);
}
Assert.Equal(look1.Count, look2.Count);
}
[Fact]
public void CachingLookupCorrectResults()
{
StringComparer comparer = StringComparer.Ordinal;
int[] numbers = RandomNumbers(200, 11234);
var dict = new Dictionary<string, ImmutableArray<int>>(comparer);
foreach (string k in Keys(numbers, false, comparer))
{
dict.Add(k, Values(k, numbers, false));
}
var look1 = CreateLookup(numbers, false);
var look2 = new CachingDictionary<string, int>(
s => dict.ContainsKey(s) ? dict[s] : ImmutableArray.Create<int>(),
(c) => Keys(numbers, false, comparer: c), comparer);
CompareLookups1(look1, look2, Keys(numbers, false, comparer));
look1 = CreateLookup(numbers, false);
look2 = new CachingDictionary<string, int>(
s => dict.ContainsKey(s) ? dict[s] : ImmutableArray.Create<int>(),
(c) => Keys(numbers, false, comparer: c), comparer);
CompareLookups2(look1, look2, Keys(numbers, false, comparer));
CompareLookups1(look1, look2, Keys(numbers, false, comparer));
look1 = CreateLookup(numbers, false);
look2 = new CachingDictionary<string, int>(
s => dict.ContainsKey(s) ? dict[s] : ImmutableArray.Create<int>(),
(c) => Keys(numbers, false, comparer: c), comparer);
CompareLookups2(look2, look1, Keys(numbers, false, comparer));
CompareLookups1(look1, look2, Keys(numbers, false, comparer));
}
[Fact]
public void CachingLookupCaseInsensitive()
{
StringComparer comparer = StringComparer.OrdinalIgnoreCase;
int[] numbers = RandomNumbers(300, 719);
var dict = new Dictionary<string, ImmutableArray<int>>(comparer);
foreach (string k in Keys(numbers, false, comparer))
{
dict.Add(k, Values(k, numbers, false));
}
var look1 = CreateLookup(numbers, true);
var look2 = new CachingDictionary<string, int>(
s => dict.ContainsKey(s) ? dict[s] : ImmutableArray.Create<int>(),
(c) => Keys(numbers, true, comparer: c), comparer);
CompareLookups1(look1, look2, Keys(numbers, true, comparer));
look1 = CreateLookup(numbers, true);
look2 = new CachingDictionary<string, int>(
s => dict.ContainsKey(s) ? dict[s] : ImmutableArray.Create<int>(),
(c) => Keys(numbers, true, comparer: c), comparer);
CompareLookups2(look1, look2, Keys(numbers, true, comparer));
CompareLookups1(look1, look2, Keys(numbers, true, comparer));
look1 = CreateLookup(numbers, true);
look2 = new CachingDictionary<string, int>(
s => dict.ContainsKey(s) ? dict[s] : ImmutableArray.Create<int>(),
(c) => Keys(numbers, true, comparer: c), comparer);
CompareLookups2(look2, look1, Keys(numbers, true, comparer));
CompareLookups1(look1, look2, Keys(numbers, true, comparer));
}
[Fact]
public void CachingLookupCaseInsensitiveNoCacheMissingKeys()
{
StringComparer comparer = StringComparer.OrdinalIgnoreCase;
int[] numbers = RandomNumbers(435, 19874);
var dict = new Dictionary<string, ImmutableArray<int>>(comparer);
foreach (string k in Keys(numbers, false, comparer))
{
dict.Add(k, Values(k, numbers, false));
}
var look1 = CreateLookup(numbers, true);
var look2 = new CachingDictionary<string, int>(s => dict.ContainsKey(s) ? dict[s] : ImmutableArray.Create<int>(),
(c) => Keys(numbers, true, comparer: c), comparer);
CompareLookups1(look1, look2, Keys(numbers, true, comparer));
look1 = CreateLookup(numbers, true);
look2 = new CachingDictionary<string, int>(s => dict.ContainsKey(s) ? dict[s] : ImmutableArray.Create<int>(),
(c) => Keys(numbers, true, comparer: c), comparer);
CompareLookups2(look1, look2, Keys(numbers, true, comparer));
CompareLookups1(look1, look2, Keys(numbers, true, comparer));
look1 = CreateLookup(numbers, true);
look2 = new CachingDictionary<string, int>(s => dict.ContainsKey(s) ? dict[s] : ImmutableArray.Create<int>(),
(c) => Keys(numbers, true, comparer: c), comparer);
CompareLookups2(look2, look1, Keys(numbers, true, comparer));
CompareLookups1(look1, look2, Keys(numbers, true, comparer));
}
// Ensure that we are called back exactly once per key.
[Fact]
public void CallExactlyOncePerKey()
{
StringComparer comparer = StringComparer.OrdinalIgnoreCase;
int[] numbers = RandomNumbers(435, 19874);
var dict = new Dictionary<string, ImmutableArray<int>>(comparer);
foreach (string k in Keys(numbers, false, comparer))
{
dict.Add(k, Values(k, numbers, false));
}
HashSet<string> lookedUp = new HashSet<string>(comparer);
bool askedForKeys = false;
var look1 = new CachingDictionary<string, int>(s =>
{
Assert.False(lookedUp.Contains(s));
lookedUp.Add(s);
return dict.ContainsKey(s) ? dict[s] : ImmutableArray.Create<int>();
},
(c) =>
{
Assert.False(askedForKeys);
askedForKeys = true;
return Keys(numbers, true, comparer: c);
}, comparer);
string key1 = GetKey(numbers[0], false);
string key2 = GetKey(numbers[1], false);
string key3 = GetKey(numbers[2], false);
ImmutableArray<int> retval;
retval = look1[key1];
retval = look1[key2];
retval = look1[key3];
retval = look1[key1];
retval = look1[key2];
retval = look1[key3];
retval = look1[key1];
retval = look1[key2];
retval = look1[key3];
retval = look1[key1];
retval = look1[key2];
retval = look1[key3];
}
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Compilers/VisualBasic/Portable/Lowering/AsyncRewriter/AsyncRewriter.vb | ' 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.
Imports System.Collections.Generic
Imports System.Collections.Immutable
Imports System.Runtime.InteropServices
Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.CodeGen
Imports Microsoft.CodeAnalysis.PooledObjects
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic
Partial Friend NotInheritable Class AsyncRewriter
Inherits StateMachineRewriter(Of CapturedSymbolOrExpression)
Private ReadOnly _binder As Binder
Private ReadOnly _lookupOptions As LookupOptions
Private ReadOnly _asyncMethodKind As AsyncMethodKind
Private ReadOnly _builderType As NamedTypeSymbol
Private ReadOnly _resultType As TypeSymbol
Private _builderField As FieldSymbol
Private _lastExpressionCaptureNumber As Integer
Public Sub New(body As BoundStatement,
method As MethodSymbol,
stateMachineType As AsyncStateMachine,
slotAllocatorOpt As VariableSlotAllocator,
asyncKind As AsyncMethodKind,
compilationState As TypeCompilationState,
diagnostics As BindingDiagnosticBag)
MyBase.New(body, method, stateMachineType, slotAllocatorOpt, compilationState, diagnostics)
Me._binder = CreateMethodBinder(method)
Me._lookupOptions = LookupOptions.AllMethodsOfAnyArity Or LookupOptions.IgnoreExtensionMethods Or LookupOptions.NoBaseClassLookup
If compilationState.ModuleBuilderOpt.IgnoreAccessibility Then
Me._binder = New IgnoreAccessibilityBinder(Me._binder)
Me._lookupOptions = Me._lookupOptions Or LookupOptions.IgnoreAccessibility
End If
Debug.Assert(asyncKind <> AsyncMethodKind.None)
Debug.Assert(asyncKind = GetAsyncMethodKind(method))
Me._asyncMethodKind = asyncKind
Select Case Me._asyncMethodKind
Case AsyncMethodKind.Sub
Me._resultType = Me.F.SpecialType(SpecialType.System_Void)
Me._builderType = Me.F.WellKnownType(WellKnownType.System_Runtime_CompilerServices_AsyncVoidMethodBuilder)
Case AsyncMethodKind.TaskFunction
Me._resultType = Me.F.SpecialType(SpecialType.System_Void)
Me._builderType = Me.F.WellKnownType(WellKnownType.System_Runtime_CompilerServices_AsyncTaskMethodBuilder)
Case AsyncMethodKind.GenericTaskFunction
Me._resultType = DirectCast(Me.Method.ReturnType, NamedTypeSymbol).TypeArgumentsNoUseSiteDiagnostics().Single().InternalSubstituteTypeParameters(Me.TypeMap).Type
Me._builderType = Me.F.WellKnownType(WellKnownType.System_Runtime_CompilerServices_AsyncTaskMethodBuilder_T).Construct(Me._resultType)
Case Else
Throw ExceptionUtilities.UnexpectedValue(Me._asyncMethodKind)
End Select
End Sub
''' <summary>
''' Rewrite an async method into a state machine class.
''' </summary>
Friend Overloads Shared Function Rewrite(body As BoundBlock,
method As MethodSymbol,
methodOrdinal As Integer,
slotAllocatorOpt As VariableSlotAllocator,
compilationState As TypeCompilationState,
diagnostics As BindingDiagnosticBag,
<Out> ByRef stateMachineType As AsyncStateMachine) As BoundBlock
If body.HasErrors Then
Return body
End If
Dim asyncMethodKind As AsyncMethodKind = GetAsyncMethodKind(method)
If asyncMethodKind = AsyncMethodKind.None Then
Return body
End If
' The CLR doesn't support adding fields to structs, so in order to enable EnC in an async method we need to generate a class.
Dim kind = If(compilationState.Compilation.Options.EnableEditAndContinue, TypeKind.Class, TypeKind.Struct)
stateMachineType = New AsyncStateMachine(slotAllocatorOpt, compilationState, method, methodOrdinal, kind)
compilationState.ModuleBuilderOpt.CompilationState.SetStateMachineType(method, stateMachineType)
Dim rewriter As New AsyncRewriter(body, method, stateMachineType, slotAllocatorOpt, asyncMethodKind, compilationState, diagnostics)
' check if we have all the types we need
If rewriter.EnsureAllSymbolsAndSignature() Then
Return body
End If
Return rewriter.Rewrite()
End Function
Private Shared Function CreateMethodBinder(method As MethodSymbol) As Binder
' For source method symbol create a binder
Dim sourceMethod = TryCast(method, SourceMethodSymbol)
If sourceMethod IsNot Nothing Then
Return BinderBuilder.CreateBinderForMethodBody(DirectCast(sourceMethod.ContainingModule, SourceModuleSymbol),
sourceMethod.ContainingType.Locations(0).PossiblyEmbeddedOrMySourceTree(),
sourceMethod)
End If
' For all other symbols we assume that it should be a synthesized method
' placed inside source named type or in one of its nested types
Debug.Assert((TypeOf method Is SynthesizedLambdaMethod) OrElse (TypeOf method Is SynthesizedInteractiveInitializerMethod))
Dim containingType As NamedTypeSymbol = method.ContainingType
While containingType IsNot Nothing
Dim syntaxTree = containingType.Locations.FirstOrDefault()?.SourceTree
If syntaxTree IsNot Nothing Then
Return BinderBuilder.CreateBinderForType(
DirectCast(containingType.ContainingModule, SourceModuleSymbol),
syntaxTree,
containingType)
End If
containingType = containingType.ContainingType
End While
Throw ExceptionUtilities.Unreachable
End Function
Protected Overrides Sub GenerateControlFields()
' The fields are initialized from async method, so they need to be public:
Me.StateField = Me.F.StateMachineField(Me.F.SpecialType(SpecialType.System_Int32), Me.Method, GeneratedNames.MakeStateMachineStateFieldName(), Accessibility.Public)
Me._builderField = Me.F.StateMachineField(Me._builderType, Me.Method, GeneratedNames.MakeStateMachineBuilderFieldName(), Accessibility.Public)
End Sub
Protected Overrides Sub InitializeStateMachine(bodyBuilder As ArrayBuilder(Of BoundStatement), frameType As NamedTypeSymbol, stateMachineLocal As LocalSymbol)
If frameType.TypeKind = TypeKind.Class Then
' Dim stateMachineLocal = new AsyncImplementationClass()
bodyBuilder.Add(
Me.F.Assignment(
Me.F.Local(stateMachineLocal, True),
Me.F.[New](StateMachineType.Constructor.AsMember(frameType))))
Else
' STAT: localStateMachine = Nothing ' Initialization
bodyBuilder.Add(
Me.F.Assignment(
Me.F.Local(stateMachineLocal, True),
Me.F.Null(stateMachineLocal.Type)))
End If
End Sub
Protected Overrides ReadOnly Property PreserveInitialParameterValues As Boolean
Get
Return False
End Get
End Property
Friend Overrides ReadOnly Property TypeMap As TypeSubstitution
Get
Return Me.StateMachineType.TypeSubstitution
End Get
End Property
Protected Overrides Sub GenerateMethodImplementations()
' Add IAsyncStateMachine.MoveNext()
GenerateMoveNext(
Me.OpenMoveNextMethodImplementation(
WellKnownMember.System_Runtime_CompilerServices_IAsyncStateMachine_MoveNext,
Accessibility.Friend))
'Add IAsyncStateMachine.SetStateMachine()
Me.OpenMethodImplementation(
WellKnownMember.System_Runtime_CompilerServices_IAsyncStateMachine_SetStateMachine,
"System.Runtime.CompilerServices.IAsyncStateMachine.SetStateMachine",
Accessibility.Private,
hasMethodBodyDependency:=False)
' SetStateMachine is used to initialize the underlying AsyncMethodBuilder's reference to the boxed copy of the state machine.
' If the state machine is a class there is no copy made and thus the initialization is not necessary.
' In fact it is an error to reinitialize the builder since it already is initialized.
If Me.F.CurrentType.TypeKind = TypeKind.Class Then
Me.F.CloseMethod(F.Return())
Else
Me.CloseMethod(
Me.F.Block(
Me.F.ExpressionStatement(
Me.GenerateMethodCall(
Me.F.Field(Me.F.Me(), Me._builderField, False),
Me._builderType,
"SetStateMachine",
{Me.F.Parameter(Me.F.CurrentMethod.Parameters(0))})),
Me.F.Return()))
End If
' Constructor
If StateMachineType.TypeKind = TypeKind.Class Then
Me.F.CurrentMethod = StateMachineType.Constructor
Me.F.CloseMethod(F.Block(ImmutableArray.Create(F.BaseInitialization(), F.Return())))
End If
End Sub
Protected Overrides Function GenerateStateMachineCreation(stateMachineVariable As LocalSymbol, frameType As NamedTypeSymbol) As BoundStatement
Dim bodyBuilder = ArrayBuilder(Of BoundStatement).GetInstance()
' STAT: localStateMachine.$stateField = NotStartedStateMachine
Dim stateFieldAsLValue As BoundExpression =
Me.F.Field(
Me.F.Local(stateMachineVariable, True),
Me.StateField.AsMember(frameType), True)
bodyBuilder.Add(
Me.F.Assignment(
stateFieldAsLValue,
Me.F.Literal(StateMachineStates.NotStartedStateMachine)))
' STAT: localStateMachine.$builder = System.Runtime.CompilerServices.AsyncTaskMethodBuilder(Of typeArgs).Create()
Dim constructedBuilderField As FieldSymbol = Me._builderField.AsMember(frameType)
Dim builderFieldAsLValue As BoundExpression = Me.F.Field(Me.F.Local(stateMachineVariable, True), constructedBuilderField, True)
' All properties and methods will be searched in this type
Dim builderType As TypeSymbol = constructedBuilderField.Type
bodyBuilder.Add(
Me.F.Assignment(
builderFieldAsLValue,
Me.GenerateMethodCall(Nothing, builderType, "Create")))
' STAT: localStateMachine.$builder.Start(ref localStateMachine) -- binding to the method AsyncTaskMethodBuilder<typeArgs>.Start(...)
bodyBuilder.Add(
Me.F.ExpressionStatement(
Me.GenerateMethodCall(
builderFieldAsLValue,
builderType,
"Start",
ImmutableArray.Create(Of TypeSymbol)(frameType),
Me.F.Local(stateMachineVariable, True))))
' STAT: Return
' or
' STAT: Return localStateMachine.$builder.Task
bodyBuilder.Add(
If(Me._asyncMethodKind = AsyncMethodKind.[Sub],
Me.F.Return(),
Me.F.Return(Me.GeneratePropertyGet(builderFieldAsLValue, builderType, "Task"))))
Return RewriteBodyIfNeeded(Me.F.Block(ImmutableArray(Of LocalSymbol).Empty, bodyBuilder.ToImmutableAndFree()), Me.F.TopLevelMethod, Me.Method)
End Function
Private Sub GenerateMoveNext(moveNextMethod As MethodSymbol)
Dim rewriter = New AsyncMethodToClassRewriter(method:=Me.Method,
F:=Me.F,
state:=Me.StateField,
builder:=Me._builderField,
hoistedVariables:=Me.hoistedVariables,
nonReusableLocalProxies:=Me.nonReusableLocalProxies,
synthesizedLocalOrdinals:=Me.SynthesizedLocalOrdinals,
slotAllocatorOpt:=Me.SlotAllocatorOpt,
nextFreeHoistedLocalSlot:=Me.nextFreeHoistedLocalSlot,
owner:=Me,
diagnostics:=Diagnostics)
rewriter.GenerateMoveNext(Me.Body, moveNextMethod)
End Sub
Friend Overrides Function RewriteBodyIfNeeded(body As BoundStatement, topMethod As MethodSymbol, currentMethod As MethodSymbol) As BoundStatement
If body.HasErrors Then
Return body
End If
Dim rewrittenNodes As HashSet(Of BoundNode) = Nothing
Dim hasLambdas As Boolean = False
Dim symbolsCapturedWithoutCtor As ISet(Of Symbol) = Nothing
If body.Kind <> BoundKind.Block Then
body = Me.F.Block(body)
End If
Const rewritingFlags As LocalRewriter.RewritingFlags =
LocalRewriter.RewritingFlags.AllowSequencePoints Or
LocalRewriter.RewritingFlags.AllowEndOfMethodReturnWithExpression Or
LocalRewriter.RewritingFlags.AllowCatchWithErrorLineNumberReference
Return LocalRewriter.Rewrite(DirectCast(body, BoundBlock),
topMethod,
F.CompilationState,
previousSubmissionFields:=Nothing,
diagnostics:=Me.Diagnostics,
rewrittenNodes:=rewrittenNodes,
hasLambdas:=hasLambdas,
symbolsCapturedWithoutCopyCtor:=symbolsCapturedWithoutCtor,
flags:=rewritingFlags,
instrumenterOpt:=Nothing, ' Do not instrument anything during this rewrite
currentMethod:=currentMethod)
End Function
''' <returns>
''' Returns true if any members that we need are missing or have use-site errors.
''' </returns>
Friend Overrides Function EnsureAllSymbolsAndSignature() As Boolean
If MyBase.EnsureAllSymbolsAndSignature Then
Return True
End If
Dim bag = BindingDiagnosticBag.GetInstance(withDiagnostics:=True, withDependencies:=Me.Diagnostics.AccumulatesDependencies)
EnsureSpecialType(SpecialType.System_Object, bag)
EnsureSpecialType(SpecialType.System_Void, bag)
EnsureSpecialType(SpecialType.System_ValueType, bag)
EnsureWellKnownType(WellKnownType.System_Runtime_CompilerServices_IAsyncStateMachine, bag)
EnsureWellKnownMember(WellKnownMember.System_Runtime_CompilerServices_IAsyncStateMachine_MoveNext, bag)
EnsureWellKnownMember(WellKnownMember.System_Runtime_CompilerServices_IAsyncStateMachine_SetStateMachine, bag)
' We don't ensure those types because we don't know if they will be actually used,
' use-site errors will be reported later if any of those types is actually requested
'
' EnsureSpecialType(SpecialType.System_Boolean, hasErrors)
' EnsureWellKnownType(WellKnownType.System_Runtime_CompilerServices_ICriticalNotifyCompletion, hasErrors)
' EnsureWellKnownType(WellKnownType.System_Runtime_CompilerServices_INotifyCompletion, hasErrors)
' NOTE: We don't ensure DebuggerStepThroughAttribute, it is just not emitted if not found
' EnsureWellKnownMember(Of MethodSymbol)(WellKnownMember.System_Diagnostics_DebuggerStepThroughAttribute__ctor, hasErrors)
Select Case Me._asyncMethodKind
Case AsyncMethodKind.GenericTaskFunction
EnsureWellKnownType(WellKnownType.System_Runtime_CompilerServices_AsyncTaskMethodBuilder_T, bag)
Case AsyncMethodKind.TaskFunction
EnsureWellKnownType(WellKnownType.System_Runtime_CompilerServices_AsyncTaskMethodBuilder, bag)
Case AsyncMethodKind.[Sub]
EnsureWellKnownType(WellKnownType.System_Runtime_CompilerServices_AsyncVoidMethodBuilder, bag)
Case Else
Throw ExceptionUtilities.UnexpectedValue(Me._asyncMethodKind)
End Select
Dim hasErrors As Boolean = bag.HasAnyErrors
If hasErrors Then
Me.Diagnostics.AddRange(bag)
End If
bag.Free()
Return hasErrors
End Function
''' <summary>
''' Specifies a kind of an Async method
'''
''' None is returned for non-Async methods or methods with wrong return type
''' </summary>
Friend Enum AsyncMethodKind
None
[Sub]
TaskFunction
GenericTaskFunction
End Enum
''' <summary>
''' Returns method's async kind
''' </summary>
Friend Shared Function GetAsyncMethodKind(method As MethodSymbol) As AsyncMethodKind
Debug.Assert(Not method.IsPartial)
If Not method.IsAsync Then
Return AsyncMethodKind.None
End If
If method.IsSub Then
Return AsyncMethodKind.[Sub]
End If
Dim compilation As VisualBasicCompilation = method.DeclaringCompilation
Debug.Assert(compilation IsNot Nothing)
Dim returnType As TypeSymbol = method.ReturnType
If TypeSymbol.Equals(returnType, compilation.GetWellKnownType(WellKnownType.System_Threading_Tasks_Task), TypeCompareKind.ConsiderEverything) Then
Return AsyncMethodKind.TaskFunction
End If
If returnType.Kind = SymbolKind.NamedType AndAlso
TypeSymbol.Equals(returnType.OriginalDefinition, compilation.GetWellKnownType(WellKnownType.System_Threading_Tasks_Task_T), TypeCompareKind.ConsiderEverything) Then
Return AsyncMethodKind.GenericTaskFunction
End If
' Wrong return type
Return AsyncMethodKind.None
End Function
Protected Overrides Function CreateByRefLocalCapture(typeMap As TypeSubstitution,
local As LocalSymbol,
initializers As Dictionary(Of LocalSymbol, BoundExpression)) As CapturedSymbolOrExpression
Debug.Assert(local.IsByRef)
Return CaptureExpression(typeMap, initializers(local), initializers)
End Function
Private Function CaptureExpression(typeMap As TypeSubstitution,
expression As BoundExpression,
initializers As Dictionary(Of LocalSymbol, BoundExpression)) As CapturedSymbolOrExpression
If expression Is Nothing Then
Return Nothing
End If
Select Case expression.Kind
Case BoundKind.Literal
Debug.Assert(Not expression.IsLValue)
' TODO: Do we want to extend support of this constant
' folding to non-literal expressions?
Return New CapturedConstantExpression(expression.ConstantValueOpt,
expression.Type.InternalSubstituteTypeParameters(typeMap).Type)
Case BoundKind.Local
Return CaptureLocalSymbol(typeMap, DirectCast(expression, BoundLocal).LocalSymbol, initializers)
Case BoundKind.Parameter
Return CaptureParameterSymbol(typeMap, DirectCast(expression, BoundParameter).ParameterSymbol)
Case BoundKind.MeReference
Return CaptureParameterSymbol(typeMap, Me.Method.MeParameter)
Case BoundKind.MyClassReference
Return CaptureParameterSymbol(typeMap, Me.Method.MeParameter)
Case BoundKind.MyBaseReference
Return CaptureParameterSymbol(typeMap, Me.Method.MeParameter)
Case BoundKind.FieldAccess
If Not expression.IsLValue Then
GoTo lCaptureRValue
End If
Dim fieldAccess = DirectCast(expression, BoundFieldAccess)
Return New CapturedFieldAccessExpression(CaptureExpression(typeMap, fieldAccess.ReceiverOpt, initializers), fieldAccess.FieldSymbol)
Case BoundKind.ArrayAccess
If Not expression.IsLValue Then
GoTo lCaptureRValue
End If
Dim arrayAccess = DirectCast(expression, BoundArrayAccess)
Dim capturedArrayPointer As CapturedSymbolOrExpression =
CaptureExpression(typeMap, arrayAccess.Expression, initializers)
Dim indices As ImmutableArray(Of BoundExpression) = arrayAccess.Indices
Dim indicesCount As Integer = indices.Length
Dim capturedIndices(indicesCount - 1) As CapturedSymbolOrExpression
For i = 0 To indicesCount - 1
capturedIndices(i) = CaptureExpression(typeMap, indices(i), initializers)
Next
Return New CapturedArrayAccessExpression(capturedArrayPointer, capturedIndices.AsImmutableOrNull)
Case Else
lCaptureRValue:
Debug.Assert(Not expression.IsLValue, "Need to support LValues of type " + expression.GetType.Name)
Me._lastExpressionCaptureNumber += 1
Return New CapturedRValueExpression(
Me.F.StateMachineField(
expression.Type,
Me.Method,
GeneratedNameConstants.StateMachineExpressionCapturePrefix & Me._lastExpressionCaptureNumber,
Accessibility.Friend),
expression)
End Select
Throw ExceptionUtilities.UnexpectedValue(expression.Kind)
End Function
Protected Overrides Sub InitializeParameterWithProxy(parameter As ParameterSymbol, proxy As CapturedSymbolOrExpression, stateMachineVariable As LocalSymbol, initializers As ArrayBuilder(Of BoundExpression))
Debug.Assert(TypeOf proxy Is CapturedParameterSymbol)
Dim field As FieldSymbol = DirectCast(proxy, CapturedParameterSymbol).Field
Dim frameType As NamedTypeSymbol = If(Me.Method.IsGenericMethod,
Me.StateMachineType.Construct(Me.Method.TypeArguments),
Me.StateMachineType)
Dim expression As BoundExpression = If(parameter.IsMe,
DirectCast(Me.F.[Me](), BoundExpression),
Me.F.Parameter(parameter).MakeRValue())
initializers.Add(
Me.F.AssignmentExpression(
Me.F.Field(
Me.F.Local(stateMachineVariable, True),
field.AsMember(frameType),
True),
expression))
End Sub
Protected Overrides Function CreateByValLocalCapture(field As FieldSymbol, local As LocalSymbol) As CapturedSymbolOrExpression
Return New CapturedLocalSymbol(field, local)
End Function
Protected Overrides Function CreateParameterCapture(field As FieldSymbol, parameter As ParameterSymbol) As CapturedSymbolOrExpression
Return New CapturedParameterSymbol(field)
End Function
#Region "Method call and property access generation"
Private Function GenerateMethodCall(receiver As BoundExpression,
type As TypeSymbol,
methodName As String,
ParamArray arguments As BoundExpression()) As BoundExpression
Return GenerateMethodCall(receiver, type, methodName, ImmutableArray(Of TypeSymbol).Empty, arguments)
End Function
Private Function GenerateMethodCall(receiver As BoundExpression,
type As TypeSymbol,
methodName As String,
typeArgs As ImmutableArray(Of TypeSymbol),
ParamArray arguments As BoundExpression()) As BoundExpression
' Get the method group
Dim methodGroup = FindMethodAndReturnMethodGroup(receiver, type, methodName, typeArgs)
If methodGroup Is Nothing OrElse
arguments.Any(Function(a) a.HasErrors) OrElse
(receiver IsNot Nothing AndAlso receiver.HasErrors) Then
Return Me.F.BadExpression(arguments)
End If
' Do overload resolution and bind an invocation of the method.
Dim result = _binder.BindInvocationExpression(Me.F.Syntax,
Me.F.Syntax,
TypeCharacter.None,
methodGroup,
ImmutableArray.Create(Of BoundExpression)(arguments),
argumentNames:=Nothing,
diagnostics:=Me.Diagnostics,
callerInfoOpt:=Nothing)
Return result
End Function
Private Function FindMethodAndReturnMethodGroup(receiver As BoundExpression,
type As TypeSymbol,
methodName As String,
typeArgs As ImmutableArray(Of TypeSymbol)) As BoundMethodGroup
Dim group As BoundMethodGroup = Nothing
Dim result = LookupResult.GetInstance()
Dim useSiteInfo = Me._binder.GetNewCompoundUseSiteInfo(Me.Diagnostics)
Me._binder.LookupMember(result, type, methodName, arity:=0, options:=_lookupOptions, useSiteInfo:=useSiteInfo)
Me.Diagnostics.Add(Me.F.Syntax, useSiteInfo)
If result.IsGood Then
Debug.Assert(result.Symbols.Count > 0)
Dim symbol0 = result.Symbols(0)
If result.Symbols(0).Kind = SymbolKind.Method Then
group = New BoundMethodGroup(Me.F.Syntax,
Me.F.TypeArguments(typeArgs),
result.Symbols.ToDowncastedImmutable(Of MethodSymbol),
result.Kind,
receiver,
QualificationKind.QualifiedViaValue)
End If
End If
If group Is Nothing Then
Me.Diagnostics.Add(If(result.HasDiagnostic,
result.Diagnostic,
ErrorFactory.ErrorInfo(ERRID.ERR_NameNotMember2, methodName, type)),
Me.F.Syntax.GetLocation())
End If
result.Free()
Return group
End Function
Private Function GeneratePropertyGet(receiver As BoundExpression, type As TypeSymbol, propertyName As String) As BoundExpression
' Get the property group
Dim propertyGroup = FindPropertyAndReturnPropertyGroup(receiver, type, propertyName)
If propertyGroup Is Nothing OrElse (receiver IsNot Nothing AndAlso receiver.HasErrors) Then
Return Me.F.BadExpression()
End If
' Do overload resolution and bind an invocation of the property.
Dim result = _binder.BindInvocationExpression(Me.F.Syntax,
Me.F.Syntax,
TypeCharacter.None,
propertyGroup,
Nothing,
argumentNames:=Nothing,
diagnostics:=Me.Diagnostics,
callerInfoOpt:=Nothing)
' reclassify property access as Get
If result.Kind = BoundKind.PropertyAccess Then
result = DirectCast(result, BoundPropertyAccess).SetAccessKind(PropertyAccessKind.Get)
End If
Debug.Assert(Not result.IsLValue)
Return result
End Function
Private Function FindPropertyAndReturnPropertyGroup(receiver As BoundExpression, type As TypeSymbol, propertyName As String) As BoundPropertyGroup
Dim group As BoundPropertyGroup = Nothing
Dim result = LookupResult.GetInstance()
Dim useSiteInfo = Me._binder.GetNewCompoundUseSiteInfo(Me.Diagnostics)
Me._binder.LookupMember(result, type, propertyName, arity:=0, options:=_lookupOptions, useSiteInfo:=useSiteInfo)
Me.Diagnostics.Add(Me.F.Syntax, useSiteInfo)
If result.IsGood Then
Debug.Assert(result.Symbols.Count > 0)
Dim symbol0 = result.Symbols(0)
If result.Symbols(0).Kind = SymbolKind.Property Then
group = New BoundPropertyGroup(Me.F.Syntax,
result.Symbols.ToDowncastedImmutable(Of PropertySymbol),
result.Kind,
receiver,
QualificationKind.QualifiedViaValue)
End If
End If
If group Is Nothing Then
Me.Diagnostics.Add(If(result.HasDiagnostic,
result.Diagnostic,
ErrorFactory.ErrorInfo(ERRID.ERR_NameNotMember2, propertyName, type)),
Me.F.Syntax.GetLocation())
End If
result.Free()
Return group
End Function
#End Region
End Class
End Namespace
| ' 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.
Imports System.Collections.Generic
Imports System.Collections.Immutable
Imports System.Runtime.InteropServices
Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.CodeGen
Imports Microsoft.CodeAnalysis.PooledObjects
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic
Partial Friend NotInheritable Class AsyncRewriter
Inherits StateMachineRewriter(Of CapturedSymbolOrExpression)
Private ReadOnly _binder As Binder
Private ReadOnly _lookupOptions As LookupOptions
Private ReadOnly _asyncMethodKind As AsyncMethodKind
Private ReadOnly _builderType As NamedTypeSymbol
Private ReadOnly _resultType As TypeSymbol
Private _builderField As FieldSymbol
Private _lastExpressionCaptureNumber As Integer
Public Sub New(body As BoundStatement,
method As MethodSymbol,
stateMachineType As AsyncStateMachine,
slotAllocatorOpt As VariableSlotAllocator,
asyncKind As AsyncMethodKind,
compilationState As TypeCompilationState,
diagnostics As BindingDiagnosticBag)
MyBase.New(body, method, stateMachineType, slotAllocatorOpt, compilationState, diagnostics)
Me._binder = CreateMethodBinder(method)
Me._lookupOptions = LookupOptions.AllMethodsOfAnyArity Or LookupOptions.IgnoreExtensionMethods Or LookupOptions.NoBaseClassLookup
If compilationState.ModuleBuilderOpt.IgnoreAccessibility Then
Me._binder = New IgnoreAccessibilityBinder(Me._binder)
Me._lookupOptions = Me._lookupOptions Or LookupOptions.IgnoreAccessibility
End If
Debug.Assert(asyncKind <> AsyncMethodKind.None)
Debug.Assert(asyncKind = GetAsyncMethodKind(method))
Me._asyncMethodKind = asyncKind
Select Case Me._asyncMethodKind
Case AsyncMethodKind.Sub
Me._resultType = Me.F.SpecialType(SpecialType.System_Void)
Me._builderType = Me.F.WellKnownType(WellKnownType.System_Runtime_CompilerServices_AsyncVoidMethodBuilder)
Case AsyncMethodKind.TaskFunction
Me._resultType = Me.F.SpecialType(SpecialType.System_Void)
Me._builderType = Me.F.WellKnownType(WellKnownType.System_Runtime_CompilerServices_AsyncTaskMethodBuilder)
Case AsyncMethodKind.GenericTaskFunction
Me._resultType = DirectCast(Me.Method.ReturnType, NamedTypeSymbol).TypeArgumentsNoUseSiteDiagnostics().Single().InternalSubstituteTypeParameters(Me.TypeMap).Type
Me._builderType = Me.F.WellKnownType(WellKnownType.System_Runtime_CompilerServices_AsyncTaskMethodBuilder_T).Construct(Me._resultType)
Case Else
Throw ExceptionUtilities.UnexpectedValue(Me._asyncMethodKind)
End Select
End Sub
''' <summary>
''' Rewrite an async method into a state machine class.
''' </summary>
Friend Overloads Shared Function Rewrite(body As BoundBlock,
method As MethodSymbol,
methodOrdinal As Integer,
slotAllocatorOpt As VariableSlotAllocator,
compilationState As TypeCompilationState,
diagnostics As BindingDiagnosticBag,
<Out> ByRef stateMachineType As AsyncStateMachine) As BoundBlock
If body.HasErrors Then
Return body
End If
Dim asyncMethodKind As AsyncMethodKind = GetAsyncMethodKind(method)
If asyncMethodKind = AsyncMethodKind.None Then
Return body
End If
' The CLR doesn't support adding fields to structs, so in order to enable EnC in an async method we need to generate a class.
Dim kind = If(compilationState.Compilation.Options.EnableEditAndContinue, TypeKind.Class, TypeKind.Struct)
stateMachineType = New AsyncStateMachine(slotAllocatorOpt, compilationState, method, methodOrdinal, kind)
compilationState.ModuleBuilderOpt.CompilationState.SetStateMachineType(method, stateMachineType)
Dim rewriter As New AsyncRewriter(body, method, stateMachineType, slotAllocatorOpt, asyncMethodKind, compilationState, diagnostics)
' check if we have all the types we need
If rewriter.EnsureAllSymbolsAndSignature() Then
Return body
End If
Return rewriter.Rewrite()
End Function
Private Shared Function CreateMethodBinder(method As MethodSymbol) As Binder
' For source method symbol create a binder
Dim sourceMethod = TryCast(method, SourceMethodSymbol)
If sourceMethod IsNot Nothing Then
Return BinderBuilder.CreateBinderForMethodBody(DirectCast(sourceMethod.ContainingModule, SourceModuleSymbol),
sourceMethod.ContainingType.Locations(0).PossiblyEmbeddedOrMySourceTree(),
sourceMethod)
End If
' For all other symbols we assume that it should be a synthesized method
' placed inside source named type or in one of its nested types
Debug.Assert((TypeOf method Is SynthesizedLambdaMethod) OrElse (TypeOf method Is SynthesizedInteractiveInitializerMethod))
Dim containingType As NamedTypeSymbol = method.ContainingType
While containingType IsNot Nothing
Dim syntaxTree = containingType.Locations.FirstOrDefault()?.SourceTree
If syntaxTree IsNot Nothing Then
Return BinderBuilder.CreateBinderForType(
DirectCast(containingType.ContainingModule, SourceModuleSymbol),
syntaxTree,
containingType)
End If
containingType = containingType.ContainingType
End While
Throw ExceptionUtilities.Unreachable
End Function
Protected Overrides Sub GenerateControlFields()
' The fields are initialized from async method, so they need to be public:
Me.StateField = Me.F.StateMachineField(Me.F.SpecialType(SpecialType.System_Int32), Me.Method, GeneratedNames.MakeStateMachineStateFieldName(), Accessibility.Public)
Me._builderField = Me.F.StateMachineField(Me._builderType, Me.Method, GeneratedNames.MakeStateMachineBuilderFieldName(), Accessibility.Public)
End Sub
Protected Overrides Sub InitializeStateMachine(bodyBuilder As ArrayBuilder(Of BoundStatement), frameType As NamedTypeSymbol, stateMachineLocal As LocalSymbol)
If frameType.TypeKind = TypeKind.Class Then
' Dim stateMachineLocal = new AsyncImplementationClass()
bodyBuilder.Add(
Me.F.Assignment(
Me.F.Local(stateMachineLocal, True),
Me.F.[New](StateMachineType.Constructor.AsMember(frameType))))
Else
' STAT: localStateMachine = Nothing ' Initialization
bodyBuilder.Add(
Me.F.Assignment(
Me.F.Local(stateMachineLocal, True),
Me.F.Null(stateMachineLocal.Type)))
End If
End Sub
Protected Overrides ReadOnly Property PreserveInitialParameterValues As Boolean
Get
Return False
End Get
End Property
Friend Overrides ReadOnly Property TypeMap As TypeSubstitution
Get
Return Me.StateMachineType.TypeSubstitution
End Get
End Property
Protected Overrides Sub GenerateMethodImplementations()
' Add IAsyncStateMachine.MoveNext()
GenerateMoveNext(
Me.OpenMoveNextMethodImplementation(
WellKnownMember.System_Runtime_CompilerServices_IAsyncStateMachine_MoveNext,
Accessibility.Friend))
'Add IAsyncStateMachine.SetStateMachine()
Me.OpenMethodImplementation(
WellKnownMember.System_Runtime_CompilerServices_IAsyncStateMachine_SetStateMachine,
"System.Runtime.CompilerServices.IAsyncStateMachine.SetStateMachine",
Accessibility.Private,
hasMethodBodyDependency:=False)
' SetStateMachine is used to initialize the underlying AsyncMethodBuilder's reference to the boxed copy of the state machine.
' If the state machine is a class there is no copy made and thus the initialization is not necessary.
' In fact it is an error to reinitialize the builder since it already is initialized.
If Me.F.CurrentType.TypeKind = TypeKind.Class Then
Me.F.CloseMethod(F.Return())
Else
Me.CloseMethod(
Me.F.Block(
Me.F.ExpressionStatement(
Me.GenerateMethodCall(
Me.F.Field(Me.F.Me(), Me._builderField, False),
Me._builderType,
"SetStateMachine",
{Me.F.Parameter(Me.F.CurrentMethod.Parameters(0))})),
Me.F.Return()))
End If
' Constructor
If StateMachineType.TypeKind = TypeKind.Class Then
Me.F.CurrentMethod = StateMachineType.Constructor
Me.F.CloseMethod(F.Block(ImmutableArray.Create(F.BaseInitialization(), F.Return())))
End If
End Sub
Protected Overrides Function GenerateStateMachineCreation(stateMachineVariable As LocalSymbol, frameType As NamedTypeSymbol) As BoundStatement
Dim bodyBuilder = ArrayBuilder(Of BoundStatement).GetInstance()
' STAT: localStateMachine.$stateField = NotStartedStateMachine
Dim stateFieldAsLValue As BoundExpression =
Me.F.Field(
Me.F.Local(stateMachineVariable, True),
Me.StateField.AsMember(frameType), True)
bodyBuilder.Add(
Me.F.Assignment(
stateFieldAsLValue,
Me.F.Literal(StateMachineStates.NotStartedStateMachine)))
' STAT: localStateMachine.$builder = System.Runtime.CompilerServices.AsyncTaskMethodBuilder(Of typeArgs).Create()
Dim constructedBuilderField As FieldSymbol = Me._builderField.AsMember(frameType)
Dim builderFieldAsLValue As BoundExpression = Me.F.Field(Me.F.Local(stateMachineVariable, True), constructedBuilderField, True)
' All properties and methods will be searched in this type
Dim builderType As TypeSymbol = constructedBuilderField.Type
bodyBuilder.Add(
Me.F.Assignment(
builderFieldAsLValue,
Me.GenerateMethodCall(Nothing, builderType, "Create")))
' STAT: localStateMachine.$builder.Start(ref localStateMachine) -- binding to the method AsyncTaskMethodBuilder<typeArgs>.Start(...)
bodyBuilder.Add(
Me.F.ExpressionStatement(
Me.GenerateMethodCall(
builderFieldAsLValue,
builderType,
"Start",
ImmutableArray.Create(Of TypeSymbol)(frameType),
Me.F.Local(stateMachineVariable, True))))
' STAT: Return
' or
' STAT: Return localStateMachine.$builder.Task
bodyBuilder.Add(
If(Me._asyncMethodKind = AsyncMethodKind.[Sub],
Me.F.Return(),
Me.F.Return(Me.GeneratePropertyGet(builderFieldAsLValue, builderType, "Task"))))
Return RewriteBodyIfNeeded(Me.F.Block(ImmutableArray(Of LocalSymbol).Empty, bodyBuilder.ToImmutableAndFree()), Me.F.TopLevelMethod, Me.Method)
End Function
Private Sub GenerateMoveNext(moveNextMethod As MethodSymbol)
Dim rewriter = New AsyncMethodToClassRewriter(method:=Me.Method,
F:=Me.F,
state:=Me.StateField,
builder:=Me._builderField,
hoistedVariables:=Me.hoistedVariables,
nonReusableLocalProxies:=Me.nonReusableLocalProxies,
synthesizedLocalOrdinals:=Me.SynthesizedLocalOrdinals,
slotAllocatorOpt:=Me.SlotAllocatorOpt,
nextFreeHoistedLocalSlot:=Me.nextFreeHoistedLocalSlot,
owner:=Me,
diagnostics:=Diagnostics)
rewriter.GenerateMoveNext(Me.Body, moveNextMethod)
End Sub
Friend Overrides Function RewriteBodyIfNeeded(body As BoundStatement, topMethod As MethodSymbol, currentMethod As MethodSymbol) As BoundStatement
If body.HasErrors Then
Return body
End If
Dim rewrittenNodes As HashSet(Of BoundNode) = Nothing
Dim hasLambdas As Boolean = False
Dim symbolsCapturedWithoutCtor As ISet(Of Symbol) = Nothing
If body.Kind <> BoundKind.Block Then
body = Me.F.Block(body)
End If
Const rewritingFlags As LocalRewriter.RewritingFlags =
LocalRewriter.RewritingFlags.AllowSequencePoints Or
LocalRewriter.RewritingFlags.AllowEndOfMethodReturnWithExpression Or
LocalRewriter.RewritingFlags.AllowCatchWithErrorLineNumberReference
Return LocalRewriter.Rewrite(DirectCast(body, BoundBlock),
topMethod,
F.CompilationState,
previousSubmissionFields:=Nothing,
diagnostics:=Me.Diagnostics,
rewrittenNodes:=rewrittenNodes,
hasLambdas:=hasLambdas,
symbolsCapturedWithoutCopyCtor:=symbolsCapturedWithoutCtor,
flags:=rewritingFlags,
instrumenterOpt:=Nothing, ' Do not instrument anything during this rewrite
currentMethod:=currentMethod)
End Function
''' <returns>
''' Returns true if any members that we need are missing or have use-site errors.
''' </returns>
Friend Overrides Function EnsureAllSymbolsAndSignature() As Boolean
If MyBase.EnsureAllSymbolsAndSignature Then
Return True
End If
Dim bag = BindingDiagnosticBag.GetInstance(withDiagnostics:=True, withDependencies:=Me.Diagnostics.AccumulatesDependencies)
EnsureSpecialType(SpecialType.System_Object, bag)
EnsureSpecialType(SpecialType.System_Void, bag)
EnsureSpecialType(SpecialType.System_ValueType, bag)
EnsureWellKnownType(WellKnownType.System_Runtime_CompilerServices_IAsyncStateMachine, bag)
EnsureWellKnownMember(WellKnownMember.System_Runtime_CompilerServices_IAsyncStateMachine_MoveNext, bag)
EnsureWellKnownMember(WellKnownMember.System_Runtime_CompilerServices_IAsyncStateMachine_SetStateMachine, bag)
' We don't ensure those types because we don't know if they will be actually used,
' use-site errors will be reported later if any of those types is actually requested
'
' EnsureSpecialType(SpecialType.System_Boolean, hasErrors)
' EnsureWellKnownType(WellKnownType.System_Runtime_CompilerServices_ICriticalNotifyCompletion, hasErrors)
' EnsureWellKnownType(WellKnownType.System_Runtime_CompilerServices_INotifyCompletion, hasErrors)
' NOTE: We don't ensure DebuggerStepThroughAttribute, it is just not emitted if not found
' EnsureWellKnownMember(Of MethodSymbol)(WellKnownMember.System_Diagnostics_DebuggerStepThroughAttribute__ctor, hasErrors)
Select Case Me._asyncMethodKind
Case AsyncMethodKind.GenericTaskFunction
EnsureWellKnownType(WellKnownType.System_Runtime_CompilerServices_AsyncTaskMethodBuilder_T, bag)
Case AsyncMethodKind.TaskFunction
EnsureWellKnownType(WellKnownType.System_Runtime_CompilerServices_AsyncTaskMethodBuilder, bag)
Case AsyncMethodKind.[Sub]
EnsureWellKnownType(WellKnownType.System_Runtime_CompilerServices_AsyncVoidMethodBuilder, bag)
Case Else
Throw ExceptionUtilities.UnexpectedValue(Me._asyncMethodKind)
End Select
Dim hasErrors As Boolean = bag.HasAnyErrors
If hasErrors Then
Me.Diagnostics.AddRange(bag)
End If
bag.Free()
Return hasErrors
End Function
''' <summary>
''' Specifies a kind of an Async method
'''
''' None is returned for non-Async methods or methods with wrong return type
''' </summary>
Friend Enum AsyncMethodKind
None
[Sub]
TaskFunction
GenericTaskFunction
End Enum
''' <summary>
''' Returns method's async kind
''' </summary>
Friend Shared Function GetAsyncMethodKind(method As MethodSymbol) As AsyncMethodKind
Debug.Assert(Not method.IsPartial)
If Not method.IsAsync Then
Return AsyncMethodKind.None
End If
If method.IsSub Then
Return AsyncMethodKind.[Sub]
End If
Dim compilation As VisualBasicCompilation = method.DeclaringCompilation
Debug.Assert(compilation IsNot Nothing)
Dim returnType As TypeSymbol = method.ReturnType
If TypeSymbol.Equals(returnType, compilation.GetWellKnownType(WellKnownType.System_Threading_Tasks_Task), TypeCompareKind.ConsiderEverything) Then
Return AsyncMethodKind.TaskFunction
End If
If returnType.Kind = SymbolKind.NamedType AndAlso
TypeSymbol.Equals(returnType.OriginalDefinition, compilation.GetWellKnownType(WellKnownType.System_Threading_Tasks_Task_T), TypeCompareKind.ConsiderEverything) Then
Return AsyncMethodKind.GenericTaskFunction
End If
' Wrong return type
Return AsyncMethodKind.None
End Function
Protected Overrides Function CreateByRefLocalCapture(typeMap As TypeSubstitution,
local As LocalSymbol,
initializers As Dictionary(Of LocalSymbol, BoundExpression)) As CapturedSymbolOrExpression
Debug.Assert(local.IsByRef)
Return CaptureExpression(typeMap, initializers(local), initializers)
End Function
Private Function CaptureExpression(typeMap As TypeSubstitution,
expression As BoundExpression,
initializers As Dictionary(Of LocalSymbol, BoundExpression)) As CapturedSymbolOrExpression
If expression Is Nothing Then
Return Nothing
End If
Select Case expression.Kind
Case BoundKind.Literal
Debug.Assert(Not expression.IsLValue)
' TODO: Do we want to extend support of this constant
' folding to non-literal expressions?
Return New CapturedConstantExpression(expression.ConstantValueOpt,
expression.Type.InternalSubstituteTypeParameters(typeMap).Type)
Case BoundKind.Local
Return CaptureLocalSymbol(typeMap, DirectCast(expression, BoundLocal).LocalSymbol, initializers)
Case BoundKind.Parameter
Return CaptureParameterSymbol(typeMap, DirectCast(expression, BoundParameter).ParameterSymbol)
Case BoundKind.MeReference
Return CaptureParameterSymbol(typeMap, Me.Method.MeParameter)
Case BoundKind.MyClassReference
Return CaptureParameterSymbol(typeMap, Me.Method.MeParameter)
Case BoundKind.MyBaseReference
Return CaptureParameterSymbol(typeMap, Me.Method.MeParameter)
Case BoundKind.FieldAccess
If Not expression.IsLValue Then
GoTo lCaptureRValue
End If
Dim fieldAccess = DirectCast(expression, BoundFieldAccess)
Return New CapturedFieldAccessExpression(CaptureExpression(typeMap, fieldAccess.ReceiverOpt, initializers), fieldAccess.FieldSymbol)
Case BoundKind.ArrayAccess
If Not expression.IsLValue Then
GoTo lCaptureRValue
End If
Dim arrayAccess = DirectCast(expression, BoundArrayAccess)
Dim capturedArrayPointer As CapturedSymbolOrExpression =
CaptureExpression(typeMap, arrayAccess.Expression, initializers)
Dim indices As ImmutableArray(Of BoundExpression) = arrayAccess.Indices
Dim indicesCount As Integer = indices.Length
Dim capturedIndices(indicesCount - 1) As CapturedSymbolOrExpression
For i = 0 To indicesCount - 1
capturedIndices(i) = CaptureExpression(typeMap, indices(i), initializers)
Next
Return New CapturedArrayAccessExpression(capturedArrayPointer, capturedIndices.AsImmutableOrNull)
Case Else
lCaptureRValue:
Debug.Assert(Not expression.IsLValue, "Need to support LValues of type " + expression.GetType.Name)
Me._lastExpressionCaptureNumber += 1
Return New CapturedRValueExpression(
Me.F.StateMachineField(
expression.Type,
Me.Method,
GeneratedNameConstants.StateMachineExpressionCapturePrefix & Me._lastExpressionCaptureNumber,
Accessibility.Friend),
expression)
End Select
Throw ExceptionUtilities.UnexpectedValue(expression.Kind)
End Function
Protected Overrides Sub InitializeParameterWithProxy(parameter As ParameterSymbol, proxy As CapturedSymbolOrExpression, stateMachineVariable As LocalSymbol, initializers As ArrayBuilder(Of BoundExpression))
Debug.Assert(TypeOf proxy Is CapturedParameterSymbol)
Dim field As FieldSymbol = DirectCast(proxy, CapturedParameterSymbol).Field
Dim frameType As NamedTypeSymbol = If(Me.Method.IsGenericMethod,
Me.StateMachineType.Construct(Me.Method.TypeArguments),
Me.StateMachineType)
Dim expression As BoundExpression = If(parameter.IsMe,
DirectCast(Me.F.[Me](), BoundExpression),
Me.F.Parameter(parameter).MakeRValue())
initializers.Add(
Me.F.AssignmentExpression(
Me.F.Field(
Me.F.Local(stateMachineVariable, True),
field.AsMember(frameType),
True),
expression))
End Sub
Protected Overrides Function CreateByValLocalCapture(field As FieldSymbol, local As LocalSymbol) As CapturedSymbolOrExpression
Return New CapturedLocalSymbol(field, local)
End Function
Protected Overrides Function CreateParameterCapture(field As FieldSymbol, parameter As ParameterSymbol) As CapturedSymbolOrExpression
Return New CapturedParameterSymbol(field)
End Function
#Region "Method call and property access generation"
Private Function GenerateMethodCall(receiver As BoundExpression,
type As TypeSymbol,
methodName As String,
ParamArray arguments As BoundExpression()) As BoundExpression
Return GenerateMethodCall(receiver, type, methodName, ImmutableArray(Of TypeSymbol).Empty, arguments)
End Function
Private Function GenerateMethodCall(receiver As BoundExpression,
type As TypeSymbol,
methodName As String,
typeArgs As ImmutableArray(Of TypeSymbol),
ParamArray arguments As BoundExpression()) As BoundExpression
' Get the method group
Dim methodGroup = FindMethodAndReturnMethodGroup(receiver, type, methodName, typeArgs)
If methodGroup Is Nothing OrElse
arguments.Any(Function(a) a.HasErrors) OrElse
(receiver IsNot Nothing AndAlso receiver.HasErrors) Then
Return Me.F.BadExpression(arguments)
End If
' Do overload resolution and bind an invocation of the method.
Dim result = _binder.BindInvocationExpression(Me.F.Syntax,
Me.F.Syntax,
TypeCharacter.None,
methodGroup,
ImmutableArray.Create(Of BoundExpression)(arguments),
argumentNames:=Nothing,
diagnostics:=Me.Diagnostics,
callerInfoOpt:=Nothing)
Return result
End Function
Private Function FindMethodAndReturnMethodGroup(receiver As BoundExpression,
type As TypeSymbol,
methodName As String,
typeArgs As ImmutableArray(Of TypeSymbol)) As BoundMethodGroup
Dim group As BoundMethodGroup = Nothing
Dim result = LookupResult.GetInstance()
Dim useSiteInfo = Me._binder.GetNewCompoundUseSiteInfo(Me.Diagnostics)
Me._binder.LookupMember(result, type, methodName, arity:=0, options:=_lookupOptions, useSiteInfo:=useSiteInfo)
Me.Diagnostics.Add(Me.F.Syntax, useSiteInfo)
If result.IsGood Then
Debug.Assert(result.Symbols.Count > 0)
Dim symbol0 = result.Symbols(0)
If result.Symbols(0).Kind = SymbolKind.Method Then
group = New BoundMethodGroup(Me.F.Syntax,
Me.F.TypeArguments(typeArgs),
result.Symbols.ToDowncastedImmutable(Of MethodSymbol),
result.Kind,
receiver,
QualificationKind.QualifiedViaValue)
End If
End If
If group Is Nothing Then
Me.Diagnostics.Add(If(result.HasDiagnostic,
result.Diagnostic,
ErrorFactory.ErrorInfo(ERRID.ERR_NameNotMember2, methodName, type)),
Me.F.Syntax.GetLocation())
End If
result.Free()
Return group
End Function
Private Function GeneratePropertyGet(receiver As BoundExpression, type As TypeSymbol, propertyName As String) As BoundExpression
' Get the property group
Dim propertyGroup = FindPropertyAndReturnPropertyGroup(receiver, type, propertyName)
If propertyGroup Is Nothing OrElse (receiver IsNot Nothing AndAlso receiver.HasErrors) Then
Return Me.F.BadExpression()
End If
' Do overload resolution and bind an invocation of the property.
Dim result = _binder.BindInvocationExpression(Me.F.Syntax,
Me.F.Syntax,
TypeCharacter.None,
propertyGroup,
Nothing,
argumentNames:=Nothing,
diagnostics:=Me.Diagnostics,
callerInfoOpt:=Nothing)
' reclassify property access as Get
If result.Kind = BoundKind.PropertyAccess Then
result = DirectCast(result, BoundPropertyAccess).SetAccessKind(PropertyAccessKind.Get)
End If
Debug.Assert(Not result.IsLValue)
Return result
End Function
Private Function FindPropertyAndReturnPropertyGroup(receiver As BoundExpression, type As TypeSymbol, propertyName As String) As BoundPropertyGroup
Dim group As BoundPropertyGroup = Nothing
Dim result = LookupResult.GetInstance()
Dim useSiteInfo = Me._binder.GetNewCompoundUseSiteInfo(Me.Diagnostics)
Me._binder.LookupMember(result, type, propertyName, arity:=0, options:=_lookupOptions, useSiteInfo:=useSiteInfo)
Me.Diagnostics.Add(Me.F.Syntax, useSiteInfo)
If result.IsGood Then
Debug.Assert(result.Symbols.Count > 0)
Dim symbol0 = result.Symbols(0)
If result.Symbols(0).Kind = SymbolKind.Property Then
group = New BoundPropertyGroup(Me.F.Syntax,
result.Symbols.ToDowncastedImmutable(Of PropertySymbol),
result.Kind,
receiver,
QualificationKind.QualifiedViaValue)
End If
End If
If group Is Nothing Then
Me.Diagnostics.Add(If(result.HasDiagnostic,
result.Diagnostic,
ErrorFactory.ErrorInfo(ERRID.ERR_NameNotMember2, propertyName, type)),
Me.F.Syntax.GetLocation())
End If
result.Free()
Return group
End Function
#End Region
End Class
End Namespace
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Compilers/Core/Portable/MetadataReference/AssemblyMetadata.cs | // 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.Collections.Generic;
using System.Collections.Immutable;
using System.IO;
using System.Reflection.Metadata;
using System.Reflection.PortableExecutable;
using System.Threading;
using System.Diagnostics;
using Roslyn.Utilities;
using Microsoft.CodeAnalysis.Symbols;
namespace Microsoft.CodeAnalysis
{
/// <summary>
/// Represents an immutable snapshot of assembly CLI metadata.
/// </summary>
public sealed class AssemblyMetadata : Metadata
{
private sealed class Data
{
public static readonly Data Disposed = new Data();
public readonly ImmutableArray<ModuleMetadata> Modules;
public readonly PEAssembly? Assembly;
private Data()
{
}
public Data(ImmutableArray<ModuleMetadata> modules, PEAssembly assembly)
{
Debug.Assert(!modules.IsDefaultOrEmpty && assembly != null);
this.Modules = modules;
this.Assembly = assembly;
}
public bool IsDisposed
{
get { return Assembly == null; }
}
}
/// <summary>
/// Factory that provides the <see cref="ModuleMetadata"/> for additional modules (other than <see cref="_initialModules"/>) of the assembly.
/// Shall only throw <see cref="BadImageFormatException"/> or <see cref="IOException"/>.
/// Null of all modules were specified at construction time.
/// </summary>
private readonly Func<string, ModuleMetadata>? _moduleFactoryOpt;
/// <summary>
/// Modules the <see cref="AssemblyMetadata"/> was created with, in case they are eagerly allocated.
/// </summary>
private readonly ImmutableArray<ModuleMetadata> _initialModules;
// Encapsulates the modules and the corresponding PEAssembly produced by the modules factory.
private Data? _lazyData;
// The actual array of modules exposed via Modules property.
// The same modules as the ones produced by the factory or their copies.
private ImmutableArray<ModuleMetadata> _lazyPublishedModules;
/// <summary>
/// Cached assembly symbols.
/// </summary>
/// <remarks>
/// Guarded by <see cref="CommonReferenceManager.SymbolCacheAndReferenceManagerStateGuard"/>.
/// </remarks>
internal readonly WeakList<IAssemblySymbolInternal> CachedSymbols = new WeakList<IAssemblySymbolInternal>();
// creates a copy
private AssemblyMetadata(AssemblyMetadata other, bool shareCachedSymbols)
: base(isImageOwner: false, id: other.Id)
{
if (shareCachedSymbols)
{
this.CachedSymbols = other.CachedSymbols;
}
_lazyData = other._lazyData;
_moduleFactoryOpt = other._moduleFactoryOpt;
_initialModules = other._initialModules;
// Leave lazyPublishedModules unset. Published modules will be set and copied as needed.
}
internal AssemblyMetadata(ImmutableArray<ModuleMetadata> modules)
: base(isImageOwner: true, id: MetadataId.CreateNewId())
{
Debug.Assert(!modules.IsDefaultOrEmpty);
_initialModules = modules;
}
internal AssemblyMetadata(ModuleMetadata manifestModule, Func<string, ModuleMetadata> moduleFactory)
: base(isImageOwner: true, id: MetadataId.CreateNewId())
{
Debug.Assert(manifestModule != null);
Debug.Assert(moduleFactory != null);
_initialModules = ImmutableArray.Create(manifestModule);
_moduleFactoryOpt = moduleFactory;
}
/// <summary>
/// Creates a single-module assembly.
/// </summary>
/// <param name="peImage">
/// Manifest module image.
/// </param>
/// <exception cref="ArgumentNullException"><paramref name="peImage"/> is null.</exception>
public static AssemblyMetadata CreateFromImage(ImmutableArray<byte> peImage)
{
return Create(ModuleMetadata.CreateFromImage(peImage));
}
/// <summary>
/// Creates a single-module assembly.
/// </summary>
/// <param name="peImage">
/// Manifest module image.
/// </param>
/// <exception cref="ArgumentNullException"><paramref name="peImage"/> is null.</exception>
/// <exception cref="BadImageFormatException">The PE image format is invalid.</exception>
public static AssemblyMetadata CreateFromImage(IEnumerable<byte> peImage)
{
return Create(ModuleMetadata.CreateFromImage(peImage));
}
/// <summary>
/// Creates a single-module assembly.
/// </summary>
/// <param name="peStream">Manifest module PE image stream.</param>
/// <param name="leaveOpen">False to close the stream upon disposal of the metadata.</param>
/// <exception cref="BadImageFormatException">The PE image format is invalid.</exception>
public static AssemblyMetadata CreateFromStream(Stream peStream, bool leaveOpen = false)
{
return Create(ModuleMetadata.CreateFromStream(peStream, leaveOpen));
}
/// <summary>
/// Creates a single-module assembly.
/// </summary>
/// <param name="peStream">Manifest module PE image stream.</param>
/// <param name="options">False to close the stream upon disposal of the metadata.</param>
/// <exception cref="BadImageFormatException">The PE image format is invalid.</exception>
public static AssemblyMetadata CreateFromStream(Stream peStream, PEStreamOptions options)
{
return Create(ModuleMetadata.CreateFromStream(peStream, options));
}
/// <summary>
/// Finds all modules of an assembly on a specified path and builds an instance of <see cref="AssemblyMetadata"/> that represents them.
/// </summary>
/// <param name="path">The full path to the assembly on disk.</param>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
/// <exception cref="ArgumentException"><paramref name="path"/> is invalid.</exception>
/// <exception cref="IOException">Error reading file <paramref name="path"/>. See <see cref="Exception.InnerException"/> for details.</exception>
/// <exception cref="NotSupportedException">Reading from a file path is not supported by the platform.</exception>
public static AssemblyMetadata CreateFromFile(string path)
{
return CreateFromFile(ModuleMetadata.CreateFromFile(path), path);
}
internal static AssemblyMetadata CreateFromFile(ModuleMetadata manifestModule, string path)
{
return new AssemblyMetadata(manifestModule, moduleName => ModuleMetadata.CreateFromFile(Path.Combine(Path.GetDirectoryName(path) ?? "", moduleName)));
}
/// <summary>
/// Creates a single-module assembly.
/// </summary>
/// <param name="module">
/// Manifest module.
/// </param>
/// <remarks>This object disposes <paramref name="module"/> it when it is itself disposed.</remarks>
public static AssemblyMetadata Create(ModuleMetadata module)
{
if (module == null)
{
throw new ArgumentNullException(nameof(module));
}
return new AssemblyMetadata(ImmutableArray.Create(module));
}
/// <summary>
/// Creates a multi-module assembly.
/// </summary>
/// <param name="modules">
/// Modules comprising the assembly. The first module is the manifest module of the assembly.</param>
/// <remarks>This object disposes the elements of <paramref name="modules"/> it when it is itself <see cref="Dispose"/>.</remarks>
/// <exception cref="ArgumentException"><paramref name="modules"/> is default value.</exception>
/// <exception cref="ArgumentNullException"><paramref name="modules"/> contains null elements.</exception>
/// <exception cref="ArgumentException"><paramref name="modules"/> is empty or contains a module that doesn't own its image (was created via <see cref="Metadata.Copy"/>).</exception>
public static AssemblyMetadata Create(ImmutableArray<ModuleMetadata> modules)
{
if (modules.IsDefaultOrEmpty)
{
throw new ArgumentException(CodeAnalysisResources.AssemblyMustHaveAtLeastOneModule, nameof(modules));
}
for (int i = 0; i < modules.Length; i++)
{
if (modules[i] == null)
{
throw new ArgumentNullException(nameof(modules) + "[" + i + "]");
}
if (!modules[i].IsImageOwner)
{
throw new ArgumentException(CodeAnalysisResources.ModuleCopyCannotBeUsedToCreateAssemblyMetadata, nameof(modules) + "[" + i + "]");
}
}
return new AssemblyMetadata(modules);
}
/// <summary>
/// Creates a multi-module assembly.
/// </summary>
/// <param name="modules">
/// Modules comprising the assembly. The first module is the manifest module of the assembly.</param>
/// <remarks>This object disposes the elements of <paramref name="modules"/> it when it is itself <see cref="Dispose"/>.</remarks>
/// <exception cref="ArgumentException"><paramref name="modules"/> is default value.</exception>
/// <exception cref="ArgumentNullException"><paramref name="modules"/> contains null elements.</exception>
/// <exception cref="ArgumentException"><paramref name="modules"/> is empty or contains a module that doesn't own its image (was created via <see cref="Metadata.Copy"/>).</exception>
public static AssemblyMetadata Create(IEnumerable<ModuleMetadata> modules)
{
return Create(modules.AsImmutableOrNull());
}
/// <summary>
/// Creates a multi-module assembly.
/// </summary>
/// <param name="modules">Modules comprising the assembly. The first module is the manifest module of the assembly.</param>
/// <remarks>This object disposes the elements of <paramref name="modules"/> it when it is itself <see cref="Dispose"/>.</remarks>
/// <exception cref="ArgumentException"><paramref name="modules"/> is default value.</exception>
/// <exception cref="ArgumentNullException"><paramref name="modules"/> contains null elements.</exception>
/// <exception cref="ArgumentException"><paramref name="modules"/> is empty or contains a module that doesn't own its image (was created via <see cref="Metadata.Copy"/>).</exception>
public static AssemblyMetadata Create(params ModuleMetadata[] modules)
{
return Create(ImmutableArray.CreateRange(modules));
}
/// <summary>
/// Creates a shallow copy of contained modules and wraps them into a new instance of <see cref="AssemblyMetadata"/>.
/// </summary>
/// <remarks>
/// The resulting copy shares the metadata images and metadata information read from them with the original.
/// It doesn't own the underlying metadata images and is not responsible for its disposal.
///
/// This is used, for example, when a metadata cache needs to return the cached metadata to its users
/// while keeping the ownership of the cached metadata object.
/// </remarks>
internal new AssemblyMetadata Copy()
{
return new AssemblyMetadata(this, shareCachedSymbols: true);
}
internal AssemblyMetadata CopyWithoutSharingCachedSymbols()
{
return new AssemblyMetadata(this, shareCachedSymbols: false);
}
protected override Metadata CommonCopy()
{
return Copy();
}
/// <summary>
/// Modules comprising this assembly. The first module is the manifest module.
/// </summary>
/// <exception cref="BadImageFormatException">The PE image format is invalid.</exception>
/// <exception cref="IOException">IO error reading the metadata. See <see cref="Exception.InnerException"/> for details.</exception>
/// <exception cref="ObjectDisposedException">The object has been disposed.</exception>
public ImmutableArray<ModuleMetadata> GetModules()
{
if (_lazyPublishedModules.IsDefault)
{
var data = GetOrCreateData();
var newModules = data.Modules;
if (!IsImageOwner)
{
newModules = newModules.SelectAsArray(module => module.Copy());
}
ImmutableInterlocked.InterlockedInitialize(ref _lazyPublishedModules, newModules);
}
if (_lazyData == Data.Disposed)
{
throw new ObjectDisposedException(nameof(AssemblyMetadata));
}
return _lazyPublishedModules;
}
/// <exception cref="BadImageFormatException">The PE image format is invalid.</exception>
/// <exception cref="IOException">IO error while reading the metadata. See <see cref="Exception.InnerException"/> for details.</exception>
/// <exception cref="ObjectDisposedException">The object has been disposed.</exception>
internal PEAssembly? GetAssembly()
{
return GetOrCreateData().Assembly;
}
/// <exception cref="BadImageFormatException">The PE image format is invalid.</exception>
/// <exception cref="IOException">IO error while reading the metadata. See <see cref="Exception.InnerException"/> for details.</exception>
/// <exception cref="ObjectDisposedException">The object has been disposed.</exception>
private Data GetOrCreateData()
{
if (_lazyData == null)
{
ImmutableArray<ModuleMetadata> modules = _initialModules;
ImmutableArray<ModuleMetadata>.Builder? moduleBuilder = null;
bool createdModulesUsed = false;
try
{
if (_moduleFactoryOpt != null)
{
Debug.Assert(_initialModules.Length == 1);
var additionalModuleNames = _initialModules[0].GetModuleNames();
if (additionalModuleNames.Length > 0)
{
moduleBuilder = ImmutableArray.CreateBuilder<ModuleMetadata>(1 + additionalModuleNames.Length);
moduleBuilder.Add(_initialModules[0]);
foreach (string moduleName in additionalModuleNames)
{
moduleBuilder.Add(_moduleFactoryOpt(moduleName));
}
modules = moduleBuilder.ToImmutable();
}
}
var assembly = new PEAssembly(this, modules.SelectAsArray(m => m.Module));
var newData = new Data(modules, assembly);
createdModulesUsed = Interlocked.CompareExchange(ref _lazyData, newData, null) == null;
}
finally
{
if (moduleBuilder != null && !createdModulesUsed)
{
// dispose unused modules created above:
for (int i = _initialModules.Length; i < moduleBuilder.Count; i++)
{
moduleBuilder[i].Dispose();
}
}
}
}
if (_lazyData.IsDisposed)
{
throw new ObjectDisposedException(nameof(AssemblyMetadata));
}
return _lazyData;
}
/// <summary>
/// Disposes all modules contained in the assembly.
/// </summary>
public override void Dispose()
{
var previousData = Interlocked.Exchange(ref _lazyData, Data.Disposed);
if (previousData == Data.Disposed || !this.IsImageOwner)
{
// already disposed, or not an owner
return;
}
// AssemblyMetadata assumes their ownership of all modules passed to the constructor.
foreach (var module in _initialModules)
{
module.Dispose();
}
if (previousData == null)
{
// no additional modules were created yet => nothing to dispose
return;
}
Debug.Assert(_initialModules.Length == 1 || _initialModules.Length == previousData.Modules.Length);
// dispose additional modules created lazily:
for (int i = _initialModules.Length; i < previousData.Modules.Length; i++)
{
previousData.Modules[i].Dispose();
}
}
/// <summary>
/// Checks if the first module has a single row in Assembly table and that all other modules have none.
/// </summary>
/// <exception cref="BadImageFormatException">The PE image format is invalid.</exception>
/// <exception cref="IOException">IO error reading the metadata. See <see cref="Exception.InnerException"/> for details.</exception>
/// <exception cref="ObjectDisposedException">The object has been disposed.</exception>
internal bool IsValidAssembly()
{
var modules = GetModules();
if (!modules[0].Module.IsManifestModule)
{
return false;
}
for (int i = 1; i < modules.Length; i++)
{
// Ignore winmd modules since runtime winmd modules may be loaded as non-primary modules.
var module = modules[i].Module;
if (!module.IsLinkedModule && module.MetadataReader.MetadataKind != MetadataKind.WindowsMetadata)
{
return false;
}
}
return true;
}
/// <summary>
/// Returns the metadata kind. <seealso cref="MetadataImageKind"/>
/// </summary>
public override MetadataImageKind Kind
{
get { return MetadataImageKind.Assembly; }
}
/// <summary>
/// Creates a reference to the assembly metadata.
/// </summary>
/// <param name="documentation">Provider of XML documentation comments for the metadata symbols contained in the module.</param>
/// <param name="aliases">Aliases that can be used to refer to the assembly from source code (see "extern alias" directive in C#).</param>
/// <param name="embedInteropTypes">True to embed interop types from the referenced assembly to the referencing compilation. Must be false for a module.</param>
/// <param name="filePath">Path describing the location of the metadata, or null if the metadata have no location.</param>
/// <param name="display">Display string used in error messages to identity the reference.</param>
/// <returns>A reference to the assembly metadata.</returns>
public PortableExecutableReference GetReference(
DocumentationProvider? documentation = null,
ImmutableArray<string> aliases = default,
bool embedInteropTypes = false,
string? filePath = null,
string? display = null)
{
return new MetadataImageReference(this, new MetadataReferenceProperties(MetadataImageKind.Assembly, aliases, embedInteropTypes), documentation, filePath, display);
}
}
}
| // 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.Collections.Generic;
using System.Collections.Immutable;
using System.IO;
using System.Reflection.Metadata;
using System.Reflection.PortableExecutable;
using System.Threading;
using System.Diagnostics;
using Roslyn.Utilities;
using Microsoft.CodeAnalysis.Symbols;
namespace Microsoft.CodeAnalysis
{
/// <summary>
/// Represents an immutable snapshot of assembly CLI metadata.
/// </summary>
public sealed class AssemblyMetadata : Metadata
{
private sealed class Data
{
public static readonly Data Disposed = new Data();
public readonly ImmutableArray<ModuleMetadata> Modules;
public readonly PEAssembly? Assembly;
private Data()
{
}
public Data(ImmutableArray<ModuleMetadata> modules, PEAssembly assembly)
{
Debug.Assert(!modules.IsDefaultOrEmpty && assembly != null);
this.Modules = modules;
this.Assembly = assembly;
}
public bool IsDisposed
{
get { return Assembly == null; }
}
}
/// <summary>
/// Factory that provides the <see cref="ModuleMetadata"/> for additional modules (other than <see cref="_initialModules"/>) of the assembly.
/// Shall only throw <see cref="BadImageFormatException"/> or <see cref="IOException"/>.
/// Null of all modules were specified at construction time.
/// </summary>
private readonly Func<string, ModuleMetadata>? _moduleFactoryOpt;
/// <summary>
/// Modules the <see cref="AssemblyMetadata"/> was created with, in case they are eagerly allocated.
/// </summary>
private readonly ImmutableArray<ModuleMetadata> _initialModules;
// Encapsulates the modules and the corresponding PEAssembly produced by the modules factory.
private Data? _lazyData;
// The actual array of modules exposed via Modules property.
// The same modules as the ones produced by the factory or their copies.
private ImmutableArray<ModuleMetadata> _lazyPublishedModules;
/// <summary>
/// Cached assembly symbols.
/// </summary>
/// <remarks>
/// Guarded by <see cref="CommonReferenceManager.SymbolCacheAndReferenceManagerStateGuard"/>.
/// </remarks>
internal readonly WeakList<IAssemblySymbolInternal> CachedSymbols = new WeakList<IAssemblySymbolInternal>();
// creates a copy
private AssemblyMetadata(AssemblyMetadata other, bool shareCachedSymbols)
: base(isImageOwner: false, id: other.Id)
{
if (shareCachedSymbols)
{
this.CachedSymbols = other.CachedSymbols;
}
_lazyData = other._lazyData;
_moduleFactoryOpt = other._moduleFactoryOpt;
_initialModules = other._initialModules;
// Leave lazyPublishedModules unset. Published modules will be set and copied as needed.
}
internal AssemblyMetadata(ImmutableArray<ModuleMetadata> modules)
: base(isImageOwner: true, id: MetadataId.CreateNewId())
{
Debug.Assert(!modules.IsDefaultOrEmpty);
_initialModules = modules;
}
internal AssemblyMetadata(ModuleMetadata manifestModule, Func<string, ModuleMetadata> moduleFactory)
: base(isImageOwner: true, id: MetadataId.CreateNewId())
{
Debug.Assert(manifestModule != null);
Debug.Assert(moduleFactory != null);
_initialModules = ImmutableArray.Create(manifestModule);
_moduleFactoryOpt = moduleFactory;
}
/// <summary>
/// Creates a single-module assembly.
/// </summary>
/// <param name="peImage">
/// Manifest module image.
/// </param>
/// <exception cref="ArgumentNullException"><paramref name="peImage"/> is null.</exception>
public static AssemblyMetadata CreateFromImage(ImmutableArray<byte> peImage)
{
return Create(ModuleMetadata.CreateFromImage(peImage));
}
/// <summary>
/// Creates a single-module assembly.
/// </summary>
/// <param name="peImage">
/// Manifest module image.
/// </param>
/// <exception cref="ArgumentNullException"><paramref name="peImage"/> is null.</exception>
/// <exception cref="BadImageFormatException">The PE image format is invalid.</exception>
public static AssemblyMetadata CreateFromImage(IEnumerable<byte> peImage)
{
return Create(ModuleMetadata.CreateFromImage(peImage));
}
/// <summary>
/// Creates a single-module assembly.
/// </summary>
/// <param name="peStream">Manifest module PE image stream.</param>
/// <param name="leaveOpen">False to close the stream upon disposal of the metadata.</param>
/// <exception cref="BadImageFormatException">The PE image format is invalid.</exception>
public static AssemblyMetadata CreateFromStream(Stream peStream, bool leaveOpen = false)
{
return Create(ModuleMetadata.CreateFromStream(peStream, leaveOpen));
}
/// <summary>
/// Creates a single-module assembly.
/// </summary>
/// <param name="peStream">Manifest module PE image stream.</param>
/// <param name="options">False to close the stream upon disposal of the metadata.</param>
/// <exception cref="BadImageFormatException">The PE image format is invalid.</exception>
public static AssemblyMetadata CreateFromStream(Stream peStream, PEStreamOptions options)
{
return Create(ModuleMetadata.CreateFromStream(peStream, options));
}
/// <summary>
/// Finds all modules of an assembly on a specified path and builds an instance of <see cref="AssemblyMetadata"/> that represents them.
/// </summary>
/// <param name="path">The full path to the assembly on disk.</param>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
/// <exception cref="ArgumentException"><paramref name="path"/> is invalid.</exception>
/// <exception cref="IOException">Error reading file <paramref name="path"/>. See <see cref="Exception.InnerException"/> for details.</exception>
/// <exception cref="NotSupportedException">Reading from a file path is not supported by the platform.</exception>
public static AssemblyMetadata CreateFromFile(string path)
{
return CreateFromFile(ModuleMetadata.CreateFromFile(path), path);
}
internal static AssemblyMetadata CreateFromFile(ModuleMetadata manifestModule, string path)
{
return new AssemblyMetadata(manifestModule, moduleName => ModuleMetadata.CreateFromFile(Path.Combine(Path.GetDirectoryName(path) ?? "", moduleName)));
}
/// <summary>
/// Creates a single-module assembly.
/// </summary>
/// <param name="module">
/// Manifest module.
/// </param>
/// <remarks>This object disposes <paramref name="module"/> it when it is itself disposed.</remarks>
public static AssemblyMetadata Create(ModuleMetadata module)
{
if (module == null)
{
throw new ArgumentNullException(nameof(module));
}
return new AssemblyMetadata(ImmutableArray.Create(module));
}
/// <summary>
/// Creates a multi-module assembly.
/// </summary>
/// <param name="modules">
/// Modules comprising the assembly. The first module is the manifest module of the assembly.</param>
/// <remarks>This object disposes the elements of <paramref name="modules"/> it when it is itself <see cref="Dispose"/>.</remarks>
/// <exception cref="ArgumentException"><paramref name="modules"/> is default value.</exception>
/// <exception cref="ArgumentNullException"><paramref name="modules"/> contains null elements.</exception>
/// <exception cref="ArgumentException"><paramref name="modules"/> is empty or contains a module that doesn't own its image (was created via <see cref="Metadata.Copy"/>).</exception>
public static AssemblyMetadata Create(ImmutableArray<ModuleMetadata> modules)
{
if (modules.IsDefaultOrEmpty)
{
throw new ArgumentException(CodeAnalysisResources.AssemblyMustHaveAtLeastOneModule, nameof(modules));
}
for (int i = 0; i < modules.Length; i++)
{
if (modules[i] == null)
{
throw new ArgumentNullException(nameof(modules) + "[" + i + "]");
}
if (!modules[i].IsImageOwner)
{
throw new ArgumentException(CodeAnalysisResources.ModuleCopyCannotBeUsedToCreateAssemblyMetadata, nameof(modules) + "[" + i + "]");
}
}
return new AssemblyMetadata(modules);
}
/// <summary>
/// Creates a multi-module assembly.
/// </summary>
/// <param name="modules">
/// Modules comprising the assembly. The first module is the manifest module of the assembly.</param>
/// <remarks>This object disposes the elements of <paramref name="modules"/> it when it is itself <see cref="Dispose"/>.</remarks>
/// <exception cref="ArgumentException"><paramref name="modules"/> is default value.</exception>
/// <exception cref="ArgumentNullException"><paramref name="modules"/> contains null elements.</exception>
/// <exception cref="ArgumentException"><paramref name="modules"/> is empty or contains a module that doesn't own its image (was created via <see cref="Metadata.Copy"/>).</exception>
public static AssemblyMetadata Create(IEnumerable<ModuleMetadata> modules)
{
return Create(modules.AsImmutableOrNull());
}
/// <summary>
/// Creates a multi-module assembly.
/// </summary>
/// <param name="modules">Modules comprising the assembly. The first module is the manifest module of the assembly.</param>
/// <remarks>This object disposes the elements of <paramref name="modules"/> it when it is itself <see cref="Dispose"/>.</remarks>
/// <exception cref="ArgumentException"><paramref name="modules"/> is default value.</exception>
/// <exception cref="ArgumentNullException"><paramref name="modules"/> contains null elements.</exception>
/// <exception cref="ArgumentException"><paramref name="modules"/> is empty or contains a module that doesn't own its image (was created via <see cref="Metadata.Copy"/>).</exception>
public static AssemblyMetadata Create(params ModuleMetadata[] modules)
{
return Create(ImmutableArray.CreateRange(modules));
}
/// <summary>
/// Creates a shallow copy of contained modules and wraps them into a new instance of <see cref="AssemblyMetadata"/>.
/// </summary>
/// <remarks>
/// The resulting copy shares the metadata images and metadata information read from them with the original.
/// It doesn't own the underlying metadata images and is not responsible for its disposal.
///
/// This is used, for example, when a metadata cache needs to return the cached metadata to its users
/// while keeping the ownership of the cached metadata object.
/// </remarks>
internal new AssemblyMetadata Copy()
{
return new AssemblyMetadata(this, shareCachedSymbols: true);
}
internal AssemblyMetadata CopyWithoutSharingCachedSymbols()
{
return new AssemblyMetadata(this, shareCachedSymbols: false);
}
protected override Metadata CommonCopy()
{
return Copy();
}
/// <summary>
/// Modules comprising this assembly. The first module is the manifest module.
/// </summary>
/// <exception cref="BadImageFormatException">The PE image format is invalid.</exception>
/// <exception cref="IOException">IO error reading the metadata. See <see cref="Exception.InnerException"/> for details.</exception>
/// <exception cref="ObjectDisposedException">The object has been disposed.</exception>
public ImmutableArray<ModuleMetadata> GetModules()
{
if (_lazyPublishedModules.IsDefault)
{
var data = GetOrCreateData();
var newModules = data.Modules;
if (!IsImageOwner)
{
newModules = newModules.SelectAsArray(module => module.Copy());
}
ImmutableInterlocked.InterlockedInitialize(ref _lazyPublishedModules, newModules);
}
if (_lazyData == Data.Disposed)
{
throw new ObjectDisposedException(nameof(AssemblyMetadata));
}
return _lazyPublishedModules;
}
/// <exception cref="BadImageFormatException">The PE image format is invalid.</exception>
/// <exception cref="IOException">IO error while reading the metadata. See <see cref="Exception.InnerException"/> for details.</exception>
/// <exception cref="ObjectDisposedException">The object has been disposed.</exception>
internal PEAssembly? GetAssembly()
{
return GetOrCreateData().Assembly;
}
/// <exception cref="BadImageFormatException">The PE image format is invalid.</exception>
/// <exception cref="IOException">IO error while reading the metadata. See <see cref="Exception.InnerException"/> for details.</exception>
/// <exception cref="ObjectDisposedException">The object has been disposed.</exception>
private Data GetOrCreateData()
{
if (_lazyData == null)
{
ImmutableArray<ModuleMetadata> modules = _initialModules;
ImmutableArray<ModuleMetadata>.Builder? moduleBuilder = null;
bool createdModulesUsed = false;
try
{
if (_moduleFactoryOpt != null)
{
Debug.Assert(_initialModules.Length == 1);
var additionalModuleNames = _initialModules[0].GetModuleNames();
if (additionalModuleNames.Length > 0)
{
moduleBuilder = ImmutableArray.CreateBuilder<ModuleMetadata>(1 + additionalModuleNames.Length);
moduleBuilder.Add(_initialModules[0]);
foreach (string moduleName in additionalModuleNames)
{
moduleBuilder.Add(_moduleFactoryOpt(moduleName));
}
modules = moduleBuilder.ToImmutable();
}
}
var assembly = new PEAssembly(this, modules.SelectAsArray(m => m.Module));
var newData = new Data(modules, assembly);
createdModulesUsed = Interlocked.CompareExchange(ref _lazyData, newData, null) == null;
}
finally
{
if (moduleBuilder != null && !createdModulesUsed)
{
// dispose unused modules created above:
for (int i = _initialModules.Length; i < moduleBuilder.Count; i++)
{
moduleBuilder[i].Dispose();
}
}
}
}
if (_lazyData.IsDisposed)
{
throw new ObjectDisposedException(nameof(AssemblyMetadata));
}
return _lazyData;
}
/// <summary>
/// Disposes all modules contained in the assembly.
/// </summary>
public override void Dispose()
{
var previousData = Interlocked.Exchange(ref _lazyData, Data.Disposed);
if (previousData == Data.Disposed || !this.IsImageOwner)
{
// already disposed, or not an owner
return;
}
// AssemblyMetadata assumes their ownership of all modules passed to the constructor.
foreach (var module in _initialModules)
{
module.Dispose();
}
if (previousData == null)
{
// no additional modules were created yet => nothing to dispose
return;
}
Debug.Assert(_initialModules.Length == 1 || _initialModules.Length == previousData.Modules.Length);
// dispose additional modules created lazily:
for (int i = _initialModules.Length; i < previousData.Modules.Length; i++)
{
previousData.Modules[i].Dispose();
}
}
/// <summary>
/// Checks if the first module has a single row in Assembly table and that all other modules have none.
/// </summary>
/// <exception cref="BadImageFormatException">The PE image format is invalid.</exception>
/// <exception cref="IOException">IO error reading the metadata. See <see cref="Exception.InnerException"/> for details.</exception>
/// <exception cref="ObjectDisposedException">The object has been disposed.</exception>
internal bool IsValidAssembly()
{
var modules = GetModules();
if (!modules[0].Module.IsManifestModule)
{
return false;
}
for (int i = 1; i < modules.Length; i++)
{
// Ignore winmd modules since runtime winmd modules may be loaded as non-primary modules.
var module = modules[i].Module;
if (!module.IsLinkedModule && module.MetadataReader.MetadataKind != MetadataKind.WindowsMetadata)
{
return false;
}
}
return true;
}
/// <summary>
/// Returns the metadata kind. <seealso cref="MetadataImageKind"/>
/// </summary>
public override MetadataImageKind Kind
{
get { return MetadataImageKind.Assembly; }
}
/// <summary>
/// Creates a reference to the assembly metadata.
/// </summary>
/// <param name="documentation">Provider of XML documentation comments for the metadata symbols contained in the module.</param>
/// <param name="aliases">Aliases that can be used to refer to the assembly from source code (see "extern alias" directive in C#).</param>
/// <param name="embedInteropTypes">True to embed interop types from the referenced assembly to the referencing compilation. Must be false for a module.</param>
/// <param name="filePath">Path describing the location of the metadata, or null if the metadata have no location.</param>
/// <param name="display">Display string used in error messages to identity the reference.</param>
/// <returns>A reference to the assembly metadata.</returns>
public PortableExecutableReference GetReference(
DocumentationProvider? documentation = null,
ImmutableArray<string> aliases = default,
bool embedInteropTypes = false,
string? filePath = null,
string? display = null)
{
return new MetadataImageReference(this, new MetadataReferenceProperties(MetadataImageKind.Assembly, aliases, embedInteropTypes), documentation, filePath, display);
}
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/VisualStudio/Core/Def/Implementation/Log/LoggerOptions.cs | // 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.
#nullable disable
using System;
using System.Collections.Immutable;
using System.Composition;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Options.Providers;
namespace Microsoft.VisualStudio.LanguageServices.Implementation
{
internal static class LoggerOptions
{
private const string LocalRegistryPath = @"Roslyn\Internal\Performance\Logger\";
public static readonly Option<bool> EtwLoggerKey = new(nameof(LoggerOptions), nameof(EtwLoggerKey), defaultValue: true,
storageLocations: new LocalUserProfileStorageLocation(LocalRegistryPath + "EtwLogger"));
public static readonly Option<bool> TraceLoggerKey = new(nameof(LoggerOptions), nameof(TraceLoggerKey), defaultValue: false,
storageLocations: new LocalUserProfileStorageLocation(LocalRegistryPath + "TraceLogger"));
public static readonly Option<bool> OutputWindowLoggerKey = new(nameof(LoggerOptions), nameof(OutputWindowLoggerKey), defaultValue: false,
storageLocations: new LocalUserProfileStorageLocation(LocalRegistryPath + "OutputWindowLogger"));
}
[ExportOptionProvider, Shared]
internal class LoggerOptionsProvider : IOptionProvider
{
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public LoggerOptionsProvider()
{
}
public ImmutableArray<IOption> Options { get; } = ImmutableArray.Create<IOption>(
LoggerOptions.EtwLoggerKey,
LoggerOptions.TraceLoggerKey,
LoggerOptions.OutputWindowLoggerKey);
}
}
| // 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.
#nullable disable
using System;
using System.Collections.Immutable;
using System.Composition;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Options.Providers;
namespace Microsoft.VisualStudio.LanguageServices.Implementation
{
internal static class LoggerOptions
{
private const string LocalRegistryPath = @"Roslyn\Internal\Performance\Logger\";
public static readonly Option<bool> EtwLoggerKey = new(nameof(LoggerOptions), nameof(EtwLoggerKey), defaultValue: true,
storageLocations: new LocalUserProfileStorageLocation(LocalRegistryPath + "EtwLogger"));
public static readonly Option<bool> TraceLoggerKey = new(nameof(LoggerOptions), nameof(TraceLoggerKey), defaultValue: false,
storageLocations: new LocalUserProfileStorageLocation(LocalRegistryPath + "TraceLogger"));
public static readonly Option<bool> OutputWindowLoggerKey = new(nameof(LoggerOptions), nameof(OutputWindowLoggerKey), defaultValue: false,
storageLocations: new LocalUserProfileStorageLocation(LocalRegistryPath + "OutputWindowLogger"));
}
[ExportOptionProvider, Shared]
internal class LoggerOptionsProvider : IOptionProvider
{
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public LoggerOptionsProvider()
{
}
public ImmutableArray<IOption> Options { get; } = ImmutableArray.Create<IOption>(
LoggerOptions.EtwLoggerKey,
LoggerOptions.TraceLoggerKey,
LoggerOptions.OutputWindowLoggerKey);
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Scripting/Core/Hosting/AssemblyLoader/DesktopAssemblyLoaderImpl.cs | // 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.
#nullable disable
using System;
using System.IO;
using System.Reflection;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Scripting.Hosting
{
internal sealed class DesktopAssemblyLoaderImpl : AssemblyLoaderImpl
{
private readonly Func<string, Assembly, Assembly> _assemblyResolveHandlerOpt;
public DesktopAssemblyLoaderImpl(InteractiveAssemblyLoader loader)
: base(loader)
{
_assemblyResolveHandlerOpt = loader.ResolveAssembly;
CoreLightup.Desktop.AddAssemblyResolveHandler(_assemblyResolveHandlerOpt);
}
public override void Dispose()
{
if (_assemblyResolveHandlerOpt != null)
{
CoreLightup.Desktop.RemoveAssemblyResolveHandler(_assemblyResolveHandlerOpt);
}
}
public override Assembly LoadFromStream(Stream peStream, Stream pdbStream)
{
byte[] peImage = new byte[peStream.Length];
peStream.TryReadAll(peImage, 0, peImage.Length);
if (pdbStream != null)
{
byte[] pdbImage = new byte[pdbStream.Length];
pdbStream.TryReadAll(pdbImage, 0, pdbImage.Length);
return Assembly.Load(peImage, pdbImage);
}
return Assembly.Load(peImage);
}
public override AssemblyAndLocation LoadFromPath(string path)
{
// An assembly is loaded into CLR's Load Context if it is in the GAC, otherwise it's loaded into No Context via Assembly.LoadFile(string).
// Assembly.LoadFile(string) automatically redirects to GAC if the assembly has a strong name and there is an equivalent assembly in GAC.
var assembly = Assembly.LoadFile(path);
var location = assembly.Location;
var fromGac = CoreLightup.Desktop.IsAssemblyFromGlobalAssemblyCache(assembly);
return new AssemblyAndLocation(assembly, location, fromGac);
}
}
}
| // 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.
#nullable disable
using System;
using System.IO;
using System.Reflection;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Scripting.Hosting
{
internal sealed class DesktopAssemblyLoaderImpl : AssemblyLoaderImpl
{
private readonly Func<string, Assembly, Assembly> _assemblyResolveHandlerOpt;
public DesktopAssemblyLoaderImpl(InteractiveAssemblyLoader loader)
: base(loader)
{
_assemblyResolveHandlerOpt = loader.ResolveAssembly;
CoreLightup.Desktop.AddAssemblyResolveHandler(_assemblyResolveHandlerOpt);
}
public override void Dispose()
{
if (_assemblyResolveHandlerOpt != null)
{
CoreLightup.Desktop.RemoveAssemblyResolveHandler(_assemblyResolveHandlerOpt);
}
}
public override Assembly LoadFromStream(Stream peStream, Stream pdbStream)
{
byte[] peImage = new byte[peStream.Length];
peStream.TryReadAll(peImage, 0, peImage.Length);
if (pdbStream != null)
{
byte[] pdbImage = new byte[pdbStream.Length];
pdbStream.TryReadAll(pdbImage, 0, pdbImage.Length);
return Assembly.Load(peImage, pdbImage);
}
return Assembly.Load(peImage);
}
public override AssemblyAndLocation LoadFromPath(string path)
{
// An assembly is loaded into CLR's Load Context if it is in the GAC, otherwise it's loaded into No Context via Assembly.LoadFile(string).
// Assembly.LoadFile(string) automatically redirects to GAC if the assembly has a strong name and there is an equivalent assembly in GAC.
var assembly = Assembly.LoadFile(path);
var location = assembly.Location;
var fromGac = CoreLightup.Desktop.IsAssemblyFromGlobalAssemblyCache(assembly);
return new AssemblyAndLocation(assembly, location, fromGac);
}
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Setup/Installer/Installer.Package.csproj | <!-- 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. -->
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="vswhere" Version="$(vswhereVersion)" />
<PackageReference Include="RoslynTools.VSIXExpInstaller" Version="$(RoslynToolsVSIXExpInstallerVersion)" />
<ProjectReference Include="..\..\Deployment\RoslynDeployment.csproj"/>
</ItemGroup>
<Target Name="_CalculateInputsOutputs">
<PropertyGroup>
<_InstallerDir>$(VisualStudioSetupOutputPath)Installer\</_InstallerDir>
<_InstallerFilePath>$(_InstallerDir)Roslyn_Preview.zip</_InstallerFilePath>
<_ZipDir>$(IntermediateOutputPath)Zip\</_ZipDir>
<_DeploymentVsixPath>$(VisualStudioSetupOutputPath)RoslynDeployment.vsix</_DeploymentVsixPath>
</PropertyGroup>
</Target>
<Target Name="_GenerateZip"
AfterTargets="Pack"
DependsOnTargets="_CalculateInputsOutputs;ResolveProjectReferences"
Inputs="$(MSBuildAllProjects);$(_DeploymentVsixPath)"
Outputs="$(_InstallerFilePath)"
Condition="'$(DotNetBuildFromSource)' != 'true' and '$(MSBuildRuntimeType)' != 'Core'">
<ItemGroup>
<_Files Include="$(MSBuildProjectDirectory)\tools\*.*" TargetDir="tools"/>
<_Files Include="$(MSBuildProjectDirectory)\scripts\*.*" TargetDir=""/>
<_Files Include="$(NuGetPackageRoot)vswhere\$(vswhereVersion)\tools\*.*" TargetDir="tools\vswhere"/>
<_Files Include="$(NuGetPackageRoot)roslyntools.vsixexpinstaller\$(RoslynToolsVSIXExpInstallerVersion)\tools\*.*" TargetDir="tools\vsixexpinstaller"/>
<_Files Include="$(_DeploymentVsixPath)" TargetDir="vsix"/>
</ItemGroup>
<RemoveDir Directories="$(_ZipDir)" />
<Copy SourceFiles="%(_Files.Identity)" DestinationFolder="$(_ZipDir)%(_Files.TargetDir)" SkipUnchangedFiles="true" />
<MakeDir Directories="$(_InstallerDir)" />
<ZipDirectory SourceDirectory="$(_ZipDir)" DestinationFile="$(_InstallerFilePath)" Overwrite="true"/>
<ItemGroup>
<FileWrites Include="$(_InstallerFilePath)"/>
</ItemGroup>
</Target>
</Project>
| <!-- 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. -->
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="vswhere" Version="$(vswhereVersion)" />
<PackageReference Include="RoslynTools.VSIXExpInstaller" Version="$(RoslynToolsVSIXExpInstallerVersion)" />
<ProjectReference Include="..\..\Deployment\RoslynDeployment.csproj"/>
</ItemGroup>
<Target Name="_CalculateInputsOutputs">
<PropertyGroup>
<_InstallerDir>$(VisualStudioSetupOutputPath)Installer\</_InstallerDir>
<_InstallerFilePath>$(_InstallerDir)Roslyn_Preview.zip</_InstallerFilePath>
<_ZipDir>$(IntermediateOutputPath)Zip\</_ZipDir>
<_DeploymentVsixPath>$(VisualStudioSetupOutputPath)RoslynDeployment.vsix</_DeploymentVsixPath>
</PropertyGroup>
</Target>
<Target Name="_GenerateZip"
AfterTargets="Pack"
DependsOnTargets="_CalculateInputsOutputs;ResolveProjectReferences"
Inputs="$(MSBuildAllProjects);$(_DeploymentVsixPath)"
Outputs="$(_InstallerFilePath)"
Condition="'$(DotNetBuildFromSource)' != 'true' and '$(MSBuildRuntimeType)' != 'Core'">
<ItemGroup>
<_Files Include="$(MSBuildProjectDirectory)\tools\*.*" TargetDir="tools"/>
<_Files Include="$(MSBuildProjectDirectory)\scripts\*.*" TargetDir=""/>
<_Files Include="$(NuGetPackageRoot)vswhere\$(vswhereVersion)\tools\*.*" TargetDir="tools\vswhere"/>
<_Files Include="$(NuGetPackageRoot)roslyntools.vsixexpinstaller\$(RoslynToolsVSIXExpInstallerVersion)\tools\*.*" TargetDir="tools\vsixexpinstaller"/>
<_Files Include="$(_DeploymentVsixPath)" TargetDir="vsix"/>
</ItemGroup>
<RemoveDir Directories="$(_ZipDir)" />
<Copy SourceFiles="%(_Files.Identity)" DestinationFolder="$(_ZipDir)%(_Files.TargetDir)" SkipUnchangedFiles="true" />
<MakeDir Directories="$(_InstallerDir)" />
<ZipDirectory SourceDirectory="$(_ZipDir)" DestinationFile="$(_InstallerFilePath)" Overwrite="true"/>
<ItemGroup>
<FileWrites Include="$(_InstallerFilePath)"/>
</ItemGroup>
</Target>
</Project>
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Compilers/VisualBasic/Portable/BoundTree/BoundRangeVariable.vb | ' 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.
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic
Partial Friend Class BoundRangeVariable
Public Overrides ReadOnly Property ExpressionSymbol As Symbol
Get
Return Me.RangeVariable
End Get
End Property
End Class
End Namespace
| ' 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.
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic
Partial Friend Class BoundRangeVariable
Public Overrides ReadOnly Property ExpressionSymbol As Symbol
Get
Return Me.RangeVariable
End Get
End Property
End Class
End Namespace
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Compilers/Core/CodeAnalysisTest/Symbols/DocumentationCommentIdTests.cs | // 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.Collections.Generic;
using System.Linq;
using Microsoft.CodeAnalysis.CodeGen;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.Test.Utilities;
using Roslyn.Test.Utilities;
using Xunit;
using Xunit.Sdk;
namespace Microsoft.CodeAnalysis.UnitTests.Symbols
{
public class DocumentationCommentIdTests : CommonTestBase
{
private CSharpCompilation CreateCompilation(string code) =>
CreateCSharpCompilation(
code, referencedAssemblies: TargetFrameworkUtil.GetReferences(TargetFramework.NetStandard20));
[Fact]
public void TupleReturnMethod()
{
string code = @"
class C
{
(int i, int) DoStuff() => default;
}";
var comp = CreateCompilation(code);
comp.VerifyDiagnostics();
var symbol = comp.GetSymbolsWithName("DoStuff").Single();
var actualDocId = DocumentationCommentId.CreateDeclarationId(symbol);
string expectedDocId = "M:C.DoStuff~System.ValueTuple{System.Int32,System.Int32}";
Assert.Equal(expectedDocId, actualDocId);
var foundSymbols = DocumentationCommentId.GetSymbolsForDeclarationId(expectedDocId, comp);
Assert.Equal(new[] { symbol }, foundSymbols);
}
[Theory]
[InlineData(
"void DoStuff((int i, int) tuple) {}",
"M:C.DoStuff(System.ValueTuple{System.Int32,System.Int32})")]
[InlineData(
"void DoStuff((int, int, int, int, int, int, int, int, int) tuple) { }",
"M:C.DoStuff(System.ValueTuple{System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.ValueTuple{System.Int32,System.Int32}})")]
public void TupleParameterMethod(string methodCode, string expectedDocId)
{
string code = $@"
class C
{{
{methodCode}
}}";
var comp = CreateCompilation(code);
comp.VerifyDiagnostics();
var symbol = comp.GetSymbolsWithName("DoStuff").Single();
var actualDocId = DocumentationCommentId.CreateDeclarationId(symbol);
Assert.Equal(expectedDocId, actualDocId);
var foundSymbols = DocumentationCommentId.GetSymbolsForDeclarationId(expectedDocId, comp);
Assert.Equal(new[] { symbol }, foundSymbols);
}
[Fact]
public void DynamicParameterMethod()
{
string code = @"
class C
{
int DoStuff(dynamic dynamic) => 0;
}";
var comp = CreateCSharpCompilation(code);
var symbol = comp.GetSymbolsWithName("DoStuff").Single();
var actualDocId = DocumentationCommentId.CreateDeclarationId(symbol);
var expectedDocId = "M:C.DoStuff(System.Object)~System.Int32";
Assert.Equal(expectedDocId, actualDocId);
var foundSymbols = DocumentationCommentId.GetSymbolsForDeclarationId(expectedDocId, comp);
Assert.Equal(new[] { symbol }, foundSymbols);
}
[Fact]
public void NintParameterMethod()
{
string code = @"
class C
{
void DoStuff(nint nint) {}
}";
var comp = CreateCSharpCompilation(code);
var symbol = comp.GetSymbolsWithName("DoStuff").Single();
var actualDocId = DocumentationCommentId.CreateDeclarationId(symbol);
var expectedDocId = "M:C.DoStuff(System.IntPtr)";
Assert.Equal(expectedDocId, actualDocId);
var foundSymbols = DocumentationCommentId.GetSymbolsForDeclarationId(expectedDocId, comp);
Assert.Equal(new[] { symbol }, foundSymbols);
}
internal override string VisualizeRealIL(
IModuleSymbol peModule, CompilationTestData.MethodData methodData, IReadOnlyDictionary<int, string> markers, bool areLocalsZeroed)
=> throw new NotImplementedException();
}
}
| // 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.Collections.Generic;
using System.Linq;
using Microsoft.CodeAnalysis.CodeGen;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.Test.Utilities;
using Roslyn.Test.Utilities;
using Xunit;
using Xunit.Sdk;
namespace Microsoft.CodeAnalysis.UnitTests.Symbols
{
public class DocumentationCommentIdTests : CommonTestBase
{
private CSharpCompilation CreateCompilation(string code) =>
CreateCSharpCompilation(
code, referencedAssemblies: TargetFrameworkUtil.GetReferences(TargetFramework.NetStandard20));
[Fact]
public void TupleReturnMethod()
{
string code = @"
class C
{
(int i, int) DoStuff() => default;
}";
var comp = CreateCompilation(code);
comp.VerifyDiagnostics();
var symbol = comp.GetSymbolsWithName("DoStuff").Single();
var actualDocId = DocumentationCommentId.CreateDeclarationId(symbol);
string expectedDocId = "M:C.DoStuff~System.ValueTuple{System.Int32,System.Int32}";
Assert.Equal(expectedDocId, actualDocId);
var foundSymbols = DocumentationCommentId.GetSymbolsForDeclarationId(expectedDocId, comp);
Assert.Equal(new[] { symbol }, foundSymbols);
}
[Theory]
[InlineData(
"void DoStuff((int i, int) tuple) {}",
"M:C.DoStuff(System.ValueTuple{System.Int32,System.Int32})")]
[InlineData(
"void DoStuff((int, int, int, int, int, int, int, int, int) tuple) { }",
"M:C.DoStuff(System.ValueTuple{System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.ValueTuple{System.Int32,System.Int32}})")]
public void TupleParameterMethod(string methodCode, string expectedDocId)
{
string code = $@"
class C
{{
{methodCode}
}}";
var comp = CreateCompilation(code);
comp.VerifyDiagnostics();
var symbol = comp.GetSymbolsWithName("DoStuff").Single();
var actualDocId = DocumentationCommentId.CreateDeclarationId(symbol);
Assert.Equal(expectedDocId, actualDocId);
var foundSymbols = DocumentationCommentId.GetSymbolsForDeclarationId(expectedDocId, comp);
Assert.Equal(new[] { symbol }, foundSymbols);
}
[Fact]
public void DynamicParameterMethod()
{
string code = @"
class C
{
int DoStuff(dynamic dynamic) => 0;
}";
var comp = CreateCSharpCompilation(code);
var symbol = comp.GetSymbolsWithName("DoStuff").Single();
var actualDocId = DocumentationCommentId.CreateDeclarationId(symbol);
var expectedDocId = "M:C.DoStuff(System.Object)~System.Int32";
Assert.Equal(expectedDocId, actualDocId);
var foundSymbols = DocumentationCommentId.GetSymbolsForDeclarationId(expectedDocId, comp);
Assert.Equal(new[] { symbol }, foundSymbols);
}
[Fact]
public void NintParameterMethod()
{
string code = @"
class C
{
void DoStuff(nint nint) {}
}";
var comp = CreateCSharpCompilation(code);
var symbol = comp.GetSymbolsWithName("DoStuff").Single();
var actualDocId = DocumentationCommentId.CreateDeclarationId(symbol);
var expectedDocId = "M:C.DoStuff(System.IntPtr)";
Assert.Equal(expectedDocId, actualDocId);
var foundSymbols = DocumentationCommentId.GetSymbolsForDeclarationId(expectedDocId, comp);
Assert.Equal(new[] { symbol }, foundSymbols);
}
internal override string VisualizeRealIL(
IModuleSymbol peModule, CompilationTestData.MethodData methodData, IReadOnlyDictionary<int, string> markers, bool areLocalsZeroed)
=> throw new NotImplementedException();
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/EditorFeatures/CSharpTest2/Microsoft.CodeAnalysis.CSharp.EditorFeatures2.UnitTests.csproj | <?xml version="1.0" encoding="utf-8"?>
<!-- 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. -->
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<StartupObject />
<TargetFramework>net472</TargetFramework>
<UseWpf>true</UseWpf>
<OutputType>Library</OutputType>
<RootNamespace>Microsoft.CodeAnalysis.Editor.CSharp.UnitTests</RootNamespace>
</PropertyGroup>
<ItemGroup Label="Project References">
<ProjectReference Include="..\..\Compilers\Core\Portable\Microsoft.CodeAnalysis.csproj" />
<ProjectReference Include="..\..\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj" />
<ProjectReference Include="..\..\Compilers\Test\Utilities\CSharp\Microsoft.CodeAnalysis.CSharp.Test.Utilities.csproj" />
<ProjectReference Include="..\..\Features\LanguageServer\Protocol\Microsoft.CodeAnalysis.LanguageServer.Protocol.csproj" />
<ProjectReference Include="..\..\Interactive\Host\Microsoft.CodeAnalysis.InteractiveHost.csproj" />
<ProjectReference Include="..\..\Workspaces\Core\Portable\Microsoft.CodeAnalysis.Workspaces.csproj" />
<ProjectReference Include="..\..\Features\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.Features.csproj" />
<ProjectReference Include="..\..\Features\Core\Portable\Microsoft.CodeAnalysis.Features.csproj" />
<ProjectReference Include="..\..\EditorFeatures\Text\Microsoft.CodeAnalysis.EditorFeatures.Text.csproj" />
<ProjectReference Include="..\..\Workspaces\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.Workspaces.csproj" />
<ProjectReference Include="..\..\EditorFeatures\Core\Microsoft.CodeAnalysis.EditorFeatures.csproj" />
<ProjectReference Include="..\..\EditorFeatures\Core.Wpf\Microsoft.CodeAnalysis.EditorFeatures.Wpf.csproj" />
<ProjectReference Include="..\..\EditorFeatures\CSharp\Microsoft.CodeAnalysis.CSharp.EditorFeatures.csproj" />
<ProjectReference Include="..\..\Compilers\Test\Resources\Core\Microsoft.CodeAnalysis.Compiler.Test.Resources.csproj" />
<ProjectReference Include="..\DiagnosticsTestUtilities\Microsoft.CodeAnalysis.EditorFeatures.DiagnosticsTests.Utilities.csproj" />
<ProjectReference Include="..\TestUtilities\Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities.csproj" />
<ProjectReference Include="..\..\Compilers\VisualBasic\Portable\Microsoft.CodeAnalysis.VisualBasic.vbproj" />
<ProjectReference Include="..\VisualBasic\Microsoft.CodeAnalysis.VisualBasic.EditorFeatures.vbproj" />
<ProjectReference Include="..\..\Features\VisualBasic\Portable\Microsoft.CodeAnalysis.VisualBasic.Features.vbproj" />
<ProjectReference Include="..\..\Scripting\VisualBasic\Microsoft.CodeAnalysis.VisualBasic.Scripting.vbproj" />
<ProjectReference Include="..\..\Workspaces\VisualBasic\Portable\Microsoft.CodeAnalysis.VisualBasic.Workspaces.vbproj" />
<ProjectReference Include="..\..\Scripting\CSharp\Microsoft.CodeAnalysis.CSharp.Scripting.csproj" />
<ProjectReference Include="..\..\Test\PdbUtilities\Roslyn.Test.PdbUtilities.csproj" />
<ProjectReference Include="..\..\Workspaces\Remote\Core\Microsoft.CodeAnalysis.Remote.Workspaces.csproj" />
<ProjectReference Include="..\..\Scripting\Core\Microsoft.CodeAnalysis.Scripting.csproj" />
<ProjectReference Include="..\..\Workspaces\Remote\ServiceHub\Microsoft.CodeAnalysis.Remote.ServiceHub.csproj" />
<ProjectReference Include="..\..\Compilers\Test\Core\Microsoft.CodeAnalysis.Test.Utilities.csproj" />
<ProjectReference Include="..\..\Workspaces\CoreTestUtilities\Microsoft.CodeAnalysis.Workspaces.Test.Utilities.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Threading" Version="$(MicrosoftVisualStudioThreadingVersion)" />
<PackageReference Include="Microsoft.VisualStudio.Imaging" Version="$(MicrosoftVisualStudioImagingVersion)" />
<PackageReference Include="Microsoft.VisualStudio.Imaging.Interop.14.0.DesignTime" Version="$(MicrosoftVisualStudioImagingInterop140DesignTimeVersion)" />
</ItemGroup>
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
</Project> | <?xml version="1.0" encoding="utf-8"?>
<!-- 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. -->
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<StartupObject />
<TargetFramework>net472</TargetFramework>
<UseWpf>true</UseWpf>
<OutputType>Library</OutputType>
<RootNamespace>Microsoft.CodeAnalysis.Editor.CSharp.UnitTests</RootNamespace>
</PropertyGroup>
<ItemGroup Label="Project References">
<ProjectReference Include="..\..\Compilers\Core\Portable\Microsoft.CodeAnalysis.csproj" />
<ProjectReference Include="..\..\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj" />
<ProjectReference Include="..\..\Compilers\Test\Utilities\CSharp\Microsoft.CodeAnalysis.CSharp.Test.Utilities.csproj" />
<ProjectReference Include="..\..\Features\LanguageServer\Protocol\Microsoft.CodeAnalysis.LanguageServer.Protocol.csproj" />
<ProjectReference Include="..\..\Interactive\Host\Microsoft.CodeAnalysis.InteractiveHost.csproj" />
<ProjectReference Include="..\..\Workspaces\Core\Portable\Microsoft.CodeAnalysis.Workspaces.csproj" />
<ProjectReference Include="..\..\Features\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.Features.csproj" />
<ProjectReference Include="..\..\Features\Core\Portable\Microsoft.CodeAnalysis.Features.csproj" />
<ProjectReference Include="..\..\EditorFeatures\Text\Microsoft.CodeAnalysis.EditorFeatures.Text.csproj" />
<ProjectReference Include="..\..\Workspaces\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.Workspaces.csproj" />
<ProjectReference Include="..\..\EditorFeatures\Core\Microsoft.CodeAnalysis.EditorFeatures.csproj" />
<ProjectReference Include="..\..\EditorFeatures\Core.Wpf\Microsoft.CodeAnalysis.EditorFeatures.Wpf.csproj" />
<ProjectReference Include="..\..\EditorFeatures\CSharp\Microsoft.CodeAnalysis.CSharp.EditorFeatures.csproj" />
<ProjectReference Include="..\..\Compilers\Test\Resources\Core\Microsoft.CodeAnalysis.Compiler.Test.Resources.csproj" />
<ProjectReference Include="..\DiagnosticsTestUtilities\Microsoft.CodeAnalysis.EditorFeatures.DiagnosticsTests.Utilities.csproj" />
<ProjectReference Include="..\TestUtilities\Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities.csproj" />
<ProjectReference Include="..\..\Compilers\VisualBasic\Portable\Microsoft.CodeAnalysis.VisualBasic.vbproj" />
<ProjectReference Include="..\VisualBasic\Microsoft.CodeAnalysis.VisualBasic.EditorFeatures.vbproj" />
<ProjectReference Include="..\..\Features\VisualBasic\Portable\Microsoft.CodeAnalysis.VisualBasic.Features.vbproj" />
<ProjectReference Include="..\..\Scripting\VisualBasic\Microsoft.CodeAnalysis.VisualBasic.Scripting.vbproj" />
<ProjectReference Include="..\..\Workspaces\VisualBasic\Portable\Microsoft.CodeAnalysis.VisualBasic.Workspaces.vbproj" />
<ProjectReference Include="..\..\Scripting\CSharp\Microsoft.CodeAnalysis.CSharp.Scripting.csproj" />
<ProjectReference Include="..\..\Test\PdbUtilities\Roslyn.Test.PdbUtilities.csproj" />
<ProjectReference Include="..\..\Workspaces\Remote\Core\Microsoft.CodeAnalysis.Remote.Workspaces.csproj" />
<ProjectReference Include="..\..\Scripting\Core\Microsoft.CodeAnalysis.Scripting.csproj" />
<ProjectReference Include="..\..\Workspaces\Remote\ServiceHub\Microsoft.CodeAnalysis.Remote.ServiceHub.csproj" />
<ProjectReference Include="..\..\Compilers\Test\Core\Microsoft.CodeAnalysis.Test.Utilities.csproj" />
<ProjectReference Include="..\..\Workspaces\CoreTestUtilities\Microsoft.CodeAnalysis.Workspaces.Test.Utilities.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Threading" Version="$(MicrosoftVisualStudioThreadingVersion)" />
<PackageReference Include="Microsoft.VisualStudio.Imaging" Version="$(MicrosoftVisualStudioImagingVersion)" />
<PackageReference Include="Microsoft.VisualStudio.Imaging.Interop.14.0.DesignTime" Version="$(MicrosoftVisualStudioImagingInterop140DesignTimeVersion)" />
</ItemGroup>
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
</Project> | -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Tools/Source/CompilerGeneratorTools/Source/CSharpErrorFactsGenerator/Program.cs | // 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.
#nullable disable
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace Microsoft.CodeAnalysis.CSharp.Internal.CSharpErrorFactsGenerator
{
public static class Program
{
public static int Main(string[] args)
{
if (args.Length != 2)
{
Console.WriteLine(
@"Usage: CSharpErrorFactsGenerator.exe input output
input The path to ErrorCode.cs
output The path to GeneratedErrorFacts.cs");
return -1;
}
string inputPath = args[0];
string outputPath = args[1];
var outputText = new StringBuilder();
outputText.AppendLine("namespace Microsoft.CodeAnalysis.CSharp");
outputText.AppendLine("{");
outputText.AppendLine(" internal static partial class ErrorFacts");
outputText.AppendLine(" {");
var warningCodeNames = new List<string>();
var fatalCodeNames = new List<string>();
var infoCodeNames = new List<string>();
var hiddenCodeNames = new List<string>();
foreach (var line in File.ReadAllLines(inputPath).Select(l => l.Trim()))
{
if (line.StartsWith("WRN_", StringComparison.OrdinalIgnoreCase))
{
warningCodeNames.Add(line.Substring(0, line.IndexOf(' ')));
}
else if (line.StartsWith("FTL_", StringComparison.OrdinalIgnoreCase))
{
fatalCodeNames.Add(line.Substring(0, line.IndexOf(' ')));
}
else if (line.StartsWith("INF_", StringComparison.OrdinalIgnoreCase))
{
infoCodeNames.Add(line.Substring(0, line.IndexOf(' ')));
}
else if (line.StartsWith("HDN_", StringComparison.OrdinalIgnoreCase))
{
hiddenCodeNames.Add(line.Substring(0, line.IndexOf(' ')));
}
}
outputText.AppendLine(" public static bool IsWarning(ErrorCode code)");
outputText.AppendLine(" {");
outputText.AppendLine(" switch (code)");
outputText.AppendLine(" {");
foreach (var name in warningCodeNames)
{
outputText.Append(" case ErrorCode.");
outputText.Append(name);
outputText.AppendLine(":");
}
outputText.AppendLine(" return true;");
outputText.AppendLine(" default:");
outputText.AppendLine(" return false;");
outputText.AppendLine(" }");
outputText.AppendLine(" }");
outputText.AppendLine();
outputText.AppendLine(" public static bool IsFatal(ErrorCode code)");
outputText.AppendLine(" {");
outputText.AppendLine(" switch (code)");
outputText.AppendLine(" {");
foreach (var name in fatalCodeNames)
{
outputText.Append(" case ErrorCode.");
outputText.Append(name);
outputText.AppendLine(":");
}
outputText.AppendLine(" return true;");
outputText.AppendLine(" default:");
outputText.AppendLine(" return false;");
outputText.AppendLine(" }");
outputText.AppendLine(" }");
outputText.AppendLine();
outputText.AppendLine(" public static bool IsInfo(ErrorCode code)");
outputText.AppendLine(" {");
outputText.AppendLine(" switch (code)");
outputText.AppendLine(" {");
foreach (var name in infoCodeNames)
{
outputText.Append(" case ErrorCode.");
outputText.Append(name);
outputText.AppendLine(":");
}
outputText.AppendLine(" return true;");
outputText.AppendLine(" default:");
outputText.AppendLine(" return false;");
outputText.AppendLine(" }");
outputText.AppendLine(" }");
outputText.AppendLine();
outputText.AppendLine(" public static bool IsHidden(ErrorCode code)");
outputText.AppendLine(" {");
outputText.AppendLine(" switch (code)");
outputText.AppendLine(" {");
foreach (var name in hiddenCodeNames)
{
outputText.Append(" case ErrorCode.");
outputText.Append(name);
outputText.AppendLine(":");
}
outputText.AppendLine(" return true;");
outputText.AppendLine(" default:");
outputText.AppendLine(" return false;");
outputText.AppendLine(" }");
outputText.AppendLine(" }");
outputText.AppendLine(" }");
outputText.AppendLine("}");
File.WriteAllText(outputPath, outputText.ToString(), Encoding.UTF8);
return 0;
}
}
}
| // 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.
#nullable disable
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace Microsoft.CodeAnalysis.CSharp.Internal.CSharpErrorFactsGenerator
{
public static class Program
{
public static int Main(string[] args)
{
if (args.Length != 2)
{
Console.WriteLine(
@"Usage: CSharpErrorFactsGenerator.exe input output
input The path to ErrorCode.cs
output The path to GeneratedErrorFacts.cs");
return -1;
}
string inputPath = args[0];
string outputPath = args[1];
var outputText = new StringBuilder();
outputText.AppendLine("namespace Microsoft.CodeAnalysis.CSharp");
outputText.AppendLine("{");
outputText.AppendLine(" internal static partial class ErrorFacts");
outputText.AppendLine(" {");
var warningCodeNames = new List<string>();
var fatalCodeNames = new List<string>();
var infoCodeNames = new List<string>();
var hiddenCodeNames = new List<string>();
foreach (var line in File.ReadAllLines(inputPath).Select(l => l.Trim()))
{
if (line.StartsWith("WRN_", StringComparison.OrdinalIgnoreCase))
{
warningCodeNames.Add(line.Substring(0, line.IndexOf(' ')));
}
else if (line.StartsWith("FTL_", StringComparison.OrdinalIgnoreCase))
{
fatalCodeNames.Add(line.Substring(0, line.IndexOf(' ')));
}
else if (line.StartsWith("INF_", StringComparison.OrdinalIgnoreCase))
{
infoCodeNames.Add(line.Substring(0, line.IndexOf(' ')));
}
else if (line.StartsWith("HDN_", StringComparison.OrdinalIgnoreCase))
{
hiddenCodeNames.Add(line.Substring(0, line.IndexOf(' ')));
}
}
outputText.AppendLine(" public static bool IsWarning(ErrorCode code)");
outputText.AppendLine(" {");
outputText.AppendLine(" switch (code)");
outputText.AppendLine(" {");
foreach (var name in warningCodeNames)
{
outputText.Append(" case ErrorCode.");
outputText.Append(name);
outputText.AppendLine(":");
}
outputText.AppendLine(" return true;");
outputText.AppendLine(" default:");
outputText.AppendLine(" return false;");
outputText.AppendLine(" }");
outputText.AppendLine(" }");
outputText.AppendLine();
outputText.AppendLine(" public static bool IsFatal(ErrorCode code)");
outputText.AppendLine(" {");
outputText.AppendLine(" switch (code)");
outputText.AppendLine(" {");
foreach (var name in fatalCodeNames)
{
outputText.Append(" case ErrorCode.");
outputText.Append(name);
outputText.AppendLine(":");
}
outputText.AppendLine(" return true;");
outputText.AppendLine(" default:");
outputText.AppendLine(" return false;");
outputText.AppendLine(" }");
outputText.AppendLine(" }");
outputText.AppendLine();
outputText.AppendLine(" public static bool IsInfo(ErrorCode code)");
outputText.AppendLine(" {");
outputText.AppendLine(" switch (code)");
outputText.AppendLine(" {");
foreach (var name in infoCodeNames)
{
outputText.Append(" case ErrorCode.");
outputText.Append(name);
outputText.AppendLine(":");
}
outputText.AppendLine(" return true;");
outputText.AppendLine(" default:");
outputText.AppendLine(" return false;");
outputText.AppendLine(" }");
outputText.AppendLine(" }");
outputText.AppendLine();
outputText.AppendLine(" public static bool IsHidden(ErrorCode code)");
outputText.AppendLine(" {");
outputText.AppendLine(" switch (code)");
outputText.AppendLine(" {");
foreach (var name in hiddenCodeNames)
{
outputText.Append(" case ErrorCode.");
outputText.Append(name);
outputText.AppendLine(":");
}
outputText.AppendLine(" return true;");
outputText.AppendLine(" default:");
outputText.AppendLine(" return false;");
outputText.AppendLine(" }");
outputText.AppendLine(" }");
outputText.AppendLine(" }");
outputText.AppendLine("}");
File.WriteAllText(outputPath, outputText.ToString(), Encoding.UTF8);
return 0;
}
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Workspaces/Core/Portable/Workspace/Solution/ProjectId.cs | // 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.Collections.Generic;
using System.Diagnostics;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis
{
/// <summary>
/// An identifier that can be used to refer to the same <see cref="Project"/> across versions.
/// </summary>
[DebuggerDisplay("{GetDebuggerDisplay(),nq}")]
public sealed class ProjectId : IEquatable<ProjectId>, IObjectWritable
{
private readonly string? _debugName;
/// <summary>
/// The system generated unique id.
/// </summary>
public Guid Id { get; }
private ProjectId(Guid guid, string? debugName)
{
this.Id = guid;
_debugName = debugName;
}
/// <summary>
/// Create a new ProjectId instance.
/// </summary>
/// <param name="debugName">An optional name to make this id easier to recognize while debugging.</param>
public static ProjectId CreateNewId(string? debugName = null)
=> new(Guid.NewGuid(), debugName);
public static ProjectId CreateFromSerialized(Guid id, string? debugName = null)
{
if (id == Guid.Empty)
{
throw new ArgumentException(nameof(id));
}
return new ProjectId(id, debugName);
}
internal string? DebugName => _debugName;
private string GetDebuggerDisplay()
=> string.Format("({0}, #{1} - {2})", this.GetType().Name, this.Id, _debugName);
public override string ToString()
=> GetDebuggerDisplay();
public override bool Equals(object? obj)
=> this.Equals(obj as ProjectId);
public bool Equals(ProjectId? other)
{
return
other is object &&
this.Id == other.Id;
}
public static bool operator ==(ProjectId? left, ProjectId? right)
=> EqualityComparer<ProjectId?>.Default.Equals(left, right);
public static bool operator !=(ProjectId? left, ProjectId? right)
=> !(left == right);
public override int GetHashCode()
=> this.Id.GetHashCode();
bool IObjectWritable.ShouldReuseInSerialization => true;
void IObjectWritable.WriteTo(ObjectWriter writer)
{
writer.WriteGuid(Id);
writer.WriteString(DebugName);
}
internal static ProjectId ReadFrom(ObjectReader reader)
{
var guid = reader.ReadGuid();
var debugName = reader.ReadString();
return CreateFromSerialized(guid, debugName);
}
}
}
| // 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.Collections.Generic;
using System.Diagnostics;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis
{
/// <summary>
/// An identifier that can be used to refer to the same <see cref="Project"/> across versions.
/// </summary>
[DebuggerDisplay("{GetDebuggerDisplay(),nq}")]
public sealed class ProjectId : IEquatable<ProjectId>, IObjectWritable
{
private readonly string? _debugName;
/// <summary>
/// The system generated unique id.
/// </summary>
public Guid Id { get; }
private ProjectId(Guid guid, string? debugName)
{
this.Id = guid;
_debugName = debugName;
}
/// <summary>
/// Create a new ProjectId instance.
/// </summary>
/// <param name="debugName">An optional name to make this id easier to recognize while debugging.</param>
public static ProjectId CreateNewId(string? debugName = null)
=> new(Guid.NewGuid(), debugName);
public static ProjectId CreateFromSerialized(Guid id, string? debugName = null)
{
if (id == Guid.Empty)
{
throw new ArgumentException(nameof(id));
}
return new ProjectId(id, debugName);
}
internal string? DebugName => _debugName;
private string GetDebuggerDisplay()
=> string.Format("({0}, #{1} - {2})", this.GetType().Name, this.Id, _debugName);
public override string ToString()
=> GetDebuggerDisplay();
public override bool Equals(object? obj)
=> this.Equals(obj as ProjectId);
public bool Equals(ProjectId? other)
{
return
other is object &&
this.Id == other.Id;
}
public static bool operator ==(ProjectId? left, ProjectId? right)
=> EqualityComparer<ProjectId?>.Default.Equals(left, right);
public static bool operator !=(ProjectId? left, ProjectId? right)
=> !(left == right);
public override int GetHashCode()
=> this.Id.GetHashCode();
bool IObjectWritable.ShouldReuseInSerialization => true;
void IObjectWritable.WriteTo(ObjectWriter writer)
{
writer.WriteGuid(Id);
writer.WriteString(DebugName);
}
internal static ProjectId ReadFrom(ObjectReader reader)
{
var guid = reader.ReadGuid();
var debugName = reader.ReadString();
return CreateFromSerialized(guid, debugName);
}
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Features/VisualBasic/Portable/Completion/KeywordRecommenders/Queries/WhereKeywordRecommender.vb | ' 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.
Imports System.Collections.Immutable
Imports System.Threading
Imports Microsoft.CodeAnalysis.Completion.Providers
Imports Microsoft.CodeAnalysis.VisualBasic.Extensions.ContextQuery
Namespace Microsoft.CodeAnalysis.VisualBasic.Completion.KeywordRecommenders.Queries
''' <summary>
''' Recommends the "Where" query clause.
''' </summary>
Friend Class WhereKeywordRecommender
Inherits AbstractKeywordRecommender
Private Shared ReadOnly s_keywords As ImmutableArray(Of RecommendedKeyword) =
ImmutableArray.Create(New RecommendedKeyword("Where", VBFeaturesResources.Specifies_the_filtering_condition_for_a_range_variable_in_a_query))
Protected Overrides Function RecommendKeywords(context As VisualBasicSyntaxContext, cancellationToken As CancellationToken) As ImmutableArray(Of RecommendedKeyword)
Return If(context.IsQueryOperatorContext, s_keywords, ImmutableArray(Of RecommendedKeyword).Empty)
End Function
End Class
End Namespace
| ' 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.
Imports System.Collections.Immutable
Imports System.Threading
Imports Microsoft.CodeAnalysis.Completion.Providers
Imports Microsoft.CodeAnalysis.VisualBasic.Extensions.ContextQuery
Namespace Microsoft.CodeAnalysis.VisualBasic.Completion.KeywordRecommenders.Queries
''' <summary>
''' Recommends the "Where" query clause.
''' </summary>
Friend Class WhereKeywordRecommender
Inherits AbstractKeywordRecommender
Private Shared ReadOnly s_keywords As ImmutableArray(Of RecommendedKeyword) =
ImmutableArray.Create(New RecommendedKeyword("Where", VBFeaturesResources.Specifies_the_filtering_condition_for_a_range_variable_in_a_query))
Protected Overrides Function RecommendKeywords(context As VisualBasicSyntaxContext, cancellationToken As CancellationToken) As ImmutableArray(Of RecommendedKeyword)
Return If(context.IsQueryOperatorContext, s_keywords, ImmutableArray(Of RecommendedKeyword).Empty)
End Function
End Class
End Namespace
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Analyzers/Core/CodeFixes/NewLines/ConsecutiveStatementPlacement/ConsecutiveStatementPlacementCodeFixProvider.cs | // 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.Collections.Immutable;
using System.Composition;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeActions;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Editing;
using Microsoft.CodeAnalysis.Formatting;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Shared.Extensions;
namespace Microsoft.CodeAnalysis.NewLines.ConsecutiveStatementPlacement
{
[ExportCodeFixProvider(LanguageNames.CSharp, LanguageNames.VisualBasic, Name = PredefinedCodeFixProviderNames.ConsecutiveStatementPlacement), Shared]
internal sealed class ConsecutiveStatementPlacementCodeFixProvider : CodeFixProvider
{
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public ConsecutiveStatementPlacementCodeFixProvider()
{
}
public override ImmutableArray<string> FixableDiagnosticIds
=> ImmutableArray.Create(IDEDiagnosticIds.ConsecutiveStatementPlacementDiagnosticId);
public override Task RegisterCodeFixesAsync(CodeFixContext context)
{
var document = context.Document;
var diagnostic = context.Diagnostics.First();
context.RegisterCodeFix(new MyCodeAction(
c => UpdateDocumentAsync(document, diagnostic, c)),
context.Diagnostics);
return Task.CompletedTask;
}
private static Task<Document> UpdateDocumentAsync(Document document, Diagnostic diagnostic, CancellationToken cancellationToken)
=> FixAllAsync(document, ImmutableArray.Create(diagnostic), cancellationToken);
public static async Task<Document> FixAllAsync(Document document, ImmutableArray<Diagnostic> diagnostics, CancellationToken cancellationToken)
{
var root = await document.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false);
#if CODE_STYLE
var options = document.Project.AnalyzerOptions.GetAnalyzerOptionSet(root.SyntaxTree, cancellationToken);
#else
var options = await document.GetOptionsAsync(cancellationToken).ConfigureAwait(false);
#endif
var newLine = options.GetOption(FormattingOptions2.NewLine, document.Project.Language);
var generator = document.GetRequiredLanguageService<SyntaxGeneratorInternal>();
var endOfLineTrivia = generator.EndOfLine(newLine);
var nextTokens = diagnostics.Select(d => d.AdditionalLocations[0].FindToken(cancellationToken));
var newRoot = root.ReplaceTokens(
nextTokens,
(original, current) => current.WithLeadingTrivia(current.LeadingTrivia.Insert(0, endOfLineTrivia)));
return document.WithSyntaxRoot(newRoot);
}
public override FixAllProvider GetFixAllProvider()
=> FixAllProvider.Create(async (context, document, diagnostics) => await FixAllAsync(document, diagnostics, context.CancellationToken).ConfigureAwait(false));
private class MyCodeAction : CustomCodeActions.DocumentChangeAction
{
public MyCodeAction(Func<CancellationToken, Task<Document>> createChangedDocument)
: base(CodeFixesResources.Add_blank_line_after_block, createChangedDocument, CodeFixesResources.Add_blank_line_after_block)
{
}
}
}
}
| // 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.Collections.Immutable;
using System.Composition;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeActions;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Editing;
using Microsoft.CodeAnalysis.Formatting;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Shared.Extensions;
namespace Microsoft.CodeAnalysis.NewLines.ConsecutiveStatementPlacement
{
[ExportCodeFixProvider(LanguageNames.CSharp, LanguageNames.VisualBasic, Name = PredefinedCodeFixProviderNames.ConsecutiveStatementPlacement), Shared]
internal sealed class ConsecutiveStatementPlacementCodeFixProvider : CodeFixProvider
{
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public ConsecutiveStatementPlacementCodeFixProvider()
{
}
public override ImmutableArray<string> FixableDiagnosticIds
=> ImmutableArray.Create(IDEDiagnosticIds.ConsecutiveStatementPlacementDiagnosticId);
public override Task RegisterCodeFixesAsync(CodeFixContext context)
{
var document = context.Document;
var diagnostic = context.Diagnostics.First();
context.RegisterCodeFix(new MyCodeAction(
c => UpdateDocumentAsync(document, diagnostic, c)),
context.Diagnostics);
return Task.CompletedTask;
}
private static Task<Document> UpdateDocumentAsync(Document document, Diagnostic diagnostic, CancellationToken cancellationToken)
=> FixAllAsync(document, ImmutableArray.Create(diagnostic), cancellationToken);
public static async Task<Document> FixAllAsync(Document document, ImmutableArray<Diagnostic> diagnostics, CancellationToken cancellationToken)
{
var root = await document.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false);
#if CODE_STYLE
var options = document.Project.AnalyzerOptions.GetAnalyzerOptionSet(root.SyntaxTree, cancellationToken);
#else
var options = await document.GetOptionsAsync(cancellationToken).ConfigureAwait(false);
#endif
var newLine = options.GetOption(FormattingOptions2.NewLine, document.Project.Language);
var generator = document.GetRequiredLanguageService<SyntaxGeneratorInternal>();
var endOfLineTrivia = generator.EndOfLine(newLine);
var nextTokens = diagnostics.Select(d => d.AdditionalLocations[0].FindToken(cancellationToken));
var newRoot = root.ReplaceTokens(
nextTokens,
(original, current) => current.WithLeadingTrivia(current.LeadingTrivia.Insert(0, endOfLineTrivia)));
return document.WithSyntaxRoot(newRoot);
}
public override FixAllProvider GetFixAllProvider()
=> FixAllProvider.Create(async (context, document, diagnostics) => await FixAllAsync(document, diagnostics, context.CancellationToken).ConfigureAwait(false));
private class MyCodeAction : CustomCodeActions.DocumentChangeAction
{
public MyCodeAction(Func<CancellationToken, Task<Document>> createChangedDocument)
: base(CodeFixesResources.Add_blank_line_after_block, createChangedDocument, CodeFixesResources.Add_blank_line_after_block)
{
}
}
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/EditorFeatures/Core/Shared/Extensions/TelemetryExtensions.cs | // 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.Globalization;
using System.Linq;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Editor.Shared.Extensions
{
internal static class TelemetryExtensions
{
public static Guid GetTelemetryId(this Type type, short scope = 0)
{
type = GetTypeForTelemetry(type);
Contract.ThrowIfNull(type.FullName);
// AssemblyQualifiedName will change across version numbers, FullName won't
// Use a stable hashing algorithm (FNV) that doesn't depend on platform
// or .NET implementation.
var suffix = Roslyn.Utilities.Hash.GetFNVHashCode(type.FullName);
// Suffix is the remaining 8 bytes, and the hash code only makes up 4. Pad
// the remainder with an empty byte array
var suffixBytes = BitConverter.GetBytes(suffix).Concat(new byte[4]).ToArray();
return new Guid(0, scope, 0, suffixBytes);
}
public static Type GetTypeForTelemetry(this Type type)
=> type.IsConstructedGenericType ? type.GetGenericTypeDefinition() : type;
public static short GetScopeIdForTelemetry(this FixAllScope scope)
=> (short)(scope switch
{
FixAllScope.Document => 1,
FixAllScope.Project => 2,
FixAllScope.Solution => 3,
_ => 4,
});
public static string GetTelemetryDiagnosticID(this Diagnostic diagnostic)
{
// we log diagnostic id as it is if it is from us
if (diagnostic.Descriptor.ImmutableCustomTags().Any(t => t == WellKnownDiagnosticTags.Telemetry))
{
return diagnostic.Id;
}
// if it is from third party, we use hashcode
return diagnostic.GetHashCode().ToString(CultureInfo.InvariantCulture);
}
}
}
| // 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.Globalization;
using System.Linq;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Editor.Shared.Extensions
{
internal static class TelemetryExtensions
{
public static Guid GetTelemetryId(this Type type, short scope = 0)
{
type = GetTypeForTelemetry(type);
Contract.ThrowIfNull(type.FullName);
// AssemblyQualifiedName will change across version numbers, FullName won't
// Use a stable hashing algorithm (FNV) that doesn't depend on platform
// or .NET implementation.
var suffix = Roslyn.Utilities.Hash.GetFNVHashCode(type.FullName);
// Suffix is the remaining 8 bytes, and the hash code only makes up 4. Pad
// the remainder with an empty byte array
var suffixBytes = BitConverter.GetBytes(suffix).Concat(new byte[4]).ToArray();
return new Guid(0, scope, 0, suffixBytes);
}
public static Type GetTypeForTelemetry(this Type type)
=> type.IsConstructedGenericType ? type.GetGenericTypeDefinition() : type;
public static short GetScopeIdForTelemetry(this FixAllScope scope)
=> (short)(scope switch
{
FixAllScope.Document => 1,
FixAllScope.Project => 2,
FixAllScope.Solution => 3,
_ => 4,
});
public static string GetTelemetryDiagnosticID(this Diagnostic diagnostic)
{
// we log diagnostic id as it is if it is from us
if (diagnostic.Descriptor.ImmutableCustomTags().Any(t => t == WellKnownDiagnosticTags.Telemetry))
{
return diagnostic.Id;
}
// if it is from third party, we use hashcode
return diagnostic.GetHashCode().ToString(CultureInfo.InvariantCulture);
}
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Compilers/VisualBasic/Test/Semantic/Semantics/BinaryOperatorsTestSource5.vb | ' 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.
Option Strict Off
Imports System
Module Module1
Sub Main()
PrintResult("False + False", False + False)
PrintResult("False + True", False + True)
PrintResult("False + System.SByte.MinValue", False + System.SByte.MinValue)
PrintResult("False + System.Byte.MaxValue", False + System.Byte.MaxValue)
PrintResult("False + -3S", False + -3S)
PrintResult("False + 24US", False + 24US)
PrintResult("False + -5I", False + -5I)
PrintResult("False + 26UI", False + 26UI)
PrintResult("False + -7L", False + -7L)
PrintResult("False + 28UL", False + 28UL)
PrintResult("False + -9D", False + -9D)
PrintResult("False + 10.0F", False + 10.0F)
PrintResult("False + -11.0R", False + -11.0R)
PrintResult("False + ""12""", False + "12")
PrintResult("False + TypeCode.Double", False + TypeCode.Double)
PrintResult("True + False", True + False)
PrintResult("True + True", True + True)
PrintResult("True + System.SByte.MaxValue", True + System.SByte.MaxValue)
PrintResult("True + System.Byte.MaxValue", True + System.Byte.MaxValue)
PrintResult("True + -3S", True + -3S)
PrintResult("True + 24US", True + 24US)
PrintResult("True + -5I", True + -5I)
PrintResult("True + 26UI", True + 26UI)
PrintResult("True + -7L", True + -7L)
PrintResult("True + 28UL", True + 28UL)
PrintResult("True + -9D", True + -9D)
PrintResult("True + 10.0F", True + 10.0F)
PrintResult("True + -11.0R", True + -11.0R)
PrintResult("True + ""12""", True + "12")
PrintResult("True + TypeCode.Double", True + TypeCode.Double)
PrintResult("System.SByte.MinValue + False", System.SByte.MinValue + False)
PrintResult("System.SByte.MaxValue + True", System.SByte.MaxValue + True)
PrintResult("System.SByte.MinValue + System.SByte.MaxValue", System.SByte.MinValue + System.SByte.MaxValue)
PrintResult("System.SByte.MinValue + System.Byte.MaxValue", System.SByte.MinValue + System.Byte.MaxValue)
PrintResult("System.SByte.MinValue + -3S", System.SByte.MinValue + -3S)
PrintResult("System.SByte.MinValue + 24US", System.SByte.MinValue + 24US)
PrintResult("System.SByte.MinValue + -5I", System.SByte.MinValue + -5I)
PrintResult("System.SByte.MinValue + 26UI", System.SByte.MinValue + 26UI)
PrintResult("System.SByte.MinValue + -7L", System.SByte.MinValue + -7L)
PrintResult("System.SByte.MinValue + 28UL", System.SByte.MinValue + 28UL)
PrintResult("System.SByte.MinValue + -9D", System.SByte.MinValue + -9D)
PrintResult("System.SByte.MinValue + 10.0F", System.SByte.MinValue + 10.0F)
PrintResult("System.SByte.MinValue + -11.0R", System.SByte.MinValue + -11.0R)
PrintResult("System.SByte.MinValue + ""12""", System.SByte.MinValue + "12")
PrintResult("System.SByte.MinValue + TypeCode.Double", System.SByte.MinValue + TypeCode.Double)
PrintResult("System.Byte.MaxValue + False", System.Byte.MaxValue + False)
PrintResult("System.Byte.MaxValue + True", System.Byte.MaxValue + True)
PrintResult("System.Byte.MaxValue + System.SByte.MinValue", System.Byte.MaxValue + System.SByte.MinValue)
PrintResult("System.Byte.MaxValue + System.Byte.MinValue", System.Byte.MaxValue + System.Byte.MinValue)
PrintResult("System.Byte.MaxValue + -3S", System.Byte.MaxValue + -3S)
PrintResult("System.Byte.MaxValue + 24US", System.Byte.MaxValue + 24US)
PrintResult("System.Byte.MaxValue + -5I", System.Byte.MaxValue + -5I)
PrintResult("System.Byte.MaxValue + 26UI", System.Byte.MaxValue + 26UI)
PrintResult("System.Byte.MaxValue + -7L", System.Byte.MaxValue + -7L)
PrintResult("System.Byte.MaxValue + 28UL", System.Byte.MaxValue + 28UL)
PrintResult("System.Byte.MaxValue + -9D", System.Byte.MaxValue + -9D)
PrintResult("System.Byte.MaxValue + 10.0F", System.Byte.MaxValue + 10.0F)
PrintResult("System.Byte.MaxValue + -11.0R", System.Byte.MaxValue + -11.0R)
PrintResult("System.Byte.MaxValue + ""12""", System.Byte.MaxValue + "12")
PrintResult("System.Byte.MaxValue + TypeCode.Double", System.Byte.MaxValue + TypeCode.Double)
PrintResult("-3S + False", -3S + False)
PrintResult("-3S + True", -3S + True)
PrintResult("-3S + System.SByte.MinValue", -3S + System.SByte.MinValue)
PrintResult("-3S + System.Byte.MaxValue", -3S + System.Byte.MaxValue)
PrintResult("-3S + -3S", -3S + -3S)
PrintResult("-3S + 24US", -3S + 24US)
PrintResult("-3S + -5I", -3S + -5I)
PrintResult("-3S + 26UI", -3S + 26UI)
PrintResult("-3S + -7L", -3S + -7L)
PrintResult("-3S + 28UL", -3S + 28UL)
PrintResult("-3S + -9D", -3S + -9D)
PrintResult("-3S + 10.0F", -3S + 10.0F)
PrintResult("-3S + -11.0R", -3S + -11.0R)
PrintResult("-3S + ""12""", -3S + "12")
PrintResult("-3S + TypeCode.Double", -3S + TypeCode.Double)
PrintResult("24US + False", 24US + False)
PrintResult("24US + True", 24US + True)
PrintResult("24US + System.SByte.MinValue", 24US + System.SByte.MinValue)
PrintResult("24US + System.Byte.MaxValue", 24US + System.Byte.MaxValue)
PrintResult("24US + -3S", 24US + -3S)
PrintResult("24US + 24US", 24US + 24US)
PrintResult("24US + -5I", 24US + -5I)
PrintResult("24US + 26UI", 24US + 26UI)
PrintResult("24US + -7L", 24US + -7L)
PrintResult("24US + 28UL", 24US + 28UL)
PrintResult("24US + -9D", 24US + -9D)
PrintResult("24US + 10.0F", 24US + 10.0F)
PrintResult("24US + -11.0R", 24US + -11.0R)
PrintResult("24US + ""12""", 24US + "12")
PrintResult("24US + TypeCode.Double", 24US + TypeCode.Double)
PrintResult("-5I + False", -5I + False)
PrintResult("-5I + True", -5I + True)
PrintResult("-5I + System.SByte.MinValue", -5I + System.SByte.MinValue)
PrintResult("-5I + System.Byte.MaxValue", -5I + System.Byte.MaxValue)
PrintResult("-5I + -3S", -5I + -3S)
PrintResult("-5I + 24US", -5I + 24US)
PrintResult("-5I + -5I", -5I + -5I)
PrintResult("-5I + 26UI", -5I + 26UI)
PrintResult("-5I + -7L", -5I + -7L)
PrintResult("-5I + 28UL", -5I + 28UL)
PrintResult("-5I + -9D", -5I + -9D)
PrintResult("-5I + 10.0F", -5I + 10.0F)
PrintResult("-5I + -11.0R", -5I + -11.0R)
PrintResult("-5I + ""12""", -5I + "12")
PrintResult("-5I + TypeCode.Double", -5I + TypeCode.Double)
PrintResult("26UI + False", 26UI + False)
PrintResult("26UI + True", 26UI + True)
PrintResult("26UI + System.SByte.MinValue", 26UI + System.SByte.MinValue)
PrintResult("26UI + System.Byte.MaxValue", 26UI + System.Byte.MaxValue)
PrintResult("26UI + -3S", 26UI + -3S)
PrintResult("26UI + 24US", 26UI + 24US)
PrintResult("26UI + -5I", 26UI + -5I)
PrintResult("26UI + 26UI", 26UI + 26UI)
PrintResult("26UI + -7L", 26UI + -7L)
PrintResult("26UI + 28UL", 26UI + 28UL)
PrintResult("26UI + -9D", 26UI + -9D)
PrintResult("26UI + 10.0F", 26UI + 10.0F)
PrintResult("26UI + -11.0R", 26UI + -11.0R)
PrintResult("26UI + ""12""", 26UI + "12")
PrintResult("26UI + TypeCode.Double", 26UI + TypeCode.Double)
PrintResult("-7L + False", -7L + False)
PrintResult("-7L + True", -7L + True)
PrintResult("-7L + System.SByte.MinValue", -7L + System.SByte.MinValue)
PrintResult("-7L + System.Byte.MaxValue", -7L + System.Byte.MaxValue)
PrintResult("-7L + -3S", -7L + -3S)
PrintResult("-7L + 24US", -7L + 24US)
PrintResult("-7L + -5I", -7L + -5I)
PrintResult("-7L + 26UI", -7L + 26UI)
PrintResult("-7L + -7L", -7L + -7L)
PrintResult("-7L + 28UL", -7L + 28UL)
PrintResult("-7L + -9D", -7L + -9D)
PrintResult("-7L + 10.0F", -7L + 10.0F)
PrintResult("-7L + -11.0R", -7L + -11.0R)
PrintResult("-7L + ""12""", -7L + "12")
PrintResult("-7L + TypeCode.Double", -7L + TypeCode.Double)
PrintResult("28UL + False", 28UL + False)
PrintResult("28UL + True", 28UL + True)
PrintResult("28UL + System.SByte.MinValue", 28UL + System.SByte.MinValue)
PrintResult("28UL + System.Byte.MaxValue", 28UL + System.Byte.MaxValue)
PrintResult("28UL + -3S", 28UL + -3S)
PrintResult("28UL + 24US", 28UL + 24US)
PrintResult("28UL + -5I", 28UL + -5I)
PrintResult("28UL + 26UI", 28UL + 26UI)
PrintResult("28UL + -7L", 28UL + -7L)
PrintResult("28UL + 28UL", 28UL + 28UL)
PrintResult("28UL + -9D", 28UL + -9D)
PrintResult("28UL + 10.0F", 28UL + 10.0F)
PrintResult("28UL + -11.0R", 28UL + -11.0R)
PrintResult("28UL + ""12""", 28UL + "12")
PrintResult("28UL + TypeCode.Double", 28UL + TypeCode.Double)
PrintResult("-9D + False", -9D + False)
PrintResult("-9D + True", -9D + True)
PrintResult("-9D + System.SByte.MinValue", -9D + System.SByte.MinValue)
PrintResult("-9D + System.Byte.MaxValue", -9D + System.Byte.MaxValue)
PrintResult("-9D + -3S", -9D + -3S)
PrintResult("-9D + 24US", -9D + 24US)
PrintResult("-9D + -5I", -9D + -5I)
PrintResult("-9D + 26UI", -9D + 26UI)
PrintResult("-9D + -7L", -9D + -7L)
PrintResult("-9D + 28UL", -9D + 28UL)
PrintResult("-9D + -9D", -9D + -9D)
PrintResult("-9D + 10.0F", -9D + 10.0F)
PrintResult("-9D + -11.0R", -9D + -11.0R)
PrintResult("-9D + ""12""", -9D + "12")
PrintResult("-9D + TypeCode.Double", -9D + TypeCode.Double)
PrintResult("10.0F + False", 10.0F + False)
PrintResult("10.0F + True", 10.0F + True)
PrintResult("10.0F + System.SByte.MinValue", 10.0F + System.SByte.MinValue)
PrintResult("10.0F + System.Byte.MaxValue", 10.0F + System.Byte.MaxValue)
PrintResult("10.0F + -3S", 10.0F + -3S)
PrintResult("10.0F + 24US", 10.0F + 24US)
PrintResult("10.0F + -5I", 10.0F + -5I)
PrintResult("10.0F + 26UI", 10.0F + 26UI)
PrintResult("10.0F + -7L", 10.0F + -7L)
PrintResult("10.0F + 28UL", 10.0F + 28UL)
PrintResult("10.0F + -9D", 10.0F + -9D)
PrintResult("10.0F + 10.0F", 10.0F + 10.0F)
PrintResult("10.0F + -11.0R", 10.0F + -11.0R)
PrintResult("10.0F + ""12""", 10.0F + "12")
PrintResult("10.0F + TypeCode.Double", 10.0F + TypeCode.Double)
PrintResult("-11.0R + False", -11.0R + False)
PrintResult("-11.0R + True", -11.0R + True)
PrintResult("-11.0R + System.SByte.MinValue", -11.0R + System.SByte.MinValue)
PrintResult("-11.0R + System.Byte.MaxValue", -11.0R + System.Byte.MaxValue)
PrintResult("-11.0R + -3S", -11.0R + -3S)
PrintResult("-11.0R + 24US", -11.0R + 24US)
PrintResult("-11.0R + -5I", -11.0R + -5I)
PrintResult("-11.0R + 26UI", -11.0R + 26UI)
PrintResult("-11.0R + -7L", -11.0R + -7L)
PrintResult("-11.0R + 28UL", -11.0R + 28UL)
PrintResult("-11.0R + -9D", -11.0R + -9D)
PrintResult("-11.0R + 10.0F", -11.0R + 10.0F)
PrintResult("-11.0R + -11.0R", -11.0R + -11.0R)
PrintResult("-11.0R + ""12""", -11.0R + "12")
PrintResult("-11.0R + TypeCode.Double", -11.0R + TypeCode.Double)
PrintResult("""12"" + False", "12" + False)
PrintResult("""12"" + True", "12" + True)
PrintResult("""12"" + System.SByte.MinValue", "12" + System.SByte.MinValue)
PrintResult("""12"" + System.Byte.MaxValue", "12" + System.Byte.MaxValue)
PrintResult("""12"" + -3S", "12" + -3S)
PrintResult("""12"" + 24US", "12" + 24US)
PrintResult("""12"" + -5I", "12" + -5I)
PrintResult("""12"" + 26UI", "12" + 26UI)
PrintResult("""12"" + -7L", "12" + -7L)
PrintResult("""12"" + 28UL", "12" + 28UL)
PrintResult("""12"" + -9D", "12" + -9D)
PrintResult("""12"" + 10.0F", "12" + 10.0F)
PrintResult("""12"" + -11.0R", "12" + -11.0R)
PrintResult("""12"" + ""12""", "12" + "12")
PrintResult("""12"" + TypeCode.Double", "12" + TypeCode.Double)
PrintResult("TypeCode.Double + False", TypeCode.Double + False)
PrintResult("TypeCode.Double + True", TypeCode.Double + True)
PrintResult("TypeCode.Double + System.SByte.MinValue", TypeCode.Double + System.SByte.MinValue)
PrintResult("TypeCode.Double + System.Byte.MaxValue", TypeCode.Double + System.Byte.MaxValue)
PrintResult("TypeCode.Double + -3S", TypeCode.Double + -3S)
PrintResult("TypeCode.Double + 24US", TypeCode.Double + 24US)
PrintResult("TypeCode.Double + -5I", TypeCode.Double + -5I)
PrintResult("TypeCode.Double + 26UI", TypeCode.Double + 26UI)
PrintResult("TypeCode.Double + -7L", TypeCode.Double + -7L)
PrintResult("TypeCode.Double + 28UL", TypeCode.Double + 28UL)
PrintResult("TypeCode.Double + -9D", TypeCode.Double + -9D)
PrintResult("TypeCode.Double + 10.0F", TypeCode.Double + 10.0F)
PrintResult("TypeCode.Double + -11.0R", TypeCode.Double + -11.0R)
PrintResult("TypeCode.Double + ""12""", TypeCode.Double + "12")
PrintResult("TypeCode.Double + TypeCode.Double", TypeCode.Double + TypeCode.Double)
PrintResult("False - False", False - False)
PrintResult("False - True", False - True)
PrintResult("False - System.SByte.MaxValue", False - System.SByte.MaxValue)
PrintResult("False - System.Byte.MaxValue", False - System.Byte.MaxValue)
PrintResult("False - -3S", False - -3S)
PrintResult("False - 24US", False - 24US)
PrintResult("False - -5I", False - -5I)
PrintResult("False - 26UI", False - 26UI)
PrintResult("False - -7L", False - -7L)
PrintResult("False - 28UL", False - 28UL)
PrintResult("False - -9D", False - -9D)
PrintResult("False - 10.0F", False - 10.0F)
PrintResult("False - -11.0R", False - -11.0R)
PrintResult("False - ""12""", False - "12")
PrintResult("False - TypeCode.Double", False - TypeCode.Double)
PrintResult("True - False", True - False)
PrintResult("True - True", True - True)
PrintResult("True - System.SByte.MinValue", True - System.SByte.MinValue)
PrintResult("True - System.Byte.MaxValue", True - System.Byte.MaxValue)
PrintResult("True - -3S", True - -3S)
PrintResult("True - 24US", True - 24US)
PrintResult("True - -5I", True - -5I)
PrintResult("True - 26UI", True - 26UI)
PrintResult("True - -7L", True - -7L)
PrintResult("True - 28UL", True - 28UL)
PrintResult("True - -9D", True - -9D)
PrintResult("True - 10.0F", True - 10.0F)
PrintResult("True - -11.0R", True - -11.0R)
PrintResult("True - ""12""", True - "12")
PrintResult("True - TypeCode.Double", True - TypeCode.Double)
PrintResult("System.SByte.MinValue - False", System.SByte.MinValue - False)
PrintResult("System.SByte.MinValue - True", System.SByte.MinValue - True)
PrintResult("System.SByte.MinValue - System.SByte.MinValue", System.SByte.MinValue - System.SByte.MinValue)
PrintResult("System.SByte.MinValue - System.Byte.MaxValue", System.SByte.MinValue - System.Byte.MaxValue)
PrintResult("System.SByte.MinValue - -3S", System.SByte.MinValue - -3S)
PrintResult("System.SByte.MinValue - 24US", System.SByte.MinValue - 24US)
PrintResult("System.SByte.MinValue - -5I", System.SByte.MinValue - -5I)
PrintResult("System.SByte.MinValue - 26UI", System.SByte.MinValue - 26UI)
PrintResult("System.SByte.MinValue - -7L", System.SByte.MinValue - -7L)
PrintResult("System.SByte.MinValue - 28UL", System.SByte.MinValue - 28UL)
PrintResult("System.SByte.MinValue - -9D", System.SByte.MinValue - -9D)
PrintResult("System.SByte.MinValue - 10.0F", System.SByte.MinValue - 10.0F)
PrintResult("System.SByte.MinValue - -11.0R", System.SByte.MinValue - -11.0R)
PrintResult("System.SByte.MinValue - ""12""", System.SByte.MinValue - "12")
PrintResult("System.SByte.MinValue - TypeCode.Double", System.SByte.MinValue - TypeCode.Double)
PrintResult("System.Byte.MaxValue - False", System.Byte.MaxValue - False)
PrintResult("System.Byte.MaxValue - True", System.Byte.MaxValue - True)
PrintResult("System.Byte.MaxValue - System.SByte.MinValue", System.Byte.MaxValue - System.SByte.MinValue)
PrintResult("System.Byte.MaxValue - System.Byte.MaxValue", System.Byte.MaxValue - System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue - -3S", System.Byte.MaxValue - -3S)
PrintResult("System.Byte.MaxValue - -5I", System.Byte.MaxValue - -5I)
PrintResult("System.Byte.MaxValue - -7L", System.Byte.MaxValue - -7L)
PrintResult("System.Byte.MaxValue - -9D", System.Byte.MaxValue - -9D)
PrintResult("System.Byte.MaxValue - 10.0F", System.Byte.MaxValue - 10.0F)
PrintResult("System.Byte.MaxValue - -11.0R", System.Byte.MaxValue - -11.0R)
PrintResult("System.Byte.MaxValue - ""12""", System.Byte.MaxValue - "12")
PrintResult("System.Byte.MaxValue - TypeCode.Double", System.Byte.MaxValue - TypeCode.Double)
PrintResult("-3S - False", -3S - False)
PrintResult("-3S - True", -3S - True)
PrintResult("-3S - System.SByte.MinValue", -3S - System.SByte.MinValue)
PrintResult("-3S - System.Byte.MaxValue", -3S - System.Byte.MaxValue)
PrintResult("-3S - -3S", -3S - -3S)
PrintResult("-3S - 24US", -3S - 24US)
PrintResult("-3S - -5I", -3S - -5I)
PrintResult("-3S - 26UI", -3S - 26UI)
PrintResult("-3S - -7L", -3S - -7L)
PrintResult("-3S - 28UL", -3S - 28UL)
PrintResult("-3S - -9D", -3S - -9D)
PrintResult("-3S - 10.0F", -3S - 10.0F)
PrintResult("-3S - -11.0R", -3S - -11.0R)
PrintResult("-3S - ""12""", -3S - "12")
PrintResult("-3S - TypeCode.Double", -3S - TypeCode.Double)
PrintResult("24US - False", 24US - False)
PrintResult("24US - True", 24US - True)
PrintResult("24US - System.SByte.MinValue", 24US - System.SByte.MinValue)
PrintResult("System.UInt16.MaxValue - System.Byte.MaxValue", System.UInt16.MaxValue - System.Byte.MaxValue)
PrintResult("24US - -3S", 24US - -3S)
PrintResult("24US - 24US", 24US - 24US)
PrintResult("24US - -5I", 24US - -5I)
PrintResult("24US - -7L", 24US - -7L)
PrintResult("24US - -9D", 24US - -9D)
PrintResult("24US - 10.0F", 24US - 10.0F)
PrintResult("24US - -11.0R", 24US - -11.0R)
PrintResult("24US - ""12""", 24US - "12")
PrintResult("24US - TypeCode.Double", 24US - TypeCode.Double)
PrintResult("-5I - False", -5I - False)
PrintResult("-5I - True", -5I - True)
PrintResult("-5I - System.SByte.MinValue", -5I - System.SByte.MinValue)
PrintResult("-5I - System.Byte.MaxValue", -5I - System.Byte.MaxValue)
PrintResult("-5I - -3S", -5I - -3S)
PrintResult("-5I - 24US", -5I - 24US)
PrintResult("-5I - -5I", -5I - -5I)
PrintResult("-5I - 26UI", -5I - 26UI)
PrintResult("-5I - -7L", -5I - -7L)
PrintResult("-5I - 28UL", -5I - 28UL)
PrintResult("-5I - -9D", -5I - -9D)
PrintResult("-5I - 10.0F", -5I - 10.0F)
PrintResult("-5I - -11.0R", -5I - -11.0R)
PrintResult("-5I - ""12""", -5I - "12")
PrintResult("-5I - TypeCode.Double", -5I - TypeCode.Double)
PrintResult("26UI - False", 26UI - False)
PrintResult("26UI - True", 26UI - True)
PrintResult("26UI - System.SByte.MinValue", 26UI - System.SByte.MinValue)
PrintResult("System.UInt32.MaxValue - System.Byte.MaxValue", System.UInt32.MaxValue - System.Byte.MaxValue)
PrintResult("26UI - -3S", 26UI - -3S)
PrintResult("26UI - 24US", 26UI - 24US)
PrintResult("26UI - -5I", 26UI - -5I)
PrintResult("26UI - 26UI", 26UI - 26UI)
PrintResult("26UI - -7L", 26UI - -7L)
PrintResult("26UI - -9D", 26UI - -9D)
PrintResult("26UI - 10.0F", 26UI - 10.0F)
PrintResult("26UI - -11.0R", 26UI - -11.0R)
PrintResult("26UI - ""12""", 26UI - "12")
PrintResult("26UI - TypeCode.Double", 26UI - TypeCode.Double)
PrintResult("-7L - False", -7L - False)
PrintResult("-7L - True", -7L - True)
PrintResult("-7L - System.SByte.MinValue", -7L - System.SByte.MinValue)
PrintResult("-7L - System.Byte.MaxValue", -7L - System.Byte.MaxValue)
PrintResult("-7L - -3S", -7L - -3S)
PrintResult("-7L - 24US", -7L - 24US)
PrintResult("-7L - -5I", -7L - -5I)
PrintResult("-7L - 26UI", -7L - 26UI)
PrintResult("-7L - -7L", -7L - -7L)
PrintResult("-7L - 28UL", -7L - 28UL)
PrintResult("-7L - -9D", -7L - -9D)
PrintResult("-7L - 10.0F", -7L - 10.0F)
PrintResult("-7L - -11.0R", -7L - -11.0R)
PrintResult("-7L - ""12""", -7L - "12")
PrintResult("-7L - TypeCode.Double", -7L - TypeCode.Double)
PrintResult("28UL - False", 28UL - False)
PrintResult("28UL - True", 28UL - True)
PrintResult("28UL - System.SByte.MinValue", 28UL - System.SByte.MinValue)
PrintResult("System.UInt64.MaxValue - System.Byte.MaxValue", System.UInt64.MaxValue - System.Byte.MaxValue)
PrintResult("28UL - -3S", 28UL - -3S)
PrintResult("28UL - 24US", 28UL - 24US)
PrintResult("28UL - -5I", 28UL - -5I)
PrintResult("28UL - 26UI", 28UL - 26UI)
PrintResult("28UL - -7L", 28UL - -7L)
PrintResult("28UL - 28UL", 28UL - 28UL)
PrintResult("28UL - -9D", 28UL - -9D)
PrintResult("28UL - 10.0F", 28UL - 10.0F)
PrintResult("28UL - -11.0R", 28UL - -11.0R)
PrintResult("28UL - ""12""", 28UL - "12")
PrintResult("28UL - TypeCode.Double", 28UL - TypeCode.Double)
PrintResult("-9D - False", -9D - False)
PrintResult("-9D - True", -9D - True)
PrintResult("-9D - System.SByte.MinValue", -9D - System.SByte.MinValue)
PrintResult("-9D - System.Byte.MaxValue", -9D - System.Byte.MaxValue)
PrintResult("-9D - -3S", -9D - -3S)
PrintResult("-9D - 24US", -9D - 24US)
PrintResult("-9D - -5I", -9D - -5I)
PrintResult("-9D - 26UI", -9D - 26UI)
PrintResult("-9D - -7L", -9D - -7L)
PrintResult("-9D - 28UL", -9D - 28UL)
PrintResult("-9D - -9D", -9D - -9D)
PrintResult("-9D - 10.0F", -9D - 10.0F)
PrintResult("-9D - -11.0R", -9D - -11.0R)
PrintResult("-9D - ""12""", -9D - "12")
PrintResult("-9D - TypeCode.Double", -9D - TypeCode.Double)
PrintResult("10.0F - False", 10.0F - False)
PrintResult("10.0F - True", 10.0F - True)
PrintResult("10.0F - System.SByte.MinValue", 10.0F - System.SByte.MinValue)
PrintResult("10.0F - System.Byte.MaxValue", 10.0F - System.Byte.MaxValue)
PrintResult("10.0F - -3S", 10.0F - -3S)
PrintResult("10.0F - 24US", 10.0F - 24US)
PrintResult("10.0F - -5I", 10.0F - -5I)
PrintResult("10.0F - 26UI", 10.0F - 26UI)
PrintResult("10.0F - -7L", 10.0F - -7L)
PrintResult("10.0F - 28UL", 10.0F - 28UL)
PrintResult("10.0F - -9D", 10.0F - -9D)
PrintResult("10.0F - 10.0F", 10.0F - 10.0F)
PrintResult("10.0F - -11.0R", 10.0F - -11.0R)
PrintResult("10.0F - ""12""", 10.0F - "12")
PrintResult("10.0F - TypeCode.Double", 10.0F - TypeCode.Double)
PrintResult("-11.0R - False", -11.0R - False)
PrintResult("-11.0R - True", -11.0R - True)
PrintResult("-11.0R - System.SByte.MinValue", -11.0R - System.SByte.MinValue)
PrintResult("-11.0R - System.Byte.MaxValue", -11.0R - System.Byte.MaxValue)
PrintResult("-11.0R - -3S", -11.0R - -3S)
PrintResult("-11.0R - 24US", -11.0R - 24US)
PrintResult("-11.0R - -5I", -11.0R - -5I)
PrintResult("-11.0R - 26UI", -11.0R - 26UI)
PrintResult("-11.0R - -7L", -11.0R - -7L)
PrintResult("-11.0R - 28UL", -11.0R - 28UL)
PrintResult("-11.0R - -9D", -11.0R - -9D)
PrintResult("-11.0R - 10.0F", -11.0R - 10.0F)
PrintResult("-11.0R - -11.0R", -11.0R - -11.0R)
PrintResult("-11.0R - ""12""", -11.0R - "12")
PrintResult("-11.0R - TypeCode.Double", -11.0R - TypeCode.Double)
PrintResult("""12"" - False", "12" - False)
PrintResult("""12"" - True", "12" - True)
PrintResult("""12"" - System.SByte.MinValue", "12" - System.SByte.MinValue)
PrintResult("""12"" - System.Byte.MaxValue", "12" - System.Byte.MaxValue)
PrintResult("""12"" - -3S", "12" - -3S)
PrintResult("""12"" - 24US", "12" - 24US)
PrintResult("""12"" - -5I", "12" - -5I)
PrintResult("""12"" - 26UI", "12" - 26UI)
PrintResult("""12"" - -7L", "12" - -7L)
PrintResult("""12"" - 28UL", "12" - 28UL)
PrintResult("""12"" - -9D", "12" - -9D)
PrintResult("""12"" - 10.0F", "12" - 10.0F)
PrintResult("""12"" - -11.0R", "12" - -11.0R)
PrintResult("""12"" - ""12""", "12" - "12")
PrintResult("""12"" - TypeCode.Double", "12" - TypeCode.Double)
PrintResult("TypeCode.Double - False", TypeCode.Double - False)
PrintResult("TypeCode.Double - True", TypeCode.Double - True)
PrintResult("TypeCode.Double - System.SByte.MinValue", TypeCode.Double - System.SByte.MinValue)
PrintResult("TypeCode.Double - System.Byte.MaxValue", TypeCode.Double - System.Byte.MaxValue)
PrintResult("TypeCode.Double - -3S", TypeCode.Double - -3S)
PrintResult("TypeCode.Double - 24US", TypeCode.Double - 24US)
PrintResult("TypeCode.Double - -5I", TypeCode.Double - -5I)
PrintResult("TypeCode.Double - 26UI", TypeCode.Double - 26UI)
PrintResult("TypeCode.Double - -7L", TypeCode.Double - -7L)
PrintResult("TypeCode.Double - 28UL", TypeCode.Double - 28UL)
PrintResult("TypeCode.Double - -9D", TypeCode.Double - -9D)
PrintResult("TypeCode.Double - 10.0F", TypeCode.Double - 10.0F)
PrintResult("TypeCode.Double - -11.0R", TypeCode.Double - -11.0R)
PrintResult("TypeCode.Double - ""12""", TypeCode.Double - "12")
PrintResult("TypeCode.Double - TypeCode.Double", TypeCode.Double - TypeCode.Double)
PrintResult("False * False", False * False)
PrintResult("False * True", False * True)
PrintResult("False * System.SByte.MinValue", False * System.SByte.MinValue)
PrintResult("False * System.Byte.MaxValue", False * System.Byte.MaxValue)
PrintResult("False * -3S", False * -3S)
PrintResult("False * 24US", False * 24US)
PrintResult("False * -5I", False * -5I)
PrintResult("False * 26UI", False * 26UI)
PrintResult("False * -7L", False * -7L)
PrintResult("False * 28UL", False * 28UL)
PrintResult("False * -9D", False * -9D)
PrintResult("False * 10.0F", False * 10.0F)
PrintResult("False * -11.0R", False * -11.0R)
PrintResult("False * ""12""", False * "12")
PrintResult("False * TypeCode.Double", False * TypeCode.Double)
PrintResult("True * False", True * False)
PrintResult("True * True", True * True)
PrintResult("True * System.SByte.MaxValue", True * System.SByte.MaxValue)
PrintResult("True * System.Byte.MaxValue", True * System.Byte.MaxValue)
PrintResult("True * -3S", True * -3S)
PrintResult("True * 24US", True * 24US)
PrintResult("True * -5I", True * -5I)
PrintResult("True * 26UI", True * 26UI)
PrintResult("True * -7L", True * -7L)
PrintResult("True * 28UL", True * 28UL)
PrintResult("True * -9D", True * -9D)
PrintResult("True * 10.0F", True * 10.0F)
PrintResult("True * -11.0R", True * -11.0R)
PrintResult("True * ""12""", True * "12")
PrintResult("True * TypeCode.Double", True * TypeCode.Double)
PrintResult("System.SByte.MinValue * False", System.SByte.MinValue * False)
PrintResult("System.SByte.MaxValue * True", System.SByte.MaxValue * True)
PrintResult("System.SByte.MinValue * (-(System.SByte.MinValue + System.SByte.MaxValue))", System.SByte.MinValue * (-(System.SByte.MinValue + System.SByte.MaxValue)))
PrintResult("System.SByte.MinValue * System.Byte.MaxValue", System.SByte.MinValue * System.Byte.MaxValue)
PrintResult("System.SByte.MinValue * -3S", System.SByte.MinValue * -3S)
PrintResult("System.SByte.MinValue * 24US", System.SByte.MinValue * 24US)
PrintResult("System.SByte.MinValue * -5I", System.SByte.MinValue * -5I)
PrintResult("System.SByte.MinValue * 26UI", System.SByte.MinValue * 26UI)
PrintResult("System.SByte.MinValue * -7L", System.SByte.MinValue * -7L)
PrintResult("System.SByte.MinValue * 28UL", System.SByte.MinValue * 28UL)
PrintResult("System.SByte.MinValue * -9D", System.SByte.MinValue * -9D)
PrintResult("System.SByte.MinValue * 10.0F", System.SByte.MinValue * 10.0F)
PrintResult("System.SByte.MinValue * -11.0R", System.SByte.MinValue * -11.0R)
PrintResult("System.SByte.MinValue * ""12""", System.SByte.MinValue * "12")
PrintResult("System.SByte.MinValue * TypeCode.Double", System.SByte.MinValue * TypeCode.Double)
PrintResult("System.Byte.MaxValue * False", System.Byte.MaxValue * False)
PrintResult("System.Byte.MaxValue * True", System.Byte.MaxValue * True)
PrintResult("System.Byte.MaxValue * System.SByte.MinValue", System.Byte.MaxValue * System.SByte.MinValue)
PrintResult("System.Byte.MaxValue * -3S", System.Byte.MaxValue * -3S)
PrintResult("System.Byte.MaxValue * 24US", System.Byte.MaxValue * 24US)
PrintResult("System.Byte.MaxValue * -5I", System.Byte.MaxValue * -5I)
PrintResult("System.Byte.MaxValue * 26UI", System.Byte.MaxValue * 26UI)
PrintResult("System.Byte.MaxValue * -7L", System.Byte.MaxValue * -7L)
PrintResult("System.Byte.MaxValue * 28UL", System.Byte.MaxValue * 28UL)
PrintResult("System.Byte.MaxValue * -9D", System.Byte.MaxValue * -9D)
PrintResult("System.Byte.MaxValue * 10.0F", System.Byte.MaxValue * 10.0F)
PrintResult("System.Byte.MaxValue * -11.0R", System.Byte.MaxValue * -11.0R)
PrintResult("System.Byte.MaxValue * ""12""", System.Byte.MaxValue * "12")
PrintResult("System.Byte.MaxValue * TypeCode.Double", System.Byte.MaxValue * TypeCode.Double)
PrintResult("-3S * False", -3S * False)
PrintResult("-3S * True", -3S * True)
PrintResult("-3S * System.SByte.MinValue", -3S * System.SByte.MinValue)
PrintResult("-3S * System.Byte.MaxValue", -3S * System.Byte.MaxValue)
PrintResult("-3S * -3S", -3S * -3S)
PrintResult("-3S * 24US", -3S * 24US)
PrintResult("-3S * -5I", -3S * -5I)
PrintResult("-3S * 26UI", -3S * 26UI)
PrintResult("-3S * -7L", -3S * -7L)
PrintResult("-3S * 28UL", -3S * 28UL)
PrintResult("-3S * -9D", -3S * -9D)
PrintResult("-3S * 10.0F", -3S * 10.0F)
PrintResult("-3S * -11.0R", -3S * -11.0R)
PrintResult("-3S * ""12""", -3S * "12")
PrintResult("-3S * TypeCode.Double", -3S * TypeCode.Double)
PrintResult("24US * False", 24US * False)
PrintResult("24US * True", 24US * True)
PrintResult("24US * System.SByte.MinValue", 24US * System.SByte.MinValue)
PrintResult("24US * System.Byte.MaxValue", 24US * System.Byte.MaxValue)
PrintResult("24US * -3S", 24US * -3S)
PrintResult("24US * 24US", 24US * 24US)
PrintResult("24US * -5I", 24US * -5I)
PrintResult("24US * 26UI", 24US * 26UI)
PrintResult("24US * -7L", 24US * -7L)
PrintResult("24US * 28UL", 24US * 28UL)
PrintResult("24US * -9D", 24US * -9D)
PrintResult("24US * 10.0F", 24US * 10.0F)
PrintResult("24US * -11.0R", 24US * -11.0R)
PrintResult("24US * ""12""", 24US * "12")
PrintResult("24US * TypeCode.Double", 24US * TypeCode.Double)
PrintResult("-5I * False", -5I * False)
PrintResult("-5I * True", -5I * True)
PrintResult("-5I * System.SByte.MinValue", -5I * System.SByte.MinValue)
PrintResult("-5I * System.Byte.MaxValue", -5I * System.Byte.MaxValue)
PrintResult("-5I * -3S", -5I * -3S)
PrintResult("-5I * 24US", -5I * 24US)
PrintResult("-5I * -5I", -5I * -5I)
PrintResult("-5I * 26UI", -5I * 26UI)
PrintResult("-5I * -7L", -5I * -7L)
PrintResult("-5I * 28UL", -5I * 28UL)
PrintResult("-5I * -9D", -5I * -9D)
PrintResult("-5I * 10.0F", -5I * 10.0F)
PrintResult("-5I * -11.0R", -5I * -11.0R)
PrintResult("-5I * ""12""", -5I * "12")
PrintResult("-5I * TypeCode.Double", -5I * TypeCode.Double)
PrintResult("26UI * False", 26UI * False)
PrintResult("26UI * True", 26UI * True)
PrintResult("26UI * System.SByte.MinValue", 26UI * System.SByte.MinValue)
PrintResult("26UI * System.Byte.MaxValue", 26UI * System.Byte.MaxValue)
PrintResult("26UI * -3S", 26UI * -3S)
PrintResult("26UI * 24US", 26UI * 24US)
PrintResult("26UI * -5I", 26UI * -5I)
PrintResult("26UI * 26UI", 26UI * 26UI)
PrintResult("26UI * -7L", 26UI * -7L)
PrintResult("26UI * 28UL", 26UI * 28UL)
PrintResult("26UI * -9D", 26UI * -9D)
PrintResult("26UI * 10.0F", 26UI * 10.0F)
PrintResult("26UI * -11.0R", 26UI * -11.0R)
PrintResult("26UI * ""12""", 26UI * "12")
PrintResult("26UI * TypeCode.Double", 26UI * TypeCode.Double)
PrintResult("-7L * False", -7L * False)
PrintResult("-7L * True", -7L * True)
PrintResult("-7L * System.SByte.MinValue", -7L * System.SByte.MinValue)
PrintResult("-7L * System.Byte.MaxValue", -7L * System.Byte.MaxValue)
PrintResult("-7L * -3S", -7L * -3S)
PrintResult("-7L * 24US", -7L * 24US)
PrintResult("-7L * -5I", -7L * -5I)
PrintResult("-7L * 26UI", -7L * 26UI)
PrintResult("-7L * -7L", -7L * -7L)
PrintResult("-7L * 28UL", -7L * 28UL)
PrintResult("-7L * -9D", -7L * -9D)
PrintResult("-7L * 10.0F", -7L * 10.0F)
PrintResult("-7L * -11.0R", -7L * -11.0R)
PrintResult("-7L * ""12""", -7L * "12")
PrintResult("-7L * TypeCode.Double", -7L * TypeCode.Double)
PrintResult("28UL * False", 28UL * False)
PrintResult("28UL * True", 28UL * True)
PrintResult("28UL * System.SByte.MinValue", 28UL * System.SByte.MinValue)
PrintResult("28UL * System.Byte.MaxValue", 28UL * System.Byte.MaxValue)
PrintResult("28UL * -3S", 28UL * -3S)
PrintResult("28UL * 24US", 28UL * 24US)
PrintResult("28UL * -5I", 28UL * -5I)
PrintResult("28UL * 26UI", 28UL * 26UI)
PrintResult("28UL * -7L", 28UL * -7L)
PrintResult("28UL * 28UL", 28UL * 28UL)
PrintResult("28UL * -9D", 28UL * -9D)
PrintResult("28UL * 10.0F", 28UL * 10.0F)
PrintResult("28UL * -11.0R", 28UL * -11.0R)
PrintResult("28UL * ""12""", 28UL * "12")
PrintResult("28UL * TypeCode.Double", 28UL * TypeCode.Double)
PrintResult("-9D * False", -9D * False)
PrintResult("-9D * True", -9D * True)
PrintResult("-9D * System.SByte.MinValue", -9D * System.SByte.MinValue)
PrintResult("-9D * System.Byte.MaxValue", -9D * System.Byte.MaxValue)
PrintResult("-9D * -3S", -9D * -3S)
PrintResult("-9D * 24US", -9D * 24US)
PrintResult("-9D * -5I", -9D * -5I)
PrintResult("-9D * 26UI", -9D * 26UI)
PrintResult("-9D * -7L", -9D * -7L)
PrintResult("-9D * 28UL", -9D * 28UL)
PrintResult("-9D * -9D", -9D * -9D)
PrintResult("-9D * 10.0F", -9D * 10.0F)
PrintResult("-9D * -11.0R", -9D * -11.0R)
PrintResult("-9D * ""12""", -9D * "12")
PrintResult("-9D * TypeCode.Double", -9D * TypeCode.Double)
PrintResult("10.0F * False", 10.0F * False)
PrintResult("10.0F * True", 10.0F * True)
PrintResult("10.0F * System.SByte.MinValue", 10.0F * System.SByte.MinValue)
PrintResult("10.0F * System.Byte.MaxValue", 10.0F * System.Byte.MaxValue)
PrintResult("10.0F * -3S", 10.0F * -3S)
PrintResult("10.0F * 24US", 10.0F * 24US)
PrintResult("10.0F * -5I", 10.0F * -5I)
PrintResult("10.0F * 26UI", 10.0F * 26UI)
PrintResult("10.0F * -7L", 10.0F * -7L)
PrintResult("10.0F * 28UL", 10.0F * 28UL)
PrintResult("10.0F * -9D", 10.0F * -9D)
PrintResult("10.0F * 10.0F", 10.0F * 10.0F)
PrintResult("10.0F * -11.0R", 10.0F * -11.0R)
PrintResult("10.0F * ""12""", 10.0F * "12")
PrintResult("10.0F * TypeCode.Double", 10.0F * TypeCode.Double)
PrintResult("-11.0R * False", -11.0R * False)
PrintResult("-11.0R * True", -11.0R * True)
PrintResult("-11.0R * System.SByte.MinValue", -11.0R * System.SByte.MinValue)
PrintResult("-11.0R * System.Byte.MaxValue", -11.0R * System.Byte.MaxValue)
PrintResult("-11.0R * -3S", -11.0R * -3S)
PrintResult("-11.0R * 24US", -11.0R * 24US)
PrintResult("-11.0R * -5I", -11.0R * -5I)
PrintResult("-11.0R * 26UI", -11.0R * 26UI)
PrintResult("-11.0R * -7L", -11.0R * -7L)
PrintResult("-11.0R * 28UL", -11.0R * 28UL)
PrintResult("-11.0R * -9D", -11.0R * -9D)
PrintResult("-11.0R * 10.0F", -11.0R * 10.0F)
PrintResult("-11.0R * -11.0R", -11.0R * -11.0R)
PrintResult("-11.0R * ""12""", -11.0R * "12")
PrintResult("-11.0R * TypeCode.Double", -11.0R * TypeCode.Double)
PrintResult("""12"" * False", "12" * False)
PrintResult("""12"" * True", "12" * True)
PrintResult("""12"" * System.SByte.MinValue", "12" * System.SByte.MinValue)
PrintResult("""12"" * System.Byte.MaxValue", "12" * System.Byte.MaxValue)
PrintResult("""12"" * -3S", "12" * -3S)
PrintResult("""12"" * 24US", "12" * 24US)
PrintResult("""12"" * -5I", "12" * -5I)
PrintResult("""12"" * 26UI", "12" * 26UI)
PrintResult("""12"" * -7L", "12" * -7L)
PrintResult("""12"" * 28UL", "12" * 28UL)
PrintResult("""12"" * -9D", "12" * -9D)
PrintResult("""12"" * 10.0F", "12" * 10.0F)
PrintResult("""12"" * -11.0R", "12" * -11.0R)
PrintResult("""12"" * ""12""", "12" * "12")
PrintResult("""12"" * TypeCode.Double", "12" * TypeCode.Double)
PrintResult("TypeCode.Double * False", TypeCode.Double * False)
PrintResult("TypeCode.Double * True", TypeCode.Double * True)
PrintResult("TypeCode.Double * System.SByte.MinValue", TypeCode.Double * System.SByte.MinValue)
PrintResult("TypeCode.Double * System.Byte.MaxValue", TypeCode.Double * System.Byte.MaxValue)
PrintResult("TypeCode.Double * -3S", TypeCode.Double * -3S)
PrintResult("TypeCode.Double * 24US", TypeCode.Double * 24US)
PrintResult("TypeCode.Double * -5I", TypeCode.Double * -5I)
PrintResult("TypeCode.Double * 26UI", TypeCode.Double * 26UI)
PrintResult("TypeCode.Double * -7L", TypeCode.Double * -7L)
PrintResult("TypeCode.Double * 28UL", TypeCode.Double * 28UL)
PrintResult("TypeCode.Double * -9D", TypeCode.Double * -9D)
PrintResult("TypeCode.Double * 10.0F", TypeCode.Double * 10.0F)
PrintResult("TypeCode.Double * -11.0R", TypeCode.Double * -11.0R)
PrintResult("TypeCode.Double * ""12""", TypeCode.Double * "12")
PrintResult("TypeCode.Double * TypeCode.Double", TypeCode.Double * TypeCode.Double)
PrintResult("False / False", False / False)
PrintResult("False / True", False / True)
PrintResult("False / System.SByte.MinValue", False / System.SByte.MinValue)
PrintResult("False / System.Byte.MaxValue", False / System.Byte.MaxValue)
PrintResult("False / -3S", False / -3S)
PrintResult("False / 24US", False / 24US)
PrintResult("False / -5I", False / -5I)
PrintResult("False / 26UI", False / 26UI)
PrintResult("False / -7L", False / -7L)
PrintResult("False / 28UL", False / 28UL)
PrintResult("False / -9D", False / -9D)
PrintResult("False / 10.0F", False / 10.0F)
PrintResult("False / -11.0R", False / -11.0R)
PrintResult("False / ""12""", False / "12")
PrintResult("False / TypeCode.Double", False / TypeCode.Double)
PrintResult("True / False", True / False)
PrintResult("True / True", True / True)
PrintResult("True / System.SByte.MinValue", True / System.SByte.MinValue)
PrintResult("True / System.Byte.MaxValue", True / System.Byte.MaxValue)
PrintResult("True / -3S", True / -3S)
PrintResult("True / 24US", True / 24US)
PrintResult("True / -5I", True / -5I)
PrintResult("True / 26UI", True / 26UI)
PrintResult("True / -7L", True / -7L)
PrintResult("True / 28UL", True / 28UL)
PrintResult("True / -9D", True / -9D)
PrintResult("True / 10.0F", True / 10.0F)
PrintResult("True / -11.0R", True / -11.0R)
PrintResult("True / ""12""", True / "12")
PrintResult("True / TypeCode.Double", True / TypeCode.Double)
PrintResult("System.SByte.MinValue / False", System.SByte.MinValue / False)
PrintResult("System.SByte.MinValue / True", System.SByte.MinValue / True)
PrintResult("System.SByte.MinValue / System.SByte.MinValue", System.SByte.MinValue / System.SByte.MinValue)
PrintResult("System.SByte.MinValue / System.Byte.MaxValue", System.SByte.MinValue / System.Byte.MaxValue)
PrintResult("System.SByte.MinValue / -3S", System.SByte.MinValue / -3S)
PrintResult("System.SByte.MinValue / 24US", System.SByte.MinValue / 24US)
PrintResult("System.SByte.MinValue / -5I", System.SByte.MinValue / -5I)
PrintResult("System.SByte.MinValue / 26UI", System.SByte.MinValue / 26UI)
PrintResult("System.SByte.MinValue / -7L", System.SByte.MinValue / -7L)
PrintResult("System.SByte.MinValue / 28UL", System.SByte.MinValue / 28UL)
PrintResult("System.SByte.MinValue / -9D", System.SByte.MinValue / -9D)
PrintResult("System.SByte.MinValue / 10.0F", System.SByte.MinValue / 10.0F)
PrintResult("System.SByte.MinValue / -11.0R", System.SByte.MinValue / -11.0R)
PrintResult("System.SByte.MinValue / ""12""", System.SByte.MinValue / "12")
PrintResult("System.SByte.MinValue / TypeCode.Double", System.SByte.MinValue / TypeCode.Double)
PrintResult("System.Byte.MaxValue / False", System.Byte.MaxValue / False)
PrintResult("System.Byte.MaxValue / True", System.Byte.MaxValue / True)
PrintResult("System.Byte.MaxValue / System.SByte.MinValue", System.Byte.MaxValue / System.SByte.MinValue)
PrintResult("System.Byte.MaxValue / System.Byte.MaxValue", System.Byte.MaxValue / System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue / -3S", System.Byte.MaxValue / -3S)
PrintResult("System.Byte.MaxValue / 24US", System.Byte.MaxValue / 24US)
PrintResult("System.Byte.MaxValue / -5I", System.Byte.MaxValue / -5I)
PrintResult("System.Byte.MaxValue / 26UI", System.Byte.MaxValue / 26UI)
PrintResult("System.Byte.MaxValue / -7L", System.Byte.MaxValue / -7L)
PrintResult("System.Byte.MaxValue / 28UL", System.Byte.MaxValue / 28UL)
PrintResult("System.Byte.MaxValue / -9D", System.Byte.MaxValue / -9D)
PrintResult("System.Byte.MaxValue / 10.0F", System.Byte.MaxValue / 10.0F)
PrintResult("System.Byte.MaxValue / -11.0R", System.Byte.MaxValue / -11.0R)
PrintResult("System.Byte.MaxValue / ""12""", System.Byte.MaxValue / "12")
PrintResult("System.Byte.MaxValue / TypeCode.Double", System.Byte.MaxValue / TypeCode.Double)
PrintResult("-3S / False", -3S / False)
PrintResult("-3S / True", -3S / True)
PrintResult("-3S / System.SByte.MinValue", -3S / System.SByte.MinValue)
PrintResult("-3S / System.Byte.MaxValue", -3S / System.Byte.MaxValue)
PrintResult("-3S / -3S", -3S / -3S)
PrintResult("-3S / 24US", -3S / 24US)
PrintResult("-3S / -5I", -3S / -5I)
PrintResult("-3S / 26UI", -3S / 26UI)
PrintResult("-3S / -7L", -3S / -7L)
PrintResult("-3S / 28UL", -3S / 28UL)
PrintResult("-3S / -9D", -3S / -9D)
PrintResult("-3S / 10.0F", -3S / 10.0F)
PrintResult("-3S / -11.0R", -3S / -11.0R)
PrintResult("-3S / ""12""", -3S / "12")
PrintResult("-3S / TypeCode.Double", -3S / TypeCode.Double)
PrintResult("24US / False", 24US / False)
PrintResult("24US / True", 24US / True)
PrintResult("24US / System.SByte.MinValue", 24US / System.SByte.MinValue)
PrintResult("24US / System.Byte.MaxValue", 24US / System.Byte.MaxValue)
PrintResult("24US / -3S", 24US / -3S)
PrintResult("24US / 24US", 24US / 24US)
PrintResult("24US / -5I", 24US / -5I)
PrintResult("24US / 26UI", 24US / 26UI)
PrintResult("24US / -7L", 24US / -7L)
PrintResult("24US / 28UL", 24US / 28UL)
PrintResult("24US / -9D", 24US / -9D)
PrintResult("24US / 10.0F", 24US / 10.0F)
PrintResult("24US / -11.0R", 24US / -11.0R)
PrintResult("24US / ""12""", 24US / "12")
PrintResult("24US / TypeCode.Double", 24US / TypeCode.Double)
PrintResult("-5I / False", -5I / False)
PrintResult("-5I / True", -5I / True)
PrintResult("-5I / System.SByte.MinValue", -5I / System.SByte.MinValue)
PrintResult("-5I / System.Byte.MaxValue", -5I / System.Byte.MaxValue)
PrintResult("-5I / -3S", -5I / -3S)
PrintResult("-5I / 24US", -5I / 24US)
PrintResult("-5I / -5I", -5I / -5I)
PrintResult("-5I / 26UI", -5I / 26UI)
PrintResult("-5I / -7L", -5I / -7L)
PrintResult("-5I / 28UL", -5I / 28UL)
PrintResult("-5I / -9D", -5I / -9D)
PrintResult("-5I / 10.0F", -5I / 10.0F)
PrintResult("-5I / -11.0R", -5I / -11.0R)
PrintResult("-5I / ""12""", -5I / "12")
PrintResult("-5I / TypeCode.Double", -5I / TypeCode.Double)
PrintResult("26UI / False", 26UI / False)
PrintResult("26UI / True", 26UI / True)
PrintResult("26UI / System.SByte.MinValue", 26UI / System.SByte.MinValue)
PrintResult("26UI / System.Byte.MaxValue", 26UI / System.Byte.MaxValue)
PrintResult("26UI / -3S", 26UI / -3S)
PrintResult("26UI / 24US", 26UI / 24US)
PrintResult("26UI / -5I", 26UI / -5I)
PrintResult("26UI / 26UI", 26UI / 26UI)
PrintResult("26UI / -7L", 26UI / -7L)
PrintResult("26UI / 28UL", 26UI / 28UL)
PrintResult("26UI / -9D", 26UI / -9D)
PrintResult("26UI / 10.0F", 26UI / 10.0F)
PrintResult("26UI / -11.0R", 26UI / -11.0R)
PrintResult("26UI / ""12""", 26UI / "12")
PrintResult("26UI / TypeCode.Double", 26UI / TypeCode.Double)
PrintResult("-7L / False", -7L / False)
PrintResult("-7L / True", -7L / True)
PrintResult("-7L / System.SByte.MinValue", -7L / System.SByte.MinValue)
PrintResult("-7L / System.Byte.MaxValue", -7L / System.Byte.MaxValue)
PrintResult("-7L / -3S", -7L / -3S)
PrintResult("-7L / 24US", -7L / 24US)
PrintResult("-7L / -5I", -7L / -5I)
PrintResult("-7L / 26UI", -7L / 26UI)
PrintResult("-7L / -7L", -7L / -7L)
PrintResult("-7L / 28UL", -7L / 28UL)
PrintResult("-7L / -9D", -7L / -9D)
PrintResult("-7L / 10.0F", -7L / 10.0F)
PrintResult("-7L / -11.0R", -7L / -11.0R)
PrintResult("-7L / ""12""", -7L / "12")
PrintResult("-7L / TypeCode.Double", -7L / TypeCode.Double)
PrintResult("28UL / False", 28UL / False)
PrintResult("28UL / True", 28UL / True)
PrintResult("28UL / System.SByte.MinValue", 28UL / System.SByte.MinValue)
PrintResult("28UL / System.Byte.MaxValue", 28UL / System.Byte.MaxValue)
PrintResult("28UL / -3S", 28UL / -3S)
PrintResult("28UL / 24US", 28UL / 24US)
PrintResult("28UL / -5I", 28UL / -5I)
PrintResult("28UL / 26UI", 28UL / 26UI)
PrintResult("28UL / -7L", 28UL / -7L)
PrintResult("28UL / 28UL", 28UL / 28UL)
PrintResult("28UL / -9D", 28UL / -9D)
PrintResult("28UL / 10.0F", 28UL / 10.0F)
PrintResult("28UL / -11.0R", 28UL / -11.0R)
PrintResult("28UL / ""12""", 28UL / "12")
PrintResult("28UL / TypeCode.Double", 28UL / TypeCode.Double)
PrintResult("-9D / True", -9D / True)
PrintResult("-9D / System.SByte.MinValue", -9D / System.SByte.MinValue)
PrintResult("-9D / System.Byte.MaxValue", -9D / System.Byte.MaxValue)
PrintResult("-9D / -3S", -9D / -3S)
PrintResult("-9D / 24US", -9D / 24US)
PrintResult("-9D / -5I", -9D / -5I)
PrintResult("-9D / 26UI", -9D / 26UI)
PrintResult("-9D / -7L", -9D / -7L)
PrintResult("-9D / 28UL", -9D / 28UL)
PrintResult("-9D / -9D", -9D / -9D)
PrintResult("-9D / 10.0F", -9D / 10.0F)
PrintResult("-9D / -11.0R", -9D / -11.0R)
PrintResult("-9D / ""12""", -9D / "12")
PrintResult("-9D / TypeCode.Double", -9D / TypeCode.Double)
PrintResult("10.0F / False", 10.0F / False)
PrintResult("10.0F / True", 10.0F / True)
PrintResult("10.0F / System.SByte.MinValue", 10.0F / System.SByte.MinValue)
PrintResult("10.0F / System.Byte.MaxValue", 10.0F / System.Byte.MaxValue)
PrintResult("10.0F / -3S", 10.0F / -3S)
PrintResult("10.0F / 24US", 10.0F / 24US)
PrintResult("10.0F / -5I", 10.0F / -5I)
PrintResult("10.0F / 26UI", 10.0F / 26UI)
PrintResult("10.0F / -7L", 10.0F / -7L)
PrintResult("10.0F / 28UL", 10.0F / 28UL)
PrintResult("10.0F / -9D", 10.0F / -9D)
PrintResult("10.0F / 10.0F", 10.0F / 10.0F)
PrintResult("10.0F / -11.0R", 10.0F / -11.0R)
PrintResult("10.0F / ""12""", 10.0F / "12")
PrintResult("10.0F / TypeCode.Double", 10.0F / TypeCode.Double)
PrintResult("-11.0R / False", -11.0R / False)
PrintResult("-11.0R / True", -11.0R / True)
PrintResult("-11.0R / System.SByte.MinValue", -11.0R / System.SByte.MinValue)
PrintResult("-11.0R / System.Byte.MaxValue", -11.0R / System.Byte.MaxValue)
PrintResult("-11.0R / -3S", -11.0R / -3S)
PrintResult("-11.0R / 24US", -11.0R / 24US)
PrintResult("-11.0R / -5I", -11.0R / -5I)
PrintResult("-11.0R / 26UI", -11.0R / 26UI)
PrintResult("-11.0R / -7L", -11.0R / -7L)
PrintResult("-11.0R / 28UL", -11.0R / 28UL)
PrintResult("-11.0R / -9D", -11.0R / -9D)
PrintResult("-11.0R / 10.0F", -11.0R / 10.0F)
PrintResult("-11.0R / -11.0R", -11.0R / -11.0R)
PrintResult("-11.0R / ""12""", -11.0R / "12")
PrintResult("-11.0R / TypeCode.Double", -11.0R / TypeCode.Double)
PrintResult("""12"" / False", "12" / False)
PrintResult("""12"" / True", "12" / True)
PrintResult("""12"" / System.SByte.MinValue", "12" / System.SByte.MinValue)
PrintResult("""12"" / System.Byte.MaxValue", "12" / System.Byte.MaxValue)
PrintResult("""12"" / -3S", "12" / -3S)
PrintResult("""12"" / 24US", "12" / 24US)
PrintResult("""12"" / -5I", "12" / -5I)
PrintResult("""12"" / 26UI", "12" / 26UI)
PrintResult("""12"" / -7L", "12" / -7L)
PrintResult("""12"" / 28UL", "12" / 28UL)
PrintResult("""12"" / -9D", "12" / -9D)
PrintResult("""12"" / 10.0F", "12" / 10.0F)
PrintResult("""12"" / -11.0R", "12" / -11.0R)
PrintResult("""12"" / ""12""", "12" / "12")
PrintResult("""12"" / TypeCode.Double", "12" / TypeCode.Double)
PrintResult("TypeCode.Double / False", TypeCode.Double / False)
PrintResult("TypeCode.Double / True", TypeCode.Double / True)
PrintResult("TypeCode.Double / System.SByte.MinValue", TypeCode.Double / System.SByte.MinValue)
PrintResult("TypeCode.Double / System.Byte.MaxValue", TypeCode.Double / System.Byte.MaxValue)
PrintResult("TypeCode.Double / -3S", TypeCode.Double / -3S)
PrintResult("TypeCode.Double / 24US", TypeCode.Double / 24US)
PrintResult("TypeCode.Double / -5I", TypeCode.Double / -5I)
PrintResult("TypeCode.Double / 26UI", TypeCode.Double / 26UI)
PrintResult("TypeCode.Double / -7L", TypeCode.Double / -7L)
PrintResult("TypeCode.Double / 28UL", TypeCode.Double / 28UL)
PrintResult("TypeCode.Double / -9D", TypeCode.Double / -9D)
PrintResult("TypeCode.Double / 10.0F", TypeCode.Double / 10.0F)
PrintResult("TypeCode.Double / -11.0R", TypeCode.Double / -11.0R)
PrintResult("TypeCode.Double / ""12""", TypeCode.Double / "12")
PrintResult("TypeCode.Double / TypeCode.Double", TypeCode.Double / TypeCode.Double)
PrintResult("False \ True", False \ True)
PrintResult("False \ System.SByte.MinValue", False \ System.SByte.MinValue)
PrintResult("False \ System.Byte.MaxValue", False \ System.Byte.MaxValue)
PrintResult("False \ -3S", False \ -3S)
PrintResult("False \ 24US", False \ 24US)
PrintResult("False \ -5I", False \ -5I)
PrintResult("False \ 26UI", False \ 26UI)
PrintResult("False \ -7L", False \ -7L)
PrintResult("False \ 28UL", False \ 28UL)
PrintResult("False \ -9D", False \ -9D)
PrintResult("False \ 10.0F", False \ 10.0F)
PrintResult("False \ -11.0R", False \ -11.0R)
PrintResult("False \ ""12""", False \ "12")
PrintResult("False \ TypeCode.Double", False \ TypeCode.Double)
PrintResult("True \ True", True \ True)
PrintResult("True \ System.SByte.MinValue", True \ System.SByte.MinValue)
PrintResult("True \ System.Byte.MaxValue", True \ System.Byte.MaxValue)
PrintResult("True \ -3S", True \ -3S)
PrintResult("True \ 24US", True \ 24US)
PrintResult("True \ -5I", True \ -5I)
PrintResult("True \ 26UI", True \ 26UI)
PrintResult("True \ -7L", True \ -7L)
PrintResult("True \ 28UL", True \ 28UL)
PrintResult("True \ -9D", True \ -9D)
PrintResult("True \ 10.0F", True \ 10.0F)
PrintResult("True \ -11.0R", True \ -11.0R)
PrintResult("True \ ""12""", True \ "12")
PrintResult("True \ TypeCode.Double", True \ TypeCode.Double)
PrintResult("System.SByte.MaxValue \ True", System.SByte.MaxValue \ True)
PrintResult("System.SByte.MinValue \ System.SByte.MinValue", System.SByte.MinValue \ System.SByte.MinValue)
PrintResult("System.SByte.MinValue \ System.Byte.MaxValue", System.SByte.MinValue \ System.Byte.MaxValue)
PrintResult("System.SByte.MinValue \ -3S", System.SByte.MinValue \ -3S)
PrintResult("System.SByte.MinValue \ 24US", System.SByte.MinValue \ 24US)
PrintResult("System.SByte.MinValue \ -5I", System.SByte.MinValue \ -5I)
PrintResult("System.SByte.MinValue \ 26UI", System.SByte.MinValue \ 26UI)
PrintResult("System.SByte.MinValue \ -7L", System.SByte.MinValue \ -7L)
PrintResult("System.SByte.MinValue \ 28UL", System.SByte.MinValue \ 28UL)
PrintResult("System.SByte.MinValue \ -9D", System.SByte.MinValue \ -9D)
PrintResult("System.SByte.MinValue \ 10.0F", System.SByte.MinValue \ 10.0F)
PrintResult("System.SByte.MinValue \ -11.0R", System.SByte.MinValue \ -11.0R)
PrintResult("System.SByte.MinValue \ ""12""", System.SByte.MinValue \ "12")
PrintResult("System.SByte.MinValue \ TypeCode.Double", System.SByte.MinValue \ TypeCode.Double)
PrintResult("System.Byte.MaxValue \ True", System.Byte.MaxValue \ True)
PrintResult("System.Byte.MaxValue \ System.SByte.MinValue", System.Byte.MaxValue \ System.SByte.MinValue)
PrintResult("System.Byte.MaxValue \ System.Byte.MaxValue", System.Byte.MaxValue \ System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue \ -3S", System.Byte.MaxValue \ -3S)
PrintResult("System.Byte.MaxValue \ 24US", System.Byte.MaxValue \ 24US)
PrintResult("System.Byte.MaxValue \ -5I", System.Byte.MaxValue \ -5I)
PrintResult("System.Byte.MaxValue \ 26UI", System.Byte.MaxValue \ 26UI)
PrintResult("System.Byte.MaxValue \ -7L", System.Byte.MaxValue \ -7L)
PrintResult("System.Byte.MaxValue \ 28UL", System.Byte.MaxValue \ 28UL)
PrintResult("System.Byte.MaxValue \ -9D", System.Byte.MaxValue \ -9D)
PrintResult("System.Byte.MaxValue \ 10.0F", System.Byte.MaxValue \ 10.0F)
PrintResult("System.Byte.MaxValue \ -11.0R", System.Byte.MaxValue \ -11.0R)
PrintResult("System.Byte.MaxValue \ ""12""", System.Byte.MaxValue \ "12")
PrintResult("System.Byte.MaxValue \ TypeCode.Double", System.Byte.MaxValue \ TypeCode.Double)
PrintResult("-3S \ True", -3S \ True)
PrintResult("-3S \ System.SByte.MinValue", -3S \ System.SByte.MinValue)
PrintResult("-3S \ System.Byte.MaxValue", -3S \ System.Byte.MaxValue)
PrintResult("-3S \ -3S", -3S \ -3S)
PrintResult("-3S \ 24US", -3S \ 24US)
PrintResult("-3S \ -5I", -3S \ -5I)
PrintResult("-3S \ 26UI", -3S \ 26UI)
PrintResult("-3S \ -7L", -3S \ -7L)
PrintResult("-3S \ 28UL", -3S \ 28UL)
PrintResult("-3S \ -9D", -3S \ -9D)
PrintResult("-3S \ 10.0F", -3S \ 10.0F)
PrintResult("-3S \ -11.0R", -3S \ -11.0R)
PrintResult("-3S \ ""12""", -3S \ "12")
PrintResult("-3S \ TypeCode.Double", -3S \ TypeCode.Double)
PrintResult("24US \ True", 24US \ True)
PrintResult("24US \ System.SByte.MinValue", 24US \ System.SByte.MinValue)
PrintResult("24US \ System.Byte.MaxValue", 24US \ System.Byte.MaxValue)
PrintResult("24US \ -3S", 24US \ -3S)
PrintResult("24US \ 24US", 24US \ 24US)
PrintResult("24US \ -5I", 24US \ -5I)
PrintResult("24US \ 26UI", 24US \ 26UI)
PrintResult("24US \ -7L", 24US \ -7L)
PrintResult("24US \ 28UL", 24US \ 28UL)
PrintResult("24US \ -9D", 24US \ -9D)
PrintResult("24US \ 10.0F", 24US \ 10.0F)
PrintResult("24US \ -11.0R", 24US \ -11.0R)
PrintResult("24US \ ""12""", 24US \ "12")
PrintResult("24US \ TypeCode.Double", 24US \ TypeCode.Double)
PrintResult("-5I \ True", -5I \ True)
PrintResult("-5I \ System.SByte.MinValue", -5I \ System.SByte.MinValue)
PrintResult("-5I \ System.Byte.MaxValue", -5I \ System.Byte.MaxValue)
PrintResult("-5I \ -3S", -5I \ -3S)
PrintResult("-5I \ 24US", -5I \ 24US)
PrintResult("-5I \ -5I", -5I \ -5I)
PrintResult("-5I \ 26UI", -5I \ 26UI)
PrintResult("-5I \ -7L", -5I \ -7L)
PrintResult("-5I \ 28UL", -5I \ 28UL)
PrintResult("-5I \ -9D", -5I \ -9D)
PrintResult("-5I \ 10.0F", -5I \ 10.0F)
PrintResult("-5I \ -11.0R", -5I \ -11.0R)
PrintResult("-5I \ ""12""", -5I \ "12")
PrintResult("-5I \ TypeCode.Double", -5I \ TypeCode.Double)
PrintResult("26UI \ True", 26UI \ True)
PrintResult("26UI \ System.SByte.MinValue", 26UI \ System.SByte.MinValue)
PrintResult("26UI \ System.Byte.MaxValue", 26UI \ System.Byte.MaxValue)
PrintResult("26UI \ -3S", 26UI \ -3S)
PrintResult("26UI \ 24US", 26UI \ 24US)
PrintResult("26UI \ -5I", 26UI \ -5I)
PrintResult("26UI \ 26UI", 26UI \ 26UI)
PrintResult("26UI \ -7L", 26UI \ -7L)
PrintResult("26UI \ 28UL", 26UI \ 28UL)
PrintResult("26UI \ -9D", 26UI \ -9D)
PrintResult("26UI \ 10.0F", 26UI \ 10.0F)
PrintResult("26UI \ -11.0R", 26UI \ -11.0R)
PrintResult("26UI \ ""12""", 26UI \ "12")
PrintResult("26UI \ TypeCode.Double", 26UI \ TypeCode.Double)
PrintResult("-7L \ True", -7L \ True)
PrintResult("-7L \ System.SByte.MinValue", -7L \ System.SByte.MinValue)
PrintResult("-7L \ System.Byte.MaxValue", -7L \ System.Byte.MaxValue)
PrintResult("-7L \ -3S", -7L \ -3S)
PrintResult("-7L \ 24US", -7L \ 24US)
PrintResult("-7L \ -5I", -7L \ -5I)
PrintResult("-7L \ 26UI", -7L \ 26UI)
PrintResult("-7L \ -7L", -7L \ -7L)
PrintResult("-7L \ 28UL", -7L \ 28UL)
PrintResult("-7L \ -9D", -7L \ -9D)
PrintResult("-7L \ 10.0F", -7L \ 10.0F)
PrintResult("-7L \ -11.0R", -7L \ -11.0R)
PrintResult("-7L \ ""12""", -7L \ "12")
PrintResult("-7L \ TypeCode.Double", -7L \ TypeCode.Double)
PrintResult("28UL \ True", 28UL \ True)
PrintResult("28UL \ System.SByte.MinValue", 28UL \ System.SByte.MinValue)
PrintResult("28UL \ System.Byte.MaxValue", 28UL \ System.Byte.MaxValue)
PrintResult("28UL \ -3S", 28UL \ -3S)
PrintResult("28UL \ 24US", 28UL \ 24US)
PrintResult("28UL \ -5I", 28UL \ -5I)
PrintResult("28UL \ 26UI", 28UL \ 26UI)
PrintResult("28UL \ -7L", 28UL \ -7L)
PrintResult("28UL \ 28UL", 28UL \ 28UL)
PrintResult("28UL \ -9D", 28UL \ -9D)
PrintResult("28UL \ 10.0F", 28UL \ 10.0F)
PrintResult("28UL \ -11.0R", 28UL \ -11.0R)
PrintResult("28UL \ ""12""", 28UL \ "12")
PrintResult("28UL \ TypeCode.Double", 28UL \ TypeCode.Double)
PrintResult("-9D \ True", -9D \ True)
PrintResult("-9D \ System.SByte.MinValue", -9D \ System.SByte.MinValue)
PrintResult("-9D \ System.Byte.MaxValue", -9D \ System.Byte.MaxValue)
PrintResult("-9D \ -3S", -9D \ -3S)
PrintResult("-9D \ 24US", -9D \ 24US)
PrintResult("-9D \ -5I", -9D \ -5I)
PrintResult("-9D \ 26UI", -9D \ 26UI)
PrintResult("-9D \ -7L", -9D \ -7L)
PrintResult("-9D \ 28UL", -9D \ 28UL)
PrintResult("-9D \ -9D", -9D \ -9D)
PrintResult("-9D \ 10.0F", -9D \ 10.0F)
PrintResult("-9D \ -11.0R", -9D \ -11.0R)
PrintResult("-9D \ ""12""", -9D \ "12")
PrintResult("-9D \ TypeCode.Double", -9D \ TypeCode.Double)
PrintResult("10.0F \ True", 10.0F \ True)
PrintResult("10.0F \ System.SByte.MinValue", 10.0F \ System.SByte.MinValue)
PrintResult("10.0F \ System.Byte.MaxValue", 10.0F \ System.Byte.MaxValue)
PrintResult("10.0F \ -3S", 10.0F \ -3S)
PrintResult("10.0F \ 24US", 10.0F \ 24US)
PrintResult("10.0F \ -5I", 10.0F \ -5I)
PrintResult("10.0F \ 26UI", 10.0F \ 26UI)
PrintResult("10.0F \ -7L", 10.0F \ -7L)
PrintResult("10.0F \ 28UL", 10.0F \ 28UL)
PrintResult("10.0F \ -9D", 10.0F \ -9D)
PrintResult("10.0F \ 10.0F", 10.0F \ 10.0F)
PrintResult("10.0F \ -11.0R", 10.0F \ -11.0R)
PrintResult("10.0F \ ""12""", 10.0F \ "12")
PrintResult("10.0F \ TypeCode.Double", 10.0F \ TypeCode.Double)
PrintResult("-11.0R \ True", -11.0R \ True)
PrintResult("-11.0R \ System.SByte.MinValue", -11.0R \ System.SByte.MinValue)
PrintResult("-11.0R \ System.Byte.MaxValue", -11.0R \ System.Byte.MaxValue)
PrintResult("-11.0R \ -3S", -11.0R \ -3S)
PrintResult("-11.0R \ 24US", -11.0R \ 24US)
PrintResult("-11.0R \ -5I", -11.0R \ -5I)
PrintResult("-11.0R \ 26UI", -11.0R \ 26UI)
PrintResult("-11.0R \ -7L", -11.0R \ -7L)
PrintResult("-11.0R \ 28UL", -11.0R \ 28UL)
PrintResult("-11.0R \ -9D", -11.0R \ -9D)
PrintResult("-11.0R \ 10.0F", -11.0R \ 10.0F)
PrintResult("-11.0R \ -11.0R", -11.0R \ -11.0R)
PrintResult("-11.0R \ ""12""", -11.0R \ "12")
PrintResult("-11.0R \ TypeCode.Double", -11.0R \ TypeCode.Double)
PrintResult("""12"" \ True", "12" \ True)
PrintResult("""12"" \ System.SByte.MinValue", "12" \ System.SByte.MinValue)
PrintResult("""12"" \ System.Byte.MaxValue", "12" \ System.Byte.MaxValue)
PrintResult("""12"" \ -3S", "12" \ -3S)
PrintResult("""12"" \ 24US", "12" \ 24US)
PrintResult("""12"" \ -5I", "12" \ -5I)
PrintResult("""12"" \ 26UI", "12" \ 26UI)
PrintResult("""12"" \ -7L", "12" \ -7L)
PrintResult("""12"" \ 28UL", "12" \ 28UL)
PrintResult("""12"" \ -9D", "12" \ -9D)
PrintResult("""12"" \ 10.0F", "12" \ 10.0F)
PrintResult("""12"" \ -11.0R", "12" \ -11.0R)
PrintResult("""12"" \ ""12""", "12" \ "12")
PrintResult("""12"" \ TypeCode.Double", "12" \ TypeCode.Double)
PrintResult("TypeCode.Double \ True", TypeCode.Double \ True)
PrintResult("TypeCode.Double \ System.SByte.MinValue", TypeCode.Double \ System.SByte.MinValue)
PrintResult("TypeCode.Double \ System.Byte.MaxValue", TypeCode.Double \ System.Byte.MaxValue)
PrintResult("TypeCode.Double \ -3S", TypeCode.Double \ -3S)
PrintResult("TypeCode.Double \ 24US", TypeCode.Double \ 24US)
PrintResult("TypeCode.Double \ -5I", TypeCode.Double \ -5I)
PrintResult("TypeCode.Double \ 26UI", TypeCode.Double \ 26UI)
PrintResult("TypeCode.Double \ -7L", TypeCode.Double \ -7L)
PrintResult("TypeCode.Double \ 28UL", TypeCode.Double \ 28UL)
PrintResult("TypeCode.Double \ -9D", TypeCode.Double \ -9D)
PrintResult("TypeCode.Double \ 10.0F", TypeCode.Double \ 10.0F)
PrintResult("TypeCode.Double \ -11.0R", TypeCode.Double \ -11.0R)
PrintResult("TypeCode.Double \ ""12""", TypeCode.Double \ "12")
PrintResult("TypeCode.Double \ TypeCode.Double", TypeCode.Double \ TypeCode.Double)
PrintResult("False Mod True", False Mod True)
PrintResult("False Mod System.SByte.MinValue", False Mod System.SByte.MinValue)
PrintResult("False Mod System.Byte.MaxValue", False Mod System.Byte.MaxValue)
PrintResult("False Mod -3S", False Mod -3S)
PrintResult("False Mod 24US", False Mod 24US)
PrintResult("False Mod -5I", False Mod -5I)
PrintResult("False Mod 26UI", False Mod 26UI)
PrintResult("False Mod -7L", False Mod -7L)
PrintResult("False Mod 28UL", False Mod 28UL)
PrintResult("False Mod -9D", False Mod -9D)
PrintResult("False Mod 10.0F", False Mod 10.0F)
PrintResult("False Mod -11.0R", False Mod -11.0R)
PrintResult("False Mod ""12""", False Mod "12")
PrintResult("False Mod TypeCode.Double", False Mod TypeCode.Double)
PrintResult("True Mod True", True Mod True)
PrintResult("True Mod System.SByte.MinValue", True Mod System.SByte.MinValue)
PrintResult("True Mod System.Byte.MaxValue", True Mod System.Byte.MaxValue)
PrintResult("True Mod -3S", True Mod -3S)
PrintResult("True Mod 24US", True Mod 24US)
PrintResult("True Mod -5I", True Mod -5I)
PrintResult("True Mod 26UI", True Mod 26UI)
PrintResult("True Mod -7L", True Mod -7L)
PrintResult("True Mod 28UL", True Mod 28UL)
PrintResult("True Mod -9D", True Mod -9D)
PrintResult("True Mod 10.0F", True Mod 10.0F)
PrintResult("True Mod -11.0R", True Mod -11.0R)
PrintResult("True Mod ""12""", True Mod "12")
PrintResult("True Mod TypeCode.Double", True Mod TypeCode.Double)
PrintResult("System.SByte.MinValue Mod True", System.SByte.MinValue Mod True)
PrintResult("System.SByte.MinValue Mod System.SByte.MinValue", System.SByte.MinValue Mod System.SByte.MinValue)
PrintResult("System.SByte.MinValue Mod System.Byte.MaxValue", System.SByte.MinValue Mod System.Byte.MaxValue)
PrintResult("System.SByte.MinValue Mod -3S", System.SByte.MinValue Mod -3S)
PrintResult("System.SByte.MinValue Mod 24US", System.SByte.MinValue Mod 24US)
PrintResult("System.SByte.MinValue Mod -5I", System.SByte.MinValue Mod -5I)
PrintResult("System.SByte.MinValue Mod 26UI", System.SByte.MinValue Mod 26UI)
PrintResult("System.SByte.MinValue Mod -7L", System.SByte.MinValue Mod -7L)
PrintResult("System.SByte.MinValue Mod 28UL", System.SByte.MinValue Mod 28UL)
PrintResult("System.SByte.MinValue Mod -9D", System.SByte.MinValue Mod -9D)
PrintResult("System.SByte.MinValue Mod 10.0F", System.SByte.MinValue Mod 10.0F)
PrintResult("System.SByte.MinValue Mod -11.0R", System.SByte.MinValue Mod -11.0R)
PrintResult("System.SByte.MinValue Mod ""12""", System.SByte.MinValue Mod "12")
PrintResult("System.SByte.MinValue Mod TypeCode.Double", System.SByte.MinValue Mod TypeCode.Double)
PrintResult("System.Byte.MaxValue Mod True", System.Byte.MaxValue Mod True)
PrintResult("System.Byte.MaxValue Mod System.SByte.MinValue", System.Byte.MaxValue Mod System.SByte.MinValue)
PrintResult("System.Byte.MaxValue Mod System.Byte.MaxValue", System.Byte.MaxValue Mod System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue Mod -3S", System.Byte.MaxValue Mod -3S)
PrintResult("System.Byte.MaxValue Mod 24US", System.Byte.MaxValue Mod 24US)
PrintResult("System.Byte.MaxValue Mod -5I", System.Byte.MaxValue Mod -5I)
PrintResult("System.Byte.MaxValue Mod 26UI", System.Byte.MaxValue Mod 26UI)
PrintResult("System.Byte.MaxValue Mod -7L", System.Byte.MaxValue Mod -7L)
PrintResult("System.Byte.MaxValue Mod 28UL", System.Byte.MaxValue Mod 28UL)
PrintResult("System.Byte.MaxValue Mod -9D", System.Byte.MaxValue Mod -9D)
PrintResult("System.Byte.MaxValue Mod 10.0F", System.Byte.MaxValue Mod 10.0F)
PrintResult("System.Byte.MaxValue Mod -11.0R", System.Byte.MaxValue Mod -11.0R)
PrintResult("System.Byte.MaxValue Mod ""12""", System.Byte.MaxValue Mod "12")
PrintResult("System.Byte.MaxValue Mod TypeCode.Double", System.Byte.MaxValue Mod TypeCode.Double)
PrintResult("-3S Mod True", -3S Mod True)
PrintResult("-3S Mod System.SByte.MinValue", -3S Mod System.SByte.MinValue)
PrintResult("-3S Mod System.Byte.MaxValue", -3S Mod System.Byte.MaxValue)
PrintResult("-3S Mod -3S", -3S Mod -3S)
PrintResult("-3S Mod 24US", -3S Mod 24US)
PrintResult("-3S Mod -5I", -3S Mod -5I)
PrintResult("-3S Mod 26UI", -3S Mod 26UI)
PrintResult("-3S Mod -7L", -3S Mod -7L)
PrintResult("-3S Mod 28UL", -3S Mod 28UL)
PrintResult("-3S Mod -9D", -3S Mod -9D)
PrintResult("-3S Mod 10.0F", -3S Mod 10.0F)
PrintResult("-3S Mod -11.0R", -3S Mod -11.0R)
PrintResult("-3S Mod ""12""", -3S Mod "12")
PrintResult("-3S Mod TypeCode.Double", -3S Mod TypeCode.Double)
PrintResult("24US Mod True", 24US Mod True)
PrintResult("24US Mod System.SByte.MinValue", 24US Mod System.SByte.MinValue)
PrintResult("24US Mod System.Byte.MaxValue", 24US Mod System.Byte.MaxValue)
PrintResult("24US Mod -3S", 24US Mod -3S)
PrintResult("24US Mod 24US", 24US Mod 24US)
PrintResult("24US Mod -5I", 24US Mod -5I)
PrintResult("24US Mod 26UI", 24US Mod 26UI)
PrintResult("24US Mod -7L", 24US Mod -7L)
PrintResult("24US Mod 28UL", 24US Mod 28UL)
PrintResult("24US Mod -9D", 24US Mod -9D)
PrintResult("24US Mod 10.0F", 24US Mod 10.0F)
PrintResult("24US Mod -11.0R", 24US Mod -11.0R)
PrintResult("24US Mod ""12""", 24US Mod "12")
PrintResult("24US Mod TypeCode.Double", 24US Mod TypeCode.Double)
PrintResult("-5I Mod True", -5I Mod True)
PrintResult("-5I Mod System.SByte.MinValue", -5I Mod System.SByte.MinValue)
PrintResult("-5I Mod System.Byte.MaxValue", -5I Mod System.Byte.MaxValue)
PrintResult("-5I Mod -3S", -5I Mod -3S)
PrintResult("-5I Mod 24US", -5I Mod 24US)
PrintResult("-5I Mod -5I", -5I Mod -5I)
PrintResult("-5I Mod 26UI", -5I Mod 26UI)
PrintResult("-5I Mod -7L", -5I Mod -7L)
PrintResult("-5I Mod 28UL", -5I Mod 28UL)
PrintResult("-5I Mod -9D", -5I Mod -9D)
PrintResult("-5I Mod 10.0F", -5I Mod 10.0F)
PrintResult("-5I Mod -11.0R", -5I Mod -11.0R)
PrintResult("-5I Mod ""12""", -5I Mod "12")
PrintResult("-5I Mod TypeCode.Double", -5I Mod TypeCode.Double)
PrintResult("26UI Mod True", 26UI Mod True)
PrintResult("26UI Mod System.SByte.MinValue", 26UI Mod System.SByte.MinValue)
PrintResult("26UI Mod System.Byte.MaxValue", 26UI Mod System.Byte.MaxValue)
PrintResult("26UI Mod -3S", 26UI Mod -3S)
PrintResult("26UI Mod 24US", 26UI Mod 24US)
PrintResult("26UI Mod -5I", 26UI Mod -5I)
PrintResult("26UI Mod 26UI", 26UI Mod 26UI)
PrintResult("26UI Mod -7L", 26UI Mod -7L)
PrintResult("26UI Mod 28UL", 26UI Mod 28UL)
PrintResult("26UI Mod -9D", 26UI Mod -9D)
PrintResult("26UI Mod 10.0F", 26UI Mod 10.0F)
PrintResult("26UI Mod -11.0R", 26UI Mod -11.0R)
PrintResult("26UI Mod ""12""", 26UI Mod "12")
PrintResult("26UI Mod TypeCode.Double", 26UI Mod TypeCode.Double)
PrintResult("-7L Mod True", -7L Mod True)
PrintResult("-7L Mod System.SByte.MinValue", -7L Mod System.SByte.MinValue)
PrintResult("-7L Mod System.Byte.MaxValue", -7L Mod System.Byte.MaxValue)
PrintResult("-7L Mod -3S", -7L Mod -3S)
PrintResult("-7L Mod 24US", -7L Mod 24US)
PrintResult("-7L Mod -5I", -7L Mod -5I)
PrintResult("-7L Mod 26UI", -7L Mod 26UI)
PrintResult("-7L Mod -7L", -7L Mod -7L)
PrintResult("-7L Mod 28UL", -7L Mod 28UL)
PrintResult("-7L Mod -9D", -7L Mod -9D)
PrintResult("-7L Mod 10.0F", -7L Mod 10.0F)
PrintResult("-7L Mod -11.0R", -7L Mod -11.0R)
PrintResult("-7L Mod ""12""", -7L Mod "12")
PrintResult("-7L Mod TypeCode.Double", -7L Mod TypeCode.Double)
PrintResult("28UL Mod True", 28UL Mod True)
PrintResult("28UL Mod System.SByte.MinValue", 28UL Mod System.SByte.MinValue)
PrintResult("28UL Mod System.Byte.MaxValue", 28UL Mod System.Byte.MaxValue)
PrintResult("28UL Mod -3S", 28UL Mod -3S)
PrintResult("28UL Mod 24US", 28UL Mod 24US)
PrintResult("28UL Mod -5I", 28UL Mod -5I)
PrintResult("28UL Mod 26UI", 28UL Mod 26UI)
PrintResult("28UL Mod -7L", 28UL Mod -7L)
PrintResult("28UL Mod 28UL", 28UL Mod 28UL)
PrintResult("28UL Mod -9D", 28UL Mod -9D)
PrintResult("28UL Mod 10.0F", 28UL Mod 10.0F)
PrintResult("28UL Mod -11.0R", 28UL Mod -11.0R)
PrintResult("28UL Mod ""12""", 28UL Mod "12")
PrintResult("28UL Mod TypeCode.Double", 28UL Mod TypeCode.Double)
PrintResult("-9D Mod True", -9D Mod True)
PrintResult("-9D Mod System.SByte.MinValue", -9D Mod System.SByte.MinValue)
PrintResult("-9D Mod System.Byte.MaxValue", -9D Mod System.Byte.MaxValue)
PrintResult("-9D Mod -3S", -9D Mod -3S)
PrintResult("-9D Mod 24US", -9D Mod 24US)
PrintResult("-9D Mod -5I", -9D Mod -5I)
PrintResult("-9D Mod 26UI", -9D Mod 26UI)
PrintResult("-9D Mod -7L", -9D Mod -7L)
PrintResult("-9D Mod 28UL", -9D Mod 28UL)
PrintResult("-9D Mod -9D", -9D Mod -9D)
PrintResult("-9D Mod 10.0F", -9D Mod 10.0F)
PrintResult("-9D Mod -11.0R", -9D Mod -11.0R)
PrintResult("-9D Mod ""12""", -9D Mod "12")
PrintResult("-9D Mod TypeCode.Double", -9D Mod TypeCode.Double)
PrintResult("10.0F Mod True", 10.0F Mod True)
PrintResult("10.0F Mod System.SByte.MinValue", 10.0F Mod System.SByte.MinValue)
PrintResult("10.0F Mod System.Byte.MaxValue", 10.0F Mod System.Byte.MaxValue)
PrintResult("10.0F Mod -3S", 10.0F Mod -3S)
PrintResult("10.0F Mod 24US", 10.0F Mod 24US)
PrintResult("10.0F Mod -5I", 10.0F Mod -5I)
PrintResult("10.0F Mod 26UI", 10.0F Mod 26UI)
PrintResult("10.0F Mod -7L", 10.0F Mod -7L)
PrintResult("10.0F Mod 28UL", 10.0F Mod 28UL)
PrintResult("10.0F Mod -9D", 10.0F Mod -9D)
PrintResult("10.0F Mod 10.0F", 10.0F Mod 10.0F)
PrintResult("10.0F Mod -11.0R", 10.0F Mod -11.0R)
PrintResult("10.0F Mod ""12""", 10.0F Mod "12")
PrintResult("10.0F Mod TypeCode.Double", 10.0F Mod TypeCode.Double)
PrintResult("-11.0R Mod True", -11.0R Mod True)
PrintResult("-11.0R Mod System.SByte.MinValue", -11.0R Mod System.SByte.MinValue)
PrintResult("-11.0R Mod System.Byte.MaxValue", -11.0R Mod System.Byte.MaxValue)
PrintResult("-11.0R Mod -3S", -11.0R Mod -3S)
PrintResult("-11.0R Mod 24US", -11.0R Mod 24US)
PrintResult("-11.0R Mod -5I", -11.0R Mod -5I)
PrintResult("-11.0R Mod 26UI", -11.0R Mod 26UI)
PrintResult("-11.0R Mod -7L", -11.0R Mod -7L)
PrintResult("-11.0R Mod 28UL", -11.0R Mod 28UL)
PrintResult("-11.0R Mod -9D", -11.0R Mod -9D)
PrintResult("-11.0R Mod 10.0F", -11.0R Mod 10.0F)
PrintResult("-11.0R Mod -11.0R", -11.0R Mod -11.0R)
PrintResult("-11.0R Mod ""12""", -11.0R Mod "12")
PrintResult("-11.0R Mod TypeCode.Double", -11.0R Mod TypeCode.Double)
PrintResult("""12"" Mod True", "12" Mod True)
PrintResult("""12"" Mod System.SByte.MinValue", "12" Mod System.SByte.MinValue)
PrintResult("""12"" Mod System.Byte.MaxValue", "12" Mod System.Byte.MaxValue)
PrintResult("""12"" Mod -3S", "12" Mod -3S)
PrintResult("""12"" Mod 24US", "12" Mod 24US)
PrintResult("""12"" Mod -5I", "12" Mod -5I)
PrintResult("""12"" Mod 26UI", "12" Mod 26UI)
PrintResult("""12"" Mod -7L", "12" Mod -7L)
PrintResult("""12"" Mod 28UL", "12" Mod 28UL)
PrintResult("""12"" Mod -9D", "12" Mod -9D)
PrintResult("""12"" Mod 10.0F", "12" Mod 10.0F)
PrintResult("""12"" Mod -11.0R", "12" Mod -11.0R)
PrintResult("""12"" Mod ""12""", "12" Mod "12")
PrintResult("""12"" Mod TypeCode.Double", "12" Mod TypeCode.Double)
PrintResult("TypeCode.Double Mod True", TypeCode.Double Mod True)
PrintResult("TypeCode.Double Mod System.SByte.MinValue", TypeCode.Double Mod System.SByte.MinValue)
PrintResult("TypeCode.Double Mod System.Byte.MaxValue", TypeCode.Double Mod System.Byte.MaxValue)
PrintResult("TypeCode.Double Mod -3S", TypeCode.Double Mod -3S)
PrintResult("TypeCode.Double Mod 24US", TypeCode.Double Mod 24US)
PrintResult("TypeCode.Double Mod -5I", TypeCode.Double Mod -5I)
PrintResult("TypeCode.Double Mod 26UI", TypeCode.Double Mod 26UI)
PrintResult("TypeCode.Double Mod -7L", TypeCode.Double Mod -7L)
PrintResult("TypeCode.Double Mod 28UL", TypeCode.Double Mod 28UL)
PrintResult("TypeCode.Double Mod -9D", TypeCode.Double Mod -9D)
PrintResult("TypeCode.Double Mod 10.0F", TypeCode.Double Mod 10.0F)
PrintResult("TypeCode.Double Mod -11.0R", TypeCode.Double Mod -11.0R)
PrintResult("TypeCode.Double Mod ""12""", TypeCode.Double Mod "12")
PrintResult("TypeCode.Double Mod TypeCode.Double", TypeCode.Double Mod TypeCode.Double)
PrintResult("False ^ False", False ^ False)
PrintResult("False ^ True", False ^ True)
PrintResult("False ^ System.SByte.MinValue", False ^ System.SByte.MinValue)
PrintResult("False ^ System.Byte.MaxValue", False ^ System.Byte.MaxValue)
PrintResult("False ^ -3S", False ^ -3S)
PrintResult("False ^ 24US", False ^ 24US)
PrintResult("False ^ -5I", False ^ -5I)
PrintResult("False ^ 26UI", False ^ 26UI)
PrintResult("False ^ -7L", False ^ -7L)
PrintResult("False ^ 28UL", False ^ 28UL)
PrintResult("False ^ -9D", False ^ -9D)
PrintResult("False ^ 10.0F", False ^ 10.0F)
PrintResult("False ^ -11.0R", False ^ -11.0R)
PrintResult("False ^ ""12""", False ^ "12")
PrintResult("False ^ TypeCode.Double", False ^ TypeCode.Double)
PrintResult("True ^ False", True ^ False)
PrintResult("True ^ True", True ^ True)
PrintResult("True ^ System.SByte.MinValue", True ^ System.SByte.MinValue)
PrintResult("True ^ System.Byte.MaxValue", True ^ System.Byte.MaxValue)
PrintResult("True ^ -3S", True ^ -3S)
PrintResult("True ^ 24US", True ^ 24US)
PrintResult("True ^ -5I", True ^ -5I)
PrintResult("True ^ 26UI", True ^ 26UI)
PrintResult("True ^ -7L", True ^ -7L)
PrintResult("True ^ 28UL", True ^ 28UL)
PrintResult("True ^ -9D", True ^ -9D)
PrintResult("True ^ 10.0F", True ^ 10.0F)
PrintResult("True ^ -11.0R", True ^ -11.0R)
PrintResult("True ^ ""12""", True ^ "12")
PrintResult("True ^ TypeCode.Double", True ^ TypeCode.Double)
PrintResult("System.SByte.MinValue ^ False", System.SByte.MinValue ^ False)
PrintResult("System.SByte.MinValue ^ True", System.SByte.MinValue ^ True)
PrintResult("System.SByte.MinValue ^ System.SByte.MinValue", System.SByte.MinValue ^ System.SByte.MinValue)
PrintResult("System.SByte.MinValue ^ System.Byte.MaxValue", System.SByte.MinValue ^ System.Byte.MaxValue)
PrintResult("System.SByte.MinValue ^ -3S", System.SByte.MinValue ^ -3S)
PrintResult("System.SByte.MinValue ^ 24US", System.SByte.MinValue ^ 24US)
PrintResult("System.SByte.MinValue ^ -5I", System.SByte.MinValue ^ -5I)
PrintResult("System.SByte.MinValue ^ 26UI", System.SByte.MinValue ^ 26UI)
PrintResult("System.SByte.MinValue ^ -7L", System.SByte.MinValue ^ -7L)
PrintResult("System.SByte.MinValue ^ 28UL", System.SByte.MinValue ^ 28UL)
PrintResult("System.SByte.MinValue ^ -9D", System.SByte.MinValue ^ -9D)
PrintResult("System.SByte.MinValue ^ 10.0F", System.SByte.MinValue ^ 10.0F)
PrintResult("System.SByte.MinValue ^ -11.0R", System.SByte.MinValue ^ -11.0R)
PrintResult("System.SByte.MinValue ^ ""12""", System.SByte.MinValue ^ "12")
PrintResult("System.SByte.MinValue ^ TypeCode.Double", System.SByte.MinValue ^ TypeCode.Double)
PrintResult("System.Byte.MaxValue ^ False", System.Byte.MaxValue ^ False)
PrintResult("System.Byte.MaxValue ^ True", System.Byte.MaxValue ^ True)
PrintResult("System.Byte.MaxValue ^ System.SByte.MinValue", System.Byte.MaxValue ^ System.SByte.MinValue)
PrintResult("System.Byte.MaxValue ^ System.Byte.MaxValue", System.Byte.MaxValue ^ System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue ^ -3S", System.Byte.MaxValue ^ -3S)
PrintResult("System.Byte.MaxValue ^ 24US", System.Byte.MaxValue ^ 24US)
PrintResult("System.Byte.MaxValue ^ -5I", System.Byte.MaxValue ^ -5I)
PrintResult("System.Byte.MaxValue ^ 26UI", System.Byte.MaxValue ^ 26UI)
PrintResult("System.Byte.MaxValue ^ -7L", System.Byte.MaxValue ^ -7L)
PrintResult("System.Byte.MaxValue ^ 28UL", System.Byte.MaxValue ^ 28UL)
PrintResult("System.Byte.MaxValue ^ -9D", System.Byte.MaxValue ^ -9D)
PrintResult("System.Byte.MaxValue ^ 10.0F", System.Byte.MaxValue ^ 10.0F)
PrintResult("System.Byte.MaxValue ^ -11.0R", System.Byte.MaxValue ^ -11.0R)
PrintResult("System.Byte.MaxValue ^ ""12""", System.Byte.MaxValue ^ "12")
PrintResult("System.Byte.MaxValue ^ TypeCode.Double", System.Byte.MaxValue ^ TypeCode.Double)
PrintResult("-3S ^ False", -3S ^ False)
PrintResult("-3S ^ True", -3S ^ True)
PrintResult("-3S ^ System.SByte.MinValue", -3S ^ System.SByte.MinValue)
PrintResult("-3S ^ System.Byte.MaxValue", -3S ^ System.Byte.MaxValue)
PrintResult("-3S ^ -3S", -3S ^ -3S)
PrintResult("-3S ^ 24US", -3S ^ 24US)
PrintResult("-3S ^ -5I", -3S ^ -5I)
PrintResult("-3S ^ 26UI", -3S ^ 26UI)
PrintResult("-3S ^ -7L", -3S ^ -7L)
PrintResult("-3S ^ 28UL", -3S ^ 28UL)
PrintResult("-3S ^ -9D", -3S ^ -9D)
PrintResult("-3S ^ 10.0F", -3S ^ 10.0F)
PrintResult("-3S ^ -11.0R", -3S ^ -11.0R)
PrintResult("-3S ^ ""12""", -3S ^ "12")
PrintResult("-3S ^ TypeCode.Double", -3S ^ TypeCode.Double)
PrintResult("24US ^ False", 24US ^ False)
PrintResult("24US ^ True", 24US ^ True)
PrintResult("24US ^ System.SByte.MinValue", 24US ^ System.SByte.MinValue)
PrintResult("24US ^ System.Byte.MaxValue", 24US ^ System.Byte.MaxValue)
PrintResult("24US ^ -3S", 24US ^ -3S)
PrintResult("24US ^ 24US", 24US ^ 24US)
PrintResult("24US ^ -5I", 24US ^ -5I)
PrintResult("24US ^ 26UI", 24US ^ 26UI)
PrintResult("24US ^ -7L", 24US ^ -7L)
PrintResult("24US ^ 28UL", 24US ^ 28UL)
PrintResult("24US ^ -9D", 24US ^ -9D)
PrintResult("24US ^ 10.0F", 24US ^ 10.0F)
PrintResult("24US ^ -11.0R", 24US ^ -11.0R)
PrintResult("24US ^ ""12""", 24US ^ "12")
PrintResult("24US ^ TypeCode.Double", 24US ^ TypeCode.Double)
PrintResult("-5I ^ False", -5I ^ False)
PrintResult("-5I ^ True", -5I ^ True)
PrintResult("-5I ^ System.SByte.MinValue", -5I ^ System.SByte.MinValue)
PrintResult("-5I ^ System.Byte.MaxValue", -5I ^ System.Byte.MaxValue)
PrintResult("-5I ^ -3S", -5I ^ -3S)
PrintResult("-5I ^ 24US", -5I ^ 24US)
PrintResult("-5I ^ -5I", -5I ^ -5I)
PrintResult("-5I ^ 26UI", -5I ^ 26UI)
PrintResult("-5I ^ -7L", -5I ^ -7L)
PrintResult("-5I ^ 28UL", -5I ^ 28UL)
PrintResult("-5I ^ -9D", -5I ^ -9D)
PrintResult("-5I ^ 10.0F", -5I ^ 10.0F)
PrintResult("-5I ^ -11.0R", -5I ^ -11.0R)
PrintResult("-5I ^ ""12""", -5I ^ "12")
PrintResult("-5I ^ TypeCode.Double", -5I ^ TypeCode.Double)
PrintResult("26UI ^ False", 26UI ^ False)
PrintResult("26UI ^ True", 26UI ^ True)
PrintResult("26UI ^ System.SByte.MinValue", 26UI ^ System.SByte.MinValue)
PrintResult("26UI ^ System.Byte.MaxValue", 26UI ^ System.Byte.MaxValue)
PrintResult("26UI ^ -3S", 26UI ^ -3S)
PrintResult("26UI ^ 24US", 26UI ^ 24US)
PrintResult("26UI ^ -5I", 26UI ^ -5I)
PrintResult("26UI ^ 26UI", 26UI ^ 26UI)
PrintResult("26UI ^ -7L", 26UI ^ -7L)
PrintResult("26UI ^ 28UL", 26UI ^ 28UL)
PrintResult("26UI ^ -9D", 26UI ^ -9D)
PrintResult("26UI ^ 10.0F", 26UI ^ 10.0F)
PrintResult("26UI ^ -11.0R", 26UI ^ -11.0R)
PrintResult("26UI ^ ""12""", 26UI ^ "12")
PrintResult("26UI ^ TypeCode.Double", 26UI ^ TypeCode.Double)
PrintResult("-7L ^ False", -7L ^ False)
PrintResult("-7L ^ True", -7L ^ True)
PrintResult("-7L ^ System.SByte.MinValue", -7L ^ System.SByte.MinValue)
PrintResult("-7L ^ System.Byte.MaxValue", -7L ^ System.Byte.MaxValue)
PrintResult("-7L ^ -3S", -7L ^ -3S)
PrintResult("-7L ^ 24US", -7L ^ 24US)
PrintResult("-7L ^ -5I", -7L ^ -5I)
PrintResult("-7L ^ 26UI", -7L ^ 26UI)
PrintResult("-7L ^ -7L", -7L ^ -7L)
PrintResult("-7L ^ 28UL", -7L ^ 28UL)
PrintResult("-7L ^ -9D", -7L ^ -9D)
PrintResult("-7L ^ 10.0F", -7L ^ 10.0F)
PrintResult("-7L ^ -11.0R", -7L ^ -11.0R)
PrintResult("-7L ^ ""12""", -7L ^ "12")
PrintResult("-7L ^ TypeCode.Double", -7L ^ TypeCode.Double)
PrintResult("28UL ^ False", 28UL ^ False)
PrintResult("28UL ^ True", 28UL ^ True)
PrintResult("28UL ^ System.SByte.MinValue", 28UL ^ System.SByte.MinValue)
PrintResult("28UL ^ System.Byte.MaxValue", 28UL ^ System.Byte.MaxValue)
PrintResult("28UL ^ -3S", 28UL ^ -3S)
PrintResult("28UL ^ 24US", 28UL ^ 24US)
PrintResult("28UL ^ -5I", 28UL ^ -5I)
PrintResult("28UL ^ 26UI", 28UL ^ 26UI)
PrintResult("28UL ^ -7L", 28UL ^ -7L)
PrintResult("28UL ^ 28UL", 28UL ^ 28UL)
PrintResult("28UL ^ -9D", 28UL ^ -9D)
PrintResult("28UL ^ 10.0F", 28UL ^ 10.0F)
PrintResult("28UL ^ -11.0R", 28UL ^ -11.0R)
PrintResult("28UL ^ ""12""", 28UL ^ "12")
PrintResult("28UL ^ TypeCode.Double", 28UL ^ TypeCode.Double)
PrintResult("-9D ^ False", -9D ^ False)
PrintResult("-9D ^ True", -9D ^ True)
PrintResult("-9D ^ System.SByte.MinValue", -9D ^ System.SByte.MinValue)
PrintResult("-9D ^ System.Byte.MaxValue", -9D ^ System.Byte.MaxValue)
PrintResult("-9D ^ -3S", -9D ^ -3S)
PrintResult("-9D ^ 24US", -9D ^ 24US)
PrintResult("-9D ^ -5I", -9D ^ -5I)
PrintResult("-9D ^ 26UI", -9D ^ 26UI)
PrintResult("-9D ^ -7L", -9D ^ -7L)
PrintResult("-9D ^ 28UL", -9D ^ 28UL)
PrintResult("-9D ^ -9D", -9D ^ -9D)
PrintResult("-9D ^ 10.0F", -9D ^ 10.0F)
PrintResult("-9D ^ -11.0R", -9D ^ -11.0R)
PrintResult("-9D ^ ""12""", -9D ^ "12")
PrintResult("-9D ^ TypeCode.Double", -9D ^ TypeCode.Double)
PrintResult("10.0F ^ False", 10.0F ^ False)
PrintResult("10.0F ^ True", 10.0F ^ True)
PrintResult("10.0F ^ System.SByte.MinValue", 10.0F ^ System.SByte.MinValue)
PrintResult("10.0F ^ System.Byte.MaxValue", 10.0F ^ System.Byte.MaxValue)
PrintResult("10.0F ^ -3S", 10.0F ^ -3S)
PrintResult("10.0F ^ 24US", 10.0F ^ 24US)
PrintResult("10.0F ^ -5I", 10.0F ^ -5I)
PrintResult("10.0F ^ 26UI", 10.0F ^ 26UI)
PrintResult("10.0F ^ -7L", 10.0F ^ -7L)
PrintResult("10.0F ^ 28UL", 10.0F ^ 28UL)
PrintResult("10.0F ^ -9D", 10.0F ^ -9D)
PrintResult("10.0F ^ 10.0F", 10.0F ^ 10.0F)
PrintResult("10.0F ^ -11.0R", 10.0F ^ -11.0R)
PrintResult("10.0F ^ ""12""", 10.0F ^ "12")
PrintResult("10.0F ^ TypeCode.Double", 10.0F ^ TypeCode.Double)
PrintResult("-11.0R ^ False", -11.0R ^ False)
PrintResult("-11.0R ^ True", -11.0R ^ True)
PrintResult("-11.0R ^ System.SByte.MinValue", -11.0R ^ System.SByte.MinValue)
PrintResult("-11.0R ^ System.Byte.MaxValue", -11.0R ^ System.Byte.MaxValue)
PrintResult("-11.0R ^ -3S", -11.0R ^ -3S)
PrintResult("-11.0R ^ 24US", -11.0R ^ 24US)
PrintResult("-11.0R ^ -5I", -11.0R ^ -5I)
PrintResult("-11.0R ^ 26UI", -11.0R ^ 26UI)
PrintResult("-11.0R ^ -7L", -11.0R ^ -7L)
PrintResult("-11.0R ^ 28UL", -11.0R ^ 28UL)
PrintResult("-11.0R ^ -9D", -11.0R ^ -9D)
PrintResult("-11.0R ^ 10.0F", -11.0R ^ 10.0F)
PrintResult("-11.0R ^ -11.0R", -11.0R ^ -11.0R)
PrintResult("-11.0R ^ ""12""", -11.0R ^ "12")
PrintResult("-11.0R ^ TypeCode.Double", -11.0R ^ TypeCode.Double)
PrintResult("""12"" ^ False", "12" ^ False)
PrintResult("""12"" ^ True", "12" ^ True)
PrintResult("""12"" ^ System.SByte.MinValue", "12" ^ System.SByte.MinValue)
PrintResult("""12"" ^ System.Byte.MaxValue", "12" ^ System.Byte.MaxValue)
PrintResult("""12"" ^ -3S", "12" ^ -3S)
PrintResult("""12"" ^ 24US", "12" ^ 24US)
PrintResult("""12"" ^ -5I", "12" ^ -5I)
PrintResult("""12"" ^ 26UI", "12" ^ 26UI)
PrintResult("""12"" ^ -7L", "12" ^ -7L)
PrintResult("""12"" ^ 28UL", "12" ^ 28UL)
PrintResult("""12"" ^ -9D", "12" ^ -9D)
PrintResult("""12"" ^ 10.0F", "12" ^ 10.0F)
PrintResult("""12"" ^ -11.0R", "12" ^ -11.0R)
PrintResult("""12"" ^ ""12""", "12" ^ "12")
PrintResult("""12"" ^ TypeCode.Double", "12" ^ TypeCode.Double)
PrintResult("TypeCode.Double ^ False", TypeCode.Double ^ False)
PrintResult("TypeCode.Double ^ True", TypeCode.Double ^ True)
PrintResult("TypeCode.Double ^ System.SByte.MinValue", TypeCode.Double ^ System.SByte.MinValue)
PrintResult("TypeCode.Double ^ System.Byte.MaxValue", TypeCode.Double ^ System.Byte.MaxValue)
PrintResult("TypeCode.Double ^ -3S", TypeCode.Double ^ -3S)
PrintResult("TypeCode.Double ^ 24US", TypeCode.Double ^ 24US)
PrintResult("TypeCode.Double ^ -5I", TypeCode.Double ^ -5I)
PrintResult("TypeCode.Double ^ 26UI", TypeCode.Double ^ 26UI)
PrintResult("TypeCode.Double ^ -7L", TypeCode.Double ^ -7L)
PrintResult("TypeCode.Double ^ 28UL", TypeCode.Double ^ 28UL)
PrintResult("TypeCode.Double ^ -9D", TypeCode.Double ^ -9D)
PrintResult("TypeCode.Double ^ 10.0F", TypeCode.Double ^ 10.0F)
PrintResult("TypeCode.Double ^ -11.0R", TypeCode.Double ^ -11.0R)
PrintResult("TypeCode.Double ^ ""12""", TypeCode.Double ^ "12")
PrintResult("TypeCode.Double ^ TypeCode.Double", TypeCode.Double ^ TypeCode.Double)
PrintResult("False << False", False << False)
PrintResult("False << True", False << True)
PrintResult("False << System.SByte.MinValue", False << System.SByte.MinValue)
PrintResult("False << System.Byte.MaxValue", False << System.Byte.MaxValue)
PrintResult("False << -3S", False << -3S)
PrintResult("False << 24US", False << 24US)
PrintResult("False << -5I", False << -5I)
PrintResult("False << 26UI", False << 26UI)
PrintResult("False << -7L", False << -7L)
PrintResult("False << 28UL", False << 28UL)
PrintResult("False << -9D", False << -9D)
PrintResult("False << 10.0F", False << 10.0F)
PrintResult("False << -11.0R", False << -11.0R)
PrintResult("False << ""12""", False << "12")
PrintResult("False << TypeCode.Double", False << TypeCode.Double)
PrintResult("True << False", True << False)
PrintResult("True << True", True << True)
PrintResult("True << System.SByte.MinValue", True << System.SByte.MinValue)
PrintResult("True << System.Byte.MaxValue", True << System.Byte.MaxValue)
PrintResult("True << -3S", True << -3S)
PrintResult("True << 24US", True << 24US)
PrintResult("True << -5I", True << -5I)
PrintResult("True << 26UI", True << 26UI)
PrintResult("True << -7L", True << -7L)
PrintResult("True << 28UL", True << 28UL)
PrintResult("True << -9D", True << -9D)
PrintResult("True << 10.0F", True << 10.0F)
PrintResult("True << -11.0R", True << -11.0R)
PrintResult("True << ""12""", True << "12")
PrintResult("True << TypeCode.Double", True << TypeCode.Double)
PrintResult("System.SByte.MinValue << False", System.SByte.MinValue << False)
PrintResult("System.SByte.MinValue << True", System.SByte.MinValue << True)
PrintResult("System.SByte.MinValue << System.SByte.MinValue", System.SByte.MinValue << System.SByte.MinValue)
PrintResult("System.SByte.MinValue << System.Byte.MaxValue", System.SByte.MinValue << System.Byte.MaxValue)
PrintResult("System.SByte.MinValue << -3S", System.SByte.MinValue << -3S)
PrintResult("System.SByte.MinValue << 24US", System.SByte.MinValue << 24US)
PrintResult("System.SByte.MinValue << -5I", System.SByte.MinValue << -5I)
PrintResult("System.SByte.MinValue << 26UI", System.SByte.MinValue << 26UI)
PrintResult("System.SByte.MinValue << -7L", System.SByte.MinValue << -7L)
PrintResult("System.SByte.MinValue << 28UL", System.SByte.MinValue << 28UL)
PrintResult("System.SByte.MinValue << -9D", System.SByte.MinValue << -9D)
PrintResult("System.SByte.MinValue << 10.0F", System.SByte.MinValue << 10.0F)
PrintResult("System.SByte.MinValue << -11.0R", System.SByte.MinValue << -11.0R)
PrintResult("System.SByte.MinValue << ""12""", System.SByte.MinValue << "12")
PrintResult("System.SByte.MinValue << TypeCode.Double", System.SByte.MinValue << TypeCode.Double)
PrintResult("System.Byte.MaxValue << False", System.Byte.MaxValue << False)
PrintResult("System.Byte.MaxValue << True", System.Byte.MaxValue << True)
PrintResult("System.Byte.MaxValue << System.SByte.MinValue", System.Byte.MaxValue << System.SByte.MinValue)
PrintResult("System.Byte.MaxValue << System.Byte.MaxValue", System.Byte.MaxValue << System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue << -3S", System.Byte.MaxValue << -3S)
PrintResult("System.Byte.MaxValue << 24US", System.Byte.MaxValue << 24US)
PrintResult("System.Byte.MaxValue << -5I", System.Byte.MaxValue << -5I)
PrintResult("System.Byte.MaxValue << 26UI", System.Byte.MaxValue << 26UI)
PrintResult("System.Byte.MaxValue << -7L", System.Byte.MaxValue << -7L)
PrintResult("System.Byte.MaxValue << 28UL", System.Byte.MaxValue << 28UL)
PrintResult("System.Byte.MaxValue << -9D", System.Byte.MaxValue << -9D)
PrintResult("System.Byte.MaxValue << 10.0F", System.Byte.MaxValue << 10.0F)
PrintResult("System.Byte.MaxValue << -11.0R", System.Byte.MaxValue << -11.0R)
PrintResult("System.Byte.MaxValue << ""12""", System.Byte.MaxValue << "12")
PrintResult("System.Byte.MaxValue << TypeCode.Double", System.Byte.MaxValue << TypeCode.Double)
PrintResult("-3S << False", -3S << False)
PrintResult("-3S << True", -3S << True)
PrintResult("-3S << System.SByte.MinValue", -3S << System.SByte.MinValue)
PrintResult("-3S << System.Byte.MaxValue", -3S << System.Byte.MaxValue)
PrintResult("-3S << -3S", -3S << -3S)
PrintResult("-3S << 24US", -3S << 24US)
PrintResult("-3S << -5I", -3S << -5I)
PrintResult("-3S << 26UI", -3S << 26UI)
PrintResult("-3S << -7L", -3S << -7L)
PrintResult("-3S << 28UL", -3S << 28UL)
PrintResult("-3S << -9D", -3S << -9D)
PrintResult("-3S << 10.0F", -3S << 10.0F)
PrintResult("-3S << -11.0R", -3S << -11.0R)
PrintResult("-3S << ""12""", -3S << "12")
PrintResult("-3S << TypeCode.Double", -3S << TypeCode.Double)
PrintResult("24US << False", 24US << False)
PrintResult("24US << True", 24US << True)
PrintResult("24US << System.SByte.MinValue", 24US << System.SByte.MinValue)
PrintResult("24US << System.Byte.MaxValue", 24US << System.Byte.MaxValue)
PrintResult("24US << -3S", 24US << -3S)
PrintResult("24US << 24US", 24US << 24US)
PrintResult("24US << -5I", 24US << -5I)
PrintResult("24US << 26UI", 24US << 26UI)
PrintResult("24US << -7L", 24US << -7L)
PrintResult("24US << 28UL", 24US << 28UL)
PrintResult("24US << -9D", 24US << -9D)
PrintResult("24US << 10.0F", 24US << 10.0F)
PrintResult("24US << -11.0R", 24US << -11.0R)
PrintResult("24US << ""12""", 24US << "12")
PrintResult("24US << TypeCode.Double", 24US << TypeCode.Double)
PrintResult("-5I << False", -5I << False)
PrintResult("-5I << True", -5I << True)
PrintResult("-5I << System.SByte.MinValue", -5I << System.SByte.MinValue)
PrintResult("-5I << System.Byte.MaxValue", -5I << System.Byte.MaxValue)
PrintResult("-5I << -3S", -5I << -3S)
PrintResult("-5I << 24US", -5I << 24US)
PrintResult("-5I << -5I", -5I << -5I)
PrintResult("-5I << 26UI", -5I << 26UI)
PrintResult("-5I << -7L", -5I << -7L)
PrintResult("-5I << 28UL", -5I << 28UL)
PrintResult("-5I << -9D", -5I << -9D)
PrintResult("-5I << 10.0F", -5I << 10.0F)
PrintResult("-5I << -11.0R", -5I << -11.0R)
PrintResult("-5I << ""12""", -5I << "12")
PrintResult("-5I << TypeCode.Double", -5I << TypeCode.Double)
PrintResult("26UI << False", 26UI << False)
PrintResult("26UI << True", 26UI << True)
PrintResult("26UI << System.SByte.MinValue", 26UI << System.SByte.MinValue)
PrintResult("26UI << System.Byte.MaxValue", 26UI << System.Byte.MaxValue)
PrintResult("26UI << -3S", 26UI << -3S)
PrintResult("26UI << 24US", 26UI << 24US)
PrintResult("26UI << -5I", 26UI << -5I)
PrintResult("26UI << 26UI", 26UI << 26UI)
PrintResult("26UI << -7L", 26UI << -7L)
PrintResult("26UI << 28UL", 26UI << 28UL)
PrintResult("26UI << -9D", 26UI << -9D)
PrintResult("26UI << 10.0F", 26UI << 10.0F)
PrintResult("26UI << -11.0R", 26UI << -11.0R)
PrintResult("26UI << ""12""", 26UI << "12")
PrintResult("26UI << TypeCode.Double", 26UI << TypeCode.Double)
PrintResult("-7L << False", -7L << False)
PrintResult("-7L << True", -7L << True)
PrintResult("-7L << System.SByte.MinValue", -7L << System.SByte.MinValue)
PrintResult("-7L << System.Byte.MaxValue", -7L << System.Byte.MaxValue)
PrintResult("-7L << -3S", -7L << -3S)
PrintResult("-7L << 24US", -7L << 24US)
PrintResult("-7L << -5I", -7L << -5I)
PrintResult("-7L << 26UI", -7L << 26UI)
PrintResult("-7L << -7L", -7L << -7L)
PrintResult("-7L << 28UL", -7L << 28UL)
PrintResult("-7L << -9D", -7L << -9D)
PrintResult("-7L << 10.0F", -7L << 10.0F)
PrintResult("-7L << -11.0R", -7L << -11.0R)
PrintResult("-7L << ""12""", -7L << "12")
PrintResult("-7L << TypeCode.Double", -7L << TypeCode.Double)
PrintResult("28UL << False", 28UL << False)
PrintResult("28UL << True", 28UL << True)
PrintResult("28UL << System.SByte.MinValue", 28UL << System.SByte.MinValue)
PrintResult("28UL << System.Byte.MaxValue", 28UL << System.Byte.MaxValue)
PrintResult("28UL << -3S", 28UL << -3S)
PrintResult("28UL << 24US", 28UL << 24US)
PrintResult("28UL << -5I", 28UL << -5I)
PrintResult("28UL << 26UI", 28UL << 26UI)
PrintResult("28UL << -7L", 28UL << -7L)
PrintResult("28UL << 28UL", 28UL << 28UL)
PrintResult("28UL << -9D", 28UL << -9D)
PrintResult("28UL << 10.0F", 28UL << 10.0F)
PrintResult("28UL << -11.0R", 28UL << -11.0R)
PrintResult("28UL << ""12""", 28UL << "12")
PrintResult("28UL << TypeCode.Double", 28UL << TypeCode.Double)
PrintResult("-9D << False", -9D << False)
PrintResult("-9D << True", -9D << True)
PrintResult("-9D << System.SByte.MinValue", -9D << System.SByte.MinValue)
PrintResult("-9D << System.Byte.MaxValue", -9D << System.Byte.MaxValue)
PrintResult("-9D << -3S", -9D << -3S)
PrintResult("-9D << 24US", -9D << 24US)
PrintResult("-9D << -5I", -9D << -5I)
PrintResult("-9D << 26UI", -9D << 26UI)
PrintResult("-9D << -7L", -9D << -7L)
PrintResult("-9D << 28UL", -9D << 28UL)
PrintResult("-9D << -9D", -9D << -9D)
PrintResult("-9D << 10.0F", -9D << 10.0F)
PrintResult("-9D << -11.0R", -9D << -11.0R)
PrintResult("-9D << ""12""", -9D << "12")
PrintResult("-9D << TypeCode.Double", -9D << TypeCode.Double)
PrintResult("10.0F << False", 10.0F << False)
PrintResult("10.0F << True", 10.0F << True)
PrintResult("10.0F << System.SByte.MinValue", 10.0F << System.SByte.MinValue)
PrintResult("10.0F << System.Byte.MaxValue", 10.0F << System.Byte.MaxValue)
PrintResult("10.0F << -3S", 10.0F << -3S)
PrintResult("10.0F << 24US", 10.0F << 24US)
PrintResult("10.0F << -5I", 10.0F << -5I)
PrintResult("10.0F << 26UI", 10.0F << 26UI)
PrintResult("10.0F << -7L", 10.0F << -7L)
PrintResult("10.0F << 28UL", 10.0F << 28UL)
PrintResult("10.0F << -9D", 10.0F << -9D)
PrintResult("10.0F << 10.0F", 10.0F << 10.0F)
PrintResult("10.0F << -11.0R", 10.0F << -11.0R)
PrintResult("10.0F << ""12""", 10.0F << "12")
PrintResult("10.0F << TypeCode.Double", 10.0F << TypeCode.Double)
PrintResult("-11.0R << False", -11.0R << False)
PrintResult("-11.0R << True", -11.0R << True)
PrintResult("-11.0R << System.SByte.MinValue", -11.0R << System.SByte.MinValue)
PrintResult("-11.0R << System.Byte.MaxValue", -11.0R << System.Byte.MaxValue)
PrintResult("-11.0R << -3S", -11.0R << -3S)
PrintResult("-11.0R << 24US", -11.0R << 24US)
PrintResult("-11.0R << -5I", -11.0R << -5I)
PrintResult("-11.0R << 26UI", -11.0R << 26UI)
PrintResult("-11.0R << -7L", -11.0R << -7L)
PrintResult("-11.0R << 28UL", -11.0R << 28UL)
PrintResult("-11.0R << -9D", -11.0R << -9D)
PrintResult("-11.0R << 10.0F", -11.0R << 10.0F)
PrintResult("-11.0R << -11.0R", -11.0R << -11.0R)
PrintResult("-11.0R << ""12""", -11.0R << "12")
PrintResult("-11.0R << TypeCode.Double", -11.0R << TypeCode.Double)
PrintResult("""12"" << False", "12" << False)
PrintResult("""12"" << True", "12" << True)
PrintResult("""12"" << System.SByte.MinValue", "12" << System.SByte.MinValue)
PrintResult("""12"" << System.Byte.MaxValue", "12" << System.Byte.MaxValue)
PrintResult("""12"" << -3S", "12" << -3S)
PrintResult("""12"" << 24US", "12" << 24US)
PrintResult("""12"" << -5I", "12" << -5I)
PrintResult("""12"" << 26UI", "12" << 26UI)
PrintResult("""12"" << -7L", "12" << -7L)
PrintResult("""12"" << 28UL", "12" << 28UL)
PrintResult("""12"" << -9D", "12" << -9D)
PrintResult("""12"" << 10.0F", "12" << 10.0F)
PrintResult("""12"" << -11.0R", "12" << -11.0R)
PrintResult("""12"" << ""12""", "12" << "12")
PrintResult("""12"" << TypeCode.Double", "12" << TypeCode.Double)
PrintResult("TypeCode.Double << False", TypeCode.Double << False)
PrintResult("TypeCode.Double << True", TypeCode.Double << True)
PrintResult("TypeCode.Double << System.SByte.MinValue", TypeCode.Double << System.SByte.MinValue)
PrintResult("TypeCode.Double << System.Byte.MaxValue", TypeCode.Double << System.Byte.MaxValue)
PrintResult("TypeCode.Double << -3S", TypeCode.Double << -3S)
PrintResult("TypeCode.Double << 24US", TypeCode.Double << 24US)
PrintResult("TypeCode.Double << -5I", TypeCode.Double << -5I)
PrintResult("TypeCode.Double << 26UI", TypeCode.Double << 26UI)
PrintResult("TypeCode.Double << -7L", TypeCode.Double << -7L)
PrintResult("TypeCode.Double << 28UL", TypeCode.Double << 28UL)
PrintResult("TypeCode.Double << -9D", TypeCode.Double << -9D)
PrintResult("TypeCode.Double << 10.0F", TypeCode.Double << 10.0F)
PrintResult("TypeCode.Double << -11.0R", TypeCode.Double << -11.0R)
PrintResult("TypeCode.Double << ""12""", TypeCode.Double << "12")
PrintResult("TypeCode.Double << TypeCode.Double", TypeCode.Double << TypeCode.Double)
PrintResult("False >> False", False >> False)
PrintResult("False >> True", False >> True)
PrintResult("False >> System.SByte.MinValue", False >> System.SByte.MinValue)
PrintResult("False >> System.Byte.MaxValue", False >> System.Byte.MaxValue)
PrintResult("False >> -3S", False >> -3S)
PrintResult("False >> 24US", False >> 24US)
PrintResult("False >> -5I", False >> -5I)
PrintResult("False >> 26UI", False >> 26UI)
PrintResult("False >> -7L", False >> -7L)
PrintResult("False >> 28UL", False >> 28UL)
PrintResult("False >> -9D", False >> -9D)
PrintResult("False >> 10.0F", False >> 10.0F)
PrintResult("False >> -11.0R", False >> -11.0R)
PrintResult("False >> ""12""", False >> "12")
PrintResult("False >> TypeCode.Double", False >> TypeCode.Double)
PrintResult("True >> False", True >> False)
PrintResult("True >> True", True >> True)
PrintResult("True >> System.SByte.MinValue", True >> System.SByte.MinValue)
PrintResult("True >> System.Byte.MaxValue", True >> System.Byte.MaxValue)
PrintResult("True >> -3S", True >> -3S)
PrintResult("True >> 24US", True >> 24US)
PrintResult("True >> -5I", True >> -5I)
PrintResult("True >> 26UI", True >> 26UI)
PrintResult("True >> -7L", True >> -7L)
PrintResult("True >> 28UL", True >> 28UL)
PrintResult("True >> -9D", True >> -9D)
PrintResult("True >> 10.0F", True >> 10.0F)
PrintResult("True >> -11.0R", True >> -11.0R)
PrintResult("True >> ""12""", True >> "12")
PrintResult("True >> TypeCode.Double", True >> TypeCode.Double)
PrintResult("System.SByte.MinValue >> False", System.SByte.MinValue >> False)
PrintResult("System.SByte.MinValue >> True", System.SByte.MinValue >> True)
PrintResult("System.SByte.MinValue >> System.SByte.MinValue", System.SByte.MinValue >> System.SByte.MinValue)
PrintResult("System.SByte.MinValue >> System.Byte.MaxValue", System.SByte.MinValue >> System.Byte.MaxValue)
PrintResult("System.SByte.MinValue >> -3S", System.SByte.MinValue >> -3S)
PrintResult("System.SByte.MinValue >> 24US", System.SByte.MinValue >> 24US)
PrintResult("System.SByte.MinValue >> -5I", System.SByte.MinValue >> -5I)
PrintResult("System.SByte.MinValue >> 26UI", System.SByte.MinValue >> 26UI)
PrintResult("System.SByte.MinValue >> -7L", System.SByte.MinValue >> -7L)
PrintResult("System.SByte.MinValue >> 28UL", System.SByte.MinValue >> 28UL)
PrintResult("System.SByte.MinValue >> -9D", System.SByte.MinValue >> -9D)
PrintResult("System.SByte.MinValue >> 10.0F", System.SByte.MinValue >> 10.0F)
PrintResult("System.SByte.MinValue >> -11.0R", System.SByte.MinValue >> -11.0R)
PrintResult("System.SByte.MinValue >> ""12""", System.SByte.MinValue >> "12")
PrintResult("System.SByte.MinValue >> TypeCode.Double", System.SByte.MinValue >> TypeCode.Double)
PrintResult("System.Byte.MaxValue >> False", System.Byte.MaxValue >> False)
PrintResult("System.Byte.MaxValue >> True", System.Byte.MaxValue >> True)
PrintResult("System.Byte.MaxValue >> System.SByte.MinValue", System.Byte.MaxValue >> System.SByte.MinValue)
PrintResult("System.Byte.MaxValue >> System.Byte.MaxValue", System.Byte.MaxValue >> System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue >> -3S", System.Byte.MaxValue >> -3S)
PrintResult("System.Byte.MaxValue >> 24US", System.Byte.MaxValue >> 24US)
PrintResult("System.Byte.MaxValue >> -5I", System.Byte.MaxValue >> -5I)
PrintResult("System.Byte.MaxValue >> 26UI", System.Byte.MaxValue >> 26UI)
PrintResult("System.Byte.MaxValue >> -7L", System.Byte.MaxValue >> -7L)
PrintResult("System.Byte.MaxValue >> 28UL", System.Byte.MaxValue >> 28UL)
PrintResult("System.Byte.MaxValue >> -9D", System.Byte.MaxValue >> -9D)
PrintResult("System.Byte.MaxValue >> 10.0F", System.Byte.MaxValue >> 10.0F)
PrintResult("System.Byte.MaxValue >> -11.0R", System.Byte.MaxValue >> -11.0R)
PrintResult("System.Byte.MaxValue >> ""12""", System.Byte.MaxValue >> "12")
PrintResult("System.Byte.MaxValue >> TypeCode.Double", System.Byte.MaxValue >> TypeCode.Double)
PrintResult("-3S >> False", -3S >> False)
PrintResult("-3S >> True", -3S >> True)
PrintResult("-3S >> System.SByte.MinValue", -3S >> System.SByte.MinValue)
PrintResult("-3S >> System.Byte.MaxValue", -3S >> System.Byte.MaxValue)
PrintResult("-3S >> -3S", -3S >> -3S)
PrintResult("-3S >> 24US", -3S >> 24US)
PrintResult("-3S >> -5I", -3S >> -5I)
PrintResult("-3S >> 26UI", -3S >> 26UI)
PrintResult("-3S >> -7L", -3S >> -7L)
PrintResult("-3S >> 28UL", -3S >> 28UL)
PrintResult("-3S >> -9D", -3S >> -9D)
PrintResult("-3S >> 10.0F", -3S >> 10.0F)
PrintResult("-3S >> -11.0R", -3S >> -11.0R)
PrintResult("-3S >> ""12""", -3S >> "12")
PrintResult("-3S >> TypeCode.Double", -3S >> TypeCode.Double)
PrintResult("24US >> False", 24US >> False)
PrintResult("24US >> True", 24US >> True)
PrintResult("24US >> System.SByte.MinValue", 24US >> System.SByte.MinValue)
PrintResult("24US >> System.Byte.MaxValue", 24US >> System.Byte.MaxValue)
PrintResult("24US >> -3S", 24US >> -3S)
PrintResult("24US >> 24US", 24US >> 24US)
PrintResult("24US >> -5I", 24US >> -5I)
PrintResult("24US >> 26UI", 24US >> 26UI)
PrintResult("24US >> -7L", 24US >> -7L)
PrintResult("24US >> 28UL", 24US >> 28UL)
PrintResult("24US >> -9D", 24US >> -9D)
PrintResult("24US >> 10.0F", 24US >> 10.0F)
PrintResult("24US >> -11.0R", 24US >> -11.0R)
PrintResult("24US >> ""12""", 24US >> "12")
PrintResult("24US >> TypeCode.Double", 24US >> TypeCode.Double)
PrintResult("-5I >> False", -5I >> False)
PrintResult("-5I >> True", -5I >> True)
PrintResult("-5I >> System.SByte.MinValue", -5I >> System.SByte.MinValue)
PrintResult("-5I >> System.Byte.MaxValue", -5I >> System.Byte.MaxValue)
PrintResult("-5I >> -3S", -5I >> -3S)
PrintResult("-5I >> 24US", -5I >> 24US)
PrintResult("-5I >> -5I", -5I >> -5I)
PrintResult("-5I >> 26UI", -5I >> 26UI)
PrintResult("-5I >> -7L", -5I >> -7L)
PrintResult("-5I >> 28UL", -5I >> 28UL)
PrintResult("-5I >> -9D", -5I >> -9D)
PrintResult("-5I >> 10.0F", -5I >> 10.0F)
PrintResult("-5I >> -11.0R", -5I >> -11.0R)
PrintResult("-5I >> ""12""", -5I >> "12")
PrintResult("-5I >> TypeCode.Double", -5I >> TypeCode.Double)
PrintResult("26UI >> False", 26UI >> False)
PrintResult("26UI >> True", 26UI >> True)
PrintResult("26UI >> System.SByte.MinValue", 26UI >> System.SByte.MinValue)
PrintResult("26UI >> System.Byte.MaxValue", 26UI >> System.Byte.MaxValue)
PrintResult("26UI >> -3S", 26UI >> -3S)
PrintResult("26UI >> 24US", 26UI >> 24US)
PrintResult("26UI >> -5I", 26UI >> -5I)
PrintResult("26UI >> 26UI", 26UI >> 26UI)
PrintResult("26UI >> -7L", 26UI >> -7L)
PrintResult("26UI >> 28UL", 26UI >> 28UL)
PrintResult("26UI >> -9D", 26UI >> -9D)
PrintResult("26UI >> 10.0F", 26UI >> 10.0F)
PrintResult("26UI >> -11.0R", 26UI >> -11.0R)
PrintResult("26UI >> ""12""", 26UI >> "12")
PrintResult("26UI >> TypeCode.Double", 26UI >> TypeCode.Double)
PrintResult("-7L >> False", -7L >> False)
PrintResult("-7L >> True", -7L >> True)
PrintResult("-7L >> System.SByte.MinValue", -7L >> System.SByte.MinValue)
PrintResult("-7L >> System.Byte.MaxValue", -7L >> System.Byte.MaxValue)
PrintResult("-7L >> -3S", -7L >> -3S)
PrintResult("-7L >> 24US", -7L >> 24US)
PrintResult("-7L >> -5I", -7L >> -5I)
PrintResult("-7L >> 26UI", -7L >> 26UI)
PrintResult("-7L >> -7L", -7L >> -7L)
PrintResult("-7L >> 28UL", -7L >> 28UL)
PrintResult("-7L >> -9D", -7L >> -9D)
PrintResult("-7L >> 10.0F", -7L >> 10.0F)
PrintResult("-7L >> -11.0R", -7L >> -11.0R)
PrintResult("-7L >> ""12""", -7L >> "12")
PrintResult("-7L >> TypeCode.Double", -7L >> TypeCode.Double)
PrintResult("28UL >> False", 28UL >> False)
PrintResult("28UL >> True", 28UL >> True)
PrintResult("28UL >> System.SByte.MinValue", 28UL >> System.SByte.MinValue)
PrintResult("28UL >> System.Byte.MaxValue", 28UL >> System.Byte.MaxValue)
PrintResult("28UL >> -3S", 28UL >> -3S)
PrintResult("28UL >> 24US", 28UL >> 24US)
PrintResult("28UL >> -5I", 28UL >> -5I)
PrintResult("28UL >> 26UI", 28UL >> 26UI)
PrintResult("28UL >> -7L", 28UL >> -7L)
PrintResult("28UL >> 28UL", 28UL >> 28UL)
PrintResult("28UL >> -9D", 28UL >> -9D)
PrintResult("28UL >> 10.0F", 28UL >> 10.0F)
PrintResult("28UL >> -11.0R", 28UL >> -11.0R)
PrintResult("28UL >> ""12""", 28UL >> "12")
PrintResult("28UL >> TypeCode.Double", 28UL >> TypeCode.Double)
PrintResult("-9D >> False", -9D >> False)
PrintResult("-9D >> True", -9D >> True)
PrintResult("-9D >> System.SByte.MinValue", -9D >> System.SByte.MinValue)
PrintResult("-9D >> System.Byte.MaxValue", -9D >> System.Byte.MaxValue)
PrintResult("-9D >> -3S", -9D >> -3S)
PrintResult("-9D >> 24US", -9D >> 24US)
PrintResult("-9D >> -5I", -9D >> -5I)
PrintResult("-9D >> 26UI", -9D >> 26UI)
PrintResult("-9D >> -7L", -9D >> -7L)
PrintResult("-9D >> 28UL", -9D >> 28UL)
PrintResult("-9D >> -9D", -9D >> -9D)
PrintResult("-9D >> 10.0F", -9D >> 10.0F)
PrintResult("-9D >> -11.0R", -9D >> -11.0R)
PrintResult("-9D >> ""12""", -9D >> "12")
PrintResult("-9D >> TypeCode.Double", -9D >> TypeCode.Double)
PrintResult("10.0F >> False", 10.0F >> False)
PrintResult("10.0F >> True", 10.0F >> True)
PrintResult("10.0F >> System.SByte.MinValue", 10.0F >> System.SByte.MinValue)
PrintResult("10.0F >> System.Byte.MaxValue", 10.0F >> System.Byte.MaxValue)
PrintResult("10.0F >> -3S", 10.0F >> -3S)
PrintResult("10.0F >> 24US", 10.0F >> 24US)
PrintResult("10.0F >> -5I", 10.0F >> -5I)
PrintResult("10.0F >> 26UI", 10.0F >> 26UI)
PrintResult("10.0F >> -7L", 10.0F >> -7L)
PrintResult("10.0F >> 28UL", 10.0F >> 28UL)
PrintResult("10.0F >> -9D", 10.0F >> -9D)
PrintResult("10.0F >> 10.0F", 10.0F >> 10.0F)
PrintResult("10.0F >> -11.0R", 10.0F >> -11.0R)
PrintResult("10.0F >> ""12""", 10.0F >> "12")
PrintResult("10.0F >> TypeCode.Double", 10.0F >> TypeCode.Double)
PrintResult("-11.0R >> False", -11.0R >> False)
PrintResult("-11.0R >> True", -11.0R >> True)
PrintResult("-11.0R >> System.SByte.MinValue", -11.0R >> System.SByte.MinValue)
PrintResult("-11.0R >> System.Byte.MaxValue", -11.0R >> System.Byte.MaxValue)
PrintResult("-11.0R >> -3S", -11.0R >> -3S)
PrintResult("-11.0R >> 24US", -11.0R >> 24US)
PrintResult("-11.0R >> -5I", -11.0R >> -5I)
PrintResult("-11.0R >> 26UI", -11.0R >> 26UI)
PrintResult("-11.0R >> -7L", -11.0R >> -7L)
PrintResult("-11.0R >> 28UL", -11.0R >> 28UL)
PrintResult("-11.0R >> -9D", -11.0R >> -9D)
PrintResult("-11.0R >> 10.0F", -11.0R >> 10.0F)
PrintResult("-11.0R >> -11.0R", -11.0R >> -11.0R)
PrintResult("-11.0R >> ""12""", -11.0R >> "12")
PrintResult("-11.0R >> TypeCode.Double", -11.0R >> TypeCode.Double)
PrintResult("""12"" >> False", "12" >> False)
PrintResult("""12"" >> True", "12" >> True)
PrintResult("""12"" >> System.SByte.MinValue", "12" >> System.SByte.MinValue)
PrintResult("""12"" >> System.Byte.MaxValue", "12" >> System.Byte.MaxValue)
PrintResult("""12"" >> -3S", "12" >> -3S)
PrintResult("""12"" >> 24US", "12" >> 24US)
PrintResult("""12"" >> -5I", "12" >> -5I)
PrintResult("""12"" >> 26UI", "12" >> 26UI)
PrintResult("""12"" >> -7L", "12" >> -7L)
PrintResult("""12"" >> 28UL", "12" >> 28UL)
PrintResult("""12"" >> -9D", "12" >> -9D)
PrintResult("""12"" >> 10.0F", "12" >> 10.0F)
PrintResult("""12"" >> -11.0R", "12" >> -11.0R)
PrintResult("""12"" >> ""12""", "12" >> "12")
PrintResult("""12"" >> TypeCode.Double", "12" >> TypeCode.Double)
PrintResult("TypeCode.Double >> False", TypeCode.Double >> False)
PrintResult("TypeCode.Double >> True", TypeCode.Double >> True)
PrintResult("TypeCode.Double >> System.SByte.MinValue", TypeCode.Double >> System.SByte.MinValue)
PrintResult("TypeCode.Double >> System.Byte.MaxValue", TypeCode.Double >> System.Byte.MaxValue)
PrintResult("TypeCode.Double >> -3S", TypeCode.Double >> -3S)
PrintResult("TypeCode.Double >> 24US", TypeCode.Double >> 24US)
PrintResult("TypeCode.Double >> -5I", TypeCode.Double >> -5I)
PrintResult("TypeCode.Double >> 26UI", TypeCode.Double >> 26UI)
PrintResult("TypeCode.Double >> -7L", TypeCode.Double >> -7L)
PrintResult("TypeCode.Double >> 28UL", TypeCode.Double >> 28UL)
PrintResult("TypeCode.Double >> -9D", TypeCode.Double >> -9D)
PrintResult("TypeCode.Double >> 10.0F", TypeCode.Double >> 10.0F)
PrintResult("TypeCode.Double >> -11.0R", TypeCode.Double >> -11.0R)
PrintResult("TypeCode.Double >> ""12""", TypeCode.Double >> "12")
PrintResult("TypeCode.Double >> TypeCode.Double", TypeCode.Double >> TypeCode.Double)
PrintResult("False OrElse False", False OrElse False)
PrintResult("False OrElse True", False OrElse True)
PrintResult("False OrElse System.SByte.MinValue", False OrElse System.SByte.MinValue)
PrintResult("False OrElse System.Byte.MaxValue", False OrElse System.Byte.MaxValue)
PrintResult("False OrElse -3S", False OrElse -3S)
PrintResult("False OrElse 24US", False OrElse 24US)
PrintResult("False OrElse -5I", False OrElse -5I)
PrintResult("False OrElse 26UI", False OrElse 26UI)
PrintResult("False OrElse -7L", False OrElse -7L)
PrintResult("False OrElse 28UL", False OrElse 28UL)
PrintResult("False OrElse -9D", False OrElse -9D)
PrintResult("False OrElse 10.0F", False OrElse 10.0F)
PrintResult("False OrElse -11.0R", False OrElse -11.0R)
PrintResult("False OrElse ""12""", False OrElse "12")
PrintResult("False OrElse TypeCode.Double", False OrElse TypeCode.Double)
PrintResult("True OrElse False", True OrElse False)
PrintResult("True OrElse True", True OrElse True)
PrintResult("True OrElse System.SByte.MinValue", True OrElse System.SByte.MinValue)
PrintResult("True OrElse System.Byte.MaxValue", True OrElse System.Byte.MaxValue)
PrintResult("True OrElse -3S", True OrElse -3S)
PrintResult("True OrElse 24US", True OrElse 24US)
PrintResult("True OrElse -5I", True OrElse -5I)
PrintResult("True OrElse 26UI", True OrElse 26UI)
PrintResult("True OrElse -7L", True OrElse -7L)
PrintResult("True OrElse 28UL", True OrElse 28UL)
PrintResult("True OrElse -9D", True OrElse -9D)
PrintResult("True OrElse 10.0F", True OrElse 10.0F)
PrintResult("True OrElse -11.0R", True OrElse -11.0R)
PrintResult("True OrElse ""12""", True OrElse "12")
PrintResult("True OrElse TypeCode.Double", True OrElse TypeCode.Double)
PrintResult("System.SByte.MinValue OrElse False", System.SByte.MinValue OrElse False)
PrintResult("System.SByte.MinValue OrElse True", System.SByte.MinValue OrElse True)
PrintResult("System.SByte.MinValue OrElse System.SByte.MinValue", System.SByte.MinValue OrElse System.SByte.MinValue)
PrintResult("System.SByte.MinValue OrElse System.Byte.MaxValue", System.SByte.MinValue OrElse System.Byte.MaxValue)
PrintResult("System.SByte.MinValue OrElse -3S", System.SByte.MinValue OrElse -3S)
PrintResult("System.SByte.MinValue OrElse 24US", System.SByte.MinValue OrElse 24US)
PrintResult("System.SByte.MinValue OrElse -5I", System.SByte.MinValue OrElse -5I)
PrintResult("System.SByte.MinValue OrElse 26UI", System.SByte.MinValue OrElse 26UI)
PrintResult("System.SByte.MinValue OrElse -7L", System.SByte.MinValue OrElse -7L)
PrintResult("System.SByte.MinValue OrElse 28UL", System.SByte.MinValue OrElse 28UL)
PrintResult("System.SByte.MinValue OrElse -9D", System.SByte.MinValue OrElse -9D)
PrintResult("System.SByte.MinValue OrElse 10.0F", System.SByte.MinValue OrElse 10.0F)
PrintResult("System.SByte.MinValue OrElse -11.0R", System.SByte.MinValue OrElse -11.0R)
PrintResult("System.SByte.MinValue OrElse ""12""", System.SByte.MinValue OrElse "12")
PrintResult("System.SByte.MinValue OrElse TypeCode.Double", System.SByte.MinValue OrElse TypeCode.Double)
PrintResult("System.Byte.MaxValue OrElse False", System.Byte.MaxValue OrElse False)
PrintResult("System.Byte.MaxValue OrElse True", System.Byte.MaxValue OrElse True)
PrintResult("System.Byte.MaxValue OrElse System.SByte.MinValue", System.Byte.MaxValue OrElse System.SByte.MinValue)
PrintResult("System.Byte.MaxValue OrElse System.Byte.MaxValue", System.Byte.MaxValue OrElse System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue OrElse -3S", System.Byte.MaxValue OrElse -3S)
PrintResult("System.Byte.MaxValue OrElse 24US", System.Byte.MaxValue OrElse 24US)
PrintResult("System.Byte.MaxValue OrElse -5I", System.Byte.MaxValue OrElse -5I)
PrintResult("System.Byte.MaxValue OrElse 26UI", System.Byte.MaxValue OrElse 26UI)
PrintResult("System.Byte.MaxValue OrElse -7L", System.Byte.MaxValue OrElse -7L)
PrintResult("System.Byte.MaxValue OrElse 28UL", System.Byte.MaxValue OrElse 28UL)
PrintResult("System.Byte.MaxValue OrElse -9D", System.Byte.MaxValue OrElse -9D)
PrintResult("System.Byte.MaxValue OrElse 10.0F", System.Byte.MaxValue OrElse 10.0F)
PrintResult("System.Byte.MaxValue OrElse -11.0R", System.Byte.MaxValue OrElse -11.0R)
PrintResult("System.Byte.MaxValue OrElse ""12""", System.Byte.MaxValue OrElse "12")
PrintResult("System.Byte.MaxValue OrElse TypeCode.Double", System.Byte.MaxValue OrElse TypeCode.Double)
PrintResult("-3S OrElse False", -3S OrElse False)
PrintResult("-3S OrElse True", -3S OrElse True)
PrintResult("-3S OrElse System.SByte.MinValue", -3S OrElse System.SByte.MinValue)
PrintResult("-3S OrElse System.Byte.MaxValue", -3S OrElse System.Byte.MaxValue)
PrintResult("-3S OrElse -3S", -3S OrElse -3S)
PrintResult("-3S OrElse 24US", -3S OrElse 24US)
PrintResult("-3S OrElse -5I", -3S OrElse -5I)
PrintResult("-3S OrElse 26UI", -3S OrElse 26UI)
PrintResult("-3S OrElse -7L", -3S OrElse -7L)
PrintResult("-3S OrElse 28UL", -3S OrElse 28UL)
PrintResult("-3S OrElse -9D", -3S OrElse -9D)
PrintResult("-3S OrElse 10.0F", -3S OrElse 10.0F)
PrintResult("-3S OrElse -11.0R", -3S OrElse -11.0R)
PrintResult("-3S OrElse ""12""", -3S OrElse "12")
PrintResult("-3S OrElse TypeCode.Double", -3S OrElse TypeCode.Double)
PrintResult("24US OrElse False", 24US OrElse False)
PrintResult("24US OrElse True", 24US OrElse True)
PrintResult("24US OrElse System.SByte.MinValue", 24US OrElse System.SByte.MinValue)
PrintResult("24US OrElse System.Byte.MaxValue", 24US OrElse System.Byte.MaxValue)
PrintResult("24US OrElse -3S", 24US OrElse -3S)
PrintResult("24US OrElse 24US", 24US OrElse 24US)
PrintResult("24US OrElse -5I", 24US OrElse -5I)
PrintResult("24US OrElse 26UI", 24US OrElse 26UI)
PrintResult("24US OrElse -7L", 24US OrElse -7L)
PrintResult("24US OrElse 28UL", 24US OrElse 28UL)
PrintResult("24US OrElse -9D", 24US OrElse -9D)
PrintResult("24US OrElse 10.0F", 24US OrElse 10.0F)
PrintResult("24US OrElse -11.0R", 24US OrElse -11.0R)
PrintResult("24US OrElse ""12""", 24US OrElse "12")
PrintResult("24US OrElse TypeCode.Double", 24US OrElse TypeCode.Double)
PrintResult("-5I OrElse False", -5I OrElse False)
PrintResult("-5I OrElse True", -5I OrElse True)
PrintResult("-5I OrElse System.SByte.MinValue", -5I OrElse System.SByte.MinValue)
PrintResult("-5I OrElse System.Byte.MaxValue", -5I OrElse System.Byte.MaxValue)
PrintResult("-5I OrElse -3S", -5I OrElse -3S)
PrintResult("-5I OrElse 24US", -5I OrElse 24US)
PrintResult("-5I OrElse -5I", -5I OrElse -5I)
PrintResult("-5I OrElse 26UI", -5I OrElse 26UI)
PrintResult("-5I OrElse -7L", -5I OrElse -7L)
PrintResult("-5I OrElse 28UL", -5I OrElse 28UL)
PrintResult("-5I OrElse -9D", -5I OrElse -9D)
PrintResult("-5I OrElse 10.0F", -5I OrElse 10.0F)
PrintResult("-5I OrElse -11.0R", -5I OrElse -11.0R)
PrintResult("-5I OrElse ""12""", -5I OrElse "12")
PrintResult("-5I OrElse TypeCode.Double", -5I OrElse TypeCode.Double)
PrintResult("26UI OrElse False", 26UI OrElse False)
PrintResult("26UI OrElse True", 26UI OrElse True)
PrintResult("26UI OrElse System.SByte.MinValue", 26UI OrElse System.SByte.MinValue)
PrintResult("26UI OrElse System.Byte.MaxValue", 26UI OrElse System.Byte.MaxValue)
PrintResult("26UI OrElse -3S", 26UI OrElse -3S)
PrintResult("26UI OrElse 24US", 26UI OrElse 24US)
PrintResult("26UI OrElse -5I", 26UI OrElse -5I)
PrintResult("26UI OrElse 26UI", 26UI OrElse 26UI)
PrintResult("26UI OrElse -7L", 26UI OrElse -7L)
PrintResult("26UI OrElse 28UL", 26UI OrElse 28UL)
PrintResult("26UI OrElse -9D", 26UI OrElse -9D)
PrintResult("26UI OrElse 10.0F", 26UI OrElse 10.0F)
PrintResult("26UI OrElse -11.0R", 26UI OrElse -11.0R)
PrintResult("26UI OrElse ""12""", 26UI OrElse "12")
PrintResult("26UI OrElse TypeCode.Double", 26UI OrElse TypeCode.Double)
PrintResult("-7L OrElse False", -7L OrElse False)
PrintResult("-7L OrElse True", -7L OrElse True)
PrintResult("-7L OrElse System.SByte.MinValue", -7L OrElse System.SByte.MinValue)
PrintResult("-7L OrElse System.Byte.MaxValue", -7L OrElse System.Byte.MaxValue)
PrintResult("-7L OrElse -3S", -7L OrElse -3S)
PrintResult("-7L OrElse 24US", -7L OrElse 24US)
PrintResult("-7L OrElse -5I", -7L OrElse -5I)
PrintResult("-7L OrElse 26UI", -7L OrElse 26UI)
PrintResult("-7L OrElse -7L", -7L OrElse -7L)
PrintResult("-7L OrElse 28UL", -7L OrElse 28UL)
PrintResult("-7L OrElse -9D", -7L OrElse -9D)
PrintResult("-7L OrElse 10.0F", -7L OrElse 10.0F)
PrintResult("-7L OrElse -11.0R", -7L OrElse -11.0R)
PrintResult("-7L OrElse ""12""", -7L OrElse "12")
PrintResult("-7L OrElse TypeCode.Double", -7L OrElse TypeCode.Double)
PrintResult("28UL OrElse False", 28UL OrElse False)
PrintResult("28UL OrElse True", 28UL OrElse True)
PrintResult("28UL OrElse System.SByte.MinValue", 28UL OrElse System.SByte.MinValue)
PrintResult("28UL OrElse System.Byte.MaxValue", 28UL OrElse System.Byte.MaxValue)
PrintResult("28UL OrElse -3S", 28UL OrElse -3S)
PrintResult("28UL OrElse 24US", 28UL OrElse 24US)
PrintResult("28UL OrElse -5I", 28UL OrElse -5I)
PrintResult("28UL OrElse 26UI", 28UL OrElse 26UI)
PrintResult("28UL OrElse -7L", 28UL OrElse -7L)
PrintResult("28UL OrElse 28UL", 28UL OrElse 28UL)
PrintResult("28UL OrElse -9D", 28UL OrElse -9D)
PrintResult("28UL OrElse 10.0F", 28UL OrElse 10.0F)
PrintResult("28UL OrElse -11.0R", 28UL OrElse -11.0R)
PrintResult("28UL OrElse ""12""", 28UL OrElse "12")
PrintResult("28UL OrElse TypeCode.Double", 28UL OrElse TypeCode.Double)
PrintResult("-9D OrElse False", -9D OrElse False)
PrintResult("-9D OrElse True", -9D OrElse True)
PrintResult("-9D OrElse System.SByte.MinValue", -9D OrElse System.SByte.MinValue)
PrintResult("-9D OrElse System.Byte.MaxValue", -9D OrElse System.Byte.MaxValue)
PrintResult("-9D OrElse -3S", -9D OrElse -3S)
PrintResult("-9D OrElse 24US", -9D OrElse 24US)
PrintResult("-9D OrElse -5I", -9D OrElse -5I)
PrintResult("-9D OrElse 26UI", -9D OrElse 26UI)
PrintResult("-9D OrElse -7L", -9D OrElse -7L)
PrintResult("-9D OrElse 28UL", -9D OrElse 28UL)
PrintResult("-9D OrElse -9D", -9D OrElse -9D)
PrintResult("-9D OrElse 10.0F", -9D OrElse 10.0F)
PrintResult("-9D OrElse -11.0R", -9D OrElse -11.0R)
PrintResult("-9D OrElse ""12""", -9D OrElse "12")
PrintResult("-9D OrElse TypeCode.Double", -9D OrElse TypeCode.Double)
PrintResult("10.0F OrElse False", 10.0F OrElse False)
PrintResult("10.0F OrElse True", 10.0F OrElse True)
PrintResult("10.0F OrElse System.SByte.MinValue", 10.0F OrElse System.SByte.MinValue)
PrintResult("10.0F OrElse System.Byte.MaxValue", 10.0F OrElse System.Byte.MaxValue)
PrintResult("10.0F OrElse -3S", 10.0F OrElse -3S)
PrintResult("10.0F OrElse 24US", 10.0F OrElse 24US)
PrintResult("10.0F OrElse -5I", 10.0F OrElse -5I)
PrintResult("10.0F OrElse 26UI", 10.0F OrElse 26UI)
PrintResult("10.0F OrElse -7L", 10.0F OrElse -7L)
PrintResult("10.0F OrElse 28UL", 10.0F OrElse 28UL)
PrintResult("10.0F OrElse -9D", 10.0F OrElse -9D)
PrintResult("10.0F OrElse 10.0F", 10.0F OrElse 10.0F)
PrintResult("10.0F OrElse -11.0R", 10.0F OrElse -11.0R)
PrintResult("10.0F OrElse ""12""", 10.0F OrElse "12")
PrintResult("10.0F OrElse TypeCode.Double", 10.0F OrElse TypeCode.Double)
PrintResult("-11.0R OrElse False", -11.0R OrElse False)
PrintResult("-11.0R OrElse True", -11.0R OrElse True)
PrintResult("-11.0R OrElse System.SByte.MinValue", -11.0R OrElse System.SByte.MinValue)
PrintResult("-11.0R OrElse System.Byte.MaxValue", -11.0R OrElse System.Byte.MaxValue)
PrintResult("-11.0R OrElse -3S", -11.0R OrElse -3S)
PrintResult("-11.0R OrElse 24US", -11.0R OrElse 24US)
PrintResult("-11.0R OrElse -5I", -11.0R OrElse -5I)
PrintResult("-11.0R OrElse 26UI", -11.0R OrElse 26UI)
PrintResult("-11.0R OrElse -7L", -11.0R OrElse -7L)
PrintResult("-11.0R OrElse 28UL", -11.0R OrElse 28UL)
PrintResult("-11.0R OrElse -9D", -11.0R OrElse -9D)
PrintResult("-11.0R OrElse 10.0F", -11.0R OrElse 10.0F)
PrintResult("-11.0R OrElse -11.0R", -11.0R OrElse -11.0R)
PrintResult("-11.0R OrElse ""12""", -11.0R OrElse "12")
PrintResult("-11.0R OrElse TypeCode.Double", -11.0R OrElse TypeCode.Double)
PrintResult("""12"" OrElse False", "12" OrElse False)
PrintResult("""12"" OrElse True", "12" OrElse True)
PrintResult("""12"" OrElse System.SByte.MinValue", "12" OrElse System.SByte.MinValue)
PrintResult("""12"" OrElse System.Byte.MaxValue", "12" OrElse System.Byte.MaxValue)
PrintResult("""12"" OrElse -3S", "12" OrElse -3S)
PrintResult("""12"" OrElse 24US", "12" OrElse 24US)
PrintResult("""12"" OrElse -5I", "12" OrElse -5I)
PrintResult("""12"" OrElse 26UI", "12" OrElse 26UI)
PrintResult("""12"" OrElse -7L", "12" OrElse -7L)
PrintResult("""12"" OrElse 28UL", "12" OrElse 28UL)
PrintResult("""12"" OrElse -9D", "12" OrElse -9D)
PrintResult("""12"" OrElse 10.0F", "12" OrElse 10.0F)
PrintResult("""12"" OrElse -11.0R", "12" OrElse -11.0R)
PrintResult("""12"" OrElse ""12""", "12" OrElse "12")
PrintResult("""12"" OrElse TypeCode.Double", "12" OrElse TypeCode.Double)
PrintResult("TypeCode.Double OrElse False", TypeCode.Double OrElse False)
PrintResult("TypeCode.Double OrElse True", TypeCode.Double OrElse True)
PrintResult("TypeCode.Double OrElse System.SByte.MinValue", TypeCode.Double OrElse System.SByte.MinValue)
PrintResult("TypeCode.Double OrElse System.Byte.MaxValue", TypeCode.Double OrElse System.Byte.MaxValue)
PrintResult("TypeCode.Double OrElse -3S", TypeCode.Double OrElse -3S)
PrintResult("TypeCode.Double OrElse 24US", TypeCode.Double OrElse 24US)
PrintResult("TypeCode.Double OrElse -5I", TypeCode.Double OrElse -5I)
PrintResult("TypeCode.Double OrElse 26UI", TypeCode.Double OrElse 26UI)
PrintResult("TypeCode.Double OrElse -7L", TypeCode.Double OrElse -7L)
PrintResult("TypeCode.Double OrElse 28UL", TypeCode.Double OrElse 28UL)
PrintResult("TypeCode.Double OrElse -9D", TypeCode.Double OrElse -9D)
PrintResult("TypeCode.Double OrElse 10.0F", TypeCode.Double OrElse 10.0F)
PrintResult("TypeCode.Double OrElse -11.0R", TypeCode.Double OrElse -11.0R)
PrintResult("TypeCode.Double OrElse ""12""", TypeCode.Double OrElse "12")
PrintResult("TypeCode.Double OrElse TypeCode.Double", TypeCode.Double OrElse TypeCode.Double)
PrintResult("False AndAlso False", False AndAlso False)
PrintResult("False AndAlso True", False AndAlso True)
PrintResult("False AndAlso System.SByte.MinValue", False AndAlso System.SByte.MinValue)
PrintResult("False AndAlso System.Byte.MaxValue", False AndAlso System.Byte.MaxValue)
PrintResult("False AndAlso -3S", False AndAlso -3S)
PrintResult("False AndAlso 24US", False AndAlso 24US)
PrintResult("False AndAlso -5I", False AndAlso -5I)
PrintResult("False AndAlso 26UI", False AndAlso 26UI)
PrintResult("False AndAlso -7L", False AndAlso -7L)
PrintResult("False AndAlso 28UL", False AndAlso 28UL)
PrintResult("False AndAlso -9D", False AndAlso -9D)
PrintResult("False AndAlso 10.0F", False AndAlso 10.0F)
PrintResult("False AndAlso -11.0R", False AndAlso -11.0R)
PrintResult("False AndAlso ""12""", False AndAlso "12")
PrintResult("False AndAlso TypeCode.Double", False AndAlso TypeCode.Double)
PrintResult("True AndAlso False", True AndAlso False)
PrintResult("True AndAlso True", True AndAlso True)
PrintResult("True AndAlso System.SByte.MinValue", True AndAlso System.SByte.MinValue)
PrintResult("True AndAlso System.Byte.MaxValue", True AndAlso System.Byte.MaxValue)
PrintResult("True AndAlso -3S", True AndAlso -3S)
PrintResult("True AndAlso 24US", True AndAlso 24US)
PrintResult("True AndAlso -5I", True AndAlso -5I)
PrintResult("True AndAlso 26UI", True AndAlso 26UI)
PrintResult("True AndAlso -7L", True AndAlso -7L)
PrintResult("True AndAlso 28UL", True AndAlso 28UL)
PrintResult("True AndAlso -9D", True AndAlso -9D)
PrintResult("True AndAlso 10.0F", True AndAlso 10.0F)
PrintResult("True AndAlso -11.0R", True AndAlso -11.0R)
PrintResult("True AndAlso ""12""", True AndAlso "12")
PrintResult("True AndAlso TypeCode.Double", True AndAlso TypeCode.Double)
PrintResult("System.SByte.MinValue AndAlso False", System.SByte.MinValue AndAlso False)
PrintResult("System.SByte.MinValue AndAlso True", System.SByte.MinValue AndAlso True)
PrintResult("System.SByte.MinValue AndAlso System.SByte.MinValue", System.SByte.MinValue AndAlso System.SByte.MinValue)
PrintResult("System.SByte.MinValue AndAlso System.Byte.MaxValue", System.SByte.MinValue AndAlso System.Byte.MaxValue)
PrintResult("System.SByte.MinValue AndAlso -3S", System.SByte.MinValue AndAlso -3S)
PrintResult("System.SByte.MinValue AndAlso 24US", System.SByte.MinValue AndAlso 24US)
PrintResult("System.SByte.MinValue AndAlso -5I", System.SByte.MinValue AndAlso -5I)
PrintResult("System.SByte.MinValue AndAlso 26UI", System.SByte.MinValue AndAlso 26UI)
PrintResult("System.SByte.MinValue AndAlso -7L", System.SByte.MinValue AndAlso -7L)
PrintResult("System.SByte.MinValue AndAlso 28UL", System.SByte.MinValue AndAlso 28UL)
PrintResult("System.SByte.MinValue AndAlso -9D", System.SByte.MinValue AndAlso -9D)
PrintResult("System.SByte.MinValue AndAlso 10.0F", System.SByte.MinValue AndAlso 10.0F)
PrintResult("System.SByte.MinValue AndAlso -11.0R", System.SByte.MinValue AndAlso -11.0R)
PrintResult("System.SByte.MinValue AndAlso ""12""", System.SByte.MinValue AndAlso "12")
PrintResult("System.SByte.MinValue AndAlso TypeCode.Double", System.SByte.MinValue AndAlso TypeCode.Double)
PrintResult("System.Byte.MaxValue AndAlso False", System.Byte.MaxValue AndAlso False)
PrintResult("System.Byte.MaxValue AndAlso True", System.Byte.MaxValue AndAlso True)
PrintResult("System.Byte.MaxValue AndAlso System.SByte.MinValue", System.Byte.MaxValue AndAlso System.SByte.MinValue)
PrintResult("System.Byte.MaxValue AndAlso System.Byte.MaxValue", System.Byte.MaxValue AndAlso System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue AndAlso -3S", System.Byte.MaxValue AndAlso -3S)
PrintResult("System.Byte.MaxValue AndAlso 24US", System.Byte.MaxValue AndAlso 24US)
PrintResult("System.Byte.MaxValue AndAlso -5I", System.Byte.MaxValue AndAlso -5I)
PrintResult("System.Byte.MaxValue AndAlso 26UI", System.Byte.MaxValue AndAlso 26UI)
PrintResult("System.Byte.MaxValue AndAlso -7L", System.Byte.MaxValue AndAlso -7L)
PrintResult("System.Byte.MaxValue AndAlso 28UL", System.Byte.MaxValue AndAlso 28UL)
PrintResult("System.Byte.MaxValue AndAlso -9D", System.Byte.MaxValue AndAlso -9D)
PrintResult("System.Byte.MaxValue AndAlso 10.0F", System.Byte.MaxValue AndAlso 10.0F)
PrintResult("System.Byte.MaxValue AndAlso -11.0R", System.Byte.MaxValue AndAlso -11.0R)
PrintResult("System.Byte.MaxValue AndAlso ""12""", System.Byte.MaxValue AndAlso "12")
PrintResult("System.Byte.MaxValue AndAlso TypeCode.Double", System.Byte.MaxValue AndAlso TypeCode.Double)
PrintResult("-3S AndAlso False", -3S AndAlso False)
PrintResult("-3S AndAlso True", -3S AndAlso True)
PrintResult("-3S AndAlso System.SByte.MinValue", -3S AndAlso System.SByte.MinValue)
PrintResult("-3S AndAlso System.Byte.MaxValue", -3S AndAlso System.Byte.MaxValue)
PrintResult("-3S AndAlso -3S", -3S AndAlso -3S)
PrintResult("-3S AndAlso 24US", -3S AndAlso 24US)
PrintResult("-3S AndAlso -5I", -3S AndAlso -5I)
PrintResult("-3S AndAlso 26UI", -3S AndAlso 26UI)
PrintResult("-3S AndAlso -7L", -3S AndAlso -7L)
PrintResult("-3S AndAlso 28UL", -3S AndAlso 28UL)
PrintResult("-3S AndAlso -9D", -3S AndAlso -9D)
PrintResult("-3S AndAlso 10.0F", -3S AndAlso 10.0F)
PrintResult("-3S AndAlso -11.0R", -3S AndAlso -11.0R)
PrintResult("-3S AndAlso ""12""", -3S AndAlso "12")
PrintResult("-3S AndAlso TypeCode.Double", -3S AndAlso TypeCode.Double)
PrintResult("24US AndAlso False", 24US AndAlso False)
PrintResult("24US AndAlso True", 24US AndAlso True)
PrintResult("24US AndAlso System.SByte.MinValue", 24US AndAlso System.SByte.MinValue)
PrintResult("24US AndAlso System.Byte.MaxValue", 24US AndAlso System.Byte.MaxValue)
PrintResult("24US AndAlso -3S", 24US AndAlso -3S)
PrintResult("24US AndAlso 24US", 24US AndAlso 24US)
PrintResult("24US AndAlso -5I", 24US AndAlso -5I)
PrintResult("24US AndAlso 26UI", 24US AndAlso 26UI)
PrintResult("24US AndAlso -7L", 24US AndAlso -7L)
PrintResult("24US AndAlso 28UL", 24US AndAlso 28UL)
PrintResult("24US AndAlso -9D", 24US AndAlso -9D)
PrintResult("24US AndAlso 10.0F", 24US AndAlso 10.0F)
PrintResult("24US AndAlso -11.0R", 24US AndAlso -11.0R)
PrintResult("24US AndAlso ""12""", 24US AndAlso "12")
PrintResult("24US AndAlso TypeCode.Double", 24US AndAlso TypeCode.Double)
PrintResult("-5I AndAlso False", -5I AndAlso False)
PrintResult("-5I AndAlso True", -5I AndAlso True)
PrintResult("-5I AndAlso System.SByte.MinValue", -5I AndAlso System.SByte.MinValue)
PrintResult("-5I AndAlso System.Byte.MaxValue", -5I AndAlso System.Byte.MaxValue)
PrintResult("-5I AndAlso -3S", -5I AndAlso -3S)
PrintResult("-5I AndAlso 24US", -5I AndAlso 24US)
PrintResult("-5I AndAlso -5I", -5I AndAlso -5I)
PrintResult("-5I AndAlso 26UI", -5I AndAlso 26UI)
PrintResult("-5I AndAlso -7L", -5I AndAlso -7L)
PrintResult("-5I AndAlso 28UL", -5I AndAlso 28UL)
PrintResult("-5I AndAlso -9D", -5I AndAlso -9D)
PrintResult("-5I AndAlso 10.0F", -5I AndAlso 10.0F)
PrintResult("-5I AndAlso -11.0R", -5I AndAlso -11.0R)
PrintResult("-5I AndAlso ""12""", -5I AndAlso "12")
PrintResult("-5I AndAlso TypeCode.Double", -5I AndAlso TypeCode.Double)
PrintResult("26UI AndAlso False", 26UI AndAlso False)
PrintResult("26UI AndAlso True", 26UI AndAlso True)
PrintResult("26UI AndAlso System.SByte.MinValue", 26UI AndAlso System.SByte.MinValue)
PrintResult("26UI AndAlso System.Byte.MaxValue", 26UI AndAlso System.Byte.MaxValue)
PrintResult("26UI AndAlso -3S", 26UI AndAlso -3S)
PrintResult("26UI AndAlso 24US", 26UI AndAlso 24US)
PrintResult("26UI AndAlso -5I", 26UI AndAlso -5I)
PrintResult("26UI AndAlso 26UI", 26UI AndAlso 26UI)
PrintResult("26UI AndAlso -7L", 26UI AndAlso -7L)
PrintResult("26UI AndAlso 28UL", 26UI AndAlso 28UL)
PrintResult("26UI AndAlso -9D", 26UI AndAlso -9D)
PrintResult("26UI AndAlso 10.0F", 26UI AndAlso 10.0F)
PrintResult("26UI AndAlso -11.0R", 26UI AndAlso -11.0R)
PrintResult("26UI AndAlso ""12""", 26UI AndAlso "12")
PrintResult("26UI AndAlso TypeCode.Double", 26UI AndAlso TypeCode.Double)
PrintResult("-7L AndAlso False", -7L AndAlso False)
PrintResult("-7L AndAlso True", -7L AndAlso True)
PrintResult("-7L AndAlso System.SByte.MinValue", -7L AndAlso System.SByte.MinValue)
PrintResult("-7L AndAlso System.Byte.MaxValue", -7L AndAlso System.Byte.MaxValue)
PrintResult("-7L AndAlso -3S", -7L AndAlso -3S)
PrintResult("-7L AndAlso 24US", -7L AndAlso 24US)
PrintResult("-7L AndAlso -5I", -7L AndAlso -5I)
PrintResult("-7L AndAlso 26UI", -7L AndAlso 26UI)
PrintResult("-7L AndAlso -7L", -7L AndAlso -7L)
PrintResult("-7L AndAlso 28UL", -7L AndAlso 28UL)
PrintResult("-7L AndAlso -9D", -7L AndAlso -9D)
PrintResult("-7L AndAlso 10.0F", -7L AndAlso 10.0F)
PrintResult("-7L AndAlso -11.0R", -7L AndAlso -11.0R)
PrintResult("-7L AndAlso ""12""", -7L AndAlso "12")
PrintResult("-7L AndAlso TypeCode.Double", -7L AndAlso TypeCode.Double)
PrintResult("28UL AndAlso False", 28UL AndAlso False)
PrintResult("28UL AndAlso True", 28UL AndAlso True)
PrintResult("28UL AndAlso System.SByte.MinValue", 28UL AndAlso System.SByte.MinValue)
PrintResult("28UL AndAlso System.Byte.MaxValue", 28UL AndAlso System.Byte.MaxValue)
PrintResult("28UL AndAlso -3S", 28UL AndAlso -3S)
PrintResult("28UL AndAlso 24US", 28UL AndAlso 24US)
PrintResult("28UL AndAlso -5I", 28UL AndAlso -5I)
PrintResult("28UL AndAlso 26UI", 28UL AndAlso 26UI)
PrintResult("28UL AndAlso -7L", 28UL AndAlso -7L)
PrintResult("28UL AndAlso 28UL", 28UL AndAlso 28UL)
PrintResult("28UL AndAlso -9D", 28UL AndAlso -9D)
PrintResult("28UL AndAlso 10.0F", 28UL AndAlso 10.0F)
PrintResult("28UL AndAlso -11.0R", 28UL AndAlso -11.0R)
PrintResult("28UL AndAlso ""12""", 28UL AndAlso "12")
PrintResult("28UL AndAlso TypeCode.Double", 28UL AndAlso TypeCode.Double)
PrintResult("-9D AndAlso False", -9D AndAlso False)
PrintResult("-9D AndAlso True", -9D AndAlso True)
PrintResult("-9D AndAlso System.SByte.MinValue", -9D AndAlso System.SByte.MinValue)
PrintResult("-9D AndAlso System.Byte.MaxValue", -9D AndAlso System.Byte.MaxValue)
PrintResult("-9D AndAlso -3S", -9D AndAlso -3S)
PrintResult("-9D AndAlso 24US", -9D AndAlso 24US)
PrintResult("-9D AndAlso -5I", -9D AndAlso -5I)
PrintResult("-9D AndAlso 26UI", -9D AndAlso 26UI)
PrintResult("-9D AndAlso -7L", -9D AndAlso -7L)
PrintResult("-9D AndAlso 28UL", -9D AndAlso 28UL)
PrintResult("-9D AndAlso -9D", -9D AndAlso -9D)
PrintResult("-9D AndAlso 10.0F", -9D AndAlso 10.0F)
PrintResult("-9D AndAlso -11.0R", -9D AndAlso -11.0R)
PrintResult("-9D AndAlso ""12""", -9D AndAlso "12")
PrintResult("-9D AndAlso TypeCode.Double", -9D AndAlso TypeCode.Double)
PrintResult("10.0F AndAlso False", 10.0F AndAlso False)
PrintResult("10.0F AndAlso True", 10.0F AndAlso True)
PrintResult("10.0F AndAlso System.SByte.MinValue", 10.0F AndAlso System.SByte.MinValue)
PrintResult("10.0F AndAlso System.Byte.MaxValue", 10.0F AndAlso System.Byte.MaxValue)
PrintResult("10.0F AndAlso -3S", 10.0F AndAlso -3S)
PrintResult("10.0F AndAlso 24US", 10.0F AndAlso 24US)
PrintResult("10.0F AndAlso -5I", 10.0F AndAlso -5I)
PrintResult("10.0F AndAlso 26UI", 10.0F AndAlso 26UI)
PrintResult("10.0F AndAlso -7L", 10.0F AndAlso -7L)
PrintResult("10.0F AndAlso 28UL", 10.0F AndAlso 28UL)
PrintResult("10.0F AndAlso -9D", 10.0F AndAlso -9D)
PrintResult("10.0F AndAlso 10.0F", 10.0F AndAlso 10.0F)
PrintResult("10.0F AndAlso -11.0R", 10.0F AndAlso -11.0R)
PrintResult("10.0F AndAlso ""12""", 10.0F AndAlso "12")
PrintResult("10.0F AndAlso TypeCode.Double", 10.0F AndAlso TypeCode.Double)
PrintResult("-11.0R AndAlso False", -11.0R AndAlso False)
PrintResult("-11.0R AndAlso True", -11.0R AndAlso True)
PrintResult("-11.0R AndAlso System.SByte.MinValue", -11.0R AndAlso System.SByte.MinValue)
PrintResult("-11.0R AndAlso System.Byte.MaxValue", -11.0R AndAlso System.Byte.MaxValue)
PrintResult("-11.0R AndAlso -3S", -11.0R AndAlso -3S)
PrintResult("-11.0R AndAlso 24US", -11.0R AndAlso 24US)
PrintResult("-11.0R AndAlso -5I", -11.0R AndAlso -5I)
PrintResult("-11.0R AndAlso 26UI", -11.0R AndAlso 26UI)
PrintResult("-11.0R AndAlso -7L", -11.0R AndAlso -7L)
PrintResult("-11.0R AndAlso 28UL", -11.0R AndAlso 28UL)
PrintResult("-11.0R AndAlso -9D", -11.0R AndAlso -9D)
PrintResult("-11.0R AndAlso 10.0F", -11.0R AndAlso 10.0F)
PrintResult("-11.0R AndAlso -11.0R", -11.0R AndAlso -11.0R)
PrintResult("-11.0R AndAlso ""12""", -11.0R AndAlso "12")
PrintResult("-11.0R AndAlso TypeCode.Double", -11.0R AndAlso TypeCode.Double)
PrintResult("""12"" AndAlso False", "12" AndAlso False)
PrintResult("""12"" AndAlso True", "12" AndAlso True)
PrintResult("""12"" AndAlso System.SByte.MinValue", "12" AndAlso System.SByte.MinValue)
PrintResult("""12"" AndAlso System.Byte.MaxValue", "12" AndAlso System.Byte.MaxValue)
PrintResult("""12"" AndAlso -3S", "12" AndAlso -3S)
PrintResult("""12"" AndAlso 24US", "12" AndAlso 24US)
PrintResult("""12"" AndAlso -5I", "12" AndAlso -5I)
PrintResult("""12"" AndAlso 26UI", "12" AndAlso 26UI)
PrintResult("""12"" AndAlso -7L", "12" AndAlso -7L)
PrintResult("""12"" AndAlso 28UL", "12" AndAlso 28UL)
PrintResult("""12"" AndAlso -9D", "12" AndAlso -9D)
PrintResult("""12"" AndAlso 10.0F", "12" AndAlso 10.0F)
PrintResult("""12"" AndAlso -11.0R", "12" AndAlso -11.0R)
PrintResult("""12"" AndAlso ""12""", "12" AndAlso "12")
PrintResult("""12"" AndAlso TypeCode.Double", "12" AndAlso TypeCode.Double)
PrintResult("TypeCode.Double AndAlso False", TypeCode.Double AndAlso False)
PrintResult("TypeCode.Double AndAlso True", TypeCode.Double AndAlso True)
PrintResult("TypeCode.Double AndAlso System.SByte.MinValue", TypeCode.Double AndAlso System.SByte.MinValue)
PrintResult("TypeCode.Double AndAlso System.Byte.MaxValue", TypeCode.Double AndAlso System.Byte.MaxValue)
PrintResult("TypeCode.Double AndAlso -3S", TypeCode.Double AndAlso -3S)
PrintResult("TypeCode.Double AndAlso 24US", TypeCode.Double AndAlso 24US)
PrintResult("TypeCode.Double AndAlso -5I", TypeCode.Double AndAlso -5I)
PrintResult("TypeCode.Double AndAlso 26UI", TypeCode.Double AndAlso 26UI)
PrintResult("TypeCode.Double AndAlso -7L", TypeCode.Double AndAlso -7L)
PrintResult("TypeCode.Double AndAlso 28UL", TypeCode.Double AndAlso 28UL)
PrintResult("TypeCode.Double AndAlso -9D", TypeCode.Double AndAlso -9D)
PrintResult("TypeCode.Double AndAlso 10.0F", TypeCode.Double AndAlso 10.0F)
PrintResult("TypeCode.Double AndAlso -11.0R", TypeCode.Double AndAlso -11.0R)
PrintResult("TypeCode.Double AndAlso ""12""", TypeCode.Double AndAlso "12")
PrintResult("TypeCode.Double AndAlso TypeCode.Double", TypeCode.Double AndAlso TypeCode.Double)
PrintResult("False & False", False & False)
PrintResult("False & True", False & True)
PrintResult("False & System.SByte.MinValue", False & System.SByte.MinValue)
PrintResult("False & System.Byte.MaxValue", False & System.Byte.MaxValue)
PrintResult("False & -3S", False & -3S)
PrintResult("False & 24US", False & 24US)
PrintResult("False & -5I", False & -5I)
PrintResult("False & 26UI", False & 26UI)
PrintResult("False & -7L", False & -7L)
PrintResult("False & 28UL", False & 28UL)
PrintResult("False & -9D", False & -9D)
PrintResult("False & 10.0F", False & 10.0F)
PrintResult("False & -11.0R", False & -11.0R)
PrintResult("False & ""12""", False & "12")
PrintResult("False & TypeCode.Double", False & TypeCode.Double)
PrintResult("True & False", True & False)
PrintResult("True & True", True & True)
PrintResult("True & System.SByte.MinValue", True & System.SByte.MinValue)
PrintResult("True & System.Byte.MaxValue", True & System.Byte.MaxValue)
PrintResult("True & -3S", True & -3S)
PrintResult("True & 24US", True & 24US)
PrintResult("True & -5I", True & -5I)
PrintResult("True & 26UI", True & 26UI)
PrintResult("True & -7L", True & -7L)
PrintResult("True & 28UL", True & 28UL)
PrintResult("True & -9D", True & -9D)
PrintResult("True & 10.0F", True & 10.0F)
PrintResult("True & -11.0R", True & -11.0R)
PrintResult("True & ""12""", True & "12")
PrintResult("True & TypeCode.Double", True & TypeCode.Double)
PrintResult("System.SByte.MinValue & False", System.SByte.MinValue & False)
PrintResult("System.SByte.MinValue & True", System.SByte.MinValue & True)
PrintResult("System.SByte.MinValue & System.SByte.MinValue", System.SByte.MinValue & System.SByte.MinValue)
PrintResult("System.SByte.MinValue & System.Byte.MaxValue", System.SByte.MinValue & System.Byte.MaxValue)
PrintResult("System.SByte.MinValue & -3S", System.SByte.MinValue & -3S)
PrintResult("System.SByte.MinValue & 24US", System.SByte.MinValue & 24US)
PrintResult("System.SByte.MinValue & -5I", System.SByte.MinValue & -5I)
PrintResult("System.SByte.MinValue & 26UI", System.SByte.MinValue & 26UI)
PrintResult("System.SByte.MinValue & -7L", System.SByte.MinValue & -7L)
PrintResult("System.SByte.MinValue & 28UL", System.SByte.MinValue & 28UL)
PrintResult("System.SByte.MinValue & -9D", System.SByte.MinValue & -9D)
PrintResult("System.SByte.MinValue & 10.0F", System.SByte.MinValue & 10.0F)
PrintResult("System.SByte.MinValue & -11.0R", System.SByte.MinValue & -11.0R)
PrintResult("System.SByte.MinValue & ""12""", System.SByte.MinValue & "12")
PrintResult("System.SByte.MinValue & TypeCode.Double", System.SByte.MinValue & TypeCode.Double)
PrintResult("System.Byte.MaxValue & False", System.Byte.MaxValue & False)
PrintResult("System.Byte.MaxValue & True", System.Byte.MaxValue & True)
PrintResult("System.Byte.MaxValue & System.SByte.MinValue", System.Byte.MaxValue & System.SByte.MinValue)
PrintResult("System.Byte.MaxValue & System.Byte.MaxValue", System.Byte.MaxValue & System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue & -3S", System.Byte.MaxValue & -3S)
PrintResult("System.Byte.MaxValue & 24US", System.Byte.MaxValue & 24US)
PrintResult("System.Byte.MaxValue & -5I", System.Byte.MaxValue & -5I)
PrintResult("System.Byte.MaxValue & 26UI", System.Byte.MaxValue & 26UI)
PrintResult("System.Byte.MaxValue & -7L", System.Byte.MaxValue & -7L)
PrintResult("System.Byte.MaxValue & 28UL", System.Byte.MaxValue & 28UL)
PrintResult("System.Byte.MaxValue & -9D", System.Byte.MaxValue & -9D)
PrintResult("System.Byte.MaxValue & 10.0F", System.Byte.MaxValue & 10.0F)
PrintResult("System.Byte.MaxValue & -11.0R", System.Byte.MaxValue & -11.0R)
PrintResult("System.Byte.MaxValue & ""12""", System.Byte.MaxValue & "12")
PrintResult("System.Byte.MaxValue & TypeCode.Double", System.Byte.MaxValue & TypeCode.Double)
PrintResult("-3S & False", -3S & False)
PrintResult("-3S & True", -3S & True)
PrintResult("-3S & System.SByte.MinValue", -3S & System.SByte.MinValue)
PrintResult("-3S & System.Byte.MaxValue", -3S & System.Byte.MaxValue)
PrintResult("-3S & -3S", -3S & -3S)
PrintResult("-3S & 24US", -3S & 24US)
PrintResult("-3S & -5I", -3S & -5I)
PrintResult("-3S & 26UI", -3S & 26UI)
PrintResult("-3S & -7L", -3S & -7L)
PrintResult("-3S & 28UL", -3S & 28UL)
PrintResult("-3S & -9D", -3S & -9D)
PrintResult("-3S & 10.0F", -3S & 10.0F)
PrintResult("-3S & -11.0R", -3S & -11.0R)
PrintResult("-3S & ""12""", -3S & "12")
PrintResult("-3S & TypeCode.Double", -3S & TypeCode.Double)
PrintResult("24US & False", 24US & False)
PrintResult("24US & True", 24US & True)
PrintResult("24US & System.SByte.MinValue", 24US & System.SByte.MinValue)
PrintResult("24US & System.Byte.MaxValue", 24US & System.Byte.MaxValue)
PrintResult("24US & -3S", 24US & -3S)
PrintResult("24US & 24US", 24US & 24US)
PrintResult("24US & -5I", 24US & -5I)
PrintResult("24US & 26UI", 24US & 26UI)
PrintResult("24US & -7L", 24US & -7L)
PrintResult("24US & 28UL", 24US & 28UL)
PrintResult("24US & -9D", 24US & -9D)
PrintResult("24US & 10.0F", 24US & 10.0F)
PrintResult("24US & -11.0R", 24US & -11.0R)
PrintResult("24US & ""12""", 24US & "12")
PrintResult("24US & TypeCode.Double", 24US & TypeCode.Double)
PrintResult("-5I & False", -5I & False)
PrintResult("-5I & True", -5I & True)
PrintResult("-5I & System.SByte.MinValue", -5I & System.SByte.MinValue)
PrintResult("-5I & System.Byte.MaxValue", -5I & System.Byte.MaxValue)
PrintResult("-5I & -3S", -5I & -3S)
PrintResult("-5I & 24US", -5I & 24US)
PrintResult("-5I & -5I", -5I & -5I)
PrintResult("-5I & 26UI", -5I & 26UI)
PrintResult("-5I & -7L", -5I & -7L)
PrintResult("-5I & 28UL", -5I & 28UL)
PrintResult("-5I & -9D", -5I & -9D)
PrintResult("-5I & 10.0F", -5I & 10.0F)
PrintResult("-5I & -11.0R", -5I & -11.0R)
PrintResult("-5I & ""12""", -5I & "12")
PrintResult("-5I & TypeCode.Double", -5I & TypeCode.Double)
PrintResult("26UI & False", 26UI & False)
PrintResult("26UI & True", 26UI & True)
PrintResult("26UI & System.SByte.MinValue", 26UI & System.SByte.MinValue)
PrintResult("26UI & System.Byte.MaxValue", 26UI & System.Byte.MaxValue)
PrintResult("26UI & -3S", 26UI & -3S)
PrintResult("26UI & 24US", 26UI & 24US)
PrintResult("26UI & -5I", 26UI & -5I)
PrintResult("26UI & 26UI", 26UI & 26UI)
PrintResult("26UI & -7L", 26UI & -7L)
PrintResult("26UI & 28UL", 26UI & 28UL)
PrintResult("26UI & -9D", 26UI & -9D)
PrintResult("26UI & 10.0F", 26UI & 10.0F)
PrintResult("26UI & -11.0R", 26UI & -11.0R)
PrintResult("26UI & ""12""", 26UI & "12")
PrintResult("26UI & TypeCode.Double", 26UI & TypeCode.Double)
PrintResult("-7L & False", -7L & False)
PrintResult("-7L & True", -7L & True)
PrintResult("-7L & System.SByte.MinValue", -7L & System.SByte.MinValue)
PrintResult("-7L & System.Byte.MaxValue", -7L & System.Byte.MaxValue)
PrintResult("-7L & -3S", -7L & -3S)
PrintResult("-7L & 24US", -7L & 24US)
PrintResult("-7L & -5I", -7L & -5I)
PrintResult("-7L & 26UI", -7L & 26UI)
PrintResult("-7L & -7L", -7L & -7L)
PrintResult("-7L & 28UL", -7L & 28UL)
PrintResult("-7L & -9D", -7L & -9D)
PrintResult("-7L & 10.0F", -7L & 10.0F)
PrintResult("-7L & -11.0R", -7L & -11.0R)
PrintResult("-7L & ""12""", -7L & "12")
PrintResult("-7L & TypeCode.Double", -7L & TypeCode.Double)
PrintResult("28UL & False", 28UL & False)
PrintResult("28UL & True", 28UL & True)
PrintResult("28UL & System.SByte.MinValue", 28UL & System.SByte.MinValue)
PrintResult("28UL & System.Byte.MaxValue", 28UL & System.Byte.MaxValue)
PrintResult("28UL & -3S", 28UL & -3S)
PrintResult("28UL & 24US", 28UL & 24US)
PrintResult("28UL & -5I", 28UL & -5I)
PrintResult("28UL & 26UI", 28UL & 26UI)
PrintResult("28UL & -7L", 28UL & -7L)
PrintResult("28UL & 28UL", 28UL & 28UL)
PrintResult("28UL & -9D", 28UL & -9D)
PrintResult("28UL & 10.0F", 28UL & 10.0F)
PrintResult("28UL & -11.0R", 28UL & -11.0R)
PrintResult("28UL & ""12""", 28UL & "12")
PrintResult("28UL & TypeCode.Double", 28UL & TypeCode.Double)
PrintResult("-9D & False", -9D & False)
PrintResult("-9D & True", -9D & True)
PrintResult("-9D & System.SByte.MinValue", -9D & System.SByte.MinValue)
PrintResult("-9D & System.Byte.MaxValue", -9D & System.Byte.MaxValue)
PrintResult("-9D & -3S", -9D & -3S)
PrintResult("-9D & 24US", -9D & 24US)
PrintResult("-9D & -5I", -9D & -5I)
PrintResult("-9D & 26UI", -9D & 26UI)
PrintResult("-9D & -7L", -9D & -7L)
PrintResult("-9D & 28UL", -9D & 28UL)
PrintResult("-9D & -9D", -9D & -9D)
PrintResult("-9D & 10.0F", -9D & 10.0F)
PrintResult("-9D & -11.0R", -9D & -11.0R)
PrintResult("-9D & ""12""", -9D & "12")
PrintResult("-9D & TypeCode.Double", -9D & TypeCode.Double)
PrintResult("10.0F & False", 10.0F & False)
PrintResult("10.0F & True", 10.0F & True)
PrintResult("10.0F & System.SByte.MinValue", 10.0F & System.SByte.MinValue)
PrintResult("10.0F & System.Byte.MaxValue", 10.0F & System.Byte.MaxValue)
PrintResult("10.0F & -3S", 10.0F & -3S)
PrintResult("10.0F & 24US", 10.0F & 24US)
PrintResult("10.0F & -5I", 10.0F & -5I)
PrintResult("10.0F & 26UI", 10.0F & 26UI)
PrintResult("10.0F & -7L", 10.0F & -7L)
PrintResult("10.0F & 28UL", 10.0F & 28UL)
PrintResult("10.0F & -9D", 10.0F & -9D)
PrintResult("10.0F & 10.0F", 10.0F & 10.0F)
PrintResult("10.0F & -11.0R", 10.0F & -11.0R)
PrintResult("10.0F & ""12""", 10.0F & "12")
PrintResult("10.0F & TypeCode.Double", 10.0F & TypeCode.Double)
PrintResult("-11.0R & False", -11.0R & False)
PrintResult("-11.0R & True", -11.0R & True)
PrintResult("-11.0R & System.SByte.MinValue", -11.0R & System.SByte.MinValue)
PrintResult("-11.0R & System.Byte.MaxValue", -11.0R & System.Byte.MaxValue)
PrintResult("-11.0R & -3S", -11.0R & -3S)
PrintResult("-11.0R & 24US", -11.0R & 24US)
PrintResult("-11.0R & -5I", -11.0R & -5I)
PrintResult("-11.0R & 26UI", -11.0R & 26UI)
PrintResult("-11.0R & -7L", -11.0R & -7L)
PrintResult("-11.0R & 28UL", -11.0R & 28UL)
PrintResult("-11.0R & -9D", -11.0R & -9D)
PrintResult("-11.0R & 10.0F", -11.0R & 10.0F)
PrintResult("-11.0R & -11.0R", -11.0R & -11.0R)
PrintResult("-11.0R & ""12""", -11.0R & "12")
PrintResult("-11.0R & TypeCode.Double", -11.0R & TypeCode.Double)
PrintResult("""12"" & False", "12" & False)
PrintResult("""12"" & True", "12" & True)
PrintResult("""12"" & System.SByte.MinValue", "12" & System.SByte.MinValue)
PrintResult("""12"" & System.Byte.MaxValue", "12" & System.Byte.MaxValue)
PrintResult("""12"" & -3S", "12" & -3S)
PrintResult("""12"" & 24US", "12" & 24US)
PrintResult("""12"" & -5I", "12" & -5I)
PrintResult("""12"" & 26UI", "12" & 26UI)
PrintResult("""12"" & -7L", "12" & -7L)
PrintResult("""12"" & 28UL", "12" & 28UL)
PrintResult("""12"" & -9D", "12" & -9D)
PrintResult("""12"" & 10.0F", "12" & 10.0F)
PrintResult("""12"" & -11.0R", "12" & -11.0R)
PrintResult("""12"" & ""12""", "12" & "12")
PrintResult("""12"" & TypeCode.Double", "12" & TypeCode.Double)
PrintResult("TypeCode.Double & False", TypeCode.Double & False)
PrintResult("TypeCode.Double & True", TypeCode.Double & True)
PrintResult("TypeCode.Double & System.SByte.MinValue", TypeCode.Double & System.SByte.MinValue)
PrintResult("TypeCode.Double & System.Byte.MaxValue", TypeCode.Double & System.Byte.MaxValue)
PrintResult("TypeCode.Double & -3S", TypeCode.Double & -3S)
PrintResult("TypeCode.Double & 24US", TypeCode.Double & 24US)
PrintResult("TypeCode.Double & -5I", TypeCode.Double & -5I)
PrintResult("TypeCode.Double & 26UI", TypeCode.Double & 26UI)
PrintResult("TypeCode.Double & -7L", TypeCode.Double & -7L)
PrintResult("TypeCode.Double & 28UL", TypeCode.Double & 28UL)
PrintResult("TypeCode.Double & -9D", TypeCode.Double & -9D)
PrintResult("TypeCode.Double & 10.0F", TypeCode.Double & 10.0F)
PrintResult("TypeCode.Double & -11.0R", TypeCode.Double & -11.0R)
PrintResult("TypeCode.Double & ""12""", TypeCode.Double & "12")
PrintResult("TypeCode.Double & TypeCode.Double", TypeCode.Double & TypeCode.Double)
PrintResult("False Like False", False Like False)
PrintResult("False Like True", False Like True)
PrintResult("False Like System.SByte.MinValue", False Like System.SByte.MinValue)
PrintResult("False Like System.Byte.MaxValue", False Like System.Byte.MaxValue)
PrintResult("False Like -3S", False Like -3S)
PrintResult("False Like 24US", False Like 24US)
PrintResult("False Like -5I", False Like -5I)
PrintResult("False Like 26UI", False Like 26UI)
PrintResult("False Like -7L", False Like -7L)
PrintResult("False Like 28UL", False Like 28UL)
PrintResult("False Like -9D", False Like -9D)
PrintResult("False Like 10.0F", False Like 10.0F)
PrintResult("False Like -11.0R", False Like -11.0R)
PrintResult("False Like ""12""", False Like "12")
PrintResult("False Like TypeCode.Double", False Like TypeCode.Double)
PrintResult("True Like False", True Like False)
PrintResult("True Like True", True Like True)
PrintResult("True Like System.SByte.MinValue", True Like System.SByte.MinValue)
PrintResult("True Like System.Byte.MaxValue", True Like System.Byte.MaxValue)
PrintResult("True Like -3S", True Like -3S)
PrintResult("True Like 24US", True Like 24US)
PrintResult("True Like -5I", True Like -5I)
PrintResult("True Like 26UI", True Like 26UI)
PrintResult("True Like -7L", True Like -7L)
PrintResult("True Like 28UL", True Like 28UL)
PrintResult("True Like -9D", True Like -9D)
PrintResult("True Like 10.0F", True Like 10.0F)
PrintResult("True Like -11.0R", True Like -11.0R)
PrintResult("True Like ""12""", True Like "12")
PrintResult("True Like TypeCode.Double", True Like TypeCode.Double)
PrintResult("System.SByte.MinValue Like False", System.SByte.MinValue Like False)
PrintResult("System.SByte.MinValue Like True", System.SByte.MinValue Like True)
PrintResult("System.SByte.MinValue Like System.SByte.MinValue", System.SByte.MinValue Like System.SByte.MinValue)
PrintResult("System.SByte.MinValue Like System.Byte.MaxValue", System.SByte.MinValue Like System.Byte.MaxValue)
PrintResult("System.SByte.MinValue Like -3S", System.SByte.MinValue Like -3S)
PrintResult("System.SByte.MinValue Like 24US", System.SByte.MinValue Like 24US)
PrintResult("System.SByte.MinValue Like -5I", System.SByte.MinValue Like -5I)
PrintResult("System.SByte.MinValue Like 26UI", System.SByte.MinValue Like 26UI)
PrintResult("System.SByte.MinValue Like -7L", System.SByte.MinValue Like -7L)
PrintResult("System.SByte.MinValue Like 28UL", System.SByte.MinValue Like 28UL)
PrintResult("System.SByte.MinValue Like -9D", System.SByte.MinValue Like -9D)
PrintResult("System.SByte.MinValue Like 10.0F", System.SByte.MinValue Like 10.0F)
PrintResult("System.SByte.MinValue Like -11.0R", System.SByte.MinValue Like -11.0R)
PrintResult("System.SByte.MinValue Like ""12""", System.SByte.MinValue Like "12")
PrintResult("System.SByte.MinValue Like TypeCode.Double", System.SByte.MinValue Like TypeCode.Double)
PrintResult("System.Byte.MaxValue Like False", System.Byte.MaxValue Like False)
PrintResult("System.Byte.MaxValue Like True", System.Byte.MaxValue Like True)
PrintResult("System.Byte.MaxValue Like System.SByte.MinValue", System.Byte.MaxValue Like System.SByte.MinValue)
PrintResult("System.Byte.MaxValue Like System.Byte.MaxValue", System.Byte.MaxValue Like System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue Like -3S", System.Byte.MaxValue Like -3S)
PrintResult("System.Byte.MaxValue Like 24US", System.Byte.MaxValue Like 24US)
PrintResult("System.Byte.MaxValue Like -5I", System.Byte.MaxValue Like -5I)
PrintResult("System.Byte.MaxValue Like 26UI", System.Byte.MaxValue Like 26UI)
PrintResult("System.Byte.MaxValue Like -7L", System.Byte.MaxValue Like -7L)
PrintResult("System.Byte.MaxValue Like 28UL", System.Byte.MaxValue Like 28UL)
PrintResult("System.Byte.MaxValue Like -9D", System.Byte.MaxValue Like -9D)
PrintResult("System.Byte.MaxValue Like 10.0F", System.Byte.MaxValue Like 10.0F)
PrintResult("System.Byte.MaxValue Like -11.0R", System.Byte.MaxValue Like -11.0R)
PrintResult("System.Byte.MaxValue Like ""12""", System.Byte.MaxValue Like "12")
PrintResult("System.Byte.MaxValue Like TypeCode.Double", System.Byte.MaxValue Like TypeCode.Double)
PrintResult("-3S Like False", -3S Like False)
PrintResult("-3S Like True", -3S Like True)
PrintResult("-3S Like System.SByte.MinValue", -3S Like System.SByte.MinValue)
PrintResult("-3S Like System.Byte.MaxValue", -3S Like System.Byte.MaxValue)
PrintResult("-3S Like -3S", -3S Like -3S)
PrintResult("-3S Like 24US", -3S Like 24US)
PrintResult("-3S Like -5I", -3S Like -5I)
PrintResult("-3S Like 26UI", -3S Like 26UI)
PrintResult("-3S Like -7L", -3S Like -7L)
PrintResult("-3S Like 28UL", -3S Like 28UL)
PrintResult("-3S Like -9D", -3S Like -9D)
PrintResult("-3S Like 10.0F", -3S Like 10.0F)
PrintResult("-3S Like -11.0R", -3S Like -11.0R)
PrintResult("-3S Like ""12""", -3S Like "12")
PrintResult("-3S Like TypeCode.Double", -3S Like TypeCode.Double)
PrintResult("24US Like False", 24US Like False)
PrintResult("24US Like True", 24US Like True)
PrintResult("24US Like System.SByte.MinValue", 24US Like System.SByte.MinValue)
PrintResult("24US Like System.Byte.MaxValue", 24US Like System.Byte.MaxValue)
PrintResult("24US Like -3S", 24US Like -3S)
PrintResult("24US Like 24US", 24US Like 24US)
PrintResult("24US Like -5I", 24US Like -5I)
PrintResult("24US Like 26UI", 24US Like 26UI)
PrintResult("24US Like -7L", 24US Like -7L)
PrintResult("24US Like 28UL", 24US Like 28UL)
PrintResult("24US Like -9D", 24US Like -9D)
PrintResult("24US Like 10.0F", 24US Like 10.0F)
PrintResult("24US Like -11.0R", 24US Like -11.0R)
PrintResult("24US Like ""12""", 24US Like "12")
PrintResult("24US Like TypeCode.Double", 24US Like TypeCode.Double)
PrintResult("-5I Like False", -5I Like False)
PrintResult("-5I Like True", -5I Like True)
PrintResult("-5I Like System.SByte.MinValue", -5I Like System.SByte.MinValue)
PrintResult("-5I Like System.Byte.MaxValue", -5I Like System.Byte.MaxValue)
PrintResult("-5I Like -3S", -5I Like -3S)
PrintResult("-5I Like 24US", -5I Like 24US)
PrintResult("-5I Like -5I", -5I Like -5I)
PrintResult("-5I Like 26UI", -5I Like 26UI)
PrintResult("-5I Like -7L", -5I Like -7L)
PrintResult("-5I Like 28UL", -5I Like 28UL)
PrintResult("-5I Like -9D", -5I Like -9D)
PrintResult("-5I Like 10.0F", -5I Like 10.0F)
PrintResult("-5I Like -11.0R", -5I Like -11.0R)
PrintResult("-5I Like ""12""", -5I Like "12")
PrintResult("-5I Like TypeCode.Double", -5I Like TypeCode.Double)
PrintResult("26UI Like False", 26UI Like False)
PrintResult("26UI Like True", 26UI Like True)
PrintResult("26UI Like System.SByte.MinValue", 26UI Like System.SByte.MinValue)
PrintResult("26UI Like System.Byte.MaxValue", 26UI Like System.Byte.MaxValue)
PrintResult("26UI Like -3S", 26UI Like -3S)
PrintResult("26UI Like 24US", 26UI Like 24US)
PrintResult("26UI Like -5I", 26UI Like -5I)
PrintResult("26UI Like 26UI", 26UI Like 26UI)
PrintResult("26UI Like -7L", 26UI Like -7L)
PrintResult("26UI Like 28UL", 26UI Like 28UL)
PrintResult("26UI Like -9D", 26UI Like -9D)
PrintResult("26UI Like 10.0F", 26UI Like 10.0F)
PrintResult("26UI Like -11.0R", 26UI Like -11.0R)
PrintResult("26UI Like ""12""", 26UI Like "12")
PrintResult("26UI Like TypeCode.Double", 26UI Like TypeCode.Double)
PrintResult("-7L Like False", -7L Like False)
PrintResult("-7L Like True", -7L Like True)
PrintResult("-7L Like System.SByte.MinValue", -7L Like System.SByte.MinValue)
PrintResult("-7L Like System.Byte.MaxValue", -7L Like System.Byte.MaxValue)
PrintResult("-7L Like -3S", -7L Like -3S)
PrintResult("-7L Like 24US", -7L Like 24US)
PrintResult("-7L Like -5I", -7L Like -5I)
PrintResult("-7L Like 26UI", -7L Like 26UI)
PrintResult("-7L Like -7L", -7L Like -7L)
PrintResult("-7L Like 28UL", -7L Like 28UL)
PrintResult("-7L Like -9D", -7L Like -9D)
PrintResult("-7L Like 10.0F", -7L Like 10.0F)
PrintResult("-7L Like -11.0R", -7L Like -11.0R)
PrintResult("-7L Like ""12""", -7L Like "12")
PrintResult("-7L Like TypeCode.Double", -7L Like TypeCode.Double)
PrintResult("28UL Like False", 28UL Like False)
PrintResult("28UL Like True", 28UL Like True)
PrintResult("28UL Like System.SByte.MinValue", 28UL Like System.SByte.MinValue)
PrintResult("28UL Like System.Byte.MaxValue", 28UL Like System.Byte.MaxValue)
PrintResult("28UL Like -3S", 28UL Like -3S)
PrintResult("28UL Like 24US", 28UL Like 24US)
PrintResult("28UL Like -5I", 28UL Like -5I)
PrintResult("28UL Like 26UI", 28UL Like 26UI)
PrintResult("28UL Like -7L", 28UL Like -7L)
PrintResult("28UL Like 28UL", 28UL Like 28UL)
PrintResult("28UL Like -9D", 28UL Like -9D)
PrintResult("28UL Like 10.0F", 28UL Like 10.0F)
PrintResult("28UL Like -11.0R", 28UL Like -11.0R)
PrintResult("28UL Like ""12""", 28UL Like "12")
PrintResult("28UL Like TypeCode.Double", 28UL Like TypeCode.Double)
PrintResult("-9D Like False", -9D Like False)
PrintResult("-9D Like True", -9D Like True)
PrintResult("-9D Like System.SByte.MinValue", -9D Like System.SByte.MinValue)
PrintResult("-9D Like System.Byte.MaxValue", -9D Like System.Byte.MaxValue)
PrintResult("-9D Like -3S", -9D Like -3S)
PrintResult("-9D Like 24US", -9D Like 24US)
PrintResult("-9D Like -5I", -9D Like -5I)
PrintResult("-9D Like 26UI", -9D Like 26UI)
PrintResult("-9D Like -7L", -9D Like -7L)
PrintResult("-9D Like 28UL", -9D Like 28UL)
PrintResult("-9D Like -9D", -9D Like -9D)
PrintResult("-9D Like 10.0F", -9D Like 10.0F)
PrintResult("-9D Like -11.0R", -9D Like -11.0R)
PrintResult("-9D Like ""12""", -9D Like "12")
PrintResult("-9D Like TypeCode.Double", -9D Like TypeCode.Double)
PrintResult("10.0F Like False", 10.0F Like False)
PrintResult("10.0F Like True", 10.0F Like True)
PrintResult("10.0F Like System.SByte.MinValue", 10.0F Like System.SByte.MinValue)
PrintResult("10.0F Like System.Byte.MaxValue", 10.0F Like System.Byte.MaxValue)
PrintResult("10.0F Like -3S", 10.0F Like -3S)
PrintResult("10.0F Like 24US", 10.0F Like 24US)
PrintResult("10.0F Like -5I", 10.0F Like -5I)
PrintResult("10.0F Like 26UI", 10.0F Like 26UI)
PrintResult("10.0F Like -7L", 10.0F Like -7L)
PrintResult("10.0F Like 28UL", 10.0F Like 28UL)
PrintResult("10.0F Like -9D", 10.0F Like -9D)
PrintResult("10.0F Like 10.0F", 10.0F Like 10.0F)
PrintResult("10.0F Like -11.0R", 10.0F Like -11.0R)
PrintResult("10.0F Like ""12""", 10.0F Like "12")
PrintResult("10.0F Like TypeCode.Double", 10.0F Like TypeCode.Double)
PrintResult("-11.0R Like False", -11.0R Like False)
PrintResult("-11.0R Like True", -11.0R Like True)
PrintResult("-11.0R Like System.SByte.MinValue", -11.0R Like System.SByte.MinValue)
PrintResult("-11.0R Like System.Byte.MaxValue", -11.0R Like System.Byte.MaxValue)
PrintResult("-11.0R Like -3S", -11.0R Like -3S)
PrintResult("-11.0R Like 24US", -11.0R Like 24US)
PrintResult("-11.0R Like -5I", -11.0R Like -5I)
PrintResult("-11.0R Like 26UI", -11.0R Like 26UI)
PrintResult("-11.0R Like -7L", -11.0R Like -7L)
PrintResult("-11.0R Like 28UL", -11.0R Like 28UL)
PrintResult("-11.0R Like -9D", -11.0R Like -9D)
PrintResult("-11.0R Like 10.0F", -11.0R Like 10.0F)
PrintResult("-11.0R Like -11.0R", -11.0R Like -11.0R)
PrintResult("-11.0R Like ""12""", -11.0R Like "12")
PrintResult("-11.0R Like TypeCode.Double", -11.0R Like TypeCode.Double)
PrintResult("""12"" Like False", "12" Like False)
PrintResult("""12"" Like True", "12" Like True)
PrintResult("""12"" Like System.SByte.MinValue", "12" Like System.SByte.MinValue)
PrintResult("""12"" Like System.Byte.MaxValue", "12" Like System.Byte.MaxValue)
PrintResult("""12"" Like -3S", "12" Like -3S)
PrintResult("""12"" Like 24US", "12" Like 24US)
PrintResult("""12"" Like -5I", "12" Like -5I)
PrintResult("""12"" Like 26UI", "12" Like 26UI)
PrintResult("""12"" Like -7L", "12" Like -7L)
PrintResult("""12"" Like 28UL", "12" Like 28UL)
PrintResult("""12"" Like -9D", "12" Like -9D)
PrintResult("""12"" Like 10.0F", "12" Like 10.0F)
PrintResult("""12"" Like -11.0R", "12" Like -11.0R)
PrintResult("""12"" Like ""12""", "12" Like "12")
PrintResult("""12"" Like TypeCode.Double", "12" Like TypeCode.Double)
PrintResult("TypeCode.Double Like False", TypeCode.Double Like False)
PrintResult("TypeCode.Double Like True", TypeCode.Double Like True)
PrintResult("TypeCode.Double Like System.SByte.MinValue", TypeCode.Double Like System.SByte.MinValue)
PrintResult("TypeCode.Double Like System.Byte.MaxValue", TypeCode.Double Like System.Byte.MaxValue)
PrintResult("TypeCode.Double Like -3S", TypeCode.Double Like -3S)
PrintResult("TypeCode.Double Like 24US", TypeCode.Double Like 24US)
PrintResult("TypeCode.Double Like -5I", TypeCode.Double Like -5I)
PrintResult("TypeCode.Double Like 26UI", TypeCode.Double Like 26UI)
PrintResult("TypeCode.Double Like -7L", TypeCode.Double Like -7L)
PrintResult("TypeCode.Double Like 28UL", TypeCode.Double Like 28UL)
PrintResult("TypeCode.Double Like -9D", TypeCode.Double Like -9D)
PrintResult("TypeCode.Double Like 10.0F", TypeCode.Double Like 10.0F)
PrintResult("TypeCode.Double Like -11.0R", TypeCode.Double Like -11.0R)
PrintResult("TypeCode.Double Like ""12""", TypeCode.Double Like "12")
PrintResult("TypeCode.Double Like TypeCode.Double", TypeCode.Double Like TypeCode.Double)
PrintResult("False = False", False = False)
PrintResult("False = True", False = True)
PrintResult("False = System.SByte.MinValue", False = System.SByte.MinValue)
PrintResult("False = System.Byte.MaxValue", False = System.Byte.MaxValue)
PrintResult("False = -3S", False = -3S)
PrintResult("False = 24US", False = 24US)
PrintResult("False = -5I", False = -5I)
PrintResult("False = 26UI", False = 26UI)
PrintResult("False = -7L", False = -7L)
PrintResult("False = 28UL", False = 28UL)
PrintResult("False = -9D", False = -9D)
PrintResult("False = 10.0F", False = 10.0F)
PrintResult("False = -11.0R", False = -11.0R)
PrintResult("False = ""12""", False = "12")
PrintResult("False = TypeCode.Double", False = TypeCode.Double)
PrintResult("True = False", True = False)
PrintResult("True = True", True = True)
PrintResult("True = System.SByte.MinValue", True = System.SByte.MinValue)
PrintResult("True = System.Byte.MaxValue", True = System.Byte.MaxValue)
PrintResult("True = -3S", True = -3S)
PrintResult("True = 24US", True = 24US)
PrintResult("True = -5I", True = -5I)
PrintResult("True = 26UI", True = 26UI)
PrintResult("True = -7L", True = -7L)
PrintResult("True = 28UL", True = 28UL)
PrintResult("True = -9D", True = -9D)
PrintResult("True = 10.0F", True = 10.0F)
PrintResult("True = -11.0R", True = -11.0R)
PrintResult("True = ""12""", True = "12")
PrintResult("True = TypeCode.Double", True = TypeCode.Double)
PrintResult("System.SByte.MinValue = False", System.SByte.MinValue = False)
PrintResult("System.SByte.MinValue = True", System.SByte.MinValue = True)
PrintResult("System.SByte.MinValue = System.SByte.MinValue", System.SByte.MinValue = System.SByte.MinValue)
PrintResult("System.SByte.MinValue = System.Byte.MaxValue", System.SByte.MinValue = System.Byte.MaxValue)
PrintResult("System.SByte.MinValue = -3S", System.SByte.MinValue = -3S)
PrintResult("System.SByte.MinValue = 24US", System.SByte.MinValue = 24US)
PrintResult("System.SByte.MinValue = -5I", System.SByte.MinValue = -5I)
PrintResult("System.SByte.MinValue = 26UI", System.SByte.MinValue = 26UI)
PrintResult("System.SByte.MinValue = -7L", System.SByte.MinValue = -7L)
PrintResult("System.SByte.MinValue = 28UL", System.SByte.MinValue = 28UL)
PrintResult("System.SByte.MinValue = -9D", System.SByte.MinValue = -9D)
PrintResult("System.SByte.MinValue = 10.0F", System.SByte.MinValue = 10.0F)
PrintResult("System.SByte.MinValue = -11.0R", System.SByte.MinValue = -11.0R)
PrintResult("System.SByte.MinValue = ""12""", System.SByte.MinValue = "12")
PrintResult("System.SByte.MinValue = TypeCode.Double", System.SByte.MinValue = TypeCode.Double)
PrintResult("System.Byte.MaxValue = False", System.Byte.MaxValue = False)
PrintResult("System.Byte.MaxValue = True", System.Byte.MaxValue = True)
PrintResult("System.Byte.MaxValue = System.SByte.MinValue", System.Byte.MaxValue = System.SByte.MinValue)
PrintResult("System.Byte.MaxValue = System.Byte.MaxValue", System.Byte.MaxValue = System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue = -3S", System.Byte.MaxValue = -3S)
PrintResult("System.Byte.MaxValue = 24US", System.Byte.MaxValue = 24US)
PrintResult("System.Byte.MaxValue = -5I", System.Byte.MaxValue = -5I)
PrintResult("System.Byte.MaxValue = 26UI", System.Byte.MaxValue = 26UI)
PrintResult("System.Byte.MaxValue = -7L", System.Byte.MaxValue = -7L)
PrintResult("System.Byte.MaxValue = 28UL", System.Byte.MaxValue = 28UL)
PrintResult("System.Byte.MaxValue = -9D", System.Byte.MaxValue = -9D)
PrintResult("System.Byte.MaxValue = 10.0F", System.Byte.MaxValue = 10.0F)
PrintResult("System.Byte.MaxValue = -11.0R", System.Byte.MaxValue = -11.0R)
PrintResult("System.Byte.MaxValue = ""12""", System.Byte.MaxValue = "12")
PrintResult("System.Byte.MaxValue = TypeCode.Double", System.Byte.MaxValue = TypeCode.Double)
PrintResult("-3S = False", -3S = False)
PrintResult("-3S = True", -3S = True)
PrintResult("-3S = System.SByte.MinValue", -3S = System.SByte.MinValue)
PrintResult("-3S = System.Byte.MaxValue", -3S = System.Byte.MaxValue)
PrintResult("-3S = -3S", -3S = -3S)
PrintResult("-3S = 24US", -3S = 24US)
PrintResult("-3S = -5I", -3S = -5I)
PrintResult("-3S = 26UI", -3S = 26UI)
PrintResult("-3S = -7L", -3S = -7L)
PrintResult("-3S = 28UL", -3S = 28UL)
PrintResult("-3S = -9D", -3S = -9D)
PrintResult("-3S = 10.0F", -3S = 10.0F)
PrintResult("-3S = -11.0R", -3S = -11.0R)
PrintResult("-3S = ""12""", -3S = "12")
PrintResult("-3S = TypeCode.Double", -3S = TypeCode.Double)
PrintResult("24US = False", 24US = False)
PrintResult("24US = True", 24US = True)
PrintResult("24US = System.SByte.MinValue", 24US = System.SByte.MinValue)
PrintResult("24US = System.Byte.MaxValue", 24US = System.Byte.MaxValue)
PrintResult("24US = -3S", 24US = -3S)
PrintResult("24US = 24US", 24US = 24US)
PrintResult("24US = -5I", 24US = -5I)
PrintResult("24US = 26UI", 24US = 26UI)
PrintResult("24US = -7L", 24US = -7L)
PrintResult("24US = 28UL", 24US = 28UL)
PrintResult("24US = -9D", 24US = -9D)
PrintResult("24US = 10.0F", 24US = 10.0F)
PrintResult("24US = -11.0R", 24US = -11.0R)
PrintResult("24US = ""12""", 24US = "12")
PrintResult("24US = TypeCode.Double", 24US = TypeCode.Double)
PrintResult("-5I = False", -5I = False)
PrintResult("-5I = True", -5I = True)
PrintResult("-5I = System.SByte.MinValue", -5I = System.SByte.MinValue)
PrintResult("-5I = System.Byte.MaxValue", -5I = System.Byte.MaxValue)
PrintResult("-5I = -3S", -5I = -3S)
PrintResult("-5I = 24US", -5I = 24US)
PrintResult("-5I = -5I", -5I = -5I)
PrintResult("-5I = 26UI", -5I = 26UI)
PrintResult("-5I = -7L", -5I = -7L)
PrintResult("-5I = 28UL", -5I = 28UL)
PrintResult("-5I = -9D", -5I = -9D)
PrintResult("-5I = 10.0F", -5I = 10.0F)
PrintResult("-5I = -11.0R", -5I = -11.0R)
PrintResult("-5I = ""12""", -5I = "12")
PrintResult("-5I = TypeCode.Double", -5I = TypeCode.Double)
PrintResult("26UI = False", 26UI = False)
PrintResult("26UI = True", 26UI = True)
PrintResult("26UI = System.SByte.MinValue", 26UI = System.SByte.MinValue)
PrintResult("26UI = System.Byte.MaxValue", 26UI = System.Byte.MaxValue)
PrintResult("26UI = -3S", 26UI = -3S)
PrintResult("26UI = 24US", 26UI = 24US)
PrintResult("26UI = -5I", 26UI = -5I)
PrintResult("26UI = 26UI", 26UI = 26UI)
PrintResult("26UI = -7L", 26UI = -7L)
PrintResult("26UI = 28UL", 26UI = 28UL)
PrintResult("26UI = -9D", 26UI = -9D)
PrintResult("26UI = 10.0F", 26UI = 10.0F)
PrintResult("26UI = -11.0R", 26UI = -11.0R)
PrintResult("26UI = ""12""", 26UI = "12")
PrintResult("26UI = TypeCode.Double", 26UI = TypeCode.Double)
PrintResult("-7L = False", -7L = False)
PrintResult("-7L = True", -7L = True)
PrintResult("-7L = System.SByte.MinValue", -7L = System.SByte.MinValue)
PrintResult("-7L = System.Byte.MaxValue", -7L = System.Byte.MaxValue)
PrintResult("-7L = -3S", -7L = -3S)
PrintResult("-7L = 24US", -7L = 24US)
PrintResult("-7L = -5I", -7L = -5I)
PrintResult("-7L = 26UI", -7L = 26UI)
PrintResult("-7L = -7L", -7L = -7L)
PrintResult("-7L = 28UL", -7L = 28UL)
PrintResult("-7L = -9D", -7L = -9D)
PrintResult("-7L = 10.0F", -7L = 10.0F)
PrintResult("-7L = -11.0R", -7L = -11.0R)
PrintResult("-7L = ""12""", -7L = "12")
PrintResult("-7L = TypeCode.Double", -7L = TypeCode.Double)
PrintResult("28UL = False", 28UL = False)
PrintResult("28UL = True", 28UL = True)
PrintResult("28UL = System.SByte.MinValue", 28UL = System.SByte.MinValue)
PrintResult("28UL = System.Byte.MaxValue", 28UL = System.Byte.MaxValue)
PrintResult("28UL = -3S", 28UL = -3S)
PrintResult("28UL = 24US", 28UL = 24US)
PrintResult("28UL = -5I", 28UL = -5I)
PrintResult("28UL = 26UI", 28UL = 26UI)
PrintResult("28UL = -7L", 28UL = -7L)
PrintResult("28UL = 28UL", 28UL = 28UL)
PrintResult("28UL = -9D", 28UL = -9D)
PrintResult("28UL = 10.0F", 28UL = 10.0F)
PrintResult("28UL = -11.0R", 28UL = -11.0R)
PrintResult("28UL = ""12""", 28UL = "12")
PrintResult("28UL = TypeCode.Double", 28UL = TypeCode.Double)
PrintResult("-9D = False", -9D = False)
PrintResult("-9D = True", -9D = True)
PrintResult("-9D = System.SByte.MinValue", -9D = System.SByte.MinValue)
PrintResult("-9D = System.Byte.MaxValue", -9D = System.Byte.MaxValue)
PrintResult("-9D = -3S", -9D = -3S)
PrintResult("-9D = 24US", -9D = 24US)
PrintResult("-9D = -5I", -9D = -5I)
PrintResult("-9D = 26UI", -9D = 26UI)
PrintResult("-9D = -7L", -9D = -7L)
PrintResult("-9D = 28UL", -9D = 28UL)
PrintResult("-9D = -9D", -9D = -9D)
PrintResult("-9D = 10.0F", -9D = 10.0F)
PrintResult("-9D = -11.0R", -9D = -11.0R)
PrintResult("-9D = ""12""", -9D = "12")
PrintResult("-9D = TypeCode.Double", -9D = TypeCode.Double)
PrintResult("10.0F = False", 10.0F = False)
PrintResult("10.0F = True", 10.0F = True)
PrintResult("10.0F = System.SByte.MinValue", 10.0F = System.SByte.MinValue)
PrintResult("10.0F = System.Byte.MaxValue", 10.0F = System.Byte.MaxValue)
PrintResult("10.0F = -3S", 10.0F = -3S)
PrintResult("10.0F = 24US", 10.0F = 24US)
PrintResult("10.0F = -5I", 10.0F = -5I)
PrintResult("10.0F = 26UI", 10.0F = 26UI)
PrintResult("10.0F = -7L", 10.0F = -7L)
PrintResult("10.0F = 28UL", 10.0F = 28UL)
PrintResult("10.0F = -9D", 10.0F = -9D)
PrintResult("10.0F = 10.0F", 10.0F = 10.0F)
PrintResult("10.0F = -11.0R", 10.0F = -11.0R)
PrintResult("10.0F = ""12""", 10.0F = "12")
PrintResult("10.0F = TypeCode.Double", 10.0F = TypeCode.Double)
PrintResult("-11.0R = False", -11.0R = False)
PrintResult("-11.0R = True", -11.0R = True)
PrintResult("-11.0R = System.SByte.MinValue", -11.0R = System.SByte.MinValue)
PrintResult("-11.0R = System.Byte.MaxValue", -11.0R = System.Byte.MaxValue)
PrintResult("-11.0R = -3S", -11.0R = -3S)
PrintResult("-11.0R = 24US", -11.0R = 24US)
PrintResult("-11.0R = -5I", -11.0R = -5I)
PrintResult("-11.0R = 26UI", -11.0R = 26UI)
PrintResult("-11.0R = -7L", -11.0R = -7L)
PrintResult("-11.0R = 28UL", -11.0R = 28UL)
PrintResult("-11.0R = -9D", -11.0R = -9D)
PrintResult("-11.0R = 10.0F", -11.0R = 10.0F)
PrintResult("-11.0R = -11.0R", -11.0R = -11.0R)
PrintResult("-11.0R = ""12""", -11.0R = "12")
PrintResult("-11.0R = TypeCode.Double", -11.0R = TypeCode.Double)
PrintResult("""12"" = False", "12" = False)
PrintResult("""12"" = True", "12" = True)
PrintResult("""12"" = System.SByte.MinValue", "12" = System.SByte.MinValue)
PrintResult("""12"" = System.Byte.MaxValue", "12" = System.Byte.MaxValue)
PrintResult("""12"" = -3S", "12" = -3S)
PrintResult("""12"" = 24US", "12" = 24US)
PrintResult("""12"" = -5I", "12" = -5I)
PrintResult("""12"" = 26UI", "12" = 26UI)
PrintResult("""12"" = -7L", "12" = -7L)
PrintResult("""12"" = 28UL", "12" = 28UL)
PrintResult("""12"" = -9D", "12" = -9D)
PrintResult("""12"" = 10.0F", "12" = 10.0F)
PrintResult("""12"" = -11.0R", "12" = -11.0R)
PrintResult("""12"" = ""12""", "12" = "12")
PrintResult("""12"" = TypeCode.Double", "12" = TypeCode.Double)
PrintResult("TypeCode.Double = False", TypeCode.Double = False)
PrintResult("TypeCode.Double = True", TypeCode.Double = True)
PrintResult("TypeCode.Double = System.SByte.MinValue", TypeCode.Double = System.SByte.MinValue)
PrintResult("TypeCode.Double = System.Byte.MaxValue", TypeCode.Double = System.Byte.MaxValue)
PrintResult("TypeCode.Double = -3S", TypeCode.Double = -3S)
PrintResult("TypeCode.Double = 24US", TypeCode.Double = 24US)
PrintResult("TypeCode.Double = -5I", TypeCode.Double = -5I)
PrintResult("TypeCode.Double = 26UI", TypeCode.Double = 26UI)
PrintResult("TypeCode.Double = -7L", TypeCode.Double = -7L)
PrintResult("TypeCode.Double = 28UL", TypeCode.Double = 28UL)
PrintResult("TypeCode.Double = -9D", TypeCode.Double = -9D)
PrintResult("TypeCode.Double = 10.0F", TypeCode.Double = 10.0F)
PrintResult("TypeCode.Double = -11.0R", TypeCode.Double = -11.0R)
PrintResult("TypeCode.Double = ""12""", TypeCode.Double = "12")
PrintResult("TypeCode.Double = TypeCode.Double", TypeCode.Double = TypeCode.Double)
PrintResult("False <> False", False <> False)
PrintResult("False <> True", False <> True)
PrintResult("False <> System.SByte.MinValue", False <> System.SByte.MinValue)
PrintResult("False <> System.Byte.MaxValue", False <> System.Byte.MaxValue)
PrintResult("False <> -3S", False <> -3S)
PrintResult("False <> 24US", False <> 24US)
PrintResult("False <> -5I", False <> -5I)
PrintResult("False <> 26UI", False <> 26UI)
PrintResult("False <> -7L", False <> -7L)
PrintResult("False <> 28UL", False <> 28UL)
PrintResult("False <> -9D", False <> -9D)
PrintResult("False <> 10.0F", False <> 10.0F)
PrintResult("False <> -11.0R", False <> -11.0R)
PrintResult("False <> ""12""", False <> "12")
PrintResult("False <> TypeCode.Double", False <> TypeCode.Double)
PrintResult("True <> False", True <> False)
PrintResult("True <> True", True <> True)
PrintResult("True <> System.SByte.MinValue", True <> System.SByte.MinValue)
PrintResult("True <> System.Byte.MaxValue", True <> System.Byte.MaxValue)
PrintResult("True <> -3S", True <> -3S)
PrintResult("True <> 24US", True <> 24US)
PrintResult("True <> -5I", True <> -5I)
PrintResult("True <> 26UI", True <> 26UI)
PrintResult("True <> -7L", True <> -7L)
PrintResult("True <> 28UL", True <> 28UL)
PrintResult("True <> -9D", True <> -9D)
PrintResult("True <> 10.0F", True <> 10.0F)
PrintResult("True <> -11.0R", True <> -11.0R)
PrintResult("True <> ""12""", True <> "12")
PrintResult("True <> TypeCode.Double", True <> TypeCode.Double)
PrintResult("System.SByte.MinValue <> False", System.SByte.MinValue <> False)
PrintResult("System.SByte.MinValue <> True", System.SByte.MinValue <> True)
PrintResult("System.SByte.MinValue <> System.SByte.MinValue", System.SByte.MinValue <> System.SByte.MinValue)
PrintResult("System.SByte.MinValue <> System.Byte.MaxValue", System.SByte.MinValue <> System.Byte.MaxValue)
PrintResult("System.SByte.MinValue <> -3S", System.SByte.MinValue <> -3S)
PrintResult("System.SByte.MinValue <> 24US", System.SByte.MinValue <> 24US)
PrintResult("System.SByte.MinValue <> -5I", System.SByte.MinValue <> -5I)
PrintResult("System.SByte.MinValue <> 26UI", System.SByte.MinValue <> 26UI)
PrintResult("System.SByte.MinValue <> -7L", System.SByte.MinValue <> -7L)
PrintResult("System.SByte.MinValue <> 28UL", System.SByte.MinValue <> 28UL)
PrintResult("System.SByte.MinValue <> -9D", System.SByte.MinValue <> -9D)
PrintResult("System.SByte.MinValue <> 10.0F", System.SByte.MinValue <> 10.0F)
PrintResult("System.SByte.MinValue <> -11.0R", System.SByte.MinValue <> -11.0R)
PrintResult("System.SByte.MinValue <> ""12""", System.SByte.MinValue <> "12")
PrintResult("System.SByte.MinValue <> TypeCode.Double", System.SByte.MinValue <> TypeCode.Double)
PrintResult("System.Byte.MaxValue <> False", System.Byte.MaxValue <> False)
PrintResult("System.Byte.MaxValue <> True", System.Byte.MaxValue <> True)
PrintResult("System.Byte.MaxValue <> System.SByte.MinValue", System.Byte.MaxValue <> System.SByte.MinValue)
PrintResult("System.Byte.MaxValue <> System.Byte.MaxValue", System.Byte.MaxValue <> System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue <> -3S", System.Byte.MaxValue <> -3S)
PrintResult("System.Byte.MaxValue <> 24US", System.Byte.MaxValue <> 24US)
PrintResult("System.Byte.MaxValue <> -5I", System.Byte.MaxValue <> -5I)
PrintResult("System.Byte.MaxValue <> 26UI", System.Byte.MaxValue <> 26UI)
PrintResult("System.Byte.MaxValue <> -7L", System.Byte.MaxValue <> -7L)
PrintResult("System.Byte.MaxValue <> 28UL", System.Byte.MaxValue <> 28UL)
PrintResult("System.Byte.MaxValue <> -9D", System.Byte.MaxValue <> -9D)
PrintResult("System.Byte.MaxValue <> 10.0F", System.Byte.MaxValue <> 10.0F)
PrintResult("System.Byte.MaxValue <> -11.0R", System.Byte.MaxValue <> -11.0R)
PrintResult("System.Byte.MaxValue <> ""12""", System.Byte.MaxValue <> "12")
PrintResult("System.Byte.MaxValue <> TypeCode.Double", System.Byte.MaxValue <> TypeCode.Double)
PrintResult("-3S <> False", -3S <> False)
PrintResult("-3S <> True", -3S <> True)
PrintResult("-3S <> System.SByte.MinValue", -3S <> System.SByte.MinValue)
PrintResult("-3S <> System.Byte.MaxValue", -3S <> System.Byte.MaxValue)
PrintResult("-3S <> -3S", -3S <> -3S)
PrintResult("-3S <> 24US", -3S <> 24US)
PrintResult("-3S <> -5I", -3S <> -5I)
PrintResult("-3S <> 26UI", -3S <> 26UI)
PrintResult("-3S <> -7L", -3S <> -7L)
PrintResult("-3S <> 28UL", -3S <> 28UL)
PrintResult("-3S <> -9D", -3S <> -9D)
PrintResult("-3S <> 10.0F", -3S <> 10.0F)
PrintResult("-3S <> -11.0R", -3S <> -11.0R)
PrintResult("-3S <> ""12""", -3S <> "12")
PrintResult("-3S <> TypeCode.Double", -3S <> TypeCode.Double)
PrintResult("24US <> False", 24US <> False)
PrintResult("24US <> True", 24US <> True)
PrintResult("24US <> System.SByte.MinValue", 24US <> System.SByte.MinValue)
PrintResult("24US <> System.Byte.MaxValue", 24US <> System.Byte.MaxValue)
PrintResult("24US <> -3S", 24US <> -3S)
PrintResult("24US <> 24US", 24US <> 24US)
PrintResult("24US <> -5I", 24US <> -5I)
PrintResult("24US <> 26UI", 24US <> 26UI)
PrintResult("24US <> -7L", 24US <> -7L)
PrintResult("24US <> 28UL", 24US <> 28UL)
PrintResult("24US <> -9D", 24US <> -9D)
PrintResult("24US <> 10.0F", 24US <> 10.0F)
PrintResult("24US <> -11.0R", 24US <> -11.0R)
PrintResult("24US <> ""12""", 24US <> "12")
PrintResult("24US <> TypeCode.Double", 24US <> TypeCode.Double)
PrintResult("-5I <> False", -5I <> False)
PrintResult("-5I <> True", -5I <> True)
PrintResult("-5I <> System.SByte.MinValue", -5I <> System.SByte.MinValue)
PrintResult("-5I <> System.Byte.MaxValue", -5I <> System.Byte.MaxValue)
PrintResult("-5I <> -3S", -5I <> -3S)
PrintResult("-5I <> 24US", -5I <> 24US)
PrintResult("-5I <> -5I", -5I <> -5I)
PrintResult("-5I <> 26UI", -5I <> 26UI)
PrintResult("-5I <> -7L", -5I <> -7L)
PrintResult("-5I <> 28UL", -5I <> 28UL)
PrintResult("-5I <> -9D", -5I <> -9D)
PrintResult("-5I <> 10.0F", -5I <> 10.0F)
PrintResult("-5I <> -11.0R", -5I <> -11.0R)
PrintResult("-5I <> ""12""", -5I <> "12")
PrintResult("-5I <> TypeCode.Double", -5I <> TypeCode.Double)
PrintResult("26UI <> False", 26UI <> False)
PrintResult("26UI <> True", 26UI <> True)
PrintResult("26UI <> System.SByte.MinValue", 26UI <> System.SByte.MinValue)
PrintResult("26UI <> System.Byte.MaxValue", 26UI <> System.Byte.MaxValue)
PrintResult("26UI <> -3S", 26UI <> -3S)
PrintResult("26UI <> 24US", 26UI <> 24US)
PrintResult("26UI <> -5I", 26UI <> -5I)
PrintResult("26UI <> 26UI", 26UI <> 26UI)
PrintResult("26UI <> -7L", 26UI <> -7L)
PrintResult("26UI <> 28UL", 26UI <> 28UL)
PrintResult("26UI <> -9D", 26UI <> -9D)
PrintResult("26UI <> 10.0F", 26UI <> 10.0F)
PrintResult("26UI <> -11.0R", 26UI <> -11.0R)
PrintResult("26UI <> ""12""", 26UI <> "12")
PrintResult("26UI <> TypeCode.Double", 26UI <> TypeCode.Double)
PrintResult("-7L <> False", -7L <> False)
PrintResult("-7L <> True", -7L <> True)
PrintResult("-7L <> System.SByte.MinValue", -7L <> System.SByte.MinValue)
PrintResult("-7L <> System.Byte.MaxValue", -7L <> System.Byte.MaxValue)
PrintResult("-7L <> -3S", -7L <> -3S)
PrintResult("-7L <> 24US", -7L <> 24US)
PrintResult("-7L <> -5I", -7L <> -5I)
PrintResult("-7L <> 26UI", -7L <> 26UI)
PrintResult("-7L <> -7L", -7L <> -7L)
PrintResult("-7L <> 28UL", -7L <> 28UL)
PrintResult("-7L <> -9D", -7L <> -9D)
PrintResult("-7L <> 10.0F", -7L <> 10.0F)
PrintResult("-7L <> -11.0R", -7L <> -11.0R)
PrintResult("-7L <> ""12""", -7L <> "12")
PrintResult("-7L <> TypeCode.Double", -7L <> TypeCode.Double)
PrintResult("28UL <> False", 28UL <> False)
PrintResult("28UL <> True", 28UL <> True)
PrintResult("28UL <> System.SByte.MinValue", 28UL <> System.SByte.MinValue)
PrintResult("28UL <> System.Byte.MaxValue", 28UL <> System.Byte.MaxValue)
PrintResult("28UL <> -3S", 28UL <> -3S)
PrintResult("28UL <> 24US", 28UL <> 24US)
PrintResult("28UL <> -5I", 28UL <> -5I)
PrintResult("28UL <> 26UI", 28UL <> 26UI)
PrintResult("28UL <> -7L", 28UL <> -7L)
PrintResult("28UL <> 28UL", 28UL <> 28UL)
PrintResult("28UL <> -9D", 28UL <> -9D)
PrintResult("28UL <> 10.0F", 28UL <> 10.0F)
PrintResult("28UL <> -11.0R", 28UL <> -11.0R)
PrintResult("28UL <> ""12""", 28UL <> "12")
PrintResult("28UL <> TypeCode.Double", 28UL <> TypeCode.Double)
PrintResult("-9D <> False", -9D <> False)
PrintResult("-9D <> True", -9D <> True)
PrintResult("-9D <> System.SByte.MinValue", -9D <> System.SByte.MinValue)
PrintResult("-9D <> System.Byte.MaxValue", -9D <> System.Byte.MaxValue)
PrintResult("-9D <> -3S", -9D <> -3S)
PrintResult("-9D <> 24US", -9D <> 24US)
PrintResult("-9D <> -5I", -9D <> -5I)
PrintResult("-9D <> 26UI", -9D <> 26UI)
PrintResult("-9D <> -7L", -9D <> -7L)
PrintResult("-9D <> 28UL", -9D <> 28UL)
PrintResult("-9D <> -9D", -9D <> -9D)
PrintResult("-9D <> 10.0F", -9D <> 10.0F)
PrintResult("-9D <> -11.0R", -9D <> -11.0R)
PrintResult("-9D <> ""12""", -9D <> "12")
PrintResult("-9D <> TypeCode.Double", -9D <> TypeCode.Double)
PrintResult("10.0F <> False", 10.0F <> False)
PrintResult("10.0F <> True", 10.0F <> True)
PrintResult("10.0F <> System.SByte.MinValue", 10.0F <> System.SByte.MinValue)
PrintResult("10.0F <> System.Byte.MaxValue", 10.0F <> System.Byte.MaxValue)
PrintResult("10.0F <> -3S", 10.0F <> -3S)
PrintResult("10.0F <> 24US", 10.0F <> 24US)
PrintResult("10.0F <> -5I", 10.0F <> -5I)
PrintResult("10.0F <> 26UI", 10.0F <> 26UI)
PrintResult("10.0F <> -7L", 10.0F <> -7L)
PrintResult("10.0F <> 28UL", 10.0F <> 28UL)
PrintResult("10.0F <> -9D", 10.0F <> -9D)
PrintResult("10.0F <> 10.0F", 10.0F <> 10.0F)
PrintResult("10.0F <> -11.0R", 10.0F <> -11.0R)
PrintResult("10.0F <> ""12""", 10.0F <> "12")
PrintResult("10.0F <> TypeCode.Double", 10.0F <> TypeCode.Double)
PrintResult("-11.0R <> False", -11.0R <> False)
PrintResult("-11.0R <> True", -11.0R <> True)
PrintResult("-11.0R <> System.SByte.MinValue", -11.0R <> System.SByte.MinValue)
PrintResult("-11.0R <> System.Byte.MaxValue", -11.0R <> System.Byte.MaxValue)
PrintResult("-11.0R <> -3S", -11.0R <> -3S)
PrintResult("-11.0R <> 24US", -11.0R <> 24US)
PrintResult("-11.0R <> -5I", -11.0R <> -5I)
PrintResult("-11.0R <> 26UI", -11.0R <> 26UI)
PrintResult("-11.0R <> -7L", -11.0R <> -7L)
PrintResult("-11.0R <> 28UL", -11.0R <> 28UL)
PrintResult("-11.0R <> -9D", -11.0R <> -9D)
PrintResult("-11.0R <> 10.0F", -11.0R <> 10.0F)
PrintResult("-11.0R <> -11.0R", -11.0R <> -11.0R)
PrintResult("-11.0R <> ""12""", -11.0R <> "12")
PrintResult("-11.0R <> TypeCode.Double", -11.0R <> TypeCode.Double)
PrintResult("""12"" <> False", "12" <> False)
PrintResult("""12"" <> True", "12" <> True)
PrintResult("""12"" <> System.SByte.MinValue", "12" <> System.SByte.MinValue)
PrintResult("""12"" <> System.Byte.MaxValue", "12" <> System.Byte.MaxValue)
PrintResult("""12"" <> -3S", "12" <> -3S)
PrintResult("""12"" <> 24US", "12" <> 24US)
PrintResult("""12"" <> -5I", "12" <> -5I)
PrintResult("""12"" <> 26UI", "12" <> 26UI)
PrintResult("""12"" <> -7L", "12" <> -7L)
PrintResult("""12"" <> 28UL", "12" <> 28UL)
PrintResult("""12"" <> -9D", "12" <> -9D)
PrintResult("""12"" <> 10.0F", "12" <> 10.0F)
PrintResult("""12"" <> -11.0R", "12" <> -11.0R)
PrintResult("""12"" <> ""12""", "12" <> "12")
PrintResult("""12"" <> TypeCode.Double", "12" <> TypeCode.Double)
PrintResult("TypeCode.Double <> False", TypeCode.Double <> False)
PrintResult("TypeCode.Double <> True", TypeCode.Double <> True)
PrintResult("TypeCode.Double <> System.SByte.MinValue", TypeCode.Double <> System.SByte.MinValue)
PrintResult("TypeCode.Double <> System.Byte.MaxValue", TypeCode.Double <> System.Byte.MaxValue)
PrintResult("TypeCode.Double <> -3S", TypeCode.Double <> -3S)
PrintResult("TypeCode.Double <> 24US", TypeCode.Double <> 24US)
PrintResult("TypeCode.Double <> -5I", TypeCode.Double <> -5I)
PrintResult("TypeCode.Double <> 26UI", TypeCode.Double <> 26UI)
PrintResult("TypeCode.Double <> -7L", TypeCode.Double <> -7L)
PrintResult("TypeCode.Double <> 28UL", TypeCode.Double <> 28UL)
PrintResult("TypeCode.Double <> -9D", TypeCode.Double <> -9D)
PrintResult("TypeCode.Double <> 10.0F", TypeCode.Double <> 10.0F)
PrintResult("TypeCode.Double <> -11.0R", TypeCode.Double <> -11.0R)
PrintResult("TypeCode.Double <> ""12""", TypeCode.Double <> "12")
PrintResult("TypeCode.Double <> TypeCode.Double", TypeCode.Double <> TypeCode.Double)
PrintResult("False <= False", False <= False)
PrintResult("False <= True", False <= True)
PrintResult("False <= System.SByte.MinValue", False <= System.SByte.MinValue)
PrintResult("False <= System.Byte.MaxValue", False <= System.Byte.MaxValue)
PrintResult("False <= -3S", False <= -3S)
PrintResult("False <= 24US", False <= 24US)
PrintResult("False <= -5I", False <= -5I)
PrintResult("False <= 26UI", False <= 26UI)
PrintResult("False <= -7L", False <= -7L)
PrintResult("False <= 28UL", False <= 28UL)
PrintResult("False <= -9D", False <= -9D)
PrintResult("False <= 10.0F", False <= 10.0F)
PrintResult("False <= -11.0R", False <= -11.0R)
PrintResult("False <= ""12""", False <= "12")
PrintResult("False <= TypeCode.Double", False <= TypeCode.Double)
PrintResult("True <= False", True <= False)
PrintResult("True <= True", True <= True)
PrintResult("True <= System.SByte.MinValue", True <= System.SByte.MinValue)
PrintResult("True <= System.Byte.MaxValue", True <= System.Byte.MaxValue)
PrintResult("True <= -3S", True <= -3S)
PrintResult("True <= 24US", True <= 24US)
PrintResult("True <= -5I", True <= -5I)
PrintResult("True <= 26UI", True <= 26UI)
PrintResult("True <= -7L", True <= -7L)
PrintResult("True <= 28UL", True <= 28UL)
PrintResult("True <= -9D", True <= -9D)
PrintResult("True <= 10.0F", True <= 10.0F)
PrintResult("True <= -11.0R", True <= -11.0R)
PrintResult("True <= ""12""", True <= "12")
PrintResult("True <= TypeCode.Double", True <= TypeCode.Double)
PrintResult("System.SByte.MinValue <= False", System.SByte.MinValue <= False)
PrintResult("System.SByte.MinValue <= True", System.SByte.MinValue <= True)
PrintResult("System.SByte.MinValue <= System.SByte.MinValue", System.SByte.MinValue <= System.SByte.MinValue)
PrintResult("System.SByte.MinValue <= System.Byte.MaxValue", System.SByte.MinValue <= System.Byte.MaxValue)
PrintResult("System.SByte.MinValue <= -3S", System.SByte.MinValue <= -3S)
PrintResult("System.SByte.MinValue <= 24US", System.SByte.MinValue <= 24US)
PrintResult("System.SByte.MinValue <= -5I", System.SByte.MinValue <= -5I)
PrintResult("System.SByte.MinValue <= 26UI", System.SByte.MinValue <= 26UI)
PrintResult("System.SByte.MinValue <= -7L", System.SByte.MinValue <= -7L)
PrintResult("System.SByte.MinValue <= 28UL", System.SByte.MinValue <= 28UL)
PrintResult("System.SByte.MinValue <= -9D", System.SByte.MinValue <= -9D)
PrintResult("System.SByte.MinValue <= 10.0F", System.SByte.MinValue <= 10.0F)
PrintResult("System.SByte.MinValue <= -11.0R", System.SByte.MinValue <= -11.0R)
PrintResult("System.SByte.MinValue <= ""12""", System.SByte.MinValue <= "12")
PrintResult("System.SByte.MinValue <= TypeCode.Double", System.SByte.MinValue <= TypeCode.Double)
PrintResult("System.Byte.MaxValue <= False", System.Byte.MaxValue <= False)
PrintResult("System.Byte.MaxValue <= True", System.Byte.MaxValue <= True)
PrintResult("System.Byte.MaxValue <= System.SByte.MinValue", System.Byte.MaxValue <= System.SByte.MinValue)
PrintResult("System.Byte.MaxValue <= System.Byte.MaxValue", System.Byte.MaxValue <= System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue <= -3S", System.Byte.MaxValue <= -3S)
PrintResult("System.Byte.MaxValue <= 24US", System.Byte.MaxValue <= 24US)
PrintResult("System.Byte.MaxValue <= -5I", System.Byte.MaxValue <= -5I)
PrintResult("System.Byte.MaxValue <= 26UI", System.Byte.MaxValue <= 26UI)
PrintResult("System.Byte.MaxValue <= -7L", System.Byte.MaxValue <= -7L)
PrintResult("System.Byte.MaxValue <= 28UL", System.Byte.MaxValue <= 28UL)
PrintResult("System.Byte.MaxValue <= -9D", System.Byte.MaxValue <= -9D)
PrintResult("System.Byte.MaxValue <= 10.0F", System.Byte.MaxValue <= 10.0F)
PrintResult("System.Byte.MaxValue <= -11.0R", System.Byte.MaxValue <= -11.0R)
PrintResult("System.Byte.MaxValue <= ""12""", System.Byte.MaxValue <= "12")
PrintResult("System.Byte.MaxValue <= TypeCode.Double", System.Byte.MaxValue <= TypeCode.Double)
PrintResult("-3S <= False", -3S <= False)
PrintResult("-3S <= True", -3S <= True)
PrintResult("-3S <= System.SByte.MinValue", -3S <= System.SByte.MinValue)
PrintResult("-3S <= System.Byte.MaxValue", -3S <= System.Byte.MaxValue)
PrintResult("-3S <= -3S", -3S <= -3S)
PrintResult("-3S <= 24US", -3S <= 24US)
PrintResult("-3S <= -5I", -3S <= -5I)
PrintResult("-3S <= 26UI", -3S <= 26UI)
PrintResult("-3S <= -7L", -3S <= -7L)
PrintResult("-3S <= 28UL", -3S <= 28UL)
PrintResult("-3S <= -9D", -3S <= -9D)
PrintResult("-3S <= 10.0F", -3S <= 10.0F)
PrintResult("-3S <= -11.0R", -3S <= -11.0R)
PrintResult("-3S <= ""12""", -3S <= "12")
PrintResult("-3S <= TypeCode.Double", -3S <= TypeCode.Double)
PrintResult("24US <= False", 24US <= False)
PrintResult("24US <= True", 24US <= True)
PrintResult("24US <= System.SByte.MinValue", 24US <= System.SByte.MinValue)
PrintResult("24US <= System.Byte.MaxValue", 24US <= System.Byte.MaxValue)
PrintResult("24US <= -3S", 24US <= -3S)
PrintResult("24US <= 24US", 24US <= 24US)
PrintResult("24US <= -5I", 24US <= -5I)
PrintResult("24US <= 26UI", 24US <= 26UI)
PrintResult("24US <= -7L", 24US <= -7L)
PrintResult("24US <= 28UL", 24US <= 28UL)
PrintResult("24US <= -9D", 24US <= -9D)
PrintResult("24US <= 10.0F", 24US <= 10.0F)
PrintResult("24US <= -11.0R", 24US <= -11.0R)
PrintResult("24US <= ""12""", 24US <= "12")
PrintResult("24US <= TypeCode.Double", 24US <= TypeCode.Double)
PrintResult("-5I <= False", -5I <= False)
PrintResult("-5I <= True", -5I <= True)
PrintResult("-5I <= System.SByte.MinValue", -5I <= System.SByte.MinValue)
PrintResult("-5I <= System.Byte.MaxValue", -5I <= System.Byte.MaxValue)
PrintResult("-5I <= -3S", -5I <= -3S)
PrintResult("-5I <= 24US", -5I <= 24US)
PrintResult("-5I <= -5I", -5I <= -5I)
PrintResult("-5I <= 26UI", -5I <= 26UI)
PrintResult("-5I <= -7L", -5I <= -7L)
PrintResult("-5I <= 28UL", -5I <= 28UL)
PrintResult("-5I <= -9D", -5I <= -9D)
PrintResult("-5I <= 10.0F", -5I <= 10.0F)
PrintResult("-5I <= -11.0R", -5I <= -11.0R)
PrintResult("-5I <= ""12""", -5I <= "12")
PrintResult("-5I <= TypeCode.Double", -5I <= TypeCode.Double)
PrintResult("26UI <= False", 26UI <= False)
PrintResult("26UI <= True", 26UI <= True)
PrintResult("26UI <= System.SByte.MinValue", 26UI <= System.SByte.MinValue)
PrintResult("26UI <= System.Byte.MaxValue", 26UI <= System.Byte.MaxValue)
PrintResult("26UI <= -3S", 26UI <= -3S)
PrintResult("26UI <= 24US", 26UI <= 24US)
PrintResult("26UI <= -5I", 26UI <= -5I)
PrintResult("26UI <= 26UI", 26UI <= 26UI)
PrintResult("26UI <= -7L", 26UI <= -7L)
PrintResult("26UI <= 28UL", 26UI <= 28UL)
PrintResult("26UI <= -9D", 26UI <= -9D)
PrintResult("26UI <= 10.0F", 26UI <= 10.0F)
PrintResult("26UI <= -11.0R", 26UI <= -11.0R)
PrintResult("26UI <= ""12""", 26UI <= "12")
PrintResult("26UI <= TypeCode.Double", 26UI <= TypeCode.Double)
PrintResult("-7L <= False", -7L <= False)
PrintResult("-7L <= True", -7L <= True)
PrintResult("-7L <= System.SByte.MinValue", -7L <= System.SByte.MinValue)
PrintResult("-7L <= System.Byte.MaxValue", -7L <= System.Byte.MaxValue)
PrintResult("-7L <= -3S", -7L <= -3S)
PrintResult("-7L <= 24US", -7L <= 24US)
PrintResult("-7L <= -5I", -7L <= -5I)
PrintResult("-7L <= 26UI", -7L <= 26UI)
PrintResult("-7L <= -7L", -7L <= -7L)
PrintResult("-7L <= 28UL", -7L <= 28UL)
PrintResult("-7L <= -9D", -7L <= -9D)
PrintResult("-7L <= 10.0F", -7L <= 10.0F)
PrintResult("-7L <= -11.0R", -7L <= -11.0R)
PrintResult("-7L <= ""12""", -7L <= "12")
PrintResult("-7L <= TypeCode.Double", -7L <= TypeCode.Double)
PrintResult("28UL <= False", 28UL <= False)
PrintResult("28UL <= True", 28UL <= True)
PrintResult("28UL <= System.SByte.MinValue", 28UL <= System.SByte.MinValue)
PrintResult("28UL <= System.Byte.MaxValue", 28UL <= System.Byte.MaxValue)
PrintResult("28UL <= -3S", 28UL <= -3S)
PrintResult("28UL <= 24US", 28UL <= 24US)
PrintResult("28UL <= -5I", 28UL <= -5I)
PrintResult("28UL <= 26UI", 28UL <= 26UI)
PrintResult("28UL <= -7L", 28UL <= -7L)
PrintResult("28UL <= 28UL", 28UL <= 28UL)
PrintResult("28UL <= -9D", 28UL <= -9D)
PrintResult("28UL <= 10.0F", 28UL <= 10.0F)
PrintResult("28UL <= -11.0R", 28UL <= -11.0R)
PrintResult("28UL <= ""12""", 28UL <= "12")
PrintResult("28UL <= TypeCode.Double", 28UL <= TypeCode.Double)
PrintResult("-9D <= False", -9D <= False)
PrintResult("-9D <= True", -9D <= True)
PrintResult("-9D <= System.SByte.MinValue", -9D <= System.SByte.MinValue)
PrintResult("-9D <= System.Byte.MaxValue", -9D <= System.Byte.MaxValue)
PrintResult("-9D <= -3S", -9D <= -3S)
PrintResult("-9D <= 24US", -9D <= 24US)
PrintResult("-9D <= -5I", -9D <= -5I)
PrintResult("-9D <= 26UI", -9D <= 26UI)
PrintResult("-9D <= -7L", -9D <= -7L)
PrintResult("-9D <= 28UL", -9D <= 28UL)
PrintResult("-9D <= -9D", -9D <= -9D)
PrintResult("-9D <= 10.0F", -9D <= 10.0F)
PrintResult("-9D <= -11.0R", -9D <= -11.0R)
PrintResult("-9D <= ""12""", -9D <= "12")
PrintResult("-9D <= TypeCode.Double", -9D <= TypeCode.Double)
PrintResult("10.0F <= False", 10.0F <= False)
PrintResult("10.0F <= True", 10.0F <= True)
PrintResult("10.0F <= System.SByte.MinValue", 10.0F <= System.SByte.MinValue)
PrintResult("10.0F <= System.Byte.MaxValue", 10.0F <= System.Byte.MaxValue)
PrintResult("10.0F <= -3S", 10.0F <= -3S)
PrintResult("10.0F <= 24US", 10.0F <= 24US)
PrintResult("10.0F <= -5I", 10.0F <= -5I)
PrintResult("10.0F <= 26UI", 10.0F <= 26UI)
PrintResult("10.0F <= -7L", 10.0F <= -7L)
PrintResult("10.0F <= 28UL", 10.0F <= 28UL)
PrintResult("10.0F <= -9D", 10.0F <= -9D)
PrintResult("10.0F <= 10.0F", 10.0F <= 10.0F)
PrintResult("10.0F <= -11.0R", 10.0F <= -11.0R)
PrintResult("10.0F <= ""12""", 10.0F <= "12")
PrintResult("10.0F <= TypeCode.Double", 10.0F <= TypeCode.Double)
PrintResult("-11.0R <= False", -11.0R <= False)
PrintResult("-11.0R <= True", -11.0R <= True)
PrintResult("-11.0R <= System.SByte.MinValue", -11.0R <= System.SByte.MinValue)
PrintResult("-11.0R <= System.Byte.MaxValue", -11.0R <= System.Byte.MaxValue)
PrintResult("-11.0R <= -3S", -11.0R <= -3S)
PrintResult("-11.0R <= 24US", -11.0R <= 24US)
PrintResult("-11.0R <= -5I", -11.0R <= -5I)
PrintResult("-11.0R <= 26UI", -11.0R <= 26UI)
PrintResult("-11.0R <= -7L", -11.0R <= -7L)
PrintResult("-11.0R <= 28UL", -11.0R <= 28UL)
PrintResult("-11.0R <= -9D", -11.0R <= -9D)
PrintResult("-11.0R <= 10.0F", -11.0R <= 10.0F)
PrintResult("-11.0R <= -11.0R", -11.0R <= -11.0R)
PrintResult("-11.0R <= ""12""", -11.0R <= "12")
PrintResult("-11.0R <= TypeCode.Double", -11.0R <= TypeCode.Double)
PrintResult("""12"" <= False", "12" <= False)
PrintResult("""12"" <= True", "12" <= True)
PrintResult("""12"" <= System.SByte.MinValue", "12" <= System.SByte.MinValue)
PrintResult("""12"" <= System.Byte.MaxValue", "12" <= System.Byte.MaxValue)
PrintResult("""12"" <= -3S", "12" <= -3S)
PrintResult("""12"" <= 24US", "12" <= 24US)
PrintResult("""12"" <= -5I", "12" <= -5I)
PrintResult("""12"" <= 26UI", "12" <= 26UI)
PrintResult("""12"" <= -7L", "12" <= -7L)
PrintResult("""12"" <= 28UL", "12" <= 28UL)
PrintResult("""12"" <= -9D", "12" <= -9D)
PrintResult("""12"" <= 10.0F", "12" <= 10.0F)
PrintResult("""12"" <= -11.0R", "12" <= -11.0R)
PrintResult("""12"" <= ""12""", "12" <= "12")
PrintResult("""12"" <= TypeCode.Double", "12" <= TypeCode.Double)
PrintResult("TypeCode.Double <= False", TypeCode.Double <= False)
PrintResult("TypeCode.Double <= True", TypeCode.Double <= True)
PrintResult("TypeCode.Double <= System.SByte.MinValue", TypeCode.Double <= System.SByte.MinValue)
PrintResult("TypeCode.Double <= System.Byte.MaxValue", TypeCode.Double <= System.Byte.MaxValue)
PrintResult("TypeCode.Double <= -3S", TypeCode.Double <= -3S)
PrintResult("TypeCode.Double <= 24US", TypeCode.Double <= 24US)
PrintResult("TypeCode.Double <= -5I", TypeCode.Double <= -5I)
PrintResult("TypeCode.Double <= 26UI", TypeCode.Double <= 26UI)
PrintResult("TypeCode.Double <= -7L", TypeCode.Double <= -7L)
PrintResult("TypeCode.Double <= 28UL", TypeCode.Double <= 28UL)
PrintResult("TypeCode.Double <= -9D", TypeCode.Double <= -9D)
PrintResult("TypeCode.Double <= 10.0F", TypeCode.Double <= 10.0F)
PrintResult("TypeCode.Double <= -11.0R", TypeCode.Double <= -11.0R)
PrintResult("TypeCode.Double <= ""12""", TypeCode.Double <= "12")
PrintResult("TypeCode.Double <= TypeCode.Double", TypeCode.Double <= TypeCode.Double)
PrintResult("False >= False", False >= False)
PrintResult("False >= True", False >= True)
PrintResult("False >= System.SByte.MinValue", False >= System.SByte.MinValue)
PrintResult("False >= System.Byte.MaxValue", False >= System.Byte.MaxValue)
PrintResult("False >= -3S", False >= -3S)
PrintResult("False >= 24US", False >= 24US)
PrintResult("False >= -5I", False >= -5I)
PrintResult("False >= 26UI", False >= 26UI)
PrintResult("False >= -7L", False >= -7L)
PrintResult("False >= 28UL", False >= 28UL)
PrintResult("False >= -9D", False >= -9D)
PrintResult("False >= 10.0F", False >= 10.0F)
PrintResult("False >= -11.0R", False >= -11.0R)
PrintResult("False >= ""12""", False >= "12")
PrintResult("False >= TypeCode.Double", False >= TypeCode.Double)
PrintResult("True >= False", True >= False)
PrintResult("True >= True", True >= True)
PrintResult("True >= System.SByte.MinValue", True >= System.SByte.MinValue)
PrintResult("True >= System.Byte.MaxValue", True >= System.Byte.MaxValue)
PrintResult("True >= -3S", True >= -3S)
PrintResult("True >= 24US", True >= 24US)
PrintResult("True >= -5I", True >= -5I)
PrintResult("True >= 26UI", True >= 26UI)
PrintResult("True >= -7L", True >= -7L)
PrintResult("True >= 28UL", True >= 28UL)
PrintResult("True >= -9D", True >= -9D)
PrintResult("True >= 10.0F", True >= 10.0F)
PrintResult("True >= -11.0R", True >= -11.0R)
PrintResult("True >= ""12""", True >= "12")
PrintResult("True >= TypeCode.Double", True >= TypeCode.Double)
PrintResult("System.SByte.MinValue >= False", System.SByte.MinValue >= False)
PrintResult("System.SByte.MinValue >= True", System.SByte.MinValue >= True)
PrintResult("System.SByte.MinValue >= System.SByte.MinValue", System.SByte.MinValue >= System.SByte.MinValue)
PrintResult("System.SByte.MinValue >= System.Byte.MaxValue", System.SByte.MinValue >= System.Byte.MaxValue)
PrintResult("System.SByte.MinValue >= -3S", System.SByte.MinValue >= -3S)
PrintResult("System.SByte.MinValue >= 24US", System.SByte.MinValue >= 24US)
PrintResult("System.SByte.MinValue >= -5I", System.SByte.MinValue >= -5I)
PrintResult("System.SByte.MinValue >= 26UI", System.SByte.MinValue >= 26UI)
PrintResult("System.SByte.MinValue >= -7L", System.SByte.MinValue >= -7L)
PrintResult("System.SByte.MinValue >= 28UL", System.SByte.MinValue >= 28UL)
PrintResult("System.SByte.MinValue >= -9D", System.SByte.MinValue >= -9D)
PrintResult("System.SByte.MinValue >= 10.0F", System.SByte.MinValue >= 10.0F)
PrintResult("System.SByte.MinValue >= -11.0R", System.SByte.MinValue >= -11.0R)
PrintResult("System.SByte.MinValue >= ""12""", System.SByte.MinValue >= "12")
PrintResult("System.SByte.MinValue >= TypeCode.Double", System.SByte.MinValue >= TypeCode.Double)
PrintResult("System.Byte.MaxValue >= False", System.Byte.MaxValue >= False)
PrintResult("System.Byte.MaxValue >= True", System.Byte.MaxValue >= True)
PrintResult("System.Byte.MaxValue >= System.SByte.MinValue", System.Byte.MaxValue >= System.SByte.MinValue)
PrintResult("System.Byte.MaxValue >= System.Byte.MaxValue", System.Byte.MaxValue >= System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue >= -3S", System.Byte.MaxValue >= -3S)
PrintResult("System.Byte.MaxValue >= 24US", System.Byte.MaxValue >= 24US)
PrintResult("System.Byte.MaxValue >= -5I", System.Byte.MaxValue >= -5I)
PrintResult("System.Byte.MaxValue >= 26UI", System.Byte.MaxValue >= 26UI)
PrintResult("System.Byte.MaxValue >= -7L", System.Byte.MaxValue >= -7L)
PrintResult("System.Byte.MaxValue >= 28UL", System.Byte.MaxValue >= 28UL)
PrintResult("System.Byte.MaxValue >= -9D", System.Byte.MaxValue >= -9D)
PrintResult("System.Byte.MaxValue >= 10.0F", System.Byte.MaxValue >= 10.0F)
PrintResult("System.Byte.MaxValue >= -11.0R", System.Byte.MaxValue >= -11.0R)
PrintResult("System.Byte.MaxValue >= ""12""", System.Byte.MaxValue >= "12")
PrintResult("System.Byte.MaxValue >= TypeCode.Double", System.Byte.MaxValue >= TypeCode.Double)
PrintResult("-3S >= False", -3S >= False)
PrintResult("-3S >= True", -3S >= True)
PrintResult("-3S >= System.SByte.MinValue", -3S >= System.SByte.MinValue)
PrintResult("-3S >= System.Byte.MaxValue", -3S >= System.Byte.MaxValue)
PrintResult("-3S >= -3S", -3S >= -3S)
PrintResult("-3S >= 24US", -3S >= 24US)
PrintResult("-3S >= -5I", -3S >= -5I)
PrintResult("-3S >= 26UI", -3S >= 26UI)
PrintResult("-3S >= -7L", -3S >= -7L)
PrintResult("-3S >= 28UL", -3S >= 28UL)
PrintResult("-3S >= -9D", -3S >= -9D)
PrintResult("-3S >= 10.0F", -3S >= 10.0F)
PrintResult("-3S >= -11.0R", -3S >= -11.0R)
PrintResult("-3S >= ""12""", -3S >= "12")
PrintResult("-3S >= TypeCode.Double", -3S >= TypeCode.Double)
PrintResult("24US >= False", 24US >= False)
PrintResult("24US >= True", 24US >= True)
PrintResult("24US >= System.SByte.MinValue", 24US >= System.SByte.MinValue)
PrintResult("24US >= System.Byte.MaxValue", 24US >= System.Byte.MaxValue)
PrintResult("24US >= -3S", 24US >= -3S)
PrintResult("24US >= 24US", 24US >= 24US)
PrintResult("24US >= -5I", 24US >= -5I)
PrintResult("24US >= 26UI", 24US >= 26UI)
PrintResult("24US >= -7L", 24US >= -7L)
PrintResult("24US >= 28UL", 24US >= 28UL)
PrintResult("24US >= -9D", 24US >= -9D)
PrintResult("24US >= 10.0F", 24US >= 10.0F)
PrintResult("24US >= -11.0R", 24US >= -11.0R)
PrintResult("24US >= ""12""", 24US >= "12")
PrintResult("24US >= TypeCode.Double", 24US >= TypeCode.Double)
PrintResult("-5I >= False", -5I >= False)
PrintResult("-5I >= True", -5I >= True)
PrintResult("-5I >= System.SByte.MinValue", -5I >= System.SByte.MinValue)
PrintResult("-5I >= System.Byte.MaxValue", -5I >= System.Byte.MaxValue)
PrintResult("-5I >= -3S", -5I >= -3S)
PrintResult("-5I >= 24US", -5I >= 24US)
PrintResult("-5I >= -5I", -5I >= -5I)
PrintResult("-5I >= 26UI", -5I >= 26UI)
PrintResult("-5I >= -7L", -5I >= -7L)
PrintResult("-5I >= 28UL", -5I >= 28UL)
PrintResult("-5I >= -9D", -5I >= -9D)
PrintResult("-5I >= 10.0F", -5I >= 10.0F)
PrintResult("-5I >= -11.0R", -5I >= -11.0R)
PrintResult("-5I >= ""12""", -5I >= "12")
PrintResult("-5I >= TypeCode.Double", -5I >= TypeCode.Double)
PrintResult("26UI >= False", 26UI >= False)
PrintResult("26UI >= True", 26UI >= True)
PrintResult("26UI >= System.SByte.MinValue", 26UI >= System.SByte.MinValue)
PrintResult("26UI >= System.Byte.MaxValue", 26UI >= System.Byte.MaxValue)
PrintResult("26UI >= -3S", 26UI >= -3S)
PrintResult("26UI >= 24US", 26UI >= 24US)
PrintResult("26UI >= -5I", 26UI >= -5I)
PrintResult("26UI >= 26UI", 26UI >= 26UI)
PrintResult("26UI >= -7L", 26UI >= -7L)
PrintResult("26UI >= 28UL", 26UI >= 28UL)
PrintResult("26UI >= -9D", 26UI >= -9D)
PrintResult("26UI >= 10.0F", 26UI >= 10.0F)
PrintResult("26UI >= -11.0R", 26UI >= -11.0R)
PrintResult("26UI >= ""12""", 26UI >= "12")
PrintResult("26UI >= TypeCode.Double", 26UI >= TypeCode.Double)
PrintResult("-7L >= False", -7L >= False)
PrintResult("-7L >= True", -7L >= True)
PrintResult("-7L >= System.SByte.MinValue", -7L >= System.SByte.MinValue)
PrintResult("-7L >= System.Byte.MaxValue", -7L >= System.Byte.MaxValue)
PrintResult("-7L >= -3S", -7L >= -3S)
PrintResult("-7L >= 24US", -7L >= 24US)
PrintResult("-7L >= -5I", -7L >= -5I)
PrintResult("-7L >= 26UI", -7L >= 26UI)
PrintResult("-7L >= -7L", -7L >= -7L)
PrintResult("-7L >= 28UL", -7L >= 28UL)
PrintResult("-7L >= -9D", -7L >= -9D)
PrintResult("-7L >= 10.0F", -7L >= 10.0F)
PrintResult("-7L >= -11.0R", -7L >= -11.0R)
PrintResult("-7L >= ""12""", -7L >= "12")
PrintResult("-7L >= TypeCode.Double", -7L >= TypeCode.Double)
PrintResult("28UL >= False", 28UL >= False)
PrintResult("28UL >= True", 28UL >= True)
PrintResult("28UL >= System.SByte.MinValue", 28UL >= System.SByte.MinValue)
PrintResult("28UL >= System.Byte.MaxValue", 28UL >= System.Byte.MaxValue)
PrintResult("28UL >= -3S", 28UL >= -3S)
PrintResult("28UL >= 24US", 28UL >= 24US)
PrintResult("28UL >= -5I", 28UL >= -5I)
PrintResult("28UL >= 26UI", 28UL >= 26UI)
PrintResult("28UL >= -7L", 28UL >= -7L)
PrintResult("28UL >= 28UL", 28UL >= 28UL)
PrintResult("28UL >= -9D", 28UL >= -9D)
PrintResult("28UL >= 10.0F", 28UL >= 10.0F)
PrintResult("28UL >= -11.0R", 28UL >= -11.0R)
PrintResult("28UL >= ""12""", 28UL >= "12")
PrintResult("28UL >= TypeCode.Double", 28UL >= TypeCode.Double)
PrintResult("-9D >= False", -9D >= False)
PrintResult("-9D >= True", -9D >= True)
PrintResult("-9D >= System.SByte.MinValue", -9D >= System.SByte.MinValue)
PrintResult("-9D >= System.Byte.MaxValue", -9D >= System.Byte.MaxValue)
PrintResult("-9D >= -3S", -9D >= -3S)
PrintResult("-9D >= 24US", -9D >= 24US)
PrintResult("-9D >= -5I", -9D >= -5I)
PrintResult("-9D >= 26UI", -9D >= 26UI)
PrintResult("-9D >= -7L", -9D >= -7L)
PrintResult("-9D >= 28UL", -9D >= 28UL)
PrintResult("-9D >= -9D", -9D >= -9D)
PrintResult("-9D >= 10.0F", -9D >= 10.0F)
PrintResult("-9D >= -11.0R", -9D >= -11.0R)
PrintResult("-9D >= ""12""", -9D >= "12")
PrintResult("-9D >= TypeCode.Double", -9D >= TypeCode.Double)
PrintResult("10.0F >= False", 10.0F >= False)
PrintResult("10.0F >= True", 10.0F >= True)
PrintResult("10.0F >= System.SByte.MinValue", 10.0F >= System.SByte.MinValue)
PrintResult("10.0F >= System.Byte.MaxValue", 10.0F >= System.Byte.MaxValue)
PrintResult("10.0F >= -3S", 10.0F >= -3S)
PrintResult("10.0F >= 24US", 10.0F >= 24US)
PrintResult("10.0F >= -5I", 10.0F >= -5I)
PrintResult("10.0F >= 26UI", 10.0F >= 26UI)
PrintResult("10.0F >= -7L", 10.0F >= -7L)
PrintResult("10.0F >= 28UL", 10.0F >= 28UL)
PrintResult("10.0F >= -9D", 10.0F >= -9D)
PrintResult("10.0F >= 10.0F", 10.0F >= 10.0F)
PrintResult("10.0F >= -11.0R", 10.0F >= -11.0R)
PrintResult("10.0F >= ""12""", 10.0F >= "12")
PrintResult("10.0F >= TypeCode.Double", 10.0F >= TypeCode.Double)
PrintResult("-11.0R >= False", -11.0R >= False)
PrintResult("-11.0R >= True", -11.0R >= True)
PrintResult("-11.0R >= System.SByte.MinValue", -11.0R >= System.SByte.MinValue)
PrintResult("-11.0R >= System.Byte.MaxValue", -11.0R >= System.Byte.MaxValue)
PrintResult("-11.0R >= -3S", -11.0R >= -3S)
PrintResult("-11.0R >= 24US", -11.0R >= 24US)
PrintResult("-11.0R >= -5I", -11.0R >= -5I)
PrintResult("-11.0R >= 26UI", -11.0R >= 26UI)
PrintResult("-11.0R >= -7L", -11.0R >= -7L)
PrintResult("-11.0R >= 28UL", -11.0R >= 28UL)
PrintResult("-11.0R >= -9D", -11.0R >= -9D)
PrintResult("-11.0R >= 10.0F", -11.0R >= 10.0F)
PrintResult("-11.0R >= -11.0R", -11.0R >= -11.0R)
PrintResult("-11.0R >= ""12""", -11.0R >= "12")
PrintResult("-11.0R >= TypeCode.Double", -11.0R >= TypeCode.Double)
PrintResult("""12"" >= False", "12" >= False)
PrintResult("""12"" >= True", "12" >= True)
PrintResult("""12"" >= System.SByte.MinValue", "12" >= System.SByte.MinValue)
PrintResult("""12"" >= System.Byte.MaxValue", "12" >= System.Byte.MaxValue)
PrintResult("""12"" >= -3S", "12" >= -3S)
PrintResult("""12"" >= 24US", "12" >= 24US)
PrintResult("""12"" >= -5I", "12" >= -5I)
PrintResult("""12"" >= 26UI", "12" >= 26UI)
PrintResult("""12"" >= -7L", "12" >= -7L)
PrintResult("""12"" >= 28UL", "12" >= 28UL)
PrintResult("""12"" >= -9D", "12" >= -9D)
PrintResult("""12"" >= 10.0F", "12" >= 10.0F)
PrintResult("""12"" >= -11.0R", "12" >= -11.0R)
PrintResult("""12"" >= ""12""", "12" >= "12")
PrintResult("""12"" >= TypeCode.Double", "12" >= TypeCode.Double)
PrintResult("TypeCode.Double >= False", TypeCode.Double >= False)
PrintResult("TypeCode.Double >= True", TypeCode.Double >= True)
PrintResult("TypeCode.Double >= System.SByte.MinValue", TypeCode.Double >= System.SByte.MinValue)
PrintResult("TypeCode.Double >= System.Byte.MaxValue", TypeCode.Double >= System.Byte.MaxValue)
PrintResult("TypeCode.Double >= -3S", TypeCode.Double >= -3S)
PrintResult("TypeCode.Double >= 24US", TypeCode.Double >= 24US)
PrintResult("TypeCode.Double >= -5I", TypeCode.Double >= -5I)
PrintResult("TypeCode.Double >= 26UI", TypeCode.Double >= 26UI)
PrintResult("TypeCode.Double >= -7L", TypeCode.Double >= -7L)
PrintResult("TypeCode.Double >= 28UL", TypeCode.Double >= 28UL)
PrintResult("TypeCode.Double >= -9D", TypeCode.Double >= -9D)
PrintResult("TypeCode.Double >= 10.0F", TypeCode.Double >= 10.0F)
PrintResult("TypeCode.Double >= -11.0R", TypeCode.Double >= -11.0R)
PrintResult("TypeCode.Double >= ""12""", TypeCode.Double >= "12")
PrintResult("TypeCode.Double >= TypeCode.Double", TypeCode.Double >= TypeCode.Double)
PrintResult("False < False", False < False)
PrintResult("False < True", False < True)
PrintResult("False < System.SByte.MinValue", False < System.SByte.MinValue)
PrintResult("False < System.Byte.MaxValue", False < System.Byte.MaxValue)
PrintResult("False < -3S", False < -3S)
PrintResult("False < 24US", False < 24US)
PrintResult("False < -5I", False < -5I)
PrintResult("False < 26UI", False < 26UI)
PrintResult("False < -7L", False < -7L)
PrintResult("False < 28UL", False < 28UL)
PrintResult("False < -9D", False < -9D)
PrintResult("False < 10.0F", False < 10.0F)
PrintResult("False < -11.0R", False < -11.0R)
PrintResult("False < ""12""", False < "12")
PrintResult("False < TypeCode.Double", False < TypeCode.Double)
PrintResult("True < False", True < False)
PrintResult("True < True", True < True)
PrintResult("True < System.SByte.MinValue", True < System.SByte.MinValue)
PrintResult("True < System.Byte.MaxValue", True < System.Byte.MaxValue)
PrintResult("True < -3S", True < -3S)
PrintResult("True < 24US", True < 24US)
PrintResult("True < -5I", True < -5I)
PrintResult("True < 26UI", True < 26UI)
PrintResult("True < -7L", True < -7L)
PrintResult("True < 28UL", True < 28UL)
PrintResult("True < -9D", True < -9D)
PrintResult("True < 10.0F", True < 10.0F)
PrintResult("True < -11.0R", True < -11.0R)
PrintResult("True < ""12""", True < "12")
PrintResult("True < TypeCode.Double", True < TypeCode.Double)
PrintResult("System.SByte.MinValue < False", System.SByte.MinValue < False)
PrintResult("System.SByte.MinValue < True", System.SByte.MinValue < True)
PrintResult("System.SByte.MinValue < System.SByte.MinValue", System.SByte.MinValue < System.SByte.MinValue)
PrintResult("System.SByte.MinValue < System.Byte.MaxValue", System.SByte.MinValue < System.Byte.MaxValue)
PrintResult("System.SByte.MinValue < -3S", System.SByte.MinValue < -3S)
PrintResult("System.SByte.MinValue < 24US", System.SByte.MinValue < 24US)
PrintResult("System.SByte.MinValue < -5I", System.SByte.MinValue < -5I)
PrintResult("System.SByte.MinValue < 26UI", System.SByte.MinValue < 26UI)
PrintResult("System.SByte.MinValue < -7L", System.SByte.MinValue < -7L)
PrintResult("System.SByte.MinValue < 28UL", System.SByte.MinValue < 28UL)
PrintResult("System.SByte.MinValue < -9D", System.SByte.MinValue < -9D)
PrintResult("System.SByte.MinValue < 10.0F", System.SByte.MinValue < 10.0F)
PrintResult("System.SByte.MinValue < -11.0R", System.SByte.MinValue < -11.0R)
PrintResult("System.SByte.MinValue < ""12""", System.SByte.MinValue < "12")
PrintResult("System.SByte.MinValue < TypeCode.Double", System.SByte.MinValue < TypeCode.Double)
PrintResult("System.Byte.MaxValue < False", System.Byte.MaxValue < False)
PrintResult("System.Byte.MaxValue < True", System.Byte.MaxValue < True)
PrintResult("System.Byte.MaxValue < System.SByte.MinValue", System.Byte.MaxValue < System.SByte.MinValue)
PrintResult("System.Byte.MaxValue < System.Byte.MaxValue", System.Byte.MaxValue < System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue < -3S", System.Byte.MaxValue < -3S)
PrintResult("System.Byte.MaxValue < 24US", System.Byte.MaxValue < 24US)
PrintResult("System.Byte.MaxValue < -5I", System.Byte.MaxValue < -5I)
PrintResult("System.Byte.MaxValue < 26UI", System.Byte.MaxValue < 26UI)
PrintResult("System.Byte.MaxValue < -7L", System.Byte.MaxValue < -7L)
PrintResult("System.Byte.MaxValue < 28UL", System.Byte.MaxValue < 28UL)
PrintResult("System.Byte.MaxValue < -9D", System.Byte.MaxValue < -9D)
PrintResult("System.Byte.MaxValue < 10.0F", System.Byte.MaxValue < 10.0F)
PrintResult("System.Byte.MaxValue < -11.0R", System.Byte.MaxValue < -11.0R)
PrintResult("System.Byte.MaxValue < ""12""", System.Byte.MaxValue < "12")
PrintResult("System.Byte.MaxValue < TypeCode.Double", System.Byte.MaxValue < TypeCode.Double)
PrintResult("-3S < False", -3S < False)
PrintResult("-3S < True", -3S < True)
PrintResult("-3S < System.SByte.MinValue", -3S < System.SByte.MinValue)
PrintResult("-3S < System.Byte.MaxValue", -3S < System.Byte.MaxValue)
PrintResult("-3S < -3S", -3S < -3S)
PrintResult("-3S < 24US", -3S < 24US)
PrintResult("-3S < -5I", -3S < -5I)
PrintResult("-3S < 26UI", -3S < 26UI)
PrintResult("-3S < -7L", -3S < -7L)
PrintResult("-3S < 28UL", -3S < 28UL)
PrintResult("-3S < -9D", -3S < -9D)
PrintResult("-3S < 10.0F", -3S < 10.0F)
PrintResult("-3S < -11.0R", -3S < -11.0R)
PrintResult("-3S < ""12""", -3S < "12")
PrintResult("-3S < TypeCode.Double", -3S < TypeCode.Double)
PrintResult("24US < False", 24US < False)
PrintResult("24US < True", 24US < True)
PrintResult("24US < System.SByte.MinValue", 24US < System.SByte.MinValue)
PrintResult("24US < System.Byte.MaxValue", 24US < System.Byte.MaxValue)
PrintResult("24US < -3S", 24US < -3S)
PrintResult("24US < 24US", 24US < 24US)
PrintResult("24US < -5I", 24US < -5I)
PrintResult("24US < 26UI", 24US < 26UI)
PrintResult("24US < -7L", 24US < -7L)
PrintResult("24US < 28UL", 24US < 28UL)
PrintResult("24US < -9D", 24US < -9D)
PrintResult("24US < 10.0F", 24US < 10.0F)
PrintResult("24US < -11.0R", 24US < -11.0R)
PrintResult("24US < ""12""", 24US < "12")
PrintResult("24US < TypeCode.Double", 24US < TypeCode.Double)
PrintResult("-5I < False", -5I < False)
PrintResult("-5I < True", -5I < True)
PrintResult("-5I < System.SByte.MinValue", -5I < System.SByte.MinValue)
PrintResult("-5I < System.Byte.MaxValue", -5I < System.Byte.MaxValue)
PrintResult("-5I < -3S", -5I < -3S)
PrintResult("-5I < 24US", -5I < 24US)
PrintResult("-5I < -5I", -5I < -5I)
PrintResult("-5I < 26UI", -5I < 26UI)
PrintResult("-5I < -7L", -5I < -7L)
PrintResult("-5I < 28UL", -5I < 28UL)
PrintResult("-5I < -9D", -5I < -9D)
PrintResult("-5I < 10.0F", -5I < 10.0F)
PrintResult("-5I < -11.0R", -5I < -11.0R)
PrintResult("-5I < ""12""", -5I < "12")
PrintResult("-5I < TypeCode.Double", -5I < TypeCode.Double)
PrintResult("26UI < False", 26UI < False)
PrintResult("26UI < True", 26UI < True)
PrintResult("26UI < System.SByte.MinValue", 26UI < System.SByte.MinValue)
PrintResult("26UI < System.Byte.MaxValue", 26UI < System.Byte.MaxValue)
PrintResult("26UI < -3S", 26UI < -3S)
PrintResult("26UI < 24US", 26UI < 24US)
PrintResult("26UI < -5I", 26UI < -5I)
PrintResult("26UI < 26UI", 26UI < 26UI)
PrintResult("26UI < -7L", 26UI < -7L)
PrintResult("26UI < 28UL", 26UI < 28UL)
PrintResult("26UI < -9D", 26UI < -9D)
PrintResult("26UI < 10.0F", 26UI < 10.0F)
PrintResult("26UI < -11.0R", 26UI < -11.0R)
PrintResult("26UI < ""12""", 26UI < "12")
PrintResult("26UI < TypeCode.Double", 26UI < TypeCode.Double)
PrintResult("-7L < False", -7L < False)
PrintResult("-7L < True", -7L < True)
PrintResult("-7L < System.SByte.MinValue", -7L < System.SByte.MinValue)
PrintResult("-7L < System.Byte.MaxValue", -7L < System.Byte.MaxValue)
PrintResult("-7L < -3S", -7L < -3S)
PrintResult("-7L < 24US", -7L < 24US)
PrintResult("-7L < -5I", -7L < -5I)
PrintResult("-7L < 26UI", -7L < 26UI)
PrintResult("-7L < -7L", -7L < -7L)
PrintResult("-7L < 28UL", -7L < 28UL)
PrintResult("-7L < -9D", -7L < -9D)
PrintResult("-7L < 10.0F", -7L < 10.0F)
PrintResult("-7L < -11.0R", -7L < -11.0R)
PrintResult("-7L < ""12""", -7L < "12")
PrintResult("-7L < TypeCode.Double", -7L < TypeCode.Double)
PrintResult("28UL < False", 28UL < False)
PrintResult("28UL < True", 28UL < True)
PrintResult("28UL < System.SByte.MinValue", 28UL < System.SByte.MinValue)
PrintResult("28UL < System.Byte.MaxValue", 28UL < System.Byte.MaxValue)
PrintResult("28UL < -3S", 28UL < -3S)
PrintResult("28UL < 24US", 28UL < 24US)
PrintResult("28UL < -5I", 28UL < -5I)
PrintResult("28UL < 26UI", 28UL < 26UI)
PrintResult("28UL < -7L", 28UL < -7L)
PrintResult("28UL < 28UL", 28UL < 28UL)
PrintResult("28UL < -9D", 28UL < -9D)
PrintResult("28UL < 10.0F", 28UL < 10.0F)
PrintResult("28UL < -11.0R", 28UL < -11.0R)
PrintResult("28UL < ""12""", 28UL < "12")
PrintResult("28UL < TypeCode.Double", 28UL < TypeCode.Double)
PrintResult("-9D < False", -9D < False)
PrintResult("-9D < True", -9D < True)
PrintResult("-9D < System.SByte.MinValue", -9D < System.SByte.MinValue)
PrintResult("-9D < System.Byte.MaxValue", -9D < System.Byte.MaxValue)
PrintResult("-9D < -3S", -9D < -3S)
PrintResult("-9D < 24US", -9D < 24US)
PrintResult("-9D < -5I", -9D < -5I)
PrintResult("-9D < 26UI", -9D < 26UI)
PrintResult("-9D < -7L", -9D < -7L)
PrintResult("-9D < 28UL", -9D < 28UL)
PrintResult("-9D < -9D", -9D < -9D)
PrintResult("-9D < 10.0F", -9D < 10.0F)
PrintResult("-9D < -11.0R", -9D < -11.0R)
PrintResult("-9D < ""12""", -9D < "12")
PrintResult("-9D < TypeCode.Double", -9D < TypeCode.Double)
PrintResult("10.0F < False", 10.0F < False)
PrintResult("10.0F < True", 10.0F < True)
PrintResult("10.0F < System.SByte.MinValue", 10.0F < System.SByte.MinValue)
PrintResult("10.0F < System.Byte.MaxValue", 10.0F < System.Byte.MaxValue)
PrintResult("10.0F < -3S", 10.0F < -3S)
PrintResult("10.0F < 24US", 10.0F < 24US)
PrintResult("10.0F < -5I", 10.0F < -5I)
PrintResult("10.0F < 26UI", 10.0F < 26UI)
PrintResult("10.0F < -7L", 10.0F < -7L)
PrintResult("10.0F < 28UL", 10.0F < 28UL)
PrintResult("10.0F < -9D", 10.0F < -9D)
PrintResult("10.0F < 10.0F", 10.0F < 10.0F)
PrintResult("10.0F < -11.0R", 10.0F < -11.0R)
PrintResult("10.0F < ""12""", 10.0F < "12")
PrintResult("10.0F < TypeCode.Double", 10.0F < TypeCode.Double)
PrintResult("-11.0R < False", -11.0R < False)
PrintResult("-11.0R < True", -11.0R < True)
PrintResult("-11.0R < System.SByte.MinValue", -11.0R < System.SByte.MinValue)
PrintResult("-11.0R < System.Byte.MaxValue", -11.0R < System.Byte.MaxValue)
PrintResult("-11.0R < -3S", -11.0R < -3S)
PrintResult("-11.0R < 24US", -11.0R < 24US)
PrintResult("-11.0R < -5I", -11.0R < -5I)
PrintResult("-11.0R < 26UI", -11.0R < 26UI)
PrintResult("-11.0R < -7L", -11.0R < -7L)
PrintResult("-11.0R < 28UL", -11.0R < 28UL)
PrintResult("-11.0R < -9D", -11.0R < -9D)
PrintResult("-11.0R < 10.0F", -11.0R < 10.0F)
PrintResult("-11.0R < -11.0R", -11.0R < -11.0R)
PrintResult("-11.0R < ""12""", -11.0R < "12")
PrintResult("-11.0R < TypeCode.Double", -11.0R < TypeCode.Double)
PrintResult("""12"" < False", "12" < False)
PrintResult("""12"" < True", "12" < True)
PrintResult("""12"" < System.SByte.MinValue", "12" < System.SByte.MinValue)
PrintResult("""12"" < System.Byte.MaxValue", "12" < System.Byte.MaxValue)
PrintResult("""12"" < -3S", "12" < -3S)
PrintResult("""12"" < 24US", "12" < 24US)
PrintResult("""12"" < -5I", "12" < -5I)
PrintResult("""12"" < 26UI", "12" < 26UI)
PrintResult("""12"" < -7L", "12" < -7L)
PrintResult("""12"" < 28UL", "12" < 28UL)
PrintResult("""12"" < -9D", "12" < -9D)
PrintResult("""12"" < 10.0F", "12" < 10.0F)
PrintResult("""12"" < -11.0R", "12" < -11.0R)
PrintResult("""12"" < ""12""", "12" < "12")
PrintResult("""12"" < TypeCode.Double", "12" < TypeCode.Double)
PrintResult("TypeCode.Double < False", TypeCode.Double < False)
PrintResult("TypeCode.Double < True", TypeCode.Double < True)
PrintResult("TypeCode.Double < System.SByte.MinValue", TypeCode.Double < System.SByte.MinValue)
PrintResult("TypeCode.Double < System.Byte.MaxValue", TypeCode.Double < System.Byte.MaxValue)
PrintResult("TypeCode.Double < -3S", TypeCode.Double < -3S)
PrintResult("TypeCode.Double < 24US", TypeCode.Double < 24US)
PrintResult("TypeCode.Double < -5I", TypeCode.Double < -5I)
PrintResult("TypeCode.Double < 26UI", TypeCode.Double < 26UI)
PrintResult("TypeCode.Double < -7L", TypeCode.Double < -7L)
PrintResult("TypeCode.Double < 28UL", TypeCode.Double < 28UL)
PrintResult("TypeCode.Double < -9D", TypeCode.Double < -9D)
PrintResult("TypeCode.Double < 10.0F", TypeCode.Double < 10.0F)
PrintResult("TypeCode.Double < -11.0R", TypeCode.Double < -11.0R)
PrintResult("TypeCode.Double < ""12""", TypeCode.Double < "12")
PrintResult("TypeCode.Double < TypeCode.Double", TypeCode.Double < TypeCode.Double)
PrintResult("False > False", False > False)
PrintResult("False > True", False > True)
PrintResult("False > System.SByte.MinValue", False > System.SByte.MinValue)
PrintResult("False > System.Byte.MaxValue", False > System.Byte.MaxValue)
PrintResult("False > -3S", False > -3S)
PrintResult("False > 24US", False > 24US)
PrintResult("False > -5I", False > -5I)
PrintResult("False > 26UI", False > 26UI)
PrintResult("False > -7L", False > -7L)
PrintResult("False > 28UL", False > 28UL)
PrintResult("False > -9D", False > -9D)
PrintResult("False > 10.0F", False > 10.0F)
PrintResult("False > -11.0R", False > -11.0R)
PrintResult("False > ""12""", False > "12")
PrintResult("False > TypeCode.Double", False > TypeCode.Double)
PrintResult("True > False", True > False)
PrintResult("True > True", True > True)
PrintResult("True > System.SByte.MinValue", True > System.SByte.MinValue)
PrintResult("True > System.Byte.MaxValue", True > System.Byte.MaxValue)
PrintResult("True > -3S", True > -3S)
PrintResult("True > 24US", True > 24US)
PrintResult("True > -5I", True > -5I)
PrintResult("True > 26UI", True > 26UI)
PrintResult("True > -7L", True > -7L)
PrintResult("True > 28UL", True > 28UL)
PrintResult("True > -9D", True > -9D)
PrintResult("True > 10.0F", True > 10.0F)
PrintResult("True > -11.0R", True > -11.0R)
PrintResult("True > ""12""", True > "12")
PrintResult("True > TypeCode.Double", True > TypeCode.Double)
PrintResult("System.SByte.MinValue > False", System.SByte.MinValue > False)
PrintResult("System.SByte.MinValue > True", System.SByte.MinValue > True)
PrintResult("System.SByte.MinValue > System.SByte.MinValue", System.SByte.MinValue > System.SByte.MinValue)
PrintResult("System.SByte.MinValue > System.Byte.MaxValue", System.SByte.MinValue > System.Byte.MaxValue)
PrintResult("System.SByte.MinValue > -3S", System.SByte.MinValue > -3S)
PrintResult("System.SByte.MinValue > 24US", System.SByte.MinValue > 24US)
PrintResult("System.SByte.MinValue > -5I", System.SByte.MinValue > -5I)
PrintResult("System.SByte.MinValue > 26UI", System.SByte.MinValue > 26UI)
PrintResult("System.SByte.MinValue > -7L", System.SByte.MinValue > -7L)
PrintResult("System.SByte.MinValue > 28UL", System.SByte.MinValue > 28UL)
PrintResult("System.SByte.MinValue > -9D", System.SByte.MinValue > -9D)
PrintResult("System.SByte.MinValue > 10.0F", System.SByte.MinValue > 10.0F)
PrintResult("System.SByte.MinValue > -11.0R", System.SByte.MinValue > -11.0R)
PrintResult("System.SByte.MinValue > ""12""", System.SByte.MinValue > "12")
PrintResult("System.SByte.MinValue > TypeCode.Double", System.SByte.MinValue > TypeCode.Double)
PrintResult("System.Byte.MaxValue > False", System.Byte.MaxValue > False)
PrintResult("System.Byte.MaxValue > True", System.Byte.MaxValue > True)
PrintResult("System.Byte.MaxValue > System.SByte.MinValue", System.Byte.MaxValue > System.SByte.MinValue)
PrintResult("System.Byte.MaxValue > System.Byte.MaxValue", System.Byte.MaxValue > System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue > -3S", System.Byte.MaxValue > -3S)
PrintResult("System.Byte.MaxValue > 24US", System.Byte.MaxValue > 24US)
PrintResult("System.Byte.MaxValue > -5I", System.Byte.MaxValue > -5I)
PrintResult("System.Byte.MaxValue > 26UI", System.Byte.MaxValue > 26UI)
PrintResult("System.Byte.MaxValue > -7L", System.Byte.MaxValue > -7L)
PrintResult("System.Byte.MaxValue > 28UL", System.Byte.MaxValue > 28UL)
PrintResult("System.Byte.MaxValue > -9D", System.Byte.MaxValue > -9D)
PrintResult("System.Byte.MaxValue > 10.0F", System.Byte.MaxValue > 10.0F)
PrintResult("System.Byte.MaxValue > -11.0R", System.Byte.MaxValue > -11.0R)
PrintResult("System.Byte.MaxValue > ""12""", System.Byte.MaxValue > "12")
PrintResult("System.Byte.MaxValue > TypeCode.Double", System.Byte.MaxValue > TypeCode.Double)
PrintResult("-3S > False", -3S > False)
PrintResult("-3S > True", -3S > True)
PrintResult("-3S > System.SByte.MinValue", -3S > System.SByte.MinValue)
PrintResult("-3S > System.Byte.MaxValue", -3S > System.Byte.MaxValue)
PrintResult("-3S > -3S", -3S > -3S)
PrintResult("-3S > 24US", -3S > 24US)
PrintResult("-3S > -5I", -3S > -5I)
PrintResult("-3S > 26UI", -3S > 26UI)
PrintResult("-3S > -7L", -3S > -7L)
PrintResult("-3S > 28UL", -3S > 28UL)
PrintResult("-3S > -9D", -3S > -9D)
PrintResult("-3S > 10.0F", -3S > 10.0F)
PrintResult("-3S > -11.0R", -3S > -11.0R)
PrintResult("-3S > ""12""", -3S > "12")
PrintResult("-3S > TypeCode.Double", -3S > TypeCode.Double)
PrintResult("24US > False", 24US > False)
PrintResult("24US > True", 24US > True)
PrintResult("24US > System.SByte.MinValue", 24US > System.SByte.MinValue)
PrintResult("24US > System.Byte.MaxValue", 24US > System.Byte.MaxValue)
PrintResult("24US > -3S", 24US > -3S)
PrintResult("24US > 24US", 24US > 24US)
PrintResult("24US > -5I", 24US > -5I)
PrintResult("24US > 26UI", 24US > 26UI)
PrintResult("24US > -7L", 24US > -7L)
PrintResult("24US > 28UL", 24US > 28UL)
PrintResult("24US > -9D", 24US > -9D)
PrintResult("24US > 10.0F", 24US > 10.0F)
PrintResult("24US > -11.0R", 24US > -11.0R)
PrintResult("24US > ""12""", 24US > "12")
PrintResult("24US > TypeCode.Double", 24US > TypeCode.Double)
PrintResult("-5I > False", -5I > False)
PrintResult("-5I > True", -5I > True)
PrintResult("-5I > System.SByte.MinValue", -5I > System.SByte.MinValue)
PrintResult("-5I > System.Byte.MaxValue", -5I > System.Byte.MaxValue)
PrintResult("-5I > -3S", -5I > -3S)
PrintResult("-5I > 24US", -5I > 24US)
PrintResult("-5I > -5I", -5I > -5I)
PrintResult("-5I > 26UI", -5I > 26UI)
PrintResult("-5I > -7L", -5I > -7L)
PrintResult("-5I > 28UL", -5I > 28UL)
PrintResult("-5I > -9D", -5I > -9D)
PrintResult("-5I > 10.0F", -5I > 10.0F)
PrintResult("-5I > -11.0R", -5I > -11.0R)
PrintResult("-5I > ""12""", -5I > "12")
PrintResult("-5I > TypeCode.Double", -5I > TypeCode.Double)
PrintResult("26UI > False", 26UI > False)
PrintResult("26UI > True", 26UI > True)
PrintResult("26UI > System.SByte.MinValue", 26UI > System.SByte.MinValue)
PrintResult("26UI > System.Byte.MaxValue", 26UI > System.Byte.MaxValue)
PrintResult("26UI > -3S", 26UI > -3S)
PrintResult("26UI > 24US", 26UI > 24US)
PrintResult("26UI > -5I", 26UI > -5I)
PrintResult("26UI > 26UI", 26UI > 26UI)
PrintResult("26UI > -7L", 26UI > -7L)
PrintResult("26UI > 28UL", 26UI > 28UL)
PrintResult("26UI > -9D", 26UI > -9D)
PrintResult("26UI > 10.0F", 26UI > 10.0F)
PrintResult("26UI > -11.0R", 26UI > -11.0R)
PrintResult("26UI > ""12""", 26UI > "12")
PrintResult("26UI > TypeCode.Double", 26UI > TypeCode.Double)
PrintResult("-7L > False", -7L > False)
PrintResult("-7L > True", -7L > True)
PrintResult("-7L > System.SByte.MinValue", -7L > System.SByte.MinValue)
PrintResult("-7L > System.Byte.MaxValue", -7L > System.Byte.MaxValue)
PrintResult("-7L > -3S", -7L > -3S)
PrintResult("-7L > 24US", -7L > 24US)
PrintResult("-7L > -5I", -7L > -5I)
PrintResult("-7L > 26UI", -7L > 26UI)
PrintResult("-7L > -7L", -7L > -7L)
PrintResult("-7L > 28UL", -7L > 28UL)
PrintResult("-7L > -9D", -7L > -9D)
PrintResult("-7L > 10.0F", -7L > 10.0F)
PrintResult("-7L > -11.0R", -7L > -11.0R)
PrintResult("-7L > ""12""", -7L > "12")
PrintResult("-7L > TypeCode.Double", -7L > TypeCode.Double)
PrintResult("28UL > False", 28UL > False)
PrintResult("28UL > True", 28UL > True)
PrintResult("28UL > System.SByte.MinValue", 28UL > System.SByte.MinValue)
PrintResult("28UL > System.Byte.MaxValue", 28UL > System.Byte.MaxValue)
PrintResult("28UL > -3S", 28UL > -3S)
PrintResult("28UL > 24US", 28UL > 24US)
PrintResult("28UL > -5I", 28UL > -5I)
PrintResult("28UL > 26UI", 28UL > 26UI)
PrintResult("28UL > -7L", 28UL > -7L)
PrintResult("28UL > 28UL", 28UL > 28UL)
PrintResult("28UL > -9D", 28UL > -9D)
PrintResult("28UL > 10.0F", 28UL > 10.0F)
PrintResult("28UL > -11.0R", 28UL > -11.0R)
PrintResult("28UL > ""12""", 28UL > "12")
PrintResult("28UL > TypeCode.Double", 28UL > TypeCode.Double)
PrintResult("-9D > False", -9D > False)
PrintResult("-9D > True", -9D > True)
PrintResult("-9D > System.SByte.MinValue", -9D > System.SByte.MinValue)
PrintResult("-9D > System.Byte.MaxValue", -9D > System.Byte.MaxValue)
PrintResult("-9D > -3S", -9D > -3S)
PrintResult("-9D > 24US", -9D > 24US)
PrintResult("-9D > -5I", -9D > -5I)
PrintResult("-9D > 26UI", -9D > 26UI)
PrintResult("-9D > -7L", -9D > -7L)
PrintResult("-9D > 28UL", -9D > 28UL)
PrintResult("-9D > -9D", -9D > -9D)
PrintResult("-9D > 10.0F", -9D > 10.0F)
PrintResult("-9D > -11.0R", -9D > -11.0R)
PrintResult("-9D > ""12""", -9D > "12")
PrintResult("-9D > TypeCode.Double", -9D > TypeCode.Double)
PrintResult("10.0F > False", 10.0F > False)
PrintResult("10.0F > True", 10.0F > True)
PrintResult("10.0F > System.SByte.MinValue", 10.0F > System.SByte.MinValue)
PrintResult("10.0F > System.Byte.MaxValue", 10.0F > System.Byte.MaxValue)
PrintResult("10.0F > -3S", 10.0F > -3S)
PrintResult("10.0F > 24US", 10.0F > 24US)
PrintResult("10.0F > -5I", 10.0F > -5I)
PrintResult("10.0F > 26UI", 10.0F > 26UI)
PrintResult("10.0F > -7L", 10.0F > -7L)
PrintResult("10.0F > 28UL", 10.0F > 28UL)
PrintResult("10.0F > -9D", 10.0F > -9D)
PrintResult("10.0F > 10.0F", 10.0F > 10.0F)
PrintResult("10.0F > -11.0R", 10.0F > -11.0R)
PrintResult("10.0F > ""12""", 10.0F > "12")
PrintResult("10.0F > TypeCode.Double", 10.0F > TypeCode.Double)
PrintResult("-11.0R > False", -11.0R > False)
PrintResult("-11.0R > True", -11.0R > True)
PrintResult("-11.0R > System.SByte.MinValue", -11.0R > System.SByte.MinValue)
PrintResult("-11.0R > System.Byte.MaxValue", -11.0R > System.Byte.MaxValue)
PrintResult("-11.0R > -3S", -11.0R > -3S)
PrintResult("-11.0R > 24US", -11.0R > 24US)
PrintResult("-11.0R > -5I", -11.0R > -5I)
PrintResult("-11.0R > 26UI", -11.0R > 26UI)
PrintResult("-11.0R > -7L", -11.0R > -7L)
PrintResult("-11.0R > 28UL", -11.0R > 28UL)
PrintResult("-11.0R > -9D", -11.0R > -9D)
PrintResult("-11.0R > 10.0F", -11.0R > 10.0F)
PrintResult("-11.0R > -11.0R", -11.0R > -11.0R)
PrintResult("-11.0R > ""12""", -11.0R > "12")
PrintResult("-11.0R > TypeCode.Double", -11.0R > TypeCode.Double)
PrintResult("""12"" > False", "12" > False)
PrintResult("""12"" > True", "12" > True)
PrintResult("""12"" > System.SByte.MinValue", "12" > System.SByte.MinValue)
PrintResult("""12"" > System.Byte.MaxValue", "12" > System.Byte.MaxValue)
PrintResult("""12"" > -3S", "12" > -3S)
PrintResult("""12"" > 24US", "12" > 24US)
PrintResult("""12"" > -5I", "12" > -5I)
PrintResult("""12"" > 26UI", "12" > 26UI)
PrintResult("""12"" > -7L", "12" > -7L)
PrintResult("""12"" > 28UL", "12" > 28UL)
PrintResult("""12"" > -9D", "12" > -9D)
PrintResult("""12"" > 10.0F", "12" > 10.0F)
PrintResult("""12"" > -11.0R", "12" > -11.0R)
PrintResult("""12"" > ""12""", "12" > "12")
PrintResult("""12"" > TypeCode.Double", "12" > TypeCode.Double)
PrintResult("TypeCode.Double > False", TypeCode.Double > False)
PrintResult("TypeCode.Double > True", TypeCode.Double > True)
PrintResult("TypeCode.Double > System.SByte.MinValue", TypeCode.Double > System.SByte.MinValue)
PrintResult("TypeCode.Double > System.Byte.MaxValue", TypeCode.Double > System.Byte.MaxValue)
PrintResult("TypeCode.Double > -3S", TypeCode.Double > -3S)
PrintResult("TypeCode.Double > 24US", TypeCode.Double > 24US)
PrintResult("TypeCode.Double > -5I", TypeCode.Double > -5I)
PrintResult("TypeCode.Double > 26UI", TypeCode.Double > 26UI)
PrintResult("TypeCode.Double > -7L", TypeCode.Double > -7L)
PrintResult("TypeCode.Double > 28UL", TypeCode.Double > 28UL)
PrintResult("TypeCode.Double > -9D", TypeCode.Double > -9D)
PrintResult("TypeCode.Double > 10.0F", TypeCode.Double > 10.0F)
PrintResult("TypeCode.Double > -11.0R", TypeCode.Double > -11.0R)
PrintResult("TypeCode.Double > ""12""", TypeCode.Double > "12")
PrintResult("TypeCode.Double > TypeCode.Double", TypeCode.Double > TypeCode.Double)
PrintResult("False Xor False", False Xor False)
PrintResult("False Xor True", False Xor True)
PrintResult("False Xor System.SByte.MinValue", False Xor System.SByte.MinValue)
PrintResult("False Xor System.Byte.MaxValue", False Xor System.Byte.MaxValue)
PrintResult("False Xor -3S", False Xor -3S)
PrintResult("False Xor 24US", False Xor 24US)
PrintResult("False Xor -5I", False Xor -5I)
PrintResult("False Xor 26UI", False Xor 26UI)
PrintResult("False Xor -7L", False Xor -7L)
PrintResult("False Xor 28UL", False Xor 28UL)
PrintResult("False Xor -9D", False Xor -9D)
PrintResult("False Xor 10.0F", False Xor 10.0F)
PrintResult("False Xor -11.0R", False Xor -11.0R)
PrintResult("False Xor ""12""", False Xor "12")
PrintResult("False Xor TypeCode.Double", False Xor TypeCode.Double)
PrintResult("True Xor False", True Xor False)
PrintResult("True Xor True", True Xor True)
PrintResult("True Xor System.SByte.MinValue", True Xor System.SByte.MinValue)
PrintResult("True Xor System.Byte.MaxValue", True Xor System.Byte.MaxValue)
PrintResult("True Xor -3S", True Xor -3S)
PrintResult("True Xor 24US", True Xor 24US)
PrintResult("True Xor -5I", True Xor -5I)
PrintResult("True Xor 26UI", True Xor 26UI)
PrintResult("True Xor -7L", True Xor -7L)
PrintResult("True Xor 28UL", True Xor 28UL)
PrintResult("True Xor -9D", True Xor -9D)
PrintResult("True Xor 10.0F", True Xor 10.0F)
PrintResult("True Xor -11.0R", True Xor -11.0R)
PrintResult("True Xor ""12""", True Xor "12")
PrintResult("True Xor TypeCode.Double", True Xor TypeCode.Double)
PrintResult("System.SByte.MinValue Xor False", System.SByte.MinValue Xor False)
PrintResult("System.SByte.MinValue Xor True", System.SByte.MinValue Xor True)
PrintResult("System.SByte.MinValue Xor System.SByte.MinValue", System.SByte.MinValue Xor System.SByte.MinValue)
PrintResult("System.SByte.MinValue Xor System.Byte.MaxValue", System.SByte.MinValue Xor System.Byte.MaxValue)
PrintResult("System.SByte.MinValue Xor -3S", System.SByte.MinValue Xor -3S)
PrintResult("System.SByte.MinValue Xor 24US", System.SByte.MinValue Xor 24US)
PrintResult("System.SByte.MinValue Xor -5I", System.SByte.MinValue Xor -5I)
PrintResult("System.SByte.MinValue Xor 26UI", System.SByte.MinValue Xor 26UI)
PrintResult("System.SByte.MinValue Xor -7L", System.SByte.MinValue Xor -7L)
PrintResult("System.SByte.MinValue Xor 28UL", System.SByte.MinValue Xor 28UL)
PrintResult("System.SByte.MinValue Xor -9D", System.SByte.MinValue Xor -9D)
PrintResult("System.SByte.MinValue Xor 10.0F", System.SByte.MinValue Xor 10.0F)
PrintResult("System.SByte.MinValue Xor -11.0R", System.SByte.MinValue Xor -11.0R)
PrintResult("System.SByte.MinValue Xor ""12""", System.SByte.MinValue Xor "12")
PrintResult("System.SByte.MinValue Xor TypeCode.Double", System.SByte.MinValue Xor TypeCode.Double)
PrintResult("System.Byte.MaxValue Xor False", System.Byte.MaxValue Xor False)
PrintResult("System.Byte.MaxValue Xor True", System.Byte.MaxValue Xor True)
PrintResult("System.Byte.MaxValue Xor System.SByte.MinValue", System.Byte.MaxValue Xor System.SByte.MinValue)
PrintResult("System.Byte.MaxValue Xor System.Byte.MaxValue", System.Byte.MaxValue Xor System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue Xor -3S", System.Byte.MaxValue Xor -3S)
PrintResult("System.Byte.MaxValue Xor 24US", System.Byte.MaxValue Xor 24US)
PrintResult("System.Byte.MaxValue Xor -5I", System.Byte.MaxValue Xor -5I)
PrintResult("System.Byte.MaxValue Xor 26UI", System.Byte.MaxValue Xor 26UI)
PrintResult("System.Byte.MaxValue Xor -7L", System.Byte.MaxValue Xor -7L)
PrintResult("System.Byte.MaxValue Xor 28UL", System.Byte.MaxValue Xor 28UL)
PrintResult("System.Byte.MaxValue Xor -9D", System.Byte.MaxValue Xor -9D)
PrintResult("System.Byte.MaxValue Xor 10.0F", System.Byte.MaxValue Xor 10.0F)
PrintResult("System.Byte.MaxValue Xor -11.0R", System.Byte.MaxValue Xor -11.0R)
PrintResult("System.Byte.MaxValue Xor ""12""", System.Byte.MaxValue Xor "12")
PrintResult("System.Byte.MaxValue Xor TypeCode.Double", System.Byte.MaxValue Xor TypeCode.Double)
PrintResult("-3S Xor False", -3S Xor False)
PrintResult("-3S Xor True", -3S Xor True)
PrintResult("-3S Xor System.SByte.MinValue", -3S Xor System.SByte.MinValue)
PrintResult("-3S Xor System.Byte.MaxValue", -3S Xor System.Byte.MaxValue)
PrintResult("-3S Xor -3S", -3S Xor -3S)
PrintResult("-3S Xor 24US", -3S Xor 24US)
PrintResult("-3S Xor -5I", -3S Xor -5I)
PrintResult("-3S Xor 26UI", -3S Xor 26UI)
PrintResult("-3S Xor -7L", -3S Xor -7L)
PrintResult("-3S Xor 28UL", -3S Xor 28UL)
PrintResult("-3S Xor -9D", -3S Xor -9D)
PrintResult("-3S Xor 10.0F", -3S Xor 10.0F)
PrintResult("-3S Xor -11.0R", -3S Xor -11.0R)
PrintResult("-3S Xor ""12""", -3S Xor "12")
PrintResult("-3S Xor TypeCode.Double", -3S Xor TypeCode.Double)
PrintResult("24US Xor False", 24US Xor False)
PrintResult("24US Xor True", 24US Xor True)
PrintResult("24US Xor System.SByte.MinValue", 24US Xor System.SByte.MinValue)
PrintResult("24US Xor System.Byte.MaxValue", 24US Xor System.Byte.MaxValue)
PrintResult("24US Xor -3S", 24US Xor -3S)
PrintResult("24US Xor 24US", 24US Xor 24US)
PrintResult("24US Xor -5I", 24US Xor -5I)
PrintResult("24US Xor 26UI", 24US Xor 26UI)
PrintResult("24US Xor -7L", 24US Xor -7L)
PrintResult("24US Xor 28UL", 24US Xor 28UL)
PrintResult("24US Xor -9D", 24US Xor -9D)
PrintResult("24US Xor 10.0F", 24US Xor 10.0F)
PrintResult("24US Xor -11.0R", 24US Xor -11.0R)
PrintResult("24US Xor ""12""", 24US Xor "12")
PrintResult("24US Xor TypeCode.Double", 24US Xor TypeCode.Double)
PrintResult("-5I Xor False", -5I Xor False)
PrintResult("-5I Xor True", -5I Xor True)
PrintResult("-5I Xor System.SByte.MinValue", -5I Xor System.SByte.MinValue)
PrintResult("-5I Xor System.Byte.MaxValue", -5I Xor System.Byte.MaxValue)
PrintResult("-5I Xor -3S", -5I Xor -3S)
PrintResult("-5I Xor 24US", -5I Xor 24US)
PrintResult("-5I Xor -5I", -5I Xor -5I)
PrintResult("-5I Xor 26UI", -5I Xor 26UI)
PrintResult("-5I Xor -7L", -5I Xor -7L)
PrintResult("-5I Xor 28UL", -5I Xor 28UL)
PrintResult("-5I Xor -9D", -5I Xor -9D)
PrintResult("-5I Xor 10.0F", -5I Xor 10.0F)
PrintResult("-5I Xor -11.0R", -5I Xor -11.0R)
PrintResult("-5I Xor ""12""", -5I Xor "12")
PrintResult("-5I Xor TypeCode.Double", -5I Xor TypeCode.Double)
PrintResult("26UI Xor False", 26UI Xor False)
PrintResult("26UI Xor True", 26UI Xor True)
PrintResult("26UI Xor System.SByte.MinValue", 26UI Xor System.SByte.MinValue)
PrintResult("26UI Xor System.Byte.MaxValue", 26UI Xor System.Byte.MaxValue)
PrintResult("26UI Xor -3S", 26UI Xor -3S)
PrintResult("26UI Xor 24US", 26UI Xor 24US)
PrintResult("26UI Xor -5I", 26UI Xor -5I)
PrintResult("26UI Xor 26UI", 26UI Xor 26UI)
PrintResult("26UI Xor -7L", 26UI Xor -7L)
PrintResult("26UI Xor 28UL", 26UI Xor 28UL)
PrintResult("26UI Xor -9D", 26UI Xor -9D)
PrintResult("26UI Xor 10.0F", 26UI Xor 10.0F)
PrintResult("26UI Xor -11.0R", 26UI Xor -11.0R)
PrintResult("26UI Xor ""12""", 26UI Xor "12")
PrintResult("26UI Xor TypeCode.Double", 26UI Xor TypeCode.Double)
PrintResult("-7L Xor False", -7L Xor False)
PrintResult("-7L Xor True", -7L Xor True)
PrintResult("-7L Xor System.SByte.MinValue", -7L Xor System.SByte.MinValue)
PrintResult("-7L Xor System.Byte.MaxValue", -7L Xor System.Byte.MaxValue)
PrintResult("-7L Xor -3S", -7L Xor -3S)
PrintResult("-7L Xor 24US", -7L Xor 24US)
PrintResult("-7L Xor -5I", -7L Xor -5I)
PrintResult("-7L Xor 26UI", -7L Xor 26UI)
PrintResult("-7L Xor -7L", -7L Xor -7L)
PrintResult("-7L Xor 28UL", -7L Xor 28UL)
PrintResult("-7L Xor -9D", -7L Xor -9D)
PrintResult("-7L Xor 10.0F", -7L Xor 10.0F)
PrintResult("-7L Xor -11.0R", -7L Xor -11.0R)
PrintResult("-7L Xor ""12""", -7L Xor "12")
PrintResult("-7L Xor TypeCode.Double", -7L Xor TypeCode.Double)
PrintResult("28UL Xor False", 28UL Xor False)
PrintResult("28UL Xor True", 28UL Xor True)
PrintResult("28UL Xor System.SByte.MinValue", 28UL Xor System.SByte.MinValue)
PrintResult("28UL Xor System.Byte.MaxValue", 28UL Xor System.Byte.MaxValue)
PrintResult("28UL Xor -3S", 28UL Xor -3S)
PrintResult("28UL Xor 24US", 28UL Xor 24US)
PrintResult("28UL Xor -5I", 28UL Xor -5I)
PrintResult("28UL Xor 26UI", 28UL Xor 26UI)
PrintResult("28UL Xor -7L", 28UL Xor -7L)
PrintResult("28UL Xor 28UL", 28UL Xor 28UL)
PrintResult("28UL Xor -9D", 28UL Xor -9D)
PrintResult("28UL Xor 10.0F", 28UL Xor 10.0F)
PrintResult("28UL Xor -11.0R", 28UL Xor -11.0R)
PrintResult("28UL Xor ""12""", 28UL Xor "12")
PrintResult("28UL Xor TypeCode.Double", 28UL Xor TypeCode.Double)
PrintResult("-9D Xor False", -9D Xor False)
PrintResult("-9D Xor True", -9D Xor True)
PrintResult("-9D Xor System.SByte.MinValue", -9D Xor System.SByte.MinValue)
PrintResult("-9D Xor System.Byte.MaxValue", -9D Xor System.Byte.MaxValue)
PrintResult("-9D Xor -3S", -9D Xor -3S)
PrintResult("-9D Xor 24US", -9D Xor 24US)
PrintResult("-9D Xor -5I", -9D Xor -5I)
PrintResult("-9D Xor 26UI", -9D Xor 26UI)
PrintResult("-9D Xor -7L", -9D Xor -7L)
PrintResult("-9D Xor 28UL", -9D Xor 28UL)
PrintResult("-9D Xor -9D", -9D Xor -9D)
PrintResult("-9D Xor 10.0F", -9D Xor 10.0F)
PrintResult("-9D Xor -11.0R", -9D Xor -11.0R)
PrintResult("-9D Xor ""12""", -9D Xor "12")
PrintResult("-9D Xor TypeCode.Double", -9D Xor TypeCode.Double)
PrintResult("10.0F Xor False", 10.0F Xor False)
PrintResult("10.0F Xor True", 10.0F Xor True)
PrintResult("10.0F Xor System.SByte.MinValue", 10.0F Xor System.SByte.MinValue)
PrintResult("10.0F Xor System.Byte.MaxValue", 10.0F Xor System.Byte.MaxValue)
PrintResult("10.0F Xor -3S", 10.0F Xor -3S)
PrintResult("10.0F Xor 24US", 10.0F Xor 24US)
PrintResult("10.0F Xor -5I", 10.0F Xor -5I)
PrintResult("10.0F Xor 26UI", 10.0F Xor 26UI)
PrintResult("10.0F Xor -7L", 10.0F Xor -7L)
PrintResult("10.0F Xor 28UL", 10.0F Xor 28UL)
PrintResult("10.0F Xor -9D", 10.0F Xor -9D)
PrintResult("10.0F Xor 10.0F", 10.0F Xor 10.0F)
PrintResult("10.0F Xor -11.0R", 10.0F Xor -11.0R)
PrintResult("10.0F Xor ""12""", 10.0F Xor "12")
PrintResult("10.0F Xor TypeCode.Double", 10.0F Xor TypeCode.Double)
PrintResult("-11.0R Xor False", -11.0R Xor False)
PrintResult("-11.0R Xor True", -11.0R Xor True)
PrintResult("-11.0R Xor System.SByte.MinValue", -11.0R Xor System.SByte.MinValue)
PrintResult("-11.0R Xor System.Byte.MaxValue", -11.0R Xor System.Byte.MaxValue)
PrintResult("-11.0R Xor -3S", -11.0R Xor -3S)
PrintResult("-11.0R Xor 24US", -11.0R Xor 24US)
PrintResult("-11.0R Xor -5I", -11.0R Xor -5I)
PrintResult("-11.0R Xor 26UI", -11.0R Xor 26UI)
PrintResult("-11.0R Xor -7L", -11.0R Xor -7L)
PrintResult("-11.0R Xor 28UL", -11.0R Xor 28UL)
PrintResult("-11.0R Xor -9D", -11.0R Xor -9D)
PrintResult("-11.0R Xor 10.0F", -11.0R Xor 10.0F)
PrintResult("-11.0R Xor -11.0R", -11.0R Xor -11.0R)
PrintResult("-11.0R Xor ""12""", -11.0R Xor "12")
PrintResult("-11.0R Xor TypeCode.Double", -11.0R Xor TypeCode.Double)
PrintResult("""12"" Xor False", "12" Xor False)
PrintResult("""12"" Xor True", "12" Xor True)
PrintResult("""12"" Xor System.SByte.MinValue", "12" Xor System.SByte.MinValue)
PrintResult("""12"" Xor System.Byte.MaxValue", "12" Xor System.Byte.MaxValue)
PrintResult("""12"" Xor -3S", "12" Xor -3S)
PrintResult("""12"" Xor 24US", "12" Xor 24US)
PrintResult("""12"" Xor -5I", "12" Xor -5I)
PrintResult("""12"" Xor 26UI", "12" Xor 26UI)
PrintResult("""12"" Xor -7L", "12" Xor -7L)
PrintResult("""12"" Xor 28UL", "12" Xor 28UL)
PrintResult("""12"" Xor -9D", "12" Xor -9D)
PrintResult("""12"" Xor 10.0F", "12" Xor 10.0F)
PrintResult("""12"" Xor -11.0R", "12" Xor -11.0R)
PrintResult("""12"" Xor ""12""", "12" Xor "12")
PrintResult("""12"" Xor TypeCode.Double", "12" Xor TypeCode.Double)
PrintResult("TypeCode.Double Xor False", TypeCode.Double Xor False)
PrintResult("TypeCode.Double Xor True", TypeCode.Double Xor True)
PrintResult("TypeCode.Double Xor System.SByte.MinValue", TypeCode.Double Xor System.SByte.MinValue)
PrintResult("TypeCode.Double Xor System.Byte.MaxValue", TypeCode.Double Xor System.Byte.MaxValue)
PrintResult("TypeCode.Double Xor -3S", TypeCode.Double Xor -3S)
PrintResult("TypeCode.Double Xor 24US", TypeCode.Double Xor 24US)
PrintResult("TypeCode.Double Xor -5I", TypeCode.Double Xor -5I)
PrintResult("TypeCode.Double Xor 26UI", TypeCode.Double Xor 26UI)
PrintResult("TypeCode.Double Xor -7L", TypeCode.Double Xor -7L)
PrintResult("TypeCode.Double Xor 28UL", TypeCode.Double Xor 28UL)
PrintResult("TypeCode.Double Xor -9D", TypeCode.Double Xor -9D)
PrintResult("TypeCode.Double Xor 10.0F", TypeCode.Double Xor 10.0F)
PrintResult("TypeCode.Double Xor -11.0R", TypeCode.Double Xor -11.0R)
PrintResult("TypeCode.Double Xor ""12""", TypeCode.Double Xor "12")
PrintResult("TypeCode.Double Xor TypeCode.Double", TypeCode.Double Xor TypeCode.Double)
PrintResult("False Or False", False Or False)
PrintResult("False Or True", False Or True)
PrintResult("False Or System.SByte.MinValue", False Or System.SByte.MinValue)
PrintResult("False Or System.Byte.MaxValue", False Or System.Byte.MaxValue)
PrintResult("False Or -3S", False Or -3S)
PrintResult("False Or 24US", False Or 24US)
PrintResult("False Or -5I", False Or -5I)
PrintResult("False Or 26UI", False Or 26UI)
PrintResult("False Or -7L", False Or -7L)
PrintResult("False Or 28UL", False Or 28UL)
PrintResult("False Or -9D", False Or -9D)
PrintResult("False Or 10.0F", False Or 10.0F)
PrintResult("False Or -11.0R", False Or -11.0R)
PrintResult("False Or ""12""", False Or "12")
PrintResult("False Or TypeCode.Double", False Or TypeCode.Double)
PrintResult("True Or False", True Or False)
PrintResult("True Or True", True Or True)
PrintResult("True Or System.SByte.MinValue", True Or System.SByte.MinValue)
PrintResult("True Or System.Byte.MaxValue", True Or System.Byte.MaxValue)
PrintResult("True Or -3S", True Or -3S)
PrintResult("True Or 24US", True Or 24US)
PrintResult("True Or -5I", True Or -5I)
PrintResult("True Or 26UI", True Or 26UI)
PrintResult("True Or -7L", True Or -7L)
PrintResult("True Or 28UL", True Or 28UL)
PrintResult("True Or -9D", True Or -9D)
PrintResult("True Or 10.0F", True Or 10.0F)
PrintResult("True Or -11.0R", True Or -11.0R)
PrintResult("True Or ""12""", True Or "12")
PrintResult("True Or TypeCode.Double", True Or TypeCode.Double)
PrintResult("System.SByte.MinValue Or False", System.SByte.MinValue Or False)
PrintResult("System.SByte.MinValue Or True", System.SByte.MinValue Or True)
PrintResult("System.SByte.MinValue Or System.SByte.MinValue", System.SByte.MinValue Or System.SByte.MinValue)
PrintResult("System.SByte.MinValue Or System.Byte.MaxValue", System.SByte.MinValue Or System.Byte.MaxValue)
PrintResult("System.SByte.MinValue Or -3S", System.SByte.MinValue Or -3S)
PrintResult("System.SByte.MinValue Or 24US", System.SByte.MinValue Or 24US)
PrintResult("System.SByte.MinValue Or -5I", System.SByte.MinValue Or -5I)
PrintResult("System.SByte.MinValue Or 26UI", System.SByte.MinValue Or 26UI)
PrintResult("System.SByte.MinValue Or -7L", System.SByte.MinValue Or -7L)
PrintResult("System.SByte.MinValue Or 28UL", System.SByte.MinValue Or 28UL)
PrintResult("System.SByte.MinValue Or -9D", System.SByte.MinValue Or -9D)
PrintResult("System.SByte.MinValue Or 10.0F", System.SByte.MinValue Or 10.0F)
PrintResult("System.SByte.MinValue Or -11.0R", System.SByte.MinValue Or -11.0R)
PrintResult("System.SByte.MinValue Or ""12""", System.SByte.MinValue Or "12")
PrintResult("System.SByte.MinValue Or TypeCode.Double", System.SByte.MinValue Or TypeCode.Double)
PrintResult("System.Byte.MaxValue Or False", System.Byte.MaxValue Or False)
PrintResult("System.Byte.MaxValue Or True", System.Byte.MaxValue Or True)
PrintResult("System.Byte.MaxValue Or System.SByte.MinValue", System.Byte.MaxValue Or System.SByte.MinValue)
PrintResult("System.Byte.MaxValue Or System.Byte.MaxValue", System.Byte.MaxValue Or System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue Or -3S", System.Byte.MaxValue Or -3S)
PrintResult("System.Byte.MaxValue Or 24US", System.Byte.MaxValue Or 24US)
PrintResult("System.Byte.MaxValue Or -5I", System.Byte.MaxValue Or -5I)
PrintResult("System.Byte.MaxValue Or 26UI", System.Byte.MaxValue Or 26UI)
PrintResult("System.Byte.MaxValue Or -7L", System.Byte.MaxValue Or -7L)
PrintResult("System.Byte.MaxValue Or 28UL", System.Byte.MaxValue Or 28UL)
PrintResult("System.Byte.MaxValue Or -9D", System.Byte.MaxValue Or -9D)
PrintResult("System.Byte.MaxValue Or 10.0F", System.Byte.MaxValue Or 10.0F)
PrintResult("System.Byte.MaxValue Or -11.0R", System.Byte.MaxValue Or -11.0R)
PrintResult("System.Byte.MaxValue Or ""12""", System.Byte.MaxValue Or "12")
PrintResult("System.Byte.MaxValue Or TypeCode.Double", System.Byte.MaxValue Or TypeCode.Double)
PrintResult("-3S Or False", -3S Or False)
PrintResult("-3S Or True", -3S Or True)
PrintResult("-3S Or System.SByte.MinValue", -3S Or System.SByte.MinValue)
PrintResult("-3S Or System.Byte.MaxValue", -3S Or System.Byte.MaxValue)
PrintResult("-3S Or -3S", -3S Or -3S)
PrintResult("-3S Or 24US", -3S Or 24US)
PrintResult("-3S Or -5I", -3S Or -5I)
PrintResult("-3S Or 26UI", -3S Or 26UI)
PrintResult("-3S Or -7L", -3S Or -7L)
PrintResult("-3S Or 28UL", -3S Or 28UL)
PrintResult("-3S Or -9D", -3S Or -9D)
PrintResult("-3S Or 10.0F", -3S Or 10.0F)
PrintResult("-3S Or -11.0R", -3S Or -11.0R)
PrintResult("-3S Or ""12""", -3S Or "12")
PrintResult("-3S Or TypeCode.Double", -3S Or TypeCode.Double)
PrintResult("24US Or False", 24US Or False)
PrintResult("24US Or True", 24US Or True)
PrintResult("24US Or System.SByte.MinValue", 24US Or System.SByte.MinValue)
PrintResult("24US Or System.Byte.MaxValue", 24US Or System.Byte.MaxValue)
PrintResult("24US Or -3S", 24US Or -3S)
PrintResult("24US Or 24US", 24US Or 24US)
PrintResult("24US Or -5I", 24US Or -5I)
PrintResult("24US Or 26UI", 24US Or 26UI)
PrintResult("24US Or -7L", 24US Or -7L)
PrintResult("24US Or 28UL", 24US Or 28UL)
PrintResult("24US Or -9D", 24US Or -9D)
PrintResult("24US Or 10.0F", 24US Or 10.0F)
PrintResult("24US Or -11.0R", 24US Or -11.0R)
PrintResult("24US Or ""12""", 24US Or "12")
PrintResult("24US Or TypeCode.Double", 24US Or TypeCode.Double)
PrintResult("-5I Or False", -5I Or False)
PrintResult("-5I Or True", -5I Or True)
PrintResult("-5I Or System.SByte.MinValue", -5I Or System.SByte.MinValue)
PrintResult("-5I Or System.Byte.MaxValue", -5I Or System.Byte.MaxValue)
PrintResult("-5I Or -3S", -5I Or -3S)
PrintResult("-5I Or 24US", -5I Or 24US)
PrintResult("-5I Or -5I", -5I Or -5I)
PrintResult("-5I Or 26UI", -5I Or 26UI)
PrintResult("-5I Or -7L", -5I Or -7L)
PrintResult("-5I Or 28UL", -5I Or 28UL)
PrintResult("-5I Or -9D", -5I Or -9D)
PrintResult("-5I Or 10.0F", -5I Or 10.0F)
PrintResult("-5I Or -11.0R", -5I Or -11.0R)
PrintResult("-5I Or ""12""", -5I Or "12")
PrintResult("-5I Or TypeCode.Double", -5I Or TypeCode.Double)
PrintResult("26UI Or False", 26UI Or False)
PrintResult("26UI Or True", 26UI Or True)
PrintResult("26UI Or System.SByte.MinValue", 26UI Or System.SByte.MinValue)
PrintResult("26UI Or System.Byte.MaxValue", 26UI Or System.Byte.MaxValue)
PrintResult("26UI Or -3S", 26UI Or -3S)
PrintResult("26UI Or 24US", 26UI Or 24US)
PrintResult("26UI Or -5I", 26UI Or -5I)
PrintResult("26UI Or 26UI", 26UI Or 26UI)
PrintResult("26UI Or -7L", 26UI Or -7L)
PrintResult("26UI Or 28UL", 26UI Or 28UL)
PrintResult("26UI Or -9D", 26UI Or -9D)
PrintResult("26UI Or 10.0F", 26UI Or 10.0F)
PrintResult("26UI Or -11.0R", 26UI Or -11.0R)
PrintResult("26UI Or ""12""", 26UI Or "12")
PrintResult("26UI Or TypeCode.Double", 26UI Or TypeCode.Double)
PrintResult("-7L Or False", -7L Or False)
PrintResult("-7L Or True", -7L Or True)
PrintResult("-7L Or System.SByte.MinValue", -7L Or System.SByte.MinValue)
PrintResult("-7L Or System.Byte.MaxValue", -7L Or System.Byte.MaxValue)
PrintResult("-7L Or -3S", -7L Or -3S)
PrintResult("-7L Or 24US", -7L Or 24US)
PrintResult("-7L Or -5I", -7L Or -5I)
PrintResult("-7L Or 26UI", -7L Or 26UI)
PrintResult("-7L Or -7L", -7L Or -7L)
PrintResult("-7L Or 28UL", -7L Or 28UL)
PrintResult("-7L Or -9D", -7L Or -9D)
PrintResult("-7L Or 10.0F", -7L Or 10.0F)
PrintResult("-7L Or -11.0R", -7L Or -11.0R)
PrintResult("-7L Or ""12""", -7L Or "12")
PrintResult("-7L Or TypeCode.Double", -7L Or TypeCode.Double)
PrintResult("28UL Or False", 28UL Or False)
PrintResult("28UL Or True", 28UL Or True)
PrintResult("28UL Or System.SByte.MinValue", 28UL Or System.SByte.MinValue)
PrintResult("28UL Or System.Byte.MaxValue", 28UL Or System.Byte.MaxValue)
PrintResult("28UL Or -3S", 28UL Or -3S)
PrintResult("28UL Or 24US", 28UL Or 24US)
PrintResult("28UL Or -5I", 28UL Or -5I)
PrintResult("28UL Or 26UI", 28UL Or 26UI)
PrintResult("28UL Or -7L", 28UL Or -7L)
PrintResult("28UL Or 28UL", 28UL Or 28UL)
PrintResult("28UL Or -9D", 28UL Or -9D)
PrintResult("28UL Or 10.0F", 28UL Or 10.0F)
PrintResult("28UL Or -11.0R", 28UL Or -11.0R)
PrintResult("28UL Or ""12""", 28UL Or "12")
PrintResult("28UL Or TypeCode.Double", 28UL Or TypeCode.Double)
PrintResult("-9D Or False", -9D Or False)
PrintResult("-9D Or True", -9D Or True)
PrintResult("-9D Or System.SByte.MinValue", -9D Or System.SByte.MinValue)
PrintResult("-9D Or System.Byte.MaxValue", -9D Or System.Byte.MaxValue)
PrintResult("-9D Or -3S", -9D Or -3S)
PrintResult("-9D Or 24US", -9D Or 24US)
PrintResult("-9D Or -5I", -9D Or -5I)
PrintResult("-9D Or 26UI", -9D Or 26UI)
PrintResult("-9D Or -7L", -9D Or -7L)
PrintResult("-9D Or 28UL", -9D Or 28UL)
PrintResult("-9D Or -9D", -9D Or -9D)
PrintResult("-9D Or 10.0F", -9D Or 10.0F)
PrintResult("-9D Or -11.0R", -9D Or -11.0R)
PrintResult("-9D Or ""12""", -9D Or "12")
PrintResult("-9D Or TypeCode.Double", -9D Or TypeCode.Double)
PrintResult("10.0F Or False", 10.0F Or False)
PrintResult("10.0F Or True", 10.0F Or True)
PrintResult("10.0F Or System.SByte.MinValue", 10.0F Or System.SByte.MinValue)
PrintResult("10.0F Or System.Byte.MaxValue", 10.0F Or System.Byte.MaxValue)
PrintResult("10.0F Or -3S", 10.0F Or -3S)
PrintResult("10.0F Or 24US", 10.0F Or 24US)
PrintResult("10.0F Or -5I", 10.0F Or -5I)
PrintResult("10.0F Or 26UI", 10.0F Or 26UI)
PrintResult("10.0F Or -7L", 10.0F Or -7L)
PrintResult("10.0F Or 28UL", 10.0F Or 28UL)
PrintResult("10.0F Or -9D", 10.0F Or -9D)
PrintResult("10.0F Or 10.0F", 10.0F Or 10.0F)
PrintResult("10.0F Or -11.0R", 10.0F Or -11.0R)
PrintResult("10.0F Or ""12""", 10.0F Or "12")
PrintResult("10.0F Or TypeCode.Double", 10.0F Or TypeCode.Double)
PrintResult("-11.0R Or False", -11.0R Or False)
PrintResult("-11.0R Or True", -11.0R Or True)
PrintResult("-11.0R Or System.SByte.MinValue", -11.0R Or System.SByte.MinValue)
PrintResult("-11.0R Or System.Byte.MaxValue", -11.0R Or System.Byte.MaxValue)
PrintResult("-11.0R Or -3S", -11.0R Or -3S)
PrintResult("-11.0R Or 24US", -11.0R Or 24US)
PrintResult("-11.0R Or -5I", -11.0R Or -5I)
PrintResult("-11.0R Or 26UI", -11.0R Or 26UI)
PrintResult("-11.0R Or -7L", -11.0R Or -7L)
PrintResult("-11.0R Or 28UL", -11.0R Or 28UL)
PrintResult("-11.0R Or -9D", -11.0R Or -9D)
PrintResult("-11.0R Or 10.0F", -11.0R Or 10.0F)
PrintResult("-11.0R Or -11.0R", -11.0R Or -11.0R)
PrintResult("-11.0R Or ""12""", -11.0R Or "12")
PrintResult("-11.0R Or TypeCode.Double", -11.0R Or TypeCode.Double)
PrintResult("""12"" Or False", "12" Or False)
PrintResult("""12"" Or True", "12" Or True)
PrintResult("""12"" Or System.SByte.MinValue", "12" Or System.SByte.MinValue)
PrintResult("""12"" Or System.Byte.MaxValue", "12" Or System.Byte.MaxValue)
PrintResult("""12"" Or -3S", "12" Or -3S)
PrintResult("""12"" Or 24US", "12" Or 24US)
PrintResult("""12"" Or -5I", "12" Or -5I)
PrintResult("""12"" Or 26UI", "12" Or 26UI)
PrintResult("""12"" Or -7L", "12" Or -7L)
PrintResult("""12"" Or 28UL", "12" Or 28UL)
PrintResult("""12"" Or -9D", "12" Or -9D)
PrintResult("""12"" Or 10.0F", "12" Or 10.0F)
PrintResult("""12"" Or -11.0R", "12" Or -11.0R)
PrintResult("""12"" Or ""12""", "12" Or "12")
PrintResult("""12"" Or TypeCode.Double", "12" Or TypeCode.Double)
PrintResult("TypeCode.Double Or False", TypeCode.Double Or False)
PrintResult("TypeCode.Double Or True", TypeCode.Double Or True)
PrintResult("TypeCode.Double Or System.SByte.MinValue", TypeCode.Double Or System.SByte.MinValue)
PrintResult("TypeCode.Double Or System.Byte.MaxValue", TypeCode.Double Or System.Byte.MaxValue)
PrintResult("TypeCode.Double Or -3S", TypeCode.Double Or -3S)
PrintResult("TypeCode.Double Or 24US", TypeCode.Double Or 24US)
PrintResult("TypeCode.Double Or -5I", TypeCode.Double Or -5I)
PrintResult("TypeCode.Double Or 26UI", TypeCode.Double Or 26UI)
PrintResult("TypeCode.Double Or -7L", TypeCode.Double Or -7L)
PrintResult("TypeCode.Double Or 28UL", TypeCode.Double Or 28UL)
PrintResult("TypeCode.Double Or -9D", TypeCode.Double Or -9D)
PrintResult("TypeCode.Double Or 10.0F", TypeCode.Double Or 10.0F)
PrintResult("TypeCode.Double Or -11.0R", TypeCode.Double Or -11.0R)
PrintResult("TypeCode.Double Or ""12""", TypeCode.Double Or "12")
PrintResult("TypeCode.Double Or TypeCode.Double", TypeCode.Double Or TypeCode.Double)
PrintResult("False And False", False And False)
PrintResult("False And True", False And True)
PrintResult("False And System.SByte.MinValue", False And System.SByte.MinValue)
PrintResult("False And System.Byte.MaxValue", False And System.Byte.MaxValue)
PrintResult("False And -3S", False And -3S)
PrintResult("False And 24US", False And 24US)
PrintResult("False And -5I", False And -5I)
PrintResult("False And 26UI", False And 26UI)
PrintResult("False And -7L", False And -7L)
PrintResult("False And 28UL", False And 28UL)
PrintResult("False And -9D", False And -9D)
PrintResult("False And 10.0F", False And 10.0F)
PrintResult("False And -11.0R", False And -11.0R)
PrintResult("False And ""12""", False And "12")
PrintResult("False And TypeCode.Double", False And TypeCode.Double)
PrintResult("True And False", True And False)
PrintResult("True And True", True And True)
PrintResult("True And System.SByte.MinValue", True And System.SByte.MinValue)
PrintResult("True And System.Byte.MaxValue", True And System.Byte.MaxValue)
PrintResult("True And -3S", True And -3S)
PrintResult("True And 24US", True And 24US)
PrintResult("True And -5I", True And -5I)
PrintResult("True And 26UI", True And 26UI)
PrintResult("True And -7L", True And -7L)
PrintResult("True And 28UL", True And 28UL)
PrintResult("True And -9D", True And -9D)
PrintResult("True And 10.0F", True And 10.0F)
PrintResult("True And -11.0R", True And -11.0R)
PrintResult("True And ""12""", True And "12")
PrintResult("True And TypeCode.Double", True And TypeCode.Double)
PrintResult("System.SByte.MinValue And False", System.SByte.MinValue And False)
PrintResult("System.SByte.MinValue And True", System.SByte.MinValue And True)
PrintResult("System.SByte.MinValue And System.SByte.MinValue", System.SByte.MinValue And System.SByte.MinValue)
PrintResult("System.SByte.MinValue And System.Byte.MaxValue", System.SByte.MinValue And System.Byte.MaxValue)
PrintResult("System.SByte.MinValue And -3S", System.SByte.MinValue And -3S)
PrintResult("System.SByte.MinValue And 24US", System.SByte.MinValue And 24US)
PrintResult("System.SByte.MinValue And -5I", System.SByte.MinValue And -5I)
PrintResult("System.SByte.MinValue And 26UI", System.SByte.MinValue And 26UI)
PrintResult("System.SByte.MinValue And -7L", System.SByte.MinValue And -7L)
PrintResult("System.SByte.MinValue And 28UL", System.SByte.MinValue And 28UL)
PrintResult("System.SByte.MinValue And -9D", System.SByte.MinValue And -9D)
PrintResult("System.SByte.MinValue And 10.0F", System.SByte.MinValue And 10.0F)
PrintResult("System.SByte.MinValue And -11.0R", System.SByte.MinValue And -11.0R)
PrintResult("System.SByte.MinValue And ""12""", System.SByte.MinValue And "12")
PrintResult("System.SByte.MinValue And TypeCode.Double", System.SByte.MinValue And TypeCode.Double)
PrintResult("System.Byte.MaxValue And False", System.Byte.MaxValue And False)
PrintResult("System.Byte.MaxValue And True", System.Byte.MaxValue And True)
PrintResult("System.Byte.MaxValue And System.SByte.MinValue", System.Byte.MaxValue And System.SByte.MinValue)
PrintResult("System.Byte.MaxValue And System.Byte.MaxValue", System.Byte.MaxValue And System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue And -3S", System.Byte.MaxValue And -3S)
PrintResult("System.Byte.MaxValue And 24US", System.Byte.MaxValue And 24US)
PrintResult("System.Byte.MaxValue And -5I", System.Byte.MaxValue And -5I)
PrintResult("System.Byte.MaxValue And 26UI", System.Byte.MaxValue And 26UI)
PrintResult("System.Byte.MaxValue And -7L", System.Byte.MaxValue And -7L)
PrintResult("System.Byte.MaxValue And 28UL", System.Byte.MaxValue And 28UL)
PrintResult("System.Byte.MaxValue And -9D", System.Byte.MaxValue And -9D)
PrintResult("System.Byte.MaxValue And 10.0F", System.Byte.MaxValue And 10.0F)
PrintResult("System.Byte.MaxValue And -11.0R", System.Byte.MaxValue And -11.0R)
PrintResult("System.Byte.MaxValue And ""12""", System.Byte.MaxValue And "12")
PrintResult("System.Byte.MaxValue And TypeCode.Double", System.Byte.MaxValue And TypeCode.Double)
PrintResult("-3S And False", -3S And False)
PrintResult("-3S And True", -3S And True)
PrintResult("-3S And System.SByte.MinValue", -3S And System.SByte.MinValue)
PrintResult("-3S And System.Byte.MaxValue", -3S And System.Byte.MaxValue)
PrintResult("-3S And -3S", -3S And -3S)
PrintResult("-3S And 24US", -3S And 24US)
PrintResult("-3S And -5I", -3S And -5I)
PrintResult("-3S And 26UI", -3S And 26UI)
PrintResult("-3S And -7L", -3S And -7L)
PrintResult("-3S And 28UL", -3S And 28UL)
PrintResult("-3S And -9D", -3S And -9D)
PrintResult("-3S And 10.0F", -3S And 10.0F)
PrintResult("-3S And -11.0R", -3S And -11.0R)
PrintResult("-3S And ""12""", -3S And "12")
PrintResult("-3S And TypeCode.Double", -3S And TypeCode.Double)
PrintResult("24US And False", 24US And False)
PrintResult("24US And True", 24US And True)
PrintResult("24US And System.SByte.MinValue", 24US And System.SByte.MinValue)
PrintResult("24US And System.Byte.MaxValue", 24US And System.Byte.MaxValue)
PrintResult("24US And -3S", 24US And -3S)
PrintResult("24US And 24US", 24US And 24US)
PrintResult("24US And -5I", 24US And -5I)
PrintResult("24US And 26UI", 24US And 26UI)
PrintResult("24US And -7L", 24US And -7L)
PrintResult("24US And 28UL", 24US And 28UL)
PrintResult("24US And -9D", 24US And -9D)
PrintResult("24US And 10.0F", 24US And 10.0F)
PrintResult("24US And -11.0R", 24US And -11.0R)
PrintResult("24US And ""12""", 24US And "12")
PrintResult("24US And TypeCode.Double", 24US And TypeCode.Double)
PrintResult("-5I And False", -5I And False)
PrintResult("-5I And True", -5I And True)
PrintResult("-5I And System.SByte.MinValue", -5I And System.SByte.MinValue)
PrintResult("-5I And System.Byte.MaxValue", -5I And System.Byte.MaxValue)
PrintResult("-5I And -3S", -5I And -3S)
PrintResult("-5I And 24US", -5I And 24US)
PrintResult("-5I And -5I", -5I And -5I)
PrintResult("-5I And 26UI", -5I And 26UI)
PrintResult("-5I And -7L", -5I And -7L)
PrintResult("-5I And 28UL", -5I And 28UL)
PrintResult("-5I And -9D", -5I And -9D)
PrintResult("-5I And 10.0F", -5I And 10.0F)
PrintResult("-5I And -11.0R", -5I And -11.0R)
PrintResult("-5I And ""12""", -5I And "12")
PrintResult("-5I And TypeCode.Double", -5I And TypeCode.Double)
PrintResult("26UI And False", 26UI And False)
PrintResult("26UI And True", 26UI And True)
PrintResult("26UI And System.SByte.MinValue", 26UI And System.SByte.MinValue)
PrintResult("26UI And System.Byte.MaxValue", 26UI And System.Byte.MaxValue)
PrintResult("26UI And -3S", 26UI And -3S)
PrintResult("26UI And 24US", 26UI And 24US)
PrintResult("26UI And -5I", 26UI And -5I)
PrintResult("26UI And 26UI", 26UI And 26UI)
PrintResult("26UI And -7L", 26UI And -7L)
PrintResult("26UI And 28UL", 26UI And 28UL)
PrintResult("26UI And -9D", 26UI And -9D)
PrintResult("26UI And 10.0F", 26UI And 10.0F)
PrintResult("26UI And -11.0R", 26UI And -11.0R)
PrintResult("26UI And ""12""", 26UI And "12")
PrintResult("26UI And TypeCode.Double", 26UI And TypeCode.Double)
PrintResult("-7L And False", -7L And False)
PrintResult("-7L And True", -7L And True)
PrintResult("-7L And System.SByte.MinValue", -7L And System.SByte.MinValue)
PrintResult("-7L And System.Byte.MaxValue", -7L And System.Byte.MaxValue)
PrintResult("-7L And -3S", -7L And -3S)
PrintResult("-7L And 24US", -7L And 24US)
PrintResult("-7L And -5I", -7L And -5I)
PrintResult("-7L And 26UI", -7L And 26UI)
PrintResult("-7L And -7L", -7L And -7L)
PrintResult("-7L And 28UL", -7L And 28UL)
PrintResult("-7L And -9D", -7L And -9D)
PrintResult("-7L And 10.0F", -7L And 10.0F)
PrintResult("-7L And -11.0R", -7L And -11.0R)
PrintResult("-7L And ""12""", -7L And "12")
PrintResult("-7L And TypeCode.Double", -7L And TypeCode.Double)
PrintResult("28UL And False", 28UL And False)
PrintResult("28UL And True", 28UL And True)
PrintResult("28UL And System.SByte.MinValue", 28UL And System.SByte.MinValue)
PrintResult("28UL And System.Byte.MaxValue", 28UL And System.Byte.MaxValue)
PrintResult("28UL And -3S", 28UL And -3S)
PrintResult("28UL And 24US", 28UL And 24US)
PrintResult("28UL And -5I", 28UL And -5I)
PrintResult("28UL And 26UI", 28UL And 26UI)
PrintResult("28UL And -7L", 28UL And -7L)
PrintResult("28UL And 28UL", 28UL And 28UL)
PrintResult("28UL And -9D", 28UL And -9D)
PrintResult("28UL And 10.0F", 28UL And 10.0F)
PrintResult("28UL And -11.0R", 28UL And -11.0R)
PrintResult("28UL And ""12""", 28UL And "12")
PrintResult("28UL And TypeCode.Double", 28UL And TypeCode.Double)
PrintResult("-9D And False", -9D And False)
PrintResult("-9D And True", -9D And True)
PrintResult("-9D And System.SByte.MinValue", -9D And System.SByte.MinValue)
PrintResult("-9D And System.Byte.MaxValue", -9D And System.Byte.MaxValue)
PrintResult("-9D And -3S", -9D And -3S)
PrintResult("-9D And 24US", -9D And 24US)
PrintResult("-9D And -5I", -9D And -5I)
PrintResult("-9D And 26UI", -9D And 26UI)
PrintResult("-9D And -7L", -9D And -7L)
PrintResult("-9D And 28UL", -9D And 28UL)
PrintResult("-9D And -9D", -9D And -9D)
PrintResult("-9D And 10.0F", -9D And 10.0F)
PrintResult("-9D And -11.0R", -9D And -11.0R)
PrintResult("-9D And ""12""", -9D And "12")
PrintResult("-9D And TypeCode.Double", -9D And TypeCode.Double)
PrintResult("10.0F And False", 10.0F And False)
PrintResult("10.0F And True", 10.0F And True)
PrintResult("10.0F And System.SByte.MinValue", 10.0F And System.SByte.MinValue)
PrintResult("10.0F And System.Byte.MaxValue", 10.0F And System.Byte.MaxValue)
PrintResult("10.0F And -3S", 10.0F And -3S)
PrintResult("10.0F And 24US", 10.0F And 24US)
PrintResult("10.0F And -5I", 10.0F And -5I)
PrintResult("10.0F And 26UI", 10.0F And 26UI)
PrintResult("10.0F And -7L", 10.0F And -7L)
PrintResult("10.0F And 28UL", 10.0F And 28UL)
PrintResult("10.0F And -9D", 10.0F And -9D)
PrintResult("10.0F And 10.0F", 10.0F And 10.0F)
PrintResult("10.0F And -11.0R", 10.0F And -11.0R)
PrintResult("10.0F And ""12""", 10.0F And "12")
PrintResult("10.0F And TypeCode.Double", 10.0F And TypeCode.Double)
PrintResult("-11.0R And False", -11.0R And False)
PrintResult("-11.0R And True", -11.0R And True)
PrintResult("-11.0R And System.SByte.MinValue", -11.0R And System.SByte.MinValue)
PrintResult("-11.0R And System.Byte.MaxValue", -11.0R And System.Byte.MaxValue)
PrintResult("-11.0R And -3S", -11.0R And -3S)
PrintResult("-11.0R And 24US", -11.0R And 24US)
PrintResult("-11.0R And -5I", -11.0R And -5I)
PrintResult("-11.0R And 26UI", -11.0R And 26UI)
PrintResult("-11.0R And -7L", -11.0R And -7L)
PrintResult("-11.0R And 28UL", -11.0R And 28UL)
PrintResult("-11.0R And -9D", -11.0R And -9D)
PrintResult("-11.0R And 10.0F", -11.0R And 10.0F)
PrintResult("-11.0R And -11.0R", -11.0R And -11.0R)
PrintResult("-11.0R And ""12""", -11.0R And "12")
PrintResult("-11.0R And TypeCode.Double", -11.0R And TypeCode.Double)
PrintResult("""12"" And False", "12" And False)
PrintResult("""12"" And True", "12" And True)
PrintResult("""12"" And System.SByte.MinValue", "12" And System.SByte.MinValue)
PrintResult("""12"" And System.Byte.MaxValue", "12" And System.Byte.MaxValue)
PrintResult("""12"" And -3S", "12" And -3S)
PrintResult("""12"" And 24US", "12" And 24US)
PrintResult("""12"" And -5I", "12" And -5I)
PrintResult("""12"" And 26UI", "12" And 26UI)
PrintResult("""12"" And -7L", "12" And -7L)
PrintResult("""12"" And 28UL", "12" And 28UL)
PrintResult("""12"" And -9D", "12" And -9D)
PrintResult("""12"" And 10.0F", "12" And 10.0F)
PrintResult("""12"" And -11.0R", "12" And -11.0R)
PrintResult("""12"" And ""12""", "12" And "12")
PrintResult("""12"" And TypeCode.Double", "12" And TypeCode.Double)
PrintResult("TypeCode.Double And False", TypeCode.Double And False)
PrintResult("TypeCode.Double And True", TypeCode.Double And True)
PrintResult("TypeCode.Double And System.SByte.MinValue", TypeCode.Double And System.SByte.MinValue)
PrintResult("TypeCode.Double And System.Byte.MaxValue", TypeCode.Double And System.Byte.MaxValue)
PrintResult("TypeCode.Double And -3S", TypeCode.Double And -3S)
PrintResult("TypeCode.Double And 24US", TypeCode.Double And 24US)
PrintResult("TypeCode.Double And -5I", TypeCode.Double And -5I)
PrintResult("TypeCode.Double And 26UI", TypeCode.Double And 26UI)
PrintResult("TypeCode.Double And -7L", TypeCode.Double And -7L)
PrintResult("TypeCode.Double And 28UL", TypeCode.Double And 28UL)
PrintResult("TypeCode.Double And -9D", TypeCode.Double And -9D)
PrintResult("TypeCode.Double And 10.0F", TypeCode.Double And 10.0F)
PrintResult("TypeCode.Double And -11.0R", TypeCode.Double And -11.0R)
PrintResult("TypeCode.Double And ""12""", TypeCode.Double And "12")
PrintResult("TypeCode.Double And TypeCode.Double", TypeCode.Double And TypeCode.Double)
'PrintResult("#8:30:00 AM# + ""12""", #8:30:00 AM# + "12")
'PrintResult("#8:30:00 AM# + #8:30:00 AM#", #8:30:00 AM# + #8:30:00 AM#)
PrintResult("""c""c + ""12""", "c"c + "12")
PrintResult("""c""c + ""c""c", "c"c + "c"c)
'PrintResult("""12"" + #8:30:00 AM#", "12" + #8:30:00 AM#)
PrintResult("""12"" + ""c""c", "12" + "c"c)
'PrintResult("#8:30:00 AM# & False", #8:30:00 AM# & False)
'PrintResult("#8:30:00 AM# & True", #8:30:00 AM# & True)
'PrintResult("#8:30:00 AM# & System.SByte.MinValue", #8:30:00 AM# & System.SByte.MinValue)
'PrintResult("#8:30:00 AM# & System.Byte.MaxValue", #8:30:00 AM# & System.Byte.MaxValue)
'PrintResult("#8:30:00 AM# & -3S", #8:30:00 AM# & -3S)
'PrintResult("#8:30:00 AM# & 24US", #8:30:00 AM# & 24US)
'PrintResult("#8:30:00 AM# & -5I", #8:30:00 AM# & -5I)
'PrintResult("#8:30:00 AM# & 26UI", #8:30:00 AM# & 26UI)
'PrintResult("#8:30:00 AM# & -7L", #8:30:00 AM# & -7L)
'PrintResult("#8:30:00 AM# & 28UL", #8:30:00 AM# & 28UL)
'PrintResult("#8:30:00 AM# & -9D", #8:30:00 AM# & -9D)
'PrintResult("#8:30:00 AM# & 10.0F", #8:30:00 AM# & 10.0F)
'PrintResult("#8:30:00 AM# & -11.0R", #8:30:00 AM# & -11.0R)
'PrintResult("#8:30:00 AM# & ""12""", #8:30:00 AM# & "12")
'PrintResult("#8:30:00 AM# & TypeCode.Double", #8:30:00 AM# & TypeCode.Double)
'PrintResult("#8:30:00 AM# & #8:30:00 AM#", #8:30:00 AM# & #8:30:00 AM#)
'PrintResult("#8:30:00 AM# & ""c""c", #8:30:00 AM# & "c"c)
PrintResult("""c""c & False", "c"c & False)
PrintResult("""c""c & True", "c"c & True)
PrintResult("""c""c & System.SByte.MinValue", "c"c & System.SByte.MinValue)
PrintResult("""c""c & System.Byte.MaxValue", "c"c & System.Byte.MaxValue)
PrintResult("""c""c & -3S", "c"c & -3S)
PrintResult("""c""c & 24US", "c"c & 24US)
PrintResult("""c""c & -5I", "c"c & -5I)
PrintResult("""c""c & 26UI", "c"c & 26UI)
PrintResult("""c""c & -7L", "c"c & -7L)
PrintResult("""c""c & 28UL", "c"c & 28UL)
PrintResult("""c""c & -9D", "c"c & -9D)
PrintResult("""c""c & 10.0F", "c"c & 10.0F)
PrintResult("""c""c & -11.0R", "c"c & -11.0R)
PrintResult("""c""c & ""12""", "c"c & "12")
PrintResult("""c""c & TypeCode.Double", "c"c & TypeCode.Double)
'PrintResult("""c""c & #8:30:00 AM#", "c"c & #8:30:00 AM#)
PrintResult("""c""c & ""c""c", "c"c & "c"c)
'PrintResult("False & #8:30:00 AM#", False & #8:30:00 AM#)
PrintResult("False & ""c""c", False & "c"c)
'PrintResult("True & #8:30:00 AM#", True & #8:30:00 AM#)
PrintResult("True & ""c""c", True & "c"c)
'PrintResult("System.SByte.MinValue & #8:30:00 AM#", System.SByte.MinValue & #8:30:00 AM#)
PrintResult("System.SByte.MinValue & ""c""c", System.SByte.MinValue & "c"c)
'PrintResult("System.Byte.MaxValue & #8:30:00 AM#", System.Byte.MaxValue & #8:30:00 AM#)
PrintResult("System.Byte.MaxValue & ""c""c", System.Byte.MaxValue & "c"c)
'PrintResult("-3S & #8:30:00 AM#", -3S & #8:30:00 AM#)
PrintResult("-3S & ""c""c", -3S & "c"c)
'PrintResult("24US & #8:30:00 AM#", 24US & #8:30:00 AM#)
PrintResult("24US & ""c""c", 24US & "c"c)
'PrintResult("-5I & #8:30:00 AM#", -5I & #8:30:00 AM#)
PrintResult("-5I & ""c""c", -5I & "c"c)
'PrintResult("26UI & #8:30:00 AM#", 26UI & #8:30:00 AM#)
PrintResult("26UI & ""c""c", 26UI & "c"c)
'PrintResult("-7L & #8:30:00 AM#", -7L & #8:30:00 AM#)
PrintResult("-7L & ""c""c", -7L & "c"c)
'PrintResult("28UL & #8:30:00 AM#", 28UL & #8:30:00 AM#)
PrintResult("28UL & ""c""c", 28UL & "c"c)
'PrintResult("-9D & #8:30:00 AM#", -9D & #8:30:00 AM#)
PrintResult("-9D & ""c""c", -9D & "c"c)
'PrintResult("10.0F & #8:30:00 AM#", 10.0F & #8:30:00 AM#)
PrintResult("10.0F & ""c""c", 10.0F & "c"c)
'PrintResult("-11.0R & #8:30:00 AM#", -11.0R & #8:30:00 AM#)
PrintResult("-11.0R & ""c""c", -11.0R & "c"c)
'PrintResult("""12"" & #8:30:00 AM#", "12" & #8:30:00 AM#)
PrintResult("""12"" & ""c""c", "12" & "c"c)
'PrintResult("TypeCode.Double & #8:30:00 AM#", TypeCode.Double & #8:30:00 AM#)
PrintResult("TypeCode.Double & ""c""c", TypeCode.Double & "c"c)
PrintResult("#8:30:00 AM# Like False", #8:30:00 AM# Like False)
PrintResult("#8:30:00 AM# Like True", #8:30:00 AM# Like True)
PrintResult("#8:30:00 AM# Like System.SByte.MinValue", #8:30:00 AM# Like System.SByte.MinValue)
PrintResult("#8:30:00 AM# Like System.Byte.MaxValue", #8:30:00 AM# Like System.Byte.MaxValue)
PrintResult("#8:30:00 AM# Like -3S", #8:30:00 AM# Like -3S)
PrintResult("#8:30:00 AM# Like 24US", #8:30:00 AM# Like 24US)
PrintResult("#8:30:00 AM# Like -5I", #8:30:00 AM# Like -5I)
PrintResult("#8:30:00 AM# Like 26UI", #8:30:00 AM# Like 26UI)
PrintResult("#8:30:00 AM# Like -7L", #8:30:00 AM# Like -7L)
PrintResult("#8:30:00 AM# Like 28UL", #8:30:00 AM# Like 28UL)
PrintResult("#8:30:00 AM# Like -9D", #8:30:00 AM# Like -9D)
PrintResult("#8:30:00 AM# Like 10.0F", #8:30:00 AM# Like 10.0F)
PrintResult("#8:30:00 AM# Like -11.0R", #8:30:00 AM# Like -11.0R)
PrintResult("#8:30:00 AM# Like ""12""", #8:30:00 AM# Like "12")
PrintResult("#8:30:00 AM# Like TypeCode.Double", #8:30:00 AM# Like TypeCode.Double)
PrintResult("#8:30:00 AM# Like #8:30:00 AM#", #8:30:00 AM# Like #8:30:00 AM#)
PrintResult("#8:30:00 AM# Like ""c""c", #8:30:00 AM# Like "c"c)
PrintResult("""c""c Like False", "c"c Like False)
PrintResult("""c""c Like True", "c"c Like True)
PrintResult("""c""c Like System.SByte.MinValue", "c"c Like System.SByte.MinValue)
PrintResult("""c""c Like System.Byte.MaxValue", "c"c Like System.Byte.MaxValue)
PrintResult("""c""c Like -3S", "c"c Like -3S)
PrintResult("""c""c Like 24US", "c"c Like 24US)
PrintResult("""c""c Like -5I", "c"c Like -5I)
PrintResult("""c""c Like 26UI", "c"c Like 26UI)
PrintResult("""c""c Like -7L", "c"c Like -7L)
PrintResult("""c""c Like 28UL", "c"c Like 28UL)
PrintResult("""c""c Like -9D", "c"c Like -9D)
PrintResult("""c""c Like 10.0F", "c"c Like 10.0F)
PrintResult("""c""c Like -11.0R", "c"c Like -11.0R)
PrintResult("""c""c Like ""12""", "c"c Like "12")
PrintResult("""c""c Like TypeCode.Double", "c"c Like TypeCode.Double)
PrintResult("""c""c Like #8:30:00 AM#", "c"c Like #8:30:00 AM#)
PrintResult("""c""c Like ""c""c", "c"c Like "c"c)
PrintResult("False Like #8:30:00 AM#", False Like #8:30:00 AM#)
PrintResult("False Like ""c""c", False Like "c"c)
PrintResult("True Like #8:30:00 AM#", True Like #8:30:00 AM#)
PrintResult("True Like ""c""c", True Like "c"c)
PrintResult("System.SByte.MinValue Like #8:30:00 AM#", System.SByte.MinValue Like #8:30:00 AM#)
PrintResult("System.SByte.MinValue Like ""c""c", System.SByte.MinValue Like "c"c)
PrintResult("System.Byte.MaxValue Like #8:30:00 AM#", System.Byte.MaxValue Like #8:30:00 AM#)
PrintResult("System.Byte.MaxValue Like ""c""c", System.Byte.MaxValue Like "c"c)
PrintResult("-3S Like #8:30:00 AM#", -3S Like #8:30:00 AM#)
PrintResult("-3S Like ""c""c", -3S Like "c"c)
PrintResult("24US Like #8:30:00 AM#", 24US Like #8:30:00 AM#)
PrintResult("24US Like ""c""c", 24US Like "c"c)
PrintResult("-5I Like #8:30:00 AM#", -5I Like #8:30:00 AM#)
PrintResult("-5I Like ""c""c", -5I Like "c"c)
PrintResult("26UI Like #8:30:00 AM#", 26UI Like #8:30:00 AM#)
PrintResult("26UI Like ""c""c", 26UI Like "c"c)
PrintResult("-7L Like #8:30:00 AM#", -7L Like #8:30:00 AM#)
PrintResult("-7L Like ""c""c", -7L Like "c"c)
PrintResult("28UL Like #8:30:00 AM#", 28UL Like #8:30:00 AM#)
PrintResult("28UL Like ""c""c", 28UL Like "c"c)
PrintResult("-9D Like #8:30:00 AM#", -9D Like #8:30:00 AM#)
PrintResult("-9D Like ""c""c", -9D Like "c"c)
PrintResult("10.0F Like #8:30:00 AM#", 10.0F Like #8:30:00 AM#)
PrintResult("10.0F Like ""c""c", 10.0F Like "c"c)
PrintResult("-11.0R Like #8:30:00 AM#", -11.0R Like #8:30:00 AM#)
PrintResult("-11.0R Like ""c""c", -11.0R Like "c"c)
PrintResult("""12"" Like #8:30:00 AM#", "12" Like #8:30:00 AM#)
PrintResult("""12"" Like ""c""c", "12" Like "c"c)
PrintResult("TypeCode.Double Like #8:30:00 AM#", TypeCode.Double Like #8:30:00 AM#)
PrintResult("TypeCode.Double Like ""c""c", TypeCode.Double Like "c"c)
PrintResult("#8:30:00 AM# = #8:30:00 AM#", #8:30:00 AM# = #8:30:00 AM#)
PrintResult("""c""c = ""12""", "c"c = "12")
PrintResult("""c""c = ""c""c", "c"c = "c"c)
PrintResult("""12"" = ""c""c", "12" = "c"c)
PrintResult("#8:30:00 AM# <> #8:30:00 AM#", #8:30:00 AM# <> #8:30:00 AM#)
PrintResult("""c""c <> ""12""", "c"c <> "12")
PrintResult("""c""c <> ""c""c", "c"c <> "c"c)
PrintResult("""12"" <> ""c""c", "12" <> "c"c)
PrintResult("#8:30:00 AM# <= #8:30:00 AM#", #8:30:00 AM# <= #8:30:00 AM#)
PrintResult("""c""c <= ""12""", "c"c <= "12")
PrintResult("""c""c <= ""c""c", "c"c <= "c"c)
PrintResult("""12"" <= ""c""c", "12" <= "c"c)
PrintResult("#8:30:00 AM# >= #8:30:00 AM#", #8:30:00 AM# >= #8:30:00 AM#)
PrintResult("""c""c >= ""12""", "c"c >= "12")
PrintResult("""c""c >= ""c""c", "c"c >= "c"c)
PrintResult("""12"" >= ""c""c", "12" >= "c"c)
PrintResult("#8:30:00 AM# < #8:30:00 AM#", #8:30:00 AM# < #8:30:00 AM#)
PrintResult("""c""c < ""12""", "c"c < "12")
PrintResult("""c""c < ""c""c", "c"c < "c"c)
PrintResult("""12"" < ""c""c", "12" < "c"c)
PrintResult("#8:30:00 AM# > #8:30:00 AM#", #8:30:00 AM# > #8:30:00 AM#)
PrintResult("""c""c > ""12""", "c"c > "12")
PrintResult("""c""c > ""c""c", "c"c > "c"c)
PrintResult("""12"" > ""c""c", "12" > "c"c)
PrintResult("System.Byte.MaxValue - 24US", System.Byte.MaxValue - 24US)
PrintResult("System.Byte.MaxValue - 26UI", System.Byte.MaxValue - 26UI)
PrintResult("System.Byte.MaxValue - 28UL", System.Byte.MaxValue - 28UL)
PrintResult("44US - 26UI", 44US - 26UI)
PrintResult("44US - 28UL", 44US - 28UL)
PrintResult("46UI - 28UL", 46UI - 28UL)
PrintResult("System.Byte.MaxValue * (System.Byte.MaxValue \ System.Byte.MaxValue)", System.Byte.MaxValue * (System.Byte.MaxValue \ System.Byte.MaxValue))
PrintResult("#8:31:00 AM# = ""8:30:00 AM""", #8:31:00 AM# = "8:30:00 AM")
PrintResult("""8:30:00 AM"" = #8:31:00 AM#", "8:30:00 AM" = #8:31:00 AM#)
PrintResult("#8:31:00 AM# <> ""8:30:00 AM""", #8:31:00 AM# <> "8:30:00 AM")
PrintResult("""8:30:00 AM"" <> #8:31:00 AM#", "8:30:00 AM" <> #8:31:00 AM#)
PrintResult("#8:31:00 AM# <= ""8:30:00 AM""", #8:31:00 AM# <= "8:30:00 AM")
PrintResult("""8:30:00 AM"" <= #8:31:00 AM#", "8:30:00 AM" <= #8:31:00 AM#)
PrintResult("#8:31:00 AM# >= ""8:30:00 AM""", #8:31:00 AM# >= "8:30:00 AM")
PrintResult("""8:30:00 AM"" >= #8:31:00 AM#", "8:30:00 AM" >= #8:31:00 AM#)
PrintResult("#8:31:00 AM# < ""8:30:00 AM""", #8:31:00 AM# < "8:30:00 AM")
PrintResult("""8:30:00 AM"" < #8:31:00 AM#", "8:30:00 AM" < #8:31:00 AM#)
PrintResult("#8:31:00 AM# > ""8:30:00 AM""", #8:31:00 AM# > "8:30:00 AM")
PrintResult("""8:30:00 AM"" > #8:31:00 AM#", "8:30:00 AM" > #8:31:00 AM#)
PrintResult("-5I + Nothing", -5I + Nothing)
PrintResult("""12"" + Nothing", "12" + Nothing)
PrintResult("""12"" + DBNull.Value", "12" + DBNull.Value)
PrintResult("Nothing + Nothing", Nothing + Nothing)
PrintResult("Nothing + -5I", Nothing + -5I)
PrintResult("Nothing + ""12""", Nothing + "12")
PrintResult("DBNull.Value + ""12""", DBNull.Value + "12")
PrintResult("-5I - Nothing", -5I - Nothing)
PrintResult("""12"" - Nothing", "12" - Nothing)
PrintResult("Nothing - Nothing", Nothing - Nothing)
PrintResult("Nothing - -5I", Nothing - -5I)
PrintResult("Nothing - ""12""", Nothing - "12")
PrintResult("-5I * Nothing", -5I * Nothing)
PrintResult("""12"" * Nothing", "12" * Nothing)
PrintResult("Nothing * Nothing", Nothing * Nothing)
PrintResult("Nothing * -5I", Nothing * -5I)
PrintResult("Nothing * ""12""", Nothing * "12")
PrintResult("-5I / Nothing", -5I / Nothing)
PrintResult("""12"" / Nothing", "12" / Nothing)
PrintResult("Nothing / Nothing", Nothing / Nothing)
PrintResult("Nothing / -5I", Nothing / -5I)
PrintResult("Nothing / ""12""", Nothing / "12")
PrintResult("Nothing \ -5I", Nothing \ -5I)
PrintResult("Nothing \ ""12""", Nothing \ "12")
PrintResult("""12"" Mod Nothing", "12" Mod Nothing)
PrintResult("Nothing Mod -5I", Nothing Mod -5I)
PrintResult("Nothing Mod ""12""", Nothing Mod "12")
PrintResult("-5I ^ Nothing", -5I ^ Nothing)
PrintResult("""12"" ^ Nothing", "12" ^ Nothing)
PrintResult("Nothing ^ Nothing", Nothing ^ Nothing)
PrintResult("Nothing ^ -5I", Nothing ^ -5I)
PrintResult("Nothing ^ ""12""", Nothing ^ "12")
PrintResult("-5I << Nothing", -5I << Nothing)
PrintResult("""12"" << Nothing", "12" << Nothing)
PrintResult("Nothing << Nothing", Nothing << Nothing)
PrintResult("Nothing << -5I", Nothing << -5I)
PrintResult("Nothing << ""12""", Nothing << "12")
PrintResult("-5I >> Nothing", -5I >> Nothing)
PrintResult("""12"" >> Nothing", "12" >> Nothing)
PrintResult("Nothing >> Nothing", Nothing >> Nothing)
PrintResult("Nothing >> -5I", Nothing >> -5I)
PrintResult("Nothing >> ""12""", Nothing >> "12")
PrintResult("-5I OrElse Nothing", -5I OrElse Nothing)
PrintResult("""12"" OrElse Nothing", "12" OrElse Nothing)
PrintResult("Nothing OrElse Nothing", Nothing OrElse Nothing)
PrintResult("Nothing OrElse -5I", Nothing OrElse -5I)
PrintResult("-5I AndAlso Nothing", -5I AndAlso Nothing)
PrintResult("Nothing AndAlso Nothing", Nothing AndAlso Nothing)
PrintResult("Nothing AndAlso -5I", Nothing AndAlso -5I)
PrintResult("-5I & Nothing", -5I & Nothing)
PrintResult("-5I & DBNull.Value", -5I & DBNull.Value)
PrintResult("""12"" & Nothing", "12" & Nothing)
PrintResult("""12"" & DBNull.Value", "12" & DBNull.Value)
PrintResult("Nothing & Nothing", Nothing & Nothing)
PrintResult("Nothing & DBNull.Value", Nothing & DBNull.Value)
PrintResult("DBNull.Value & Nothing", DBNull.Value & Nothing)
PrintResult("Nothing & -5I", Nothing & -5I)
PrintResult("Nothing & ""12""", Nothing & "12")
PrintResult("DBNull.Value & -5I", DBNull.Value & -5I)
PrintResult("DBNull.Value & ""12""", DBNull.Value & "12")
PrintResult("-5I Like Nothing", -5I Like Nothing)
PrintResult("""12"" Like Nothing", "12" Like Nothing)
PrintResult("Nothing Like Nothing", Nothing Like Nothing)
PrintResult("Nothing Like -5I", Nothing Like -5I)
PrintResult("Nothing Like ""12""", Nothing Like "12")
PrintResult("-5I = Nothing", -5I = Nothing)
PrintResult("""12"" = Nothing", "12" = Nothing)
PrintResult("Nothing = Nothing", Nothing = Nothing)
PrintResult("Nothing = -5I", Nothing = -5I)
PrintResult("Nothing = ""12""", Nothing = "12")
PrintResult("-5I <> Nothing", -5I <> Nothing)
PrintResult("""12"" <> Nothing", "12" <> Nothing)
PrintResult("Nothing <> Nothing", Nothing <> Nothing)
PrintResult("Nothing <> -5I", Nothing <> -5I)
PrintResult("Nothing <> ""12""", Nothing <> "12")
PrintResult("-5I <= Nothing", -5I <= Nothing)
PrintResult("""12"" <= Nothing", "12" <= Nothing)
PrintResult("Nothing <= Nothing", Nothing <= Nothing)
PrintResult("Nothing <= -5I", Nothing <= -5I)
PrintResult("Nothing <= ""12""", Nothing <= "12")
PrintResult("-5I >= Nothing", -5I >= Nothing)
PrintResult("""12"" >= Nothing", "12" >= Nothing)
PrintResult("Nothing >= Nothing", Nothing >= Nothing)
PrintResult("Nothing >= -5I", Nothing >= -5I)
PrintResult("Nothing >= ""12""", Nothing >= "12")
PrintResult("-5I < Nothing", -5I < Nothing)
PrintResult("""12"" < Nothing", "12" < Nothing)
PrintResult("Nothing < Nothing", Nothing < Nothing)
PrintResult("Nothing < -5I", Nothing < -5I)
PrintResult("Nothing < ""12""", Nothing < "12")
PrintResult("-5I > Nothing", -5I > Nothing)
PrintResult("""12"" > Nothing", "12" > Nothing)
PrintResult("Nothing > Nothing", Nothing > Nothing)
PrintResult("Nothing > -5I", Nothing > -5I)
PrintResult("Nothing > ""12""", Nothing > "12")
PrintResult("-5I Xor Nothing", -5I Xor Nothing)
PrintResult("""12"" Xor Nothing", "12" Xor Nothing)
PrintResult("Nothing Xor Nothing", Nothing Xor Nothing)
PrintResult("Nothing Xor -5I", Nothing Xor -5I)
PrintResult("Nothing Xor ""12""", Nothing Xor "12")
PrintResult("-5I Or Nothing", -5I Or Nothing)
PrintResult("""12"" Or Nothing", "12" Or Nothing)
PrintResult("Nothing Or Nothing", Nothing Or Nothing)
PrintResult("Nothing Or -5I", Nothing Or -5I)
PrintResult("Nothing Or ""12""", Nothing Or "12")
PrintResult("-5I And Nothing", -5I And Nothing)
PrintResult("""12"" And Nothing", "12" And Nothing)
PrintResult("Nothing And Nothing", Nothing And Nothing)
PrintResult("Nothing And -5I", Nothing And -5I)
PrintResult("Nothing And ""12""", Nothing And "12")
PrintResult("2I / 0", 2I / 0)
PrintResult("1.5F / 0", 1.5F / 0)
PrintResult("2.5R / 0", 2.5R / 0)
PrintResult("1.5F Mod 0", 1.5F Mod 0)
PrintResult("2.5R Mod 0", 2.5R Mod 0)
PrintResult("2I / 0", 2I / Nothing)
PrintResult("1.5F / 0", 1.5F / Nothing)
PrintResult("2.5R / 0", 2.5R / Nothing)
PrintResult("1.5F Mod 0", 1.5F Mod Nothing)
PrintResult("2.5R Mod 0", 2.5R Mod Nothing)
PrintResult("System.Single.MinValue - 1.0F", System.Single.MinValue - 1.0F)
PrintResult("System.Double.MinValue - 1.0R", System.Double.MinValue - 1.0R)
PrintResult("System.Single.MaxValue + 1.0F", System.Single.MaxValue + 1.0F)
PrintResult("System.Double.MaxValue + 1.0R", System.Double.MaxValue + 1.0R)
PrintResult("1.0F ^ System.Single.NegativeInfinity", 1.0F ^ System.Single.NegativeInfinity)
PrintResult("1.0F ^ System.Single.PositiveInfinity", 1.0F ^ System.Single.PositiveInfinity)
PrintResult("1.0R ^ System.Double.NegativeInfinity", 1.0R ^ System.Double.NegativeInfinity)
PrintResult("1.0R ^ System.Double.PositiveInfinity", 1.0R ^ System.Double.PositiveInfinity)
PrintResult("-1.0F ^ System.Single.NegativeInfinity", -1.0F ^ System.Single.NegativeInfinity)
PrintResult("-1.0F ^ System.Single.PositiveInfinity", -1.0F ^ System.Single.PositiveInfinity)
PrintResult("-1.0R ^ System.Double.NegativeInfinity", -1.0R ^ System.Double.NegativeInfinity)
PrintResult("-1.0R ^ System.Double.PositiveInfinity", -1.0R ^ System.Double.PositiveInfinity)
PrintResult("2.0F ^ System.Single.NaN", 2.0F ^ System.Single.NaN)
PrintResult("2.0R ^ System.Double.NaN", 2.0R ^ System.Double.NaN)
PrintResult("(-1.0F) ^ System.Single.NegativeInfinity", (-1.0F) ^ System.Single.NegativeInfinity)
PrintResult("(-1.0F) ^ System.Single.PositiveInfinity", (-1.0F) ^ System.Single.PositiveInfinity)
PrintResult("(-1.0F) ^ System.Double.NegativeInfinity", (-1.0F) ^ System.Double.NegativeInfinity)
PrintResult("(-1.0F) ^ System.Double.PositiveInfinity", (-1.0F) ^ System.Double.PositiveInfinity)
End Sub
End Module
| ' 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.
Option Strict Off
Imports System
Module Module1
Sub Main()
PrintResult("False + False", False + False)
PrintResult("False + True", False + True)
PrintResult("False + System.SByte.MinValue", False + System.SByte.MinValue)
PrintResult("False + System.Byte.MaxValue", False + System.Byte.MaxValue)
PrintResult("False + -3S", False + -3S)
PrintResult("False + 24US", False + 24US)
PrintResult("False + -5I", False + -5I)
PrintResult("False + 26UI", False + 26UI)
PrintResult("False + -7L", False + -7L)
PrintResult("False + 28UL", False + 28UL)
PrintResult("False + -9D", False + -9D)
PrintResult("False + 10.0F", False + 10.0F)
PrintResult("False + -11.0R", False + -11.0R)
PrintResult("False + ""12""", False + "12")
PrintResult("False + TypeCode.Double", False + TypeCode.Double)
PrintResult("True + False", True + False)
PrintResult("True + True", True + True)
PrintResult("True + System.SByte.MaxValue", True + System.SByte.MaxValue)
PrintResult("True + System.Byte.MaxValue", True + System.Byte.MaxValue)
PrintResult("True + -3S", True + -3S)
PrintResult("True + 24US", True + 24US)
PrintResult("True + -5I", True + -5I)
PrintResult("True + 26UI", True + 26UI)
PrintResult("True + -7L", True + -7L)
PrintResult("True + 28UL", True + 28UL)
PrintResult("True + -9D", True + -9D)
PrintResult("True + 10.0F", True + 10.0F)
PrintResult("True + -11.0R", True + -11.0R)
PrintResult("True + ""12""", True + "12")
PrintResult("True + TypeCode.Double", True + TypeCode.Double)
PrintResult("System.SByte.MinValue + False", System.SByte.MinValue + False)
PrintResult("System.SByte.MaxValue + True", System.SByte.MaxValue + True)
PrintResult("System.SByte.MinValue + System.SByte.MaxValue", System.SByte.MinValue + System.SByte.MaxValue)
PrintResult("System.SByte.MinValue + System.Byte.MaxValue", System.SByte.MinValue + System.Byte.MaxValue)
PrintResult("System.SByte.MinValue + -3S", System.SByte.MinValue + -3S)
PrintResult("System.SByte.MinValue + 24US", System.SByte.MinValue + 24US)
PrintResult("System.SByte.MinValue + -5I", System.SByte.MinValue + -5I)
PrintResult("System.SByte.MinValue + 26UI", System.SByte.MinValue + 26UI)
PrintResult("System.SByte.MinValue + -7L", System.SByte.MinValue + -7L)
PrintResult("System.SByte.MinValue + 28UL", System.SByte.MinValue + 28UL)
PrintResult("System.SByte.MinValue + -9D", System.SByte.MinValue + -9D)
PrintResult("System.SByte.MinValue + 10.0F", System.SByte.MinValue + 10.0F)
PrintResult("System.SByte.MinValue + -11.0R", System.SByte.MinValue + -11.0R)
PrintResult("System.SByte.MinValue + ""12""", System.SByte.MinValue + "12")
PrintResult("System.SByte.MinValue + TypeCode.Double", System.SByte.MinValue + TypeCode.Double)
PrintResult("System.Byte.MaxValue + False", System.Byte.MaxValue + False)
PrintResult("System.Byte.MaxValue + True", System.Byte.MaxValue + True)
PrintResult("System.Byte.MaxValue + System.SByte.MinValue", System.Byte.MaxValue + System.SByte.MinValue)
PrintResult("System.Byte.MaxValue + System.Byte.MinValue", System.Byte.MaxValue + System.Byte.MinValue)
PrintResult("System.Byte.MaxValue + -3S", System.Byte.MaxValue + -3S)
PrintResult("System.Byte.MaxValue + 24US", System.Byte.MaxValue + 24US)
PrintResult("System.Byte.MaxValue + -5I", System.Byte.MaxValue + -5I)
PrintResult("System.Byte.MaxValue + 26UI", System.Byte.MaxValue + 26UI)
PrintResult("System.Byte.MaxValue + -7L", System.Byte.MaxValue + -7L)
PrintResult("System.Byte.MaxValue + 28UL", System.Byte.MaxValue + 28UL)
PrintResult("System.Byte.MaxValue + -9D", System.Byte.MaxValue + -9D)
PrintResult("System.Byte.MaxValue + 10.0F", System.Byte.MaxValue + 10.0F)
PrintResult("System.Byte.MaxValue + -11.0R", System.Byte.MaxValue + -11.0R)
PrintResult("System.Byte.MaxValue + ""12""", System.Byte.MaxValue + "12")
PrintResult("System.Byte.MaxValue + TypeCode.Double", System.Byte.MaxValue + TypeCode.Double)
PrintResult("-3S + False", -3S + False)
PrintResult("-3S + True", -3S + True)
PrintResult("-3S + System.SByte.MinValue", -3S + System.SByte.MinValue)
PrintResult("-3S + System.Byte.MaxValue", -3S + System.Byte.MaxValue)
PrintResult("-3S + -3S", -3S + -3S)
PrintResult("-3S + 24US", -3S + 24US)
PrintResult("-3S + -5I", -3S + -5I)
PrintResult("-3S + 26UI", -3S + 26UI)
PrintResult("-3S + -7L", -3S + -7L)
PrintResult("-3S + 28UL", -3S + 28UL)
PrintResult("-3S + -9D", -3S + -9D)
PrintResult("-3S + 10.0F", -3S + 10.0F)
PrintResult("-3S + -11.0R", -3S + -11.0R)
PrintResult("-3S + ""12""", -3S + "12")
PrintResult("-3S + TypeCode.Double", -3S + TypeCode.Double)
PrintResult("24US + False", 24US + False)
PrintResult("24US + True", 24US + True)
PrintResult("24US + System.SByte.MinValue", 24US + System.SByte.MinValue)
PrintResult("24US + System.Byte.MaxValue", 24US + System.Byte.MaxValue)
PrintResult("24US + -3S", 24US + -3S)
PrintResult("24US + 24US", 24US + 24US)
PrintResult("24US + -5I", 24US + -5I)
PrintResult("24US + 26UI", 24US + 26UI)
PrintResult("24US + -7L", 24US + -7L)
PrintResult("24US + 28UL", 24US + 28UL)
PrintResult("24US + -9D", 24US + -9D)
PrintResult("24US + 10.0F", 24US + 10.0F)
PrintResult("24US + -11.0R", 24US + -11.0R)
PrintResult("24US + ""12""", 24US + "12")
PrintResult("24US + TypeCode.Double", 24US + TypeCode.Double)
PrintResult("-5I + False", -5I + False)
PrintResult("-5I + True", -5I + True)
PrintResult("-5I + System.SByte.MinValue", -5I + System.SByte.MinValue)
PrintResult("-5I + System.Byte.MaxValue", -5I + System.Byte.MaxValue)
PrintResult("-5I + -3S", -5I + -3S)
PrintResult("-5I + 24US", -5I + 24US)
PrintResult("-5I + -5I", -5I + -5I)
PrintResult("-5I + 26UI", -5I + 26UI)
PrintResult("-5I + -7L", -5I + -7L)
PrintResult("-5I + 28UL", -5I + 28UL)
PrintResult("-5I + -9D", -5I + -9D)
PrintResult("-5I + 10.0F", -5I + 10.0F)
PrintResult("-5I + -11.0R", -5I + -11.0R)
PrintResult("-5I + ""12""", -5I + "12")
PrintResult("-5I + TypeCode.Double", -5I + TypeCode.Double)
PrintResult("26UI + False", 26UI + False)
PrintResult("26UI + True", 26UI + True)
PrintResult("26UI + System.SByte.MinValue", 26UI + System.SByte.MinValue)
PrintResult("26UI + System.Byte.MaxValue", 26UI + System.Byte.MaxValue)
PrintResult("26UI + -3S", 26UI + -3S)
PrintResult("26UI + 24US", 26UI + 24US)
PrintResult("26UI + -5I", 26UI + -5I)
PrintResult("26UI + 26UI", 26UI + 26UI)
PrintResult("26UI + -7L", 26UI + -7L)
PrintResult("26UI + 28UL", 26UI + 28UL)
PrintResult("26UI + -9D", 26UI + -9D)
PrintResult("26UI + 10.0F", 26UI + 10.0F)
PrintResult("26UI + -11.0R", 26UI + -11.0R)
PrintResult("26UI + ""12""", 26UI + "12")
PrintResult("26UI + TypeCode.Double", 26UI + TypeCode.Double)
PrintResult("-7L + False", -7L + False)
PrintResult("-7L + True", -7L + True)
PrintResult("-7L + System.SByte.MinValue", -7L + System.SByte.MinValue)
PrintResult("-7L + System.Byte.MaxValue", -7L + System.Byte.MaxValue)
PrintResult("-7L + -3S", -7L + -3S)
PrintResult("-7L + 24US", -7L + 24US)
PrintResult("-7L + -5I", -7L + -5I)
PrintResult("-7L + 26UI", -7L + 26UI)
PrintResult("-7L + -7L", -7L + -7L)
PrintResult("-7L + 28UL", -7L + 28UL)
PrintResult("-7L + -9D", -7L + -9D)
PrintResult("-7L + 10.0F", -7L + 10.0F)
PrintResult("-7L + -11.0R", -7L + -11.0R)
PrintResult("-7L + ""12""", -7L + "12")
PrintResult("-7L + TypeCode.Double", -7L + TypeCode.Double)
PrintResult("28UL + False", 28UL + False)
PrintResult("28UL + True", 28UL + True)
PrintResult("28UL + System.SByte.MinValue", 28UL + System.SByte.MinValue)
PrintResult("28UL + System.Byte.MaxValue", 28UL + System.Byte.MaxValue)
PrintResult("28UL + -3S", 28UL + -3S)
PrintResult("28UL + 24US", 28UL + 24US)
PrintResult("28UL + -5I", 28UL + -5I)
PrintResult("28UL + 26UI", 28UL + 26UI)
PrintResult("28UL + -7L", 28UL + -7L)
PrintResult("28UL + 28UL", 28UL + 28UL)
PrintResult("28UL + -9D", 28UL + -9D)
PrintResult("28UL + 10.0F", 28UL + 10.0F)
PrintResult("28UL + -11.0R", 28UL + -11.0R)
PrintResult("28UL + ""12""", 28UL + "12")
PrintResult("28UL + TypeCode.Double", 28UL + TypeCode.Double)
PrintResult("-9D + False", -9D + False)
PrintResult("-9D + True", -9D + True)
PrintResult("-9D + System.SByte.MinValue", -9D + System.SByte.MinValue)
PrintResult("-9D + System.Byte.MaxValue", -9D + System.Byte.MaxValue)
PrintResult("-9D + -3S", -9D + -3S)
PrintResult("-9D + 24US", -9D + 24US)
PrintResult("-9D + -5I", -9D + -5I)
PrintResult("-9D + 26UI", -9D + 26UI)
PrintResult("-9D + -7L", -9D + -7L)
PrintResult("-9D + 28UL", -9D + 28UL)
PrintResult("-9D + -9D", -9D + -9D)
PrintResult("-9D + 10.0F", -9D + 10.0F)
PrintResult("-9D + -11.0R", -9D + -11.0R)
PrintResult("-9D + ""12""", -9D + "12")
PrintResult("-9D + TypeCode.Double", -9D + TypeCode.Double)
PrintResult("10.0F + False", 10.0F + False)
PrintResult("10.0F + True", 10.0F + True)
PrintResult("10.0F + System.SByte.MinValue", 10.0F + System.SByte.MinValue)
PrintResult("10.0F + System.Byte.MaxValue", 10.0F + System.Byte.MaxValue)
PrintResult("10.0F + -3S", 10.0F + -3S)
PrintResult("10.0F + 24US", 10.0F + 24US)
PrintResult("10.0F + -5I", 10.0F + -5I)
PrintResult("10.0F + 26UI", 10.0F + 26UI)
PrintResult("10.0F + -7L", 10.0F + -7L)
PrintResult("10.0F + 28UL", 10.0F + 28UL)
PrintResult("10.0F + -9D", 10.0F + -9D)
PrintResult("10.0F + 10.0F", 10.0F + 10.0F)
PrintResult("10.0F + -11.0R", 10.0F + -11.0R)
PrintResult("10.0F + ""12""", 10.0F + "12")
PrintResult("10.0F + TypeCode.Double", 10.0F + TypeCode.Double)
PrintResult("-11.0R + False", -11.0R + False)
PrintResult("-11.0R + True", -11.0R + True)
PrintResult("-11.0R + System.SByte.MinValue", -11.0R + System.SByte.MinValue)
PrintResult("-11.0R + System.Byte.MaxValue", -11.0R + System.Byte.MaxValue)
PrintResult("-11.0R + -3S", -11.0R + -3S)
PrintResult("-11.0R + 24US", -11.0R + 24US)
PrintResult("-11.0R + -5I", -11.0R + -5I)
PrintResult("-11.0R + 26UI", -11.0R + 26UI)
PrintResult("-11.0R + -7L", -11.0R + -7L)
PrintResult("-11.0R + 28UL", -11.0R + 28UL)
PrintResult("-11.0R + -9D", -11.0R + -9D)
PrintResult("-11.0R + 10.0F", -11.0R + 10.0F)
PrintResult("-11.0R + -11.0R", -11.0R + -11.0R)
PrintResult("-11.0R + ""12""", -11.0R + "12")
PrintResult("-11.0R + TypeCode.Double", -11.0R + TypeCode.Double)
PrintResult("""12"" + False", "12" + False)
PrintResult("""12"" + True", "12" + True)
PrintResult("""12"" + System.SByte.MinValue", "12" + System.SByte.MinValue)
PrintResult("""12"" + System.Byte.MaxValue", "12" + System.Byte.MaxValue)
PrintResult("""12"" + -3S", "12" + -3S)
PrintResult("""12"" + 24US", "12" + 24US)
PrintResult("""12"" + -5I", "12" + -5I)
PrintResult("""12"" + 26UI", "12" + 26UI)
PrintResult("""12"" + -7L", "12" + -7L)
PrintResult("""12"" + 28UL", "12" + 28UL)
PrintResult("""12"" + -9D", "12" + -9D)
PrintResult("""12"" + 10.0F", "12" + 10.0F)
PrintResult("""12"" + -11.0R", "12" + -11.0R)
PrintResult("""12"" + ""12""", "12" + "12")
PrintResult("""12"" + TypeCode.Double", "12" + TypeCode.Double)
PrintResult("TypeCode.Double + False", TypeCode.Double + False)
PrintResult("TypeCode.Double + True", TypeCode.Double + True)
PrintResult("TypeCode.Double + System.SByte.MinValue", TypeCode.Double + System.SByte.MinValue)
PrintResult("TypeCode.Double + System.Byte.MaxValue", TypeCode.Double + System.Byte.MaxValue)
PrintResult("TypeCode.Double + -3S", TypeCode.Double + -3S)
PrintResult("TypeCode.Double + 24US", TypeCode.Double + 24US)
PrintResult("TypeCode.Double + -5I", TypeCode.Double + -5I)
PrintResult("TypeCode.Double + 26UI", TypeCode.Double + 26UI)
PrintResult("TypeCode.Double + -7L", TypeCode.Double + -7L)
PrintResult("TypeCode.Double + 28UL", TypeCode.Double + 28UL)
PrintResult("TypeCode.Double + -9D", TypeCode.Double + -9D)
PrintResult("TypeCode.Double + 10.0F", TypeCode.Double + 10.0F)
PrintResult("TypeCode.Double + -11.0R", TypeCode.Double + -11.0R)
PrintResult("TypeCode.Double + ""12""", TypeCode.Double + "12")
PrintResult("TypeCode.Double + TypeCode.Double", TypeCode.Double + TypeCode.Double)
PrintResult("False - False", False - False)
PrintResult("False - True", False - True)
PrintResult("False - System.SByte.MaxValue", False - System.SByte.MaxValue)
PrintResult("False - System.Byte.MaxValue", False - System.Byte.MaxValue)
PrintResult("False - -3S", False - -3S)
PrintResult("False - 24US", False - 24US)
PrintResult("False - -5I", False - -5I)
PrintResult("False - 26UI", False - 26UI)
PrintResult("False - -7L", False - -7L)
PrintResult("False - 28UL", False - 28UL)
PrintResult("False - -9D", False - -9D)
PrintResult("False - 10.0F", False - 10.0F)
PrintResult("False - -11.0R", False - -11.0R)
PrintResult("False - ""12""", False - "12")
PrintResult("False - TypeCode.Double", False - TypeCode.Double)
PrintResult("True - False", True - False)
PrintResult("True - True", True - True)
PrintResult("True - System.SByte.MinValue", True - System.SByte.MinValue)
PrintResult("True - System.Byte.MaxValue", True - System.Byte.MaxValue)
PrintResult("True - -3S", True - -3S)
PrintResult("True - 24US", True - 24US)
PrintResult("True - -5I", True - -5I)
PrintResult("True - 26UI", True - 26UI)
PrintResult("True - -7L", True - -7L)
PrintResult("True - 28UL", True - 28UL)
PrintResult("True - -9D", True - -9D)
PrintResult("True - 10.0F", True - 10.0F)
PrintResult("True - -11.0R", True - -11.0R)
PrintResult("True - ""12""", True - "12")
PrintResult("True - TypeCode.Double", True - TypeCode.Double)
PrintResult("System.SByte.MinValue - False", System.SByte.MinValue - False)
PrintResult("System.SByte.MinValue - True", System.SByte.MinValue - True)
PrintResult("System.SByte.MinValue - System.SByte.MinValue", System.SByte.MinValue - System.SByte.MinValue)
PrintResult("System.SByte.MinValue - System.Byte.MaxValue", System.SByte.MinValue - System.Byte.MaxValue)
PrintResult("System.SByte.MinValue - -3S", System.SByte.MinValue - -3S)
PrintResult("System.SByte.MinValue - 24US", System.SByte.MinValue - 24US)
PrintResult("System.SByte.MinValue - -5I", System.SByte.MinValue - -5I)
PrintResult("System.SByte.MinValue - 26UI", System.SByte.MinValue - 26UI)
PrintResult("System.SByte.MinValue - -7L", System.SByte.MinValue - -7L)
PrintResult("System.SByte.MinValue - 28UL", System.SByte.MinValue - 28UL)
PrintResult("System.SByte.MinValue - -9D", System.SByte.MinValue - -9D)
PrintResult("System.SByte.MinValue - 10.0F", System.SByte.MinValue - 10.0F)
PrintResult("System.SByte.MinValue - -11.0R", System.SByte.MinValue - -11.0R)
PrintResult("System.SByte.MinValue - ""12""", System.SByte.MinValue - "12")
PrintResult("System.SByte.MinValue - TypeCode.Double", System.SByte.MinValue - TypeCode.Double)
PrintResult("System.Byte.MaxValue - False", System.Byte.MaxValue - False)
PrintResult("System.Byte.MaxValue - True", System.Byte.MaxValue - True)
PrintResult("System.Byte.MaxValue - System.SByte.MinValue", System.Byte.MaxValue - System.SByte.MinValue)
PrintResult("System.Byte.MaxValue - System.Byte.MaxValue", System.Byte.MaxValue - System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue - -3S", System.Byte.MaxValue - -3S)
PrintResult("System.Byte.MaxValue - -5I", System.Byte.MaxValue - -5I)
PrintResult("System.Byte.MaxValue - -7L", System.Byte.MaxValue - -7L)
PrintResult("System.Byte.MaxValue - -9D", System.Byte.MaxValue - -9D)
PrintResult("System.Byte.MaxValue - 10.0F", System.Byte.MaxValue - 10.0F)
PrintResult("System.Byte.MaxValue - -11.0R", System.Byte.MaxValue - -11.0R)
PrintResult("System.Byte.MaxValue - ""12""", System.Byte.MaxValue - "12")
PrintResult("System.Byte.MaxValue - TypeCode.Double", System.Byte.MaxValue - TypeCode.Double)
PrintResult("-3S - False", -3S - False)
PrintResult("-3S - True", -3S - True)
PrintResult("-3S - System.SByte.MinValue", -3S - System.SByte.MinValue)
PrintResult("-3S - System.Byte.MaxValue", -3S - System.Byte.MaxValue)
PrintResult("-3S - -3S", -3S - -3S)
PrintResult("-3S - 24US", -3S - 24US)
PrintResult("-3S - -5I", -3S - -5I)
PrintResult("-3S - 26UI", -3S - 26UI)
PrintResult("-3S - -7L", -3S - -7L)
PrintResult("-3S - 28UL", -3S - 28UL)
PrintResult("-3S - -9D", -3S - -9D)
PrintResult("-3S - 10.0F", -3S - 10.0F)
PrintResult("-3S - -11.0R", -3S - -11.0R)
PrintResult("-3S - ""12""", -3S - "12")
PrintResult("-3S - TypeCode.Double", -3S - TypeCode.Double)
PrintResult("24US - False", 24US - False)
PrintResult("24US - True", 24US - True)
PrintResult("24US - System.SByte.MinValue", 24US - System.SByte.MinValue)
PrintResult("System.UInt16.MaxValue - System.Byte.MaxValue", System.UInt16.MaxValue - System.Byte.MaxValue)
PrintResult("24US - -3S", 24US - -3S)
PrintResult("24US - 24US", 24US - 24US)
PrintResult("24US - -5I", 24US - -5I)
PrintResult("24US - -7L", 24US - -7L)
PrintResult("24US - -9D", 24US - -9D)
PrintResult("24US - 10.0F", 24US - 10.0F)
PrintResult("24US - -11.0R", 24US - -11.0R)
PrintResult("24US - ""12""", 24US - "12")
PrintResult("24US - TypeCode.Double", 24US - TypeCode.Double)
PrintResult("-5I - False", -5I - False)
PrintResult("-5I - True", -5I - True)
PrintResult("-5I - System.SByte.MinValue", -5I - System.SByte.MinValue)
PrintResult("-5I - System.Byte.MaxValue", -5I - System.Byte.MaxValue)
PrintResult("-5I - -3S", -5I - -3S)
PrintResult("-5I - 24US", -5I - 24US)
PrintResult("-5I - -5I", -5I - -5I)
PrintResult("-5I - 26UI", -5I - 26UI)
PrintResult("-5I - -7L", -5I - -7L)
PrintResult("-5I - 28UL", -5I - 28UL)
PrintResult("-5I - -9D", -5I - -9D)
PrintResult("-5I - 10.0F", -5I - 10.0F)
PrintResult("-5I - -11.0R", -5I - -11.0R)
PrintResult("-5I - ""12""", -5I - "12")
PrintResult("-5I - TypeCode.Double", -5I - TypeCode.Double)
PrintResult("26UI - False", 26UI - False)
PrintResult("26UI - True", 26UI - True)
PrintResult("26UI - System.SByte.MinValue", 26UI - System.SByte.MinValue)
PrintResult("System.UInt32.MaxValue - System.Byte.MaxValue", System.UInt32.MaxValue - System.Byte.MaxValue)
PrintResult("26UI - -3S", 26UI - -3S)
PrintResult("26UI - 24US", 26UI - 24US)
PrintResult("26UI - -5I", 26UI - -5I)
PrintResult("26UI - 26UI", 26UI - 26UI)
PrintResult("26UI - -7L", 26UI - -7L)
PrintResult("26UI - -9D", 26UI - -9D)
PrintResult("26UI - 10.0F", 26UI - 10.0F)
PrintResult("26UI - -11.0R", 26UI - -11.0R)
PrintResult("26UI - ""12""", 26UI - "12")
PrintResult("26UI - TypeCode.Double", 26UI - TypeCode.Double)
PrintResult("-7L - False", -7L - False)
PrintResult("-7L - True", -7L - True)
PrintResult("-7L - System.SByte.MinValue", -7L - System.SByte.MinValue)
PrintResult("-7L - System.Byte.MaxValue", -7L - System.Byte.MaxValue)
PrintResult("-7L - -3S", -7L - -3S)
PrintResult("-7L - 24US", -7L - 24US)
PrintResult("-7L - -5I", -7L - -5I)
PrintResult("-7L - 26UI", -7L - 26UI)
PrintResult("-7L - -7L", -7L - -7L)
PrintResult("-7L - 28UL", -7L - 28UL)
PrintResult("-7L - -9D", -7L - -9D)
PrintResult("-7L - 10.0F", -7L - 10.0F)
PrintResult("-7L - -11.0R", -7L - -11.0R)
PrintResult("-7L - ""12""", -7L - "12")
PrintResult("-7L - TypeCode.Double", -7L - TypeCode.Double)
PrintResult("28UL - False", 28UL - False)
PrintResult("28UL - True", 28UL - True)
PrintResult("28UL - System.SByte.MinValue", 28UL - System.SByte.MinValue)
PrintResult("System.UInt64.MaxValue - System.Byte.MaxValue", System.UInt64.MaxValue - System.Byte.MaxValue)
PrintResult("28UL - -3S", 28UL - -3S)
PrintResult("28UL - 24US", 28UL - 24US)
PrintResult("28UL - -5I", 28UL - -5I)
PrintResult("28UL - 26UI", 28UL - 26UI)
PrintResult("28UL - -7L", 28UL - -7L)
PrintResult("28UL - 28UL", 28UL - 28UL)
PrintResult("28UL - -9D", 28UL - -9D)
PrintResult("28UL - 10.0F", 28UL - 10.0F)
PrintResult("28UL - -11.0R", 28UL - -11.0R)
PrintResult("28UL - ""12""", 28UL - "12")
PrintResult("28UL - TypeCode.Double", 28UL - TypeCode.Double)
PrintResult("-9D - False", -9D - False)
PrintResult("-9D - True", -9D - True)
PrintResult("-9D - System.SByte.MinValue", -9D - System.SByte.MinValue)
PrintResult("-9D - System.Byte.MaxValue", -9D - System.Byte.MaxValue)
PrintResult("-9D - -3S", -9D - -3S)
PrintResult("-9D - 24US", -9D - 24US)
PrintResult("-9D - -5I", -9D - -5I)
PrintResult("-9D - 26UI", -9D - 26UI)
PrintResult("-9D - -7L", -9D - -7L)
PrintResult("-9D - 28UL", -9D - 28UL)
PrintResult("-9D - -9D", -9D - -9D)
PrintResult("-9D - 10.0F", -9D - 10.0F)
PrintResult("-9D - -11.0R", -9D - -11.0R)
PrintResult("-9D - ""12""", -9D - "12")
PrintResult("-9D - TypeCode.Double", -9D - TypeCode.Double)
PrintResult("10.0F - False", 10.0F - False)
PrintResult("10.0F - True", 10.0F - True)
PrintResult("10.0F - System.SByte.MinValue", 10.0F - System.SByte.MinValue)
PrintResult("10.0F - System.Byte.MaxValue", 10.0F - System.Byte.MaxValue)
PrintResult("10.0F - -3S", 10.0F - -3S)
PrintResult("10.0F - 24US", 10.0F - 24US)
PrintResult("10.0F - -5I", 10.0F - -5I)
PrintResult("10.0F - 26UI", 10.0F - 26UI)
PrintResult("10.0F - -7L", 10.0F - -7L)
PrintResult("10.0F - 28UL", 10.0F - 28UL)
PrintResult("10.0F - -9D", 10.0F - -9D)
PrintResult("10.0F - 10.0F", 10.0F - 10.0F)
PrintResult("10.0F - -11.0R", 10.0F - -11.0R)
PrintResult("10.0F - ""12""", 10.0F - "12")
PrintResult("10.0F - TypeCode.Double", 10.0F - TypeCode.Double)
PrintResult("-11.0R - False", -11.0R - False)
PrintResult("-11.0R - True", -11.0R - True)
PrintResult("-11.0R - System.SByte.MinValue", -11.0R - System.SByte.MinValue)
PrintResult("-11.0R - System.Byte.MaxValue", -11.0R - System.Byte.MaxValue)
PrintResult("-11.0R - -3S", -11.0R - -3S)
PrintResult("-11.0R - 24US", -11.0R - 24US)
PrintResult("-11.0R - -5I", -11.0R - -5I)
PrintResult("-11.0R - 26UI", -11.0R - 26UI)
PrintResult("-11.0R - -7L", -11.0R - -7L)
PrintResult("-11.0R - 28UL", -11.0R - 28UL)
PrintResult("-11.0R - -9D", -11.0R - -9D)
PrintResult("-11.0R - 10.0F", -11.0R - 10.0F)
PrintResult("-11.0R - -11.0R", -11.0R - -11.0R)
PrintResult("-11.0R - ""12""", -11.0R - "12")
PrintResult("-11.0R - TypeCode.Double", -11.0R - TypeCode.Double)
PrintResult("""12"" - False", "12" - False)
PrintResult("""12"" - True", "12" - True)
PrintResult("""12"" - System.SByte.MinValue", "12" - System.SByte.MinValue)
PrintResult("""12"" - System.Byte.MaxValue", "12" - System.Byte.MaxValue)
PrintResult("""12"" - -3S", "12" - -3S)
PrintResult("""12"" - 24US", "12" - 24US)
PrintResult("""12"" - -5I", "12" - -5I)
PrintResult("""12"" - 26UI", "12" - 26UI)
PrintResult("""12"" - -7L", "12" - -7L)
PrintResult("""12"" - 28UL", "12" - 28UL)
PrintResult("""12"" - -9D", "12" - -9D)
PrintResult("""12"" - 10.0F", "12" - 10.0F)
PrintResult("""12"" - -11.0R", "12" - -11.0R)
PrintResult("""12"" - ""12""", "12" - "12")
PrintResult("""12"" - TypeCode.Double", "12" - TypeCode.Double)
PrintResult("TypeCode.Double - False", TypeCode.Double - False)
PrintResult("TypeCode.Double - True", TypeCode.Double - True)
PrintResult("TypeCode.Double - System.SByte.MinValue", TypeCode.Double - System.SByte.MinValue)
PrintResult("TypeCode.Double - System.Byte.MaxValue", TypeCode.Double - System.Byte.MaxValue)
PrintResult("TypeCode.Double - -3S", TypeCode.Double - -3S)
PrintResult("TypeCode.Double - 24US", TypeCode.Double - 24US)
PrintResult("TypeCode.Double - -5I", TypeCode.Double - -5I)
PrintResult("TypeCode.Double - 26UI", TypeCode.Double - 26UI)
PrintResult("TypeCode.Double - -7L", TypeCode.Double - -7L)
PrintResult("TypeCode.Double - 28UL", TypeCode.Double - 28UL)
PrintResult("TypeCode.Double - -9D", TypeCode.Double - -9D)
PrintResult("TypeCode.Double - 10.0F", TypeCode.Double - 10.0F)
PrintResult("TypeCode.Double - -11.0R", TypeCode.Double - -11.0R)
PrintResult("TypeCode.Double - ""12""", TypeCode.Double - "12")
PrintResult("TypeCode.Double - TypeCode.Double", TypeCode.Double - TypeCode.Double)
PrintResult("False * False", False * False)
PrintResult("False * True", False * True)
PrintResult("False * System.SByte.MinValue", False * System.SByte.MinValue)
PrintResult("False * System.Byte.MaxValue", False * System.Byte.MaxValue)
PrintResult("False * -3S", False * -3S)
PrintResult("False * 24US", False * 24US)
PrintResult("False * -5I", False * -5I)
PrintResult("False * 26UI", False * 26UI)
PrintResult("False * -7L", False * -7L)
PrintResult("False * 28UL", False * 28UL)
PrintResult("False * -9D", False * -9D)
PrintResult("False * 10.0F", False * 10.0F)
PrintResult("False * -11.0R", False * -11.0R)
PrintResult("False * ""12""", False * "12")
PrintResult("False * TypeCode.Double", False * TypeCode.Double)
PrintResult("True * False", True * False)
PrintResult("True * True", True * True)
PrintResult("True * System.SByte.MaxValue", True * System.SByte.MaxValue)
PrintResult("True * System.Byte.MaxValue", True * System.Byte.MaxValue)
PrintResult("True * -3S", True * -3S)
PrintResult("True * 24US", True * 24US)
PrintResult("True * -5I", True * -5I)
PrintResult("True * 26UI", True * 26UI)
PrintResult("True * -7L", True * -7L)
PrintResult("True * 28UL", True * 28UL)
PrintResult("True * -9D", True * -9D)
PrintResult("True * 10.0F", True * 10.0F)
PrintResult("True * -11.0R", True * -11.0R)
PrintResult("True * ""12""", True * "12")
PrintResult("True * TypeCode.Double", True * TypeCode.Double)
PrintResult("System.SByte.MinValue * False", System.SByte.MinValue * False)
PrintResult("System.SByte.MaxValue * True", System.SByte.MaxValue * True)
PrintResult("System.SByte.MinValue * (-(System.SByte.MinValue + System.SByte.MaxValue))", System.SByte.MinValue * (-(System.SByte.MinValue + System.SByte.MaxValue)))
PrintResult("System.SByte.MinValue * System.Byte.MaxValue", System.SByte.MinValue * System.Byte.MaxValue)
PrintResult("System.SByte.MinValue * -3S", System.SByte.MinValue * -3S)
PrintResult("System.SByte.MinValue * 24US", System.SByte.MinValue * 24US)
PrintResult("System.SByte.MinValue * -5I", System.SByte.MinValue * -5I)
PrintResult("System.SByte.MinValue * 26UI", System.SByte.MinValue * 26UI)
PrintResult("System.SByte.MinValue * -7L", System.SByte.MinValue * -7L)
PrintResult("System.SByte.MinValue * 28UL", System.SByte.MinValue * 28UL)
PrintResult("System.SByte.MinValue * -9D", System.SByte.MinValue * -9D)
PrintResult("System.SByte.MinValue * 10.0F", System.SByte.MinValue * 10.0F)
PrintResult("System.SByte.MinValue * -11.0R", System.SByte.MinValue * -11.0R)
PrintResult("System.SByte.MinValue * ""12""", System.SByte.MinValue * "12")
PrintResult("System.SByte.MinValue * TypeCode.Double", System.SByte.MinValue * TypeCode.Double)
PrintResult("System.Byte.MaxValue * False", System.Byte.MaxValue * False)
PrintResult("System.Byte.MaxValue * True", System.Byte.MaxValue * True)
PrintResult("System.Byte.MaxValue * System.SByte.MinValue", System.Byte.MaxValue * System.SByte.MinValue)
PrintResult("System.Byte.MaxValue * -3S", System.Byte.MaxValue * -3S)
PrintResult("System.Byte.MaxValue * 24US", System.Byte.MaxValue * 24US)
PrintResult("System.Byte.MaxValue * -5I", System.Byte.MaxValue * -5I)
PrintResult("System.Byte.MaxValue * 26UI", System.Byte.MaxValue * 26UI)
PrintResult("System.Byte.MaxValue * -7L", System.Byte.MaxValue * -7L)
PrintResult("System.Byte.MaxValue * 28UL", System.Byte.MaxValue * 28UL)
PrintResult("System.Byte.MaxValue * -9D", System.Byte.MaxValue * -9D)
PrintResult("System.Byte.MaxValue * 10.0F", System.Byte.MaxValue * 10.0F)
PrintResult("System.Byte.MaxValue * -11.0R", System.Byte.MaxValue * -11.0R)
PrintResult("System.Byte.MaxValue * ""12""", System.Byte.MaxValue * "12")
PrintResult("System.Byte.MaxValue * TypeCode.Double", System.Byte.MaxValue * TypeCode.Double)
PrintResult("-3S * False", -3S * False)
PrintResult("-3S * True", -3S * True)
PrintResult("-3S * System.SByte.MinValue", -3S * System.SByte.MinValue)
PrintResult("-3S * System.Byte.MaxValue", -3S * System.Byte.MaxValue)
PrintResult("-3S * -3S", -3S * -3S)
PrintResult("-3S * 24US", -3S * 24US)
PrintResult("-3S * -5I", -3S * -5I)
PrintResult("-3S * 26UI", -3S * 26UI)
PrintResult("-3S * -7L", -3S * -7L)
PrintResult("-3S * 28UL", -3S * 28UL)
PrintResult("-3S * -9D", -3S * -9D)
PrintResult("-3S * 10.0F", -3S * 10.0F)
PrintResult("-3S * -11.0R", -3S * -11.0R)
PrintResult("-3S * ""12""", -3S * "12")
PrintResult("-3S * TypeCode.Double", -3S * TypeCode.Double)
PrintResult("24US * False", 24US * False)
PrintResult("24US * True", 24US * True)
PrintResult("24US * System.SByte.MinValue", 24US * System.SByte.MinValue)
PrintResult("24US * System.Byte.MaxValue", 24US * System.Byte.MaxValue)
PrintResult("24US * -3S", 24US * -3S)
PrintResult("24US * 24US", 24US * 24US)
PrintResult("24US * -5I", 24US * -5I)
PrintResult("24US * 26UI", 24US * 26UI)
PrintResult("24US * -7L", 24US * -7L)
PrintResult("24US * 28UL", 24US * 28UL)
PrintResult("24US * -9D", 24US * -9D)
PrintResult("24US * 10.0F", 24US * 10.0F)
PrintResult("24US * -11.0R", 24US * -11.0R)
PrintResult("24US * ""12""", 24US * "12")
PrintResult("24US * TypeCode.Double", 24US * TypeCode.Double)
PrintResult("-5I * False", -5I * False)
PrintResult("-5I * True", -5I * True)
PrintResult("-5I * System.SByte.MinValue", -5I * System.SByte.MinValue)
PrintResult("-5I * System.Byte.MaxValue", -5I * System.Byte.MaxValue)
PrintResult("-5I * -3S", -5I * -3S)
PrintResult("-5I * 24US", -5I * 24US)
PrintResult("-5I * -5I", -5I * -5I)
PrintResult("-5I * 26UI", -5I * 26UI)
PrintResult("-5I * -7L", -5I * -7L)
PrintResult("-5I * 28UL", -5I * 28UL)
PrintResult("-5I * -9D", -5I * -9D)
PrintResult("-5I * 10.0F", -5I * 10.0F)
PrintResult("-5I * -11.0R", -5I * -11.0R)
PrintResult("-5I * ""12""", -5I * "12")
PrintResult("-5I * TypeCode.Double", -5I * TypeCode.Double)
PrintResult("26UI * False", 26UI * False)
PrintResult("26UI * True", 26UI * True)
PrintResult("26UI * System.SByte.MinValue", 26UI * System.SByte.MinValue)
PrintResult("26UI * System.Byte.MaxValue", 26UI * System.Byte.MaxValue)
PrintResult("26UI * -3S", 26UI * -3S)
PrintResult("26UI * 24US", 26UI * 24US)
PrintResult("26UI * -5I", 26UI * -5I)
PrintResult("26UI * 26UI", 26UI * 26UI)
PrintResult("26UI * -7L", 26UI * -7L)
PrintResult("26UI * 28UL", 26UI * 28UL)
PrintResult("26UI * -9D", 26UI * -9D)
PrintResult("26UI * 10.0F", 26UI * 10.0F)
PrintResult("26UI * -11.0R", 26UI * -11.0R)
PrintResult("26UI * ""12""", 26UI * "12")
PrintResult("26UI * TypeCode.Double", 26UI * TypeCode.Double)
PrintResult("-7L * False", -7L * False)
PrintResult("-7L * True", -7L * True)
PrintResult("-7L * System.SByte.MinValue", -7L * System.SByte.MinValue)
PrintResult("-7L * System.Byte.MaxValue", -7L * System.Byte.MaxValue)
PrintResult("-7L * -3S", -7L * -3S)
PrintResult("-7L * 24US", -7L * 24US)
PrintResult("-7L * -5I", -7L * -5I)
PrintResult("-7L * 26UI", -7L * 26UI)
PrintResult("-7L * -7L", -7L * -7L)
PrintResult("-7L * 28UL", -7L * 28UL)
PrintResult("-7L * -9D", -7L * -9D)
PrintResult("-7L * 10.0F", -7L * 10.0F)
PrintResult("-7L * -11.0R", -7L * -11.0R)
PrintResult("-7L * ""12""", -7L * "12")
PrintResult("-7L * TypeCode.Double", -7L * TypeCode.Double)
PrintResult("28UL * False", 28UL * False)
PrintResult("28UL * True", 28UL * True)
PrintResult("28UL * System.SByte.MinValue", 28UL * System.SByte.MinValue)
PrintResult("28UL * System.Byte.MaxValue", 28UL * System.Byte.MaxValue)
PrintResult("28UL * -3S", 28UL * -3S)
PrintResult("28UL * 24US", 28UL * 24US)
PrintResult("28UL * -5I", 28UL * -5I)
PrintResult("28UL * 26UI", 28UL * 26UI)
PrintResult("28UL * -7L", 28UL * -7L)
PrintResult("28UL * 28UL", 28UL * 28UL)
PrintResult("28UL * -9D", 28UL * -9D)
PrintResult("28UL * 10.0F", 28UL * 10.0F)
PrintResult("28UL * -11.0R", 28UL * -11.0R)
PrintResult("28UL * ""12""", 28UL * "12")
PrintResult("28UL * TypeCode.Double", 28UL * TypeCode.Double)
PrintResult("-9D * False", -9D * False)
PrintResult("-9D * True", -9D * True)
PrintResult("-9D * System.SByte.MinValue", -9D * System.SByte.MinValue)
PrintResult("-9D * System.Byte.MaxValue", -9D * System.Byte.MaxValue)
PrintResult("-9D * -3S", -9D * -3S)
PrintResult("-9D * 24US", -9D * 24US)
PrintResult("-9D * -5I", -9D * -5I)
PrintResult("-9D * 26UI", -9D * 26UI)
PrintResult("-9D * -7L", -9D * -7L)
PrintResult("-9D * 28UL", -9D * 28UL)
PrintResult("-9D * -9D", -9D * -9D)
PrintResult("-9D * 10.0F", -9D * 10.0F)
PrintResult("-9D * -11.0R", -9D * -11.0R)
PrintResult("-9D * ""12""", -9D * "12")
PrintResult("-9D * TypeCode.Double", -9D * TypeCode.Double)
PrintResult("10.0F * False", 10.0F * False)
PrintResult("10.0F * True", 10.0F * True)
PrintResult("10.0F * System.SByte.MinValue", 10.0F * System.SByte.MinValue)
PrintResult("10.0F * System.Byte.MaxValue", 10.0F * System.Byte.MaxValue)
PrintResult("10.0F * -3S", 10.0F * -3S)
PrintResult("10.0F * 24US", 10.0F * 24US)
PrintResult("10.0F * -5I", 10.0F * -5I)
PrintResult("10.0F * 26UI", 10.0F * 26UI)
PrintResult("10.0F * -7L", 10.0F * -7L)
PrintResult("10.0F * 28UL", 10.0F * 28UL)
PrintResult("10.0F * -9D", 10.0F * -9D)
PrintResult("10.0F * 10.0F", 10.0F * 10.0F)
PrintResult("10.0F * -11.0R", 10.0F * -11.0R)
PrintResult("10.0F * ""12""", 10.0F * "12")
PrintResult("10.0F * TypeCode.Double", 10.0F * TypeCode.Double)
PrintResult("-11.0R * False", -11.0R * False)
PrintResult("-11.0R * True", -11.0R * True)
PrintResult("-11.0R * System.SByte.MinValue", -11.0R * System.SByte.MinValue)
PrintResult("-11.0R * System.Byte.MaxValue", -11.0R * System.Byte.MaxValue)
PrintResult("-11.0R * -3S", -11.0R * -3S)
PrintResult("-11.0R * 24US", -11.0R * 24US)
PrintResult("-11.0R * -5I", -11.0R * -5I)
PrintResult("-11.0R * 26UI", -11.0R * 26UI)
PrintResult("-11.0R * -7L", -11.0R * -7L)
PrintResult("-11.0R * 28UL", -11.0R * 28UL)
PrintResult("-11.0R * -9D", -11.0R * -9D)
PrintResult("-11.0R * 10.0F", -11.0R * 10.0F)
PrintResult("-11.0R * -11.0R", -11.0R * -11.0R)
PrintResult("-11.0R * ""12""", -11.0R * "12")
PrintResult("-11.0R * TypeCode.Double", -11.0R * TypeCode.Double)
PrintResult("""12"" * False", "12" * False)
PrintResult("""12"" * True", "12" * True)
PrintResult("""12"" * System.SByte.MinValue", "12" * System.SByte.MinValue)
PrintResult("""12"" * System.Byte.MaxValue", "12" * System.Byte.MaxValue)
PrintResult("""12"" * -3S", "12" * -3S)
PrintResult("""12"" * 24US", "12" * 24US)
PrintResult("""12"" * -5I", "12" * -5I)
PrintResult("""12"" * 26UI", "12" * 26UI)
PrintResult("""12"" * -7L", "12" * -7L)
PrintResult("""12"" * 28UL", "12" * 28UL)
PrintResult("""12"" * -9D", "12" * -9D)
PrintResult("""12"" * 10.0F", "12" * 10.0F)
PrintResult("""12"" * -11.0R", "12" * -11.0R)
PrintResult("""12"" * ""12""", "12" * "12")
PrintResult("""12"" * TypeCode.Double", "12" * TypeCode.Double)
PrintResult("TypeCode.Double * False", TypeCode.Double * False)
PrintResult("TypeCode.Double * True", TypeCode.Double * True)
PrintResult("TypeCode.Double * System.SByte.MinValue", TypeCode.Double * System.SByte.MinValue)
PrintResult("TypeCode.Double * System.Byte.MaxValue", TypeCode.Double * System.Byte.MaxValue)
PrintResult("TypeCode.Double * -3S", TypeCode.Double * -3S)
PrintResult("TypeCode.Double * 24US", TypeCode.Double * 24US)
PrintResult("TypeCode.Double * -5I", TypeCode.Double * -5I)
PrintResult("TypeCode.Double * 26UI", TypeCode.Double * 26UI)
PrintResult("TypeCode.Double * -7L", TypeCode.Double * -7L)
PrintResult("TypeCode.Double * 28UL", TypeCode.Double * 28UL)
PrintResult("TypeCode.Double * -9D", TypeCode.Double * -9D)
PrintResult("TypeCode.Double * 10.0F", TypeCode.Double * 10.0F)
PrintResult("TypeCode.Double * -11.0R", TypeCode.Double * -11.0R)
PrintResult("TypeCode.Double * ""12""", TypeCode.Double * "12")
PrintResult("TypeCode.Double * TypeCode.Double", TypeCode.Double * TypeCode.Double)
PrintResult("False / False", False / False)
PrintResult("False / True", False / True)
PrintResult("False / System.SByte.MinValue", False / System.SByte.MinValue)
PrintResult("False / System.Byte.MaxValue", False / System.Byte.MaxValue)
PrintResult("False / -3S", False / -3S)
PrintResult("False / 24US", False / 24US)
PrintResult("False / -5I", False / -5I)
PrintResult("False / 26UI", False / 26UI)
PrintResult("False / -7L", False / -7L)
PrintResult("False / 28UL", False / 28UL)
PrintResult("False / -9D", False / -9D)
PrintResult("False / 10.0F", False / 10.0F)
PrintResult("False / -11.0R", False / -11.0R)
PrintResult("False / ""12""", False / "12")
PrintResult("False / TypeCode.Double", False / TypeCode.Double)
PrintResult("True / False", True / False)
PrintResult("True / True", True / True)
PrintResult("True / System.SByte.MinValue", True / System.SByte.MinValue)
PrintResult("True / System.Byte.MaxValue", True / System.Byte.MaxValue)
PrintResult("True / -3S", True / -3S)
PrintResult("True / 24US", True / 24US)
PrintResult("True / -5I", True / -5I)
PrintResult("True / 26UI", True / 26UI)
PrintResult("True / -7L", True / -7L)
PrintResult("True / 28UL", True / 28UL)
PrintResult("True / -9D", True / -9D)
PrintResult("True / 10.0F", True / 10.0F)
PrintResult("True / -11.0R", True / -11.0R)
PrintResult("True / ""12""", True / "12")
PrintResult("True / TypeCode.Double", True / TypeCode.Double)
PrintResult("System.SByte.MinValue / False", System.SByte.MinValue / False)
PrintResult("System.SByte.MinValue / True", System.SByte.MinValue / True)
PrintResult("System.SByte.MinValue / System.SByte.MinValue", System.SByte.MinValue / System.SByte.MinValue)
PrintResult("System.SByte.MinValue / System.Byte.MaxValue", System.SByte.MinValue / System.Byte.MaxValue)
PrintResult("System.SByte.MinValue / -3S", System.SByte.MinValue / -3S)
PrintResult("System.SByte.MinValue / 24US", System.SByte.MinValue / 24US)
PrintResult("System.SByte.MinValue / -5I", System.SByte.MinValue / -5I)
PrintResult("System.SByte.MinValue / 26UI", System.SByte.MinValue / 26UI)
PrintResult("System.SByte.MinValue / -7L", System.SByte.MinValue / -7L)
PrintResult("System.SByte.MinValue / 28UL", System.SByte.MinValue / 28UL)
PrintResult("System.SByte.MinValue / -9D", System.SByte.MinValue / -9D)
PrintResult("System.SByte.MinValue / 10.0F", System.SByte.MinValue / 10.0F)
PrintResult("System.SByte.MinValue / -11.0R", System.SByte.MinValue / -11.0R)
PrintResult("System.SByte.MinValue / ""12""", System.SByte.MinValue / "12")
PrintResult("System.SByte.MinValue / TypeCode.Double", System.SByte.MinValue / TypeCode.Double)
PrintResult("System.Byte.MaxValue / False", System.Byte.MaxValue / False)
PrintResult("System.Byte.MaxValue / True", System.Byte.MaxValue / True)
PrintResult("System.Byte.MaxValue / System.SByte.MinValue", System.Byte.MaxValue / System.SByte.MinValue)
PrintResult("System.Byte.MaxValue / System.Byte.MaxValue", System.Byte.MaxValue / System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue / -3S", System.Byte.MaxValue / -3S)
PrintResult("System.Byte.MaxValue / 24US", System.Byte.MaxValue / 24US)
PrintResult("System.Byte.MaxValue / -5I", System.Byte.MaxValue / -5I)
PrintResult("System.Byte.MaxValue / 26UI", System.Byte.MaxValue / 26UI)
PrintResult("System.Byte.MaxValue / -7L", System.Byte.MaxValue / -7L)
PrintResult("System.Byte.MaxValue / 28UL", System.Byte.MaxValue / 28UL)
PrintResult("System.Byte.MaxValue / -9D", System.Byte.MaxValue / -9D)
PrintResult("System.Byte.MaxValue / 10.0F", System.Byte.MaxValue / 10.0F)
PrintResult("System.Byte.MaxValue / -11.0R", System.Byte.MaxValue / -11.0R)
PrintResult("System.Byte.MaxValue / ""12""", System.Byte.MaxValue / "12")
PrintResult("System.Byte.MaxValue / TypeCode.Double", System.Byte.MaxValue / TypeCode.Double)
PrintResult("-3S / False", -3S / False)
PrintResult("-3S / True", -3S / True)
PrintResult("-3S / System.SByte.MinValue", -3S / System.SByte.MinValue)
PrintResult("-3S / System.Byte.MaxValue", -3S / System.Byte.MaxValue)
PrintResult("-3S / -3S", -3S / -3S)
PrintResult("-3S / 24US", -3S / 24US)
PrintResult("-3S / -5I", -3S / -5I)
PrintResult("-3S / 26UI", -3S / 26UI)
PrintResult("-3S / -7L", -3S / -7L)
PrintResult("-3S / 28UL", -3S / 28UL)
PrintResult("-3S / -9D", -3S / -9D)
PrintResult("-3S / 10.0F", -3S / 10.0F)
PrintResult("-3S / -11.0R", -3S / -11.0R)
PrintResult("-3S / ""12""", -3S / "12")
PrintResult("-3S / TypeCode.Double", -3S / TypeCode.Double)
PrintResult("24US / False", 24US / False)
PrintResult("24US / True", 24US / True)
PrintResult("24US / System.SByte.MinValue", 24US / System.SByte.MinValue)
PrintResult("24US / System.Byte.MaxValue", 24US / System.Byte.MaxValue)
PrintResult("24US / -3S", 24US / -3S)
PrintResult("24US / 24US", 24US / 24US)
PrintResult("24US / -5I", 24US / -5I)
PrintResult("24US / 26UI", 24US / 26UI)
PrintResult("24US / -7L", 24US / -7L)
PrintResult("24US / 28UL", 24US / 28UL)
PrintResult("24US / -9D", 24US / -9D)
PrintResult("24US / 10.0F", 24US / 10.0F)
PrintResult("24US / -11.0R", 24US / -11.0R)
PrintResult("24US / ""12""", 24US / "12")
PrintResult("24US / TypeCode.Double", 24US / TypeCode.Double)
PrintResult("-5I / False", -5I / False)
PrintResult("-5I / True", -5I / True)
PrintResult("-5I / System.SByte.MinValue", -5I / System.SByte.MinValue)
PrintResult("-5I / System.Byte.MaxValue", -5I / System.Byte.MaxValue)
PrintResult("-5I / -3S", -5I / -3S)
PrintResult("-5I / 24US", -5I / 24US)
PrintResult("-5I / -5I", -5I / -5I)
PrintResult("-5I / 26UI", -5I / 26UI)
PrintResult("-5I / -7L", -5I / -7L)
PrintResult("-5I / 28UL", -5I / 28UL)
PrintResult("-5I / -9D", -5I / -9D)
PrintResult("-5I / 10.0F", -5I / 10.0F)
PrintResult("-5I / -11.0R", -5I / -11.0R)
PrintResult("-5I / ""12""", -5I / "12")
PrintResult("-5I / TypeCode.Double", -5I / TypeCode.Double)
PrintResult("26UI / False", 26UI / False)
PrintResult("26UI / True", 26UI / True)
PrintResult("26UI / System.SByte.MinValue", 26UI / System.SByte.MinValue)
PrintResult("26UI / System.Byte.MaxValue", 26UI / System.Byte.MaxValue)
PrintResult("26UI / -3S", 26UI / -3S)
PrintResult("26UI / 24US", 26UI / 24US)
PrintResult("26UI / -5I", 26UI / -5I)
PrintResult("26UI / 26UI", 26UI / 26UI)
PrintResult("26UI / -7L", 26UI / -7L)
PrintResult("26UI / 28UL", 26UI / 28UL)
PrintResult("26UI / -9D", 26UI / -9D)
PrintResult("26UI / 10.0F", 26UI / 10.0F)
PrintResult("26UI / -11.0R", 26UI / -11.0R)
PrintResult("26UI / ""12""", 26UI / "12")
PrintResult("26UI / TypeCode.Double", 26UI / TypeCode.Double)
PrintResult("-7L / False", -7L / False)
PrintResult("-7L / True", -7L / True)
PrintResult("-7L / System.SByte.MinValue", -7L / System.SByte.MinValue)
PrintResult("-7L / System.Byte.MaxValue", -7L / System.Byte.MaxValue)
PrintResult("-7L / -3S", -7L / -3S)
PrintResult("-7L / 24US", -7L / 24US)
PrintResult("-7L / -5I", -7L / -5I)
PrintResult("-7L / 26UI", -7L / 26UI)
PrintResult("-7L / -7L", -7L / -7L)
PrintResult("-7L / 28UL", -7L / 28UL)
PrintResult("-7L / -9D", -7L / -9D)
PrintResult("-7L / 10.0F", -7L / 10.0F)
PrintResult("-7L / -11.0R", -7L / -11.0R)
PrintResult("-7L / ""12""", -7L / "12")
PrintResult("-7L / TypeCode.Double", -7L / TypeCode.Double)
PrintResult("28UL / False", 28UL / False)
PrintResult("28UL / True", 28UL / True)
PrintResult("28UL / System.SByte.MinValue", 28UL / System.SByte.MinValue)
PrintResult("28UL / System.Byte.MaxValue", 28UL / System.Byte.MaxValue)
PrintResult("28UL / -3S", 28UL / -3S)
PrintResult("28UL / 24US", 28UL / 24US)
PrintResult("28UL / -5I", 28UL / -5I)
PrintResult("28UL / 26UI", 28UL / 26UI)
PrintResult("28UL / -7L", 28UL / -7L)
PrintResult("28UL / 28UL", 28UL / 28UL)
PrintResult("28UL / -9D", 28UL / -9D)
PrintResult("28UL / 10.0F", 28UL / 10.0F)
PrintResult("28UL / -11.0R", 28UL / -11.0R)
PrintResult("28UL / ""12""", 28UL / "12")
PrintResult("28UL / TypeCode.Double", 28UL / TypeCode.Double)
PrintResult("-9D / True", -9D / True)
PrintResult("-9D / System.SByte.MinValue", -9D / System.SByte.MinValue)
PrintResult("-9D / System.Byte.MaxValue", -9D / System.Byte.MaxValue)
PrintResult("-9D / -3S", -9D / -3S)
PrintResult("-9D / 24US", -9D / 24US)
PrintResult("-9D / -5I", -9D / -5I)
PrintResult("-9D / 26UI", -9D / 26UI)
PrintResult("-9D / -7L", -9D / -7L)
PrintResult("-9D / 28UL", -9D / 28UL)
PrintResult("-9D / -9D", -9D / -9D)
PrintResult("-9D / 10.0F", -9D / 10.0F)
PrintResult("-9D / -11.0R", -9D / -11.0R)
PrintResult("-9D / ""12""", -9D / "12")
PrintResult("-9D / TypeCode.Double", -9D / TypeCode.Double)
PrintResult("10.0F / False", 10.0F / False)
PrintResult("10.0F / True", 10.0F / True)
PrintResult("10.0F / System.SByte.MinValue", 10.0F / System.SByte.MinValue)
PrintResult("10.0F / System.Byte.MaxValue", 10.0F / System.Byte.MaxValue)
PrintResult("10.0F / -3S", 10.0F / -3S)
PrintResult("10.0F / 24US", 10.0F / 24US)
PrintResult("10.0F / -5I", 10.0F / -5I)
PrintResult("10.0F / 26UI", 10.0F / 26UI)
PrintResult("10.0F / -7L", 10.0F / -7L)
PrintResult("10.0F / 28UL", 10.0F / 28UL)
PrintResult("10.0F / -9D", 10.0F / -9D)
PrintResult("10.0F / 10.0F", 10.0F / 10.0F)
PrintResult("10.0F / -11.0R", 10.0F / -11.0R)
PrintResult("10.0F / ""12""", 10.0F / "12")
PrintResult("10.0F / TypeCode.Double", 10.0F / TypeCode.Double)
PrintResult("-11.0R / False", -11.0R / False)
PrintResult("-11.0R / True", -11.0R / True)
PrintResult("-11.0R / System.SByte.MinValue", -11.0R / System.SByte.MinValue)
PrintResult("-11.0R / System.Byte.MaxValue", -11.0R / System.Byte.MaxValue)
PrintResult("-11.0R / -3S", -11.0R / -3S)
PrintResult("-11.0R / 24US", -11.0R / 24US)
PrintResult("-11.0R / -5I", -11.0R / -5I)
PrintResult("-11.0R / 26UI", -11.0R / 26UI)
PrintResult("-11.0R / -7L", -11.0R / -7L)
PrintResult("-11.0R / 28UL", -11.0R / 28UL)
PrintResult("-11.0R / -9D", -11.0R / -9D)
PrintResult("-11.0R / 10.0F", -11.0R / 10.0F)
PrintResult("-11.0R / -11.0R", -11.0R / -11.0R)
PrintResult("-11.0R / ""12""", -11.0R / "12")
PrintResult("-11.0R / TypeCode.Double", -11.0R / TypeCode.Double)
PrintResult("""12"" / False", "12" / False)
PrintResult("""12"" / True", "12" / True)
PrintResult("""12"" / System.SByte.MinValue", "12" / System.SByte.MinValue)
PrintResult("""12"" / System.Byte.MaxValue", "12" / System.Byte.MaxValue)
PrintResult("""12"" / -3S", "12" / -3S)
PrintResult("""12"" / 24US", "12" / 24US)
PrintResult("""12"" / -5I", "12" / -5I)
PrintResult("""12"" / 26UI", "12" / 26UI)
PrintResult("""12"" / -7L", "12" / -7L)
PrintResult("""12"" / 28UL", "12" / 28UL)
PrintResult("""12"" / -9D", "12" / -9D)
PrintResult("""12"" / 10.0F", "12" / 10.0F)
PrintResult("""12"" / -11.0R", "12" / -11.0R)
PrintResult("""12"" / ""12""", "12" / "12")
PrintResult("""12"" / TypeCode.Double", "12" / TypeCode.Double)
PrintResult("TypeCode.Double / False", TypeCode.Double / False)
PrintResult("TypeCode.Double / True", TypeCode.Double / True)
PrintResult("TypeCode.Double / System.SByte.MinValue", TypeCode.Double / System.SByte.MinValue)
PrintResult("TypeCode.Double / System.Byte.MaxValue", TypeCode.Double / System.Byte.MaxValue)
PrintResult("TypeCode.Double / -3S", TypeCode.Double / -3S)
PrintResult("TypeCode.Double / 24US", TypeCode.Double / 24US)
PrintResult("TypeCode.Double / -5I", TypeCode.Double / -5I)
PrintResult("TypeCode.Double / 26UI", TypeCode.Double / 26UI)
PrintResult("TypeCode.Double / -7L", TypeCode.Double / -7L)
PrintResult("TypeCode.Double / 28UL", TypeCode.Double / 28UL)
PrintResult("TypeCode.Double / -9D", TypeCode.Double / -9D)
PrintResult("TypeCode.Double / 10.0F", TypeCode.Double / 10.0F)
PrintResult("TypeCode.Double / -11.0R", TypeCode.Double / -11.0R)
PrintResult("TypeCode.Double / ""12""", TypeCode.Double / "12")
PrintResult("TypeCode.Double / TypeCode.Double", TypeCode.Double / TypeCode.Double)
PrintResult("False \ True", False \ True)
PrintResult("False \ System.SByte.MinValue", False \ System.SByte.MinValue)
PrintResult("False \ System.Byte.MaxValue", False \ System.Byte.MaxValue)
PrintResult("False \ -3S", False \ -3S)
PrintResult("False \ 24US", False \ 24US)
PrintResult("False \ -5I", False \ -5I)
PrintResult("False \ 26UI", False \ 26UI)
PrintResult("False \ -7L", False \ -7L)
PrintResult("False \ 28UL", False \ 28UL)
PrintResult("False \ -9D", False \ -9D)
PrintResult("False \ 10.0F", False \ 10.0F)
PrintResult("False \ -11.0R", False \ -11.0R)
PrintResult("False \ ""12""", False \ "12")
PrintResult("False \ TypeCode.Double", False \ TypeCode.Double)
PrintResult("True \ True", True \ True)
PrintResult("True \ System.SByte.MinValue", True \ System.SByte.MinValue)
PrintResult("True \ System.Byte.MaxValue", True \ System.Byte.MaxValue)
PrintResult("True \ -3S", True \ -3S)
PrintResult("True \ 24US", True \ 24US)
PrintResult("True \ -5I", True \ -5I)
PrintResult("True \ 26UI", True \ 26UI)
PrintResult("True \ -7L", True \ -7L)
PrintResult("True \ 28UL", True \ 28UL)
PrintResult("True \ -9D", True \ -9D)
PrintResult("True \ 10.0F", True \ 10.0F)
PrintResult("True \ -11.0R", True \ -11.0R)
PrintResult("True \ ""12""", True \ "12")
PrintResult("True \ TypeCode.Double", True \ TypeCode.Double)
PrintResult("System.SByte.MaxValue \ True", System.SByte.MaxValue \ True)
PrintResult("System.SByte.MinValue \ System.SByte.MinValue", System.SByte.MinValue \ System.SByte.MinValue)
PrintResult("System.SByte.MinValue \ System.Byte.MaxValue", System.SByte.MinValue \ System.Byte.MaxValue)
PrintResult("System.SByte.MinValue \ -3S", System.SByte.MinValue \ -3S)
PrintResult("System.SByte.MinValue \ 24US", System.SByte.MinValue \ 24US)
PrintResult("System.SByte.MinValue \ -5I", System.SByte.MinValue \ -5I)
PrintResult("System.SByte.MinValue \ 26UI", System.SByte.MinValue \ 26UI)
PrintResult("System.SByte.MinValue \ -7L", System.SByte.MinValue \ -7L)
PrintResult("System.SByte.MinValue \ 28UL", System.SByte.MinValue \ 28UL)
PrintResult("System.SByte.MinValue \ -9D", System.SByte.MinValue \ -9D)
PrintResult("System.SByte.MinValue \ 10.0F", System.SByte.MinValue \ 10.0F)
PrintResult("System.SByte.MinValue \ -11.0R", System.SByte.MinValue \ -11.0R)
PrintResult("System.SByte.MinValue \ ""12""", System.SByte.MinValue \ "12")
PrintResult("System.SByte.MinValue \ TypeCode.Double", System.SByte.MinValue \ TypeCode.Double)
PrintResult("System.Byte.MaxValue \ True", System.Byte.MaxValue \ True)
PrintResult("System.Byte.MaxValue \ System.SByte.MinValue", System.Byte.MaxValue \ System.SByte.MinValue)
PrintResult("System.Byte.MaxValue \ System.Byte.MaxValue", System.Byte.MaxValue \ System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue \ -3S", System.Byte.MaxValue \ -3S)
PrintResult("System.Byte.MaxValue \ 24US", System.Byte.MaxValue \ 24US)
PrintResult("System.Byte.MaxValue \ -5I", System.Byte.MaxValue \ -5I)
PrintResult("System.Byte.MaxValue \ 26UI", System.Byte.MaxValue \ 26UI)
PrintResult("System.Byte.MaxValue \ -7L", System.Byte.MaxValue \ -7L)
PrintResult("System.Byte.MaxValue \ 28UL", System.Byte.MaxValue \ 28UL)
PrintResult("System.Byte.MaxValue \ -9D", System.Byte.MaxValue \ -9D)
PrintResult("System.Byte.MaxValue \ 10.0F", System.Byte.MaxValue \ 10.0F)
PrintResult("System.Byte.MaxValue \ -11.0R", System.Byte.MaxValue \ -11.0R)
PrintResult("System.Byte.MaxValue \ ""12""", System.Byte.MaxValue \ "12")
PrintResult("System.Byte.MaxValue \ TypeCode.Double", System.Byte.MaxValue \ TypeCode.Double)
PrintResult("-3S \ True", -3S \ True)
PrintResult("-3S \ System.SByte.MinValue", -3S \ System.SByte.MinValue)
PrintResult("-3S \ System.Byte.MaxValue", -3S \ System.Byte.MaxValue)
PrintResult("-3S \ -3S", -3S \ -3S)
PrintResult("-3S \ 24US", -3S \ 24US)
PrintResult("-3S \ -5I", -3S \ -5I)
PrintResult("-3S \ 26UI", -3S \ 26UI)
PrintResult("-3S \ -7L", -3S \ -7L)
PrintResult("-3S \ 28UL", -3S \ 28UL)
PrintResult("-3S \ -9D", -3S \ -9D)
PrintResult("-3S \ 10.0F", -3S \ 10.0F)
PrintResult("-3S \ -11.0R", -3S \ -11.0R)
PrintResult("-3S \ ""12""", -3S \ "12")
PrintResult("-3S \ TypeCode.Double", -3S \ TypeCode.Double)
PrintResult("24US \ True", 24US \ True)
PrintResult("24US \ System.SByte.MinValue", 24US \ System.SByte.MinValue)
PrintResult("24US \ System.Byte.MaxValue", 24US \ System.Byte.MaxValue)
PrintResult("24US \ -3S", 24US \ -3S)
PrintResult("24US \ 24US", 24US \ 24US)
PrintResult("24US \ -5I", 24US \ -5I)
PrintResult("24US \ 26UI", 24US \ 26UI)
PrintResult("24US \ -7L", 24US \ -7L)
PrintResult("24US \ 28UL", 24US \ 28UL)
PrintResult("24US \ -9D", 24US \ -9D)
PrintResult("24US \ 10.0F", 24US \ 10.0F)
PrintResult("24US \ -11.0R", 24US \ -11.0R)
PrintResult("24US \ ""12""", 24US \ "12")
PrintResult("24US \ TypeCode.Double", 24US \ TypeCode.Double)
PrintResult("-5I \ True", -5I \ True)
PrintResult("-5I \ System.SByte.MinValue", -5I \ System.SByte.MinValue)
PrintResult("-5I \ System.Byte.MaxValue", -5I \ System.Byte.MaxValue)
PrintResult("-5I \ -3S", -5I \ -3S)
PrintResult("-5I \ 24US", -5I \ 24US)
PrintResult("-5I \ -5I", -5I \ -5I)
PrintResult("-5I \ 26UI", -5I \ 26UI)
PrintResult("-5I \ -7L", -5I \ -7L)
PrintResult("-5I \ 28UL", -5I \ 28UL)
PrintResult("-5I \ -9D", -5I \ -9D)
PrintResult("-5I \ 10.0F", -5I \ 10.0F)
PrintResult("-5I \ -11.0R", -5I \ -11.0R)
PrintResult("-5I \ ""12""", -5I \ "12")
PrintResult("-5I \ TypeCode.Double", -5I \ TypeCode.Double)
PrintResult("26UI \ True", 26UI \ True)
PrintResult("26UI \ System.SByte.MinValue", 26UI \ System.SByte.MinValue)
PrintResult("26UI \ System.Byte.MaxValue", 26UI \ System.Byte.MaxValue)
PrintResult("26UI \ -3S", 26UI \ -3S)
PrintResult("26UI \ 24US", 26UI \ 24US)
PrintResult("26UI \ -5I", 26UI \ -5I)
PrintResult("26UI \ 26UI", 26UI \ 26UI)
PrintResult("26UI \ -7L", 26UI \ -7L)
PrintResult("26UI \ 28UL", 26UI \ 28UL)
PrintResult("26UI \ -9D", 26UI \ -9D)
PrintResult("26UI \ 10.0F", 26UI \ 10.0F)
PrintResult("26UI \ -11.0R", 26UI \ -11.0R)
PrintResult("26UI \ ""12""", 26UI \ "12")
PrintResult("26UI \ TypeCode.Double", 26UI \ TypeCode.Double)
PrintResult("-7L \ True", -7L \ True)
PrintResult("-7L \ System.SByte.MinValue", -7L \ System.SByte.MinValue)
PrintResult("-7L \ System.Byte.MaxValue", -7L \ System.Byte.MaxValue)
PrintResult("-7L \ -3S", -7L \ -3S)
PrintResult("-7L \ 24US", -7L \ 24US)
PrintResult("-7L \ -5I", -7L \ -5I)
PrintResult("-7L \ 26UI", -7L \ 26UI)
PrintResult("-7L \ -7L", -7L \ -7L)
PrintResult("-7L \ 28UL", -7L \ 28UL)
PrintResult("-7L \ -9D", -7L \ -9D)
PrintResult("-7L \ 10.0F", -7L \ 10.0F)
PrintResult("-7L \ -11.0R", -7L \ -11.0R)
PrintResult("-7L \ ""12""", -7L \ "12")
PrintResult("-7L \ TypeCode.Double", -7L \ TypeCode.Double)
PrintResult("28UL \ True", 28UL \ True)
PrintResult("28UL \ System.SByte.MinValue", 28UL \ System.SByte.MinValue)
PrintResult("28UL \ System.Byte.MaxValue", 28UL \ System.Byte.MaxValue)
PrintResult("28UL \ -3S", 28UL \ -3S)
PrintResult("28UL \ 24US", 28UL \ 24US)
PrintResult("28UL \ -5I", 28UL \ -5I)
PrintResult("28UL \ 26UI", 28UL \ 26UI)
PrintResult("28UL \ -7L", 28UL \ -7L)
PrintResult("28UL \ 28UL", 28UL \ 28UL)
PrintResult("28UL \ -9D", 28UL \ -9D)
PrintResult("28UL \ 10.0F", 28UL \ 10.0F)
PrintResult("28UL \ -11.0R", 28UL \ -11.0R)
PrintResult("28UL \ ""12""", 28UL \ "12")
PrintResult("28UL \ TypeCode.Double", 28UL \ TypeCode.Double)
PrintResult("-9D \ True", -9D \ True)
PrintResult("-9D \ System.SByte.MinValue", -9D \ System.SByte.MinValue)
PrintResult("-9D \ System.Byte.MaxValue", -9D \ System.Byte.MaxValue)
PrintResult("-9D \ -3S", -9D \ -3S)
PrintResult("-9D \ 24US", -9D \ 24US)
PrintResult("-9D \ -5I", -9D \ -5I)
PrintResult("-9D \ 26UI", -9D \ 26UI)
PrintResult("-9D \ -7L", -9D \ -7L)
PrintResult("-9D \ 28UL", -9D \ 28UL)
PrintResult("-9D \ -9D", -9D \ -9D)
PrintResult("-9D \ 10.0F", -9D \ 10.0F)
PrintResult("-9D \ -11.0R", -9D \ -11.0R)
PrintResult("-9D \ ""12""", -9D \ "12")
PrintResult("-9D \ TypeCode.Double", -9D \ TypeCode.Double)
PrintResult("10.0F \ True", 10.0F \ True)
PrintResult("10.0F \ System.SByte.MinValue", 10.0F \ System.SByte.MinValue)
PrintResult("10.0F \ System.Byte.MaxValue", 10.0F \ System.Byte.MaxValue)
PrintResult("10.0F \ -3S", 10.0F \ -3S)
PrintResult("10.0F \ 24US", 10.0F \ 24US)
PrintResult("10.0F \ -5I", 10.0F \ -5I)
PrintResult("10.0F \ 26UI", 10.0F \ 26UI)
PrintResult("10.0F \ -7L", 10.0F \ -7L)
PrintResult("10.0F \ 28UL", 10.0F \ 28UL)
PrintResult("10.0F \ -9D", 10.0F \ -9D)
PrintResult("10.0F \ 10.0F", 10.0F \ 10.0F)
PrintResult("10.0F \ -11.0R", 10.0F \ -11.0R)
PrintResult("10.0F \ ""12""", 10.0F \ "12")
PrintResult("10.0F \ TypeCode.Double", 10.0F \ TypeCode.Double)
PrintResult("-11.0R \ True", -11.0R \ True)
PrintResult("-11.0R \ System.SByte.MinValue", -11.0R \ System.SByte.MinValue)
PrintResult("-11.0R \ System.Byte.MaxValue", -11.0R \ System.Byte.MaxValue)
PrintResult("-11.0R \ -3S", -11.0R \ -3S)
PrintResult("-11.0R \ 24US", -11.0R \ 24US)
PrintResult("-11.0R \ -5I", -11.0R \ -5I)
PrintResult("-11.0R \ 26UI", -11.0R \ 26UI)
PrintResult("-11.0R \ -7L", -11.0R \ -7L)
PrintResult("-11.0R \ 28UL", -11.0R \ 28UL)
PrintResult("-11.0R \ -9D", -11.0R \ -9D)
PrintResult("-11.0R \ 10.0F", -11.0R \ 10.0F)
PrintResult("-11.0R \ -11.0R", -11.0R \ -11.0R)
PrintResult("-11.0R \ ""12""", -11.0R \ "12")
PrintResult("-11.0R \ TypeCode.Double", -11.0R \ TypeCode.Double)
PrintResult("""12"" \ True", "12" \ True)
PrintResult("""12"" \ System.SByte.MinValue", "12" \ System.SByte.MinValue)
PrintResult("""12"" \ System.Byte.MaxValue", "12" \ System.Byte.MaxValue)
PrintResult("""12"" \ -3S", "12" \ -3S)
PrintResult("""12"" \ 24US", "12" \ 24US)
PrintResult("""12"" \ -5I", "12" \ -5I)
PrintResult("""12"" \ 26UI", "12" \ 26UI)
PrintResult("""12"" \ -7L", "12" \ -7L)
PrintResult("""12"" \ 28UL", "12" \ 28UL)
PrintResult("""12"" \ -9D", "12" \ -9D)
PrintResult("""12"" \ 10.0F", "12" \ 10.0F)
PrintResult("""12"" \ -11.0R", "12" \ -11.0R)
PrintResult("""12"" \ ""12""", "12" \ "12")
PrintResult("""12"" \ TypeCode.Double", "12" \ TypeCode.Double)
PrintResult("TypeCode.Double \ True", TypeCode.Double \ True)
PrintResult("TypeCode.Double \ System.SByte.MinValue", TypeCode.Double \ System.SByte.MinValue)
PrintResult("TypeCode.Double \ System.Byte.MaxValue", TypeCode.Double \ System.Byte.MaxValue)
PrintResult("TypeCode.Double \ -3S", TypeCode.Double \ -3S)
PrintResult("TypeCode.Double \ 24US", TypeCode.Double \ 24US)
PrintResult("TypeCode.Double \ -5I", TypeCode.Double \ -5I)
PrintResult("TypeCode.Double \ 26UI", TypeCode.Double \ 26UI)
PrintResult("TypeCode.Double \ -7L", TypeCode.Double \ -7L)
PrintResult("TypeCode.Double \ 28UL", TypeCode.Double \ 28UL)
PrintResult("TypeCode.Double \ -9D", TypeCode.Double \ -9D)
PrintResult("TypeCode.Double \ 10.0F", TypeCode.Double \ 10.0F)
PrintResult("TypeCode.Double \ -11.0R", TypeCode.Double \ -11.0R)
PrintResult("TypeCode.Double \ ""12""", TypeCode.Double \ "12")
PrintResult("TypeCode.Double \ TypeCode.Double", TypeCode.Double \ TypeCode.Double)
PrintResult("False Mod True", False Mod True)
PrintResult("False Mod System.SByte.MinValue", False Mod System.SByte.MinValue)
PrintResult("False Mod System.Byte.MaxValue", False Mod System.Byte.MaxValue)
PrintResult("False Mod -3S", False Mod -3S)
PrintResult("False Mod 24US", False Mod 24US)
PrintResult("False Mod -5I", False Mod -5I)
PrintResult("False Mod 26UI", False Mod 26UI)
PrintResult("False Mod -7L", False Mod -7L)
PrintResult("False Mod 28UL", False Mod 28UL)
PrintResult("False Mod -9D", False Mod -9D)
PrintResult("False Mod 10.0F", False Mod 10.0F)
PrintResult("False Mod -11.0R", False Mod -11.0R)
PrintResult("False Mod ""12""", False Mod "12")
PrintResult("False Mod TypeCode.Double", False Mod TypeCode.Double)
PrintResult("True Mod True", True Mod True)
PrintResult("True Mod System.SByte.MinValue", True Mod System.SByte.MinValue)
PrintResult("True Mod System.Byte.MaxValue", True Mod System.Byte.MaxValue)
PrintResult("True Mod -3S", True Mod -3S)
PrintResult("True Mod 24US", True Mod 24US)
PrintResult("True Mod -5I", True Mod -5I)
PrintResult("True Mod 26UI", True Mod 26UI)
PrintResult("True Mod -7L", True Mod -7L)
PrintResult("True Mod 28UL", True Mod 28UL)
PrintResult("True Mod -9D", True Mod -9D)
PrintResult("True Mod 10.0F", True Mod 10.0F)
PrintResult("True Mod -11.0R", True Mod -11.0R)
PrintResult("True Mod ""12""", True Mod "12")
PrintResult("True Mod TypeCode.Double", True Mod TypeCode.Double)
PrintResult("System.SByte.MinValue Mod True", System.SByte.MinValue Mod True)
PrintResult("System.SByte.MinValue Mod System.SByte.MinValue", System.SByte.MinValue Mod System.SByte.MinValue)
PrintResult("System.SByte.MinValue Mod System.Byte.MaxValue", System.SByte.MinValue Mod System.Byte.MaxValue)
PrintResult("System.SByte.MinValue Mod -3S", System.SByte.MinValue Mod -3S)
PrintResult("System.SByte.MinValue Mod 24US", System.SByte.MinValue Mod 24US)
PrintResult("System.SByte.MinValue Mod -5I", System.SByte.MinValue Mod -5I)
PrintResult("System.SByte.MinValue Mod 26UI", System.SByte.MinValue Mod 26UI)
PrintResult("System.SByte.MinValue Mod -7L", System.SByte.MinValue Mod -7L)
PrintResult("System.SByte.MinValue Mod 28UL", System.SByte.MinValue Mod 28UL)
PrintResult("System.SByte.MinValue Mod -9D", System.SByte.MinValue Mod -9D)
PrintResult("System.SByte.MinValue Mod 10.0F", System.SByte.MinValue Mod 10.0F)
PrintResult("System.SByte.MinValue Mod -11.0R", System.SByte.MinValue Mod -11.0R)
PrintResult("System.SByte.MinValue Mod ""12""", System.SByte.MinValue Mod "12")
PrintResult("System.SByte.MinValue Mod TypeCode.Double", System.SByte.MinValue Mod TypeCode.Double)
PrintResult("System.Byte.MaxValue Mod True", System.Byte.MaxValue Mod True)
PrintResult("System.Byte.MaxValue Mod System.SByte.MinValue", System.Byte.MaxValue Mod System.SByte.MinValue)
PrintResult("System.Byte.MaxValue Mod System.Byte.MaxValue", System.Byte.MaxValue Mod System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue Mod -3S", System.Byte.MaxValue Mod -3S)
PrintResult("System.Byte.MaxValue Mod 24US", System.Byte.MaxValue Mod 24US)
PrintResult("System.Byte.MaxValue Mod -5I", System.Byte.MaxValue Mod -5I)
PrintResult("System.Byte.MaxValue Mod 26UI", System.Byte.MaxValue Mod 26UI)
PrintResult("System.Byte.MaxValue Mod -7L", System.Byte.MaxValue Mod -7L)
PrintResult("System.Byte.MaxValue Mod 28UL", System.Byte.MaxValue Mod 28UL)
PrintResult("System.Byte.MaxValue Mod -9D", System.Byte.MaxValue Mod -9D)
PrintResult("System.Byte.MaxValue Mod 10.0F", System.Byte.MaxValue Mod 10.0F)
PrintResult("System.Byte.MaxValue Mod -11.0R", System.Byte.MaxValue Mod -11.0R)
PrintResult("System.Byte.MaxValue Mod ""12""", System.Byte.MaxValue Mod "12")
PrintResult("System.Byte.MaxValue Mod TypeCode.Double", System.Byte.MaxValue Mod TypeCode.Double)
PrintResult("-3S Mod True", -3S Mod True)
PrintResult("-3S Mod System.SByte.MinValue", -3S Mod System.SByte.MinValue)
PrintResult("-3S Mod System.Byte.MaxValue", -3S Mod System.Byte.MaxValue)
PrintResult("-3S Mod -3S", -3S Mod -3S)
PrintResult("-3S Mod 24US", -3S Mod 24US)
PrintResult("-3S Mod -5I", -3S Mod -5I)
PrintResult("-3S Mod 26UI", -3S Mod 26UI)
PrintResult("-3S Mod -7L", -3S Mod -7L)
PrintResult("-3S Mod 28UL", -3S Mod 28UL)
PrintResult("-3S Mod -9D", -3S Mod -9D)
PrintResult("-3S Mod 10.0F", -3S Mod 10.0F)
PrintResult("-3S Mod -11.0R", -3S Mod -11.0R)
PrintResult("-3S Mod ""12""", -3S Mod "12")
PrintResult("-3S Mod TypeCode.Double", -3S Mod TypeCode.Double)
PrintResult("24US Mod True", 24US Mod True)
PrintResult("24US Mod System.SByte.MinValue", 24US Mod System.SByte.MinValue)
PrintResult("24US Mod System.Byte.MaxValue", 24US Mod System.Byte.MaxValue)
PrintResult("24US Mod -3S", 24US Mod -3S)
PrintResult("24US Mod 24US", 24US Mod 24US)
PrintResult("24US Mod -5I", 24US Mod -5I)
PrintResult("24US Mod 26UI", 24US Mod 26UI)
PrintResult("24US Mod -7L", 24US Mod -7L)
PrintResult("24US Mod 28UL", 24US Mod 28UL)
PrintResult("24US Mod -9D", 24US Mod -9D)
PrintResult("24US Mod 10.0F", 24US Mod 10.0F)
PrintResult("24US Mod -11.0R", 24US Mod -11.0R)
PrintResult("24US Mod ""12""", 24US Mod "12")
PrintResult("24US Mod TypeCode.Double", 24US Mod TypeCode.Double)
PrintResult("-5I Mod True", -5I Mod True)
PrintResult("-5I Mod System.SByte.MinValue", -5I Mod System.SByte.MinValue)
PrintResult("-5I Mod System.Byte.MaxValue", -5I Mod System.Byte.MaxValue)
PrintResult("-5I Mod -3S", -5I Mod -3S)
PrintResult("-5I Mod 24US", -5I Mod 24US)
PrintResult("-5I Mod -5I", -5I Mod -5I)
PrintResult("-5I Mod 26UI", -5I Mod 26UI)
PrintResult("-5I Mod -7L", -5I Mod -7L)
PrintResult("-5I Mod 28UL", -5I Mod 28UL)
PrintResult("-5I Mod -9D", -5I Mod -9D)
PrintResult("-5I Mod 10.0F", -5I Mod 10.0F)
PrintResult("-5I Mod -11.0R", -5I Mod -11.0R)
PrintResult("-5I Mod ""12""", -5I Mod "12")
PrintResult("-5I Mod TypeCode.Double", -5I Mod TypeCode.Double)
PrintResult("26UI Mod True", 26UI Mod True)
PrintResult("26UI Mod System.SByte.MinValue", 26UI Mod System.SByte.MinValue)
PrintResult("26UI Mod System.Byte.MaxValue", 26UI Mod System.Byte.MaxValue)
PrintResult("26UI Mod -3S", 26UI Mod -3S)
PrintResult("26UI Mod 24US", 26UI Mod 24US)
PrintResult("26UI Mod -5I", 26UI Mod -5I)
PrintResult("26UI Mod 26UI", 26UI Mod 26UI)
PrintResult("26UI Mod -7L", 26UI Mod -7L)
PrintResult("26UI Mod 28UL", 26UI Mod 28UL)
PrintResult("26UI Mod -9D", 26UI Mod -9D)
PrintResult("26UI Mod 10.0F", 26UI Mod 10.0F)
PrintResult("26UI Mod -11.0R", 26UI Mod -11.0R)
PrintResult("26UI Mod ""12""", 26UI Mod "12")
PrintResult("26UI Mod TypeCode.Double", 26UI Mod TypeCode.Double)
PrintResult("-7L Mod True", -7L Mod True)
PrintResult("-7L Mod System.SByte.MinValue", -7L Mod System.SByte.MinValue)
PrintResult("-7L Mod System.Byte.MaxValue", -7L Mod System.Byte.MaxValue)
PrintResult("-7L Mod -3S", -7L Mod -3S)
PrintResult("-7L Mod 24US", -7L Mod 24US)
PrintResult("-7L Mod -5I", -7L Mod -5I)
PrintResult("-7L Mod 26UI", -7L Mod 26UI)
PrintResult("-7L Mod -7L", -7L Mod -7L)
PrintResult("-7L Mod 28UL", -7L Mod 28UL)
PrintResult("-7L Mod -9D", -7L Mod -9D)
PrintResult("-7L Mod 10.0F", -7L Mod 10.0F)
PrintResult("-7L Mod -11.0R", -7L Mod -11.0R)
PrintResult("-7L Mod ""12""", -7L Mod "12")
PrintResult("-7L Mod TypeCode.Double", -7L Mod TypeCode.Double)
PrintResult("28UL Mod True", 28UL Mod True)
PrintResult("28UL Mod System.SByte.MinValue", 28UL Mod System.SByte.MinValue)
PrintResult("28UL Mod System.Byte.MaxValue", 28UL Mod System.Byte.MaxValue)
PrintResult("28UL Mod -3S", 28UL Mod -3S)
PrintResult("28UL Mod 24US", 28UL Mod 24US)
PrintResult("28UL Mod -5I", 28UL Mod -5I)
PrintResult("28UL Mod 26UI", 28UL Mod 26UI)
PrintResult("28UL Mod -7L", 28UL Mod -7L)
PrintResult("28UL Mod 28UL", 28UL Mod 28UL)
PrintResult("28UL Mod -9D", 28UL Mod -9D)
PrintResult("28UL Mod 10.0F", 28UL Mod 10.0F)
PrintResult("28UL Mod -11.0R", 28UL Mod -11.0R)
PrintResult("28UL Mod ""12""", 28UL Mod "12")
PrintResult("28UL Mod TypeCode.Double", 28UL Mod TypeCode.Double)
PrintResult("-9D Mod True", -9D Mod True)
PrintResult("-9D Mod System.SByte.MinValue", -9D Mod System.SByte.MinValue)
PrintResult("-9D Mod System.Byte.MaxValue", -9D Mod System.Byte.MaxValue)
PrintResult("-9D Mod -3S", -9D Mod -3S)
PrintResult("-9D Mod 24US", -9D Mod 24US)
PrintResult("-9D Mod -5I", -9D Mod -5I)
PrintResult("-9D Mod 26UI", -9D Mod 26UI)
PrintResult("-9D Mod -7L", -9D Mod -7L)
PrintResult("-9D Mod 28UL", -9D Mod 28UL)
PrintResult("-9D Mod -9D", -9D Mod -9D)
PrintResult("-9D Mod 10.0F", -9D Mod 10.0F)
PrintResult("-9D Mod -11.0R", -9D Mod -11.0R)
PrintResult("-9D Mod ""12""", -9D Mod "12")
PrintResult("-9D Mod TypeCode.Double", -9D Mod TypeCode.Double)
PrintResult("10.0F Mod True", 10.0F Mod True)
PrintResult("10.0F Mod System.SByte.MinValue", 10.0F Mod System.SByte.MinValue)
PrintResult("10.0F Mod System.Byte.MaxValue", 10.0F Mod System.Byte.MaxValue)
PrintResult("10.0F Mod -3S", 10.0F Mod -3S)
PrintResult("10.0F Mod 24US", 10.0F Mod 24US)
PrintResult("10.0F Mod -5I", 10.0F Mod -5I)
PrintResult("10.0F Mod 26UI", 10.0F Mod 26UI)
PrintResult("10.0F Mod -7L", 10.0F Mod -7L)
PrintResult("10.0F Mod 28UL", 10.0F Mod 28UL)
PrintResult("10.0F Mod -9D", 10.0F Mod -9D)
PrintResult("10.0F Mod 10.0F", 10.0F Mod 10.0F)
PrintResult("10.0F Mod -11.0R", 10.0F Mod -11.0R)
PrintResult("10.0F Mod ""12""", 10.0F Mod "12")
PrintResult("10.0F Mod TypeCode.Double", 10.0F Mod TypeCode.Double)
PrintResult("-11.0R Mod True", -11.0R Mod True)
PrintResult("-11.0R Mod System.SByte.MinValue", -11.0R Mod System.SByte.MinValue)
PrintResult("-11.0R Mod System.Byte.MaxValue", -11.0R Mod System.Byte.MaxValue)
PrintResult("-11.0R Mod -3S", -11.0R Mod -3S)
PrintResult("-11.0R Mod 24US", -11.0R Mod 24US)
PrintResult("-11.0R Mod -5I", -11.0R Mod -5I)
PrintResult("-11.0R Mod 26UI", -11.0R Mod 26UI)
PrintResult("-11.0R Mod -7L", -11.0R Mod -7L)
PrintResult("-11.0R Mod 28UL", -11.0R Mod 28UL)
PrintResult("-11.0R Mod -9D", -11.0R Mod -9D)
PrintResult("-11.0R Mod 10.0F", -11.0R Mod 10.0F)
PrintResult("-11.0R Mod -11.0R", -11.0R Mod -11.0R)
PrintResult("-11.0R Mod ""12""", -11.0R Mod "12")
PrintResult("-11.0R Mod TypeCode.Double", -11.0R Mod TypeCode.Double)
PrintResult("""12"" Mod True", "12" Mod True)
PrintResult("""12"" Mod System.SByte.MinValue", "12" Mod System.SByte.MinValue)
PrintResult("""12"" Mod System.Byte.MaxValue", "12" Mod System.Byte.MaxValue)
PrintResult("""12"" Mod -3S", "12" Mod -3S)
PrintResult("""12"" Mod 24US", "12" Mod 24US)
PrintResult("""12"" Mod -5I", "12" Mod -5I)
PrintResult("""12"" Mod 26UI", "12" Mod 26UI)
PrintResult("""12"" Mod -7L", "12" Mod -7L)
PrintResult("""12"" Mod 28UL", "12" Mod 28UL)
PrintResult("""12"" Mod -9D", "12" Mod -9D)
PrintResult("""12"" Mod 10.0F", "12" Mod 10.0F)
PrintResult("""12"" Mod -11.0R", "12" Mod -11.0R)
PrintResult("""12"" Mod ""12""", "12" Mod "12")
PrintResult("""12"" Mod TypeCode.Double", "12" Mod TypeCode.Double)
PrintResult("TypeCode.Double Mod True", TypeCode.Double Mod True)
PrintResult("TypeCode.Double Mod System.SByte.MinValue", TypeCode.Double Mod System.SByte.MinValue)
PrintResult("TypeCode.Double Mod System.Byte.MaxValue", TypeCode.Double Mod System.Byte.MaxValue)
PrintResult("TypeCode.Double Mod -3S", TypeCode.Double Mod -3S)
PrintResult("TypeCode.Double Mod 24US", TypeCode.Double Mod 24US)
PrintResult("TypeCode.Double Mod -5I", TypeCode.Double Mod -5I)
PrintResult("TypeCode.Double Mod 26UI", TypeCode.Double Mod 26UI)
PrintResult("TypeCode.Double Mod -7L", TypeCode.Double Mod -7L)
PrintResult("TypeCode.Double Mod 28UL", TypeCode.Double Mod 28UL)
PrintResult("TypeCode.Double Mod -9D", TypeCode.Double Mod -9D)
PrintResult("TypeCode.Double Mod 10.0F", TypeCode.Double Mod 10.0F)
PrintResult("TypeCode.Double Mod -11.0R", TypeCode.Double Mod -11.0R)
PrintResult("TypeCode.Double Mod ""12""", TypeCode.Double Mod "12")
PrintResult("TypeCode.Double Mod TypeCode.Double", TypeCode.Double Mod TypeCode.Double)
PrintResult("False ^ False", False ^ False)
PrintResult("False ^ True", False ^ True)
PrintResult("False ^ System.SByte.MinValue", False ^ System.SByte.MinValue)
PrintResult("False ^ System.Byte.MaxValue", False ^ System.Byte.MaxValue)
PrintResult("False ^ -3S", False ^ -3S)
PrintResult("False ^ 24US", False ^ 24US)
PrintResult("False ^ -5I", False ^ -5I)
PrintResult("False ^ 26UI", False ^ 26UI)
PrintResult("False ^ -7L", False ^ -7L)
PrintResult("False ^ 28UL", False ^ 28UL)
PrintResult("False ^ -9D", False ^ -9D)
PrintResult("False ^ 10.0F", False ^ 10.0F)
PrintResult("False ^ -11.0R", False ^ -11.0R)
PrintResult("False ^ ""12""", False ^ "12")
PrintResult("False ^ TypeCode.Double", False ^ TypeCode.Double)
PrintResult("True ^ False", True ^ False)
PrintResult("True ^ True", True ^ True)
PrintResult("True ^ System.SByte.MinValue", True ^ System.SByte.MinValue)
PrintResult("True ^ System.Byte.MaxValue", True ^ System.Byte.MaxValue)
PrintResult("True ^ -3S", True ^ -3S)
PrintResult("True ^ 24US", True ^ 24US)
PrintResult("True ^ -5I", True ^ -5I)
PrintResult("True ^ 26UI", True ^ 26UI)
PrintResult("True ^ -7L", True ^ -7L)
PrintResult("True ^ 28UL", True ^ 28UL)
PrintResult("True ^ -9D", True ^ -9D)
PrintResult("True ^ 10.0F", True ^ 10.0F)
PrintResult("True ^ -11.0R", True ^ -11.0R)
PrintResult("True ^ ""12""", True ^ "12")
PrintResult("True ^ TypeCode.Double", True ^ TypeCode.Double)
PrintResult("System.SByte.MinValue ^ False", System.SByte.MinValue ^ False)
PrintResult("System.SByte.MinValue ^ True", System.SByte.MinValue ^ True)
PrintResult("System.SByte.MinValue ^ System.SByte.MinValue", System.SByte.MinValue ^ System.SByte.MinValue)
PrintResult("System.SByte.MinValue ^ System.Byte.MaxValue", System.SByte.MinValue ^ System.Byte.MaxValue)
PrintResult("System.SByte.MinValue ^ -3S", System.SByte.MinValue ^ -3S)
PrintResult("System.SByte.MinValue ^ 24US", System.SByte.MinValue ^ 24US)
PrintResult("System.SByte.MinValue ^ -5I", System.SByte.MinValue ^ -5I)
PrintResult("System.SByte.MinValue ^ 26UI", System.SByte.MinValue ^ 26UI)
PrintResult("System.SByte.MinValue ^ -7L", System.SByte.MinValue ^ -7L)
PrintResult("System.SByte.MinValue ^ 28UL", System.SByte.MinValue ^ 28UL)
PrintResult("System.SByte.MinValue ^ -9D", System.SByte.MinValue ^ -9D)
PrintResult("System.SByte.MinValue ^ 10.0F", System.SByte.MinValue ^ 10.0F)
PrintResult("System.SByte.MinValue ^ -11.0R", System.SByte.MinValue ^ -11.0R)
PrintResult("System.SByte.MinValue ^ ""12""", System.SByte.MinValue ^ "12")
PrintResult("System.SByte.MinValue ^ TypeCode.Double", System.SByte.MinValue ^ TypeCode.Double)
PrintResult("System.Byte.MaxValue ^ False", System.Byte.MaxValue ^ False)
PrintResult("System.Byte.MaxValue ^ True", System.Byte.MaxValue ^ True)
PrintResult("System.Byte.MaxValue ^ System.SByte.MinValue", System.Byte.MaxValue ^ System.SByte.MinValue)
PrintResult("System.Byte.MaxValue ^ System.Byte.MaxValue", System.Byte.MaxValue ^ System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue ^ -3S", System.Byte.MaxValue ^ -3S)
PrintResult("System.Byte.MaxValue ^ 24US", System.Byte.MaxValue ^ 24US)
PrintResult("System.Byte.MaxValue ^ -5I", System.Byte.MaxValue ^ -5I)
PrintResult("System.Byte.MaxValue ^ 26UI", System.Byte.MaxValue ^ 26UI)
PrintResult("System.Byte.MaxValue ^ -7L", System.Byte.MaxValue ^ -7L)
PrintResult("System.Byte.MaxValue ^ 28UL", System.Byte.MaxValue ^ 28UL)
PrintResult("System.Byte.MaxValue ^ -9D", System.Byte.MaxValue ^ -9D)
PrintResult("System.Byte.MaxValue ^ 10.0F", System.Byte.MaxValue ^ 10.0F)
PrintResult("System.Byte.MaxValue ^ -11.0R", System.Byte.MaxValue ^ -11.0R)
PrintResult("System.Byte.MaxValue ^ ""12""", System.Byte.MaxValue ^ "12")
PrintResult("System.Byte.MaxValue ^ TypeCode.Double", System.Byte.MaxValue ^ TypeCode.Double)
PrintResult("-3S ^ False", -3S ^ False)
PrintResult("-3S ^ True", -3S ^ True)
PrintResult("-3S ^ System.SByte.MinValue", -3S ^ System.SByte.MinValue)
PrintResult("-3S ^ System.Byte.MaxValue", -3S ^ System.Byte.MaxValue)
PrintResult("-3S ^ -3S", -3S ^ -3S)
PrintResult("-3S ^ 24US", -3S ^ 24US)
PrintResult("-3S ^ -5I", -3S ^ -5I)
PrintResult("-3S ^ 26UI", -3S ^ 26UI)
PrintResult("-3S ^ -7L", -3S ^ -7L)
PrintResult("-3S ^ 28UL", -3S ^ 28UL)
PrintResult("-3S ^ -9D", -3S ^ -9D)
PrintResult("-3S ^ 10.0F", -3S ^ 10.0F)
PrintResult("-3S ^ -11.0R", -3S ^ -11.0R)
PrintResult("-3S ^ ""12""", -3S ^ "12")
PrintResult("-3S ^ TypeCode.Double", -3S ^ TypeCode.Double)
PrintResult("24US ^ False", 24US ^ False)
PrintResult("24US ^ True", 24US ^ True)
PrintResult("24US ^ System.SByte.MinValue", 24US ^ System.SByte.MinValue)
PrintResult("24US ^ System.Byte.MaxValue", 24US ^ System.Byte.MaxValue)
PrintResult("24US ^ -3S", 24US ^ -3S)
PrintResult("24US ^ 24US", 24US ^ 24US)
PrintResult("24US ^ -5I", 24US ^ -5I)
PrintResult("24US ^ 26UI", 24US ^ 26UI)
PrintResult("24US ^ -7L", 24US ^ -7L)
PrintResult("24US ^ 28UL", 24US ^ 28UL)
PrintResult("24US ^ -9D", 24US ^ -9D)
PrintResult("24US ^ 10.0F", 24US ^ 10.0F)
PrintResult("24US ^ -11.0R", 24US ^ -11.0R)
PrintResult("24US ^ ""12""", 24US ^ "12")
PrintResult("24US ^ TypeCode.Double", 24US ^ TypeCode.Double)
PrintResult("-5I ^ False", -5I ^ False)
PrintResult("-5I ^ True", -5I ^ True)
PrintResult("-5I ^ System.SByte.MinValue", -5I ^ System.SByte.MinValue)
PrintResult("-5I ^ System.Byte.MaxValue", -5I ^ System.Byte.MaxValue)
PrintResult("-5I ^ -3S", -5I ^ -3S)
PrintResult("-5I ^ 24US", -5I ^ 24US)
PrintResult("-5I ^ -5I", -5I ^ -5I)
PrintResult("-5I ^ 26UI", -5I ^ 26UI)
PrintResult("-5I ^ -7L", -5I ^ -7L)
PrintResult("-5I ^ 28UL", -5I ^ 28UL)
PrintResult("-5I ^ -9D", -5I ^ -9D)
PrintResult("-5I ^ 10.0F", -5I ^ 10.0F)
PrintResult("-5I ^ -11.0R", -5I ^ -11.0R)
PrintResult("-5I ^ ""12""", -5I ^ "12")
PrintResult("-5I ^ TypeCode.Double", -5I ^ TypeCode.Double)
PrintResult("26UI ^ False", 26UI ^ False)
PrintResult("26UI ^ True", 26UI ^ True)
PrintResult("26UI ^ System.SByte.MinValue", 26UI ^ System.SByte.MinValue)
PrintResult("26UI ^ System.Byte.MaxValue", 26UI ^ System.Byte.MaxValue)
PrintResult("26UI ^ -3S", 26UI ^ -3S)
PrintResult("26UI ^ 24US", 26UI ^ 24US)
PrintResult("26UI ^ -5I", 26UI ^ -5I)
PrintResult("26UI ^ 26UI", 26UI ^ 26UI)
PrintResult("26UI ^ -7L", 26UI ^ -7L)
PrintResult("26UI ^ 28UL", 26UI ^ 28UL)
PrintResult("26UI ^ -9D", 26UI ^ -9D)
PrintResult("26UI ^ 10.0F", 26UI ^ 10.0F)
PrintResult("26UI ^ -11.0R", 26UI ^ -11.0R)
PrintResult("26UI ^ ""12""", 26UI ^ "12")
PrintResult("26UI ^ TypeCode.Double", 26UI ^ TypeCode.Double)
PrintResult("-7L ^ False", -7L ^ False)
PrintResult("-7L ^ True", -7L ^ True)
PrintResult("-7L ^ System.SByte.MinValue", -7L ^ System.SByte.MinValue)
PrintResult("-7L ^ System.Byte.MaxValue", -7L ^ System.Byte.MaxValue)
PrintResult("-7L ^ -3S", -7L ^ -3S)
PrintResult("-7L ^ 24US", -7L ^ 24US)
PrintResult("-7L ^ -5I", -7L ^ -5I)
PrintResult("-7L ^ 26UI", -7L ^ 26UI)
PrintResult("-7L ^ -7L", -7L ^ -7L)
PrintResult("-7L ^ 28UL", -7L ^ 28UL)
PrintResult("-7L ^ -9D", -7L ^ -9D)
PrintResult("-7L ^ 10.0F", -7L ^ 10.0F)
PrintResult("-7L ^ -11.0R", -7L ^ -11.0R)
PrintResult("-7L ^ ""12""", -7L ^ "12")
PrintResult("-7L ^ TypeCode.Double", -7L ^ TypeCode.Double)
PrintResult("28UL ^ False", 28UL ^ False)
PrintResult("28UL ^ True", 28UL ^ True)
PrintResult("28UL ^ System.SByte.MinValue", 28UL ^ System.SByte.MinValue)
PrintResult("28UL ^ System.Byte.MaxValue", 28UL ^ System.Byte.MaxValue)
PrintResult("28UL ^ -3S", 28UL ^ -3S)
PrintResult("28UL ^ 24US", 28UL ^ 24US)
PrintResult("28UL ^ -5I", 28UL ^ -5I)
PrintResult("28UL ^ 26UI", 28UL ^ 26UI)
PrintResult("28UL ^ -7L", 28UL ^ -7L)
PrintResult("28UL ^ 28UL", 28UL ^ 28UL)
PrintResult("28UL ^ -9D", 28UL ^ -9D)
PrintResult("28UL ^ 10.0F", 28UL ^ 10.0F)
PrintResult("28UL ^ -11.0R", 28UL ^ -11.0R)
PrintResult("28UL ^ ""12""", 28UL ^ "12")
PrintResult("28UL ^ TypeCode.Double", 28UL ^ TypeCode.Double)
PrintResult("-9D ^ False", -9D ^ False)
PrintResult("-9D ^ True", -9D ^ True)
PrintResult("-9D ^ System.SByte.MinValue", -9D ^ System.SByte.MinValue)
PrintResult("-9D ^ System.Byte.MaxValue", -9D ^ System.Byte.MaxValue)
PrintResult("-9D ^ -3S", -9D ^ -3S)
PrintResult("-9D ^ 24US", -9D ^ 24US)
PrintResult("-9D ^ -5I", -9D ^ -5I)
PrintResult("-9D ^ 26UI", -9D ^ 26UI)
PrintResult("-9D ^ -7L", -9D ^ -7L)
PrintResult("-9D ^ 28UL", -9D ^ 28UL)
PrintResult("-9D ^ -9D", -9D ^ -9D)
PrintResult("-9D ^ 10.0F", -9D ^ 10.0F)
PrintResult("-9D ^ -11.0R", -9D ^ -11.0R)
PrintResult("-9D ^ ""12""", -9D ^ "12")
PrintResult("-9D ^ TypeCode.Double", -9D ^ TypeCode.Double)
PrintResult("10.0F ^ False", 10.0F ^ False)
PrintResult("10.0F ^ True", 10.0F ^ True)
PrintResult("10.0F ^ System.SByte.MinValue", 10.0F ^ System.SByte.MinValue)
PrintResult("10.0F ^ System.Byte.MaxValue", 10.0F ^ System.Byte.MaxValue)
PrintResult("10.0F ^ -3S", 10.0F ^ -3S)
PrintResult("10.0F ^ 24US", 10.0F ^ 24US)
PrintResult("10.0F ^ -5I", 10.0F ^ -5I)
PrintResult("10.0F ^ 26UI", 10.0F ^ 26UI)
PrintResult("10.0F ^ -7L", 10.0F ^ -7L)
PrintResult("10.0F ^ 28UL", 10.0F ^ 28UL)
PrintResult("10.0F ^ -9D", 10.0F ^ -9D)
PrintResult("10.0F ^ 10.0F", 10.0F ^ 10.0F)
PrintResult("10.0F ^ -11.0R", 10.0F ^ -11.0R)
PrintResult("10.0F ^ ""12""", 10.0F ^ "12")
PrintResult("10.0F ^ TypeCode.Double", 10.0F ^ TypeCode.Double)
PrintResult("-11.0R ^ False", -11.0R ^ False)
PrintResult("-11.0R ^ True", -11.0R ^ True)
PrintResult("-11.0R ^ System.SByte.MinValue", -11.0R ^ System.SByte.MinValue)
PrintResult("-11.0R ^ System.Byte.MaxValue", -11.0R ^ System.Byte.MaxValue)
PrintResult("-11.0R ^ -3S", -11.0R ^ -3S)
PrintResult("-11.0R ^ 24US", -11.0R ^ 24US)
PrintResult("-11.0R ^ -5I", -11.0R ^ -5I)
PrintResult("-11.0R ^ 26UI", -11.0R ^ 26UI)
PrintResult("-11.0R ^ -7L", -11.0R ^ -7L)
PrintResult("-11.0R ^ 28UL", -11.0R ^ 28UL)
PrintResult("-11.0R ^ -9D", -11.0R ^ -9D)
PrintResult("-11.0R ^ 10.0F", -11.0R ^ 10.0F)
PrintResult("-11.0R ^ -11.0R", -11.0R ^ -11.0R)
PrintResult("-11.0R ^ ""12""", -11.0R ^ "12")
PrintResult("-11.0R ^ TypeCode.Double", -11.0R ^ TypeCode.Double)
PrintResult("""12"" ^ False", "12" ^ False)
PrintResult("""12"" ^ True", "12" ^ True)
PrintResult("""12"" ^ System.SByte.MinValue", "12" ^ System.SByte.MinValue)
PrintResult("""12"" ^ System.Byte.MaxValue", "12" ^ System.Byte.MaxValue)
PrintResult("""12"" ^ -3S", "12" ^ -3S)
PrintResult("""12"" ^ 24US", "12" ^ 24US)
PrintResult("""12"" ^ -5I", "12" ^ -5I)
PrintResult("""12"" ^ 26UI", "12" ^ 26UI)
PrintResult("""12"" ^ -7L", "12" ^ -7L)
PrintResult("""12"" ^ 28UL", "12" ^ 28UL)
PrintResult("""12"" ^ -9D", "12" ^ -9D)
PrintResult("""12"" ^ 10.0F", "12" ^ 10.0F)
PrintResult("""12"" ^ -11.0R", "12" ^ -11.0R)
PrintResult("""12"" ^ ""12""", "12" ^ "12")
PrintResult("""12"" ^ TypeCode.Double", "12" ^ TypeCode.Double)
PrintResult("TypeCode.Double ^ False", TypeCode.Double ^ False)
PrintResult("TypeCode.Double ^ True", TypeCode.Double ^ True)
PrintResult("TypeCode.Double ^ System.SByte.MinValue", TypeCode.Double ^ System.SByte.MinValue)
PrintResult("TypeCode.Double ^ System.Byte.MaxValue", TypeCode.Double ^ System.Byte.MaxValue)
PrintResult("TypeCode.Double ^ -3S", TypeCode.Double ^ -3S)
PrintResult("TypeCode.Double ^ 24US", TypeCode.Double ^ 24US)
PrintResult("TypeCode.Double ^ -5I", TypeCode.Double ^ -5I)
PrintResult("TypeCode.Double ^ 26UI", TypeCode.Double ^ 26UI)
PrintResult("TypeCode.Double ^ -7L", TypeCode.Double ^ -7L)
PrintResult("TypeCode.Double ^ 28UL", TypeCode.Double ^ 28UL)
PrintResult("TypeCode.Double ^ -9D", TypeCode.Double ^ -9D)
PrintResult("TypeCode.Double ^ 10.0F", TypeCode.Double ^ 10.0F)
PrintResult("TypeCode.Double ^ -11.0R", TypeCode.Double ^ -11.0R)
PrintResult("TypeCode.Double ^ ""12""", TypeCode.Double ^ "12")
PrintResult("TypeCode.Double ^ TypeCode.Double", TypeCode.Double ^ TypeCode.Double)
PrintResult("False << False", False << False)
PrintResult("False << True", False << True)
PrintResult("False << System.SByte.MinValue", False << System.SByte.MinValue)
PrintResult("False << System.Byte.MaxValue", False << System.Byte.MaxValue)
PrintResult("False << -3S", False << -3S)
PrintResult("False << 24US", False << 24US)
PrintResult("False << -5I", False << -5I)
PrintResult("False << 26UI", False << 26UI)
PrintResult("False << -7L", False << -7L)
PrintResult("False << 28UL", False << 28UL)
PrintResult("False << -9D", False << -9D)
PrintResult("False << 10.0F", False << 10.0F)
PrintResult("False << -11.0R", False << -11.0R)
PrintResult("False << ""12""", False << "12")
PrintResult("False << TypeCode.Double", False << TypeCode.Double)
PrintResult("True << False", True << False)
PrintResult("True << True", True << True)
PrintResult("True << System.SByte.MinValue", True << System.SByte.MinValue)
PrintResult("True << System.Byte.MaxValue", True << System.Byte.MaxValue)
PrintResult("True << -3S", True << -3S)
PrintResult("True << 24US", True << 24US)
PrintResult("True << -5I", True << -5I)
PrintResult("True << 26UI", True << 26UI)
PrintResult("True << -7L", True << -7L)
PrintResult("True << 28UL", True << 28UL)
PrintResult("True << -9D", True << -9D)
PrintResult("True << 10.0F", True << 10.0F)
PrintResult("True << -11.0R", True << -11.0R)
PrintResult("True << ""12""", True << "12")
PrintResult("True << TypeCode.Double", True << TypeCode.Double)
PrintResult("System.SByte.MinValue << False", System.SByte.MinValue << False)
PrintResult("System.SByte.MinValue << True", System.SByte.MinValue << True)
PrintResult("System.SByte.MinValue << System.SByte.MinValue", System.SByte.MinValue << System.SByte.MinValue)
PrintResult("System.SByte.MinValue << System.Byte.MaxValue", System.SByte.MinValue << System.Byte.MaxValue)
PrintResult("System.SByte.MinValue << -3S", System.SByte.MinValue << -3S)
PrintResult("System.SByte.MinValue << 24US", System.SByte.MinValue << 24US)
PrintResult("System.SByte.MinValue << -5I", System.SByte.MinValue << -5I)
PrintResult("System.SByte.MinValue << 26UI", System.SByte.MinValue << 26UI)
PrintResult("System.SByte.MinValue << -7L", System.SByte.MinValue << -7L)
PrintResult("System.SByte.MinValue << 28UL", System.SByte.MinValue << 28UL)
PrintResult("System.SByte.MinValue << -9D", System.SByte.MinValue << -9D)
PrintResult("System.SByte.MinValue << 10.0F", System.SByte.MinValue << 10.0F)
PrintResult("System.SByte.MinValue << -11.0R", System.SByte.MinValue << -11.0R)
PrintResult("System.SByte.MinValue << ""12""", System.SByte.MinValue << "12")
PrintResult("System.SByte.MinValue << TypeCode.Double", System.SByte.MinValue << TypeCode.Double)
PrintResult("System.Byte.MaxValue << False", System.Byte.MaxValue << False)
PrintResult("System.Byte.MaxValue << True", System.Byte.MaxValue << True)
PrintResult("System.Byte.MaxValue << System.SByte.MinValue", System.Byte.MaxValue << System.SByte.MinValue)
PrintResult("System.Byte.MaxValue << System.Byte.MaxValue", System.Byte.MaxValue << System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue << -3S", System.Byte.MaxValue << -3S)
PrintResult("System.Byte.MaxValue << 24US", System.Byte.MaxValue << 24US)
PrintResult("System.Byte.MaxValue << -5I", System.Byte.MaxValue << -5I)
PrintResult("System.Byte.MaxValue << 26UI", System.Byte.MaxValue << 26UI)
PrintResult("System.Byte.MaxValue << -7L", System.Byte.MaxValue << -7L)
PrintResult("System.Byte.MaxValue << 28UL", System.Byte.MaxValue << 28UL)
PrintResult("System.Byte.MaxValue << -9D", System.Byte.MaxValue << -9D)
PrintResult("System.Byte.MaxValue << 10.0F", System.Byte.MaxValue << 10.0F)
PrintResult("System.Byte.MaxValue << -11.0R", System.Byte.MaxValue << -11.0R)
PrintResult("System.Byte.MaxValue << ""12""", System.Byte.MaxValue << "12")
PrintResult("System.Byte.MaxValue << TypeCode.Double", System.Byte.MaxValue << TypeCode.Double)
PrintResult("-3S << False", -3S << False)
PrintResult("-3S << True", -3S << True)
PrintResult("-3S << System.SByte.MinValue", -3S << System.SByte.MinValue)
PrintResult("-3S << System.Byte.MaxValue", -3S << System.Byte.MaxValue)
PrintResult("-3S << -3S", -3S << -3S)
PrintResult("-3S << 24US", -3S << 24US)
PrintResult("-3S << -5I", -3S << -5I)
PrintResult("-3S << 26UI", -3S << 26UI)
PrintResult("-3S << -7L", -3S << -7L)
PrintResult("-3S << 28UL", -3S << 28UL)
PrintResult("-3S << -9D", -3S << -9D)
PrintResult("-3S << 10.0F", -3S << 10.0F)
PrintResult("-3S << -11.0R", -3S << -11.0R)
PrintResult("-3S << ""12""", -3S << "12")
PrintResult("-3S << TypeCode.Double", -3S << TypeCode.Double)
PrintResult("24US << False", 24US << False)
PrintResult("24US << True", 24US << True)
PrintResult("24US << System.SByte.MinValue", 24US << System.SByte.MinValue)
PrintResult("24US << System.Byte.MaxValue", 24US << System.Byte.MaxValue)
PrintResult("24US << -3S", 24US << -3S)
PrintResult("24US << 24US", 24US << 24US)
PrintResult("24US << -5I", 24US << -5I)
PrintResult("24US << 26UI", 24US << 26UI)
PrintResult("24US << -7L", 24US << -7L)
PrintResult("24US << 28UL", 24US << 28UL)
PrintResult("24US << -9D", 24US << -9D)
PrintResult("24US << 10.0F", 24US << 10.0F)
PrintResult("24US << -11.0R", 24US << -11.0R)
PrintResult("24US << ""12""", 24US << "12")
PrintResult("24US << TypeCode.Double", 24US << TypeCode.Double)
PrintResult("-5I << False", -5I << False)
PrintResult("-5I << True", -5I << True)
PrintResult("-5I << System.SByte.MinValue", -5I << System.SByte.MinValue)
PrintResult("-5I << System.Byte.MaxValue", -5I << System.Byte.MaxValue)
PrintResult("-5I << -3S", -5I << -3S)
PrintResult("-5I << 24US", -5I << 24US)
PrintResult("-5I << -5I", -5I << -5I)
PrintResult("-5I << 26UI", -5I << 26UI)
PrintResult("-5I << -7L", -5I << -7L)
PrintResult("-5I << 28UL", -5I << 28UL)
PrintResult("-5I << -9D", -5I << -9D)
PrintResult("-5I << 10.0F", -5I << 10.0F)
PrintResult("-5I << -11.0R", -5I << -11.0R)
PrintResult("-5I << ""12""", -5I << "12")
PrintResult("-5I << TypeCode.Double", -5I << TypeCode.Double)
PrintResult("26UI << False", 26UI << False)
PrintResult("26UI << True", 26UI << True)
PrintResult("26UI << System.SByte.MinValue", 26UI << System.SByte.MinValue)
PrintResult("26UI << System.Byte.MaxValue", 26UI << System.Byte.MaxValue)
PrintResult("26UI << -3S", 26UI << -3S)
PrintResult("26UI << 24US", 26UI << 24US)
PrintResult("26UI << -5I", 26UI << -5I)
PrintResult("26UI << 26UI", 26UI << 26UI)
PrintResult("26UI << -7L", 26UI << -7L)
PrintResult("26UI << 28UL", 26UI << 28UL)
PrintResult("26UI << -9D", 26UI << -9D)
PrintResult("26UI << 10.0F", 26UI << 10.0F)
PrintResult("26UI << -11.0R", 26UI << -11.0R)
PrintResult("26UI << ""12""", 26UI << "12")
PrintResult("26UI << TypeCode.Double", 26UI << TypeCode.Double)
PrintResult("-7L << False", -7L << False)
PrintResult("-7L << True", -7L << True)
PrintResult("-7L << System.SByte.MinValue", -7L << System.SByte.MinValue)
PrintResult("-7L << System.Byte.MaxValue", -7L << System.Byte.MaxValue)
PrintResult("-7L << -3S", -7L << -3S)
PrintResult("-7L << 24US", -7L << 24US)
PrintResult("-7L << -5I", -7L << -5I)
PrintResult("-7L << 26UI", -7L << 26UI)
PrintResult("-7L << -7L", -7L << -7L)
PrintResult("-7L << 28UL", -7L << 28UL)
PrintResult("-7L << -9D", -7L << -9D)
PrintResult("-7L << 10.0F", -7L << 10.0F)
PrintResult("-7L << -11.0R", -7L << -11.0R)
PrintResult("-7L << ""12""", -7L << "12")
PrintResult("-7L << TypeCode.Double", -7L << TypeCode.Double)
PrintResult("28UL << False", 28UL << False)
PrintResult("28UL << True", 28UL << True)
PrintResult("28UL << System.SByte.MinValue", 28UL << System.SByte.MinValue)
PrintResult("28UL << System.Byte.MaxValue", 28UL << System.Byte.MaxValue)
PrintResult("28UL << -3S", 28UL << -3S)
PrintResult("28UL << 24US", 28UL << 24US)
PrintResult("28UL << -5I", 28UL << -5I)
PrintResult("28UL << 26UI", 28UL << 26UI)
PrintResult("28UL << -7L", 28UL << -7L)
PrintResult("28UL << 28UL", 28UL << 28UL)
PrintResult("28UL << -9D", 28UL << -9D)
PrintResult("28UL << 10.0F", 28UL << 10.0F)
PrintResult("28UL << -11.0R", 28UL << -11.0R)
PrintResult("28UL << ""12""", 28UL << "12")
PrintResult("28UL << TypeCode.Double", 28UL << TypeCode.Double)
PrintResult("-9D << False", -9D << False)
PrintResult("-9D << True", -9D << True)
PrintResult("-9D << System.SByte.MinValue", -9D << System.SByte.MinValue)
PrintResult("-9D << System.Byte.MaxValue", -9D << System.Byte.MaxValue)
PrintResult("-9D << -3S", -9D << -3S)
PrintResult("-9D << 24US", -9D << 24US)
PrintResult("-9D << -5I", -9D << -5I)
PrintResult("-9D << 26UI", -9D << 26UI)
PrintResult("-9D << -7L", -9D << -7L)
PrintResult("-9D << 28UL", -9D << 28UL)
PrintResult("-9D << -9D", -9D << -9D)
PrintResult("-9D << 10.0F", -9D << 10.0F)
PrintResult("-9D << -11.0R", -9D << -11.0R)
PrintResult("-9D << ""12""", -9D << "12")
PrintResult("-9D << TypeCode.Double", -9D << TypeCode.Double)
PrintResult("10.0F << False", 10.0F << False)
PrintResult("10.0F << True", 10.0F << True)
PrintResult("10.0F << System.SByte.MinValue", 10.0F << System.SByte.MinValue)
PrintResult("10.0F << System.Byte.MaxValue", 10.0F << System.Byte.MaxValue)
PrintResult("10.0F << -3S", 10.0F << -3S)
PrintResult("10.0F << 24US", 10.0F << 24US)
PrintResult("10.0F << -5I", 10.0F << -5I)
PrintResult("10.0F << 26UI", 10.0F << 26UI)
PrintResult("10.0F << -7L", 10.0F << -7L)
PrintResult("10.0F << 28UL", 10.0F << 28UL)
PrintResult("10.0F << -9D", 10.0F << -9D)
PrintResult("10.0F << 10.0F", 10.0F << 10.0F)
PrintResult("10.0F << -11.0R", 10.0F << -11.0R)
PrintResult("10.0F << ""12""", 10.0F << "12")
PrintResult("10.0F << TypeCode.Double", 10.0F << TypeCode.Double)
PrintResult("-11.0R << False", -11.0R << False)
PrintResult("-11.0R << True", -11.0R << True)
PrintResult("-11.0R << System.SByte.MinValue", -11.0R << System.SByte.MinValue)
PrintResult("-11.0R << System.Byte.MaxValue", -11.0R << System.Byte.MaxValue)
PrintResult("-11.0R << -3S", -11.0R << -3S)
PrintResult("-11.0R << 24US", -11.0R << 24US)
PrintResult("-11.0R << -5I", -11.0R << -5I)
PrintResult("-11.0R << 26UI", -11.0R << 26UI)
PrintResult("-11.0R << -7L", -11.0R << -7L)
PrintResult("-11.0R << 28UL", -11.0R << 28UL)
PrintResult("-11.0R << -9D", -11.0R << -9D)
PrintResult("-11.0R << 10.0F", -11.0R << 10.0F)
PrintResult("-11.0R << -11.0R", -11.0R << -11.0R)
PrintResult("-11.0R << ""12""", -11.0R << "12")
PrintResult("-11.0R << TypeCode.Double", -11.0R << TypeCode.Double)
PrintResult("""12"" << False", "12" << False)
PrintResult("""12"" << True", "12" << True)
PrintResult("""12"" << System.SByte.MinValue", "12" << System.SByte.MinValue)
PrintResult("""12"" << System.Byte.MaxValue", "12" << System.Byte.MaxValue)
PrintResult("""12"" << -3S", "12" << -3S)
PrintResult("""12"" << 24US", "12" << 24US)
PrintResult("""12"" << -5I", "12" << -5I)
PrintResult("""12"" << 26UI", "12" << 26UI)
PrintResult("""12"" << -7L", "12" << -7L)
PrintResult("""12"" << 28UL", "12" << 28UL)
PrintResult("""12"" << -9D", "12" << -9D)
PrintResult("""12"" << 10.0F", "12" << 10.0F)
PrintResult("""12"" << -11.0R", "12" << -11.0R)
PrintResult("""12"" << ""12""", "12" << "12")
PrintResult("""12"" << TypeCode.Double", "12" << TypeCode.Double)
PrintResult("TypeCode.Double << False", TypeCode.Double << False)
PrintResult("TypeCode.Double << True", TypeCode.Double << True)
PrintResult("TypeCode.Double << System.SByte.MinValue", TypeCode.Double << System.SByte.MinValue)
PrintResult("TypeCode.Double << System.Byte.MaxValue", TypeCode.Double << System.Byte.MaxValue)
PrintResult("TypeCode.Double << -3S", TypeCode.Double << -3S)
PrintResult("TypeCode.Double << 24US", TypeCode.Double << 24US)
PrintResult("TypeCode.Double << -5I", TypeCode.Double << -5I)
PrintResult("TypeCode.Double << 26UI", TypeCode.Double << 26UI)
PrintResult("TypeCode.Double << -7L", TypeCode.Double << -7L)
PrintResult("TypeCode.Double << 28UL", TypeCode.Double << 28UL)
PrintResult("TypeCode.Double << -9D", TypeCode.Double << -9D)
PrintResult("TypeCode.Double << 10.0F", TypeCode.Double << 10.0F)
PrintResult("TypeCode.Double << -11.0R", TypeCode.Double << -11.0R)
PrintResult("TypeCode.Double << ""12""", TypeCode.Double << "12")
PrintResult("TypeCode.Double << TypeCode.Double", TypeCode.Double << TypeCode.Double)
PrintResult("False >> False", False >> False)
PrintResult("False >> True", False >> True)
PrintResult("False >> System.SByte.MinValue", False >> System.SByte.MinValue)
PrintResult("False >> System.Byte.MaxValue", False >> System.Byte.MaxValue)
PrintResult("False >> -3S", False >> -3S)
PrintResult("False >> 24US", False >> 24US)
PrintResult("False >> -5I", False >> -5I)
PrintResult("False >> 26UI", False >> 26UI)
PrintResult("False >> -7L", False >> -7L)
PrintResult("False >> 28UL", False >> 28UL)
PrintResult("False >> -9D", False >> -9D)
PrintResult("False >> 10.0F", False >> 10.0F)
PrintResult("False >> -11.0R", False >> -11.0R)
PrintResult("False >> ""12""", False >> "12")
PrintResult("False >> TypeCode.Double", False >> TypeCode.Double)
PrintResult("True >> False", True >> False)
PrintResult("True >> True", True >> True)
PrintResult("True >> System.SByte.MinValue", True >> System.SByte.MinValue)
PrintResult("True >> System.Byte.MaxValue", True >> System.Byte.MaxValue)
PrintResult("True >> -3S", True >> -3S)
PrintResult("True >> 24US", True >> 24US)
PrintResult("True >> -5I", True >> -5I)
PrintResult("True >> 26UI", True >> 26UI)
PrintResult("True >> -7L", True >> -7L)
PrintResult("True >> 28UL", True >> 28UL)
PrintResult("True >> -9D", True >> -9D)
PrintResult("True >> 10.0F", True >> 10.0F)
PrintResult("True >> -11.0R", True >> -11.0R)
PrintResult("True >> ""12""", True >> "12")
PrintResult("True >> TypeCode.Double", True >> TypeCode.Double)
PrintResult("System.SByte.MinValue >> False", System.SByte.MinValue >> False)
PrintResult("System.SByte.MinValue >> True", System.SByte.MinValue >> True)
PrintResult("System.SByte.MinValue >> System.SByte.MinValue", System.SByte.MinValue >> System.SByte.MinValue)
PrintResult("System.SByte.MinValue >> System.Byte.MaxValue", System.SByte.MinValue >> System.Byte.MaxValue)
PrintResult("System.SByte.MinValue >> -3S", System.SByte.MinValue >> -3S)
PrintResult("System.SByte.MinValue >> 24US", System.SByte.MinValue >> 24US)
PrintResult("System.SByte.MinValue >> -5I", System.SByte.MinValue >> -5I)
PrintResult("System.SByte.MinValue >> 26UI", System.SByte.MinValue >> 26UI)
PrintResult("System.SByte.MinValue >> -7L", System.SByte.MinValue >> -7L)
PrintResult("System.SByte.MinValue >> 28UL", System.SByte.MinValue >> 28UL)
PrintResult("System.SByte.MinValue >> -9D", System.SByte.MinValue >> -9D)
PrintResult("System.SByte.MinValue >> 10.0F", System.SByte.MinValue >> 10.0F)
PrintResult("System.SByte.MinValue >> -11.0R", System.SByte.MinValue >> -11.0R)
PrintResult("System.SByte.MinValue >> ""12""", System.SByte.MinValue >> "12")
PrintResult("System.SByte.MinValue >> TypeCode.Double", System.SByte.MinValue >> TypeCode.Double)
PrintResult("System.Byte.MaxValue >> False", System.Byte.MaxValue >> False)
PrintResult("System.Byte.MaxValue >> True", System.Byte.MaxValue >> True)
PrintResult("System.Byte.MaxValue >> System.SByte.MinValue", System.Byte.MaxValue >> System.SByte.MinValue)
PrintResult("System.Byte.MaxValue >> System.Byte.MaxValue", System.Byte.MaxValue >> System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue >> -3S", System.Byte.MaxValue >> -3S)
PrintResult("System.Byte.MaxValue >> 24US", System.Byte.MaxValue >> 24US)
PrintResult("System.Byte.MaxValue >> -5I", System.Byte.MaxValue >> -5I)
PrintResult("System.Byte.MaxValue >> 26UI", System.Byte.MaxValue >> 26UI)
PrintResult("System.Byte.MaxValue >> -7L", System.Byte.MaxValue >> -7L)
PrintResult("System.Byte.MaxValue >> 28UL", System.Byte.MaxValue >> 28UL)
PrintResult("System.Byte.MaxValue >> -9D", System.Byte.MaxValue >> -9D)
PrintResult("System.Byte.MaxValue >> 10.0F", System.Byte.MaxValue >> 10.0F)
PrintResult("System.Byte.MaxValue >> -11.0R", System.Byte.MaxValue >> -11.0R)
PrintResult("System.Byte.MaxValue >> ""12""", System.Byte.MaxValue >> "12")
PrintResult("System.Byte.MaxValue >> TypeCode.Double", System.Byte.MaxValue >> TypeCode.Double)
PrintResult("-3S >> False", -3S >> False)
PrintResult("-3S >> True", -3S >> True)
PrintResult("-3S >> System.SByte.MinValue", -3S >> System.SByte.MinValue)
PrintResult("-3S >> System.Byte.MaxValue", -3S >> System.Byte.MaxValue)
PrintResult("-3S >> -3S", -3S >> -3S)
PrintResult("-3S >> 24US", -3S >> 24US)
PrintResult("-3S >> -5I", -3S >> -5I)
PrintResult("-3S >> 26UI", -3S >> 26UI)
PrintResult("-3S >> -7L", -3S >> -7L)
PrintResult("-3S >> 28UL", -3S >> 28UL)
PrintResult("-3S >> -9D", -3S >> -9D)
PrintResult("-3S >> 10.0F", -3S >> 10.0F)
PrintResult("-3S >> -11.0R", -3S >> -11.0R)
PrintResult("-3S >> ""12""", -3S >> "12")
PrintResult("-3S >> TypeCode.Double", -3S >> TypeCode.Double)
PrintResult("24US >> False", 24US >> False)
PrintResult("24US >> True", 24US >> True)
PrintResult("24US >> System.SByte.MinValue", 24US >> System.SByte.MinValue)
PrintResult("24US >> System.Byte.MaxValue", 24US >> System.Byte.MaxValue)
PrintResult("24US >> -3S", 24US >> -3S)
PrintResult("24US >> 24US", 24US >> 24US)
PrintResult("24US >> -5I", 24US >> -5I)
PrintResult("24US >> 26UI", 24US >> 26UI)
PrintResult("24US >> -7L", 24US >> -7L)
PrintResult("24US >> 28UL", 24US >> 28UL)
PrintResult("24US >> -9D", 24US >> -9D)
PrintResult("24US >> 10.0F", 24US >> 10.0F)
PrintResult("24US >> -11.0R", 24US >> -11.0R)
PrintResult("24US >> ""12""", 24US >> "12")
PrintResult("24US >> TypeCode.Double", 24US >> TypeCode.Double)
PrintResult("-5I >> False", -5I >> False)
PrintResult("-5I >> True", -5I >> True)
PrintResult("-5I >> System.SByte.MinValue", -5I >> System.SByte.MinValue)
PrintResult("-5I >> System.Byte.MaxValue", -5I >> System.Byte.MaxValue)
PrintResult("-5I >> -3S", -5I >> -3S)
PrintResult("-5I >> 24US", -5I >> 24US)
PrintResult("-5I >> -5I", -5I >> -5I)
PrintResult("-5I >> 26UI", -5I >> 26UI)
PrintResult("-5I >> -7L", -5I >> -7L)
PrintResult("-5I >> 28UL", -5I >> 28UL)
PrintResult("-5I >> -9D", -5I >> -9D)
PrintResult("-5I >> 10.0F", -5I >> 10.0F)
PrintResult("-5I >> -11.0R", -5I >> -11.0R)
PrintResult("-5I >> ""12""", -5I >> "12")
PrintResult("-5I >> TypeCode.Double", -5I >> TypeCode.Double)
PrintResult("26UI >> False", 26UI >> False)
PrintResult("26UI >> True", 26UI >> True)
PrintResult("26UI >> System.SByte.MinValue", 26UI >> System.SByte.MinValue)
PrintResult("26UI >> System.Byte.MaxValue", 26UI >> System.Byte.MaxValue)
PrintResult("26UI >> -3S", 26UI >> -3S)
PrintResult("26UI >> 24US", 26UI >> 24US)
PrintResult("26UI >> -5I", 26UI >> -5I)
PrintResult("26UI >> 26UI", 26UI >> 26UI)
PrintResult("26UI >> -7L", 26UI >> -7L)
PrintResult("26UI >> 28UL", 26UI >> 28UL)
PrintResult("26UI >> -9D", 26UI >> -9D)
PrintResult("26UI >> 10.0F", 26UI >> 10.0F)
PrintResult("26UI >> -11.0R", 26UI >> -11.0R)
PrintResult("26UI >> ""12""", 26UI >> "12")
PrintResult("26UI >> TypeCode.Double", 26UI >> TypeCode.Double)
PrintResult("-7L >> False", -7L >> False)
PrintResult("-7L >> True", -7L >> True)
PrintResult("-7L >> System.SByte.MinValue", -7L >> System.SByte.MinValue)
PrintResult("-7L >> System.Byte.MaxValue", -7L >> System.Byte.MaxValue)
PrintResult("-7L >> -3S", -7L >> -3S)
PrintResult("-7L >> 24US", -7L >> 24US)
PrintResult("-7L >> -5I", -7L >> -5I)
PrintResult("-7L >> 26UI", -7L >> 26UI)
PrintResult("-7L >> -7L", -7L >> -7L)
PrintResult("-7L >> 28UL", -7L >> 28UL)
PrintResult("-7L >> -9D", -7L >> -9D)
PrintResult("-7L >> 10.0F", -7L >> 10.0F)
PrintResult("-7L >> -11.0R", -7L >> -11.0R)
PrintResult("-7L >> ""12""", -7L >> "12")
PrintResult("-7L >> TypeCode.Double", -7L >> TypeCode.Double)
PrintResult("28UL >> False", 28UL >> False)
PrintResult("28UL >> True", 28UL >> True)
PrintResult("28UL >> System.SByte.MinValue", 28UL >> System.SByte.MinValue)
PrintResult("28UL >> System.Byte.MaxValue", 28UL >> System.Byte.MaxValue)
PrintResult("28UL >> -3S", 28UL >> -3S)
PrintResult("28UL >> 24US", 28UL >> 24US)
PrintResult("28UL >> -5I", 28UL >> -5I)
PrintResult("28UL >> 26UI", 28UL >> 26UI)
PrintResult("28UL >> -7L", 28UL >> -7L)
PrintResult("28UL >> 28UL", 28UL >> 28UL)
PrintResult("28UL >> -9D", 28UL >> -9D)
PrintResult("28UL >> 10.0F", 28UL >> 10.0F)
PrintResult("28UL >> -11.0R", 28UL >> -11.0R)
PrintResult("28UL >> ""12""", 28UL >> "12")
PrintResult("28UL >> TypeCode.Double", 28UL >> TypeCode.Double)
PrintResult("-9D >> False", -9D >> False)
PrintResult("-9D >> True", -9D >> True)
PrintResult("-9D >> System.SByte.MinValue", -9D >> System.SByte.MinValue)
PrintResult("-9D >> System.Byte.MaxValue", -9D >> System.Byte.MaxValue)
PrintResult("-9D >> -3S", -9D >> -3S)
PrintResult("-9D >> 24US", -9D >> 24US)
PrintResult("-9D >> -5I", -9D >> -5I)
PrintResult("-9D >> 26UI", -9D >> 26UI)
PrintResult("-9D >> -7L", -9D >> -7L)
PrintResult("-9D >> 28UL", -9D >> 28UL)
PrintResult("-9D >> -9D", -9D >> -9D)
PrintResult("-9D >> 10.0F", -9D >> 10.0F)
PrintResult("-9D >> -11.0R", -9D >> -11.0R)
PrintResult("-9D >> ""12""", -9D >> "12")
PrintResult("-9D >> TypeCode.Double", -9D >> TypeCode.Double)
PrintResult("10.0F >> False", 10.0F >> False)
PrintResult("10.0F >> True", 10.0F >> True)
PrintResult("10.0F >> System.SByte.MinValue", 10.0F >> System.SByte.MinValue)
PrintResult("10.0F >> System.Byte.MaxValue", 10.0F >> System.Byte.MaxValue)
PrintResult("10.0F >> -3S", 10.0F >> -3S)
PrintResult("10.0F >> 24US", 10.0F >> 24US)
PrintResult("10.0F >> -5I", 10.0F >> -5I)
PrintResult("10.0F >> 26UI", 10.0F >> 26UI)
PrintResult("10.0F >> -7L", 10.0F >> -7L)
PrintResult("10.0F >> 28UL", 10.0F >> 28UL)
PrintResult("10.0F >> -9D", 10.0F >> -9D)
PrintResult("10.0F >> 10.0F", 10.0F >> 10.0F)
PrintResult("10.0F >> -11.0R", 10.0F >> -11.0R)
PrintResult("10.0F >> ""12""", 10.0F >> "12")
PrintResult("10.0F >> TypeCode.Double", 10.0F >> TypeCode.Double)
PrintResult("-11.0R >> False", -11.0R >> False)
PrintResult("-11.0R >> True", -11.0R >> True)
PrintResult("-11.0R >> System.SByte.MinValue", -11.0R >> System.SByte.MinValue)
PrintResult("-11.0R >> System.Byte.MaxValue", -11.0R >> System.Byte.MaxValue)
PrintResult("-11.0R >> -3S", -11.0R >> -3S)
PrintResult("-11.0R >> 24US", -11.0R >> 24US)
PrintResult("-11.0R >> -5I", -11.0R >> -5I)
PrintResult("-11.0R >> 26UI", -11.0R >> 26UI)
PrintResult("-11.0R >> -7L", -11.0R >> -7L)
PrintResult("-11.0R >> 28UL", -11.0R >> 28UL)
PrintResult("-11.0R >> -9D", -11.0R >> -9D)
PrintResult("-11.0R >> 10.0F", -11.0R >> 10.0F)
PrintResult("-11.0R >> -11.0R", -11.0R >> -11.0R)
PrintResult("-11.0R >> ""12""", -11.0R >> "12")
PrintResult("-11.0R >> TypeCode.Double", -11.0R >> TypeCode.Double)
PrintResult("""12"" >> False", "12" >> False)
PrintResult("""12"" >> True", "12" >> True)
PrintResult("""12"" >> System.SByte.MinValue", "12" >> System.SByte.MinValue)
PrintResult("""12"" >> System.Byte.MaxValue", "12" >> System.Byte.MaxValue)
PrintResult("""12"" >> -3S", "12" >> -3S)
PrintResult("""12"" >> 24US", "12" >> 24US)
PrintResult("""12"" >> -5I", "12" >> -5I)
PrintResult("""12"" >> 26UI", "12" >> 26UI)
PrintResult("""12"" >> -7L", "12" >> -7L)
PrintResult("""12"" >> 28UL", "12" >> 28UL)
PrintResult("""12"" >> -9D", "12" >> -9D)
PrintResult("""12"" >> 10.0F", "12" >> 10.0F)
PrintResult("""12"" >> -11.0R", "12" >> -11.0R)
PrintResult("""12"" >> ""12""", "12" >> "12")
PrintResult("""12"" >> TypeCode.Double", "12" >> TypeCode.Double)
PrintResult("TypeCode.Double >> False", TypeCode.Double >> False)
PrintResult("TypeCode.Double >> True", TypeCode.Double >> True)
PrintResult("TypeCode.Double >> System.SByte.MinValue", TypeCode.Double >> System.SByte.MinValue)
PrintResult("TypeCode.Double >> System.Byte.MaxValue", TypeCode.Double >> System.Byte.MaxValue)
PrintResult("TypeCode.Double >> -3S", TypeCode.Double >> -3S)
PrintResult("TypeCode.Double >> 24US", TypeCode.Double >> 24US)
PrintResult("TypeCode.Double >> -5I", TypeCode.Double >> -5I)
PrintResult("TypeCode.Double >> 26UI", TypeCode.Double >> 26UI)
PrintResult("TypeCode.Double >> -7L", TypeCode.Double >> -7L)
PrintResult("TypeCode.Double >> 28UL", TypeCode.Double >> 28UL)
PrintResult("TypeCode.Double >> -9D", TypeCode.Double >> -9D)
PrintResult("TypeCode.Double >> 10.0F", TypeCode.Double >> 10.0F)
PrintResult("TypeCode.Double >> -11.0R", TypeCode.Double >> -11.0R)
PrintResult("TypeCode.Double >> ""12""", TypeCode.Double >> "12")
PrintResult("TypeCode.Double >> TypeCode.Double", TypeCode.Double >> TypeCode.Double)
PrintResult("False OrElse False", False OrElse False)
PrintResult("False OrElse True", False OrElse True)
PrintResult("False OrElse System.SByte.MinValue", False OrElse System.SByte.MinValue)
PrintResult("False OrElse System.Byte.MaxValue", False OrElse System.Byte.MaxValue)
PrintResult("False OrElse -3S", False OrElse -3S)
PrintResult("False OrElse 24US", False OrElse 24US)
PrintResult("False OrElse -5I", False OrElse -5I)
PrintResult("False OrElse 26UI", False OrElse 26UI)
PrintResult("False OrElse -7L", False OrElse -7L)
PrintResult("False OrElse 28UL", False OrElse 28UL)
PrintResult("False OrElse -9D", False OrElse -9D)
PrintResult("False OrElse 10.0F", False OrElse 10.0F)
PrintResult("False OrElse -11.0R", False OrElse -11.0R)
PrintResult("False OrElse ""12""", False OrElse "12")
PrintResult("False OrElse TypeCode.Double", False OrElse TypeCode.Double)
PrintResult("True OrElse False", True OrElse False)
PrintResult("True OrElse True", True OrElse True)
PrintResult("True OrElse System.SByte.MinValue", True OrElse System.SByte.MinValue)
PrintResult("True OrElse System.Byte.MaxValue", True OrElse System.Byte.MaxValue)
PrintResult("True OrElse -3S", True OrElse -3S)
PrintResult("True OrElse 24US", True OrElse 24US)
PrintResult("True OrElse -5I", True OrElse -5I)
PrintResult("True OrElse 26UI", True OrElse 26UI)
PrintResult("True OrElse -7L", True OrElse -7L)
PrintResult("True OrElse 28UL", True OrElse 28UL)
PrintResult("True OrElse -9D", True OrElse -9D)
PrintResult("True OrElse 10.0F", True OrElse 10.0F)
PrintResult("True OrElse -11.0R", True OrElse -11.0R)
PrintResult("True OrElse ""12""", True OrElse "12")
PrintResult("True OrElse TypeCode.Double", True OrElse TypeCode.Double)
PrintResult("System.SByte.MinValue OrElse False", System.SByte.MinValue OrElse False)
PrintResult("System.SByte.MinValue OrElse True", System.SByte.MinValue OrElse True)
PrintResult("System.SByte.MinValue OrElse System.SByte.MinValue", System.SByte.MinValue OrElse System.SByte.MinValue)
PrintResult("System.SByte.MinValue OrElse System.Byte.MaxValue", System.SByte.MinValue OrElse System.Byte.MaxValue)
PrintResult("System.SByte.MinValue OrElse -3S", System.SByte.MinValue OrElse -3S)
PrintResult("System.SByte.MinValue OrElse 24US", System.SByte.MinValue OrElse 24US)
PrintResult("System.SByte.MinValue OrElse -5I", System.SByte.MinValue OrElse -5I)
PrintResult("System.SByte.MinValue OrElse 26UI", System.SByte.MinValue OrElse 26UI)
PrintResult("System.SByte.MinValue OrElse -7L", System.SByte.MinValue OrElse -7L)
PrintResult("System.SByte.MinValue OrElse 28UL", System.SByte.MinValue OrElse 28UL)
PrintResult("System.SByte.MinValue OrElse -9D", System.SByte.MinValue OrElse -9D)
PrintResult("System.SByte.MinValue OrElse 10.0F", System.SByte.MinValue OrElse 10.0F)
PrintResult("System.SByte.MinValue OrElse -11.0R", System.SByte.MinValue OrElse -11.0R)
PrintResult("System.SByte.MinValue OrElse ""12""", System.SByte.MinValue OrElse "12")
PrintResult("System.SByte.MinValue OrElse TypeCode.Double", System.SByte.MinValue OrElse TypeCode.Double)
PrintResult("System.Byte.MaxValue OrElse False", System.Byte.MaxValue OrElse False)
PrintResult("System.Byte.MaxValue OrElse True", System.Byte.MaxValue OrElse True)
PrintResult("System.Byte.MaxValue OrElse System.SByte.MinValue", System.Byte.MaxValue OrElse System.SByte.MinValue)
PrintResult("System.Byte.MaxValue OrElse System.Byte.MaxValue", System.Byte.MaxValue OrElse System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue OrElse -3S", System.Byte.MaxValue OrElse -3S)
PrintResult("System.Byte.MaxValue OrElse 24US", System.Byte.MaxValue OrElse 24US)
PrintResult("System.Byte.MaxValue OrElse -5I", System.Byte.MaxValue OrElse -5I)
PrintResult("System.Byte.MaxValue OrElse 26UI", System.Byte.MaxValue OrElse 26UI)
PrintResult("System.Byte.MaxValue OrElse -7L", System.Byte.MaxValue OrElse -7L)
PrintResult("System.Byte.MaxValue OrElse 28UL", System.Byte.MaxValue OrElse 28UL)
PrintResult("System.Byte.MaxValue OrElse -9D", System.Byte.MaxValue OrElse -9D)
PrintResult("System.Byte.MaxValue OrElse 10.0F", System.Byte.MaxValue OrElse 10.0F)
PrintResult("System.Byte.MaxValue OrElse -11.0R", System.Byte.MaxValue OrElse -11.0R)
PrintResult("System.Byte.MaxValue OrElse ""12""", System.Byte.MaxValue OrElse "12")
PrintResult("System.Byte.MaxValue OrElse TypeCode.Double", System.Byte.MaxValue OrElse TypeCode.Double)
PrintResult("-3S OrElse False", -3S OrElse False)
PrintResult("-3S OrElse True", -3S OrElse True)
PrintResult("-3S OrElse System.SByte.MinValue", -3S OrElse System.SByte.MinValue)
PrintResult("-3S OrElse System.Byte.MaxValue", -3S OrElse System.Byte.MaxValue)
PrintResult("-3S OrElse -3S", -3S OrElse -3S)
PrintResult("-3S OrElse 24US", -3S OrElse 24US)
PrintResult("-3S OrElse -5I", -3S OrElse -5I)
PrintResult("-3S OrElse 26UI", -3S OrElse 26UI)
PrintResult("-3S OrElse -7L", -3S OrElse -7L)
PrintResult("-3S OrElse 28UL", -3S OrElse 28UL)
PrintResult("-3S OrElse -9D", -3S OrElse -9D)
PrintResult("-3S OrElse 10.0F", -3S OrElse 10.0F)
PrintResult("-3S OrElse -11.0R", -3S OrElse -11.0R)
PrintResult("-3S OrElse ""12""", -3S OrElse "12")
PrintResult("-3S OrElse TypeCode.Double", -3S OrElse TypeCode.Double)
PrintResult("24US OrElse False", 24US OrElse False)
PrintResult("24US OrElse True", 24US OrElse True)
PrintResult("24US OrElse System.SByte.MinValue", 24US OrElse System.SByte.MinValue)
PrintResult("24US OrElse System.Byte.MaxValue", 24US OrElse System.Byte.MaxValue)
PrintResult("24US OrElse -3S", 24US OrElse -3S)
PrintResult("24US OrElse 24US", 24US OrElse 24US)
PrintResult("24US OrElse -5I", 24US OrElse -5I)
PrintResult("24US OrElse 26UI", 24US OrElse 26UI)
PrintResult("24US OrElse -7L", 24US OrElse -7L)
PrintResult("24US OrElse 28UL", 24US OrElse 28UL)
PrintResult("24US OrElse -9D", 24US OrElse -9D)
PrintResult("24US OrElse 10.0F", 24US OrElse 10.0F)
PrintResult("24US OrElse -11.0R", 24US OrElse -11.0R)
PrintResult("24US OrElse ""12""", 24US OrElse "12")
PrintResult("24US OrElse TypeCode.Double", 24US OrElse TypeCode.Double)
PrintResult("-5I OrElse False", -5I OrElse False)
PrintResult("-5I OrElse True", -5I OrElse True)
PrintResult("-5I OrElse System.SByte.MinValue", -5I OrElse System.SByte.MinValue)
PrintResult("-5I OrElse System.Byte.MaxValue", -5I OrElse System.Byte.MaxValue)
PrintResult("-5I OrElse -3S", -5I OrElse -3S)
PrintResult("-5I OrElse 24US", -5I OrElse 24US)
PrintResult("-5I OrElse -5I", -5I OrElse -5I)
PrintResult("-5I OrElse 26UI", -5I OrElse 26UI)
PrintResult("-5I OrElse -7L", -5I OrElse -7L)
PrintResult("-5I OrElse 28UL", -5I OrElse 28UL)
PrintResult("-5I OrElse -9D", -5I OrElse -9D)
PrintResult("-5I OrElse 10.0F", -5I OrElse 10.0F)
PrintResult("-5I OrElse -11.0R", -5I OrElse -11.0R)
PrintResult("-5I OrElse ""12""", -5I OrElse "12")
PrintResult("-5I OrElse TypeCode.Double", -5I OrElse TypeCode.Double)
PrintResult("26UI OrElse False", 26UI OrElse False)
PrintResult("26UI OrElse True", 26UI OrElse True)
PrintResult("26UI OrElse System.SByte.MinValue", 26UI OrElse System.SByte.MinValue)
PrintResult("26UI OrElse System.Byte.MaxValue", 26UI OrElse System.Byte.MaxValue)
PrintResult("26UI OrElse -3S", 26UI OrElse -3S)
PrintResult("26UI OrElse 24US", 26UI OrElse 24US)
PrintResult("26UI OrElse -5I", 26UI OrElse -5I)
PrintResult("26UI OrElse 26UI", 26UI OrElse 26UI)
PrintResult("26UI OrElse -7L", 26UI OrElse -7L)
PrintResult("26UI OrElse 28UL", 26UI OrElse 28UL)
PrintResult("26UI OrElse -9D", 26UI OrElse -9D)
PrintResult("26UI OrElse 10.0F", 26UI OrElse 10.0F)
PrintResult("26UI OrElse -11.0R", 26UI OrElse -11.0R)
PrintResult("26UI OrElse ""12""", 26UI OrElse "12")
PrintResult("26UI OrElse TypeCode.Double", 26UI OrElse TypeCode.Double)
PrintResult("-7L OrElse False", -7L OrElse False)
PrintResult("-7L OrElse True", -7L OrElse True)
PrintResult("-7L OrElse System.SByte.MinValue", -7L OrElse System.SByte.MinValue)
PrintResult("-7L OrElse System.Byte.MaxValue", -7L OrElse System.Byte.MaxValue)
PrintResult("-7L OrElse -3S", -7L OrElse -3S)
PrintResult("-7L OrElse 24US", -7L OrElse 24US)
PrintResult("-7L OrElse -5I", -7L OrElse -5I)
PrintResult("-7L OrElse 26UI", -7L OrElse 26UI)
PrintResult("-7L OrElse -7L", -7L OrElse -7L)
PrintResult("-7L OrElse 28UL", -7L OrElse 28UL)
PrintResult("-7L OrElse -9D", -7L OrElse -9D)
PrintResult("-7L OrElse 10.0F", -7L OrElse 10.0F)
PrintResult("-7L OrElse -11.0R", -7L OrElse -11.0R)
PrintResult("-7L OrElse ""12""", -7L OrElse "12")
PrintResult("-7L OrElse TypeCode.Double", -7L OrElse TypeCode.Double)
PrintResult("28UL OrElse False", 28UL OrElse False)
PrintResult("28UL OrElse True", 28UL OrElse True)
PrintResult("28UL OrElse System.SByte.MinValue", 28UL OrElse System.SByte.MinValue)
PrintResult("28UL OrElse System.Byte.MaxValue", 28UL OrElse System.Byte.MaxValue)
PrintResult("28UL OrElse -3S", 28UL OrElse -3S)
PrintResult("28UL OrElse 24US", 28UL OrElse 24US)
PrintResult("28UL OrElse -5I", 28UL OrElse -5I)
PrintResult("28UL OrElse 26UI", 28UL OrElse 26UI)
PrintResult("28UL OrElse -7L", 28UL OrElse -7L)
PrintResult("28UL OrElse 28UL", 28UL OrElse 28UL)
PrintResult("28UL OrElse -9D", 28UL OrElse -9D)
PrintResult("28UL OrElse 10.0F", 28UL OrElse 10.0F)
PrintResult("28UL OrElse -11.0R", 28UL OrElse -11.0R)
PrintResult("28UL OrElse ""12""", 28UL OrElse "12")
PrintResult("28UL OrElse TypeCode.Double", 28UL OrElse TypeCode.Double)
PrintResult("-9D OrElse False", -9D OrElse False)
PrintResult("-9D OrElse True", -9D OrElse True)
PrintResult("-9D OrElse System.SByte.MinValue", -9D OrElse System.SByte.MinValue)
PrintResult("-9D OrElse System.Byte.MaxValue", -9D OrElse System.Byte.MaxValue)
PrintResult("-9D OrElse -3S", -9D OrElse -3S)
PrintResult("-9D OrElse 24US", -9D OrElse 24US)
PrintResult("-9D OrElse -5I", -9D OrElse -5I)
PrintResult("-9D OrElse 26UI", -9D OrElse 26UI)
PrintResult("-9D OrElse -7L", -9D OrElse -7L)
PrintResult("-9D OrElse 28UL", -9D OrElse 28UL)
PrintResult("-9D OrElse -9D", -9D OrElse -9D)
PrintResult("-9D OrElse 10.0F", -9D OrElse 10.0F)
PrintResult("-9D OrElse -11.0R", -9D OrElse -11.0R)
PrintResult("-9D OrElse ""12""", -9D OrElse "12")
PrintResult("-9D OrElse TypeCode.Double", -9D OrElse TypeCode.Double)
PrintResult("10.0F OrElse False", 10.0F OrElse False)
PrintResult("10.0F OrElse True", 10.0F OrElse True)
PrintResult("10.0F OrElse System.SByte.MinValue", 10.0F OrElse System.SByte.MinValue)
PrintResult("10.0F OrElse System.Byte.MaxValue", 10.0F OrElse System.Byte.MaxValue)
PrintResult("10.0F OrElse -3S", 10.0F OrElse -3S)
PrintResult("10.0F OrElse 24US", 10.0F OrElse 24US)
PrintResult("10.0F OrElse -5I", 10.0F OrElse -5I)
PrintResult("10.0F OrElse 26UI", 10.0F OrElse 26UI)
PrintResult("10.0F OrElse -7L", 10.0F OrElse -7L)
PrintResult("10.0F OrElse 28UL", 10.0F OrElse 28UL)
PrintResult("10.0F OrElse -9D", 10.0F OrElse -9D)
PrintResult("10.0F OrElse 10.0F", 10.0F OrElse 10.0F)
PrintResult("10.0F OrElse -11.0R", 10.0F OrElse -11.0R)
PrintResult("10.0F OrElse ""12""", 10.0F OrElse "12")
PrintResult("10.0F OrElse TypeCode.Double", 10.0F OrElse TypeCode.Double)
PrintResult("-11.0R OrElse False", -11.0R OrElse False)
PrintResult("-11.0R OrElse True", -11.0R OrElse True)
PrintResult("-11.0R OrElse System.SByte.MinValue", -11.0R OrElse System.SByte.MinValue)
PrintResult("-11.0R OrElse System.Byte.MaxValue", -11.0R OrElse System.Byte.MaxValue)
PrintResult("-11.0R OrElse -3S", -11.0R OrElse -3S)
PrintResult("-11.0R OrElse 24US", -11.0R OrElse 24US)
PrintResult("-11.0R OrElse -5I", -11.0R OrElse -5I)
PrintResult("-11.0R OrElse 26UI", -11.0R OrElse 26UI)
PrintResult("-11.0R OrElse -7L", -11.0R OrElse -7L)
PrintResult("-11.0R OrElse 28UL", -11.0R OrElse 28UL)
PrintResult("-11.0R OrElse -9D", -11.0R OrElse -9D)
PrintResult("-11.0R OrElse 10.0F", -11.0R OrElse 10.0F)
PrintResult("-11.0R OrElse -11.0R", -11.0R OrElse -11.0R)
PrintResult("-11.0R OrElse ""12""", -11.0R OrElse "12")
PrintResult("-11.0R OrElse TypeCode.Double", -11.0R OrElse TypeCode.Double)
PrintResult("""12"" OrElse False", "12" OrElse False)
PrintResult("""12"" OrElse True", "12" OrElse True)
PrintResult("""12"" OrElse System.SByte.MinValue", "12" OrElse System.SByte.MinValue)
PrintResult("""12"" OrElse System.Byte.MaxValue", "12" OrElse System.Byte.MaxValue)
PrintResult("""12"" OrElse -3S", "12" OrElse -3S)
PrintResult("""12"" OrElse 24US", "12" OrElse 24US)
PrintResult("""12"" OrElse -5I", "12" OrElse -5I)
PrintResult("""12"" OrElse 26UI", "12" OrElse 26UI)
PrintResult("""12"" OrElse -7L", "12" OrElse -7L)
PrintResult("""12"" OrElse 28UL", "12" OrElse 28UL)
PrintResult("""12"" OrElse -9D", "12" OrElse -9D)
PrintResult("""12"" OrElse 10.0F", "12" OrElse 10.0F)
PrintResult("""12"" OrElse -11.0R", "12" OrElse -11.0R)
PrintResult("""12"" OrElse ""12""", "12" OrElse "12")
PrintResult("""12"" OrElse TypeCode.Double", "12" OrElse TypeCode.Double)
PrintResult("TypeCode.Double OrElse False", TypeCode.Double OrElse False)
PrintResult("TypeCode.Double OrElse True", TypeCode.Double OrElse True)
PrintResult("TypeCode.Double OrElse System.SByte.MinValue", TypeCode.Double OrElse System.SByte.MinValue)
PrintResult("TypeCode.Double OrElse System.Byte.MaxValue", TypeCode.Double OrElse System.Byte.MaxValue)
PrintResult("TypeCode.Double OrElse -3S", TypeCode.Double OrElse -3S)
PrintResult("TypeCode.Double OrElse 24US", TypeCode.Double OrElse 24US)
PrintResult("TypeCode.Double OrElse -5I", TypeCode.Double OrElse -5I)
PrintResult("TypeCode.Double OrElse 26UI", TypeCode.Double OrElse 26UI)
PrintResult("TypeCode.Double OrElse -7L", TypeCode.Double OrElse -7L)
PrintResult("TypeCode.Double OrElse 28UL", TypeCode.Double OrElse 28UL)
PrintResult("TypeCode.Double OrElse -9D", TypeCode.Double OrElse -9D)
PrintResult("TypeCode.Double OrElse 10.0F", TypeCode.Double OrElse 10.0F)
PrintResult("TypeCode.Double OrElse -11.0R", TypeCode.Double OrElse -11.0R)
PrintResult("TypeCode.Double OrElse ""12""", TypeCode.Double OrElse "12")
PrintResult("TypeCode.Double OrElse TypeCode.Double", TypeCode.Double OrElse TypeCode.Double)
PrintResult("False AndAlso False", False AndAlso False)
PrintResult("False AndAlso True", False AndAlso True)
PrintResult("False AndAlso System.SByte.MinValue", False AndAlso System.SByte.MinValue)
PrintResult("False AndAlso System.Byte.MaxValue", False AndAlso System.Byte.MaxValue)
PrintResult("False AndAlso -3S", False AndAlso -3S)
PrintResult("False AndAlso 24US", False AndAlso 24US)
PrintResult("False AndAlso -5I", False AndAlso -5I)
PrintResult("False AndAlso 26UI", False AndAlso 26UI)
PrintResult("False AndAlso -7L", False AndAlso -7L)
PrintResult("False AndAlso 28UL", False AndAlso 28UL)
PrintResult("False AndAlso -9D", False AndAlso -9D)
PrintResult("False AndAlso 10.0F", False AndAlso 10.0F)
PrintResult("False AndAlso -11.0R", False AndAlso -11.0R)
PrintResult("False AndAlso ""12""", False AndAlso "12")
PrintResult("False AndAlso TypeCode.Double", False AndAlso TypeCode.Double)
PrintResult("True AndAlso False", True AndAlso False)
PrintResult("True AndAlso True", True AndAlso True)
PrintResult("True AndAlso System.SByte.MinValue", True AndAlso System.SByte.MinValue)
PrintResult("True AndAlso System.Byte.MaxValue", True AndAlso System.Byte.MaxValue)
PrintResult("True AndAlso -3S", True AndAlso -3S)
PrintResult("True AndAlso 24US", True AndAlso 24US)
PrintResult("True AndAlso -5I", True AndAlso -5I)
PrintResult("True AndAlso 26UI", True AndAlso 26UI)
PrintResult("True AndAlso -7L", True AndAlso -7L)
PrintResult("True AndAlso 28UL", True AndAlso 28UL)
PrintResult("True AndAlso -9D", True AndAlso -9D)
PrintResult("True AndAlso 10.0F", True AndAlso 10.0F)
PrintResult("True AndAlso -11.0R", True AndAlso -11.0R)
PrintResult("True AndAlso ""12""", True AndAlso "12")
PrintResult("True AndAlso TypeCode.Double", True AndAlso TypeCode.Double)
PrintResult("System.SByte.MinValue AndAlso False", System.SByte.MinValue AndAlso False)
PrintResult("System.SByte.MinValue AndAlso True", System.SByte.MinValue AndAlso True)
PrintResult("System.SByte.MinValue AndAlso System.SByte.MinValue", System.SByte.MinValue AndAlso System.SByte.MinValue)
PrintResult("System.SByte.MinValue AndAlso System.Byte.MaxValue", System.SByte.MinValue AndAlso System.Byte.MaxValue)
PrintResult("System.SByte.MinValue AndAlso -3S", System.SByte.MinValue AndAlso -3S)
PrintResult("System.SByte.MinValue AndAlso 24US", System.SByte.MinValue AndAlso 24US)
PrintResult("System.SByte.MinValue AndAlso -5I", System.SByte.MinValue AndAlso -5I)
PrintResult("System.SByte.MinValue AndAlso 26UI", System.SByte.MinValue AndAlso 26UI)
PrintResult("System.SByte.MinValue AndAlso -7L", System.SByte.MinValue AndAlso -7L)
PrintResult("System.SByte.MinValue AndAlso 28UL", System.SByte.MinValue AndAlso 28UL)
PrintResult("System.SByte.MinValue AndAlso -9D", System.SByte.MinValue AndAlso -9D)
PrintResult("System.SByte.MinValue AndAlso 10.0F", System.SByte.MinValue AndAlso 10.0F)
PrintResult("System.SByte.MinValue AndAlso -11.0R", System.SByte.MinValue AndAlso -11.0R)
PrintResult("System.SByte.MinValue AndAlso ""12""", System.SByte.MinValue AndAlso "12")
PrintResult("System.SByte.MinValue AndAlso TypeCode.Double", System.SByte.MinValue AndAlso TypeCode.Double)
PrintResult("System.Byte.MaxValue AndAlso False", System.Byte.MaxValue AndAlso False)
PrintResult("System.Byte.MaxValue AndAlso True", System.Byte.MaxValue AndAlso True)
PrintResult("System.Byte.MaxValue AndAlso System.SByte.MinValue", System.Byte.MaxValue AndAlso System.SByte.MinValue)
PrintResult("System.Byte.MaxValue AndAlso System.Byte.MaxValue", System.Byte.MaxValue AndAlso System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue AndAlso -3S", System.Byte.MaxValue AndAlso -3S)
PrintResult("System.Byte.MaxValue AndAlso 24US", System.Byte.MaxValue AndAlso 24US)
PrintResult("System.Byte.MaxValue AndAlso -5I", System.Byte.MaxValue AndAlso -5I)
PrintResult("System.Byte.MaxValue AndAlso 26UI", System.Byte.MaxValue AndAlso 26UI)
PrintResult("System.Byte.MaxValue AndAlso -7L", System.Byte.MaxValue AndAlso -7L)
PrintResult("System.Byte.MaxValue AndAlso 28UL", System.Byte.MaxValue AndAlso 28UL)
PrintResult("System.Byte.MaxValue AndAlso -9D", System.Byte.MaxValue AndAlso -9D)
PrintResult("System.Byte.MaxValue AndAlso 10.0F", System.Byte.MaxValue AndAlso 10.0F)
PrintResult("System.Byte.MaxValue AndAlso -11.0R", System.Byte.MaxValue AndAlso -11.0R)
PrintResult("System.Byte.MaxValue AndAlso ""12""", System.Byte.MaxValue AndAlso "12")
PrintResult("System.Byte.MaxValue AndAlso TypeCode.Double", System.Byte.MaxValue AndAlso TypeCode.Double)
PrintResult("-3S AndAlso False", -3S AndAlso False)
PrintResult("-3S AndAlso True", -3S AndAlso True)
PrintResult("-3S AndAlso System.SByte.MinValue", -3S AndAlso System.SByte.MinValue)
PrintResult("-3S AndAlso System.Byte.MaxValue", -3S AndAlso System.Byte.MaxValue)
PrintResult("-3S AndAlso -3S", -3S AndAlso -3S)
PrintResult("-3S AndAlso 24US", -3S AndAlso 24US)
PrintResult("-3S AndAlso -5I", -3S AndAlso -5I)
PrintResult("-3S AndAlso 26UI", -3S AndAlso 26UI)
PrintResult("-3S AndAlso -7L", -3S AndAlso -7L)
PrintResult("-3S AndAlso 28UL", -3S AndAlso 28UL)
PrintResult("-3S AndAlso -9D", -3S AndAlso -9D)
PrintResult("-3S AndAlso 10.0F", -3S AndAlso 10.0F)
PrintResult("-3S AndAlso -11.0R", -3S AndAlso -11.0R)
PrintResult("-3S AndAlso ""12""", -3S AndAlso "12")
PrintResult("-3S AndAlso TypeCode.Double", -3S AndAlso TypeCode.Double)
PrintResult("24US AndAlso False", 24US AndAlso False)
PrintResult("24US AndAlso True", 24US AndAlso True)
PrintResult("24US AndAlso System.SByte.MinValue", 24US AndAlso System.SByte.MinValue)
PrintResult("24US AndAlso System.Byte.MaxValue", 24US AndAlso System.Byte.MaxValue)
PrintResult("24US AndAlso -3S", 24US AndAlso -3S)
PrintResult("24US AndAlso 24US", 24US AndAlso 24US)
PrintResult("24US AndAlso -5I", 24US AndAlso -5I)
PrintResult("24US AndAlso 26UI", 24US AndAlso 26UI)
PrintResult("24US AndAlso -7L", 24US AndAlso -7L)
PrintResult("24US AndAlso 28UL", 24US AndAlso 28UL)
PrintResult("24US AndAlso -9D", 24US AndAlso -9D)
PrintResult("24US AndAlso 10.0F", 24US AndAlso 10.0F)
PrintResult("24US AndAlso -11.0R", 24US AndAlso -11.0R)
PrintResult("24US AndAlso ""12""", 24US AndAlso "12")
PrintResult("24US AndAlso TypeCode.Double", 24US AndAlso TypeCode.Double)
PrintResult("-5I AndAlso False", -5I AndAlso False)
PrintResult("-5I AndAlso True", -5I AndAlso True)
PrintResult("-5I AndAlso System.SByte.MinValue", -5I AndAlso System.SByte.MinValue)
PrintResult("-5I AndAlso System.Byte.MaxValue", -5I AndAlso System.Byte.MaxValue)
PrintResult("-5I AndAlso -3S", -5I AndAlso -3S)
PrintResult("-5I AndAlso 24US", -5I AndAlso 24US)
PrintResult("-5I AndAlso -5I", -5I AndAlso -5I)
PrintResult("-5I AndAlso 26UI", -5I AndAlso 26UI)
PrintResult("-5I AndAlso -7L", -5I AndAlso -7L)
PrintResult("-5I AndAlso 28UL", -5I AndAlso 28UL)
PrintResult("-5I AndAlso -9D", -5I AndAlso -9D)
PrintResult("-5I AndAlso 10.0F", -5I AndAlso 10.0F)
PrintResult("-5I AndAlso -11.0R", -5I AndAlso -11.0R)
PrintResult("-5I AndAlso ""12""", -5I AndAlso "12")
PrintResult("-5I AndAlso TypeCode.Double", -5I AndAlso TypeCode.Double)
PrintResult("26UI AndAlso False", 26UI AndAlso False)
PrintResult("26UI AndAlso True", 26UI AndAlso True)
PrintResult("26UI AndAlso System.SByte.MinValue", 26UI AndAlso System.SByte.MinValue)
PrintResult("26UI AndAlso System.Byte.MaxValue", 26UI AndAlso System.Byte.MaxValue)
PrintResult("26UI AndAlso -3S", 26UI AndAlso -3S)
PrintResult("26UI AndAlso 24US", 26UI AndAlso 24US)
PrintResult("26UI AndAlso -5I", 26UI AndAlso -5I)
PrintResult("26UI AndAlso 26UI", 26UI AndAlso 26UI)
PrintResult("26UI AndAlso -7L", 26UI AndAlso -7L)
PrintResult("26UI AndAlso 28UL", 26UI AndAlso 28UL)
PrintResult("26UI AndAlso -9D", 26UI AndAlso -9D)
PrintResult("26UI AndAlso 10.0F", 26UI AndAlso 10.0F)
PrintResult("26UI AndAlso -11.0R", 26UI AndAlso -11.0R)
PrintResult("26UI AndAlso ""12""", 26UI AndAlso "12")
PrintResult("26UI AndAlso TypeCode.Double", 26UI AndAlso TypeCode.Double)
PrintResult("-7L AndAlso False", -7L AndAlso False)
PrintResult("-7L AndAlso True", -7L AndAlso True)
PrintResult("-7L AndAlso System.SByte.MinValue", -7L AndAlso System.SByte.MinValue)
PrintResult("-7L AndAlso System.Byte.MaxValue", -7L AndAlso System.Byte.MaxValue)
PrintResult("-7L AndAlso -3S", -7L AndAlso -3S)
PrintResult("-7L AndAlso 24US", -7L AndAlso 24US)
PrintResult("-7L AndAlso -5I", -7L AndAlso -5I)
PrintResult("-7L AndAlso 26UI", -7L AndAlso 26UI)
PrintResult("-7L AndAlso -7L", -7L AndAlso -7L)
PrintResult("-7L AndAlso 28UL", -7L AndAlso 28UL)
PrintResult("-7L AndAlso -9D", -7L AndAlso -9D)
PrintResult("-7L AndAlso 10.0F", -7L AndAlso 10.0F)
PrintResult("-7L AndAlso -11.0R", -7L AndAlso -11.0R)
PrintResult("-7L AndAlso ""12""", -7L AndAlso "12")
PrintResult("-7L AndAlso TypeCode.Double", -7L AndAlso TypeCode.Double)
PrintResult("28UL AndAlso False", 28UL AndAlso False)
PrintResult("28UL AndAlso True", 28UL AndAlso True)
PrintResult("28UL AndAlso System.SByte.MinValue", 28UL AndAlso System.SByte.MinValue)
PrintResult("28UL AndAlso System.Byte.MaxValue", 28UL AndAlso System.Byte.MaxValue)
PrintResult("28UL AndAlso -3S", 28UL AndAlso -3S)
PrintResult("28UL AndAlso 24US", 28UL AndAlso 24US)
PrintResult("28UL AndAlso -5I", 28UL AndAlso -5I)
PrintResult("28UL AndAlso 26UI", 28UL AndAlso 26UI)
PrintResult("28UL AndAlso -7L", 28UL AndAlso -7L)
PrintResult("28UL AndAlso 28UL", 28UL AndAlso 28UL)
PrintResult("28UL AndAlso -9D", 28UL AndAlso -9D)
PrintResult("28UL AndAlso 10.0F", 28UL AndAlso 10.0F)
PrintResult("28UL AndAlso -11.0R", 28UL AndAlso -11.0R)
PrintResult("28UL AndAlso ""12""", 28UL AndAlso "12")
PrintResult("28UL AndAlso TypeCode.Double", 28UL AndAlso TypeCode.Double)
PrintResult("-9D AndAlso False", -9D AndAlso False)
PrintResult("-9D AndAlso True", -9D AndAlso True)
PrintResult("-9D AndAlso System.SByte.MinValue", -9D AndAlso System.SByte.MinValue)
PrintResult("-9D AndAlso System.Byte.MaxValue", -9D AndAlso System.Byte.MaxValue)
PrintResult("-9D AndAlso -3S", -9D AndAlso -3S)
PrintResult("-9D AndAlso 24US", -9D AndAlso 24US)
PrintResult("-9D AndAlso -5I", -9D AndAlso -5I)
PrintResult("-9D AndAlso 26UI", -9D AndAlso 26UI)
PrintResult("-9D AndAlso -7L", -9D AndAlso -7L)
PrintResult("-9D AndAlso 28UL", -9D AndAlso 28UL)
PrintResult("-9D AndAlso -9D", -9D AndAlso -9D)
PrintResult("-9D AndAlso 10.0F", -9D AndAlso 10.0F)
PrintResult("-9D AndAlso -11.0R", -9D AndAlso -11.0R)
PrintResult("-9D AndAlso ""12""", -9D AndAlso "12")
PrintResult("-9D AndAlso TypeCode.Double", -9D AndAlso TypeCode.Double)
PrintResult("10.0F AndAlso False", 10.0F AndAlso False)
PrintResult("10.0F AndAlso True", 10.0F AndAlso True)
PrintResult("10.0F AndAlso System.SByte.MinValue", 10.0F AndAlso System.SByte.MinValue)
PrintResult("10.0F AndAlso System.Byte.MaxValue", 10.0F AndAlso System.Byte.MaxValue)
PrintResult("10.0F AndAlso -3S", 10.0F AndAlso -3S)
PrintResult("10.0F AndAlso 24US", 10.0F AndAlso 24US)
PrintResult("10.0F AndAlso -5I", 10.0F AndAlso -5I)
PrintResult("10.0F AndAlso 26UI", 10.0F AndAlso 26UI)
PrintResult("10.0F AndAlso -7L", 10.0F AndAlso -7L)
PrintResult("10.0F AndAlso 28UL", 10.0F AndAlso 28UL)
PrintResult("10.0F AndAlso -9D", 10.0F AndAlso -9D)
PrintResult("10.0F AndAlso 10.0F", 10.0F AndAlso 10.0F)
PrintResult("10.0F AndAlso -11.0R", 10.0F AndAlso -11.0R)
PrintResult("10.0F AndAlso ""12""", 10.0F AndAlso "12")
PrintResult("10.0F AndAlso TypeCode.Double", 10.0F AndAlso TypeCode.Double)
PrintResult("-11.0R AndAlso False", -11.0R AndAlso False)
PrintResult("-11.0R AndAlso True", -11.0R AndAlso True)
PrintResult("-11.0R AndAlso System.SByte.MinValue", -11.0R AndAlso System.SByte.MinValue)
PrintResult("-11.0R AndAlso System.Byte.MaxValue", -11.0R AndAlso System.Byte.MaxValue)
PrintResult("-11.0R AndAlso -3S", -11.0R AndAlso -3S)
PrintResult("-11.0R AndAlso 24US", -11.0R AndAlso 24US)
PrintResult("-11.0R AndAlso -5I", -11.0R AndAlso -5I)
PrintResult("-11.0R AndAlso 26UI", -11.0R AndAlso 26UI)
PrintResult("-11.0R AndAlso -7L", -11.0R AndAlso -7L)
PrintResult("-11.0R AndAlso 28UL", -11.0R AndAlso 28UL)
PrintResult("-11.0R AndAlso -9D", -11.0R AndAlso -9D)
PrintResult("-11.0R AndAlso 10.0F", -11.0R AndAlso 10.0F)
PrintResult("-11.0R AndAlso -11.0R", -11.0R AndAlso -11.0R)
PrintResult("-11.0R AndAlso ""12""", -11.0R AndAlso "12")
PrintResult("-11.0R AndAlso TypeCode.Double", -11.0R AndAlso TypeCode.Double)
PrintResult("""12"" AndAlso False", "12" AndAlso False)
PrintResult("""12"" AndAlso True", "12" AndAlso True)
PrintResult("""12"" AndAlso System.SByte.MinValue", "12" AndAlso System.SByte.MinValue)
PrintResult("""12"" AndAlso System.Byte.MaxValue", "12" AndAlso System.Byte.MaxValue)
PrintResult("""12"" AndAlso -3S", "12" AndAlso -3S)
PrintResult("""12"" AndAlso 24US", "12" AndAlso 24US)
PrintResult("""12"" AndAlso -5I", "12" AndAlso -5I)
PrintResult("""12"" AndAlso 26UI", "12" AndAlso 26UI)
PrintResult("""12"" AndAlso -7L", "12" AndAlso -7L)
PrintResult("""12"" AndAlso 28UL", "12" AndAlso 28UL)
PrintResult("""12"" AndAlso -9D", "12" AndAlso -9D)
PrintResult("""12"" AndAlso 10.0F", "12" AndAlso 10.0F)
PrintResult("""12"" AndAlso -11.0R", "12" AndAlso -11.0R)
PrintResult("""12"" AndAlso ""12""", "12" AndAlso "12")
PrintResult("""12"" AndAlso TypeCode.Double", "12" AndAlso TypeCode.Double)
PrintResult("TypeCode.Double AndAlso False", TypeCode.Double AndAlso False)
PrintResult("TypeCode.Double AndAlso True", TypeCode.Double AndAlso True)
PrintResult("TypeCode.Double AndAlso System.SByte.MinValue", TypeCode.Double AndAlso System.SByte.MinValue)
PrintResult("TypeCode.Double AndAlso System.Byte.MaxValue", TypeCode.Double AndAlso System.Byte.MaxValue)
PrintResult("TypeCode.Double AndAlso -3S", TypeCode.Double AndAlso -3S)
PrintResult("TypeCode.Double AndAlso 24US", TypeCode.Double AndAlso 24US)
PrintResult("TypeCode.Double AndAlso -5I", TypeCode.Double AndAlso -5I)
PrintResult("TypeCode.Double AndAlso 26UI", TypeCode.Double AndAlso 26UI)
PrintResult("TypeCode.Double AndAlso -7L", TypeCode.Double AndAlso -7L)
PrintResult("TypeCode.Double AndAlso 28UL", TypeCode.Double AndAlso 28UL)
PrintResult("TypeCode.Double AndAlso -9D", TypeCode.Double AndAlso -9D)
PrintResult("TypeCode.Double AndAlso 10.0F", TypeCode.Double AndAlso 10.0F)
PrintResult("TypeCode.Double AndAlso -11.0R", TypeCode.Double AndAlso -11.0R)
PrintResult("TypeCode.Double AndAlso ""12""", TypeCode.Double AndAlso "12")
PrintResult("TypeCode.Double AndAlso TypeCode.Double", TypeCode.Double AndAlso TypeCode.Double)
PrintResult("False & False", False & False)
PrintResult("False & True", False & True)
PrintResult("False & System.SByte.MinValue", False & System.SByte.MinValue)
PrintResult("False & System.Byte.MaxValue", False & System.Byte.MaxValue)
PrintResult("False & -3S", False & -3S)
PrintResult("False & 24US", False & 24US)
PrintResult("False & -5I", False & -5I)
PrintResult("False & 26UI", False & 26UI)
PrintResult("False & -7L", False & -7L)
PrintResult("False & 28UL", False & 28UL)
PrintResult("False & -9D", False & -9D)
PrintResult("False & 10.0F", False & 10.0F)
PrintResult("False & -11.0R", False & -11.0R)
PrintResult("False & ""12""", False & "12")
PrintResult("False & TypeCode.Double", False & TypeCode.Double)
PrintResult("True & False", True & False)
PrintResult("True & True", True & True)
PrintResult("True & System.SByte.MinValue", True & System.SByte.MinValue)
PrintResult("True & System.Byte.MaxValue", True & System.Byte.MaxValue)
PrintResult("True & -3S", True & -3S)
PrintResult("True & 24US", True & 24US)
PrintResult("True & -5I", True & -5I)
PrintResult("True & 26UI", True & 26UI)
PrintResult("True & -7L", True & -7L)
PrintResult("True & 28UL", True & 28UL)
PrintResult("True & -9D", True & -9D)
PrintResult("True & 10.0F", True & 10.0F)
PrintResult("True & -11.0R", True & -11.0R)
PrintResult("True & ""12""", True & "12")
PrintResult("True & TypeCode.Double", True & TypeCode.Double)
PrintResult("System.SByte.MinValue & False", System.SByte.MinValue & False)
PrintResult("System.SByte.MinValue & True", System.SByte.MinValue & True)
PrintResult("System.SByte.MinValue & System.SByte.MinValue", System.SByte.MinValue & System.SByte.MinValue)
PrintResult("System.SByte.MinValue & System.Byte.MaxValue", System.SByte.MinValue & System.Byte.MaxValue)
PrintResult("System.SByte.MinValue & -3S", System.SByte.MinValue & -3S)
PrintResult("System.SByte.MinValue & 24US", System.SByte.MinValue & 24US)
PrintResult("System.SByte.MinValue & -5I", System.SByte.MinValue & -5I)
PrintResult("System.SByte.MinValue & 26UI", System.SByte.MinValue & 26UI)
PrintResult("System.SByte.MinValue & -7L", System.SByte.MinValue & -7L)
PrintResult("System.SByte.MinValue & 28UL", System.SByte.MinValue & 28UL)
PrintResult("System.SByte.MinValue & -9D", System.SByte.MinValue & -9D)
PrintResult("System.SByte.MinValue & 10.0F", System.SByte.MinValue & 10.0F)
PrintResult("System.SByte.MinValue & -11.0R", System.SByte.MinValue & -11.0R)
PrintResult("System.SByte.MinValue & ""12""", System.SByte.MinValue & "12")
PrintResult("System.SByte.MinValue & TypeCode.Double", System.SByte.MinValue & TypeCode.Double)
PrintResult("System.Byte.MaxValue & False", System.Byte.MaxValue & False)
PrintResult("System.Byte.MaxValue & True", System.Byte.MaxValue & True)
PrintResult("System.Byte.MaxValue & System.SByte.MinValue", System.Byte.MaxValue & System.SByte.MinValue)
PrintResult("System.Byte.MaxValue & System.Byte.MaxValue", System.Byte.MaxValue & System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue & -3S", System.Byte.MaxValue & -3S)
PrintResult("System.Byte.MaxValue & 24US", System.Byte.MaxValue & 24US)
PrintResult("System.Byte.MaxValue & -5I", System.Byte.MaxValue & -5I)
PrintResult("System.Byte.MaxValue & 26UI", System.Byte.MaxValue & 26UI)
PrintResult("System.Byte.MaxValue & -7L", System.Byte.MaxValue & -7L)
PrintResult("System.Byte.MaxValue & 28UL", System.Byte.MaxValue & 28UL)
PrintResult("System.Byte.MaxValue & -9D", System.Byte.MaxValue & -9D)
PrintResult("System.Byte.MaxValue & 10.0F", System.Byte.MaxValue & 10.0F)
PrintResult("System.Byte.MaxValue & -11.0R", System.Byte.MaxValue & -11.0R)
PrintResult("System.Byte.MaxValue & ""12""", System.Byte.MaxValue & "12")
PrintResult("System.Byte.MaxValue & TypeCode.Double", System.Byte.MaxValue & TypeCode.Double)
PrintResult("-3S & False", -3S & False)
PrintResult("-3S & True", -3S & True)
PrintResult("-3S & System.SByte.MinValue", -3S & System.SByte.MinValue)
PrintResult("-3S & System.Byte.MaxValue", -3S & System.Byte.MaxValue)
PrintResult("-3S & -3S", -3S & -3S)
PrintResult("-3S & 24US", -3S & 24US)
PrintResult("-3S & -5I", -3S & -5I)
PrintResult("-3S & 26UI", -3S & 26UI)
PrintResult("-3S & -7L", -3S & -7L)
PrintResult("-3S & 28UL", -3S & 28UL)
PrintResult("-3S & -9D", -3S & -9D)
PrintResult("-3S & 10.0F", -3S & 10.0F)
PrintResult("-3S & -11.0R", -3S & -11.0R)
PrintResult("-3S & ""12""", -3S & "12")
PrintResult("-3S & TypeCode.Double", -3S & TypeCode.Double)
PrintResult("24US & False", 24US & False)
PrintResult("24US & True", 24US & True)
PrintResult("24US & System.SByte.MinValue", 24US & System.SByte.MinValue)
PrintResult("24US & System.Byte.MaxValue", 24US & System.Byte.MaxValue)
PrintResult("24US & -3S", 24US & -3S)
PrintResult("24US & 24US", 24US & 24US)
PrintResult("24US & -5I", 24US & -5I)
PrintResult("24US & 26UI", 24US & 26UI)
PrintResult("24US & -7L", 24US & -7L)
PrintResult("24US & 28UL", 24US & 28UL)
PrintResult("24US & -9D", 24US & -9D)
PrintResult("24US & 10.0F", 24US & 10.0F)
PrintResult("24US & -11.0R", 24US & -11.0R)
PrintResult("24US & ""12""", 24US & "12")
PrintResult("24US & TypeCode.Double", 24US & TypeCode.Double)
PrintResult("-5I & False", -5I & False)
PrintResult("-5I & True", -5I & True)
PrintResult("-5I & System.SByte.MinValue", -5I & System.SByte.MinValue)
PrintResult("-5I & System.Byte.MaxValue", -5I & System.Byte.MaxValue)
PrintResult("-5I & -3S", -5I & -3S)
PrintResult("-5I & 24US", -5I & 24US)
PrintResult("-5I & -5I", -5I & -5I)
PrintResult("-5I & 26UI", -5I & 26UI)
PrintResult("-5I & -7L", -5I & -7L)
PrintResult("-5I & 28UL", -5I & 28UL)
PrintResult("-5I & -9D", -5I & -9D)
PrintResult("-5I & 10.0F", -5I & 10.0F)
PrintResult("-5I & -11.0R", -5I & -11.0R)
PrintResult("-5I & ""12""", -5I & "12")
PrintResult("-5I & TypeCode.Double", -5I & TypeCode.Double)
PrintResult("26UI & False", 26UI & False)
PrintResult("26UI & True", 26UI & True)
PrintResult("26UI & System.SByte.MinValue", 26UI & System.SByte.MinValue)
PrintResult("26UI & System.Byte.MaxValue", 26UI & System.Byte.MaxValue)
PrintResult("26UI & -3S", 26UI & -3S)
PrintResult("26UI & 24US", 26UI & 24US)
PrintResult("26UI & -5I", 26UI & -5I)
PrintResult("26UI & 26UI", 26UI & 26UI)
PrintResult("26UI & -7L", 26UI & -7L)
PrintResult("26UI & 28UL", 26UI & 28UL)
PrintResult("26UI & -9D", 26UI & -9D)
PrintResult("26UI & 10.0F", 26UI & 10.0F)
PrintResult("26UI & -11.0R", 26UI & -11.0R)
PrintResult("26UI & ""12""", 26UI & "12")
PrintResult("26UI & TypeCode.Double", 26UI & TypeCode.Double)
PrintResult("-7L & False", -7L & False)
PrintResult("-7L & True", -7L & True)
PrintResult("-7L & System.SByte.MinValue", -7L & System.SByte.MinValue)
PrintResult("-7L & System.Byte.MaxValue", -7L & System.Byte.MaxValue)
PrintResult("-7L & -3S", -7L & -3S)
PrintResult("-7L & 24US", -7L & 24US)
PrintResult("-7L & -5I", -7L & -5I)
PrintResult("-7L & 26UI", -7L & 26UI)
PrintResult("-7L & -7L", -7L & -7L)
PrintResult("-7L & 28UL", -7L & 28UL)
PrintResult("-7L & -9D", -7L & -9D)
PrintResult("-7L & 10.0F", -7L & 10.0F)
PrintResult("-7L & -11.0R", -7L & -11.0R)
PrintResult("-7L & ""12""", -7L & "12")
PrintResult("-7L & TypeCode.Double", -7L & TypeCode.Double)
PrintResult("28UL & False", 28UL & False)
PrintResult("28UL & True", 28UL & True)
PrintResult("28UL & System.SByte.MinValue", 28UL & System.SByte.MinValue)
PrintResult("28UL & System.Byte.MaxValue", 28UL & System.Byte.MaxValue)
PrintResult("28UL & -3S", 28UL & -3S)
PrintResult("28UL & 24US", 28UL & 24US)
PrintResult("28UL & -5I", 28UL & -5I)
PrintResult("28UL & 26UI", 28UL & 26UI)
PrintResult("28UL & -7L", 28UL & -7L)
PrintResult("28UL & 28UL", 28UL & 28UL)
PrintResult("28UL & -9D", 28UL & -9D)
PrintResult("28UL & 10.0F", 28UL & 10.0F)
PrintResult("28UL & -11.0R", 28UL & -11.0R)
PrintResult("28UL & ""12""", 28UL & "12")
PrintResult("28UL & TypeCode.Double", 28UL & TypeCode.Double)
PrintResult("-9D & False", -9D & False)
PrintResult("-9D & True", -9D & True)
PrintResult("-9D & System.SByte.MinValue", -9D & System.SByte.MinValue)
PrintResult("-9D & System.Byte.MaxValue", -9D & System.Byte.MaxValue)
PrintResult("-9D & -3S", -9D & -3S)
PrintResult("-9D & 24US", -9D & 24US)
PrintResult("-9D & -5I", -9D & -5I)
PrintResult("-9D & 26UI", -9D & 26UI)
PrintResult("-9D & -7L", -9D & -7L)
PrintResult("-9D & 28UL", -9D & 28UL)
PrintResult("-9D & -9D", -9D & -9D)
PrintResult("-9D & 10.0F", -9D & 10.0F)
PrintResult("-9D & -11.0R", -9D & -11.0R)
PrintResult("-9D & ""12""", -9D & "12")
PrintResult("-9D & TypeCode.Double", -9D & TypeCode.Double)
PrintResult("10.0F & False", 10.0F & False)
PrintResult("10.0F & True", 10.0F & True)
PrintResult("10.0F & System.SByte.MinValue", 10.0F & System.SByte.MinValue)
PrintResult("10.0F & System.Byte.MaxValue", 10.0F & System.Byte.MaxValue)
PrintResult("10.0F & -3S", 10.0F & -3S)
PrintResult("10.0F & 24US", 10.0F & 24US)
PrintResult("10.0F & -5I", 10.0F & -5I)
PrintResult("10.0F & 26UI", 10.0F & 26UI)
PrintResult("10.0F & -7L", 10.0F & -7L)
PrintResult("10.0F & 28UL", 10.0F & 28UL)
PrintResult("10.0F & -9D", 10.0F & -9D)
PrintResult("10.0F & 10.0F", 10.0F & 10.0F)
PrintResult("10.0F & -11.0R", 10.0F & -11.0R)
PrintResult("10.0F & ""12""", 10.0F & "12")
PrintResult("10.0F & TypeCode.Double", 10.0F & TypeCode.Double)
PrintResult("-11.0R & False", -11.0R & False)
PrintResult("-11.0R & True", -11.0R & True)
PrintResult("-11.0R & System.SByte.MinValue", -11.0R & System.SByte.MinValue)
PrintResult("-11.0R & System.Byte.MaxValue", -11.0R & System.Byte.MaxValue)
PrintResult("-11.0R & -3S", -11.0R & -3S)
PrintResult("-11.0R & 24US", -11.0R & 24US)
PrintResult("-11.0R & -5I", -11.0R & -5I)
PrintResult("-11.0R & 26UI", -11.0R & 26UI)
PrintResult("-11.0R & -7L", -11.0R & -7L)
PrintResult("-11.0R & 28UL", -11.0R & 28UL)
PrintResult("-11.0R & -9D", -11.0R & -9D)
PrintResult("-11.0R & 10.0F", -11.0R & 10.0F)
PrintResult("-11.0R & -11.0R", -11.0R & -11.0R)
PrintResult("-11.0R & ""12""", -11.0R & "12")
PrintResult("-11.0R & TypeCode.Double", -11.0R & TypeCode.Double)
PrintResult("""12"" & False", "12" & False)
PrintResult("""12"" & True", "12" & True)
PrintResult("""12"" & System.SByte.MinValue", "12" & System.SByte.MinValue)
PrintResult("""12"" & System.Byte.MaxValue", "12" & System.Byte.MaxValue)
PrintResult("""12"" & -3S", "12" & -3S)
PrintResult("""12"" & 24US", "12" & 24US)
PrintResult("""12"" & -5I", "12" & -5I)
PrintResult("""12"" & 26UI", "12" & 26UI)
PrintResult("""12"" & -7L", "12" & -7L)
PrintResult("""12"" & 28UL", "12" & 28UL)
PrintResult("""12"" & -9D", "12" & -9D)
PrintResult("""12"" & 10.0F", "12" & 10.0F)
PrintResult("""12"" & -11.0R", "12" & -11.0R)
PrintResult("""12"" & ""12""", "12" & "12")
PrintResult("""12"" & TypeCode.Double", "12" & TypeCode.Double)
PrintResult("TypeCode.Double & False", TypeCode.Double & False)
PrintResult("TypeCode.Double & True", TypeCode.Double & True)
PrintResult("TypeCode.Double & System.SByte.MinValue", TypeCode.Double & System.SByte.MinValue)
PrintResult("TypeCode.Double & System.Byte.MaxValue", TypeCode.Double & System.Byte.MaxValue)
PrintResult("TypeCode.Double & -3S", TypeCode.Double & -3S)
PrintResult("TypeCode.Double & 24US", TypeCode.Double & 24US)
PrintResult("TypeCode.Double & -5I", TypeCode.Double & -5I)
PrintResult("TypeCode.Double & 26UI", TypeCode.Double & 26UI)
PrintResult("TypeCode.Double & -7L", TypeCode.Double & -7L)
PrintResult("TypeCode.Double & 28UL", TypeCode.Double & 28UL)
PrintResult("TypeCode.Double & -9D", TypeCode.Double & -9D)
PrintResult("TypeCode.Double & 10.0F", TypeCode.Double & 10.0F)
PrintResult("TypeCode.Double & -11.0R", TypeCode.Double & -11.0R)
PrintResult("TypeCode.Double & ""12""", TypeCode.Double & "12")
PrintResult("TypeCode.Double & TypeCode.Double", TypeCode.Double & TypeCode.Double)
PrintResult("False Like False", False Like False)
PrintResult("False Like True", False Like True)
PrintResult("False Like System.SByte.MinValue", False Like System.SByte.MinValue)
PrintResult("False Like System.Byte.MaxValue", False Like System.Byte.MaxValue)
PrintResult("False Like -3S", False Like -3S)
PrintResult("False Like 24US", False Like 24US)
PrintResult("False Like -5I", False Like -5I)
PrintResult("False Like 26UI", False Like 26UI)
PrintResult("False Like -7L", False Like -7L)
PrintResult("False Like 28UL", False Like 28UL)
PrintResult("False Like -9D", False Like -9D)
PrintResult("False Like 10.0F", False Like 10.0F)
PrintResult("False Like -11.0R", False Like -11.0R)
PrintResult("False Like ""12""", False Like "12")
PrintResult("False Like TypeCode.Double", False Like TypeCode.Double)
PrintResult("True Like False", True Like False)
PrintResult("True Like True", True Like True)
PrintResult("True Like System.SByte.MinValue", True Like System.SByte.MinValue)
PrintResult("True Like System.Byte.MaxValue", True Like System.Byte.MaxValue)
PrintResult("True Like -3S", True Like -3S)
PrintResult("True Like 24US", True Like 24US)
PrintResult("True Like -5I", True Like -5I)
PrintResult("True Like 26UI", True Like 26UI)
PrintResult("True Like -7L", True Like -7L)
PrintResult("True Like 28UL", True Like 28UL)
PrintResult("True Like -9D", True Like -9D)
PrintResult("True Like 10.0F", True Like 10.0F)
PrintResult("True Like -11.0R", True Like -11.0R)
PrintResult("True Like ""12""", True Like "12")
PrintResult("True Like TypeCode.Double", True Like TypeCode.Double)
PrintResult("System.SByte.MinValue Like False", System.SByte.MinValue Like False)
PrintResult("System.SByte.MinValue Like True", System.SByte.MinValue Like True)
PrintResult("System.SByte.MinValue Like System.SByte.MinValue", System.SByte.MinValue Like System.SByte.MinValue)
PrintResult("System.SByte.MinValue Like System.Byte.MaxValue", System.SByte.MinValue Like System.Byte.MaxValue)
PrintResult("System.SByte.MinValue Like -3S", System.SByte.MinValue Like -3S)
PrintResult("System.SByte.MinValue Like 24US", System.SByte.MinValue Like 24US)
PrintResult("System.SByte.MinValue Like -5I", System.SByte.MinValue Like -5I)
PrintResult("System.SByte.MinValue Like 26UI", System.SByte.MinValue Like 26UI)
PrintResult("System.SByte.MinValue Like -7L", System.SByte.MinValue Like -7L)
PrintResult("System.SByte.MinValue Like 28UL", System.SByte.MinValue Like 28UL)
PrintResult("System.SByte.MinValue Like -9D", System.SByte.MinValue Like -9D)
PrintResult("System.SByte.MinValue Like 10.0F", System.SByte.MinValue Like 10.0F)
PrintResult("System.SByte.MinValue Like -11.0R", System.SByte.MinValue Like -11.0R)
PrintResult("System.SByte.MinValue Like ""12""", System.SByte.MinValue Like "12")
PrintResult("System.SByte.MinValue Like TypeCode.Double", System.SByte.MinValue Like TypeCode.Double)
PrintResult("System.Byte.MaxValue Like False", System.Byte.MaxValue Like False)
PrintResult("System.Byte.MaxValue Like True", System.Byte.MaxValue Like True)
PrintResult("System.Byte.MaxValue Like System.SByte.MinValue", System.Byte.MaxValue Like System.SByte.MinValue)
PrintResult("System.Byte.MaxValue Like System.Byte.MaxValue", System.Byte.MaxValue Like System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue Like -3S", System.Byte.MaxValue Like -3S)
PrintResult("System.Byte.MaxValue Like 24US", System.Byte.MaxValue Like 24US)
PrintResult("System.Byte.MaxValue Like -5I", System.Byte.MaxValue Like -5I)
PrintResult("System.Byte.MaxValue Like 26UI", System.Byte.MaxValue Like 26UI)
PrintResult("System.Byte.MaxValue Like -7L", System.Byte.MaxValue Like -7L)
PrintResult("System.Byte.MaxValue Like 28UL", System.Byte.MaxValue Like 28UL)
PrintResult("System.Byte.MaxValue Like -9D", System.Byte.MaxValue Like -9D)
PrintResult("System.Byte.MaxValue Like 10.0F", System.Byte.MaxValue Like 10.0F)
PrintResult("System.Byte.MaxValue Like -11.0R", System.Byte.MaxValue Like -11.0R)
PrintResult("System.Byte.MaxValue Like ""12""", System.Byte.MaxValue Like "12")
PrintResult("System.Byte.MaxValue Like TypeCode.Double", System.Byte.MaxValue Like TypeCode.Double)
PrintResult("-3S Like False", -3S Like False)
PrintResult("-3S Like True", -3S Like True)
PrintResult("-3S Like System.SByte.MinValue", -3S Like System.SByte.MinValue)
PrintResult("-3S Like System.Byte.MaxValue", -3S Like System.Byte.MaxValue)
PrintResult("-3S Like -3S", -3S Like -3S)
PrintResult("-3S Like 24US", -3S Like 24US)
PrintResult("-3S Like -5I", -3S Like -5I)
PrintResult("-3S Like 26UI", -3S Like 26UI)
PrintResult("-3S Like -7L", -3S Like -7L)
PrintResult("-3S Like 28UL", -3S Like 28UL)
PrintResult("-3S Like -9D", -3S Like -9D)
PrintResult("-3S Like 10.0F", -3S Like 10.0F)
PrintResult("-3S Like -11.0R", -3S Like -11.0R)
PrintResult("-3S Like ""12""", -3S Like "12")
PrintResult("-3S Like TypeCode.Double", -3S Like TypeCode.Double)
PrintResult("24US Like False", 24US Like False)
PrintResult("24US Like True", 24US Like True)
PrintResult("24US Like System.SByte.MinValue", 24US Like System.SByte.MinValue)
PrintResult("24US Like System.Byte.MaxValue", 24US Like System.Byte.MaxValue)
PrintResult("24US Like -3S", 24US Like -3S)
PrintResult("24US Like 24US", 24US Like 24US)
PrintResult("24US Like -5I", 24US Like -5I)
PrintResult("24US Like 26UI", 24US Like 26UI)
PrintResult("24US Like -7L", 24US Like -7L)
PrintResult("24US Like 28UL", 24US Like 28UL)
PrintResult("24US Like -9D", 24US Like -9D)
PrintResult("24US Like 10.0F", 24US Like 10.0F)
PrintResult("24US Like -11.0R", 24US Like -11.0R)
PrintResult("24US Like ""12""", 24US Like "12")
PrintResult("24US Like TypeCode.Double", 24US Like TypeCode.Double)
PrintResult("-5I Like False", -5I Like False)
PrintResult("-5I Like True", -5I Like True)
PrintResult("-5I Like System.SByte.MinValue", -5I Like System.SByte.MinValue)
PrintResult("-5I Like System.Byte.MaxValue", -5I Like System.Byte.MaxValue)
PrintResult("-5I Like -3S", -5I Like -3S)
PrintResult("-5I Like 24US", -5I Like 24US)
PrintResult("-5I Like -5I", -5I Like -5I)
PrintResult("-5I Like 26UI", -5I Like 26UI)
PrintResult("-5I Like -7L", -5I Like -7L)
PrintResult("-5I Like 28UL", -5I Like 28UL)
PrintResult("-5I Like -9D", -5I Like -9D)
PrintResult("-5I Like 10.0F", -5I Like 10.0F)
PrintResult("-5I Like -11.0R", -5I Like -11.0R)
PrintResult("-5I Like ""12""", -5I Like "12")
PrintResult("-5I Like TypeCode.Double", -5I Like TypeCode.Double)
PrintResult("26UI Like False", 26UI Like False)
PrintResult("26UI Like True", 26UI Like True)
PrintResult("26UI Like System.SByte.MinValue", 26UI Like System.SByte.MinValue)
PrintResult("26UI Like System.Byte.MaxValue", 26UI Like System.Byte.MaxValue)
PrintResult("26UI Like -3S", 26UI Like -3S)
PrintResult("26UI Like 24US", 26UI Like 24US)
PrintResult("26UI Like -5I", 26UI Like -5I)
PrintResult("26UI Like 26UI", 26UI Like 26UI)
PrintResult("26UI Like -7L", 26UI Like -7L)
PrintResult("26UI Like 28UL", 26UI Like 28UL)
PrintResult("26UI Like -9D", 26UI Like -9D)
PrintResult("26UI Like 10.0F", 26UI Like 10.0F)
PrintResult("26UI Like -11.0R", 26UI Like -11.0R)
PrintResult("26UI Like ""12""", 26UI Like "12")
PrintResult("26UI Like TypeCode.Double", 26UI Like TypeCode.Double)
PrintResult("-7L Like False", -7L Like False)
PrintResult("-7L Like True", -7L Like True)
PrintResult("-7L Like System.SByte.MinValue", -7L Like System.SByte.MinValue)
PrintResult("-7L Like System.Byte.MaxValue", -7L Like System.Byte.MaxValue)
PrintResult("-7L Like -3S", -7L Like -3S)
PrintResult("-7L Like 24US", -7L Like 24US)
PrintResult("-7L Like -5I", -7L Like -5I)
PrintResult("-7L Like 26UI", -7L Like 26UI)
PrintResult("-7L Like -7L", -7L Like -7L)
PrintResult("-7L Like 28UL", -7L Like 28UL)
PrintResult("-7L Like -9D", -7L Like -9D)
PrintResult("-7L Like 10.0F", -7L Like 10.0F)
PrintResult("-7L Like -11.0R", -7L Like -11.0R)
PrintResult("-7L Like ""12""", -7L Like "12")
PrintResult("-7L Like TypeCode.Double", -7L Like TypeCode.Double)
PrintResult("28UL Like False", 28UL Like False)
PrintResult("28UL Like True", 28UL Like True)
PrintResult("28UL Like System.SByte.MinValue", 28UL Like System.SByte.MinValue)
PrintResult("28UL Like System.Byte.MaxValue", 28UL Like System.Byte.MaxValue)
PrintResult("28UL Like -3S", 28UL Like -3S)
PrintResult("28UL Like 24US", 28UL Like 24US)
PrintResult("28UL Like -5I", 28UL Like -5I)
PrintResult("28UL Like 26UI", 28UL Like 26UI)
PrintResult("28UL Like -7L", 28UL Like -7L)
PrintResult("28UL Like 28UL", 28UL Like 28UL)
PrintResult("28UL Like -9D", 28UL Like -9D)
PrintResult("28UL Like 10.0F", 28UL Like 10.0F)
PrintResult("28UL Like -11.0R", 28UL Like -11.0R)
PrintResult("28UL Like ""12""", 28UL Like "12")
PrintResult("28UL Like TypeCode.Double", 28UL Like TypeCode.Double)
PrintResult("-9D Like False", -9D Like False)
PrintResult("-9D Like True", -9D Like True)
PrintResult("-9D Like System.SByte.MinValue", -9D Like System.SByte.MinValue)
PrintResult("-9D Like System.Byte.MaxValue", -9D Like System.Byte.MaxValue)
PrintResult("-9D Like -3S", -9D Like -3S)
PrintResult("-9D Like 24US", -9D Like 24US)
PrintResult("-9D Like -5I", -9D Like -5I)
PrintResult("-9D Like 26UI", -9D Like 26UI)
PrintResult("-9D Like -7L", -9D Like -7L)
PrintResult("-9D Like 28UL", -9D Like 28UL)
PrintResult("-9D Like -9D", -9D Like -9D)
PrintResult("-9D Like 10.0F", -9D Like 10.0F)
PrintResult("-9D Like -11.0R", -9D Like -11.0R)
PrintResult("-9D Like ""12""", -9D Like "12")
PrintResult("-9D Like TypeCode.Double", -9D Like TypeCode.Double)
PrintResult("10.0F Like False", 10.0F Like False)
PrintResult("10.0F Like True", 10.0F Like True)
PrintResult("10.0F Like System.SByte.MinValue", 10.0F Like System.SByte.MinValue)
PrintResult("10.0F Like System.Byte.MaxValue", 10.0F Like System.Byte.MaxValue)
PrintResult("10.0F Like -3S", 10.0F Like -3S)
PrintResult("10.0F Like 24US", 10.0F Like 24US)
PrintResult("10.0F Like -5I", 10.0F Like -5I)
PrintResult("10.0F Like 26UI", 10.0F Like 26UI)
PrintResult("10.0F Like -7L", 10.0F Like -7L)
PrintResult("10.0F Like 28UL", 10.0F Like 28UL)
PrintResult("10.0F Like -9D", 10.0F Like -9D)
PrintResult("10.0F Like 10.0F", 10.0F Like 10.0F)
PrintResult("10.0F Like -11.0R", 10.0F Like -11.0R)
PrintResult("10.0F Like ""12""", 10.0F Like "12")
PrintResult("10.0F Like TypeCode.Double", 10.0F Like TypeCode.Double)
PrintResult("-11.0R Like False", -11.0R Like False)
PrintResult("-11.0R Like True", -11.0R Like True)
PrintResult("-11.0R Like System.SByte.MinValue", -11.0R Like System.SByte.MinValue)
PrintResult("-11.0R Like System.Byte.MaxValue", -11.0R Like System.Byte.MaxValue)
PrintResult("-11.0R Like -3S", -11.0R Like -3S)
PrintResult("-11.0R Like 24US", -11.0R Like 24US)
PrintResult("-11.0R Like -5I", -11.0R Like -5I)
PrintResult("-11.0R Like 26UI", -11.0R Like 26UI)
PrintResult("-11.0R Like -7L", -11.0R Like -7L)
PrintResult("-11.0R Like 28UL", -11.0R Like 28UL)
PrintResult("-11.0R Like -9D", -11.0R Like -9D)
PrintResult("-11.0R Like 10.0F", -11.0R Like 10.0F)
PrintResult("-11.0R Like -11.0R", -11.0R Like -11.0R)
PrintResult("-11.0R Like ""12""", -11.0R Like "12")
PrintResult("-11.0R Like TypeCode.Double", -11.0R Like TypeCode.Double)
PrintResult("""12"" Like False", "12" Like False)
PrintResult("""12"" Like True", "12" Like True)
PrintResult("""12"" Like System.SByte.MinValue", "12" Like System.SByte.MinValue)
PrintResult("""12"" Like System.Byte.MaxValue", "12" Like System.Byte.MaxValue)
PrintResult("""12"" Like -3S", "12" Like -3S)
PrintResult("""12"" Like 24US", "12" Like 24US)
PrintResult("""12"" Like -5I", "12" Like -5I)
PrintResult("""12"" Like 26UI", "12" Like 26UI)
PrintResult("""12"" Like -7L", "12" Like -7L)
PrintResult("""12"" Like 28UL", "12" Like 28UL)
PrintResult("""12"" Like -9D", "12" Like -9D)
PrintResult("""12"" Like 10.0F", "12" Like 10.0F)
PrintResult("""12"" Like -11.0R", "12" Like -11.0R)
PrintResult("""12"" Like ""12""", "12" Like "12")
PrintResult("""12"" Like TypeCode.Double", "12" Like TypeCode.Double)
PrintResult("TypeCode.Double Like False", TypeCode.Double Like False)
PrintResult("TypeCode.Double Like True", TypeCode.Double Like True)
PrintResult("TypeCode.Double Like System.SByte.MinValue", TypeCode.Double Like System.SByte.MinValue)
PrintResult("TypeCode.Double Like System.Byte.MaxValue", TypeCode.Double Like System.Byte.MaxValue)
PrintResult("TypeCode.Double Like -3S", TypeCode.Double Like -3S)
PrintResult("TypeCode.Double Like 24US", TypeCode.Double Like 24US)
PrintResult("TypeCode.Double Like -5I", TypeCode.Double Like -5I)
PrintResult("TypeCode.Double Like 26UI", TypeCode.Double Like 26UI)
PrintResult("TypeCode.Double Like -7L", TypeCode.Double Like -7L)
PrintResult("TypeCode.Double Like 28UL", TypeCode.Double Like 28UL)
PrintResult("TypeCode.Double Like -9D", TypeCode.Double Like -9D)
PrintResult("TypeCode.Double Like 10.0F", TypeCode.Double Like 10.0F)
PrintResult("TypeCode.Double Like -11.0R", TypeCode.Double Like -11.0R)
PrintResult("TypeCode.Double Like ""12""", TypeCode.Double Like "12")
PrintResult("TypeCode.Double Like TypeCode.Double", TypeCode.Double Like TypeCode.Double)
PrintResult("False = False", False = False)
PrintResult("False = True", False = True)
PrintResult("False = System.SByte.MinValue", False = System.SByte.MinValue)
PrintResult("False = System.Byte.MaxValue", False = System.Byte.MaxValue)
PrintResult("False = -3S", False = -3S)
PrintResult("False = 24US", False = 24US)
PrintResult("False = -5I", False = -5I)
PrintResult("False = 26UI", False = 26UI)
PrintResult("False = -7L", False = -7L)
PrintResult("False = 28UL", False = 28UL)
PrintResult("False = -9D", False = -9D)
PrintResult("False = 10.0F", False = 10.0F)
PrintResult("False = -11.0R", False = -11.0R)
PrintResult("False = ""12""", False = "12")
PrintResult("False = TypeCode.Double", False = TypeCode.Double)
PrintResult("True = False", True = False)
PrintResult("True = True", True = True)
PrintResult("True = System.SByte.MinValue", True = System.SByte.MinValue)
PrintResult("True = System.Byte.MaxValue", True = System.Byte.MaxValue)
PrintResult("True = -3S", True = -3S)
PrintResult("True = 24US", True = 24US)
PrintResult("True = -5I", True = -5I)
PrintResult("True = 26UI", True = 26UI)
PrintResult("True = -7L", True = -7L)
PrintResult("True = 28UL", True = 28UL)
PrintResult("True = -9D", True = -9D)
PrintResult("True = 10.0F", True = 10.0F)
PrintResult("True = -11.0R", True = -11.0R)
PrintResult("True = ""12""", True = "12")
PrintResult("True = TypeCode.Double", True = TypeCode.Double)
PrintResult("System.SByte.MinValue = False", System.SByte.MinValue = False)
PrintResult("System.SByte.MinValue = True", System.SByte.MinValue = True)
PrintResult("System.SByte.MinValue = System.SByte.MinValue", System.SByte.MinValue = System.SByte.MinValue)
PrintResult("System.SByte.MinValue = System.Byte.MaxValue", System.SByte.MinValue = System.Byte.MaxValue)
PrintResult("System.SByte.MinValue = -3S", System.SByte.MinValue = -3S)
PrintResult("System.SByte.MinValue = 24US", System.SByte.MinValue = 24US)
PrintResult("System.SByte.MinValue = -5I", System.SByte.MinValue = -5I)
PrintResult("System.SByte.MinValue = 26UI", System.SByte.MinValue = 26UI)
PrintResult("System.SByte.MinValue = -7L", System.SByte.MinValue = -7L)
PrintResult("System.SByte.MinValue = 28UL", System.SByte.MinValue = 28UL)
PrintResult("System.SByte.MinValue = -9D", System.SByte.MinValue = -9D)
PrintResult("System.SByte.MinValue = 10.0F", System.SByte.MinValue = 10.0F)
PrintResult("System.SByte.MinValue = -11.0R", System.SByte.MinValue = -11.0R)
PrintResult("System.SByte.MinValue = ""12""", System.SByte.MinValue = "12")
PrintResult("System.SByte.MinValue = TypeCode.Double", System.SByte.MinValue = TypeCode.Double)
PrintResult("System.Byte.MaxValue = False", System.Byte.MaxValue = False)
PrintResult("System.Byte.MaxValue = True", System.Byte.MaxValue = True)
PrintResult("System.Byte.MaxValue = System.SByte.MinValue", System.Byte.MaxValue = System.SByte.MinValue)
PrintResult("System.Byte.MaxValue = System.Byte.MaxValue", System.Byte.MaxValue = System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue = -3S", System.Byte.MaxValue = -3S)
PrintResult("System.Byte.MaxValue = 24US", System.Byte.MaxValue = 24US)
PrintResult("System.Byte.MaxValue = -5I", System.Byte.MaxValue = -5I)
PrintResult("System.Byte.MaxValue = 26UI", System.Byte.MaxValue = 26UI)
PrintResult("System.Byte.MaxValue = -7L", System.Byte.MaxValue = -7L)
PrintResult("System.Byte.MaxValue = 28UL", System.Byte.MaxValue = 28UL)
PrintResult("System.Byte.MaxValue = -9D", System.Byte.MaxValue = -9D)
PrintResult("System.Byte.MaxValue = 10.0F", System.Byte.MaxValue = 10.0F)
PrintResult("System.Byte.MaxValue = -11.0R", System.Byte.MaxValue = -11.0R)
PrintResult("System.Byte.MaxValue = ""12""", System.Byte.MaxValue = "12")
PrintResult("System.Byte.MaxValue = TypeCode.Double", System.Byte.MaxValue = TypeCode.Double)
PrintResult("-3S = False", -3S = False)
PrintResult("-3S = True", -3S = True)
PrintResult("-3S = System.SByte.MinValue", -3S = System.SByte.MinValue)
PrintResult("-3S = System.Byte.MaxValue", -3S = System.Byte.MaxValue)
PrintResult("-3S = -3S", -3S = -3S)
PrintResult("-3S = 24US", -3S = 24US)
PrintResult("-3S = -5I", -3S = -5I)
PrintResult("-3S = 26UI", -3S = 26UI)
PrintResult("-3S = -7L", -3S = -7L)
PrintResult("-3S = 28UL", -3S = 28UL)
PrintResult("-3S = -9D", -3S = -9D)
PrintResult("-3S = 10.0F", -3S = 10.0F)
PrintResult("-3S = -11.0R", -3S = -11.0R)
PrintResult("-3S = ""12""", -3S = "12")
PrintResult("-3S = TypeCode.Double", -3S = TypeCode.Double)
PrintResult("24US = False", 24US = False)
PrintResult("24US = True", 24US = True)
PrintResult("24US = System.SByte.MinValue", 24US = System.SByte.MinValue)
PrintResult("24US = System.Byte.MaxValue", 24US = System.Byte.MaxValue)
PrintResult("24US = -3S", 24US = -3S)
PrintResult("24US = 24US", 24US = 24US)
PrintResult("24US = -5I", 24US = -5I)
PrintResult("24US = 26UI", 24US = 26UI)
PrintResult("24US = -7L", 24US = -7L)
PrintResult("24US = 28UL", 24US = 28UL)
PrintResult("24US = -9D", 24US = -9D)
PrintResult("24US = 10.0F", 24US = 10.0F)
PrintResult("24US = -11.0R", 24US = -11.0R)
PrintResult("24US = ""12""", 24US = "12")
PrintResult("24US = TypeCode.Double", 24US = TypeCode.Double)
PrintResult("-5I = False", -5I = False)
PrintResult("-5I = True", -5I = True)
PrintResult("-5I = System.SByte.MinValue", -5I = System.SByte.MinValue)
PrintResult("-5I = System.Byte.MaxValue", -5I = System.Byte.MaxValue)
PrintResult("-5I = -3S", -5I = -3S)
PrintResult("-5I = 24US", -5I = 24US)
PrintResult("-5I = -5I", -5I = -5I)
PrintResult("-5I = 26UI", -5I = 26UI)
PrintResult("-5I = -7L", -5I = -7L)
PrintResult("-5I = 28UL", -5I = 28UL)
PrintResult("-5I = -9D", -5I = -9D)
PrintResult("-5I = 10.0F", -5I = 10.0F)
PrintResult("-5I = -11.0R", -5I = -11.0R)
PrintResult("-5I = ""12""", -5I = "12")
PrintResult("-5I = TypeCode.Double", -5I = TypeCode.Double)
PrintResult("26UI = False", 26UI = False)
PrintResult("26UI = True", 26UI = True)
PrintResult("26UI = System.SByte.MinValue", 26UI = System.SByte.MinValue)
PrintResult("26UI = System.Byte.MaxValue", 26UI = System.Byte.MaxValue)
PrintResult("26UI = -3S", 26UI = -3S)
PrintResult("26UI = 24US", 26UI = 24US)
PrintResult("26UI = -5I", 26UI = -5I)
PrintResult("26UI = 26UI", 26UI = 26UI)
PrintResult("26UI = -7L", 26UI = -7L)
PrintResult("26UI = 28UL", 26UI = 28UL)
PrintResult("26UI = -9D", 26UI = -9D)
PrintResult("26UI = 10.0F", 26UI = 10.0F)
PrintResult("26UI = -11.0R", 26UI = -11.0R)
PrintResult("26UI = ""12""", 26UI = "12")
PrintResult("26UI = TypeCode.Double", 26UI = TypeCode.Double)
PrintResult("-7L = False", -7L = False)
PrintResult("-7L = True", -7L = True)
PrintResult("-7L = System.SByte.MinValue", -7L = System.SByte.MinValue)
PrintResult("-7L = System.Byte.MaxValue", -7L = System.Byte.MaxValue)
PrintResult("-7L = -3S", -7L = -3S)
PrintResult("-7L = 24US", -7L = 24US)
PrintResult("-7L = -5I", -7L = -5I)
PrintResult("-7L = 26UI", -7L = 26UI)
PrintResult("-7L = -7L", -7L = -7L)
PrintResult("-7L = 28UL", -7L = 28UL)
PrintResult("-7L = -9D", -7L = -9D)
PrintResult("-7L = 10.0F", -7L = 10.0F)
PrintResult("-7L = -11.0R", -7L = -11.0R)
PrintResult("-7L = ""12""", -7L = "12")
PrintResult("-7L = TypeCode.Double", -7L = TypeCode.Double)
PrintResult("28UL = False", 28UL = False)
PrintResult("28UL = True", 28UL = True)
PrintResult("28UL = System.SByte.MinValue", 28UL = System.SByte.MinValue)
PrintResult("28UL = System.Byte.MaxValue", 28UL = System.Byte.MaxValue)
PrintResult("28UL = -3S", 28UL = -3S)
PrintResult("28UL = 24US", 28UL = 24US)
PrintResult("28UL = -5I", 28UL = -5I)
PrintResult("28UL = 26UI", 28UL = 26UI)
PrintResult("28UL = -7L", 28UL = -7L)
PrintResult("28UL = 28UL", 28UL = 28UL)
PrintResult("28UL = -9D", 28UL = -9D)
PrintResult("28UL = 10.0F", 28UL = 10.0F)
PrintResult("28UL = -11.0R", 28UL = -11.0R)
PrintResult("28UL = ""12""", 28UL = "12")
PrintResult("28UL = TypeCode.Double", 28UL = TypeCode.Double)
PrintResult("-9D = False", -9D = False)
PrintResult("-9D = True", -9D = True)
PrintResult("-9D = System.SByte.MinValue", -9D = System.SByte.MinValue)
PrintResult("-9D = System.Byte.MaxValue", -9D = System.Byte.MaxValue)
PrintResult("-9D = -3S", -9D = -3S)
PrintResult("-9D = 24US", -9D = 24US)
PrintResult("-9D = -5I", -9D = -5I)
PrintResult("-9D = 26UI", -9D = 26UI)
PrintResult("-9D = -7L", -9D = -7L)
PrintResult("-9D = 28UL", -9D = 28UL)
PrintResult("-9D = -9D", -9D = -9D)
PrintResult("-9D = 10.0F", -9D = 10.0F)
PrintResult("-9D = -11.0R", -9D = -11.0R)
PrintResult("-9D = ""12""", -9D = "12")
PrintResult("-9D = TypeCode.Double", -9D = TypeCode.Double)
PrintResult("10.0F = False", 10.0F = False)
PrintResult("10.0F = True", 10.0F = True)
PrintResult("10.0F = System.SByte.MinValue", 10.0F = System.SByte.MinValue)
PrintResult("10.0F = System.Byte.MaxValue", 10.0F = System.Byte.MaxValue)
PrintResult("10.0F = -3S", 10.0F = -3S)
PrintResult("10.0F = 24US", 10.0F = 24US)
PrintResult("10.0F = -5I", 10.0F = -5I)
PrintResult("10.0F = 26UI", 10.0F = 26UI)
PrintResult("10.0F = -7L", 10.0F = -7L)
PrintResult("10.0F = 28UL", 10.0F = 28UL)
PrintResult("10.0F = -9D", 10.0F = -9D)
PrintResult("10.0F = 10.0F", 10.0F = 10.0F)
PrintResult("10.0F = -11.0R", 10.0F = -11.0R)
PrintResult("10.0F = ""12""", 10.0F = "12")
PrintResult("10.0F = TypeCode.Double", 10.0F = TypeCode.Double)
PrintResult("-11.0R = False", -11.0R = False)
PrintResult("-11.0R = True", -11.0R = True)
PrintResult("-11.0R = System.SByte.MinValue", -11.0R = System.SByte.MinValue)
PrintResult("-11.0R = System.Byte.MaxValue", -11.0R = System.Byte.MaxValue)
PrintResult("-11.0R = -3S", -11.0R = -3S)
PrintResult("-11.0R = 24US", -11.0R = 24US)
PrintResult("-11.0R = -5I", -11.0R = -5I)
PrintResult("-11.0R = 26UI", -11.0R = 26UI)
PrintResult("-11.0R = -7L", -11.0R = -7L)
PrintResult("-11.0R = 28UL", -11.0R = 28UL)
PrintResult("-11.0R = -9D", -11.0R = -9D)
PrintResult("-11.0R = 10.0F", -11.0R = 10.0F)
PrintResult("-11.0R = -11.0R", -11.0R = -11.0R)
PrintResult("-11.0R = ""12""", -11.0R = "12")
PrintResult("-11.0R = TypeCode.Double", -11.0R = TypeCode.Double)
PrintResult("""12"" = False", "12" = False)
PrintResult("""12"" = True", "12" = True)
PrintResult("""12"" = System.SByte.MinValue", "12" = System.SByte.MinValue)
PrintResult("""12"" = System.Byte.MaxValue", "12" = System.Byte.MaxValue)
PrintResult("""12"" = -3S", "12" = -3S)
PrintResult("""12"" = 24US", "12" = 24US)
PrintResult("""12"" = -5I", "12" = -5I)
PrintResult("""12"" = 26UI", "12" = 26UI)
PrintResult("""12"" = -7L", "12" = -7L)
PrintResult("""12"" = 28UL", "12" = 28UL)
PrintResult("""12"" = -9D", "12" = -9D)
PrintResult("""12"" = 10.0F", "12" = 10.0F)
PrintResult("""12"" = -11.0R", "12" = -11.0R)
PrintResult("""12"" = ""12""", "12" = "12")
PrintResult("""12"" = TypeCode.Double", "12" = TypeCode.Double)
PrintResult("TypeCode.Double = False", TypeCode.Double = False)
PrintResult("TypeCode.Double = True", TypeCode.Double = True)
PrintResult("TypeCode.Double = System.SByte.MinValue", TypeCode.Double = System.SByte.MinValue)
PrintResult("TypeCode.Double = System.Byte.MaxValue", TypeCode.Double = System.Byte.MaxValue)
PrintResult("TypeCode.Double = -3S", TypeCode.Double = -3S)
PrintResult("TypeCode.Double = 24US", TypeCode.Double = 24US)
PrintResult("TypeCode.Double = -5I", TypeCode.Double = -5I)
PrintResult("TypeCode.Double = 26UI", TypeCode.Double = 26UI)
PrintResult("TypeCode.Double = -7L", TypeCode.Double = -7L)
PrintResult("TypeCode.Double = 28UL", TypeCode.Double = 28UL)
PrintResult("TypeCode.Double = -9D", TypeCode.Double = -9D)
PrintResult("TypeCode.Double = 10.0F", TypeCode.Double = 10.0F)
PrintResult("TypeCode.Double = -11.0R", TypeCode.Double = -11.0R)
PrintResult("TypeCode.Double = ""12""", TypeCode.Double = "12")
PrintResult("TypeCode.Double = TypeCode.Double", TypeCode.Double = TypeCode.Double)
PrintResult("False <> False", False <> False)
PrintResult("False <> True", False <> True)
PrintResult("False <> System.SByte.MinValue", False <> System.SByte.MinValue)
PrintResult("False <> System.Byte.MaxValue", False <> System.Byte.MaxValue)
PrintResult("False <> -3S", False <> -3S)
PrintResult("False <> 24US", False <> 24US)
PrintResult("False <> -5I", False <> -5I)
PrintResult("False <> 26UI", False <> 26UI)
PrintResult("False <> -7L", False <> -7L)
PrintResult("False <> 28UL", False <> 28UL)
PrintResult("False <> -9D", False <> -9D)
PrintResult("False <> 10.0F", False <> 10.0F)
PrintResult("False <> -11.0R", False <> -11.0R)
PrintResult("False <> ""12""", False <> "12")
PrintResult("False <> TypeCode.Double", False <> TypeCode.Double)
PrintResult("True <> False", True <> False)
PrintResult("True <> True", True <> True)
PrintResult("True <> System.SByte.MinValue", True <> System.SByte.MinValue)
PrintResult("True <> System.Byte.MaxValue", True <> System.Byte.MaxValue)
PrintResult("True <> -3S", True <> -3S)
PrintResult("True <> 24US", True <> 24US)
PrintResult("True <> -5I", True <> -5I)
PrintResult("True <> 26UI", True <> 26UI)
PrintResult("True <> -7L", True <> -7L)
PrintResult("True <> 28UL", True <> 28UL)
PrintResult("True <> -9D", True <> -9D)
PrintResult("True <> 10.0F", True <> 10.0F)
PrintResult("True <> -11.0R", True <> -11.0R)
PrintResult("True <> ""12""", True <> "12")
PrintResult("True <> TypeCode.Double", True <> TypeCode.Double)
PrintResult("System.SByte.MinValue <> False", System.SByte.MinValue <> False)
PrintResult("System.SByte.MinValue <> True", System.SByte.MinValue <> True)
PrintResult("System.SByte.MinValue <> System.SByte.MinValue", System.SByte.MinValue <> System.SByte.MinValue)
PrintResult("System.SByte.MinValue <> System.Byte.MaxValue", System.SByte.MinValue <> System.Byte.MaxValue)
PrintResult("System.SByte.MinValue <> -3S", System.SByte.MinValue <> -3S)
PrintResult("System.SByte.MinValue <> 24US", System.SByte.MinValue <> 24US)
PrintResult("System.SByte.MinValue <> -5I", System.SByte.MinValue <> -5I)
PrintResult("System.SByte.MinValue <> 26UI", System.SByte.MinValue <> 26UI)
PrintResult("System.SByte.MinValue <> -7L", System.SByte.MinValue <> -7L)
PrintResult("System.SByte.MinValue <> 28UL", System.SByte.MinValue <> 28UL)
PrintResult("System.SByte.MinValue <> -9D", System.SByte.MinValue <> -9D)
PrintResult("System.SByte.MinValue <> 10.0F", System.SByte.MinValue <> 10.0F)
PrintResult("System.SByte.MinValue <> -11.0R", System.SByte.MinValue <> -11.0R)
PrintResult("System.SByte.MinValue <> ""12""", System.SByte.MinValue <> "12")
PrintResult("System.SByte.MinValue <> TypeCode.Double", System.SByte.MinValue <> TypeCode.Double)
PrintResult("System.Byte.MaxValue <> False", System.Byte.MaxValue <> False)
PrintResult("System.Byte.MaxValue <> True", System.Byte.MaxValue <> True)
PrintResult("System.Byte.MaxValue <> System.SByte.MinValue", System.Byte.MaxValue <> System.SByte.MinValue)
PrintResult("System.Byte.MaxValue <> System.Byte.MaxValue", System.Byte.MaxValue <> System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue <> -3S", System.Byte.MaxValue <> -3S)
PrintResult("System.Byte.MaxValue <> 24US", System.Byte.MaxValue <> 24US)
PrintResult("System.Byte.MaxValue <> -5I", System.Byte.MaxValue <> -5I)
PrintResult("System.Byte.MaxValue <> 26UI", System.Byte.MaxValue <> 26UI)
PrintResult("System.Byte.MaxValue <> -7L", System.Byte.MaxValue <> -7L)
PrintResult("System.Byte.MaxValue <> 28UL", System.Byte.MaxValue <> 28UL)
PrintResult("System.Byte.MaxValue <> -9D", System.Byte.MaxValue <> -9D)
PrintResult("System.Byte.MaxValue <> 10.0F", System.Byte.MaxValue <> 10.0F)
PrintResult("System.Byte.MaxValue <> -11.0R", System.Byte.MaxValue <> -11.0R)
PrintResult("System.Byte.MaxValue <> ""12""", System.Byte.MaxValue <> "12")
PrintResult("System.Byte.MaxValue <> TypeCode.Double", System.Byte.MaxValue <> TypeCode.Double)
PrintResult("-3S <> False", -3S <> False)
PrintResult("-3S <> True", -3S <> True)
PrintResult("-3S <> System.SByte.MinValue", -3S <> System.SByte.MinValue)
PrintResult("-3S <> System.Byte.MaxValue", -3S <> System.Byte.MaxValue)
PrintResult("-3S <> -3S", -3S <> -3S)
PrintResult("-3S <> 24US", -3S <> 24US)
PrintResult("-3S <> -5I", -3S <> -5I)
PrintResult("-3S <> 26UI", -3S <> 26UI)
PrintResult("-3S <> -7L", -3S <> -7L)
PrintResult("-3S <> 28UL", -3S <> 28UL)
PrintResult("-3S <> -9D", -3S <> -9D)
PrintResult("-3S <> 10.0F", -3S <> 10.0F)
PrintResult("-3S <> -11.0R", -3S <> -11.0R)
PrintResult("-3S <> ""12""", -3S <> "12")
PrintResult("-3S <> TypeCode.Double", -3S <> TypeCode.Double)
PrintResult("24US <> False", 24US <> False)
PrintResult("24US <> True", 24US <> True)
PrintResult("24US <> System.SByte.MinValue", 24US <> System.SByte.MinValue)
PrintResult("24US <> System.Byte.MaxValue", 24US <> System.Byte.MaxValue)
PrintResult("24US <> -3S", 24US <> -3S)
PrintResult("24US <> 24US", 24US <> 24US)
PrintResult("24US <> -5I", 24US <> -5I)
PrintResult("24US <> 26UI", 24US <> 26UI)
PrintResult("24US <> -7L", 24US <> -7L)
PrintResult("24US <> 28UL", 24US <> 28UL)
PrintResult("24US <> -9D", 24US <> -9D)
PrintResult("24US <> 10.0F", 24US <> 10.0F)
PrintResult("24US <> -11.0R", 24US <> -11.0R)
PrintResult("24US <> ""12""", 24US <> "12")
PrintResult("24US <> TypeCode.Double", 24US <> TypeCode.Double)
PrintResult("-5I <> False", -5I <> False)
PrintResult("-5I <> True", -5I <> True)
PrintResult("-5I <> System.SByte.MinValue", -5I <> System.SByte.MinValue)
PrintResult("-5I <> System.Byte.MaxValue", -5I <> System.Byte.MaxValue)
PrintResult("-5I <> -3S", -5I <> -3S)
PrintResult("-5I <> 24US", -5I <> 24US)
PrintResult("-5I <> -5I", -5I <> -5I)
PrintResult("-5I <> 26UI", -5I <> 26UI)
PrintResult("-5I <> -7L", -5I <> -7L)
PrintResult("-5I <> 28UL", -5I <> 28UL)
PrintResult("-5I <> -9D", -5I <> -9D)
PrintResult("-5I <> 10.0F", -5I <> 10.0F)
PrintResult("-5I <> -11.0R", -5I <> -11.0R)
PrintResult("-5I <> ""12""", -5I <> "12")
PrintResult("-5I <> TypeCode.Double", -5I <> TypeCode.Double)
PrintResult("26UI <> False", 26UI <> False)
PrintResult("26UI <> True", 26UI <> True)
PrintResult("26UI <> System.SByte.MinValue", 26UI <> System.SByte.MinValue)
PrintResult("26UI <> System.Byte.MaxValue", 26UI <> System.Byte.MaxValue)
PrintResult("26UI <> -3S", 26UI <> -3S)
PrintResult("26UI <> 24US", 26UI <> 24US)
PrintResult("26UI <> -5I", 26UI <> -5I)
PrintResult("26UI <> 26UI", 26UI <> 26UI)
PrintResult("26UI <> -7L", 26UI <> -7L)
PrintResult("26UI <> 28UL", 26UI <> 28UL)
PrintResult("26UI <> -9D", 26UI <> -9D)
PrintResult("26UI <> 10.0F", 26UI <> 10.0F)
PrintResult("26UI <> -11.0R", 26UI <> -11.0R)
PrintResult("26UI <> ""12""", 26UI <> "12")
PrintResult("26UI <> TypeCode.Double", 26UI <> TypeCode.Double)
PrintResult("-7L <> False", -7L <> False)
PrintResult("-7L <> True", -7L <> True)
PrintResult("-7L <> System.SByte.MinValue", -7L <> System.SByte.MinValue)
PrintResult("-7L <> System.Byte.MaxValue", -7L <> System.Byte.MaxValue)
PrintResult("-7L <> -3S", -7L <> -3S)
PrintResult("-7L <> 24US", -7L <> 24US)
PrintResult("-7L <> -5I", -7L <> -5I)
PrintResult("-7L <> 26UI", -7L <> 26UI)
PrintResult("-7L <> -7L", -7L <> -7L)
PrintResult("-7L <> 28UL", -7L <> 28UL)
PrintResult("-7L <> -9D", -7L <> -9D)
PrintResult("-7L <> 10.0F", -7L <> 10.0F)
PrintResult("-7L <> -11.0R", -7L <> -11.0R)
PrintResult("-7L <> ""12""", -7L <> "12")
PrintResult("-7L <> TypeCode.Double", -7L <> TypeCode.Double)
PrintResult("28UL <> False", 28UL <> False)
PrintResult("28UL <> True", 28UL <> True)
PrintResult("28UL <> System.SByte.MinValue", 28UL <> System.SByte.MinValue)
PrintResult("28UL <> System.Byte.MaxValue", 28UL <> System.Byte.MaxValue)
PrintResult("28UL <> -3S", 28UL <> -3S)
PrintResult("28UL <> 24US", 28UL <> 24US)
PrintResult("28UL <> -5I", 28UL <> -5I)
PrintResult("28UL <> 26UI", 28UL <> 26UI)
PrintResult("28UL <> -7L", 28UL <> -7L)
PrintResult("28UL <> 28UL", 28UL <> 28UL)
PrintResult("28UL <> -9D", 28UL <> -9D)
PrintResult("28UL <> 10.0F", 28UL <> 10.0F)
PrintResult("28UL <> -11.0R", 28UL <> -11.0R)
PrintResult("28UL <> ""12""", 28UL <> "12")
PrintResult("28UL <> TypeCode.Double", 28UL <> TypeCode.Double)
PrintResult("-9D <> False", -9D <> False)
PrintResult("-9D <> True", -9D <> True)
PrintResult("-9D <> System.SByte.MinValue", -9D <> System.SByte.MinValue)
PrintResult("-9D <> System.Byte.MaxValue", -9D <> System.Byte.MaxValue)
PrintResult("-9D <> -3S", -9D <> -3S)
PrintResult("-9D <> 24US", -9D <> 24US)
PrintResult("-9D <> -5I", -9D <> -5I)
PrintResult("-9D <> 26UI", -9D <> 26UI)
PrintResult("-9D <> -7L", -9D <> -7L)
PrintResult("-9D <> 28UL", -9D <> 28UL)
PrintResult("-9D <> -9D", -9D <> -9D)
PrintResult("-9D <> 10.0F", -9D <> 10.0F)
PrintResult("-9D <> -11.0R", -9D <> -11.0R)
PrintResult("-9D <> ""12""", -9D <> "12")
PrintResult("-9D <> TypeCode.Double", -9D <> TypeCode.Double)
PrintResult("10.0F <> False", 10.0F <> False)
PrintResult("10.0F <> True", 10.0F <> True)
PrintResult("10.0F <> System.SByte.MinValue", 10.0F <> System.SByte.MinValue)
PrintResult("10.0F <> System.Byte.MaxValue", 10.0F <> System.Byte.MaxValue)
PrintResult("10.0F <> -3S", 10.0F <> -3S)
PrintResult("10.0F <> 24US", 10.0F <> 24US)
PrintResult("10.0F <> -5I", 10.0F <> -5I)
PrintResult("10.0F <> 26UI", 10.0F <> 26UI)
PrintResult("10.0F <> -7L", 10.0F <> -7L)
PrintResult("10.0F <> 28UL", 10.0F <> 28UL)
PrintResult("10.0F <> -9D", 10.0F <> -9D)
PrintResult("10.0F <> 10.0F", 10.0F <> 10.0F)
PrintResult("10.0F <> -11.0R", 10.0F <> -11.0R)
PrintResult("10.0F <> ""12""", 10.0F <> "12")
PrintResult("10.0F <> TypeCode.Double", 10.0F <> TypeCode.Double)
PrintResult("-11.0R <> False", -11.0R <> False)
PrintResult("-11.0R <> True", -11.0R <> True)
PrintResult("-11.0R <> System.SByte.MinValue", -11.0R <> System.SByte.MinValue)
PrintResult("-11.0R <> System.Byte.MaxValue", -11.0R <> System.Byte.MaxValue)
PrintResult("-11.0R <> -3S", -11.0R <> -3S)
PrintResult("-11.0R <> 24US", -11.0R <> 24US)
PrintResult("-11.0R <> -5I", -11.0R <> -5I)
PrintResult("-11.0R <> 26UI", -11.0R <> 26UI)
PrintResult("-11.0R <> -7L", -11.0R <> -7L)
PrintResult("-11.0R <> 28UL", -11.0R <> 28UL)
PrintResult("-11.0R <> -9D", -11.0R <> -9D)
PrintResult("-11.0R <> 10.0F", -11.0R <> 10.0F)
PrintResult("-11.0R <> -11.0R", -11.0R <> -11.0R)
PrintResult("-11.0R <> ""12""", -11.0R <> "12")
PrintResult("-11.0R <> TypeCode.Double", -11.0R <> TypeCode.Double)
PrintResult("""12"" <> False", "12" <> False)
PrintResult("""12"" <> True", "12" <> True)
PrintResult("""12"" <> System.SByte.MinValue", "12" <> System.SByte.MinValue)
PrintResult("""12"" <> System.Byte.MaxValue", "12" <> System.Byte.MaxValue)
PrintResult("""12"" <> -3S", "12" <> -3S)
PrintResult("""12"" <> 24US", "12" <> 24US)
PrintResult("""12"" <> -5I", "12" <> -5I)
PrintResult("""12"" <> 26UI", "12" <> 26UI)
PrintResult("""12"" <> -7L", "12" <> -7L)
PrintResult("""12"" <> 28UL", "12" <> 28UL)
PrintResult("""12"" <> -9D", "12" <> -9D)
PrintResult("""12"" <> 10.0F", "12" <> 10.0F)
PrintResult("""12"" <> -11.0R", "12" <> -11.0R)
PrintResult("""12"" <> ""12""", "12" <> "12")
PrintResult("""12"" <> TypeCode.Double", "12" <> TypeCode.Double)
PrintResult("TypeCode.Double <> False", TypeCode.Double <> False)
PrintResult("TypeCode.Double <> True", TypeCode.Double <> True)
PrintResult("TypeCode.Double <> System.SByte.MinValue", TypeCode.Double <> System.SByte.MinValue)
PrintResult("TypeCode.Double <> System.Byte.MaxValue", TypeCode.Double <> System.Byte.MaxValue)
PrintResult("TypeCode.Double <> -3S", TypeCode.Double <> -3S)
PrintResult("TypeCode.Double <> 24US", TypeCode.Double <> 24US)
PrintResult("TypeCode.Double <> -5I", TypeCode.Double <> -5I)
PrintResult("TypeCode.Double <> 26UI", TypeCode.Double <> 26UI)
PrintResult("TypeCode.Double <> -7L", TypeCode.Double <> -7L)
PrintResult("TypeCode.Double <> 28UL", TypeCode.Double <> 28UL)
PrintResult("TypeCode.Double <> -9D", TypeCode.Double <> -9D)
PrintResult("TypeCode.Double <> 10.0F", TypeCode.Double <> 10.0F)
PrintResult("TypeCode.Double <> -11.0R", TypeCode.Double <> -11.0R)
PrintResult("TypeCode.Double <> ""12""", TypeCode.Double <> "12")
PrintResult("TypeCode.Double <> TypeCode.Double", TypeCode.Double <> TypeCode.Double)
PrintResult("False <= False", False <= False)
PrintResult("False <= True", False <= True)
PrintResult("False <= System.SByte.MinValue", False <= System.SByte.MinValue)
PrintResult("False <= System.Byte.MaxValue", False <= System.Byte.MaxValue)
PrintResult("False <= -3S", False <= -3S)
PrintResult("False <= 24US", False <= 24US)
PrintResult("False <= -5I", False <= -5I)
PrintResult("False <= 26UI", False <= 26UI)
PrintResult("False <= -7L", False <= -7L)
PrintResult("False <= 28UL", False <= 28UL)
PrintResult("False <= -9D", False <= -9D)
PrintResult("False <= 10.0F", False <= 10.0F)
PrintResult("False <= -11.0R", False <= -11.0R)
PrintResult("False <= ""12""", False <= "12")
PrintResult("False <= TypeCode.Double", False <= TypeCode.Double)
PrintResult("True <= False", True <= False)
PrintResult("True <= True", True <= True)
PrintResult("True <= System.SByte.MinValue", True <= System.SByte.MinValue)
PrintResult("True <= System.Byte.MaxValue", True <= System.Byte.MaxValue)
PrintResult("True <= -3S", True <= -3S)
PrintResult("True <= 24US", True <= 24US)
PrintResult("True <= -5I", True <= -5I)
PrintResult("True <= 26UI", True <= 26UI)
PrintResult("True <= -7L", True <= -7L)
PrintResult("True <= 28UL", True <= 28UL)
PrintResult("True <= -9D", True <= -9D)
PrintResult("True <= 10.0F", True <= 10.0F)
PrintResult("True <= -11.0R", True <= -11.0R)
PrintResult("True <= ""12""", True <= "12")
PrintResult("True <= TypeCode.Double", True <= TypeCode.Double)
PrintResult("System.SByte.MinValue <= False", System.SByte.MinValue <= False)
PrintResult("System.SByte.MinValue <= True", System.SByte.MinValue <= True)
PrintResult("System.SByte.MinValue <= System.SByte.MinValue", System.SByte.MinValue <= System.SByte.MinValue)
PrintResult("System.SByte.MinValue <= System.Byte.MaxValue", System.SByte.MinValue <= System.Byte.MaxValue)
PrintResult("System.SByte.MinValue <= -3S", System.SByte.MinValue <= -3S)
PrintResult("System.SByte.MinValue <= 24US", System.SByte.MinValue <= 24US)
PrintResult("System.SByte.MinValue <= -5I", System.SByte.MinValue <= -5I)
PrintResult("System.SByte.MinValue <= 26UI", System.SByte.MinValue <= 26UI)
PrintResult("System.SByte.MinValue <= -7L", System.SByte.MinValue <= -7L)
PrintResult("System.SByte.MinValue <= 28UL", System.SByte.MinValue <= 28UL)
PrintResult("System.SByte.MinValue <= -9D", System.SByte.MinValue <= -9D)
PrintResult("System.SByte.MinValue <= 10.0F", System.SByte.MinValue <= 10.0F)
PrintResult("System.SByte.MinValue <= -11.0R", System.SByte.MinValue <= -11.0R)
PrintResult("System.SByte.MinValue <= ""12""", System.SByte.MinValue <= "12")
PrintResult("System.SByte.MinValue <= TypeCode.Double", System.SByte.MinValue <= TypeCode.Double)
PrintResult("System.Byte.MaxValue <= False", System.Byte.MaxValue <= False)
PrintResult("System.Byte.MaxValue <= True", System.Byte.MaxValue <= True)
PrintResult("System.Byte.MaxValue <= System.SByte.MinValue", System.Byte.MaxValue <= System.SByte.MinValue)
PrintResult("System.Byte.MaxValue <= System.Byte.MaxValue", System.Byte.MaxValue <= System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue <= -3S", System.Byte.MaxValue <= -3S)
PrintResult("System.Byte.MaxValue <= 24US", System.Byte.MaxValue <= 24US)
PrintResult("System.Byte.MaxValue <= -5I", System.Byte.MaxValue <= -5I)
PrintResult("System.Byte.MaxValue <= 26UI", System.Byte.MaxValue <= 26UI)
PrintResult("System.Byte.MaxValue <= -7L", System.Byte.MaxValue <= -7L)
PrintResult("System.Byte.MaxValue <= 28UL", System.Byte.MaxValue <= 28UL)
PrintResult("System.Byte.MaxValue <= -9D", System.Byte.MaxValue <= -9D)
PrintResult("System.Byte.MaxValue <= 10.0F", System.Byte.MaxValue <= 10.0F)
PrintResult("System.Byte.MaxValue <= -11.0R", System.Byte.MaxValue <= -11.0R)
PrintResult("System.Byte.MaxValue <= ""12""", System.Byte.MaxValue <= "12")
PrintResult("System.Byte.MaxValue <= TypeCode.Double", System.Byte.MaxValue <= TypeCode.Double)
PrintResult("-3S <= False", -3S <= False)
PrintResult("-3S <= True", -3S <= True)
PrintResult("-3S <= System.SByte.MinValue", -3S <= System.SByte.MinValue)
PrintResult("-3S <= System.Byte.MaxValue", -3S <= System.Byte.MaxValue)
PrintResult("-3S <= -3S", -3S <= -3S)
PrintResult("-3S <= 24US", -3S <= 24US)
PrintResult("-3S <= -5I", -3S <= -5I)
PrintResult("-3S <= 26UI", -3S <= 26UI)
PrintResult("-3S <= -7L", -3S <= -7L)
PrintResult("-3S <= 28UL", -3S <= 28UL)
PrintResult("-3S <= -9D", -3S <= -9D)
PrintResult("-3S <= 10.0F", -3S <= 10.0F)
PrintResult("-3S <= -11.0R", -3S <= -11.0R)
PrintResult("-3S <= ""12""", -3S <= "12")
PrintResult("-3S <= TypeCode.Double", -3S <= TypeCode.Double)
PrintResult("24US <= False", 24US <= False)
PrintResult("24US <= True", 24US <= True)
PrintResult("24US <= System.SByte.MinValue", 24US <= System.SByte.MinValue)
PrintResult("24US <= System.Byte.MaxValue", 24US <= System.Byte.MaxValue)
PrintResult("24US <= -3S", 24US <= -3S)
PrintResult("24US <= 24US", 24US <= 24US)
PrintResult("24US <= -5I", 24US <= -5I)
PrintResult("24US <= 26UI", 24US <= 26UI)
PrintResult("24US <= -7L", 24US <= -7L)
PrintResult("24US <= 28UL", 24US <= 28UL)
PrintResult("24US <= -9D", 24US <= -9D)
PrintResult("24US <= 10.0F", 24US <= 10.0F)
PrintResult("24US <= -11.0R", 24US <= -11.0R)
PrintResult("24US <= ""12""", 24US <= "12")
PrintResult("24US <= TypeCode.Double", 24US <= TypeCode.Double)
PrintResult("-5I <= False", -5I <= False)
PrintResult("-5I <= True", -5I <= True)
PrintResult("-5I <= System.SByte.MinValue", -5I <= System.SByte.MinValue)
PrintResult("-5I <= System.Byte.MaxValue", -5I <= System.Byte.MaxValue)
PrintResult("-5I <= -3S", -5I <= -3S)
PrintResult("-5I <= 24US", -5I <= 24US)
PrintResult("-5I <= -5I", -5I <= -5I)
PrintResult("-5I <= 26UI", -5I <= 26UI)
PrintResult("-5I <= -7L", -5I <= -7L)
PrintResult("-5I <= 28UL", -5I <= 28UL)
PrintResult("-5I <= -9D", -5I <= -9D)
PrintResult("-5I <= 10.0F", -5I <= 10.0F)
PrintResult("-5I <= -11.0R", -5I <= -11.0R)
PrintResult("-5I <= ""12""", -5I <= "12")
PrintResult("-5I <= TypeCode.Double", -5I <= TypeCode.Double)
PrintResult("26UI <= False", 26UI <= False)
PrintResult("26UI <= True", 26UI <= True)
PrintResult("26UI <= System.SByte.MinValue", 26UI <= System.SByte.MinValue)
PrintResult("26UI <= System.Byte.MaxValue", 26UI <= System.Byte.MaxValue)
PrintResult("26UI <= -3S", 26UI <= -3S)
PrintResult("26UI <= 24US", 26UI <= 24US)
PrintResult("26UI <= -5I", 26UI <= -5I)
PrintResult("26UI <= 26UI", 26UI <= 26UI)
PrintResult("26UI <= -7L", 26UI <= -7L)
PrintResult("26UI <= 28UL", 26UI <= 28UL)
PrintResult("26UI <= -9D", 26UI <= -9D)
PrintResult("26UI <= 10.0F", 26UI <= 10.0F)
PrintResult("26UI <= -11.0R", 26UI <= -11.0R)
PrintResult("26UI <= ""12""", 26UI <= "12")
PrintResult("26UI <= TypeCode.Double", 26UI <= TypeCode.Double)
PrintResult("-7L <= False", -7L <= False)
PrintResult("-7L <= True", -7L <= True)
PrintResult("-7L <= System.SByte.MinValue", -7L <= System.SByte.MinValue)
PrintResult("-7L <= System.Byte.MaxValue", -7L <= System.Byte.MaxValue)
PrintResult("-7L <= -3S", -7L <= -3S)
PrintResult("-7L <= 24US", -7L <= 24US)
PrintResult("-7L <= -5I", -7L <= -5I)
PrintResult("-7L <= 26UI", -7L <= 26UI)
PrintResult("-7L <= -7L", -7L <= -7L)
PrintResult("-7L <= 28UL", -7L <= 28UL)
PrintResult("-7L <= -9D", -7L <= -9D)
PrintResult("-7L <= 10.0F", -7L <= 10.0F)
PrintResult("-7L <= -11.0R", -7L <= -11.0R)
PrintResult("-7L <= ""12""", -7L <= "12")
PrintResult("-7L <= TypeCode.Double", -7L <= TypeCode.Double)
PrintResult("28UL <= False", 28UL <= False)
PrintResult("28UL <= True", 28UL <= True)
PrintResult("28UL <= System.SByte.MinValue", 28UL <= System.SByte.MinValue)
PrintResult("28UL <= System.Byte.MaxValue", 28UL <= System.Byte.MaxValue)
PrintResult("28UL <= -3S", 28UL <= -3S)
PrintResult("28UL <= 24US", 28UL <= 24US)
PrintResult("28UL <= -5I", 28UL <= -5I)
PrintResult("28UL <= 26UI", 28UL <= 26UI)
PrintResult("28UL <= -7L", 28UL <= -7L)
PrintResult("28UL <= 28UL", 28UL <= 28UL)
PrintResult("28UL <= -9D", 28UL <= -9D)
PrintResult("28UL <= 10.0F", 28UL <= 10.0F)
PrintResult("28UL <= -11.0R", 28UL <= -11.0R)
PrintResult("28UL <= ""12""", 28UL <= "12")
PrintResult("28UL <= TypeCode.Double", 28UL <= TypeCode.Double)
PrintResult("-9D <= False", -9D <= False)
PrintResult("-9D <= True", -9D <= True)
PrintResult("-9D <= System.SByte.MinValue", -9D <= System.SByte.MinValue)
PrintResult("-9D <= System.Byte.MaxValue", -9D <= System.Byte.MaxValue)
PrintResult("-9D <= -3S", -9D <= -3S)
PrintResult("-9D <= 24US", -9D <= 24US)
PrintResult("-9D <= -5I", -9D <= -5I)
PrintResult("-9D <= 26UI", -9D <= 26UI)
PrintResult("-9D <= -7L", -9D <= -7L)
PrintResult("-9D <= 28UL", -9D <= 28UL)
PrintResult("-9D <= -9D", -9D <= -9D)
PrintResult("-9D <= 10.0F", -9D <= 10.0F)
PrintResult("-9D <= -11.0R", -9D <= -11.0R)
PrintResult("-9D <= ""12""", -9D <= "12")
PrintResult("-9D <= TypeCode.Double", -9D <= TypeCode.Double)
PrintResult("10.0F <= False", 10.0F <= False)
PrintResult("10.0F <= True", 10.0F <= True)
PrintResult("10.0F <= System.SByte.MinValue", 10.0F <= System.SByte.MinValue)
PrintResult("10.0F <= System.Byte.MaxValue", 10.0F <= System.Byte.MaxValue)
PrintResult("10.0F <= -3S", 10.0F <= -3S)
PrintResult("10.0F <= 24US", 10.0F <= 24US)
PrintResult("10.0F <= -5I", 10.0F <= -5I)
PrintResult("10.0F <= 26UI", 10.0F <= 26UI)
PrintResult("10.0F <= -7L", 10.0F <= -7L)
PrintResult("10.0F <= 28UL", 10.0F <= 28UL)
PrintResult("10.0F <= -9D", 10.0F <= -9D)
PrintResult("10.0F <= 10.0F", 10.0F <= 10.0F)
PrintResult("10.0F <= -11.0R", 10.0F <= -11.0R)
PrintResult("10.0F <= ""12""", 10.0F <= "12")
PrintResult("10.0F <= TypeCode.Double", 10.0F <= TypeCode.Double)
PrintResult("-11.0R <= False", -11.0R <= False)
PrintResult("-11.0R <= True", -11.0R <= True)
PrintResult("-11.0R <= System.SByte.MinValue", -11.0R <= System.SByte.MinValue)
PrintResult("-11.0R <= System.Byte.MaxValue", -11.0R <= System.Byte.MaxValue)
PrintResult("-11.0R <= -3S", -11.0R <= -3S)
PrintResult("-11.0R <= 24US", -11.0R <= 24US)
PrintResult("-11.0R <= -5I", -11.0R <= -5I)
PrintResult("-11.0R <= 26UI", -11.0R <= 26UI)
PrintResult("-11.0R <= -7L", -11.0R <= -7L)
PrintResult("-11.0R <= 28UL", -11.0R <= 28UL)
PrintResult("-11.0R <= -9D", -11.0R <= -9D)
PrintResult("-11.0R <= 10.0F", -11.0R <= 10.0F)
PrintResult("-11.0R <= -11.0R", -11.0R <= -11.0R)
PrintResult("-11.0R <= ""12""", -11.0R <= "12")
PrintResult("-11.0R <= TypeCode.Double", -11.0R <= TypeCode.Double)
PrintResult("""12"" <= False", "12" <= False)
PrintResult("""12"" <= True", "12" <= True)
PrintResult("""12"" <= System.SByte.MinValue", "12" <= System.SByte.MinValue)
PrintResult("""12"" <= System.Byte.MaxValue", "12" <= System.Byte.MaxValue)
PrintResult("""12"" <= -3S", "12" <= -3S)
PrintResult("""12"" <= 24US", "12" <= 24US)
PrintResult("""12"" <= -5I", "12" <= -5I)
PrintResult("""12"" <= 26UI", "12" <= 26UI)
PrintResult("""12"" <= -7L", "12" <= -7L)
PrintResult("""12"" <= 28UL", "12" <= 28UL)
PrintResult("""12"" <= -9D", "12" <= -9D)
PrintResult("""12"" <= 10.0F", "12" <= 10.0F)
PrintResult("""12"" <= -11.0R", "12" <= -11.0R)
PrintResult("""12"" <= ""12""", "12" <= "12")
PrintResult("""12"" <= TypeCode.Double", "12" <= TypeCode.Double)
PrintResult("TypeCode.Double <= False", TypeCode.Double <= False)
PrintResult("TypeCode.Double <= True", TypeCode.Double <= True)
PrintResult("TypeCode.Double <= System.SByte.MinValue", TypeCode.Double <= System.SByte.MinValue)
PrintResult("TypeCode.Double <= System.Byte.MaxValue", TypeCode.Double <= System.Byte.MaxValue)
PrintResult("TypeCode.Double <= -3S", TypeCode.Double <= -3S)
PrintResult("TypeCode.Double <= 24US", TypeCode.Double <= 24US)
PrintResult("TypeCode.Double <= -5I", TypeCode.Double <= -5I)
PrintResult("TypeCode.Double <= 26UI", TypeCode.Double <= 26UI)
PrintResult("TypeCode.Double <= -7L", TypeCode.Double <= -7L)
PrintResult("TypeCode.Double <= 28UL", TypeCode.Double <= 28UL)
PrintResult("TypeCode.Double <= -9D", TypeCode.Double <= -9D)
PrintResult("TypeCode.Double <= 10.0F", TypeCode.Double <= 10.0F)
PrintResult("TypeCode.Double <= -11.0R", TypeCode.Double <= -11.0R)
PrintResult("TypeCode.Double <= ""12""", TypeCode.Double <= "12")
PrintResult("TypeCode.Double <= TypeCode.Double", TypeCode.Double <= TypeCode.Double)
PrintResult("False >= False", False >= False)
PrintResult("False >= True", False >= True)
PrintResult("False >= System.SByte.MinValue", False >= System.SByte.MinValue)
PrintResult("False >= System.Byte.MaxValue", False >= System.Byte.MaxValue)
PrintResult("False >= -3S", False >= -3S)
PrintResult("False >= 24US", False >= 24US)
PrintResult("False >= -5I", False >= -5I)
PrintResult("False >= 26UI", False >= 26UI)
PrintResult("False >= -7L", False >= -7L)
PrintResult("False >= 28UL", False >= 28UL)
PrintResult("False >= -9D", False >= -9D)
PrintResult("False >= 10.0F", False >= 10.0F)
PrintResult("False >= -11.0R", False >= -11.0R)
PrintResult("False >= ""12""", False >= "12")
PrintResult("False >= TypeCode.Double", False >= TypeCode.Double)
PrintResult("True >= False", True >= False)
PrintResult("True >= True", True >= True)
PrintResult("True >= System.SByte.MinValue", True >= System.SByte.MinValue)
PrintResult("True >= System.Byte.MaxValue", True >= System.Byte.MaxValue)
PrintResult("True >= -3S", True >= -3S)
PrintResult("True >= 24US", True >= 24US)
PrintResult("True >= -5I", True >= -5I)
PrintResult("True >= 26UI", True >= 26UI)
PrintResult("True >= -7L", True >= -7L)
PrintResult("True >= 28UL", True >= 28UL)
PrintResult("True >= -9D", True >= -9D)
PrintResult("True >= 10.0F", True >= 10.0F)
PrintResult("True >= -11.0R", True >= -11.0R)
PrintResult("True >= ""12""", True >= "12")
PrintResult("True >= TypeCode.Double", True >= TypeCode.Double)
PrintResult("System.SByte.MinValue >= False", System.SByte.MinValue >= False)
PrintResult("System.SByte.MinValue >= True", System.SByte.MinValue >= True)
PrintResult("System.SByte.MinValue >= System.SByte.MinValue", System.SByte.MinValue >= System.SByte.MinValue)
PrintResult("System.SByte.MinValue >= System.Byte.MaxValue", System.SByte.MinValue >= System.Byte.MaxValue)
PrintResult("System.SByte.MinValue >= -3S", System.SByte.MinValue >= -3S)
PrintResult("System.SByte.MinValue >= 24US", System.SByte.MinValue >= 24US)
PrintResult("System.SByte.MinValue >= -5I", System.SByte.MinValue >= -5I)
PrintResult("System.SByte.MinValue >= 26UI", System.SByte.MinValue >= 26UI)
PrintResult("System.SByte.MinValue >= -7L", System.SByte.MinValue >= -7L)
PrintResult("System.SByte.MinValue >= 28UL", System.SByte.MinValue >= 28UL)
PrintResult("System.SByte.MinValue >= -9D", System.SByte.MinValue >= -9D)
PrintResult("System.SByte.MinValue >= 10.0F", System.SByte.MinValue >= 10.0F)
PrintResult("System.SByte.MinValue >= -11.0R", System.SByte.MinValue >= -11.0R)
PrintResult("System.SByte.MinValue >= ""12""", System.SByte.MinValue >= "12")
PrintResult("System.SByte.MinValue >= TypeCode.Double", System.SByte.MinValue >= TypeCode.Double)
PrintResult("System.Byte.MaxValue >= False", System.Byte.MaxValue >= False)
PrintResult("System.Byte.MaxValue >= True", System.Byte.MaxValue >= True)
PrintResult("System.Byte.MaxValue >= System.SByte.MinValue", System.Byte.MaxValue >= System.SByte.MinValue)
PrintResult("System.Byte.MaxValue >= System.Byte.MaxValue", System.Byte.MaxValue >= System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue >= -3S", System.Byte.MaxValue >= -3S)
PrintResult("System.Byte.MaxValue >= 24US", System.Byte.MaxValue >= 24US)
PrintResult("System.Byte.MaxValue >= -5I", System.Byte.MaxValue >= -5I)
PrintResult("System.Byte.MaxValue >= 26UI", System.Byte.MaxValue >= 26UI)
PrintResult("System.Byte.MaxValue >= -7L", System.Byte.MaxValue >= -7L)
PrintResult("System.Byte.MaxValue >= 28UL", System.Byte.MaxValue >= 28UL)
PrintResult("System.Byte.MaxValue >= -9D", System.Byte.MaxValue >= -9D)
PrintResult("System.Byte.MaxValue >= 10.0F", System.Byte.MaxValue >= 10.0F)
PrintResult("System.Byte.MaxValue >= -11.0R", System.Byte.MaxValue >= -11.0R)
PrintResult("System.Byte.MaxValue >= ""12""", System.Byte.MaxValue >= "12")
PrintResult("System.Byte.MaxValue >= TypeCode.Double", System.Byte.MaxValue >= TypeCode.Double)
PrintResult("-3S >= False", -3S >= False)
PrintResult("-3S >= True", -3S >= True)
PrintResult("-3S >= System.SByte.MinValue", -3S >= System.SByte.MinValue)
PrintResult("-3S >= System.Byte.MaxValue", -3S >= System.Byte.MaxValue)
PrintResult("-3S >= -3S", -3S >= -3S)
PrintResult("-3S >= 24US", -3S >= 24US)
PrintResult("-3S >= -5I", -3S >= -5I)
PrintResult("-3S >= 26UI", -3S >= 26UI)
PrintResult("-3S >= -7L", -3S >= -7L)
PrintResult("-3S >= 28UL", -3S >= 28UL)
PrintResult("-3S >= -9D", -3S >= -9D)
PrintResult("-3S >= 10.0F", -3S >= 10.0F)
PrintResult("-3S >= -11.0R", -3S >= -11.0R)
PrintResult("-3S >= ""12""", -3S >= "12")
PrintResult("-3S >= TypeCode.Double", -3S >= TypeCode.Double)
PrintResult("24US >= False", 24US >= False)
PrintResult("24US >= True", 24US >= True)
PrintResult("24US >= System.SByte.MinValue", 24US >= System.SByte.MinValue)
PrintResult("24US >= System.Byte.MaxValue", 24US >= System.Byte.MaxValue)
PrintResult("24US >= -3S", 24US >= -3S)
PrintResult("24US >= 24US", 24US >= 24US)
PrintResult("24US >= -5I", 24US >= -5I)
PrintResult("24US >= 26UI", 24US >= 26UI)
PrintResult("24US >= -7L", 24US >= -7L)
PrintResult("24US >= 28UL", 24US >= 28UL)
PrintResult("24US >= -9D", 24US >= -9D)
PrintResult("24US >= 10.0F", 24US >= 10.0F)
PrintResult("24US >= -11.0R", 24US >= -11.0R)
PrintResult("24US >= ""12""", 24US >= "12")
PrintResult("24US >= TypeCode.Double", 24US >= TypeCode.Double)
PrintResult("-5I >= False", -5I >= False)
PrintResult("-5I >= True", -5I >= True)
PrintResult("-5I >= System.SByte.MinValue", -5I >= System.SByte.MinValue)
PrintResult("-5I >= System.Byte.MaxValue", -5I >= System.Byte.MaxValue)
PrintResult("-5I >= -3S", -5I >= -3S)
PrintResult("-5I >= 24US", -5I >= 24US)
PrintResult("-5I >= -5I", -5I >= -5I)
PrintResult("-5I >= 26UI", -5I >= 26UI)
PrintResult("-5I >= -7L", -5I >= -7L)
PrintResult("-5I >= 28UL", -5I >= 28UL)
PrintResult("-5I >= -9D", -5I >= -9D)
PrintResult("-5I >= 10.0F", -5I >= 10.0F)
PrintResult("-5I >= -11.0R", -5I >= -11.0R)
PrintResult("-5I >= ""12""", -5I >= "12")
PrintResult("-5I >= TypeCode.Double", -5I >= TypeCode.Double)
PrintResult("26UI >= False", 26UI >= False)
PrintResult("26UI >= True", 26UI >= True)
PrintResult("26UI >= System.SByte.MinValue", 26UI >= System.SByte.MinValue)
PrintResult("26UI >= System.Byte.MaxValue", 26UI >= System.Byte.MaxValue)
PrintResult("26UI >= -3S", 26UI >= -3S)
PrintResult("26UI >= 24US", 26UI >= 24US)
PrintResult("26UI >= -5I", 26UI >= -5I)
PrintResult("26UI >= 26UI", 26UI >= 26UI)
PrintResult("26UI >= -7L", 26UI >= -7L)
PrintResult("26UI >= 28UL", 26UI >= 28UL)
PrintResult("26UI >= -9D", 26UI >= -9D)
PrintResult("26UI >= 10.0F", 26UI >= 10.0F)
PrintResult("26UI >= -11.0R", 26UI >= -11.0R)
PrintResult("26UI >= ""12""", 26UI >= "12")
PrintResult("26UI >= TypeCode.Double", 26UI >= TypeCode.Double)
PrintResult("-7L >= False", -7L >= False)
PrintResult("-7L >= True", -7L >= True)
PrintResult("-7L >= System.SByte.MinValue", -7L >= System.SByte.MinValue)
PrintResult("-7L >= System.Byte.MaxValue", -7L >= System.Byte.MaxValue)
PrintResult("-7L >= -3S", -7L >= -3S)
PrintResult("-7L >= 24US", -7L >= 24US)
PrintResult("-7L >= -5I", -7L >= -5I)
PrintResult("-7L >= 26UI", -7L >= 26UI)
PrintResult("-7L >= -7L", -7L >= -7L)
PrintResult("-7L >= 28UL", -7L >= 28UL)
PrintResult("-7L >= -9D", -7L >= -9D)
PrintResult("-7L >= 10.0F", -7L >= 10.0F)
PrintResult("-7L >= -11.0R", -7L >= -11.0R)
PrintResult("-7L >= ""12""", -7L >= "12")
PrintResult("-7L >= TypeCode.Double", -7L >= TypeCode.Double)
PrintResult("28UL >= False", 28UL >= False)
PrintResult("28UL >= True", 28UL >= True)
PrintResult("28UL >= System.SByte.MinValue", 28UL >= System.SByte.MinValue)
PrintResult("28UL >= System.Byte.MaxValue", 28UL >= System.Byte.MaxValue)
PrintResult("28UL >= -3S", 28UL >= -3S)
PrintResult("28UL >= 24US", 28UL >= 24US)
PrintResult("28UL >= -5I", 28UL >= -5I)
PrintResult("28UL >= 26UI", 28UL >= 26UI)
PrintResult("28UL >= -7L", 28UL >= -7L)
PrintResult("28UL >= 28UL", 28UL >= 28UL)
PrintResult("28UL >= -9D", 28UL >= -9D)
PrintResult("28UL >= 10.0F", 28UL >= 10.0F)
PrintResult("28UL >= -11.0R", 28UL >= -11.0R)
PrintResult("28UL >= ""12""", 28UL >= "12")
PrintResult("28UL >= TypeCode.Double", 28UL >= TypeCode.Double)
PrintResult("-9D >= False", -9D >= False)
PrintResult("-9D >= True", -9D >= True)
PrintResult("-9D >= System.SByte.MinValue", -9D >= System.SByte.MinValue)
PrintResult("-9D >= System.Byte.MaxValue", -9D >= System.Byte.MaxValue)
PrintResult("-9D >= -3S", -9D >= -3S)
PrintResult("-9D >= 24US", -9D >= 24US)
PrintResult("-9D >= -5I", -9D >= -5I)
PrintResult("-9D >= 26UI", -9D >= 26UI)
PrintResult("-9D >= -7L", -9D >= -7L)
PrintResult("-9D >= 28UL", -9D >= 28UL)
PrintResult("-9D >= -9D", -9D >= -9D)
PrintResult("-9D >= 10.0F", -9D >= 10.0F)
PrintResult("-9D >= -11.0R", -9D >= -11.0R)
PrintResult("-9D >= ""12""", -9D >= "12")
PrintResult("-9D >= TypeCode.Double", -9D >= TypeCode.Double)
PrintResult("10.0F >= False", 10.0F >= False)
PrintResult("10.0F >= True", 10.0F >= True)
PrintResult("10.0F >= System.SByte.MinValue", 10.0F >= System.SByte.MinValue)
PrintResult("10.0F >= System.Byte.MaxValue", 10.0F >= System.Byte.MaxValue)
PrintResult("10.0F >= -3S", 10.0F >= -3S)
PrintResult("10.0F >= 24US", 10.0F >= 24US)
PrintResult("10.0F >= -5I", 10.0F >= -5I)
PrintResult("10.0F >= 26UI", 10.0F >= 26UI)
PrintResult("10.0F >= -7L", 10.0F >= -7L)
PrintResult("10.0F >= 28UL", 10.0F >= 28UL)
PrintResult("10.0F >= -9D", 10.0F >= -9D)
PrintResult("10.0F >= 10.0F", 10.0F >= 10.0F)
PrintResult("10.0F >= -11.0R", 10.0F >= -11.0R)
PrintResult("10.0F >= ""12""", 10.0F >= "12")
PrintResult("10.0F >= TypeCode.Double", 10.0F >= TypeCode.Double)
PrintResult("-11.0R >= False", -11.0R >= False)
PrintResult("-11.0R >= True", -11.0R >= True)
PrintResult("-11.0R >= System.SByte.MinValue", -11.0R >= System.SByte.MinValue)
PrintResult("-11.0R >= System.Byte.MaxValue", -11.0R >= System.Byte.MaxValue)
PrintResult("-11.0R >= -3S", -11.0R >= -3S)
PrintResult("-11.0R >= 24US", -11.0R >= 24US)
PrintResult("-11.0R >= -5I", -11.0R >= -5I)
PrintResult("-11.0R >= 26UI", -11.0R >= 26UI)
PrintResult("-11.0R >= -7L", -11.0R >= -7L)
PrintResult("-11.0R >= 28UL", -11.0R >= 28UL)
PrintResult("-11.0R >= -9D", -11.0R >= -9D)
PrintResult("-11.0R >= 10.0F", -11.0R >= 10.0F)
PrintResult("-11.0R >= -11.0R", -11.0R >= -11.0R)
PrintResult("-11.0R >= ""12""", -11.0R >= "12")
PrintResult("-11.0R >= TypeCode.Double", -11.0R >= TypeCode.Double)
PrintResult("""12"" >= False", "12" >= False)
PrintResult("""12"" >= True", "12" >= True)
PrintResult("""12"" >= System.SByte.MinValue", "12" >= System.SByte.MinValue)
PrintResult("""12"" >= System.Byte.MaxValue", "12" >= System.Byte.MaxValue)
PrintResult("""12"" >= -3S", "12" >= -3S)
PrintResult("""12"" >= 24US", "12" >= 24US)
PrintResult("""12"" >= -5I", "12" >= -5I)
PrintResult("""12"" >= 26UI", "12" >= 26UI)
PrintResult("""12"" >= -7L", "12" >= -7L)
PrintResult("""12"" >= 28UL", "12" >= 28UL)
PrintResult("""12"" >= -9D", "12" >= -9D)
PrintResult("""12"" >= 10.0F", "12" >= 10.0F)
PrintResult("""12"" >= -11.0R", "12" >= -11.0R)
PrintResult("""12"" >= ""12""", "12" >= "12")
PrintResult("""12"" >= TypeCode.Double", "12" >= TypeCode.Double)
PrintResult("TypeCode.Double >= False", TypeCode.Double >= False)
PrintResult("TypeCode.Double >= True", TypeCode.Double >= True)
PrintResult("TypeCode.Double >= System.SByte.MinValue", TypeCode.Double >= System.SByte.MinValue)
PrintResult("TypeCode.Double >= System.Byte.MaxValue", TypeCode.Double >= System.Byte.MaxValue)
PrintResult("TypeCode.Double >= -3S", TypeCode.Double >= -3S)
PrintResult("TypeCode.Double >= 24US", TypeCode.Double >= 24US)
PrintResult("TypeCode.Double >= -5I", TypeCode.Double >= -5I)
PrintResult("TypeCode.Double >= 26UI", TypeCode.Double >= 26UI)
PrintResult("TypeCode.Double >= -7L", TypeCode.Double >= -7L)
PrintResult("TypeCode.Double >= 28UL", TypeCode.Double >= 28UL)
PrintResult("TypeCode.Double >= -9D", TypeCode.Double >= -9D)
PrintResult("TypeCode.Double >= 10.0F", TypeCode.Double >= 10.0F)
PrintResult("TypeCode.Double >= -11.0R", TypeCode.Double >= -11.0R)
PrintResult("TypeCode.Double >= ""12""", TypeCode.Double >= "12")
PrintResult("TypeCode.Double >= TypeCode.Double", TypeCode.Double >= TypeCode.Double)
PrintResult("False < False", False < False)
PrintResult("False < True", False < True)
PrintResult("False < System.SByte.MinValue", False < System.SByte.MinValue)
PrintResult("False < System.Byte.MaxValue", False < System.Byte.MaxValue)
PrintResult("False < -3S", False < -3S)
PrintResult("False < 24US", False < 24US)
PrintResult("False < -5I", False < -5I)
PrintResult("False < 26UI", False < 26UI)
PrintResult("False < -7L", False < -7L)
PrintResult("False < 28UL", False < 28UL)
PrintResult("False < -9D", False < -9D)
PrintResult("False < 10.0F", False < 10.0F)
PrintResult("False < -11.0R", False < -11.0R)
PrintResult("False < ""12""", False < "12")
PrintResult("False < TypeCode.Double", False < TypeCode.Double)
PrintResult("True < False", True < False)
PrintResult("True < True", True < True)
PrintResult("True < System.SByte.MinValue", True < System.SByte.MinValue)
PrintResult("True < System.Byte.MaxValue", True < System.Byte.MaxValue)
PrintResult("True < -3S", True < -3S)
PrintResult("True < 24US", True < 24US)
PrintResult("True < -5I", True < -5I)
PrintResult("True < 26UI", True < 26UI)
PrintResult("True < -7L", True < -7L)
PrintResult("True < 28UL", True < 28UL)
PrintResult("True < -9D", True < -9D)
PrintResult("True < 10.0F", True < 10.0F)
PrintResult("True < -11.0R", True < -11.0R)
PrintResult("True < ""12""", True < "12")
PrintResult("True < TypeCode.Double", True < TypeCode.Double)
PrintResult("System.SByte.MinValue < False", System.SByte.MinValue < False)
PrintResult("System.SByte.MinValue < True", System.SByte.MinValue < True)
PrintResult("System.SByte.MinValue < System.SByte.MinValue", System.SByte.MinValue < System.SByte.MinValue)
PrintResult("System.SByte.MinValue < System.Byte.MaxValue", System.SByte.MinValue < System.Byte.MaxValue)
PrintResult("System.SByte.MinValue < -3S", System.SByte.MinValue < -3S)
PrintResult("System.SByte.MinValue < 24US", System.SByte.MinValue < 24US)
PrintResult("System.SByte.MinValue < -5I", System.SByte.MinValue < -5I)
PrintResult("System.SByte.MinValue < 26UI", System.SByte.MinValue < 26UI)
PrintResult("System.SByte.MinValue < -7L", System.SByte.MinValue < -7L)
PrintResult("System.SByte.MinValue < 28UL", System.SByte.MinValue < 28UL)
PrintResult("System.SByte.MinValue < -9D", System.SByte.MinValue < -9D)
PrintResult("System.SByte.MinValue < 10.0F", System.SByte.MinValue < 10.0F)
PrintResult("System.SByte.MinValue < -11.0R", System.SByte.MinValue < -11.0R)
PrintResult("System.SByte.MinValue < ""12""", System.SByte.MinValue < "12")
PrintResult("System.SByte.MinValue < TypeCode.Double", System.SByte.MinValue < TypeCode.Double)
PrintResult("System.Byte.MaxValue < False", System.Byte.MaxValue < False)
PrintResult("System.Byte.MaxValue < True", System.Byte.MaxValue < True)
PrintResult("System.Byte.MaxValue < System.SByte.MinValue", System.Byte.MaxValue < System.SByte.MinValue)
PrintResult("System.Byte.MaxValue < System.Byte.MaxValue", System.Byte.MaxValue < System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue < -3S", System.Byte.MaxValue < -3S)
PrintResult("System.Byte.MaxValue < 24US", System.Byte.MaxValue < 24US)
PrintResult("System.Byte.MaxValue < -5I", System.Byte.MaxValue < -5I)
PrintResult("System.Byte.MaxValue < 26UI", System.Byte.MaxValue < 26UI)
PrintResult("System.Byte.MaxValue < -7L", System.Byte.MaxValue < -7L)
PrintResult("System.Byte.MaxValue < 28UL", System.Byte.MaxValue < 28UL)
PrintResult("System.Byte.MaxValue < -9D", System.Byte.MaxValue < -9D)
PrintResult("System.Byte.MaxValue < 10.0F", System.Byte.MaxValue < 10.0F)
PrintResult("System.Byte.MaxValue < -11.0R", System.Byte.MaxValue < -11.0R)
PrintResult("System.Byte.MaxValue < ""12""", System.Byte.MaxValue < "12")
PrintResult("System.Byte.MaxValue < TypeCode.Double", System.Byte.MaxValue < TypeCode.Double)
PrintResult("-3S < False", -3S < False)
PrintResult("-3S < True", -3S < True)
PrintResult("-3S < System.SByte.MinValue", -3S < System.SByte.MinValue)
PrintResult("-3S < System.Byte.MaxValue", -3S < System.Byte.MaxValue)
PrintResult("-3S < -3S", -3S < -3S)
PrintResult("-3S < 24US", -3S < 24US)
PrintResult("-3S < -5I", -3S < -5I)
PrintResult("-3S < 26UI", -3S < 26UI)
PrintResult("-3S < -7L", -3S < -7L)
PrintResult("-3S < 28UL", -3S < 28UL)
PrintResult("-3S < -9D", -3S < -9D)
PrintResult("-3S < 10.0F", -3S < 10.0F)
PrintResult("-3S < -11.0R", -3S < -11.0R)
PrintResult("-3S < ""12""", -3S < "12")
PrintResult("-3S < TypeCode.Double", -3S < TypeCode.Double)
PrintResult("24US < False", 24US < False)
PrintResult("24US < True", 24US < True)
PrintResult("24US < System.SByte.MinValue", 24US < System.SByte.MinValue)
PrintResult("24US < System.Byte.MaxValue", 24US < System.Byte.MaxValue)
PrintResult("24US < -3S", 24US < -3S)
PrintResult("24US < 24US", 24US < 24US)
PrintResult("24US < -5I", 24US < -5I)
PrintResult("24US < 26UI", 24US < 26UI)
PrintResult("24US < -7L", 24US < -7L)
PrintResult("24US < 28UL", 24US < 28UL)
PrintResult("24US < -9D", 24US < -9D)
PrintResult("24US < 10.0F", 24US < 10.0F)
PrintResult("24US < -11.0R", 24US < -11.0R)
PrintResult("24US < ""12""", 24US < "12")
PrintResult("24US < TypeCode.Double", 24US < TypeCode.Double)
PrintResult("-5I < False", -5I < False)
PrintResult("-5I < True", -5I < True)
PrintResult("-5I < System.SByte.MinValue", -5I < System.SByte.MinValue)
PrintResult("-5I < System.Byte.MaxValue", -5I < System.Byte.MaxValue)
PrintResult("-5I < -3S", -5I < -3S)
PrintResult("-5I < 24US", -5I < 24US)
PrintResult("-5I < -5I", -5I < -5I)
PrintResult("-5I < 26UI", -5I < 26UI)
PrintResult("-5I < -7L", -5I < -7L)
PrintResult("-5I < 28UL", -5I < 28UL)
PrintResult("-5I < -9D", -5I < -9D)
PrintResult("-5I < 10.0F", -5I < 10.0F)
PrintResult("-5I < -11.0R", -5I < -11.0R)
PrintResult("-5I < ""12""", -5I < "12")
PrintResult("-5I < TypeCode.Double", -5I < TypeCode.Double)
PrintResult("26UI < False", 26UI < False)
PrintResult("26UI < True", 26UI < True)
PrintResult("26UI < System.SByte.MinValue", 26UI < System.SByte.MinValue)
PrintResult("26UI < System.Byte.MaxValue", 26UI < System.Byte.MaxValue)
PrintResult("26UI < -3S", 26UI < -3S)
PrintResult("26UI < 24US", 26UI < 24US)
PrintResult("26UI < -5I", 26UI < -5I)
PrintResult("26UI < 26UI", 26UI < 26UI)
PrintResult("26UI < -7L", 26UI < -7L)
PrintResult("26UI < 28UL", 26UI < 28UL)
PrintResult("26UI < -9D", 26UI < -9D)
PrintResult("26UI < 10.0F", 26UI < 10.0F)
PrintResult("26UI < -11.0R", 26UI < -11.0R)
PrintResult("26UI < ""12""", 26UI < "12")
PrintResult("26UI < TypeCode.Double", 26UI < TypeCode.Double)
PrintResult("-7L < False", -7L < False)
PrintResult("-7L < True", -7L < True)
PrintResult("-7L < System.SByte.MinValue", -7L < System.SByte.MinValue)
PrintResult("-7L < System.Byte.MaxValue", -7L < System.Byte.MaxValue)
PrintResult("-7L < -3S", -7L < -3S)
PrintResult("-7L < 24US", -7L < 24US)
PrintResult("-7L < -5I", -7L < -5I)
PrintResult("-7L < 26UI", -7L < 26UI)
PrintResult("-7L < -7L", -7L < -7L)
PrintResult("-7L < 28UL", -7L < 28UL)
PrintResult("-7L < -9D", -7L < -9D)
PrintResult("-7L < 10.0F", -7L < 10.0F)
PrintResult("-7L < -11.0R", -7L < -11.0R)
PrintResult("-7L < ""12""", -7L < "12")
PrintResult("-7L < TypeCode.Double", -7L < TypeCode.Double)
PrintResult("28UL < False", 28UL < False)
PrintResult("28UL < True", 28UL < True)
PrintResult("28UL < System.SByte.MinValue", 28UL < System.SByte.MinValue)
PrintResult("28UL < System.Byte.MaxValue", 28UL < System.Byte.MaxValue)
PrintResult("28UL < -3S", 28UL < -3S)
PrintResult("28UL < 24US", 28UL < 24US)
PrintResult("28UL < -5I", 28UL < -5I)
PrintResult("28UL < 26UI", 28UL < 26UI)
PrintResult("28UL < -7L", 28UL < -7L)
PrintResult("28UL < 28UL", 28UL < 28UL)
PrintResult("28UL < -9D", 28UL < -9D)
PrintResult("28UL < 10.0F", 28UL < 10.0F)
PrintResult("28UL < -11.0R", 28UL < -11.0R)
PrintResult("28UL < ""12""", 28UL < "12")
PrintResult("28UL < TypeCode.Double", 28UL < TypeCode.Double)
PrintResult("-9D < False", -9D < False)
PrintResult("-9D < True", -9D < True)
PrintResult("-9D < System.SByte.MinValue", -9D < System.SByte.MinValue)
PrintResult("-9D < System.Byte.MaxValue", -9D < System.Byte.MaxValue)
PrintResult("-9D < -3S", -9D < -3S)
PrintResult("-9D < 24US", -9D < 24US)
PrintResult("-9D < -5I", -9D < -5I)
PrintResult("-9D < 26UI", -9D < 26UI)
PrintResult("-9D < -7L", -9D < -7L)
PrintResult("-9D < 28UL", -9D < 28UL)
PrintResult("-9D < -9D", -9D < -9D)
PrintResult("-9D < 10.0F", -9D < 10.0F)
PrintResult("-9D < -11.0R", -9D < -11.0R)
PrintResult("-9D < ""12""", -9D < "12")
PrintResult("-9D < TypeCode.Double", -9D < TypeCode.Double)
PrintResult("10.0F < False", 10.0F < False)
PrintResult("10.0F < True", 10.0F < True)
PrintResult("10.0F < System.SByte.MinValue", 10.0F < System.SByte.MinValue)
PrintResult("10.0F < System.Byte.MaxValue", 10.0F < System.Byte.MaxValue)
PrintResult("10.0F < -3S", 10.0F < -3S)
PrintResult("10.0F < 24US", 10.0F < 24US)
PrintResult("10.0F < -5I", 10.0F < -5I)
PrintResult("10.0F < 26UI", 10.0F < 26UI)
PrintResult("10.0F < -7L", 10.0F < -7L)
PrintResult("10.0F < 28UL", 10.0F < 28UL)
PrintResult("10.0F < -9D", 10.0F < -9D)
PrintResult("10.0F < 10.0F", 10.0F < 10.0F)
PrintResult("10.0F < -11.0R", 10.0F < -11.0R)
PrintResult("10.0F < ""12""", 10.0F < "12")
PrintResult("10.0F < TypeCode.Double", 10.0F < TypeCode.Double)
PrintResult("-11.0R < False", -11.0R < False)
PrintResult("-11.0R < True", -11.0R < True)
PrintResult("-11.0R < System.SByte.MinValue", -11.0R < System.SByte.MinValue)
PrintResult("-11.0R < System.Byte.MaxValue", -11.0R < System.Byte.MaxValue)
PrintResult("-11.0R < -3S", -11.0R < -3S)
PrintResult("-11.0R < 24US", -11.0R < 24US)
PrintResult("-11.0R < -5I", -11.0R < -5I)
PrintResult("-11.0R < 26UI", -11.0R < 26UI)
PrintResult("-11.0R < -7L", -11.0R < -7L)
PrintResult("-11.0R < 28UL", -11.0R < 28UL)
PrintResult("-11.0R < -9D", -11.0R < -9D)
PrintResult("-11.0R < 10.0F", -11.0R < 10.0F)
PrintResult("-11.0R < -11.0R", -11.0R < -11.0R)
PrintResult("-11.0R < ""12""", -11.0R < "12")
PrintResult("-11.0R < TypeCode.Double", -11.0R < TypeCode.Double)
PrintResult("""12"" < False", "12" < False)
PrintResult("""12"" < True", "12" < True)
PrintResult("""12"" < System.SByte.MinValue", "12" < System.SByte.MinValue)
PrintResult("""12"" < System.Byte.MaxValue", "12" < System.Byte.MaxValue)
PrintResult("""12"" < -3S", "12" < -3S)
PrintResult("""12"" < 24US", "12" < 24US)
PrintResult("""12"" < -5I", "12" < -5I)
PrintResult("""12"" < 26UI", "12" < 26UI)
PrintResult("""12"" < -7L", "12" < -7L)
PrintResult("""12"" < 28UL", "12" < 28UL)
PrintResult("""12"" < -9D", "12" < -9D)
PrintResult("""12"" < 10.0F", "12" < 10.0F)
PrintResult("""12"" < -11.0R", "12" < -11.0R)
PrintResult("""12"" < ""12""", "12" < "12")
PrintResult("""12"" < TypeCode.Double", "12" < TypeCode.Double)
PrintResult("TypeCode.Double < False", TypeCode.Double < False)
PrintResult("TypeCode.Double < True", TypeCode.Double < True)
PrintResult("TypeCode.Double < System.SByte.MinValue", TypeCode.Double < System.SByte.MinValue)
PrintResult("TypeCode.Double < System.Byte.MaxValue", TypeCode.Double < System.Byte.MaxValue)
PrintResult("TypeCode.Double < -3S", TypeCode.Double < -3S)
PrintResult("TypeCode.Double < 24US", TypeCode.Double < 24US)
PrintResult("TypeCode.Double < -5I", TypeCode.Double < -5I)
PrintResult("TypeCode.Double < 26UI", TypeCode.Double < 26UI)
PrintResult("TypeCode.Double < -7L", TypeCode.Double < -7L)
PrintResult("TypeCode.Double < 28UL", TypeCode.Double < 28UL)
PrintResult("TypeCode.Double < -9D", TypeCode.Double < -9D)
PrintResult("TypeCode.Double < 10.0F", TypeCode.Double < 10.0F)
PrintResult("TypeCode.Double < -11.0R", TypeCode.Double < -11.0R)
PrintResult("TypeCode.Double < ""12""", TypeCode.Double < "12")
PrintResult("TypeCode.Double < TypeCode.Double", TypeCode.Double < TypeCode.Double)
PrintResult("False > False", False > False)
PrintResult("False > True", False > True)
PrintResult("False > System.SByte.MinValue", False > System.SByte.MinValue)
PrintResult("False > System.Byte.MaxValue", False > System.Byte.MaxValue)
PrintResult("False > -3S", False > -3S)
PrintResult("False > 24US", False > 24US)
PrintResult("False > -5I", False > -5I)
PrintResult("False > 26UI", False > 26UI)
PrintResult("False > -7L", False > -7L)
PrintResult("False > 28UL", False > 28UL)
PrintResult("False > -9D", False > -9D)
PrintResult("False > 10.0F", False > 10.0F)
PrintResult("False > -11.0R", False > -11.0R)
PrintResult("False > ""12""", False > "12")
PrintResult("False > TypeCode.Double", False > TypeCode.Double)
PrintResult("True > False", True > False)
PrintResult("True > True", True > True)
PrintResult("True > System.SByte.MinValue", True > System.SByte.MinValue)
PrintResult("True > System.Byte.MaxValue", True > System.Byte.MaxValue)
PrintResult("True > -3S", True > -3S)
PrintResult("True > 24US", True > 24US)
PrintResult("True > -5I", True > -5I)
PrintResult("True > 26UI", True > 26UI)
PrintResult("True > -7L", True > -7L)
PrintResult("True > 28UL", True > 28UL)
PrintResult("True > -9D", True > -9D)
PrintResult("True > 10.0F", True > 10.0F)
PrintResult("True > -11.0R", True > -11.0R)
PrintResult("True > ""12""", True > "12")
PrintResult("True > TypeCode.Double", True > TypeCode.Double)
PrintResult("System.SByte.MinValue > False", System.SByte.MinValue > False)
PrintResult("System.SByte.MinValue > True", System.SByte.MinValue > True)
PrintResult("System.SByte.MinValue > System.SByte.MinValue", System.SByte.MinValue > System.SByte.MinValue)
PrintResult("System.SByte.MinValue > System.Byte.MaxValue", System.SByte.MinValue > System.Byte.MaxValue)
PrintResult("System.SByte.MinValue > -3S", System.SByte.MinValue > -3S)
PrintResult("System.SByte.MinValue > 24US", System.SByte.MinValue > 24US)
PrintResult("System.SByte.MinValue > -5I", System.SByte.MinValue > -5I)
PrintResult("System.SByte.MinValue > 26UI", System.SByte.MinValue > 26UI)
PrintResult("System.SByte.MinValue > -7L", System.SByte.MinValue > -7L)
PrintResult("System.SByte.MinValue > 28UL", System.SByte.MinValue > 28UL)
PrintResult("System.SByte.MinValue > -9D", System.SByte.MinValue > -9D)
PrintResult("System.SByte.MinValue > 10.0F", System.SByte.MinValue > 10.0F)
PrintResult("System.SByte.MinValue > -11.0R", System.SByte.MinValue > -11.0R)
PrintResult("System.SByte.MinValue > ""12""", System.SByte.MinValue > "12")
PrintResult("System.SByte.MinValue > TypeCode.Double", System.SByte.MinValue > TypeCode.Double)
PrintResult("System.Byte.MaxValue > False", System.Byte.MaxValue > False)
PrintResult("System.Byte.MaxValue > True", System.Byte.MaxValue > True)
PrintResult("System.Byte.MaxValue > System.SByte.MinValue", System.Byte.MaxValue > System.SByte.MinValue)
PrintResult("System.Byte.MaxValue > System.Byte.MaxValue", System.Byte.MaxValue > System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue > -3S", System.Byte.MaxValue > -3S)
PrintResult("System.Byte.MaxValue > 24US", System.Byte.MaxValue > 24US)
PrintResult("System.Byte.MaxValue > -5I", System.Byte.MaxValue > -5I)
PrintResult("System.Byte.MaxValue > 26UI", System.Byte.MaxValue > 26UI)
PrintResult("System.Byte.MaxValue > -7L", System.Byte.MaxValue > -7L)
PrintResult("System.Byte.MaxValue > 28UL", System.Byte.MaxValue > 28UL)
PrintResult("System.Byte.MaxValue > -9D", System.Byte.MaxValue > -9D)
PrintResult("System.Byte.MaxValue > 10.0F", System.Byte.MaxValue > 10.0F)
PrintResult("System.Byte.MaxValue > -11.0R", System.Byte.MaxValue > -11.0R)
PrintResult("System.Byte.MaxValue > ""12""", System.Byte.MaxValue > "12")
PrintResult("System.Byte.MaxValue > TypeCode.Double", System.Byte.MaxValue > TypeCode.Double)
PrintResult("-3S > False", -3S > False)
PrintResult("-3S > True", -3S > True)
PrintResult("-3S > System.SByte.MinValue", -3S > System.SByte.MinValue)
PrintResult("-3S > System.Byte.MaxValue", -3S > System.Byte.MaxValue)
PrintResult("-3S > -3S", -3S > -3S)
PrintResult("-3S > 24US", -3S > 24US)
PrintResult("-3S > -5I", -3S > -5I)
PrintResult("-3S > 26UI", -3S > 26UI)
PrintResult("-3S > -7L", -3S > -7L)
PrintResult("-3S > 28UL", -3S > 28UL)
PrintResult("-3S > -9D", -3S > -9D)
PrintResult("-3S > 10.0F", -3S > 10.0F)
PrintResult("-3S > -11.0R", -3S > -11.0R)
PrintResult("-3S > ""12""", -3S > "12")
PrintResult("-3S > TypeCode.Double", -3S > TypeCode.Double)
PrintResult("24US > False", 24US > False)
PrintResult("24US > True", 24US > True)
PrintResult("24US > System.SByte.MinValue", 24US > System.SByte.MinValue)
PrintResult("24US > System.Byte.MaxValue", 24US > System.Byte.MaxValue)
PrintResult("24US > -3S", 24US > -3S)
PrintResult("24US > 24US", 24US > 24US)
PrintResult("24US > -5I", 24US > -5I)
PrintResult("24US > 26UI", 24US > 26UI)
PrintResult("24US > -7L", 24US > -7L)
PrintResult("24US > 28UL", 24US > 28UL)
PrintResult("24US > -9D", 24US > -9D)
PrintResult("24US > 10.0F", 24US > 10.0F)
PrintResult("24US > -11.0R", 24US > -11.0R)
PrintResult("24US > ""12""", 24US > "12")
PrintResult("24US > TypeCode.Double", 24US > TypeCode.Double)
PrintResult("-5I > False", -5I > False)
PrintResult("-5I > True", -5I > True)
PrintResult("-5I > System.SByte.MinValue", -5I > System.SByte.MinValue)
PrintResult("-5I > System.Byte.MaxValue", -5I > System.Byte.MaxValue)
PrintResult("-5I > -3S", -5I > -3S)
PrintResult("-5I > 24US", -5I > 24US)
PrintResult("-5I > -5I", -5I > -5I)
PrintResult("-5I > 26UI", -5I > 26UI)
PrintResult("-5I > -7L", -5I > -7L)
PrintResult("-5I > 28UL", -5I > 28UL)
PrintResult("-5I > -9D", -5I > -9D)
PrintResult("-5I > 10.0F", -5I > 10.0F)
PrintResult("-5I > -11.0R", -5I > -11.0R)
PrintResult("-5I > ""12""", -5I > "12")
PrintResult("-5I > TypeCode.Double", -5I > TypeCode.Double)
PrintResult("26UI > False", 26UI > False)
PrintResult("26UI > True", 26UI > True)
PrintResult("26UI > System.SByte.MinValue", 26UI > System.SByte.MinValue)
PrintResult("26UI > System.Byte.MaxValue", 26UI > System.Byte.MaxValue)
PrintResult("26UI > -3S", 26UI > -3S)
PrintResult("26UI > 24US", 26UI > 24US)
PrintResult("26UI > -5I", 26UI > -5I)
PrintResult("26UI > 26UI", 26UI > 26UI)
PrintResult("26UI > -7L", 26UI > -7L)
PrintResult("26UI > 28UL", 26UI > 28UL)
PrintResult("26UI > -9D", 26UI > -9D)
PrintResult("26UI > 10.0F", 26UI > 10.0F)
PrintResult("26UI > -11.0R", 26UI > -11.0R)
PrintResult("26UI > ""12""", 26UI > "12")
PrintResult("26UI > TypeCode.Double", 26UI > TypeCode.Double)
PrintResult("-7L > False", -7L > False)
PrintResult("-7L > True", -7L > True)
PrintResult("-7L > System.SByte.MinValue", -7L > System.SByte.MinValue)
PrintResult("-7L > System.Byte.MaxValue", -7L > System.Byte.MaxValue)
PrintResult("-7L > -3S", -7L > -3S)
PrintResult("-7L > 24US", -7L > 24US)
PrintResult("-7L > -5I", -7L > -5I)
PrintResult("-7L > 26UI", -7L > 26UI)
PrintResult("-7L > -7L", -7L > -7L)
PrintResult("-7L > 28UL", -7L > 28UL)
PrintResult("-7L > -9D", -7L > -9D)
PrintResult("-7L > 10.0F", -7L > 10.0F)
PrintResult("-7L > -11.0R", -7L > -11.0R)
PrintResult("-7L > ""12""", -7L > "12")
PrintResult("-7L > TypeCode.Double", -7L > TypeCode.Double)
PrintResult("28UL > False", 28UL > False)
PrintResult("28UL > True", 28UL > True)
PrintResult("28UL > System.SByte.MinValue", 28UL > System.SByte.MinValue)
PrintResult("28UL > System.Byte.MaxValue", 28UL > System.Byte.MaxValue)
PrintResult("28UL > -3S", 28UL > -3S)
PrintResult("28UL > 24US", 28UL > 24US)
PrintResult("28UL > -5I", 28UL > -5I)
PrintResult("28UL > 26UI", 28UL > 26UI)
PrintResult("28UL > -7L", 28UL > -7L)
PrintResult("28UL > 28UL", 28UL > 28UL)
PrintResult("28UL > -9D", 28UL > -9D)
PrintResult("28UL > 10.0F", 28UL > 10.0F)
PrintResult("28UL > -11.0R", 28UL > -11.0R)
PrintResult("28UL > ""12""", 28UL > "12")
PrintResult("28UL > TypeCode.Double", 28UL > TypeCode.Double)
PrintResult("-9D > False", -9D > False)
PrintResult("-9D > True", -9D > True)
PrintResult("-9D > System.SByte.MinValue", -9D > System.SByte.MinValue)
PrintResult("-9D > System.Byte.MaxValue", -9D > System.Byte.MaxValue)
PrintResult("-9D > -3S", -9D > -3S)
PrintResult("-9D > 24US", -9D > 24US)
PrintResult("-9D > -5I", -9D > -5I)
PrintResult("-9D > 26UI", -9D > 26UI)
PrintResult("-9D > -7L", -9D > -7L)
PrintResult("-9D > 28UL", -9D > 28UL)
PrintResult("-9D > -9D", -9D > -9D)
PrintResult("-9D > 10.0F", -9D > 10.0F)
PrintResult("-9D > -11.0R", -9D > -11.0R)
PrintResult("-9D > ""12""", -9D > "12")
PrintResult("-9D > TypeCode.Double", -9D > TypeCode.Double)
PrintResult("10.0F > False", 10.0F > False)
PrintResult("10.0F > True", 10.0F > True)
PrintResult("10.0F > System.SByte.MinValue", 10.0F > System.SByte.MinValue)
PrintResult("10.0F > System.Byte.MaxValue", 10.0F > System.Byte.MaxValue)
PrintResult("10.0F > -3S", 10.0F > -3S)
PrintResult("10.0F > 24US", 10.0F > 24US)
PrintResult("10.0F > -5I", 10.0F > -5I)
PrintResult("10.0F > 26UI", 10.0F > 26UI)
PrintResult("10.0F > -7L", 10.0F > -7L)
PrintResult("10.0F > 28UL", 10.0F > 28UL)
PrintResult("10.0F > -9D", 10.0F > -9D)
PrintResult("10.0F > 10.0F", 10.0F > 10.0F)
PrintResult("10.0F > -11.0R", 10.0F > -11.0R)
PrintResult("10.0F > ""12""", 10.0F > "12")
PrintResult("10.0F > TypeCode.Double", 10.0F > TypeCode.Double)
PrintResult("-11.0R > False", -11.0R > False)
PrintResult("-11.0R > True", -11.0R > True)
PrintResult("-11.0R > System.SByte.MinValue", -11.0R > System.SByte.MinValue)
PrintResult("-11.0R > System.Byte.MaxValue", -11.0R > System.Byte.MaxValue)
PrintResult("-11.0R > -3S", -11.0R > -3S)
PrintResult("-11.0R > 24US", -11.0R > 24US)
PrintResult("-11.0R > -5I", -11.0R > -5I)
PrintResult("-11.0R > 26UI", -11.0R > 26UI)
PrintResult("-11.0R > -7L", -11.0R > -7L)
PrintResult("-11.0R > 28UL", -11.0R > 28UL)
PrintResult("-11.0R > -9D", -11.0R > -9D)
PrintResult("-11.0R > 10.0F", -11.0R > 10.0F)
PrintResult("-11.0R > -11.0R", -11.0R > -11.0R)
PrintResult("-11.0R > ""12""", -11.0R > "12")
PrintResult("-11.0R > TypeCode.Double", -11.0R > TypeCode.Double)
PrintResult("""12"" > False", "12" > False)
PrintResult("""12"" > True", "12" > True)
PrintResult("""12"" > System.SByte.MinValue", "12" > System.SByte.MinValue)
PrintResult("""12"" > System.Byte.MaxValue", "12" > System.Byte.MaxValue)
PrintResult("""12"" > -3S", "12" > -3S)
PrintResult("""12"" > 24US", "12" > 24US)
PrintResult("""12"" > -5I", "12" > -5I)
PrintResult("""12"" > 26UI", "12" > 26UI)
PrintResult("""12"" > -7L", "12" > -7L)
PrintResult("""12"" > 28UL", "12" > 28UL)
PrintResult("""12"" > -9D", "12" > -9D)
PrintResult("""12"" > 10.0F", "12" > 10.0F)
PrintResult("""12"" > -11.0R", "12" > -11.0R)
PrintResult("""12"" > ""12""", "12" > "12")
PrintResult("""12"" > TypeCode.Double", "12" > TypeCode.Double)
PrintResult("TypeCode.Double > False", TypeCode.Double > False)
PrintResult("TypeCode.Double > True", TypeCode.Double > True)
PrintResult("TypeCode.Double > System.SByte.MinValue", TypeCode.Double > System.SByte.MinValue)
PrintResult("TypeCode.Double > System.Byte.MaxValue", TypeCode.Double > System.Byte.MaxValue)
PrintResult("TypeCode.Double > -3S", TypeCode.Double > -3S)
PrintResult("TypeCode.Double > 24US", TypeCode.Double > 24US)
PrintResult("TypeCode.Double > -5I", TypeCode.Double > -5I)
PrintResult("TypeCode.Double > 26UI", TypeCode.Double > 26UI)
PrintResult("TypeCode.Double > -7L", TypeCode.Double > -7L)
PrintResult("TypeCode.Double > 28UL", TypeCode.Double > 28UL)
PrintResult("TypeCode.Double > -9D", TypeCode.Double > -9D)
PrintResult("TypeCode.Double > 10.0F", TypeCode.Double > 10.0F)
PrintResult("TypeCode.Double > -11.0R", TypeCode.Double > -11.0R)
PrintResult("TypeCode.Double > ""12""", TypeCode.Double > "12")
PrintResult("TypeCode.Double > TypeCode.Double", TypeCode.Double > TypeCode.Double)
PrintResult("False Xor False", False Xor False)
PrintResult("False Xor True", False Xor True)
PrintResult("False Xor System.SByte.MinValue", False Xor System.SByte.MinValue)
PrintResult("False Xor System.Byte.MaxValue", False Xor System.Byte.MaxValue)
PrintResult("False Xor -3S", False Xor -3S)
PrintResult("False Xor 24US", False Xor 24US)
PrintResult("False Xor -5I", False Xor -5I)
PrintResult("False Xor 26UI", False Xor 26UI)
PrintResult("False Xor -7L", False Xor -7L)
PrintResult("False Xor 28UL", False Xor 28UL)
PrintResult("False Xor -9D", False Xor -9D)
PrintResult("False Xor 10.0F", False Xor 10.0F)
PrintResult("False Xor -11.0R", False Xor -11.0R)
PrintResult("False Xor ""12""", False Xor "12")
PrintResult("False Xor TypeCode.Double", False Xor TypeCode.Double)
PrintResult("True Xor False", True Xor False)
PrintResult("True Xor True", True Xor True)
PrintResult("True Xor System.SByte.MinValue", True Xor System.SByte.MinValue)
PrintResult("True Xor System.Byte.MaxValue", True Xor System.Byte.MaxValue)
PrintResult("True Xor -3S", True Xor -3S)
PrintResult("True Xor 24US", True Xor 24US)
PrintResult("True Xor -5I", True Xor -5I)
PrintResult("True Xor 26UI", True Xor 26UI)
PrintResult("True Xor -7L", True Xor -7L)
PrintResult("True Xor 28UL", True Xor 28UL)
PrintResult("True Xor -9D", True Xor -9D)
PrintResult("True Xor 10.0F", True Xor 10.0F)
PrintResult("True Xor -11.0R", True Xor -11.0R)
PrintResult("True Xor ""12""", True Xor "12")
PrintResult("True Xor TypeCode.Double", True Xor TypeCode.Double)
PrintResult("System.SByte.MinValue Xor False", System.SByte.MinValue Xor False)
PrintResult("System.SByte.MinValue Xor True", System.SByte.MinValue Xor True)
PrintResult("System.SByte.MinValue Xor System.SByte.MinValue", System.SByte.MinValue Xor System.SByte.MinValue)
PrintResult("System.SByte.MinValue Xor System.Byte.MaxValue", System.SByte.MinValue Xor System.Byte.MaxValue)
PrintResult("System.SByte.MinValue Xor -3S", System.SByte.MinValue Xor -3S)
PrintResult("System.SByte.MinValue Xor 24US", System.SByte.MinValue Xor 24US)
PrintResult("System.SByte.MinValue Xor -5I", System.SByte.MinValue Xor -5I)
PrintResult("System.SByte.MinValue Xor 26UI", System.SByte.MinValue Xor 26UI)
PrintResult("System.SByte.MinValue Xor -7L", System.SByte.MinValue Xor -7L)
PrintResult("System.SByte.MinValue Xor 28UL", System.SByte.MinValue Xor 28UL)
PrintResult("System.SByte.MinValue Xor -9D", System.SByte.MinValue Xor -9D)
PrintResult("System.SByte.MinValue Xor 10.0F", System.SByte.MinValue Xor 10.0F)
PrintResult("System.SByte.MinValue Xor -11.0R", System.SByte.MinValue Xor -11.0R)
PrintResult("System.SByte.MinValue Xor ""12""", System.SByte.MinValue Xor "12")
PrintResult("System.SByte.MinValue Xor TypeCode.Double", System.SByte.MinValue Xor TypeCode.Double)
PrintResult("System.Byte.MaxValue Xor False", System.Byte.MaxValue Xor False)
PrintResult("System.Byte.MaxValue Xor True", System.Byte.MaxValue Xor True)
PrintResult("System.Byte.MaxValue Xor System.SByte.MinValue", System.Byte.MaxValue Xor System.SByte.MinValue)
PrintResult("System.Byte.MaxValue Xor System.Byte.MaxValue", System.Byte.MaxValue Xor System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue Xor -3S", System.Byte.MaxValue Xor -3S)
PrintResult("System.Byte.MaxValue Xor 24US", System.Byte.MaxValue Xor 24US)
PrintResult("System.Byte.MaxValue Xor -5I", System.Byte.MaxValue Xor -5I)
PrintResult("System.Byte.MaxValue Xor 26UI", System.Byte.MaxValue Xor 26UI)
PrintResult("System.Byte.MaxValue Xor -7L", System.Byte.MaxValue Xor -7L)
PrintResult("System.Byte.MaxValue Xor 28UL", System.Byte.MaxValue Xor 28UL)
PrintResult("System.Byte.MaxValue Xor -9D", System.Byte.MaxValue Xor -9D)
PrintResult("System.Byte.MaxValue Xor 10.0F", System.Byte.MaxValue Xor 10.0F)
PrintResult("System.Byte.MaxValue Xor -11.0R", System.Byte.MaxValue Xor -11.0R)
PrintResult("System.Byte.MaxValue Xor ""12""", System.Byte.MaxValue Xor "12")
PrintResult("System.Byte.MaxValue Xor TypeCode.Double", System.Byte.MaxValue Xor TypeCode.Double)
PrintResult("-3S Xor False", -3S Xor False)
PrintResult("-3S Xor True", -3S Xor True)
PrintResult("-3S Xor System.SByte.MinValue", -3S Xor System.SByte.MinValue)
PrintResult("-3S Xor System.Byte.MaxValue", -3S Xor System.Byte.MaxValue)
PrintResult("-3S Xor -3S", -3S Xor -3S)
PrintResult("-3S Xor 24US", -3S Xor 24US)
PrintResult("-3S Xor -5I", -3S Xor -5I)
PrintResult("-3S Xor 26UI", -3S Xor 26UI)
PrintResult("-3S Xor -7L", -3S Xor -7L)
PrintResult("-3S Xor 28UL", -3S Xor 28UL)
PrintResult("-3S Xor -9D", -3S Xor -9D)
PrintResult("-3S Xor 10.0F", -3S Xor 10.0F)
PrintResult("-3S Xor -11.0R", -3S Xor -11.0R)
PrintResult("-3S Xor ""12""", -3S Xor "12")
PrintResult("-3S Xor TypeCode.Double", -3S Xor TypeCode.Double)
PrintResult("24US Xor False", 24US Xor False)
PrintResult("24US Xor True", 24US Xor True)
PrintResult("24US Xor System.SByte.MinValue", 24US Xor System.SByte.MinValue)
PrintResult("24US Xor System.Byte.MaxValue", 24US Xor System.Byte.MaxValue)
PrintResult("24US Xor -3S", 24US Xor -3S)
PrintResult("24US Xor 24US", 24US Xor 24US)
PrintResult("24US Xor -5I", 24US Xor -5I)
PrintResult("24US Xor 26UI", 24US Xor 26UI)
PrintResult("24US Xor -7L", 24US Xor -7L)
PrintResult("24US Xor 28UL", 24US Xor 28UL)
PrintResult("24US Xor -9D", 24US Xor -9D)
PrintResult("24US Xor 10.0F", 24US Xor 10.0F)
PrintResult("24US Xor -11.0R", 24US Xor -11.0R)
PrintResult("24US Xor ""12""", 24US Xor "12")
PrintResult("24US Xor TypeCode.Double", 24US Xor TypeCode.Double)
PrintResult("-5I Xor False", -5I Xor False)
PrintResult("-5I Xor True", -5I Xor True)
PrintResult("-5I Xor System.SByte.MinValue", -5I Xor System.SByte.MinValue)
PrintResult("-5I Xor System.Byte.MaxValue", -5I Xor System.Byte.MaxValue)
PrintResult("-5I Xor -3S", -5I Xor -3S)
PrintResult("-5I Xor 24US", -5I Xor 24US)
PrintResult("-5I Xor -5I", -5I Xor -5I)
PrintResult("-5I Xor 26UI", -5I Xor 26UI)
PrintResult("-5I Xor -7L", -5I Xor -7L)
PrintResult("-5I Xor 28UL", -5I Xor 28UL)
PrintResult("-5I Xor -9D", -5I Xor -9D)
PrintResult("-5I Xor 10.0F", -5I Xor 10.0F)
PrintResult("-5I Xor -11.0R", -5I Xor -11.0R)
PrintResult("-5I Xor ""12""", -5I Xor "12")
PrintResult("-5I Xor TypeCode.Double", -5I Xor TypeCode.Double)
PrintResult("26UI Xor False", 26UI Xor False)
PrintResult("26UI Xor True", 26UI Xor True)
PrintResult("26UI Xor System.SByte.MinValue", 26UI Xor System.SByte.MinValue)
PrintResult("26UI Xor System.Byte.MaxValue", 26UI Xor System.Byte.MaxValue)
PrintResult("26UI Xor -3S", 26UI Xor -3S)
PrintResult("26UI Xor 24US", 26UI Xor 24US)
PrintResult("26UI Xor -5I", 26UI Xor -5I)
PrintResult("26UI Xor 26UI", 26UI Xor 26UI)
PrintResult("26UI Xor -7L", 26UI Xor -7L)
PrintResult("26UI Xor 28UL", 26UI Xor 28UL)
PrintResult("26UI Xor -9D", 26UI Xor -9D)
PrintResult("26UI Xor 10.0F", 26UI Xor 10.0F)
PrintResult("26UI Xor -11.0R", 26UI Xor -11.0R)
PrintResult("26UI Xor ""12""", 26UI Xor "12")
PrintResult("26UI Xor TypeCode.Double", 26UI Xor TypeCode.Double)
PrintResult("-7L Xor False", -7L Xor False)
PrintResult("-7L Xor True", -7L Xor True)
PrintResult("-7L Xor System.SByte.MinValue", -7L Xor System.SByte.MinValue)
PrintResult("-7L Xor System.Byte.MaxValue", -7L Xor System.Byte.MaxValue)
PrintResult("-7L Xor -3S", -7L Xor -3S)
PrintResult("-7L Xor 24US", -7L Xor 24US)
PrintResult("-7L Xor -5I", -7L Xor -5I)
PrintResult("-7L Xor 26UI", -7L Xor 26UI)
PrintResult("-7L Xor -7L", -7L Xor -7L)
PrintResult("-7L Xor 28UL", -7L Xor 28UL)
PrintResult("-7L Xor -9D", -7L Xor -9D)
PrintResult("-7L Xor 10.0F", -7L Xor 10.0F)
PrintResult("-7L Xor -11.0R", -7L Xor -11.0R)
PrintResult("-7L Xor ""12""", -7L Xor "12")
PrintResult("-7L Xor TypeCode.Double", -7L Xor TypeCode.Double)
PrintResult("28UL Xor False", 28UL Xor False)
PrintResult("28UL Xor True", 28UL Xor True)
PrintResult("28UL Xor System.SByte.MinValue", 28UL Xor System.SByte.MinValue)
PrintResult("28UL Xor System.Byte.MaxValue", 28UL Xor System.Byte.MaxValue)
PrintResult("28UL Xor -3S", 28UL Xor -3S)
PrintResult("28UL Xor 24US", 28UL Xor 24US)
PrintResult("28UL Xor -5I", 28UL Xor -5I)
PrintResult("28UL Xor 26UI", 28UL Xor 26UI)
PrintResult("28UL Xor -7L", 28UL Xor -7L)
PrintResult("28UL Xor 28UL", 28UL Xor 28UL)
PrintResult("28UL Xor -9D", 28UL Xor -9D)
PrintResult("28UL Xor 10.0F", 28UL Xor 10.0F)
PrintResult("28UL Xor -11.0R", 28UL Xor -11.0R)
PrintResult("28UL Xor ""12""", 28UL Xor "12")
PrintResult("28UL Xor TypeCode.Double", 28UL Xor TypeCode.Double)
PrintResult("-9D Xor False", -9D Xor False)
PrintResult("-9D Xor True", -9D Xor True)
PrintResult("-9D Xor System.SByte.MinValue", -9D Xor System.SByte.MinValue)
PrintResult("-9D Xor System.Byte.MaxValue", -9D Xor System.Byte.MaxValue)
PrintResult("-9D Xor -3S", -9D Xor -3S)
PrintResult("-9D Xor 24US", -9D Xor 24US)
PrintResult("-9D Xor -5I", -9D Xor -5I)
PrintResult("-9D Xor 26UI", -9D Xor 26UI)
PrintResult("-9D Xor -7L", -9D Xor -7L)
PrintResult("-9D Xor 28UL", -9D Xor 28UL)
PrintResult("-9D Xor -9D", -9D Xor -9D)
PrintResult("-9D Xor 10.0F", -9D Xor 10.0F)
PrintResult("-9D Xor -11.0R", -9D Xor -11.0R)
PrintResult("-9D Xor ""12""", -9D Xor "12")
PrintResult("-9D Xor TypeCode.Double", -9D Xor TypeCode.Double)
PrintResult("10.0F Xor False", 10.0F Xor False)
PrintResult("10.0F Xor True", 10.0F Xor True)
PrintResult("10.0F Xor System.SByte.MinValue", 10.0F Xor System.SByte.MinValue)
PrintResult("10.0F Xor System.Byte.MaxValue", 10.0F Xor System.Byte.MaxValue)
PrintResult("10.0F Xor -3S", 10.0F Xor -3S)
PrintResult("10.0F Xor 24US", 10.0F Xor 24US)
PrintResult("10.0F Xor -5I", 10.0F Xor -5I)
PrintResult("10.0F Xor 26UI", 10.0F Xor 26UI)
PrintResult("10.0F Xor -7L", 10.0F Xor -7L)
PrintResult("10.0F Xor 28UL", 10.0F Xor 28UL)
PrintResult("10.0F Xor -9D", 10.0F Xor -9D)
PrintResult("10.0F Xor 10.0F", 10.0F Xor 10.0F)
PrintResult("10.0F Xor -11.0R", 10.0F Xor -11.0R)
PrintResult("10.0F Xor ""12""", 10.0F Xor "12")
PrintResult("10.0F Xor TypeCode.Double", 10.0F Xor TypeCode.Double)
PrintResult("-11.0R Xor False", -11.0R Xor False)
PrintResult("-11.0R Xor True", -11.0R Xor True)
PrintResult("-11.0R Xor System.SByte.MinValue", -11.0R Xor System.SByte.MinValue)
PrintResult("-11.0R Xor System.Byte.MaxValue", -11.0R Xor System.Byte.MaxValue)
PrintResult("-11.0R Xor -3S", -11.0R Xor -3S)
PrintResult("-11.0R Xor 24US", -11.0R Xor 24US)
PrintResult("-11.0R Xor -5I", -11.0R Xor -5I)
PrintResult("-11.0R Xor 26UI", -11.0R Xor 26UI)
PrintResult("-11.0R Xor -7L", -11.0R Xor -7L)
PrintResult("-11.0R Xor 28UL", -11.0R Xor 28UL)
PrintResult("-11.0R Xor -9D", -11.0R Xor -9D)
PrintResult("-11.0R Xor 10.0F", -11.0R Xor 10.0F)
PrintResult("-11.0R Xor -11.0R", -11.0R Xor -11.0R)
PrintResult("-11.0R Xor ""12""", -11.0R Xor "12")
PrintResult("-11.0R Xor TypeCode.Double", -11.0R Xor TypeCode.Double)
PrintResult("""12"" Xor False", "12" Xor False)
PrintResult("""12"" Xor True", "12" Xor True)
PrintResult("""12"" Xor System.SByte.MinValue", "12" Xor System.SByte.MinValue)
PrintResult("""12"" Xor System.Byte.MaxValue", "12" Xor System.Byte.MaxValue)
PrintResult("""12"" Xor -3S", "12" Xor -3S)
PrintResult("""12"" Xor 24US", "12" Xor 24US)
PrintResult("""12"" Xor -5I", "12" Xor -5I)
PrintResult("""12"" Xor 26UI", "12" Xor 26UI)
PrintResult("""12"" Xor -7L", "12" Xor -7L)
PrintResult("""12"" Xor 28UL", "12" Xor 28UL)
PrintResult("""12"" Xor -9D", "12" Xor -9D)
PrintResult("""12"" Xor 10.0F", "12" Xor 10.0F)
PrintResult("""12"" Xor -11.0R", "12" Xor -11.0R)
PrintResult("""12"" Xor ""12""", "12" Xor "12")
PrintResult("""12"" Xor TypeCode.Double", "12" Xor TypeCode.Double)
PrintResult("TypeCode.Double Xor False", TypeCode.Double Xor False)
PrintResult("TypeCode.Double Xor True", TypeCode.Double Xor True)
PrintResult("TypeCode.Double Xor System.SByte.MinValue", TypeCode.Double Xor System.SByte.MinValue)
PrintResult("TypeCode.Double Xor System.Byte.MaxValue", TypeCode.Double Xor System.Byte.MaxValue)
PrintResult("TypeCode.Double Xor -3S", TypeCode.Double Xor -3S)
PrintResult("TypeCode.Double Xor 24US", TypeCode.Double Xor 24US)
PrintResult("TypeCode.Double Xor -5I", TypeCode.Double Xor -5I)
PrintResult("TypeCode.Double Xor 26UI", TypeCode.Double Xor 26UI)
PrintResult("TypeCode.Double Xor -7L", TypeCode.Double Xor -7L)
PrintResult("TypeCode.Double Xor 28UL", TypeCode.Double Xor 28UL)
PrintResult("TypeCode.Double Xor -9D", TypeCode.Double Xor -9D)
PrintResult("TypeCode.Double Xor 10.0F", TypeCode.Double Xor 10.0F)
PrintResult("TypeCode.Double Xor -11.0R", TypeCode.Double Xor -11.0R)
PrintResult("TypeCode.Double Xor ""12""", TypeCode.Double Xor "12")
PrintResult("TypeCode.Double Xor TypeCode.Double", TypeCode.Double Xor TypeCode.Double)
PrintResult("False Or False", False Or False)
PrintResult("False Or True", False Or True)
PrintResult("False Or System.SByte.MinValue", False Or System.SByte.MinValue)
PrintResult("False Or System.Byte.MaxValue", False Or System.Byte.MaxValue)
PrintResult("False Or -3S", False Or -3S)
PrintResult("False Or 24US", False Or 24US)
PrintResult("False Or -5I", False Or -5I)
PrintResult("False Or 26UI", False Or 26UI)
PrintResult("False Or -7L", False Or -7L)
PrintResult("False Or 28UL", False Or 28UL)
PrintResult("False Or -9D", False Or -9D)
PrintResult("False Or 10.0F", False Or 10.0F)
PrintResult("False Or -11.0R", False Or -11.0R)
PrintResult("False Or ""12""", False Or "12")
PrintResult("False Or TypeCode.Double", False Or TypeCode.Double)
PrintResult("True Or False", True Or False)
PrintResult("True Or True", True Or True)
PrintResult("True Or System.SByte.MinValue", True Or System.SByte.MinValue)
PrintResult("True Or System.Byte.MaxValue", True Or System.Byte.MaxValue)
PrintResult("True Or -3S", True Or -3S)
PrintResult("True Or 24US", True Or 24US)
PrintResult("True Or -5I", True Or -5I)
PrintResult("True Or 26UI", True Or 26UI)
PrintResult("True Or -7L", True Or -7L)
PrintResult("True Or 28UL", True Or 28UL)
PrintResult("True Or -9D", True Or -9D)
PrintResult("True Or 10.0F", True Or 10.0F)
PrintResult("True Or -11.0R", True Or -11.0R)
PrintResult("True Or ""12""", True Or "12")
PrintResult("True Or TypeCode.Double", True Or TypeCode.Double)
PrintResult("System.SByte.MinValue Or False", System.SByte.MinValue Or False)
PrintResult("System.SByte.MinValue Or True", System.SByte.MinValue Or True)
PrintResult("System.SByte.MinValue Or System.SByte.MinValue", System.SByte.MinValue Or System.SByte.MinValue)
PrintResult("System.SByte.MinValue Or System.Byte.MaxValue", System.SByte.MinValue Or System.Byte.MaxValue)
PrintResult("System.SByte.MinValue Or -3S", System.SByte.MinValue Or -3S)
PrintResult("System.SByte.MinValue Or 24US", System.SByte.MinValue Or 24US)
PrintResult("System.SByte.MinValue Or -5I", System.SByte.MinValue Or -5I)
PrintResult("System.SByte.MinValue Or 26UI", System.SByte.MinValue Or 26UI)
PrintResult("System.SByte.MinValue Or -7L", System.SByte.MinValue Or -7L)
PrintResult("System.SByte.MinValue Or 28UL", System.SByte.MinValue Or 28UL)
PrintResult("System.SByte.MinValue Or -9D", System.SByte.MinValue Or -9D)
PrintResult("System.SByte.MinValue Or 10.0F", System.SByte.MinValue Or 10.0F)
PrintResult("System.SByte.MinValue Or -11.0R", System.SByte.MinValue Or -11.0R)
PrintResult("System.SByte.MinValue Or ""12""", System.SByte.MinValue Or "12")
PrintResult("System.SByte.MinValue Or TypeCode.Double", System.SByte.MinValue Or TypeCode.Double)
PrintResult("System.Byte.MaxValue Or False", System.Byte.MaxValue Or False)
PrintResult("System.Byte.MaxValue Or True", System.Byte.MaxValue Or True)
PrintResult("System.Byte.MaxValue Or System.SByte.MinValue", System.Byte.MaxValue Or System.SByte.MinValue)
PrintResult("System.Byte.MaxValue Or System.Byte.MaxValue", System.Byte.MaxValue Or System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue Or -3S", System.Byte.MaxValue Or -3S)
PrintResult("System.Byte.MaxValue Or 24US", System.Byte.MaxValue Or 24US)
PrintResult("System.Byte.MaxValue Or -5I", System.Byte.MaxValue Or -5I)
PrintResult("System.Byte.MaxValue Or 26UI", System.Byte.MaxValue Or 26UI)
PrintResult("System.Byte.MaxValue Or -7L", System.Byte.MaxValue Or -7L)
PrintResult("System.Byte.MaxValue Or 28UL", System.Byte.MaxValue Or 28UL)
PrintResult("System.Byte.MaxValue Or -9D", System.Byte.MaxValue Or -9D)
PrintResult("System.Byte.MaxValue Or 10.0F", System.Byte.MaxValue Or 10.0F)
PrintResult("System.Byte.MaxValue Or -11.0R", System.Byte.MaxValue Or -11.0R)
PrintResult("System.Byte.MaxValue Or ""12""", System.Byte.MaxValue Or "12")
PrintResult("System.Byte.MaxValue Or TypeCode.Double", System.Byte.MaxValue Or TypeCode.Double)
PrintResult("-3S Or False", -3S Or False)
PrintResult("-3S Or True", -3S Or True)
PrintResult("-3S Or System.SByte.MinValue", -3S Or System.SByte.MinValue)
PrintResult("-3S Or System.Byte.MaxValue", -3S Or System.Byte.MaxValue)
PrintResult("-3S Or -3S", -3S Or -3S)
PrintResult("-3S Or 24US", -3S Or 24US)
PrintResult("-3S Or -5I", -3S Or -5I)
PrintResult("-3S Or 26UI", -3S Or 26UI)
PrintResult("-3S Or -7L", -3S Or -7L)
PrintResult("-3S Or 28UL", -3S Or 28UL)
PrintResult("-3S Or -9D", -3S Or -9D)
PrintResult("-3S Or 10.0F", -3S Or 10.0F)
PrintResult("-3S Or -11.0R", -3S Or -11.0R)
PrintResult("-3S Or ""12""", -3S Or "12")
PrintResult("-3S Or TypeCode.Double", -3S Or TypeCode.Double)
PrintResult("24US Or False", 24US Or False)
PrintResult("24US Or True", 24US Or True)
PrintResult("24US Or System.SByte.MinValue", 24US Or System.SByte.MinValue)
PrintResult("24US Or System.Byte.MaxValue", 24US Or System.Byte.MaxValue)
PrintResult("24US Or -3S", 24US Or -3S)
PrintResult("24US Or 24US", 24US Or 24US)
PrintResult("24US Or -5I", 24US Or -5I)
PrintResult("24US Or 26UI", 24US Or 26UI)
PrintResult("24US Or -7L", 24US Or -7L)
PrintResult("24US Or 28UL", 24US Or 28UL)
PrintResult("24US Or -9D", 24US Or -9D)
PrintResult("24US Or 10.0F", 24US Or 10.0F)
PrintResult("24US Or -11.0R", 24US Or -11.0R)
PrintResult("24US Or ""12""", 24US Or "12")
PrintResult("24US Or TypeCode.Double", 24US Or TypeCode.Double)
PrintResult("-5I Or False", -5I Or False)
PrintResult("-5I Or True", -5I Or True)
PrintResult("-5I Or System.SByte.MinValue", -5I Or System.SByte.MinValue)
PrintResult("-5I Or System.Byte.MaxValue", -5I Or System.Byte.MaxValue)
PrintResult("-5I Or -3S", -5I Or -3S)
PrintResult("-5I Or 24US", -5I Or 24US)
PrintResult("-5I Or -5I", -5I Or -5I)
PrintResult("-5I Or 26UI", -5I Or 26UI)
PrintResult("-5I Or -7L", -5I Or -7L)
PrintResult("-5I Or 28UL", -5I Or 28UL)
PrintResult("-5I Or -9D", -5I Or -9D)
PrintResult("-5I Or 10.0F", -5I Or 10.0F)
PrintResult("-5I Or -11.0R", -5I Or -11.0R)
PrintResult("-5I Or ""12""", -5I Or "12")
PrintResult("-5I Or TypeCode.Double", -5I Or TypeCode.Double)
PrintResult("26UI Or False", 26UI Or False)
PrintResult("26UI Or True", 26UI Or True)
PrintResult("26UI Or System.SByte.MinValue", 26UI Or System.SByte.MinValue)
PrintResult("26UI Or System.Byte.MaxValue", 26UI Or System.Byte.MaxValue)
PrintResult("26UI Or -3S", 26UI Or -3S)
PrintResult("26UI Or 24US", 26UI Or 24US)
PrintResult("26UI Or -5I", 26UI Or -5I)
PrintResult("26UI Or 26UI", 26UI Or 26UI)
PrintResult("26UI Or -7L", 26UI Or -7L)
PrintResult("26UI Or 28UL", 26UI Or 28UL)
PrintResult("26UI Or -9D", 26UI Or -9D)
PrintResult("26UI Or 10.0F", 26UI Or 10.0F)
PrintResult("26UI Or -11.0R", 26UI Or -11.0R)
PrintResult("26UI Or ""12""", 26UI Or "12")
PrintResult("26UI Or TypeCode.Double", 26UI Or TypeCode.Double)
PrintResult("-7L Or False", -7L Or False)
PrintResult("-7L Or True", -7L Or True)
PrintResult("-7L Or System.SByte.MinValue", -7L Or System.SByte.MinValue)
PrintResult("-7L Or System.Byte.MaxValue", -7L Or System.Byte.MaxValue)
PrintResult("-7L Or -3S", -7L Or -3S)
PrintResult("-7L Or 24US", -7L Or 24US)
PrintResult("-7L Or -5I", -7L Or -5I)
PrintResult("-7L Or 26UI", -7L Or 26UI)
PrintResult("-7L Or -7L", -7L Or -7L)
PrintResult("-7L Or 28UL", -7L Or 28UL)
PrintResult("-7L Or -9D", -7L Or -9D)
PrintResult("-7L Or 10.0F", -7L Or 10.0F)
PrintResult("-7L Or -11.0R", -7L Or -11.0R)
PrintResult("-7L Or ""12""", -7L Or "12")
PrintResult("-7L Or TypeCode.Double", -7L Or TypeCode.Double)
PrintResult("28UL Or False", 28UL Or False)
PrintResult("28UL Or True", 28UL Or True)
PrintResult("28UL Or System.SByte.MinValue", 28UL Or System.SByte.MinValue)
PrintResult("28UL Or System.Byte.MaxValue", 28UL Or System.Byte.MaxValue)
PrintResult("28UL Or -3S", 28UL Or -3S)
PrintResult("28UL Or 24US", 28UL Or 24US)
PrintResult("28UL Or -5I", 28UL Or -5I)
PrintResult("28UL Or 26UI", 28UL Or 26UI)
PrintResult("28UL Or -7L", 28UL Or -7L)
PrintResult("28UL Or 28UL", 28UL Or 28UL)
PrintResult("28UL Or -9D", 28UL Or -9D)
PrintResult("28UL Or 10.0F", 28UL Or 10.0F)
PrintResult("28UL Or -11.0R", 28UL Or -11.0R)
PrintResult("28UL Or ""12""", 28UL Or "12")
PrintResult("28UL Or TypeCode.Double", 28UL Or TypeCode.Double)
PrintResult("-9D Or False", -9D Or False)
PrintResult("-9D Or True", -9D Or True)
PrintResult("-9D Or System.SByte.MinValue", -9D Or System.SByte.MinValue)
PrintResult("-9D Or System.Byte.MaxValue", -9D Or System.Byte.MaxValue)
PrintResult("-9D Or -3S", -9D Or -3S)
PrintResult("-9D Or 24US", -9D Or 24US)
PrintResult("-9D Or -5I", -9D Or -5I)
PrintResult("-9D Or 26UI", -9D Or 26UI)
PrintResult("-9D Or -7L", -9D Or -7L)
PrintResult("-9D Or 28UL", -9D Or 28UL)
PrintResult("-9D Or -9D", -9D Or -9D)
PrintResult("-9D Or 10.0F", -9D Or 10.0F)
PrintResult("-9D Or -11.0R", -9D Or -11.0R)
PrintResult("-9D Or ""12""", -9D Or "12")
PrintResult("-9D Or TypeCode.Double", -9D Or TypeCode.Double)
PrintResult("10.0F Or False", 10.0F Or False)
PrintResult("10.0F Or True", 10.0F Or True)
PrintResult("10.0F Or System.SByte.MinValue", 10.0F Or System.SByte.MinValue)
PrintResult("10.0F Or System.Byte.MaxValue", 10.0F Or System.Byte.MaxValue)
PrintResult("10.0F Or -3S", 10.0F Or -3S)
PrintResult("10.0F Or 24US", 10.0F Or 24US)
PrintResult("10.0F Or -5I", 10.0F Or -5I)
PrintResult("10.0F Or 26UI", 10.0F Or 26UI)
PrintResult("10.0F Or -7L", 10.0F Or -7L)
PrintResult("10.0F Or 28UL", 10.0F Or 28UL)
PrintResult("10.0F Or -9D", 10.0F Or -9D)
PrintResult("10.0F Or 10.0F", 10.0F Or 10.0F)
PrintResult("10.0F Or -11.0R", 10.0F Or -11.0R)
PrintResult("10.0F Or ""12""", 10.0F Or "12")
PrintResult("10.0F Or TypeCode.Double", 10.0F Or TypeCode.Double)
PrintResult("-11.0R Or False", -11.0R Or False)
PrintResult("-11.0R Or True", -11.0R Or True)
PrintResult("-11.0R Or System.SByte.MinValue", -11.0R Or System.SByte.MinValue)
PrintResult("-11.0R Or System.Byte.MaxValue", -11.0R Or System.Byte.MaxValue)
PrintResult("-11.0R Or -3S", -11.0R Or -3S)
PrintResult("-11.0R Or 24US", -11.0R Or 24US)
PrintResult("-11.0R Or -5I", -11.0R Or -5I)
PrintResult("-11.0R Or 26UI", -11.0R Or 26UI)
PrintResult("-11.0R Or -7L", -11.0R Or -7L)
PrintResult("-11.0R Or 28UL", -11.0R Or 28UL)
PrintResult("-11.0R Or -9D", -11.0R Or -9D)
PrintResult("-11.0R Or 10.0F", -11.0R Or 10.0F)
PrintResult("-11.0R Or -11.0R", -11.0R Or -11.0R)
PrintResult("-11.0R Or ""12""", -11.0R Or "12")
PrintResult("-11.0R Or TypeCode.Double", -11.0R Or TypeCode.Double)
PrintResult("""12"" Or False", "12" Or False)
PrintResult("""12"" Or True", "12" Or True)
PrintResult("""12"" Or System.SByte.MinValue", "12" Or System.SByte.MinValue)
PrintResult("""12"" Or System.Byte.MaxValue", "12" Or System.Byte.MaxValue)
PrintResult("""12"" Or -3S", "12" Or -3S)
PrintResult("""12"" Or 24US", "12" Or 24US)
PrintResult("""12"" Or -5I", "12" Or -5I)
PrintResult("""12"" Or 26UI", "12" Or 26UI)
PrintResult("""12"" Or -7L", "12" Or -7L)
PrintResult("""12"" Or 28UL", "12" Or 28UL)
PrintResult("""12"" Or -9D", "12" Or -9D)
PrintResult("""12"" Or 10.0F", "12" Or 10.0F)
PrintResult("""12"" Or -11.0R", "12" Or -11.0R)
PrintResult("""12"" Or ""12""", "12" Or "12")
PrintResult("""12"" Or TypeCode.Double", "12" Or TypeCode.Double)
PrintResult("TypeCode.Double Or False", TypeCode.Double Or False)
PrintResult("TypeCode.Double Or True", TypeCode.Double Or True)
PrintResult("TypeCode.Double Or System.SByte.MinValue", TypeCode.Double Or System.SByte.MinValue)
PrintResult("TypeCode.Double Or System.Byte.MaxValue", TypeCode.Double Or System.Byte.MaxValue)
PrintResult("TypeCode.Double Or -3S", TypeCode.Double Or -3S)
PrintResult("TypeCode.Double Or 24US", TypeCode.Double Or 24US)
PrintResult("TypeCode.Double Or -5I", TypeCode.Double Or -5I)
PrintResult("TypeCode.Double Or 26UI", TypeCode.Double Or 26UI)
PrintResult("TypeCode.Double Or -7L", TypeCode.Double Or -7L)
PrintResult("TypeCode.Double Or 28UL", TypeCode.Double Or 28UL)
PrintResult("TypeCode.Double Or -9D", TypeCode.Double Or -9D)
PrintResult("TypeCode.Double Or 10.0F", TypeCode.Double Or 10.0F)
PrintResult("TypeCode.Double Or -11.0R", TypeCode.Double Or -11.0R)
PrintResult("TypeCode.Double Or ""12""", TypeCode.Double Or "12")
PrintResult("TypeCode.Double Or TypeCode.Double", TypeCode.Double Or TypeCode.Double)
PrintResult("False And False", False And False)
PrintResult("False And True", False And True)
PrintResult("False And System.SByte.MinValue", False And System.SByte.MinValue)
PrintResult("False And System.Byte.MaxValue", False And System.Byte.MaxValue)
PrintResult("False And -3S", False And -3S)
PrintResult("False And 24US", False And 24US)
PrintResult("False And -5I", False And -5I)
PrintResult("False And 26UI", False And 26UI)
PrintResult("False And -7L", False And -7L)
PrintResult("False And 28UL", False And 28UL)
PrintResult("False And -9D", False And -9D)
PrintResult("False And 10.0F", False And 10.0F)
PrintResult("False And -11.0R", False And -11.0R)
PrintResult("False And ""12""", False And "12")
PrintResult("False And TypeCode.Double", False And TypeCode.Double)
PrintResult("True And False", True And False)
PrintResult("True And True", True And True)
PrintResult("True And System.SByte.MinValue", True And System.SByte.MinValue)
PrintResult("True And System.Byte.MaxValue", True And System.Byte.MaxValue)
PrintResult("True And -3S", True And -3S)
PrintResult("True And 24US", True And 24US)
PrintResult("True And -5I", True And -5I)
PrintResult("True And 26UI", True And 26UI)
PrintResult("True And -7L", True And -7L)
PrintResult("True And 28UL", True And 28UL)
PrintResult("True And -9D", True And -9D)
PrintResult("True And 10.0F", True And 10.0F)
PrintResult("True And -11.0R", True And -11.0R)
PrintResult("True And ""12""", True And "12")
PrintResult("True And TypeCode.Double", True And TypeCode.Double)
PrintResult("System.SByte.MinValue And False", System.SByte.MinValue And False)
PrintResult("System.SByte.MinValue And True", System.SByte.MinValue And True)
PrintResult("System.SByte.MinValue And System.SByte.MinValue", System.SByte.MinValue And System.SByte.MinValue)
PrintResult("System.SByte.MinValue And System.Byte.MaxValue", System.SByte.MinValue And System.Byte.MaxValue)
PrintResult("System.SByte.MinValue And -3S", System.SByte.MinValue And -3S)
PrintResult("System.SByte.MinValue And 24US", System.SByte.MinValue And 24US)
PrintResult("System.SByte.MinValue And -5I", System.SByte.MinValue And -5I)
PrintResult("System.SByte.MinValue And 26UI", System.SByte.MinValue And 26UI)
PrintResult("System.SByte.MinValue And -7L", System.SByte.MinValue And -7L)
PrintResult("System.SByte.MinValue And 28UL", System.SByte.MinValue And 28UL)
PrintResult("System.SByte.MinValue And -9D", System.SByte.MinValue And -9D)
PrintResult("System.SByte.MinValue And 10.0F", System.SByte.MinValue And 10.0F)
PrintResult("System.SByte.MinValue And -11.0R", System.SByte.MinValue And -11.0R)
PrintResult("System.SByte.MinValue And ""12""", System.SByte.MinValue And "12")
PrintResult("System.SByte.MinValue And TypeCode.Double", System.SByte.MinValue And TypeCode.Double)
PrintResult("System.Byte.MaxValue And False", System.Byte.MaxValue And False)
PrintResult("System.Byte.MaxValue And True", System.Byte.MaxValue And True)
PrintResult("System.Byte.MaxValue And System.SByte.MinValue", System.Byte.MaxValue And System.SByte.MinValue)
PrintResult("System.Byte.MaxValue And System.Byte.MaxValue", System.Byte.MaxValue And System.Byte.MaxValue)
PrintResult("System.Byte.MaxValue And -3S", System.Byte.MaxValue And -3S)
PrintResult("System.Byte.MaxValue And 24US", System.Byte.MaxValue And 24US)
PrintResult("System.Byte.MaxValue And -5I", System.Byte.MaxValue And -5I)
PrintResult("System.Byte.MaxValue And 26UI", System.Byte.MaxValue And 26UI)
PrintResult("System.Byte.MaxValue And -7L", System.Byte.MaxValue And -7L)
PrintResult("System.Byte.MaxValue And 28UL", System.Byte.MaxValue And 28UL)
PrintResult("System.Byte.MaxValue And -9D", System.Byte.MaxValue And -9D)
PrintResult("System.Byte.MaxValue And 10.0F", System.Byte.MaxValue And 10.0F)
PrintResult("System.Byte.MaxValue And -11.0R", System.Byte.MaxValue And -11.0R)
PrintResult("System.Byte.MaxValue And ""12""", System.Byte.MaxValue And "12")
PrintResult("System.Byte.MaxValue And TypeCode.Double", System.Byte.MaxValue And TypeCode.Double)
PrintResult("-3S And False", -3S And False)
PrintResult("-3S And True", -3S And True)
PrintResult("-3S And System.SByte.MinValue", -3S And System.SByte.MinValue)
PrintResult("-3S And System.Byte.MaxValue", -3S And System.Byte.MaxValue)
PrintResult("-3S And -3S", -3S And -3S)
PrintResult("-3S And 24US", -3S And 24US)
PrintResult("-3S And -5I", -3S And -5I)
PrintResult("-3S And 26UI", -3S And 26UI)
PrintResult("-3S And -7L", -3S And -7L)
PrintResult("-3S And 28UL", -3S And 28UL)
PrintResult("-3S And -9D", -3S And -9D)
PrintResult("-3S And 10.0F", -3S And 10.0F)
PrintResult("-3S And -11.0R", -3S And -11.0R)
PrintResult("-3S And ""12""", -3S And "12")
PrintResult("-3S And TypeCode.Double", -3S And TypeCode.Double)
PrintResult("24US And False", 24US And False)
PrintResult("24US And True", 24US And True)
PrintResult("24US And System.SByte.MinValue", 24US And System.SByte.MinValue)
PrintResult("24US And System.Byte.MaxValue", 24US And System.Byte.MaxValue)
PrintResult("24US And -3S", 24US And -3S)
PrintResult("24US And 24US", 24US And 24US)
PrintResult("24US And -5I", 24US And -5I)
PrintResult("24US And 26UI", 24US And 26UI)
PrintResult("24US And -7L", 24US And -7L)
PrintResult("24US And 28UL", 24US And 28UL)
PrintResult("24US And -9D", 24US And -9D)
PrintResult("24US And 10.0F", 24US And 10.0F)
PrintResult("24US And -11.0R", 24US And -11.0R)
PrintResult("24US And ""12""", 24US And "12")
PrintResult("24US And TypeCode.Double", 24US And TypeCode.Double)
PrintResult("-5I And False", -5I And False)
PrintResult("-5I And True", -5I And True)
PrintResult("-5I And System.SByte.MinValue", -5I And System.SByte.MinValue)
PrintResult("-5I And System.Byte.MaxValue", -5I And System.Byte.MaxValue)
PrintResult("-5I And -3S", -5I And -3S)
PrintResult("-5I And 24US", -5I And 24US)
PrintResult("-5I And -5I", -5I And -5I)
PrintResult("-5I And 26UI", -5I And 26UI)
PrintResult("-5I And -7L", -5I And -7L)
PrintResult("-5I And 28UL", -5I And 28UL)
PrintResult("-5I And -9D", -5I And -9D)
PrintResult("-5I And 10.0F", -5I And 10.0F)
PrintResult("-5I And -11.0R", -5I And -11.0R)
PrintResult("-5I And ""12""", -5I And "12")
PrintResult("-5I And TypeCode.Double", -5I And TypeCode.Double)
PrintResult("26UI And False", 26UI And False)
PrintResult("26UI And True", 26UI And True)
PrintResult("26UI And System.SByte.MinValue", 26UI And System.SByte.MinValue)
PrintResult("26UI And System.Byte.MaxValue", 26UI And System.Byte.MaxValue)
PrintResult("26UI And -3S", 26UI And -3S)
PrintResult("26UI And 24US", 26UI And 24US)
PrintResult("26UI And -5I", 26UI And -5I)
PrintResult("26UI And 26UI", 26UI And 26UI)
PrintResult("26UI And -7L", 26UI And -7L)
PrintResult("26UI And 28UL", 26UI And 28UL)
PrintResult("26UI And -9D", 26UI And -9D)
PrintResult("26UI And 10.0F", 26UI And 10.0F)
PrintResult("26UI And -11.0R", 26UI And -11.0R)
PrintResult("26UI And ""12""", 26UI And "12")
PrintResult("26UI And TypeCode.Double", 26UI And TypeCode.Double)
PrintResult("-7L And False", -7L And False)
PrintResult("-7L And True", -7L And True)
PrintResult("-7L And System.SByte.MinValue", -7L And System.SByte.MinValue)
PrintResult("-7L And System.Byte.MaxValue", -7L And System.Byte.MaxValue)
PrintResult("-7L And -3S", -7L And -3S)
PrintResult("-7L And 24US", -7L And 24US)
PrintResult("-7L And -5I", -7L And -5I)
PrintResult("-7L And 26UI", -7L And 26UI)
PrintResult("-7L And -7L", -7L And -7L)
PrintResult("-7L And 28UL", -7L And 28UL)
PrintResult("-7L And -9D", -7L And -9D)
PrintResult("-7L And 10.0F", -7L And 10.0F)
PrintResult("-7L And -11.0R", -7L And -11.0R)
PrintResult("-7L And ""12""", -7L And "12")
PrintResult("-7L And TypeCode.Double", -7L And TypeCode.Double)
PrintResult("28UL And False", 28UL And False)
PrintResult("28UL And True", 28UL And True)
PrintResult("28UL And System.SByte.MinValue", 28UL And System.SByte.MinValue)
PrintResult("28UL And System.Byte.MaxValue", 28UL And System.Byte.MaxValue)
PrintResult("28UL And -3S", 28UL And -3S)
PrintResult("28UL And 24US", 28UL And 24US)
PrintResult("28UL And -5I", 28UL And -5I)
PrintResult("28UL And 26UI", 28UL And 26UI)
PrintResult("28UL And -7L", 28UL And -7L)
PrintResult("28UL And 28UL", 28UL And 28UL)
PrintResult("28UL And -9D", 28UL And -9D)
PrintResult("28UL And 10.0F", 28UL And 10.0F)
PrintResult("28UL And -11.0R", 28UL And -11.0R)
PrintResult("28UL And ""12""", 28UL And "12")
PrintResult("28UL And TypeCode.Double", 28UL And TypeCode.Double)
PrintResult("-9D And False", -9D And False)
PrintResult("-9D And True", -9D And True)
PrintResult("-9D And System.SByte.MinValue", -9D And System.SByte.MinValue)
PrintResult("-9D And System.Byte.MaxValue", -9D And System.Byte.MaxValue)
PrintResult("-9D And -3S", -9D And -3S)
PrintResult("-9D And 24US", -9D And 24US)
PrintResult("-9D And -5I", -9D And -5I)
PrintResult("-9D And 26UI", -9D And 26UI)
PrintResult("-9D And -7L", -9D And -7L)
PrintResult("-9D And 28UL", -9D And 28UL)
PrintResult("-9D And -9D", -9D And -9D)
PrintResult("-9D And 10.0F", -9D And 10.0F)
PrintResult("-9D And -11.0R", -9D And -11.0R)
PrintResult("-9D And ""12""", -9D And "12")
PrintResult("-9D And TypeCode.Double", -9D And TypeCode.Double)
PrintResult("10.0F And False", 10.0F And False)
PrintResult("10.0F And True", 10.0F And True)
PrintResult("10.0F And System.SByte.MinValue", 10.0F And System.SByte.MinValue)
PrintResult("10.0F And System.Byte.MaxValue", 10.0F And System.Byte.MaxValue)
PrintResult("10.0F And -3S", 10.0F And -3S)
PrintResult("10.0F And 24US", 10.0F And 24US)
PrintResult("10.0F And -5I", 10.0F And -5I)
PrintResult("10.0F And 26UI", 10.0F And 26UI)
PrintResult("10.0F And -7L", 10.0F And -7L)
PrintResult("10.0F And 28UL", 10.0F And 28UL)
PrintResult("10.0F And -9D", 10.0F And -9D)
PrintResult("10.0F And 10.0F", 10.0F And 10.0F)
PrintResult("10.0F And -11.0R", 10.0F And -11.0R)
PrintResult("10.0F And ""12""", 10.0F And "12")
PrintResult("10.0F And TypeCode.Double", 10.0F And TypeCode.Double)
PrintResult("-11.0R And False", -11.0R And False)
PrintResult("-11.0R And True", -11.0R And True)
PrintResult("-11.0R And System.SByte.MinValue", -11.0R And System.SByte.MinValue)
PrintResult("-11.0R And System.Byte.MaxValue", -11.0R And System.Byte.MaxValue)
PrintResult("-11.0R And -3S", -11.0R And -3S)
PrintResult("-11.0R And 24US", -11.0R And 24US)
PrintResult("-11.0R And -5I", -11.0R And -5I)
PrintResult("-11.0R And 26UI", -11.0R And 26UI)
PrintResult("-11.0R And -7L", -11.0R And -7L)
PrintResult("-11.0R And 28UL", -11.0R And 28UL)
PrintResult("-11.0R And -9D", -11.0R And -9D)
PrintResult("-11.0R And 10.0F", -11.0R And 10.0F)
PrintResult("-11.0R And -11.0R", -11.0R And -11.0R)
PrintResult("-11.0R And ""12""", -11.0R And "12")
PrintResult("-11.0R And TypeCode.Double", -11.0R And TypeCode.Double)
PrintResult("""12"" And False", "12" And False)
PrintResult("""12"" And True", "12" And True)
PrintResult("""12"" And System.SByte.MinValue", "12" And System.SByte.MinValue)
PrintResult("""12"" And System.Byte.MaxValue", "12" And System.Byte.MaxValue)
PrintResult("""12"" And -3S", "12" And -3S)
PrintResult("""12"" And 24US", "12" And 24US)
PrintResult("""12"" And -5I", "12" And -5I)
PrintResult("""12"" And 26UI", "12" And 26UI)
PrintResult("""12"" And -7L", "12" And -7L)
PrintResult("""12"" And 28UL", "12" And 28UL)
PrintResult("""12"" And -9D", "12" And -9D)
PrintResult("""12"" And 10.0F", "12" And 10.0F)
PrintResult("""12"" And -11.0R", "12" And -11.0R)
PrintResult("""12"" And ""12""", "12" And "12")
PrintResult("""12"" And TypeCode.Double", "12" And TypeCode.Double)
PrintResult("TypeCode.Double And False", TypeCode.Double And False)
PrintResult("TypeCode.Double And True", TypeCode.Double And True)
PrintResult("TypeCode.Double And System.SByte.MinValue", TypeCode.Double And System.SByte.MinValue)
PrintResult("TypeCode.Double And System.Byte.MaxValue", TypeCode.Double And System.Byte.MaxValue)
PrintResult("TypeCode.Double And -3S", TypeCode.Double And -3S)
PrintResult("TypeCode.Double And 24US", TypeCode.Double And 24US)
PrintResult("TypeCode.Double And -5I", TypeCode.Double And -5I)
PrintResult("TypeCode.Double And 26UI", TypeCode.Double And 26UI)
PrintResult("TypeCode.Double And -7L", TypeCode.Double And -7L)
PrintResult("TypeCode.Double And 28UL", TypeCode.Double And 28UL)
PrintResult("TypeCode.Double And -9D", TypeCode.Double And -9D)
PrintResult("TypeCode.Double And 10.0F", TypeCode.Double And 10.0F)
PrintResult("TypeCode.Double And -11.0R", TypeCode.Double And -11.0R)
PrintResult("TypeCode.Double And ""12""", TypeCode.Double And "12")
PrintResult("TypeCode.Double And TypeCode.Double", TypeCode.Double And TypeCode.Double)
'PrintResult("#8:30:00 AM# + ""12""", #8:30:00 AM# + "12")
'PrintResult("#8:30:00 AM# + #8:30:00 AM#", #8:30:00 AM# + #8:30:00 AM#)
PrintResult("""c""c + ""12""", "c"c + "12")
PrintResult("""c""c + ""c""c", "c"c + "c"c)
'PrintResult("""12"" + #8:30:00 AM#", "12" + #8:30:00 AM#)
PrintResult("""12"" + ""c""c", "12" + "c"c)
'PrintResult("#8:30:00 AM# & False", #8:30:00 AM# & False)
'PrintResult("#8:30:00 AM# & True", #8:30:00 AM# & True)
'PrintResult("#8:30:00 AM# & System.SByte.MinValue", #8:30:00 AM# & System.SByte.MinValue)
'PrintResult("#8:30:00 AM# & System.Byte.MaxValue", #8:30:00 AM# & System.Byte.MaxValue)
'PrintResult("#8:30:00 AM# & -3S", #8:30:00 AM# & -3S)
'PrintResult("#8:30:00 AM# & 24US", #8:30:00 AM# & 24US)
'PrintResult("#8:30:00 AM# & -5I", #8:30:00 AM# & -5I)
'PrintResult("#8:30:00 AM# & 26UI", #8:30:00 AM# & 26UI)
'PrintResult("#8:30:00 AM# & -7L", #8:30:00 AM# & -7L)
'PrintResult("#8:30:00 AM# & 28UL", #8:30:00 AM# & 28UL)
'PrintResult("#8:30:00 AM# & -9D", #8:30:00 AM# & -9D)
'PrintResult("#8:30:00 AM# & 10.0F", #8:30:00 AM# & 10.0F)
'PrintResult("#8:30:00 AM# & -11.0R", #8:30:00 AM# & -11.0R)
'PrintResult("#8:30:00 AM# & ""12""", #8:30:00 AM# & "12")
'PrintResult("#8:30:00 AM# & TypeCode.Double", #8:30:00 AM# & TypeCode.Double)
'PrintResult("#8:30:00 AM# & #8:30:00 AM#", #8:30:00 AM# & #8:30:00 AM#)
'PrintResult("#8:30:00 AM# & ""c""c", #8:30:00 AM# & "c"c)
PrintResult("""c""c & False", "c"c & False)
PrintResult("""c""c & True", "c"c & True)
PrintResult("""c""c & System.SByte.MinValue", "c"c & System.SByte.MinValue)
PrintResult("""c""c & System.Byte.MaxValue", "c"c & System.Byte.MaxValue)
PrintResult("""c""c & -3S", "c"c & -3S)
PrintResult("""c""c & 24US", "c"c & 24US)
PrintResult("""c""c & -5I", "c"c & -5I)
PrintResult("""c""c & 26UI", "c"c & 26UI)
PrintResult("""c""c & -7L", "c"c & -7L)
PrintResult("""c""c & 28UL", "c"c & 28UL)
PrintResult("""c""c & -9D", "c"c & -9D)
PrintResult("""c""c & 10.0F", "c"c & 10.0F)
PrintResult("""c""c & -11.0R", "c"c & -11.0R)
PrintResult("""c""c & ""12""", "c"c & "12")
PrintResult("""c""c & TypeCode.Double", "c"c & TypeCode.Double)
'PrintResult("""c""c & #8:30:00 AM#", "c"c & #8:30:00 AM#)
PrintResult("""c""c & ""c""c", "c"c & "c"c)
'PrintResult("False & #8:30:00 AM#", False & #8:30:00 AM#)
PrintResult("False & ""c""c", False & "c"c)
'PrintResult("True & #8:30:00 AM#", True & #8:30:00 AM#)
PrintResult("True & ""c""c", True & "c"c)
'PrintResult("System.SByte.MinValue & #8:30:00 AM#", System.SByte.MinValue & #8:30:00 AM#)
PrintResult("System.SByte.MinValue & ""c""c", System.SByte.MinValue & "c"c)
'PrintResult("System.Byte.MaxValue & #8:30:00 AM#", System.Byte.MaxValue & #8:30:00 AM#)
PrintResult("System.Byte.MaxValue & ""c""c", System.Byte.MaxValue & "c"c)
'PrintResult("-3S & #8:30:00 AM#", -3S & #8:30:00 AM#)
PrintResult("-3S & ""c""c", -3S & "c"c)
'PrintResult("24US & #8:30:00 AM#", 24US & #8:30:00 AM#)
PrintResult("24US & ""c""c", 24US & "c"c)
'PrintResult("-5I & #8:30:00 AM#", -5I & #8:30:00 AM#)
PrintResult("-5I & ""c""c", -5I & "c"c)
'PrintResult("26UI & #8:30:00 AM#", 26UI & #8:30:00 AM#)
PrintResult("26UI & ""c""c", 26UI & "c"c)
'PrintResult("-7L & #8:30:00 AM#", -7L & #8:30:00 AM#)
PrintResult("-7L & ""c""c", -7L & "c"c)
'PrintResult("28UL & #8:30:00 AM#", 28UL & #8:30:00 AM#)
PrintResult("28UL & ""c""c", 28UL & "c"c)
'PrintResult("-9D & #8:30:00 AM#", -9D & #8:30:00 AM#)
PrintResult("-9D & ""c""c", -9D & "c"c)
'PrintResult("10.0F & #8:30:00 AM#", 10.0F & #8:30:00 AM#)
PrintResult("10.0F & ""c""c", 10.0F & "c"c)
'PrintResult("-11.0R & #8:30:00 AM#", -11.0R & #8:30:00 AM#)
PrintResult("-11.0R & ""c""c", -11.0R & "c"c)
'PrintResult("""12"" & #8:30:00 AM#", "12" & #8:30:00 AM#)
PrintResult("""12"" & ""c""c", "12" & "c"c)
'PrintResult("TypeCode.Double & #8:30:00 AM#", TypeCode.Double & #8:30:00 AM#)
PrintResult("TypeCode.Double & ""c""c", TypeCode.Double & "c"c)
PrintResult("#8:30:00 AM# Like False", #8:30:00 AM# Like False)
PrintResult("#8:30:00 AM# Like True", #8:30:00 AM# Like True)
PrintResult("#8:30:00 AM# Like System.SByte.MinValue", #8:30:00 AM# Like System.SByte.MinValue)
PrintResult("#8:30:00 AM# Like System.Byte.MaxValue", #8:30:00 AM# Like System.Byte.MaxValue)
PrintResult("#8:30:00 AM# Like -3S", #8:30:00 AM# Like -3S)
PrintResult("#8:30:00 AM# Like 24US", #8:30:00 AM# Like 24US)
PrintResult("#8:30:00 AM# Like -5I", #8:30:00 AM# Like -5I)
PrintResult("#8:30:00 AM# Like 26UI", #8:30:00 AM# Like 26UI)
PrintResult("#8:30:00 AM# Like -7L", #8:30:00 AM# Like -7L)
PrintResult("#8:30:00 AM# Like 28UL", #8:30:00 AM# Like 28UL)
PrintResult("#8:30:00 AM# Like -9D", #8:30:00 AM# Like -9D)
PrintResult("#8:30:00 AM# Like 10.0F", #8:30:00 AM# Like 10.0F)
PrintResult("#8:30:00 AM# Like -11.0R", #8:30:00 AM# Like -11.0R)
PrintResult("#8:30:00 AM# Like ""12""", #8:30:00 AM# Like "12")
PrintResult("#8:30:00 AM# Like TypeCode.Double", #8:30:00 AM# Like TypeCode.Double)
PrintResult("#8:30:00 AM# Like #8:30:00 AM#", #8:30:00 AM# Like #8:30:00 AM#)
PrintResult("#8:30:00 AM# Like ""c""c", #8:30:00 AM# Like "c"c)
PrintResult("""c""c Like False", "c"c Like False)
PrintResult("""c""c Like True", "c"c Like True)
PrintResult("""c""c Like System.SByte.MinValue", "c"c Like System.SByte.MinValue)
PrintResult("""c""c Like System.Byte.MaxValue", "c"c Like System.Byte.MaxValue)
PrintResult("""c""c Like -3S", "c"c Like -3S)
PrintResult("""c""c Like 24US", "c"c Like 24US)
PrintResult("""c""c Like -5I", "c"c Like -5I)
PrintResult("""c""c Like 26UI", "c"c Like 26UI)
PrintResult("""c""c Like -7L", "c"c Like -7L)
PrintResult("""c""c Like 28UL", "c"c Like 28UL)
PrintResult("""c""c Like -9D", "c"c Like -9D)
PrintResult("""c""c Like 10.0F", "c"c Like 10.0F)
PrintResult("""c""c Like -11.0R", "c"c Like -11.0R)
PrintResult("""c""c Like ""12""", "c"c Like "12")
PrintResult("""c""c Like TypeCode.Double", "c"c Like TypeCode.Double)
PrintResult("""c""c Like #8:30:00 AM#", "c"c Like #8:30:00 AM#)
PrintResult("""c""c Like ""c""c", "c"c Like "c"c)
PrintResult("False Like #8:30:00 AM#", False Like #8:30:00 AM#)
PrintResult("False Like ""c""c", False Like "c"c)
PrintResult("True Like #8:30:00 AM#", True Like #8:30:00 AM#)
PrintResult("True Like ""c""c", True Like "c"c)
PrintResult("System.SByte.MinValue Like #8:30:00 AM#", System.SByte.MinValue Like #8:30:00 AM#)
PrintResult("System.SByte.MinValue Like ""c""c", System.SByte.MinValue Like "c"c)
PrintResult("System.Byte.MaxValue Like #8:30:00 AM#", System.Byte.MaxValue Like #8:30:00 AM#)
PrintResult("System.Byte.MaxValue Like ""c""c", System.Byte.MaxValue Like "c"c)
PrintResult("-3S Like #8:30:00 AM#", -3S Like #8:30:00 AM#)
PrintResult("-3S Like ""c""c", -3S Like "c"c)
PrintResult("24US Like #8:30:00 AM#", 24US Like #8:30:00 AM#)
PrintResult("24US Like ""c""c", 24US Like "c"c)
PrintResult("-5I Like #8:30:00 AM#", -5I Like #8:30:00 AM#)
PrintResult("-5I Like ""c""c", -5I Like "c"c)
PrintResult("26UI Like #8:30:00 AM#", 26UI Like #8:30:00 AM#)
PrintResult("26UI Like ""c""c", 26UI Like "c"c)
PrintResult("-7L Like #8:30:00 AM#", -7L Like #8:30:00 AM#)
PrintResult("-7L Like ""c""c", -7L Like "c"c)
PrintResult("28UL Like #8:30:00 AM#", 28UL Like #8:30:00 AM#)
PrintResult("28UL Like ""c""c", 28UL Like "c"c)
PrintResult("-9D Like #8:30:00 AM#", -9D Like #8:30:00 AM#)
PrintResult("-9D Like ""c""c", -9D Like "c"c)
PrintResult("10.0F Like #8:30:00 AM#", 10.0F Like #8:30:00 AM#)
PrintResult("10.0F Like ""c""c", 10.0F Like "c"c)
PrintResult("-11.0R Like #8:30:00 AM#", -11.0R Like #8:30:00 AM#)
PrintResult("-11.0R Like ""c""c", -11.0R Like "c"c)
PrintResult("""12"" Like #8:30:00 AM#", "12" Like #8:30:00 AM#)
PrintResult("""12"" Like ""c""c", "12" Like "c"c)
PrintResult("TypeCode.Double Like #8:30:00 AM#", TypeCode.Double Like #8:30:00 AM#)
PrintResult("TypeCode.Double Like ""c""c", TypeCode.Double Like "c"c)
PrintResult("#8:30:00 AM# = #8:30:00 AM#", #8:30:00 AM# = #8:30:00 AM#)
PrintResult("""c""c = ""12""", "c"c = "12")
PrintResult("""c""c = ""c""c", "c"c = "c"c)
PrintResult("""12"" = ""c""c", "12" = "c"c)
PrintResult("#8:30:00 AM# <> #8:30:00 AM#", #8:30:00 AM# <> #8:30:00 AM#)
PrintResult("""c""c <> ""12""", "c"c <> "12")
PrintResult("""c""c <> ""c""c", "c"c <> "c"c)
PrintResult("""12"" <> ""c""c", "12" <> "c"c)
PrintResult("#8:30:00 AM# <= #8:30:00 AM#", #8:30:00 AM# <= #8:30:00 AM#)
PrintResult("""c""c <= ""12""", "c"c <= "12")
PrintResult("""c""c <= ""c""c", "c"c <= "c"c)
PrintResult("""12"" <= ""c""c", "12" <= "c"c)
PrintResult("#8:30:00 AM# >= #8:30:00 AM#", #8:30:00 AM# >= #8:30:00 AM#)
PrintResult("""c""c >= ""12""", "c"c >= "12")
PrintResult("""c""c >= ""c""c", "c"c >= "c"c)
PrintResult("""12"" >= ""c""c", "12" >= "c"c)
PrintResult("#8:30:00 AM# < #8:30:00 AM#", #8:30:00 AM# < #8:30:00 AM#)
PrintResult("""c""c < ""12""", "c"c < "12")
PrintResult("""c""c < ""c""c", "c"c < "c"c)
PrintResult("""12"" < ""c""c", "12" < "c"c)
PrintResult("#8:30:00 AM# > #8:30:00 AM#", #8:30:00 AM# > #8:30:00 AM#)
PrintResult("""c""c > ""12""", "c"c > "12")
PrintResult("""c""c > ""c""c", "c"c > "c"c)
PrintResult("""12"" > ""c""c", "12" > "c"c)
PrintResult("System.Byte.MaxValue - 24US", System.Byte.MaxValue - 24US)
PrintResult("System.Byte.MaxValue - 26UI", System.Byte.MaxValue - 26UI)
PrintResult("System.Byte.MaxValue - 28UL", System.Byte.MaxValue - 28UL)
PrintResult("44US - 26UI", 44US - 26UI)
PrintResult("44US - 28UL", 44US - 28UL)
PrintResult("46UI - 28UL", 46UI - 28UL)
PrintResult("System.Byte.MaxValue * (System.Byte.MaxValue \ System.Byte.MaxValue)", System.Byte.MaxValue * (System.Byte.MaxValue \ System.Byte.MaxValue))
PrintResult("#8:31:00 AM# = ""8:30:00 AM""", #8:31:00 AM# = "8:30:00 AM")
PrintResult("""8:30:00 AM"" = #8:31:00 AM#", "8:30:00 AM" = #8:31:00 AM#)
PrintResult("#8:31:00 AM# <> ""8:30:00 AM""", #8:31:00 AM# <> "8:30:00 AM")
PrintResult("""8:30:00 AM"" <> #8:31:00 AM#", "8:30:00 AM" <> #8:31:00 AM#)
PrintResult("#8:31:00 AM# <= ""8:30:00 AM""", #8:31:00 AM# <= "8:30:00 AM")
PrintResult("""8:30:00 AM"" <= #8:31:00 AM#", "8:30:00 AM" <= #8:31:00 AM#)
PrintResult("#8:31:00 AM# >= ""8:30:00 AM""", #8:31:00 AM# >= "8:30:00 AM")
PrintResult("""8:30:00 AM"" >= #8:31:00 AM#", "8:30:00 AM" >= #8:31:00 AM#)
PrintResult("#8:31:00 AM# < ""8:30:00 AM""", #8:31:00 AM# < "8:30:00 AM")
PrintResult("""8:30:00 AM"" < #8:31:00 AM#", "8:30:00 AM" < #8:31:00 AM#)
PrintResult("#8:31:00 AM# > ""8:30:00 AM""", #8:31:00 AM# > "8:30:00 AM")
PrintResult("""8:30:00 AM"" > #8:31:00 AM#", "8:30:00 AM" > #8:31:00 AM#)
PrintResult("-5I + Nothing", -5I + Nothing)
PrintResult("""12"" + Nothing", "12" + Nothing)
PrintResult("""12"" + DBNull.Value", "12" + DBNull.Value)
PrintResult("Nothing + Nothing", Nothing + Nothing)
PrintResult("Nothing + -5I", Nothing + -5I)
PrintResult("Nothing + ""12""", Nothing + "12")
PrintResult("DBNull.Value + ""12""", DBNull.Value + "12")
PrintResult("-5I - Nothing", -5I - Nothing)
PrintResult("""12"" - Nothing", "12" - Nothing)
PrintResult("Nothing - Nothing", Nothing - Nothing)
PrintResult("Nothing - -5I", Nothing - -5I)
PrintResult("Nothing - ""12""", Nothing - "12")
PrintResult("-5I * Nothing", -5I * Nothing)
PrintResult("""12"" * Nothing", "12" * Nothing)
PrintResult("Nothing * Nothing", Nothing * Nothing)
PrintResult("Nothing * -5I", Nothing * -5I)
PrintResult("Nothing * ""12""", Nothing * "12")
PrintResult("-5I / Nothing", -5I / Nothing)
PrintResult("""12"" / Nothing", "12" / Nothing)
PrintResult("Nothing / Nothing", Nothing / Nothing)
PrintResult("Nothing / -5I", Nothing / -5I)
PrintResult("Nothing / ""12""", Nothing / "12")
PrintResult("Nothing \ -5I", Nothing \ -5I)
PrintResult("Nothing \ ""12""", Nothing \ "12")
PrintResult("""12"" Mod Nothing", "12" Mod Nothing)
PrintResult("Nothing Mod -5I", Nothing Mod -5I)
PrintResult("Nothing Mod ""12""", Nothing Mod "12")
PrintResult("-5I ^ Nothing", -5I ^ Nothing)
PrintResult("""12"" ^ Nothing", "12" ^ Nothing)
PrintResult("Nothing ^ Nothing", Nothing ^ Nothing)
PrintResult("Nothing ^ -5I", Nothing ^ -5I)
PrintResult("Nothing ^ ""12""", Nothing ^ "12")
PrintResult("-5I << Nothing", -5I << Nothing)
PrintResult("""12"" << Nothing", "12" << Nothing)
PrintResult("Nothing << Nothing", Nothing << Nothing)
PrintResult("Nothing << -5I", Nothing << -5I)
PrintResult("Nothing << ""12""", Nothing << "12")
PrintResult("-5I >> Nothing", -5I >> Nothing)
PrintResult("""12"" >> Nothing", "12" >> Nothing)
PrintResult("Nothing >> Nothing", Nothing >> Nothing)
PrintResult("Nothing >> -5I", Nothing >> -5I)
PrintResult("Nothing >> ""12""", Nothing >> "12")
PrintResult("-5I OrElse Nothing", -5I OrElse Nothing)
PrintResult("""12"" OrElse Nothing", "12" OrElse Nothing)
PrintResult("Nothing OrElse Nothing", Nothing OrElse Nothing)
PrintResult("Nothing OrElse -5I", Nothing OrElse -5I)
PrintResult("-5I AndAlso Nothing", -5I AndAlso Nothing)
PrintResult("Nothing AndAlso Nothing", Nothing AndAlso Nothing)
PrintResult("Nothing AndAlso -5I", Nothing AndAlso -5I)
PrintResult("-5I & Nothing", -5I & Nothing)
PrintResult("-5I & DBNull.Value", -5I & DBNull.Value)
PrintResult("""12"" & Nothing", "12" & Nothing)
PrintResult("""12"" & DBNull.Value", "12" & DBNull.Value)
PrintResult("Nothing & Nothing", Nothing & Nothing)
PrintResult("Nothing & DBNull.Value", Nothing & DBNull.Value)
PrintResult("DBNull.Value & Nothing", DBNull.Value & Nothing)
PrintResult("Nothing & -5I", Nothing & -5I)
PrintResult("Nothing & ""12""", Nothing & "12")
PrintResult("DBNull.Value & -5I", DBNull.Value & -5I)
PrintResult("DBNull.Value & ""12""", DBNull.Value & "12")
PrintResult("-5I Like Nothing", -5I Like Nothing)
PrintResult("""12"" Like Nothing", "12" Like Nothing)
PrintResult("Nothing Like Nothing", Nothing Like Nothing)
PrintResult("Nothing Like -5I", Nothing Like -5I)
PrintResult("Nothing Like ""12""", Nothing Like "12")
PrintResult("-5I = Nothing", -5I = Nothing)
PrintResult("""12"" = Nothing", "12" = Nothing)
PrintResult("Nothing = Nothing", Nothing = Nothing)
PrintResult("Nothing = -5I", Nothing = -5I)
PrintResult("Nothing = ""12""", Nothing = "12")
PrintResult("-5I <> Nothing", -5I <> Nothing)
PrintResult("""12"" <> Nothing", "12" <> Nothing)
PrintResult("Nothing <> Nothing", Nothing <> Nothing)
PrintResult("Nothing <> -5I", Nothing <> -5I)
PrintResult("Nothing <> ""12""", Nothing <> "12")
PrintResult("-5I <= Nothing", -5I <= Nothing)
PrintResult("""12"" <= Nothing", "12" <= Nothing)
PrintResult("Nothing <= Nothing", Nothing <= Nothing)
PrintResult("Nothing <= -5I", Nothing <= -5I)
PrintResult("Nothing <= ""12""", Nothing <= "12")
PrintResult("-5I >= Nothing", -5I >= Nothing)
PrintResult("""12"" >= Nothing", "12" >= Nothing)
PrintResult("Nothing >= Nothing", Nothing >= Nothing)
PrintResult("Nothing >= -5I", Nothing >= -5I)
PrintResult("Nothing >= ""12""", Nothing >= "12")
PrintResult("-5I < Nothing", -5I < Nothing)
PrintResult("""12"" < Nothing", "12" < Nothing)
PrintResult("Nothing < Nothing", Nothing < Nothing)
PrintResult("Nothing < -5I", Nothing < -5I)
PrintResult("Nothing < ""12""", Nothing < "12")
PrintResult("-5I > Nothing", -5I > Nothing)
PrintResult("""12"" > Nothing", "12" > Nothing)
PrintResult("Nothing > Nothing", Nothing > Nothing)
PrintResult("Nothing > -5I", Nothing > -5I)
PrintResult("Nothing > ""12""", Nothing > "12")
PrintResult("-5I Xor Nothing", -5I Xor Nothing)
PrintResult("""12"" Xor Nothing", "12" Xor Nothing)
PrintResult("Nothing Xor Nothing", Nothing Xor Nothing)
PrintResult("Nothing Xor -5I", Nothing Xor -5I)
PrintResult("Nothing Xor ""12""", Nothing Xor "12")
PrintResult("-5I Or Nothing", -5I Or Nothing)
PrintResult("""12"" Or Nothing", "12" Or Nothing)
PrintResult("Nothing Or Nothing", Nothing Or Nothing)
PrintResult("Nothing Or -5I", Nothing Or -5I)
PrintResult("Nothing Or ""12""", Nothing Or "12")
PrintResult("-5I And Nothing", -5I And Nothing)
PrintResult("""12"" And Nothing", "12" And Nothing)
PrintResult("Nothing And Nothing", Nothing And Nothing)
PrintResult("Nothing And -5I", Nothing And -5I)
PrintResult("Nothing And ""12""", Nothing And "12")
PrintResult("2I / 0", 2I / 0)
PrintResult("1.5F / 0", 1.5F / 0)
PrintResult("2.5R / 0", 2.5R / 0)
PrintResult("1.5F Mod 0", 1.5F Mod 0)
PrintResult("2.5R Mod 0", 2.5R Mod 0)
PrintResult("2I / 0", 2I / Nothing)
PrintResult("1.5F / 0", 1.5F / Nothing)
PrintResult("2.5R / 0", 2.5R / Nothing)
PrintResult("1.5F Mod 0", 1.5F Mod Nothing)
PrintResult("2.5R Mod 0", 2.5R Mod Nothing)
PrintResult("System.Single.MinValue - 1.0F", System.Single.MinValue - 1.0F)
PrintResult("System.Double.MinValue - 1.0R", System.Double.MinValue - 1.0R)
PrintResult("System.Single.MaxValue + 1.0F", System.Single.MaxValue + 1.0F)
PrintResult("System.Double.MaxValue + 1.0R", System.Double.MaxValue + 1.0R)
PrintResult("1.0F ^ System.Single.NegativeInfinity", 1.0F ^ System.Single.NegativeInfinity)
PrintResult("1.0F ^ System.Single.PositiveInfinity", 1.0F ^ System.Single.PositiveInfinity)
PrintResult("1.0R ^ System.Double.NegativeInfinity", 1.0R ^ System.Double.NegativeInfinity)
PrintResult("1.0R ^ System.Double.PositiveInfinity", 1.0R ^ System.Double.PositiveInfinity)
PrintResult("-1.0F ^ System.Single.NegativeInfinity", -1.0F ^ System.Single.NegativeInfinity)
PrintResult("-1.0F ^ System.Single.PositiveInfinity", -1.0F ^ System.Single.PositiveInfinity)
PrintResult("-1.0R ^ System.Double.NegativeInfinity", -1.0R ^ System.Double.NegativeInfinity)
PrintResult("-1.0R ^ System.Double.PositiveInfinity", -1.0R ^ System.Double.PositiveInfinity)
PrintResult("2.0F ^ System.Single.NaN", 2.0F ^ System.Single.NaN)
PrintResult("2.0R ^ System.Double.NaN", 2.0R ^ System.Double.NaN)
PrintResult("(-1.0F) ^ System.Single.NegativeInfinity", (-1.0F) ^ System.Single.NegativeInfinity)
PrintResult("(-1.0F) ^ System.Single.PositiveInfinity", (-1.0F) ^ System.Single.PositiveInfinity)
PrintResult("(-1.0F) ^ System.Double.NegativeInfinity", (-1.0F) ^ System.Double.NegativeInfinity)
PrintResult("(-1.0F) ^ System.Double.PositiveInfinity", (-1.0F) ^ System.Double.PositiveInfinity)
End Sub
End Module
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpNavigationBar.cs | // 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.
#nullable disable
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.VisualStudio.IntegrationTest.Utilities;
using Roslyn.Test.Utilities;
using Xunit;
using Xunit.Abstractions;
namespace Roslyn.VisualStudio.IntegrationTests.CSharp
{
[Collection(nameof(SharedIntegrationHostFixture))]
public class CSharpNavigationBar : AbstractEditorTest
{
private const string TestSource = @"
class C
{
public void M(int i) { }
private C $$this[int index] { get { return null; } set { } }
public static bool operator ==(C c1, C c2) { return true; }
public static bool operator !=(C c1, C c2) { return false; }
}
struct S
{
int Goo() { }
void Bar() { }
}";
protected override string LanguageName => LanguageNames.CSharp;
public CSharpNavigationBar(VisualStudioInstanceFactory instanceFactory)
: base(instanceFactory, nameof(CSharpNavigationBar))
{
}
public override async Task DisposeAsync()
{
VisualStudio.Workspace.SetFeatureOption("NavigationBarOptions", "ShowNavigationBar", "C#", "True");
await base.DisposeAsync();
}
[WpfFact, Trait(Traits.Feature, Traits.Features.NavigationBar)]
public void VerifyNavBar()
{
SetUpEditor(TestSource);
VisualStudio.Editor.PlaceCaret("this", charsOffset: 1);
VisualStudio.Editor.ExpandMemberNavBar();
var expectedItems = new[]
{
"M(int i)",
"operator !=(C c1, C c2)",
"operator ==(C c1, C c2)",
"this[int index]"
};
Assert.Equal(expectedItems, VisualStudio.Editor.GetMemberNavBarItems());
VisualStudio.Editor.SelectMemberNavBarItem("operator !=(C c1, C c2)");
VisualStudio.Editor.Verify.CurrentLineText("public static bool operator $$!=(C c1, C c2) { return false; }", assertCaretPosition: true, trimWhitespace: true);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.NavigationBar)]
public void VerifyNavBar2()
{
SetUpEditor(TestSource);
VerifyLeftSelected("C");
VerifyRightSelected("this[int index]");
VisualStudio.Editor.ExpandTypeNavBar();
VisualStudio.Editor.SelectTypeNavBarItem("S");
VerifyLeftSelected("S");
VerifyRightSelected("Goo()");
VisualStudio.Editor.Verify.CurrentLineText("struct $$S", assertCaretPosition: true, trimWhitespace: true);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.NavigationBar)]
public void VerifyNavBar3()
{
SetUpEditor(@"
struct S$$
{
int Goo() { }
void Bar() { }
}");
VisualStudio.Editor.ExpandMemberNavBar();
var expectedItems = new[]
{
"Bar()",
"Goo()",
};
Assert.Equal(expectedItems, VisualStudio.Editor.GetMemberNavBarItems());
VisualStudio.Editor.SelectMemberNavBarItem("Bar()");
VisualStudio.Editor.Verify.CurrentLineText("void $$Bar() { }", assertCaretPosition: true, trimWhitespace: true);
VisualStudio.ExecuteCommand("Edit.LineUp");
VerifyRightSelected("Goo()");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.NavigationBar)]
public void TestSplitWindow()
{
VisualStudio.Editor.SetText(@"
class C
{
public void M(int i) { }
private C this[int index] { get { return null; } set { } }
}
struct S
{
int Goo() { }
void Bar() { }
}");
VisualStudio.ExecuteCommand("Window.Split");
VisualStudio.Editor.PlaceCaret("this", charsOffset: 1);
VerifyLeftSelected("C");
VerifyRightSelected("this[int index]");
VisualStudio.ExecuteCommand("Window.NextSplitPane");
VisualStudio.Editor.PlaceCaret("Goo", charsOffset: 1);
VerifyLeftSelected("S");
VerifyRightSelected("Goo()");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.NavigationBar)]
public void VerifyOption()
{
VisualStudio.Workspace.SetFeatureOption("NavigationBarOptions", "ShowNavigationBar", "C#", "False");
Assert.False(VisualStudio.Editor.IsNavBarEnabled());
VisualStudio.Workspace.SetFeatureOption("NavigationBarOptions", "ShowNavigationBar", "C#", "True");
Assert.True(VisualStudio.Editor.IsNavBarEnabled());
}
private void VerifyLeftSelected(string expected)
{
Assert.Equal(expected, VisualStudio.Editor.GetTypeNavBarSelection());
}
private void VerifyRightSelected(string expected)
{
Assert.Equal(expected, VisualStudio.Editor.GetMemberNavBarSelection());
}
}
}
| // 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.
#nullable disable
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.VisualStudio.IntegrationTest.Utilities;
using Roslyn.Test.Utilities;
using Xunit;
using Xunit.Abstractions;
namespace Roslyn.VisualStudio.IntegrationTests.CSharp
{
[Collection(nameof(SharedIntegrationHostFixture))]
public class CSharpNavigationBar : AbstractEditorTest
{
private const string TestSource = @"
class C
{
public void M(int i) { }
private C $$this[int index] { get { return null; } set { } }
public static bool operator ==(C c1, C c2) { return true; }
public static bool operator !=(C c1, C c2) { return false; }
}
struct S
{
int Goo() { }
void Bar() { }
}";
protected override string LanguageName => LanguageNames.CSharp;
public CSharpNavigationBar(VisualStudioInstanceFactory instanceFactory)
: base(instanceFactory, nameof(CSharpNavigationBar))
{
}
public override async Task DisposeAsync()
{
VisualStudio.Workspace.SetFeatureOption("NavigationBarOptions", "ShowNavigationBar", "C#", "True");
await base.DisposeAsync();
}
[WpfFact, Trait(Traits.Feature, Traits.Features.NavigationBar)]
public void VerifyNavBar()
{
SetUpEditor(TestSource);
VisualStudio.Editor.PlaceCaret("this", charsOffset: 1);
VisualStudio.Editor.ExpandMemberNavBar();
var expectedItems = new[]
{
"M(int i)",
"operator !=(C c1, C c2)",
"operator ==(C c1, C c2)",
"this[int index]"
};
Assert.Equal(expectedItems, VisualStudio.Editor.GetMemberNavBarItems());
VisualStudio.Editor.SelectMemberNavBarItem("operator !=(C c1, C c2)");
VisualStudio.Editor.Verify.CurrentLineText("public static bool operator $$!=(C c1, C c2) { return false; }", assertCaretPosition: true, trimWhitespace: true);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.NavigationBar)]
public void VerifyNavBar2()
{
SetUpEditor(TestSource);
VerifyLeftSelected("C");
VerifyRightSelected("this[int index]");
VisualStudio.Editor.ExpandTypeNavBar();
VisualStudio.Editor.SelectTypeNavBarItem("S");
VerifyLeftSelected("S");
VerifyRightSelected("Goo()");
VisualStudio.Editor.Verify.CurrentLineText("struct $$S", assertCaretPosition: true, trimWhitespace: true);
}
[WpfFact, Trait(Traits.Feature, Traits.Features.NavigationBar)]
public void VerifyNavBar3()
{
SetUpEditor(@"
struct S$$
{
int Goo() { }
void Bar() { }
}");
VisualStudio.Editor.ExpandMemberNavBar();
var expectedItems = new[]
{
"Bar()",
"Goo()",
};
Assert.Equal(expectedItems, VisualStudio.Editor.GetMemberNavBarItems());
VisualStudio.Editor.SelectMemberNavBarItem("Bar()");
VisualStudio.Editor.Verify.CurrentLineText("void $$Bar() { }", assertCaretPosition: true, trimWhitespace: true);
VisualStudio.ExecuteCommand("Edit.LineUp");
VerifyRightSelected("Goo()");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.NavigationBar)]
public void TestSplitWindow()
{
VisualStudio.Editor.SetText(@"
class C
{
public void M(int i) { }
private C this[int index] { get { return null; } set { } }
}
struct S
{
int Goo() { }
void Bar() { }
}");
VisualStudio.ExecuteCommand("Window.Split");
VisualStudio.Editor.PlaceCaret("this", charsOffset: 1);
VerifyLeftSelected("C");
VerifyRightSelected("this[int index]");
VisualStudio.ExecuteCommand("Window.NextSplitPane");
VisualStudio.Editor.PlaceCaret("Goo", charsOffset: 1);
VerifyLeftSelected("S");
VerifyRightSelected("Goo()");
}
[WpfFact, Trait(Traits.Feature, Traits.Features.NavigationBar)]
public void VerifyOption()
{
VisualStudio.Workspace.SetFeatureOption("NavigationBarOptions", "ShowNavigationBar", "C#", "False");
Assert.False(VisualStudio.Editor.IsNavBarEnabled());
VisualStudio.Workspace.SetFeatureOption("NavigationBarOptions", "ShowNavigationBar", "C#", "True");
Assert.True(VisualStudio.Editor.IsNavBarEnabled());
}
private void VerifyLeftSelected(string expected)
{
Assert.Equal(expected, VisualStudio.Editor.GetTypeNavBarSelection());
}
private void VerifyRightSelected(string expected)
{
Assert.Equal(expected, VisualStudio.Editor.GetMemberNavBarSelection());
}
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Features/Core/Portable/IntroduceUsingStatement/AbstractIntroduceUsingStatementCodeRefactoringProvider.cs | // 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.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeRefactorings;
using Microsoft.CodeAnalysis.Formatting;
using Microsoft.CodeAnalysis.LanguageServices;
using Microsoft.CodeAnalysis.Operations;
using Microsoft.CodeAnalysis.PooledObjects;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Microsoft.CodeAnalysis.Text;
using Microsoft.CodeAnalysis.Utilities;
using Roslyn.Utilities;
using static Microsoft.CodeAnalysis.CodeActions.CodeAction;
namespace Microsoft.CodeAnalysis.IntroduceUsingStatement
{
internal abstract class AbstractIntroduceUsingStatementCodeRefactoringProvider<TStatementSyntax, TLocalDeclarationSyntax> : CodeRefactoringProvider
where TStatementSyntax : SyntaxNode
where TLocalDeclarationSyntax : TStatementSyntax
{
protected abstract string CodeActionTitle { get; }
protected abstract bool CanRefactorToContainBlockStatements(SyntaxNode parent);
protected abstract SyntaxList<TStatementSyntax> GetStatements(SyntaxNode parentOfStatementsToSurround);
protected abstract SyntaxNode WithStatements(SyntaxNode parentOfStatementsToSurround, SyntaxList<TStatementSyntax> statements);
protected abstract TStatementSyntax CreateUsingStatement(TLocalDeclarationSyntax declarationStatement, SyntaxTriviaList sameLineTrivia, SyntaxList<TStatementSyntax> statementsToSurround);
public override async Task ComputeRefactoringsAsync(CodeRefactoringContext context)
{
var (document, span, cancellationToken) = context;
var declarationSyntax = await FindDisposableLocalDeclarationAsync(document, span, cancellationToken).ConfigureAwait(false);
if (declarationSyntax != null)
{
context.RegisterRefactoring(
new MyCodeAction(
CodeActionTitle,
cancellationToken => IntroduceUsingStatementAsync(document, declarationSyntax, cancellationToken)),
declarationSyntax.Span);
}
}
private async Task<TLocalDeclarationSyntax?> FindDisposableLocalDeclarationAsync(Document document, TextSpan selection, CancellationToken cancellationToken)
{
var declarationSyntax = await document.TryGetRelevantNodeAsync<TLocalDeclarationSyntax>(selection, cancellationToken).ConfigureAwait(false);
if (declarationSyntax is null || !CanRefactorToContainBlockStatements(declarationSyntax.GetRequiredParent()))
{
return null;
}
var semanticModel = await document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false);
var disposableType = semanticModel.Compilation.GetSpecialType(SpecialType.System_IDisposable);
if (disposableType is null)
{
return null;
}
var operation = semanticModel.GetOperation(declarationSyntax, cancellationToken) as IVariableDeclarationGroupOperation;
if (operation?.Declarations.Length != 1)
{
return null;
}
var localDeclaration = operation.Declarations[0];
if (localDeclaration.Declarators.Length != 1)
{
return null;
}
var declarator = localDeclaration.Declarators[0];
var localType = declarator.Symbol?.Type;
if (localType is null)
{
return null;
}
var initializer = (localDeclaration.Initializer ?? declarator.Initializer)?.Value;
// Initializer kind is invalid when incomplete declaration syntax ends in an equals token.
if (initializer is null || initializer.Kind == OperationKind.Invalid)
{
return null;
}
if (!IsLegalUsingStatementType(semanticModel.Compilation, disposableType, localType))
{
return null;
}
return declarationSyntax;
}
/// <summary>
/// Up to date with C# 7.3. Pattern-based disposal is likely to be added to C# 8.0,
/// in which case accessible instance and extension methods will need to be detected.
/// </summary>
private static bool IsLegalUsingStatementType(Compilation compilation, ITypeSymbol disposableType, ITypeSymbol type)
{
if (disposableType == null)
{
return false;
}
// CS1674: type used in a using statement must be implicitly convertible to 'System.IDisposable'
return compilation.ClassifyCommonConversion(type, disposableType).IsImplicit;
}
private async Task<Document> IntroduceUsingStatementAsync(
Document document,
TLocalDeclarationSyntax declarationStatement,
CancellationToken cancellationToken)
{
var root = await document.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false);
var semanticModel = await document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false);
var syntaxFactsService = document.GetRequiredLanguageService<ISyntaxFactsService>();
var statementsToSurround = GetStatementsToSurround(declarationStatement, semanticModel, syntaxFactsService, cancellationToken);
// Separate the newline from the trivia that is going on the using declaration line.
var (sameLine, endOfLine) = SplitTrailingTrivia(declarationStatement, syntaxFactsService);
var usingStatement =
CreateUsingStatement(
declarationStatement,
sameLine,
statementsToSurround)
.WithLeadingTrivia(declarationStatement.GetLeadingTrivia())
.WithTrailingTrivia(endOfLine);
if (statementsToSurround.Any())
{
var parentStatements = GetStatements(declarationStatement.GetRequiredParent());
var declarationStatementIndex = parentStatements.IndexOf(declarationStatement);
var newParent = WithStatements(
declarationStatement.GetRequiredParent(),
new SyntaxList<TStatementSyntax>(parentStatements
.Take(declarationStatementIndex)
.Concat(usingStatement)
.Concat(parentStatements.Skip(declarationStatementIndex + 1 + statementsToSurround.Count))));
return document.WithSyntaxRoot(root.ReplaceNode(
declarationStatement.GetRequiredParent(),
newParent.WithAdditionalAnnotations(Formatter.Annotation)));
}
else
{
// Either the parent is not blocklike, meaning WithStatements can’t be used as in the other branch,
// or there’s just no need to replace more than the statement itself because no following statements
// will be surrounded.
return document.WithSyntaxRoot(root.ReplaceNode(
declarationStatement,
usingStatement.WithAdditionalAnnotations(Formatter.Annotation)));
}
}
private SyntaxList<TStatementSyntax> GetStatementsToSurround(
TLocalDeclarationSyntax declarationStatement,
SemanticModel semanticModel,
ISyntaxFactsService syntaxFactsService,
CancellationToken cancellationToken)
{
// Find the minimal number of statements to move into the using block
// in order to not break existing references to the local.
var lastUsageStatement = FindSiblingStatementContainingLastUsage(
declarationStatement,
semanticModel,
syntaxFactsService,
cancellationToken);
if (lastUsageStatement == declarationStatement)
{
return default;
}
var parentStatements = GetStatements(declarationStatement.GetRequiredParent());
var declarationStatementIndex = parentStatements.IndexOf(declarationStatement);
var lastUsageStatementIndex = parentStatements.IndexOf(lastUsageStatement, declarationStatementIndex + 1);
return new SyntaxList<TStatementSyntax>(parentStatements
.Take(lastUsageStatementIndex + 1)
.Skip(declarationStatementIndex + 1));
}
private static (SyntaxTriviaList sameLine, SyntaxTriviaList endOfLine) SplitTrailingTrivia(SyntaxNode node, ISyntaxFactsService syntaxFactsService)
{
var trailingTrivia = node.GetTrailingTrivia();
var lastIndex = trailingTrivia.Count - 1;
return lastIndex != -1 && syntaxFactsService.IsEndOfLineTrivia(trailingTrivia[lastIndex])
? (sameLine: trailingTrivia.RemoveAt(lastIndex), endOfLine: new SyntaxTriviaList(trailingTrivia[lastIndex]))
: (sameLine: trailingTrivia, endOfLine: SyntaxTriviaList.Empty);
}
private static TStatementSyntax FindSiblingStatementContainingLastUsage(
TStatementSyntax declarationSyntax,
SemanticModel semanticModel,
ISyntaxFactsService syntaxFactsService,
CancellationToken cancellationToken)
{
// We are going to step through the statements starting with the trigger variable's declaration.
// We will track when new locals are declared and when they are used. To determine the last
// statement that we should surround, we will walk through the locals in the order they are declared.
// If the local's declaration index falls within the last variable usage index, we will extend
// the last variable usage index to include the local's last usage.
// Take all the statements starting with the trigger variable's declaration.
var statementsFromDeclarationToEnd = declarationSyntax.GetRequiredParent().ChildNodesAndTokens()
.Select(nodeOrToken => nodeOrToken.AsNode())
.OfType<TStatementSyntax>()
.SkipWhile(node => node != declarationSyntax)
.ToImmutableArray();
// List of local variables that will be in the order they are declared.
using var _0 = ArrayBuilder<ISymbol>.GetInstance(out var localVariables);
// Map a symbol to an index into the statementsFromDeclarationToEnd array.
using var _1 = PooledDictionary<ISymbol, int>.GetInstance(out var variableDeclarationIndex);
using var _2 = PooledDictionary<ISymbol, int>.GetInstance(out var lastVariableUsageIndex);
// Loop through the statements from the trigger declaration to the end of the containing body.
// By starting with the trigger declaration it will add the trigger variable to the list of
// local variables.
for (var statementIndex = 0; statementIndex < statementsFromDeclarationToEnd.Length; statementIndex++)
{
var currentStatement = statementsFromDeclarationToEnd[statementIndex];
// Determine which local variables were referenced in this statement.
using var _ = PooledHashSet<ISymbol>.GetInstance(out var referencedVariables);
AddReferencedLocalVariables(referencedVariables, currentStatement, localVariables, semanticModel, syntaxFactsService, cancellationToken);
// Update the last usage index for each of the referenced variables.
foreach (var referencedVariable in referencedVariables)
{
lastVariableUsageIndex[referencedVariable] = statementIndex;
}
// Determine if new variables were declared in this statement.
var declaredVariables = semanticModel.GetAllDeclaredSymbols(currentStatement, cancellationToken);
foreach (var declaredVariable in declaredVariables)
{
// Initialize the declaration and usage index for the new variable and add it
// to the list of local variables.
variableDeclarationIndex[declaredVariable] = statementIndex;
lastVariableUsageIndex[declaredVariable] = statementIndex;
localVariables.Add(declaredVariable);
}
}
// Initially we will consider the trigger declaration statement the end of the using
// statement. This index will grow as we examine the last usage index of the local
// variables declared within the using statements scope.
var endOfUsingStatementIndex = 0;
// Walk through the local variables in the order that they were declared, starting
// with the trigger variable.
foreach (var localSymbol in localVariables)
{
var declarationIndex = variableDeclarationIndex[localSymbol];
if (declarationIndex > endOfUsingStatementIndex)
{
// If the variable was declared after the last statement to include in
// the using statement, we have gone far enough and other variables will
// also be declared outside the using statement.
break;
}
// If this variable was used later in the method than what we were considering
// the scope of the using statement, then increase the scope to include its last
// usage.
endOfUsingStatementIndex = Math.Max(endOfUsingStatementIndex, lastVariableUsageIndex[localSymbol]);
}
return statementsFromDeclarationToEnd[endOfUsingStatementIndex];
}
/// <summary>
/// Adds local variables that are being referenced within a statement to a set of symbols.
/// </summary>
private static void AddReferencedLocalVariables(
HashSet<ISymbol> referencedVariables,
SyntaxNode node,
IReadOnlyList<ISymbol> localVariables,
SemanticModel semanticModel,
ISyntaxFactsService syntaxFactsService,
CancellationToken cancellationToken)
{
// If this node matches one of our local variables, then we can say it has been referenced.
if (syntaxFactsService.IsIdentifierName(node))
{
var identifierName = syntaxFactsService.GetIdentifierOfSimpleName(node).ValueText;
var variable = localVariables.FirstOrDefault(localVariable
=> syntaxFactsService.StringComparer.Equals(localVariable.Name, identifierName) &&
localVariable.Equals(semanticModel.GetSymbolInfo(node, cancellationToken).Symbol));
if (variable is object)
{
referencedVariables.Add(variable);
}
}
// Walk through child nodes looking for references
foreach (var nodeOrToken in node.ChildNodesAndTokens())
{
// If we have already referenced all the local variables we are
// concerned with, then we can return early.
if (referencedVariables.Count == localVariables.Count)
{
return;
}
var childNode = nodeOrToken.AsNode();
if (childNode is null)
{
continue;
}
AddReferencedLocalVariables(referencedVariables, childNode, localVariables, semanticModel, syntaxFactsService, cancellationToken);
}
}
private sealed class MyCodeAction : DocumentChangeAction
{
public MyCodeAction(string title, Func<CancellationToken, Task<Document>> createChangedDocument)
: base(title, createChangedDocument, title)
{
}
}
}
}
| // 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.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeRefactorings;
using Microsoft.CodeAnalysis.Formatting;
using Microsoft.CodeAnalysis.LanguageServices;
using Microsoft.CodeAnalysis.Operations;
using Microsoft.CodeAnalysis.PooledObjects;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Microsoft.CodeAnalysis.Text;
using Microsoft.CodeAnalysis.Utilities;
using Roslyn.Utilities;
using static Microsoft.CodeAnalysis.CodeActions.CodeAction;
namespace Microsoft.CodeAnalysis.IntroduceUsingStatement
{
internal abstract class AbstractIntroduceUsingStatementCodeRefactoringProvider<TStatementSyntax, TLocalDeclarationSyntax> : CodeRefactoringProvider
where TStatementSyntax : SyntaxNode
where TLocalDeclarationSyntax : TStatementSyntax
{
protected abstract string CodeActionTitle { get; }
protected abstract bool CanRefactorToContainBlockStatements(SyntaxNode parent);
protected abstract SyntaxList<TStatementSyntax> GetStatements(SyntaxNode parentOfStatementsToSurround);
protected abstract SyntaxNode WithStatements(SyntaxNode parentOfStatementsToSurround, SyntaxList<TStatementSyntax> statements);
protected abstract TStatementSyntax CreateUsingStatement(TLocalDeclarationSyntax declarationStatement, SyntaxTriviaList sameLineTrivia, SyntaxList<TStatementSyntax> statementsToSurround);
public override async Task ComputeRefactoringsAsync(CodeRefactoringContext context)
{
var (document, span, cancellationToken) = context;
var declarationSyntax = await FindDisposableLocalDeclarationAsync(document, span, cancellationToken).ConfigureAwait(false);
if (declarationSyntax != null)
{
context.RegisterRefactoring(
new MyCodeAction(
CodeActionTitle,
cancellationToken => IntroduceUsingStatementAsync(document, declarationSyntax, cancellationToken)),
declarationSyntax.Span);
}
}
private async Task<TLocalDeclarationSyntax?> FindDisposableLocalDeclarationAsync(Document document, TextSpan selection, CancellationToken cancellationToken)
{
var declarationSyntax = await document.TryGetRelevantNodeAsync<TLocalDeclarationSyntax>(selection, cancellationToken).ConfigureAwait(false);
if (declarationSyntax is null || !CanRefactorToContainBlockStatements(declarationSyntax.GetRequiredParent()))
{
return null;
}
var semanticModel = await document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false);
var disposableType = semanticModel.Compilation.GetSpecialType(SpecialType.System_IDisposable);
if (disposableType is null)
{
return null;
}
var operation = semanticModel.GetOperation(declarationSyntax, cancellationToken) as IVariableDeclarationGroupOperation;
if (operation?.Declarations.Length != 1)
{
return null;
}
var localDeclaration = operation.Declarations[0];
if (localDeclaration.Declarators.Length != 1)
{
return null;
}
var declarator = localDeclaration.Declarators[0];
var localType = declarator.Symbol?.Type;
if (localType is null)
{
return null;
}
var initializer = (localDeclaration.Initializer ?? declarator.Initializer)?.Value;
// Initializer kind is invalid when incomplete declaration syntax ends in an equals token.
if (initializer is null || initializer.Kind == OperationKind.Invalid)
{
return null;
}
if (!IsLegalUsingStatementType(semanticModel.Compilation, disposableType, localType))
{
return null;
}
return declarationSyntax;
}
/// <summary>
/// Up to date with C# 7.3. Pattern-based disposal is likely to be added to C# 8.0,
/// in which case accessible instance and extension methods will need to be detected.
/// </summary>
private static bool IsLegalUsingStatementType(Compilation compilation, ITypeSymbol disposableType, ITypeSymbol type)
{
if (disposableType == null)
{
return false;
}
// CS1674: type used in a using statement must be implicitly convertible to 'System.IDisposable'
return compilation.ClassifyCommonConversion(type, disposableType).IsImplicit;
}
private async Task<Document> IntroduceUsingStatementAsync(
Document document,
TLocalDeclarationSyntax declarationStatement,
CancellationToken cancellationToken)
{
var root = await document.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false);
var semanticModel = await document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false);
var syntaxFactsService = document.GetRequiredLanguageService<ISyntaxFactsService>();
var statementsToSurround = GetStatementsToSurround(declarationStatement, semanticModel, syntaxFactsService, cancellationToken);
// Separate the newline from the trivia that is going on the using declaration line.
var (sameLine, endOfLine) = SplitTrailingTrivia(declarationStatement, syntaxFactsService);
var usingStatement =
CreateUsingStatement(
declarationStatement,
sameLine,
statementsToSurround)
.WithLeadingTrivia(declarationStatement.GetLeadingTrivia())
.WithTrailingTrivia(endOfLine);
if (statementsToSurround.Any())
{
var parentStatements = GetStatements(declarationStatement.GetRequiredParent());
var declarationStatementIndex = parentStatements.IndexOf(declarationStatement);
var newParent = WithStatements(
declarationStatement.GetRequiredParent(),
new SyntaxList<TStatementSyntax>(parentStatements
.Take(declarationStatementIndex)
.Concat(usingStatement)
.Concat(parentStatements.Skip(declarationStatementIndex + 1 + statementsToSurround.Count))));
return document.WithSyntaxRoot(root.ReplaceNode(
declarationStatement.GetRequiredParent(),
newParent.WithAdditionalAnnotations(Formatter.Annotation)));
}
else
{
// Either the parent is not blocklike, meaning WithStatements can’t be used as in the other branch,
// or there’s just no need to replace more than the statement itself because no following statements
// will be surrounded.
return document.WithSyntaxRoot(root.ReplaceNode(
declarationStatement,
usingStatement.WithAdditionalAnnotations(Formatter.Annotation)));
}
}
private SyntaxList<TStatementSyntax> GetStatementsToSurround(
TLocalDeclarationSyntax declarationStatement,
SemanticModel semanticModel,
ISyntaxFactsService syntaxFactsService,
CancellationToken cancellationToken)
{
// Find the minimal number of statements to move into the using block
// in order to not break existing references to the local.
var lastUsageStatement = FindSiblingStatementContainingLastUsage(
declarationStatement,
semanticModel,
syntaxFactsService,
cancellationToken);
if (lastUsageStatement == declarationStatement)
{
return default;
}
var parentStatements = GetStatements(declarationStatement.GetRequiredParent());
var declarationStatementIndex = parentStatements.IndexOf(declarationStatement);
var lastUsageStatementIndex = parentStatements.IndexOf(lastUsageStatement, declarationStatementIndex + 1);
return new SyntaxList<TStatementSyntax>(parentStatements
.Take(lastUsageStatementIndex + 1)
.Skip(declarationStatementIndex + 1));
}
private static (SyntaxTriviaList sameLine, SyntaxTriviaList endOfLine) SplitTrailingTrivia(SyntaxNode node, ISyntaxFactsService syntaxFactsService)
{
var trailingTrivia = node.GetTrailingTrivia();
var lastIndex = trailingTrivia.Count - 1;
return lastIndex != -1 && syntaxFactsService.IsEndOfLineTrivia(trailingTrivia[lastIndex])
? (sameLine: trailingTrivia.RemoveAt(lastIndex), endOfLine: new SyntaxTriviaList(trailingTrivia[lastIndex]))
: (sameLine: trailingTrivia, endOfLine: SyntaxTriviaList.Empty);
}
private static TStatementSyntax FindSiblingStatementContainingLastUsage(
TStatementSyntax declarationSyntax,
SemanticModel semanticModel,
ISyntaxFactsService syntaxFactsService,
CancellationToken cancellationToken)
{
// We are going to step through the statements starting with the trigger variable's declaration.
// We will track when new locals are declared and when they are used. To determine the last
// statement that we should surround, we will walk through the locals in the order they are declared.
// If the local's declaration index falls within the last variable usage index, we will extend
// the last variable usage index to include the local's last usage.
// Take all the statements starting with the trigger variable's declaration.
var statementsFromDeclarationToEnd = declarationSyntax.GetRequiredParent().ChildNodesAndTokens()
.Select(nodeOrToken => nodeOrToken.AsNode())
.OfType<TStatementSyntax>()
.SkipWhile(node => node != declarationSyntax)
.ToImmutableArray();
// List of local variables that will be in the order they are declared.
using var _0 = ArrayBuilder<ISymbol>.GetInstance(out var localVariables);
// Map a symbol to an index into the statementsFromDeclarationToEnd array.
using var _1 = PooledDictionary<ISymbol, int>.GetInstance(out var variableDeclarationIndex);
using var _2 = PooledDictionary<ISymbol, int>.GetInstance(out var lastVariableUsageIndex);
// Loop through the statements from the trigger declaration to the end of the containing body.
// By starting with the trigger declaration it will add the trigger variable to the list of
// local variables.
for (var statementIndex = 0; statementIndex < statementsFromDeclarationToEnd.Length; statementIndex++)
{
var currentStatement = statementsFromDeclarationToEnd[statementIndex];
// Determine which local variables were referenced in this statement.
using var _ = PooledHashSet<ISymbol>.GetInstance(out var referencedVariables);
AddReferencedLocalVariables(referencedVariables, currentStatement, localVariables, semanticModel, syntaxFactsService, cancellationToken);
// Update the last usage index for each of the referenced variables.
foreach (var referencedVariable in referencedVariables)
{
lastVariableUsageIndex[referencedVariable] = statementIndex;
}
// Determine if new variables were declared in this statement.
var declaredVariables = semanticModel.GetAllDeclaredSymbols(currentStatement, cancellationToken);
foreach (var declaredVariable in declaredVariables)
{
// Initialize the declaration and usage index for the new variable and add it
// to the list of local variables.
variableDeclarationIndex[declaredVariable] = statementIndex;
lastVariableUsageIndex[declaredVariable] = statementIndex;
localVariables.Add(declaredVariable);
}
}
// Initially we will consider the trigger declaration statement the end of the using
// statement. This index will grow as we examine the last usage index of the local
// variables declared within the using statements scope.
var endOfUsingStatementIndex = 0;
// Walk through the local variables in the order that they were declared, starting
// with the trigger variable.
foreach (var localSymbol in localVariables)
{
var declarationIndex = variableDeclarationIndex[localSymbol];
if (declarationIndex > endOfUsingStatementIndex)
{
// If the variable was declared after the last statement to include in
// the using statement, we have gone far enough and other variables will
// also be declared outside the using statement.
break;
}
// If this variable was used later in the method than what we were considering
// the scope of the using statement, then increase the scope to include its last
// usage.
endOfUsingStatementIndex = Math.Max(endOfUsingStatementIndex, lastVariableUsageIndex[localSymbol]);
}
return statementsFromDeclarationToEnd[endOfUsingStatementIndex];
}
/// <summary>
/// Adds local variables that are being referenced within a statement to a set of symbols.
/// </summary>
private static void AddReferencedLocalVariables(
HashSet<ISymbol> referencedVariables,
SyntaxNode node,
IReadOnlyList<ISymbol> localVariables,
SemanticModel semanticModel,
ISyntaxFactsService syntaxFactsService,
CancellationToken cancellationToken)
{
// If this node matches one of our local variables, then we can say it has been referenced.
if (syntaxFactsService.IsIdentifierName(node))
{
var identifierName = syntaxFactsService.GetIdentifierOfSimpleName(node).ValueText;
var variable = localVariables.FirstOrDefault(localVariable
=> syntaxFactsService.StringComparer.Equals(localVariable.Name, identifierName) &&
localVariable.Equals(semanticModel.GetSymbolInfo(node, cancellationToken).Symbol));
if (variable is object)
{
referencedVariables.Add(variable);
}
}
// Walk through child nodes looking for references
foreach (var nodeOrToken in node.ChildNodesAndTokens())
{
// If we have already referenced all the local variables we are
// concerned with, then we can return early.
if (referencedVariables.Count == localVariables.Count)
{
return;
}
var childNode = nodeOrToken.AsNode();
if (childNode is null)
{
continue;
}
AddReferencedLocalVariables(referencedVariables, childNode, localVariables, semanticModel, syntaxFactsService, cancellationToken);
}
}
private sealed class MyCodeAction : DocumentChangeAction
{
public MyCodeAction(string title, Func<CancellationToken, Task<Document>> createChangedDocument)
: base(title, createChangedDocument, title)
{
}
}
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Features/Core/Portable/Structure/BlockStructureService.cs | // 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.
#nullable disable
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Structure
{
internal abstract class BlockStructureService : ILanguageService
{
/// <summary>
/// Gets the service corresponding to the specified document.
/// </summary>
public static BlockStructureService GetService(Document document)
=> document.GetLanguageService<BlockStructureService>();
/// <summary>
/// The language from <see cref="LanguageNames"/> this service corresponds to.
/// </summary>
public abstract string Language { get; }
public abstract Task<BlockStructure> GetBlockStructureAsync(Document document, CancellationToken cancellationToken);
}
}
| // 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.
#nullable disable
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Structure
{
internal abstract class BlockStructureService : ILanguageService
{
/// <summary>
/// Gets the service corresponding to the specified document.
/// </summary>
public static BlockStructureService GetService(Document document)
=> document.GetLanguageService<BlockStructureService>();
/// <summary>
/// The language from <see cref="LanguageNames"/> this service corresponds to.
/// </summary>
public abstract string Language { get; }
public abstract Task<BlockStructure> GetBlockStructureAsync(Document document, CancellationToken cancellationToken);
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Features/Core/Portable/ExtractMethod/OperationStatus_Statics.cs | // 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.
#nullable disable
namespace Microsoft.CodeAnalysis.ExtractMethod
{
internal partial class OperationStatus
{
public static readonly OperationStatus Succeeded = new(OperationStatusFlag.Succeeded, reason: null);
public static readonly OperationStatus FailedWithUnknownReason = new(OperationStatusFlag.None, reason: FeaturesResources.Unknown_error_occurred);
public static readonly OperationStatus OverlapsHiddenPosition = new(OperationStatusFlag.None, FeaturesResources.generated_code_is_overlapping_with_hidden_portion_of_the_code);
public static readonly OperationStatus NoValidLocationToInsertMethodCall = new(OperationStatusFlag.None, FeaturesResources.No_valid_location_to_insert_method_call);
public static readonly OperationStatus NoActiveStatement = new(OperationStatusFlag.BestEffort, FeaturesResources.The_selection_contains_no_active_statement);
public static readonly OperationStatus ErrorOrUnknownType = new(OperationStatusFlag.BestEffort, FeaturesResources.The_selection_contains_an_error_or_unknown_type);
public static readonly OperationStatus UnsafeAddressTaken = new(OperationStatusFlag.BestEffort, FeaturesResources.The_address_of_a_variable_is_used_inside_the_selected_code);
public static readonly OperationStatus LocalFunctionCallWithoutDeclaration = new(OperationStatusFlag.BestEffort, FeaturesResources.The_selection_contains_a_local_function_call_without_its_declaration);
/// <summary>
/// create operation status with the given data
/// </summary>
public static OperationStatus<T> Create<T>(OperationStatus status, T data)
=> new(status, data);
}
}
| // 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.
#nullable disable
namespace Microsoft.CodeAnalysis.ExtractMethod
{
internal partial class OperationStatus
{
public static readonly OperationStatus Succeeded = new(OperationStatusFlag.Succeeded, reason: null);
public static readonly OperationStatus FailedWithUnknownReason = new(OperationStatusFlag.None, reason: FeaturesResources.Unknown_error_occurred);
public static readonly OperationStatus OverlapsHiddenPosition = new(OperationStatusFlag.None, FeaturesResources.generated_code_is_overlapping_with_hidden_portion_of_the_code);
public static readonly OperationStatus NoValidLocationToInsertMethodCall = new(OperationStatusFlag.None, FeaturesResources.No_valid_location_to_insert_method_call);
public static readonly OperationStatus NoActiveStatement = new(OperationStatusFlag.BestEffort, FeaturesResources.The_selection_contains_no_active_statement);
public static readonly OperationStatus ErrorOrUnknownType = new(OperationStatusFlag.BestEffort, FeaturesResources.The_selection_contains_an_error_or_unknown_type);
public static readonly OperationStatus UnsafeAddressTaken = new(OperationStatusFlag.BestEffort, FeaturesResources.The_address_of_a_variable_is_used_inside_the_selected_code);
public static readonly OperationStatus LocalFunctionCallWithoutDeclaration = new(OperationStatusFlag.BestEffort, FeaturesResources.The_selection_contains_a_local_function_call_without_its_declaration);
/// <summary>
/// create operation status with the given data
/// </summary>
public static OperationStatus<T> Create<T>(OperationStatus status, T data)
=> new(status, data);
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/EditorFeatures/VisualBasic/Highlighting/KeywordHighlighters/XmlElementHighlighter.vb | ' 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.
Imports System.ComponentModel.Composition
Imports System.Threading
Imports Microsoft.CodeAnalysis.Editor.Implementation.Highlighting
Imports Microsoft.CodeAnalysis.Host.Mef
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.KeywordHighlighting
<ExportHighlighter(LanguageNames.VisualBasic)>
Friend Class XmlElementHighlighter
Inherits AbstractKeywordHighlighter(Of XmlNodeSyntax)
<ImportingConstructor>
<Obsolete(MefConstruction.ImportingConstructorMessage, True)>
Public Sub New()
End Sub
Protected Overloads Overrides Sub AddHighlights(node As XmlNodeSyntax, highlights As List(Of TextSpan), cancellationToken As CancellationToken)
Dim xmlElement = node.GetAncestor(Of XmlElementSyntax)()
With xmlElement
If xmlElement IsNot Nothing AndAlso
Not .ContainsDiagnostics AndAlso
Not .HasAncestor(Of DocumentationCommentTriviaSyntax)() Then
With .StartTag
If .Attributes.Count = 0 Then
highlights.Add(.Span)
Else
highlights.Add(TextSpan.FromBounds(.LessThanToken.SpanStart, .Name.Span.End))
highlights.Add(.GreaterThanToken.Span)
End If
End With
highlights.Add(.EndTag.Span)
End If
End With
End Sub
End Class
End Namespace
| ' 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.
Imports System.ComponentModel.Composition
Imports System.Threading
Imports Microsoft.CodeAnalysis.Editor.Implementation.Highlighting
Imports Microsoft.CodeAnalysis.Host.Mef
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.KeywordHighlighting
<ExportHighlighter(LanguageNames.VisualBasic)>
Friend Class XmlElementHighlighter
Inherits AbstractKeywordHighlighter(Of XmlNodeSyntax)
<ImportingConstructor>
<Obsolete(MefConstruction.ImportingConstructorMessage, True)>
Public Sub New()
End Sub
Protected Overloads Overrides Sub AddHighlights(node As XmlNodeSyntax, highlights As List(Of TextSpan), cancellationToken As CancellationToken)
Dim xmlElement = node.GetAncestor(Of XmlElementSyntax)()
With xmlElement
If xmlElement IsNot Nothing AndAlso
Not .ContainsDiagnostics AndAlso
Not .HasAncestor(Of DocumentationCommentTriviaSyntax)() Then
With .StartTag
If .Attributes.Count = 0 Then
highlights.Add(.Span)
Else
highlights.Add(TextSpan.FromBounds(.LessThanToken.SpanStart, .Name.Span.End))
highlights.Add(.GreaterThanToken.Span)
End If
End With
highlights.Add(.EndTag.Span)
End If
End With
End Sub
End Class
End Namespace
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Compilers/CSharp/Portable/FlowAnalysis/AbstractFlowPass.cs | // 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.
#nullable disable
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Text;
using Microsoft.CodeAnalysis.CSharp.Symbols;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.PooledObjects;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.CSharp
{
/// <summary>
/// An abstract flow pass that takes some shortcuts in analyzing finally blocks, in order to enable
/// the analysis to take place without tracking exceptions or repeating the analysis of a finally block
/// for each exit from a try statement. The shortcut results in a slightly less precise
/// (but still conservative) analysis, but that less precise analysis is all that is required for
/// the language specification. The most significant shortcut is that we do not track the state
/// where exceptions can arise. That does not affect the soundness for most analyses, but for those
/// analyses whose soundness would be affected (e.g. "data flows out"), we track "unassignments" to keep
/// the analysis sound.
/// </summary>
/// <remarks>
/// Formally, this is a fairly conventional lattice flow analysis (<see
/// href="https://en.wikipedia.org/wiki/Data-flow_analysis"/>) that moves upward through the <see cref="Join(ref
/// TLocalState, ref TLocalState)"/> operation.
/// </remarks>
internal abstract partial class AbstractFlowPass<TLocalState, TLocalFunctionState> : BoundTreeVisitor
where TLocalState : AbstractFlowPass<TLocalState, TLocalFunctionState>.ILocalState
where TLocalFunctionState : AbstractFlowPass<TLocalState, TLocalFunctionState>.AbstractLocalFunctionState
{
protected int _recursionDepth;
/// <summary>
/// The compilation in which the analysis is taking place. This is needed to determine which
/// conditional methods will be compiled and which will be omitted.
/// </summary>
protected readonly CSharpCompilation compilation;
/// <summary>
/// The method whose body is being analyzed, or the field whose initializer is being analyzed.
/// May be a top-level member or a lambda or local function. It is used for
/// references to method parameters. Thus, '_symbol' should not be used directly, but
/// 'MethodParameters', 'MethodThisParameter' and 'AnalyzeOutParameters(...)' should be used
/// instead. _symbol is null during speculative binding.
/// </summary>
protected readonly Symbol _symbol;
/// <summary>
/// Reflects the enclosing member, lambda or local function at the current location (in the bound tree).
/// </summary>
protected Symbol CurrentSymbol;
/// <summary>
/// The bound node of the method or initializer being analyzed.
/// </summary>
protected readonly BoundNode methodMainNode;
/// <summary>
/// The flow analysis state at each label, computed by calling <see cref="Join(ref
/// TLocalState, ref TLocalState)"/> on the state from branches to that label with the state
/// when we fall into the label. Entries are created when the label is encountered. One
/// case deserves special attention: when the destination of the branch is a label earlier
/// in the code, it is possible (though rarely occurs in practice) that we are changing the
/// state at a label that we've already analyzed. In that case we run another pass of the
/// analysis to allow those changes to propagate. This repeats until no further changes to
/// the state of these labels occurs. This can result in quadratic performance in unlikely
/// but possible code such as this: "int x; if (cond) goto l1; x = 3; l5: print x; l4: goto
/// l5; l3: goto l4; l2: goto l3; l1: goto l2;"
/// </summary>
private readonly PooledDictionary<LabelSymbol, TLocalState> _labels;
/// <summary>
/// Set to true after an analysis scan if the analysis was incomplete due to state changing
/// after it was used by another analysis component. In this case the caller scans again (until
/// this is false). Since the analysis proceeds by monotonically changing the state computed
/// at each label, this must terminate.
/// </summary>
protected bool stateChangedAfterUse;
/// <summary>
/// All of the labels seen so far in this forward scan of the body
/// </summary>
private PooledHashSet<BoundStatement> _labelsSeen;
/// <summary>
/// Pending escapes generated in the current scope (or more deeply nested scopes). When jump
/// statements (goto, break, continue, return) are processed, they are placed in the
/// pendingBranches buffer to be processed later by the code handling the destination
/// statement. As a special case, the processing of try-finally statements might modify the
/// contents of the pendingBranches buffer to take into account the behavior of
/// "intervening" finally clauses.
/// </summary>
protected ArrayBuilder<PendingBranch> PendingBranches { get; private set; }
/// <summary>
/// The definite assignment and/or reachability state at the point currently being analyzed.
/// </summary>
protected TLocalState State;
protected TLocalState StateWhenTrue;
protected TLocalState StateWhenFalse;
protected bool IsConditionalState;
/// <summary>
/// Indicates that the transfer function for a particular node (the function mapping the
/// state before the node to the state after the node) is not monotonic, in the sense that
/// it can change the state in either direction in the lattice. If the transfer function is
/// monotonic, the transfer function can only change the state toward the <see
/// cref="UnreachableState"/>. Reachability and definite assignment are monotonic, and
/// permit a more efficient analysis. Region analysis and nullable analysis are not
/// monotonic. This is just an optimization; we could treat all of them as nonmonotonic
/// without much loss of performance. In fact, this only affects the analysis of (relatively
/// rare) try statements, and is only a slight optimization.
/// </summary>
private readonly bool _nonMonotonicTransfer;
protected void SetConditionalState((TLocalState whenTrue, TLocalState whenFalse) state)
{
SetConditionalState(state.whenTrue, state.whenFalse);
}
protected void SetConditionalState(TLocalState whenTrue, TLocalState whenFalse)
{
IsConditionalState = true;
State = default(TLocalState);
StateWhenTrue = whenTrue;
StateWhenFalse = whenFalse;
}
protected void SetState(TLocalState newState)
{
Debug.Assert(newState != null);
StateWhenTrue = StateWhenFalse = default(TLocalState);
IsConditionalState = false;
State = newState;
}
protected void Split()
{
if (!IsConditionalState)
{
SetConditionalState(State, State.Clone());
}
}
protected void Unsplit()
{
if (IsConditionalState)
{
Join(ref StateWhenTrue, ref StateWhenFalse);
SetState(StateWhenTrue);
}
}
/// <summary>
/// Where all diagnostics are deposited.
/// </summary>
protected DiagnosticBag Diagnostics { get; }
#region Region
// For region analysis, we maintain some extra data.
protected RegionPlace regionPlace; // tells whether we are currently analyzing code before, during, or after the region
protected readonly BoundNode firstInRegion, lastInRegion;
protected readonly bool TrackingRegions;
/// <summary>
/// A cache of the state at the backward branch point of each loop. This is not needed
/// during normal flow analysis, but is needed for DataFlowsOut region analysis.
/// </summary>
private readonly Dictionary<BoundLoopStatement, TLocalState> _loopHeadState;
#endregion Region
protected AbstractFlowPass(
CSharpCompilation compilation,
Symbol symbol,
BoundNode node,
BoundNode firstInRegion = null,
BoundNode lastInRegion = null,
bool trackRegions = false,
bool nonMonotonicTransferFunction = false)
{
Debug.Assert(node != null);
if (firstInRegion != null && lastInRegion != null)
{
trackRegions = true;
}
if (trackRegions)
{
Debug.Assert(firstInRegion != null);
Debug.Assert(lastInRegion != null);
int startLocation = firstInRegion.Syntax.SpanStart;
int endLocation = lastInRegion.Syntax.Span.End;
int length = endLocation - startLocation;
Debug.Assert(length >= 0, "last comes before first");
this.RegionSpan = new TextSpan(startLocation, length);
}
PendingBranches = ArrayBuilder<PendingBranch>.GetInstance();
_labelsSeen = PooledHashSet<BoundStatement>.GetInstance();
_labels = PooledDictionary<LabelSymbol, TLocalState>.GetInstance();
this.Diagnostics = DiagnosticBag.GetInstance();
this.compilation = compilation;
_symbol = symbol;
CurrentSymbol = symbol;
this.methodMainNode = node;
this.firstInRegion = firstInRegion;
this.lastInRegion = lastInRegion;
_loopHeadState = new Dictionary<BoundLoopStatement, TLocalState>(ReferenceEqualityComparer.Instance);
TrackingRegions = trackRegions;
_nonMonotonicTransfer = nonMonotonicTransferFunction;
}
protected abstract string Dump(TLocalState state);
protected string Dump()
{
return IsConditionalState
? $"true: {Dump(this.StateWhenTrue)} false: {Dump(this.StateWhenFalse)}"
: Dump(this.State);
}
#if DEBUG
protected string DumpLabels()
{
StringBuilder result = new StringBuilder();
result.Append("Labels{");
bool first = true;
foreach (var key in _labels.Keys)
{
if (!first)
{
result.Append(", ");
}
string name = key.Name;
if (string.IsNullOrEmpty(name))
{
name = "<Label>" + key.GetHashCode();
}
result.Append(name).Append(": ").Append(this.Dump(_labels[key]));
first = false;
}
result.Append("}");
return result.ToString();
}
#endif
private void EnterRegionIfNeeded(BoundNode node)
{
if (TrackingRegions && node == this.firstInRegion && this.regionPlace == RegionPlace.Before)
{
EnterRegion();
}
}
/// <summary>
/// Subclasses may override EnterRegion to perform any actions at the entry to the region.
/// </summary>
protected virtual void EnterRegion()
{
Debug.Assert(this.regionPlace == RegionPlace.Before);
this.regionPlace = RegionPlace.Inside;
}
private void LeaveRegionIfNeeded(BoundNode node)
{
if (TrackingRegions && node == this.lastInRegion && this.regionPlace == RegionPlace.Inside)
{
LeaveRegion();
}
}
/// <summary>
/// Subclasses may override LeaveRegion to perform any action at the end of the region.
/// </summary>
protected virtual void LeaveRegion()
{
Debug.Assert(IsInside);
this.regionPlace = RegionPlace.After;
}
protected readonly TextSpan RegionSpan;
protected bool RegionContains(TextSpan span)
{
// TODO: There are no scenarios involving a zero-length span
// currently. If the assert fails, add a corresponding test.
Debug.Assert(span.Length > 0);
if (span.Length == 0)
{
return RegionSpan.Contains(span.Start);
}
return RegionSpan.Contains(span);
}
protected bool IsInside
{
get
{
return regionPlace == RegionPlace.Inside;
}
}
protected virtual void EnterParameters(ImmutableArray<ParameterSymbol> parameters)
{
foreach (var parameter in parameters)
{
EnterParameter(parameter);
}
}
protected virtual void EnterParameter(ParameterSymbol parameter)
{ }
protected virtual void LeaveParameters(
ImmutableArray<ParameterSymbol> parameters,
SyntaxNode syntax,
Location location)
{
foreach (ParameterSymbol parameter in parameters)
{
LeaveParameter(parameter, syntax, location);
}
}
protected virtual void LeaveParameter(ParameterSymbol parameter, SyntaxNode syntax, Location location)
{ }
public override BoundNode Visit(BoundNode node)
{
return VisitAlways(node);
}
protected BoundNode VisitAlways(BoundNode node)
{
BoundNode result = null;
// We scan even expressions, because we must process lambdas contained within them.
if (node != null)
{
EnterRegionIfNeeded(node);
VisitWithStackGuard(node);
LeaveRegionIfNeeded(node);
}
return result;
}
[DebuggerStepThrough]
private BoundNode VisitWithStackGuard(BoundNode node)
{
var expression = node as BoundExpression;
if (expression != null)
{
return VisitExpressionWithStackGuard(ref _recursionDepth, expression);
}
return base.Visit(node);
}
[DebuggerStepThrough]
protected override BoundExpression VisitExpressionWithoutStackGuard(BoundExpression node)
{
return (BoundExpression)base.Visit(node);
}
protected override bool ConvertInsufficientExecutionStackExceptionToCancelledByStackGuardException()
{
return false; // just let the original exception bubble up.
}
/// <summary>
/// A pending branch. These are created for a return, break, continue, goto statement,
/// yield return, yield break, await expression, and await foreach/using. The idea is that
/// we don't know if the branch will eventually reach its destination because of an
/// intervening finally block that cannot complete normally. So we store them up and handle
/// them as we complete processing each construct. At the end of a block, if there are any
/// pending branches to a label in that block we process the branch. Otherwise we relay it
/// up to the enclosing construct as a pending branch of the enclosing construct.
/// </summary>
internal class PendingBranch
{
public readonly BoundNode Branch;
public bool IsConditionalState;
public TLocalState State;
public TLocalState StateWhenTrue;
public TLocalState StateWhenFalse;
public readonly LabelSymbol Label;
public PendingBranch(BoundNode branch, TLocalState state, LabelSymbol label, bool isConditionalState = false, TLocalState stateWhenTrue = default, TLocalState stateWhenFalse = default)
{
this.Branch = branch;
this.State = state.Clone();
this.IsConditionalState = isConditionalState;
if (isConditionalState)
{
this.StateWhenTrue = stateWhenTrue.Clone();
this.StateWhenFalse = stateWhenFalse.Clone();
}
this.Label = label;
}
}
/// <summary>
/// Perform a single pass of flow analysis. Note that after this pass,
/// this.backwardBranchChanged indicates if a further pass is required.
/// </summary>
protected virtual ImmutableArray<PendingBranch> Scan(ref bool badRegion)
{
var oldPending = SavePending();
Visit(methodMainNode);
this.Unsplit();
RestorePending(oldPending);
if (TrackingRegions && regionPlace != RegionPlace.After)
{
badRegion = true;
}
ImmutableArray<PendingBranch> result = RemoveReturns();
return result;
}
protected ImmutableArray<PendingBranch> Analyze(ref bool badRegion, Optional<TLocalState> initialState = default)
{
ImmutableArray<PendingBranch> returns;
do
{
// the entry point of a method is assumed reachable
regionPlace = RegionPlace.Before;
this.State = initialState.HasValue ? initialState.Value : TopState();
PendingBranches.Clear();
this.stateChangedAfterUse = false;
this.Diagnostics.Clear();
returns = this.Scan(ref badRegion);
}
while (this.stateChangedAfterUse);
return returns;
}
protected virtual void Free()
{
this.Diagnostics.Free();
PendingBranches.Free();
_labelsSeen.Free();
_labels.Free();
}
/// <summary>
/// If a method is currently being analyzed returns its parameters, returns an empty array
/// otherwise.
/// </summary>
protected ImmutableArray<ParameterSymbol> MethodParameters
{
get
{
var method = _symbol as MethodSymbol;
return (object)method == null ? ImmutableArray<ParameterSymbol>.Empty : method.Parameters;
}
}
/// <summary>
/// If a method is currently being analyzed returns its 'this' parameter, returns null
/// otherwise.
/// </summary>
protected ParameterSymbol MethodThisParameter
{
get
{
ParameterSymbol thisParameter = null;
(_symbol as MethodSymbol)?.TryGetThisParameter(out thisParameter);
return thisParameter;
}
}
/// <summary>
/// Specifies whether or not method's out parameters should be analyzed. If there's more
/// than one location in the method being analyzed, then the method is partial and we prefer
/// to report an out parameter in partial method error.
/// </summary>
/// <param name="location">location to be used</param>
/// <returns>true if the out parameters of the method should be analyzed</returns>
protected bool ShouldAnalyzeOutParameters(out Location location)
{
var method = _symbol as MethodSymbol;
if ((object)method == null || method.Locations.Length != 1)
{
location = null;
return false;
}
else
{
location = method.Locations[0];
return true;
}
}
/// <summary>
/// Return the flow analysis state associated with a label.
/// </summary>
/// <param name="label"></param>
/// <returns></returns>
protected virtual TLocalState LabelState(LabelSymbol label)
{
TLocalState result;
if (_labels.TryGetValue(label, out result))
{
return result;
}
result = UnreachableState();
_labels.Add(label, result);
return result;
}
/// <summary>
/// Return to the caller the set of pending return statements.
/// </summary>
/// <returns></returns>
protected virtual ImmutableArray<PendingBranch> RemoveReturns()
{
ImmutableArray<PendingBranch> result;
result = PendingBranches.ToImmutable();
PendingBranches.Clear();
// The caller should have handled and cleared labelsSeen.
Debug.Assert(_labelsSeen.Count == 0);
return result;
}
/// <summary>
/// Set the current state to one that indicates that it is unreachable.
/// </summary>
protected void SetUnreachable()
{
this.State = UnreachableState();
}
protected void VisitLvalue(BoundExpression node)
{
EnterRegionIfNeeded(node);
switch (node?.Kind)
{
case BoundKind.Parameter:
VisitLvalueParameter((BoundParameter)node);
break;
case BoundKind.Local:
VisitLvalue((BoundLocal)node);
break;
case BoundKind.ThisReference:
case BoundKind.BaseReference:
break;
case BoundKind.PropertyAccess:
var access = (BoundPropertyAccess)node;
if (Binder.AccessingAutoPropertyFromConstructor(access, _symbol))
{
var backingField = (access.PropertySymbol as SourcePropertySymbolBase)?.BackingField;
if (backingField != null)
{
VisitFieldAccessInternal(access.ReceiverOpt, backingField);
break;
}
}
goto default;
case BoundKind.FieldAccess:
{
BoundFieldAccess node1 = (BoundFieldAccess)node;
VisitFieldAccessInternal(node1.ReceiverOpt, node1.FieldSymbol);
break;
}
case BoundKind.EventAccess:
{
BoundEventAccess node1 = (BoundEventAccess)node;
VisitFieldAccessInternal(node1.ReceiverOpt, node1.EventSymbol.AssociatedField);
break;
}
case BoundKind.TupleLiteral:
case BoundKind.ConvertedTupleLiteral:
((BoundTupleExpression)node).VisitAllElements((x, self) => self.VisitLvalue(x), this);
break;
default:
VisitRvalue(node);
break;
}
LeaveRegionIfNeeded(node);
}
protected virtual void VisitLvalue(BoundLocal node)
{
}
/// <summary>
/// Visit a boolean condition expression.
/// </summary>
/// <param name="node"></param>
protected void VisitCondition(BoundExpression node)
{
Visit(node);
AdjustConditionalState(node);
}
private void AdjustConditionalState(BoundExpression node)
{
if (IsConstantTrue(node))
{
Unsplit();
SetConditionalState(this.State, UnreachableState());
}
else if (IsConstantFalse(node))
{
Unsplit();
SetConditionalState(UnreachableState(), this.State);
}
else if ((object)node.Type == null || node.Type.SpecialType != SpecialType.System_Boolean)
{
// a dynamic type or a type with operator true/false
Unsplit();
}
Split();
}
/// <summary>
/// Visit a general expression, where we will only need to determine if variables are
/// assigned (or not). That is, we will not be needing AssignedWhenTrue and
/// AssignedWhenFalse.
/// </summary>
/// <param name="isKnownToBeAnLvalue">True when visiting an rvalue that will actually be used as an lvalue,
/// for example a ref parameter when simulating a read of it, or an argument corresponding to an in parameter</param>
protected virtual void VisitRvalue(BoundExpression node, bool isKnownToBeAnLvalue = false)
{
Visit(node);
Unsplit();
}
/// <summary>
/// Visit a statement.
/// </summary>
[DebuggerHidden]
protected virtual void VisitStatement(BoundStatement statement)
{
Visit(statement);
Debug.Assert(!this.IsConditionalState);
}
protected static bool IsConstantTrue(BoundExpression node)
{
return node.ConstantValue == ConstantValue.True;
}
protected static bool IsConstantFalse(BoundExpression node)
{
return node.ConstantValue == ConstantValue.False;
}
protected static bool IsConstantNull(BoundExpression node)
{
return node.ConstantValue == ConstantValue.Null;
}
/// <summary>
/// Called at the point in a loop where the backwards branch would go to.
/// </summary>
private void LoopHead(BoundLoopStatement node)
{
TLocalState previousState;
if (_loopHeadState.TryGetValue(node, out previousState))
{
Join(ref this.State, ref previousState);
}
_loopHeadState[node] = this.State.Clone();
}
/// <summary>
/// Called at the point in a loop where the backward branch is placed.
/// </summary>
private void LoopTail(BoundLoopStatement node)
{
var oldState = _loopHeadState[node];
if (Join(ref oldState, ref this.State))
{
_loopHeadState[node] = oldState;
this.stateChangedAfterUse = true;
}
}
/// <summary>
/// Used to resolve break statements in each statement form that has a break statement
/// (loops, switch).
/// </summary>
private void ResolveBreaks(TLocalState breakState, LabelSymbol label)
{
var pendingBranches = PendingBranches;
var count = pendingBranches.Count;
if (count != 0)
{
int stillPending = 0;
for (int i = 0; i < count; i++)
{
var pending = pendingBranches[i];
if (pending.Label == label)
{
Join(ref breakState, ref pending.State);
}
else
{
if (stillPending != i)
{
pendingBranches[stillPending] = pending;
}
stillPending++;
}
}
pendingBranches.Clip(stillPending);
}
SetState(breakState);
}
/// <summary>
/// Used to resolve continue statements in each statement form that supports it.
/// </summary>
private void ResolveContinues(LabelSymbol continueLabel)
{
var pendingBranches = PendingBranches;
var count = pendingBranches.Count;
if (count != 0)
{
int stillPending = 0;
for (int i = 0; i < count; i++)
{
var pending = pendingBranches[i];
if (pending.Label == continueLabel)
{
// Technically, nothing in the language specification depends on the state
// at the continue label, so we could just discard them instead of merging
// the states. In fact, we need not have added continue statements to the
// pending jump queue in the first place if we were interested solely in the
// flow analysis. However, region analysis (in support of extract method)
// and other forms of more precise analysis
// depend on continue statements appearing in the pending branch queue, so
// we process them from the queue here.
Join(ref this.State, ref pending.State);
}
else
{
if (stillPending != i)
{
pendingBranches[stillPending] = pending;
}
stillPending++;
}
}
pendingBranches.Clip(stillPending);
}
}
/// <summary>
/// Subclasses override this if they want to take special actions on processing a goto
/// statement, when both the jump and the label have been located.
/// </summary>
protected virtual void NoteBranch(PendingBranch pending, BoundNode gotoStmt, BoundStatement target)
{
target.AssertIsLabeledStatement();
}
/// <summary>
/// To handle a label, we resolve all branches to that label. Returns true if the state of
/// the label changes as a result.
/// </summary>
/// <param name="label">Target label</param>
/// <param name="target">Statement containing the target label</param>
private bool ResolveBranches(LabelSymbol label, BoundStatement target)
{
target?.AssertIsLabeledStatementWithLabel(label);
bool labelStateChanged = false;
var pendingBranches = PendingBranches;
var count = pendingBranches.Count;
if (count != 0)
{
int stillPending = 0;
for (int i = 0; i < count; i++)
{
var pending = pendingBranches[i];
if (pending.Label == label)
{
ResolveBranch(pending, label, target, ref labelStateChanged);
}
else
{
if (stillPending != i)
{
pendingBranches[stillPending] = pending;
}
stillPending++;
}
}
pendingBranches.Clip(stillPending);
}
return labelStateChanged;
}
protected virtual void ResolveBranch(PendingBranch pending, LabelSymbol label, BoundStatement target, ref bool labelStateChanged)
{
var state = LabelState(label);
if (target != null)
{
NoteBranch(pending, pending.Branch, target);
}
var changed = Join(ref state, ref pending.State);
if (changed)
{
labelStateChanged = true;
_labels[label] = state;
}
}
protected struct SavedPending
{
public readonly ArrayBuilder<PendingBranch> PendingBranches;
public readonly PooledHashSet<BoundStatement> LabelsSeen;
public SavedPending(ArrayBuilder<PendingBranch> pendingBranches, PooledHashSet<BoundStatement> labelsSeen)
{
this.PendingBranches = pendingBranches;
this.LabelsSeen = labelsSeen;
}
}
/// <summary>
/// Since branches cannot branch into constructs, only out, we save the pending branches
/// when visiting more nested constructs. When tracking exceptions, we store the current
/// state as the exception state for the following code.
/// </summary>
protected SavedPending SavePending()
{
Debug.Assert(!this.IsConditionalState);
var result = new SavedPending(PendingBranches, _labelsSeen);
PendingBranches = ArrayBuilder<PendingBranch>.GetInstance();
_labelsSeen = PooledHashSet<BoundStatement>.GetInstance();
return result;
}
/// <summary>
/// We use this when closing a block that may contain labels or branches
/// - branches to new labels are resolved
/// - new labels are removed (no longer can be reached)
/// - unresolved pending branches are carried forward
/// </summary>
/// <param name="oldPending">The old pending branches, which are to be merged with the current ones</param>
protected void RestorePending(SavedPending oldPending)
{
foreach (var node in _labelsSeen)
{
switch (node.Kind)
{
case BoundKind.LabeledStatement:
{
var label = (BoundLabeledStatement)node;
stateChangedAfterUse |= ResolveBranches(label.Label, label);
}
break;
case BoundKind.LabelStatement:
{
var label = (BoundLabelStatement)node;
stateChangedAfterUse |= ResolveBranches(label.Label, label);
}
break;
case BoundKind.SwitchSection:
{
var sec = (BoundSwitchSection)node;
foreach (var label in sec.SwitchLabels)
{
stateChangedAfterUse |= ResolveBranches(label.Label, sec);
}
}
break;
default:
// there are no other kinds of labels
throw ExceptionUtilities.UnexpectedValue(node.Kind);
}
}
oldPending.PendingBranches.AddRange(this.PendingBranches);
PendingBranches.Free();
PendingBranches = oldPending.PendingBranches;
// We only use SavePending/RestorePending when there could be no branch into the region between them.
// So there is no need to save the labels seen between the calls. If there were such a need, we would
// do "this.labelsSeen.UnionWith(oldPending.LabelsSeen);" instead of the following assignment
_labelsSeen.Free();
_labelsSeen = oldPending.LabelsSeen;
}
#region visitors
/// <summary>
/// Since each language construct must be handled according to the rules of the language specification,
/// the default visitor reports that the construct for the node is not implemented in the compiler.
/// </summary>
public override BoundNode DefaultVisit(BoundNode node)
{
Debug.Assert(false, $"Should Visit{node.Kind} be overridden in {this.GetType().Name}?");
Diagnostics.Add(ErrorCode.ERR_InternalError, node.Syntax.Location);
return null;
}
public override BoundNode VisitAttribute(BoundAttribute node)
{
// No flow analysis is ever done in attributes (or their arguments).
return null;
}
public override BoundNode VisitThrowExpression(BoundThrowExpression node)
{
VisitRvalue(node.Expression);
SetUnreachable();
return node;
}
public override BoundNode VisitPassByCopy(BoundPassByCopy node)
{
VisitRvalue(node.Expression);
return node;
}
public override BoundNode VisitIsPatternExpression(BoundIsPatternExpression node)
{
Debug.Assert(!IsConditionalState);
bool negated = node.Pattern.IsNegated(out var pattern);
Debug.Assert(negated == node.IsNegated);
if (VisitPossibleConditionalAccess(node.Expression, out var stateWhenNotNull))
{
Debug.Assert(!IsConditionalState);
SetConditionalState(patternMatchesNull(pattern)
? (State, stateWhenNotNull)
: (stateWhenNotNull, State));
}
else if (IsConditionalState)
{
// Patterns which only match a single boolean value should propagate conditional state
// for example, `(a != null && a.M(out x)) is true` should have the same conditional state as `(a != null && a.M(out x))`.
if (isBoolTest(pattern) is bool value)
{
if (!value)
{
SetConditionalState(StateWhenFalse, StateWhenTrue);
}
}
else
{
// Patterns which match more than a single boolean value cannot propagate conditional state
// for example, `(a != null && a.M(out x)) is bool b` should not have conditional state
Unsplit();
}
}
VisitPattern(pattern);
var reachableLabels = node.DecisionDag.ReachableLabels;
if (!reachableLabels.Contains(node.WhenTrueLabel))
{
SetState(this.StateWhenFalse);
SetConditionalState(UnreachableState(), this.State);
}
else if (!reachableLabels.Contains(node.WhenFalseLabel))
{
SetState(this.StateWhenTrue);
SetConditionalState(this.State, UnreachableState());
}
if (negated)
{
SetConditionalState(this.StateWhenFalse, this.StateWhenTrue);
}
return node;
static bool patternMatchesNull(BoundPattern pattern)
{
switch (pattern)
{
case BoundTypePattern:
case BoundRecursivePattern:
case BoundITuplePattern:
case BoundRelationalPattern:
case BoundDeclarationPattern { IsVar: false }:
case BoundConstantPattern { ConstantValue: { IsNull: false } }:
return false;
case BoundConstantPattern { ConstantValue: { IsNull: true } }:
return true;
case BoundNegatedPattern negated:
return !patternMatchesNull(negated.Negated);
case BoundBinaryPattern binary:
if (binary.Disjunction)
{
// `a?.b(out x) is null or C`
// pattern matches null if either subpattern matches null
var leftNullTest = patternMatchesNull(binary.Left);
return patternMatchesNull(binary.Left) || patternMatchesNull(binary.Right);
}
// `a?.b out x is not null and var c`
// pattern matches null only if both subpatterns match null
return patternMatchesNull(binary.Left) && patternMatchesNull(binary.Right);
case BoundDeclarationPattern { IsVar: true }:
case BoundDiscardPattern:
return true;
default:
throw ExceptionUtilities.UnexpectedValue(pattern.Kind);
}
}
// Returns `true` if the pattern only matches a `true` input.
// Returns `false` if the pattern only matches a `false` input.
// Otherwise, returns `null`.
static bool? isBoolTest(BoundPattern pattern)
{
switch (pattern)
{
case BoundConstantPattern { ConstantValue: { IsBoolean: true, BooleanValue: var boolValue } }:
return boolValue;
case BoundNegatedPattern negated:
return !isBoolTest(negated.Negated);
case BoundBinaryPattern binary:
if (binary.Disjunction)
{
// `(a != null && a.b(out x)) is true or true` matches `true`
// `(a != null && a.b(out x)) is true or false` matches any boolean
// both subpatterns must have the same bool test for the test to propagate out
var leftNullTest = isBoolTest(binary.Left);
return leftNullTest is null ? null :
leftNullTest != isBoolTest(binary.Right) ? null :
leftNullTest;
}
// `(a != null && a.b(out x)) is true and true` matches `true`
// `(a != null && a.b(out x)) is true and var x` matches `true`
// `(a != null && a.b(out x)) is true and false` never matches and is a compile error
return isBoolTest(binary.Left) ?? isBoolTest(binary.Right);
case BoundConstantPattern { ConstantValue: { IsBoolean: false } }:
case BoundDiscardPattern:
case BoundTypePattern:
case BoundRecursivePattern:
case BoundITuplePattern:
case BoundRelationalPattern:
case BoundDeclarationPattern:
return null;
default:
throw ExceptionUtilities.UnexpectedValue(pattern.Kind);
}
}
}
public virtual void VisitPattern(BoundPattern pattern)
{
Split();
}
public override BoundNode VisitConstantPattern(BoundConstantPattern node)
{
// All patterns are handled by VisitPattern
throw ExceptionUtilities.Unreachable;
}
public override BoundNode VisitTupleLiteral(BoundTupleLiteral node)
{
return VisitTupleExpression(node);
}
public override BoundNode VisitConvertedTupleLiteral(BoundConvertedTupleLiteral node)
{
return VisitTupleExpression(node);
}
private BoundNode VisitTupleExpression(BoundTupleExpression node)
{
VisitArguments(node.Arguments, default(ImmutableArray<RefKind>), null);
return null;
}
public override BoundNode VisitTupleBinaryOperator(BoundTupleBinaryOperator node)
{
VisitRvalue(node.Left);
VisitRvalue(node.Right);
return null;
}
public override BoundNode VisitDynamicObjectCreationExpression(BoundDynamicObjectCreationExpression node)
{
VisitArguments(node.Arguments, node.ArgumentRefKindsOpt, null);
VisitRvalue(node.InitializerExpressionOpt);
return null;
}
public override BoundNode VisitDynamicIndexerAccess(BoundDynamicIndexerAccess node)
{
VisitRvalue(node.Receiver);
VisitArguments(node.Arguments, node.ArgumentRefKindsOpt, null);
return null;
}
public override BoundNode VisitDynamicMemberAccess(BoundDynamicMemberAccess node)
{
VisitRvalue(node.Receiver);
return null;
}
public override BoundNode VisitDynamicInvocation(BoundDynamicInvocation node)
{
VisitRvalue(node.Expression);
VisitArguments(node.Arguments, node.ArgumentRefKindsOpt, null);
return null;
}
#nullable enable
protected BoundNode? VisitInterpolatedStringBase(BoundInterpolatedStringBase node, InterpolatedStringHandlerData? data)
{
// If there can be any branching, then we need to treat the expressions
// as optionally evaluated. Otherwise, we treat them as always evaluated
(BoundExpression? construction, bool useBoolReturns, bool firstPartIsConditional) = data switch
{
null => (null, false, false),
{ } d => (d.Construction, d.UsesBoolReturns, d.HasTrailingHandlerValidityParameter)
};
VisitRvalue(construction);
bool hasConditionalEvaluation = useBoolReturns || firstPartIsConditional;
TLocalState? shortCircuitState = hasConditionalEvaluation ? State.Clone() : default;
_ = VisitInterpolatedStringHandlerParts(node, useBoolReturns, firstPartIsConditional, ref shortCircuitState);
if (hasConditionalEvaluation)
{
Debug.Assert(shortCircuitState != null);
Join(ref this.State, ref shortCircuitState);
}
return null;
}
#nullable disable
public override BoundNode VisitInterpolatedString(BoundInterpolatedString node)
{
return VisitInterpolatedStringBase(node, node.InterpolationData);
}
public override BoundNode VisitUnconvertedInterpolatedString(BoundUnconvertedInterpolatedString node)
{
// If the node is unconverted, we'll just treat it as if the contents are always evaluated
return VisitInterpolatedStringBase(node, data: null);
}
public override BoundNode VisitStringInsert(BoundStringInsert node)
{
VisitRvalue(node.Value);
if (node.Alignment != null)
{
VisitRvalue(node.Alignment);
}
if (node.Format != null)
{
VisitRvalue(node.Format);
}
return null;
}
public override BoundNode VisitInterpolatedStringHandlerPlaceholder(BoundInterpolatedStringHandlerPlaceholder node)
{
return null;
}
public override BoundNode VisitInterpolatedStringArgumentPlaceholder(BoundInterpolatedStringArgumentPlaceholder node)
{
return null;
}
public override BoundNode VisitArgList(BoundArgList node)
{
// The "__arglist" expression that is legal inside a varargs method has no
// effect on flow analysis and it has no children.
return null;
}
public override BoundNode VisitArgListOperator(BoundArgListOperator node)
{
// When we have M(__arglist(x, y, z)) we must visit x, y and z.
VisitArguments(node.Arguments, node.ArgumentRefKindsOpt, null);
return null;
}
public override BoundNode VisitRefTypeOperator(BoundRefTypeOperator node)
{
VisitRvalue(node.Operand);
return null;
}
public override BoundNode VisitMakeRefOperator(BoundMakeRefOperator node)
{
// Note that we require that the variable whose reference we are taking
// has been initialized; it is similar to passing the variable as a ref parameter.
VisitRvalue(node.Operand, isKnownToBeAnLvalue: true);
return null;
}
public override BoundNode VisitRefValueOperator(BoundRefValueOperator node)
{
VisitRvalue(node.Operand);
return null;
}
public override BoundNode VisitGlobalStatementInitializer(BoundGlobalStatementInitializer node)
{
VisitStatement(node.Statement);
return null;
}
public override BoundNode VisitLambda(BoundLambda node) => null;
public override BoundNode VisitLocal(BoundLocal node)
{
SplitIfBooleanConstant(node);
return null;
}
public override BoundNode VisitLocalDeclaration(BoundLocalDeclaration node)
{
if (node.InitializerOpt != null)
{
// analyze the expression
VisitRvalue(node.InitializerOpt, isKnownToBeAnLvalue: node.LocalSymbol.RefKind != RefKind.None);
// byref assignment is also a potential write
if (node.LocalSymbol.RefKind != RefKind.None)
{
WriteArgument(node.InitializerOpt, node.LocalSymbol.RefKind, method: null);
}
}
return null;
}
public override BoundNode VisitBlock(BoundBlock node)
{
VisitStatements(node.Statements);
return null;
}
private void VisitStatements(ImmutableArray<BoundStatement> statements)
{
foreach (var statement in statements)
{
VisitStatement(statement);
}
}
public override BoundNode VisitScope(BoundScope node)
{
VisitStatements(node.Statements);
return null;
}
public override BoundNode VisitExpressionStatement(BoundExpressionStatement node)
{
VisitRvalue(node.Expression);
return null;
}
public override BoundNode VisitCall(BoundCall node)
{
// If the method being called is a partial method without a definition, or is a conditional method
// whose condition is not true, then the call has no effect and it is ignored for the purposes of
// definite assignment analysis.
bool callsAreOmitted = node.Method.CallsAreOmitted(node.SyntaxTree);
TLocalState savedState = default(TLocalState);
if (callsAreOmitted)
{
savedState = this.State.Clone();
SetUnreachable();
}
VisitReceiverBeforeCall(node.ReceiverOpt, node.Method);
VisitArgumentsBeforeCall(node.Arguments, node.ArgumentRefKindsOpt);
if (node.Method?.OriginalDefinition is LocalFunctionSymbol localFunc)
{
VisitLocalFunctionUse(localFunc, node.Syntax, isCall: true);
}
VisitArgumentsAfterCall(node.Arguments, node.ArgumentRefKindsOpt, node.Method);
VisitReceiverAfterCall(node.ReceiverOpt, node.Method);
if (callsAreOmitted)
{
this.State = savedState;
}
return null;
}
protected void VisitLocalFunctionUse(LocalFunctionSymbol symbol, SyntaxNode syntax, bool isCall)
{
var localFuncState = GetOrCreateLocalFuncUsages(symbol);
VisitLocalFunctionUse(symbol, localFuncState, syntax, isCall);
}
protected virtual void VisitLocalFunctionUse(
LocalFunctionSymbol symbol,
TLocalFunctionState localFunctionState,
SyntaxNode syntax,
bool isCall)
{
if (isCall)
{
Join(ref State, ref localFunctionState.StateFromBottom);
Meet(ref State, ref localFunctionState.StateFromTop);
}
localFunctionState.Visited = true;
}
private void VisitReceiverBeforeCall(BoundExpression receiverOpt, MethodSymbol method)
{
if (method is null || method.MethodKind != MethodKind.Constructor)
{
VisitRvalue(receiverOpt);
}
}
private void VisitReceiverAfterCall(BoundExpression receiverOpt, MethodSymbol method)
{
if (receiverOpt is null)
{
return;
}
if (method is null)
{
WriteArgument(receiverOpt, RefKind.Ref, method: null);
}
else if (method.TryGetThisParameter(out var thisParameter)
&& thisParameter is object
&& !TypeIsImmutable(thisParameter.Type))
{
var thisRefKind = thisParameter.RefKind;
if (thisRefKind.IsWritableReference())
{
WriteArgument(receiverOpt, thisRefKind, method);
}
}
}
/// <summary>
/// Certain (struct) types are known by the compiler to be immutable. In these cases calling a method on
/// the type is known (by flow analysis) not to write the receiver.
/// </summary>
/// <param name="t"></param>
/// <returns></returns>
private static bool TypeIsImmutable(TypeSymbol t)
{
switch (t.SpecialType)
{
case SpecialType.System_Boolean:
case SpecialType.System_Char:
case SpecialType.System_SByte:
case SpecialType.System_Byte:
case SpecialType.System_Int16:
case SpecialType.System_UInt16:
case SpecialType.System_Int32:
case SpecialType.System_UInt32:
case SpecialType.System_Int64:
case SpecialType.System_UInt64:
case SpecialType.System_Decimal:
case SpecialType.System_Single:
case SpecialType.System_Double:
case SpecialType.System_DateTime:
return true;
default:
return t.IsNullableType();
}
}
public override BoundNode VisitIndexerAccess(BoundIndexerAccess node)
{
var method = GetReadMethod(node.Indexer);
VisitReceiverBeforeCall(node.ReceiverOpt, method);
VisitArguments(node.Arguments, node.ArgumentRefKindsOpt, method);
if ((object)method != null)
{
VisitReceiverAfterCall(node.ReceiverOpt, method);
}
return null;
}
public override BoundNode VisitIndexOrRangePatternIndexerAccess(BoundIndexOrRangePatternIndexerAccess node)
{
// Index or Range pattern indexers evaluate the following in order:
// 1. The receiver
// 1. The Count or Length method off the receiver
// 2. The argument to the access
// 3. The pattern method
VisitRvalue(node.Receiver);
var method = GetReadMethod(node.LengthOrCountProperty);
VisitReceiverAfterCall(node.Receiver, method);
VisitRvalue(node.Argument);
method = node.PatternSymbol switch
{
PropertySymbol p => GetReadMethod(p),
MethodSymbol m => m,
_ => throw ExceptionUtilities.UnexpectedValue(node.PatternSymbol)
};
VisitReceiverAfterCall(node.Receiver, method);
return null;
}
public override BoundNode VisitEventAssignmentOperator(BoundEventAssignmentOperator node)
{
VisitRvalue(node.ReceiverOpt);
VisitRvalue(node.Argument);
return null;
}
/// <summary>
/// Do not call for a local function.
/// </summary>
protected virtual void VisitArguments(ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> refKindsOpt, MethodSymbol method)
{
Debug.Assert(method?.OriginalDefinition.MethodKind != MethodKind.LocalFunction);
VisitArgumentsBeforeCall(arguments, refKindsOpt);
VisitArgumentsAfterCall(arguments, refKindsOpt, method);
}
private void VisitArgumentsBeforeCall(ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> refKindsOpt)
{
// first value and ref parameters are read...
for (int i = 0; i < arguments.Length; i++)
{
RefKind refKind = GetRefKind(refKindsOpt, i);
if (refKind != RefKind.Out)
{
VisitRvalue(arguments[i], isKnownToBeAnLvalue: refKind != RefKind.None);
}
else
{
VisitLvalue(arguments[i]);
}
}
}
/// <summary>
/// Writes ref and out parameters
/// </summary>
private void VisitArgumentsAfterCall(ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> refKindsOpt, MethodSymbol method)
{
for (int i = 0; i < arguments.Length; i++)
{
RefKind refKind = GetRefKind(refKindsOpt, i);
// passing as a byref argument is also a potential write
if (refKind != RefKind.None)
{
WriteArgument(arguments[i], refKind, method);
}
}
}
protected static RefKind GetRefKind(ImmutableArray<RefKind> refKindsOpt, int index)
{
return refKindsOpt.IsDefault || refKindsOpt.Length <= index ? RefKind.None : refKindsOpt[index];
}
protected virtual void WriteArgument(BoundExpression arg, RefKind refKind, MethodSymbol method)
{
}
public override BoundNode VisitBadExpression(BoundBadExpression node)
{
foreach (var child in node.ChildBoundNodes)
{
VisitRvalue(child as BoundExpression);
}
return null;
}
public override BoundNode VisitBadStatement(BoundBadStatement node)
{
foreach (var child in node.ChildBoundNodes)
{
if (child is BoundStatement)
{
VisitStatement(child as BoundStatement);
}
else
{
VisitRvalue(child as BoundExpression);
}
}
return null;
}
// Can be called as part of a bad expression.
public override BoundNode VisitArrayInitialization(BoundArrayInitialization node)
{
foreach (var child in node.Initializers)
{
VisitRvalue(child);
}
return null;
}
public override BoundNode VisitDelegateCreationExpression(BoundDelegateCreationExpression node)
{
var methodGroup = node.Argument as BoundMethodGroup;
if (methodGroup != null)
{
if ((object)node.MethodOpt != null && node.MethodOpt.RequiresInstanceReceiver)
{
EnterRegionIfNeeded(methodGroup);
VisitRvalue(methodGroup.ReceiverOpt);
LeaveRegionIfNeeded(methodGroup);
}
else if (node.MethodOpt?.OriginalDefinition is LocalFunctionSymbol localFunc)
{
VisitLocalFunctionUse(localFunc, node.Syntax, isCall: false);
}
}
else
{
VisitRvalue(node.Argument);
}
return null;
}
public override BoundNode VisitTypeExpression(BoundTypeExpression node)
{
return null;
}
public override BoundNode VisitTypeOrValueExpression(BoundTypeOrValueExpression node)
{
// If we're seeing a node of this kind, then we failed to resolve the member access
// as either a type or a property/field/event/local/parameter. In such cases,
// the second interpretation applies so just visit the node for that.
return this.Visit(node.Data.ValueExpression);
}
public override BoundNode VisitLiteral(BoundLiteral node)
{
SplitIfBooleanConstant(node);
return null;
}
protected void SplitIfBooleanConstant(BoundExpression node)
{
if (node.ConstantValue is { IsBoolean: true, BooleanValue: bool booleanValue })
{
var unreachable = UnreachableState();
Split();
if (booleanValue)
{
StateWhenFalse = unreachable;
}
else
{
StateWhenTrue = unreachable;
}
}
}
public override BoundNode VisitMethodDefIndex(BoundMethodDefIndex node)
{
return null;
}
public override BoundNode VisitMaximumMethodDefIndex(BoundMaximumMethodDefIndex node)
{
return null;
}
public override BoundNode VisitModuleVersionId(BoundModuleVersionId node)
{
return null;
}
public override BoundNode VisitModuleVersionIdString(BoundModuleVersionIdString node)
{
return null;
}
public override BoundNode VisitInstrumentationPayloadRoot(BoundInstrumentationPayloadRoot node)
{
return null;
}
public override BoundNode VisitSourceDocumentIndex(BoundSourceDocumentIndex node)
{
return null;
}
public override BoundNode VisitConversion(BoundConversion node)
{
if (node.ConversionKind == ConversionKind.MethodGroup)
{
if (node.IsExtensionMethod || ((object)node.SymbolOpt != null && node.SymbolOpt.RequiresInstanceReceiver))
{
BoundExpression receiver = ((BoundMethodGroup)node.Operand).ReceiverOpt;
// A method group's "implicit this" is only used for instance methods.
EnterRegionIfNeeded(node.Operand);
VisitRvalue(receiver);
LeaveRegionIfNeeded(node.Operand);
}
else if (node.SymbolOpt?.OriginalDefinition is LocalFunctionSymbol localFunc)
{
VisitLocalFunctionUse(localFunc, node.Syntax, isCall: false);
}
}
else
{
Visit(node.Operand);
}
return null;
}
public override BoundNode VisitIfStatement(BoundIfStatement node)
{
// 5.3.3.5 If statements
VisitCondition(node.Condition);
TLocalState trueState = StateWhenTrue;
TLocalState falseState = StateWhenFalse;
SetState(trueState);
VisitStatement(node.Consequence);
trueState = this.State;
SetState(falseState);
if (node.AlternativeOpt != null)
{
VisitStatement(node.AlternativeOpt);
}
Join(ref this.State, ref trueState);
return null;
}
public override BoundNode VisitTryStatement(BoundTryStatement node)
{
var oldPending = SavePending(); // we do not allow branches into a try statement
var initialState = this.State.Clone();
// use this state to resolve all the branches introduced and internal to try/catch
var pendingBeforeTry = SavePending();
VisitTryBlockWithAnyTransferFunction(node.TryBlock, node, ref initialState);
var finallyState = initialState.Clone();
var endState = this.State;
foreach (var catchBlock in node.CatchBlocks)
{
SetState(initialState.Clone());
VisitCatchBlockWithAnyTransferFunction(catchBlock, ref finallyState);
Join(ref endState, ref this.State);
}
// Give a chance to branches internal to try/catch to resolve.
// Carry forward unresolved branches.
RestorePending(pendingBeforeTry);
// NOTE: At this point all branches that are internal to try or catch blocks have been resolved.
// However we have not yet restored the oldPending branches. Therefore all the branches
// that are currently pending must have been introduced in try/catch and do not terminate inside those blocks.
//
// With exception of YieldReturn, these branches logically go through finally, if such present,
// so we must Union/Intersect finally state as appropriate
if (node.FinallyBlockOpt != null)
{
// branches from the finally block, while illegal, should still not be considered
// to execute the finally block before occurring. Also, we do not handle branches
// *into* the finally block.
SetState(finallyState);
// capture tryAndCatchPending before going into finally
// we will need pending branches as they were before finally later
var tryAndCatchPending = SavePending();
var stateMovedUpInFinally = ReachableBottomState();
VisitFinallyBlockWithAnyTransferFunction(node.FinallyBlockOpt, ref stateMovedUpInFinally);
foreach (var pend in tryAndCatchPending.PendingBranches)
{
if (pend.Branch == null)
{
continue; // a tracked exception
}
if (pend.Branch.Kind != BoundKind.YieldReturnStatement)
{
updatePendingBranchState(ref pend.State, ref stateMovedUpInFinally);
if (pend.IsConditionalState)
{
updatePendingBranchState(ref pend.StateWhenTrue, ref stateMovedUpInFinally);
updatePendingBranchState(ref pend.StateWhenFalse, ref stateMovedUpInFinally);
}
}
}
RestorePending(tryAndCatchPending);
Meet(ref endState, ref this.State);
if (_nonMonotonicTransfer)
{
Join(ref endState, ref stateMovedUpInFinally);
}
}
SetState(endState);
RestorePending(oldPending);
return null;
void updatePendingBranchState(ref TLocalState stateToUpdate, ref TLocalState stateMovedUpInFinally)
{
Meet(ref stateToUpdate, ref this.State);
if (_nonMonotonicTransfer)
{
Join(ref stateToUpdate, ref stateMovedUpInFinally);
}
}
}
protected Optional<TLocalState> NonMonotonicState;
/// <summary>
/// Join state from other try block, potentially in a nested method.
/// </summary>
protected virtual void JoinTryBlockState(ref TLocalState self, ref TLocalState other)
{
Join(ref self, ref other);
}
private void VisitTryBlockWithAnyTransferFunction(BoundStatement tryBlock, BoundTryStatement node, ref TLocalState tryState)
{
if (_nonMonotonicTransfer)
{
Optional<TLocalState> oldTryState = NonMonotonicState;
NonMonotonicState = ReachableBottomState();
VisitTryBlock(tryBlock, node, ref tryState);
var tempTryStateValue = NonMonotonicState.Value;
Join(ref tryState, ref tempTryStateValue);
if (oldTryState.HasValue)
{
var oldTryStateValue = oldTryState.Value;
JoinTryBlockState(ref oldTryStateValue, ref tempTryStateValue);
oldTryState = oldTryStateValue;
}
NonMonotonicState = oldTryState;
}
else
{
VisitTryBlock(tryBlock, node, ref tryState);
}
}
protected virtual void VisitTryBlock(BoundStatement tryBlock, BoundTryStatement node, ref TLocalState tryState)
{
VisitStatement(tryBlock);
}
private void VisitCatchBlockWithAnyTransferFunction(BoundCatchBlock catchBlock, ref TLocalState finallyState)
{
if (_nonMonotonicTransfer)
{
Optional<TLocalState> oldTryState = NonMonotonicState;
NonMonotonicState = ReachableBottomState();
VisitCatchBlock(catchBlock, ref finallyState);
var tempTryStateValue = NonMonotonicState.Value;
Join(ref finallyState, ref tempTryStateValue);
if (oldTryState.HasValue)
{
var oldTryStateValue = oldTryState.Value;
JoinTryBlockState(ref oldTryStateValue, ref tempTryStateValue);
oldTryState = oldTryStateValue;
}
NonMonotonicState = oldTryState;
}
else
{
VisitCatchBlock(catchBlock, ref finallyState);
}
}
protected virtual void VisitCatchBlock(BoundCatchBlock catchBlock, ref TLocalState finallyState)
{
if (catchBlock.ExceptionSourceOpt != null)
{
VisitLvalue(catchBlock.ExceptionSourceOpt);
}
if (catchBlock.ExceptionFilterPrologueOpt is { })
{
VisitStatementList(catchBlock.ExceptionFilterPrologueOpt);
}
if (catchBlock.ExceptionFilterOpt != null)
{
VisitCondition(catchBlock.ExceptionFilterOpt);
SetState(StateWhenTrue);
}
VisitStatement(catchBlock.Body);
}
private void VisitFinallyBlockWithAnyTransferFunction(BoundStatement finallyBlock, ref TLocalState stateMovedUp)
{
if (_nonMonotonicTransfer)
{
Optional<TLocalState> oldTryState = NonMonotonicState;
NonMonotonicState = ReachableBottomState();
VisitFinallyBlock(finallyBlock, ref stateMovedUp);
var tempTryStateValue = NonMonotonicState.Value;
Join(ref stateMovedUp, ref tempTryStateValue);
if (oldTryState.HasValue)
{
var oldTryStateValue = oldTryState.Value;
JoinTryBlockState(ref oldTryStateValue, ref tempTryStateValue);
oldTryState = oldTryStateValue;
}
NonMonotonicState = oldTryState;
}
else
{
VisitFinallyBlock(finallyBlock, ref stateMovedUp);
}
}
protected virtual void VisitFinallyBlock(BoundStatement finallyBlock, ref TLocalState stateMovedUp)
{
VisitStatement(finallyBlock); // this should generate no pending branches
}
public override BoundNode VisitExtractedFinallyBlock(BoundExtractedFinallyBlock node)
{
return VisitBlock(node.FinallyBlock);
}
public override BoundNode VisitReturnStatement(BoundReturnStatement node)
{
var result = VisitReturnStatementNoAdjust(node);
PendingBranches.Add(new PendingBranch(node, this.State, label: null));
SetUnreachable();
return result;
}
protected virtual BoundNode VisitReturnStatementNoAdjust(BoundReturnStatement node)
{
VisitRvalue(node.ExpressionOpt, isKnownToBeAnLvalue: node.RefKind != RefKind.None);
// byref return is also a potential write
if (node.RefKind != RefKind.None)
{
WriteArgument(node.ExpressionOpt, node.RefKind, method: null);
}
return null;
}
public override BoundNode VisitThisReference(BoundThisReference node)
{
return null;
}
public override BoundNode VisitPreviousSubmissionReference(BoundPreviousSubmissionReference node)
{
return null;
}
public override BoundNode VisitHostObjectMemberReference(BoundHostObjectMemberReference node)
{
return null;
}
public override BoundNode VisitParameter(BoundParameter node)
{
return null;
}
protected virtual void VisitLvalueParameter(BoundParameter node)
{
}
public override BoundNode VisitObjectCreationExpression(BoundObjectCreationExpression node)
{
VisitArguments(node.Arguments, node.ArgumentRefKindsOpt, node.Constructor);
VisitRvalue(node.InitializerExpressionOpt);
return null;
}
public override BoundNode VisitNewT(BoundNewT node)
{
VisitRvalue(node.InitializerExpressionOpt);
return null;
}
public override BoundNode VisitNoPiaObjectCreationExpression(BoundNoPiaObjectCreationExpression node)
{
VisitRvalue(node.InitializerExpressionOpt);
return null;
}
// represents anything that occurs at the invocation of the property setter
protected virtual void PropertySetter(BoundExpression node, BoundExpression receiver, MethodSymbol setter, BoundExpression value = null)
{
VisitReceiverAfterCall(receiver, setter);
}
// returns false if expression is not a property access
// or if the property has a backing field
// and accessed in a corresponding constructor
private bool RegularPropertyAccess(BoundExpression expr)
{
if (expr.Kind != BoundKind.PropertyAccess)
{
return false;
}
return !Binder.AccessingAutoPropertyFromConstructor((BoundPropertyAccess)expr, _symbol);
}
public override BoundNode VisitAssignmentOperator(BoundAssignmentOperator node)
{
// TODO: should events be handled specially too?
if (RegularPropertyAccess(node.Left))
{
var left = (BoundPropertyAccess)node.Left;
var property = left.PropertySymbol;
if (property.RefKind == RefKind.None)
{
var method = GetWriteMethod(property);
VisitReceiverBeforeCall(left.ReceiverOpt, method);
VisitRvalue(node.Right);
PropertySetter(node, left.ReceiverOpt, method, node.Right);
return null;
}
}
VisitLvalue(node.Left);
VisitRvalue(node.Right, isKnownToBeAnLvalue: node.IsRef);
// byref assignment is also a potential write
if (node.IsRef)
{
// Assume that BadExpression is a ref location to avoid
// cascading diagnostics
var refKind = node.Left.Kind == BoundKind.BadExpression
? RefKind.Ref
: node.Left.GetRefKind();
WriteArgument(node.Right, refKind, method: null);
}
return null;
}
public override BoundNode VisitDeconstructionAssignmentOperator(BoundDeconstructionAssignmentOperator node)
{
VisitLvalue(node.Left);
VisitRvalue(node.Right);
return null;
}
public sealed override BoundNode VisitOutDeconstructVarPendingInference(OutDeconstructVarPendingInference node)
{
// OutDeconstructVarPendingInference nodes are only used within initial binding, but don't survive past that stage
throw ExceptionUtilities.Unreachable;
}
public override BoundNode VisitCompoundAssignmentOperator(BoundCompoundAssignmentOperator node)
{
VisitCompoundAssignmentTarget(node);
VisitRvalue(node.Right);
AfterRightHasBeenVisited(node);
return null;
}
protected void VisitCompoundAssignmentTarget(BoundCompoundAssignmentOperator node)
{
// TODO: should events be handled specially too?
if (RegularPropertyAccess(node.Left))
{
var left = (BoundPropertyAccess)node.Left;
var property = left.PropertySymbol;
if (property.RefKind == RefKind.None)
{
var readMethod = GetReadMethod(property);
Debug.Assert(node.HasAnyErrors || (object)readMethod != (object)GetWriteMethod(property));
VisitReceiverBeforeCall(left.ReceiverOpt, readMethod);
VisitReceiverAfterCall(left.ReceiverOpt, readMethod);
return;
}
}
VisitRvalue(node.Left, isKnownToBeAnLvalue: true);
}
protected void AfterRightHasBeenVisited(BoundCompoundAssignmentOperator node)
{
if (RegularPropertyAccess(node.Left))
{
var left = (BoundPropertyAccess)node.Left;
var property = left.PropertySymbol;
if (property.RefKind == RefKind.None)
{
var writeMethod = GetWriteMethod(property);
PropertySetter(node, left.ReceiverOpt, writeMethod);
VisitReceiverAfterCall(left.ReceiverOpt, writeMethod);
return;
}
}
}
public override BoundNode VisitFieldAccess(BoundFieldAccess node)
{
VisitFieldAccessInternal(node.ReceiverOpt, node.FieldSymbol);
SplitIfBooleanConstant(node);
return null;
}
private void VisitFieldAccessInternal(BoundExpression receiverOpt, FieldSymbol fieldSymbol)
{
bool asLvalue = (object)fieldSymbol != null &&
(fieldSymbol.IsFixedSizeBuffer ||
!fieldSymbol.IsStatic &&
fieldSymbol.ContainingType.TypeKind == TypeKind.Struct &&
receiverOpt != null &&
receiverOpt.Kind != BoundKind.TypeExpression &&
(object)receiverOpt.Type != null &&
!receiverOpt.Type.IsPrimitiveRecursiveStruct());
if (asLvalue)
{
VisitLvalue(receiverOpt);
}
else
{
VisitRvalue(receiverOpt);
}
}
public override BoundNode VisitFieldInfo(BoundFieldInfo node)
{
return null;
}
public override BoundNode VisitMethodInfo(BoundMethodInfo node)
{
return null;
}
public override BoundNode VisitPropertyAccess(BoundPropertyAccess node)
{
var property = node.PropertySymbol;
if (Binder.AccessingAutoPropertyFromConstructor(node, _symbol))
{
var backingField = (property as SourcePropertySymbolBase)?.BackingField;
if (backingField != null)
{
VisitFieldAccessInternal(node.ReceiverOpt, backingField);
return null;
}
}
var method = GetReadMethod(property);
VisitReceiverBeforeCall(node.ReceiverOpt, method);
VisitReceiverAfterCall(node.ReceiverOpt, method);
return null;
// TODO: In an expression such as
// M().Prop = G();
// Exceptions thrown from M() occur before those from G(), but exceptions from the property accessor
// occur after both. The precise abstract flow pass does not yet currently have this quite right.
// Probably what is needed is a VisitPropertyAccessInternal(BoundPropertyAccess node, bool read)
// which should assume that the receiver will have been handled by the caller. This can be invoked
// twice for read/write operations such as
// M().Prop += 1
// or at the appropriate place in the sequence for read or write operations.
// Do events require any special handling too?
}
public override BoundNode VisitEventAccess(BoundEventAccess node)
{
VisitFieldAccessInternal(node.ReceiverOpt, node.EventSymbol.AssociatedField);
return null;
}
public override BoundNode VisitRangeVariable(BoundRangeVariable node)
{
return null;
}
public override BoundNode VisitQueryClause(BoundQueryClause node)
{
VisitRvalue(node.UnoptimizedForm ?? node.Value);
return null;
}
private BoundNode VisitMultipleLocalDeclarationsBase(BoundMultipleLocalDeclarationsBase node)
{
foreach (var v in node.LocalDeclarations)
{
Visit(v);
}
return null;
}
public override BoundNode VisitMultipleLocalDeclarations(BoundMultipleLocalDeclarations node)
{
return VisitMultipleLocalDeclarationsBase(node);
}
public override BoundNode VisitUsingLocalDeclarations(BoundUsingLocalDeclarations node)
{
if (AwaitUsingAndForeachAddsPendingBranch && node.AwaitOpt != null)
{
PendingBranches.Add(new PendingBranch(node, this.State, null));
}
return VisitMultipleLocalDeclarationsBase(node);
}
public override BoundNode VisitWhileStatement(BoundWhileStatement node)
{
// while (node.Condition) { node.Body; node.ContinueLabel: } node.BreakLabel:
LoopHead(node);
VisitCondition(node.Condition);
TLocalState bodyState = StateWhenTrue;
TLocalState breakState = StateWhenFalse;
SetState(bodyState);
VisitStatement(node.Body);
ResolveContinues(node.ContinueLabel);
LoopTail(node);
ResolveBreaks(breakState, node.BreakLabel);
return null;
}
public override BoundNode VisitWithExpression(BoundWithExpression node)
{
VisitRvalue(node.Receiver);
VisitObjectOrCollectionInitializerExpression(node.InitializerExpression.Initializers);
return null;
}
public override BoundNode VisitArrayAccess(BoundArrayAccess node)
{
VisitRvalue(node.Expression);
foreach (var i in node.Indices)
{
VisitRvalue(i);
}
return null;
}
public override BoundNode VisitBinaryOperator(BoundBinaryOperator node)
{
if (node.OperatorKind.IsLogical())
{
Debug.Assert(!node.OperatorKind.IsUserDefined());
VisitBinaryLogicalOperatorChildren(node);
}
else if (node.InterpolatedStringHandlerData is { } data)
{
VisitBinaryInterpolatedStringAddition(node);
}
else
{
VisitBinaryOperatorChildren(node);
}
return null;
}
public override BoundNode VisitUserDefinedConditionalLogicalOperator(BoundUserDefinedConditionalLogicalOperator node)
{
VisitBinaryLogicalOperatorChildren(node);
return null;
}
private void VisitBinaryLogicalOperatorChildren(BoundExpression node)
{
// Do not blow the stack due to a deep recursion on the left.
var stack = ArrayBuilder<BoundExpression>.GetInstance();
BoundExpression binary;
BoundExpression child = node;
while (true)
{
var childKind = child.Kind;
if (childKind == BoundKind.BinaryOperator)
{
var binOp = (BoundBinaryOperator)child;
if (!binOp.OperatorKind.IsLogical())
{
break;
}
Debug.Assert(!binOp.OperatorKind.IsUserDefined());
binary = child;
child = binOp.Left;
}
else if (childKind == BoundKind.UserDefinedConditionalLogicalOperator)
{
binary = child;
child = ((BoundUserDefinedConditionalLogicalOperator)binary).Left;
}
else
{
break;
}
stack.Push(binary);
}
Debug.Assert(stack.Count > 0);
VisitCondition(child);
while (true)
{
binary = stack.Pop();
BinaryOperatorKind kind;
BoundExpression right;
switch (binary.Kind)
{
case BoundKind.BinaryOperator:
var binOp = (BoundBinaryOperator)binary;
kind = binOp.OperatorKind;
right = binOp.Right;
break;
case BoundKind.UserDefinedConditionalLogicalOperator:
var udBinOp = (BoundUserDefinedConditionalLogicalOperator)binary;
kind = udBinOp.OperatorKind;
right = udBinOp.Right;
break;
default:
throw ExceptionUtilities.UnexpectedValue(binary.Kind);
}
var op = kind.Operator();
var isAnd = op == BinaryOperatorKind.And;
var isBool = kind.OperandTypes() == BinaryOperatorKind.Bool;
Debug.Assert(isAnd || op == BinaryOperatorKind.Or);
var leftTrue = this.StateWhenTrue;
var leftFalse = this.StateWhenFalse;
SetState(isAnd ? leftTrue : leftFalse);
AfterLeftChildOfBinaryLogicalOperatorHasBeenVisited(binary, right, isAnd, isBool, ref leftTrue, ref leftFalse);
if (stack.Count == 0)
{
break;
}
AdjustConditionalState(binary);
}
Debug.Assert((object)binary == node);
stack.Free();
}
protected virtual void AfterLeftChildOfBinaryLogicalOperatorHasBeenVisited(BoundExpression binary, BoundExpression right, bool isAnd, bool isBool, ref TLocalState leftTrue, ref TLocalState leftFalse)
{
Visit(right); // First part of VisitCondition
AfterRightChildOfBinaryLogicalOperatorHasBeenVisited(binary, right, isAnd, isBool, ref leftTrue, ref leftFalse);
}
protected void AfterRightChildOfBinaryLogicalOperatorHasBeenVisited(BoundExpression binary, BoundExpression right, bool isAnd, bool isBool, ref TLocalState leftTrue, ref TLocalState leftFalse)
{
AdjustConditionalState(right); // Second part of VisitCondition
if (!isBool)
{
this.Unsplit();
this.Split();
}
var resultTrue = this.StateWhenTrue;
var resultFalse = this.StateWhenFalse;
if (isAnd)
{
Join(ref resultFalse, ref leftFalse);
}
else
{
Join(ref resultTrue, ref leftTrue);
}
SetConditionalState(resultTrue, resultFalse);
if (!isBool)
{
this.Unsplit();
}
}
private void VisitBinaryOperatorChildren(BoundBinaryOperator node)
{
// It is common in machine-generated code for there to be deep recursion on the left side of a binary
// operator, for example, if you have "a + b + c + ... " then the bound tree will be deep on the left
// hand side. To mitigate the risk of stack overflow we use an explicit stack.
//
// Of course we must ensure that we visit the left hand side before the right hand side.
var stack = ArrayBuilder<BoundBinaryOperator>.GetInstance();
BoundBinaryOperator binary = node;
do
{
stack.Push(binary);
binary = binary.Left as BoundBinaryOperator;
}
while (binary != null && !binary.OperatorKind.IsLogical() && binary.InterpolatedStringHandlerData is null);
VisitBinaryOperatorChildren(stack);
stack.Free();
}
#nullable enable
protected virtual void VisitBinaryOperatorChildren(ArrayBuilder<BoundBinaryOperator> stack)
{
var binary = stack.Pop();
// Only the leftmost operator of a left-associative binary operator chain can learn from a conditional access on the left
// For simplicity, we just special case it here.
// For example, `a?.b(out x) == true` has a conditional access on the left of the operator,
// but `expr == a?.b(out x) == true` has a conditional access on the right of the operator
if (VisitPossibleConditionalAccess(binary.Left, out var stateWhenNotNull)
&& canLearnFromOperator(binary)
&& isKnownNullOrNotNull(binary.Right))
{
if (_nonMonotonicTransfer)
{
// In this very specific scenario, we need to do extra work to track unassignments for region analysis.
// See `AbstractFlowPass.VisitCatchBlockWithAnyTransferFunction` for a similar scenario in catch blocks.
Optional<TLocalState> oldState = NonMonotonicState;
NonMonotonicState = ReachableBottomState();
VisitRvalue(binary.Right);
var tempStateValue = NonMonotonicState.Value;
Join(ref stateWhenNotNull, ref tempStateValue);
if (oldState.HasValue)
{
var oldStateValue = oldState.Value;
Join(ref oldStateValue, ref tempStateValue);
oldState = oldStateValue;
}
NonMonotonicState = oldState;
}
else
{
VisitRvalue(binary.Right);
Meet(ref stateWhenNotNull, ref State);
}
var isNullConstant = binary.Right.ConstantValue?.IsNull == true;
SetConditionalState(isNullConstant == isEquals(binary)
? (State, stateWhenNotNull)
: (stateWhenNotNull, State));
if (stack.Count == 0)
{
return;
}
binary = stack.Pop();
}
while (true)
{
if (!canLearnFromOperator(binary)
|| !learnFromOperator(binary))
{
Unsplit();
Visit(binary.Right);
}
if (stack.Count == 0)
{
break;
}
binary = stack.Pop();
}
static bool canLearnFromOperator(BoundBinaryOperator binary)
{
var kind = binary.OperatorKind;
return kind.Operator() is BinaryOperatorKind.Equal or BinaryOperatorKind.NotEqual
&& (!kind.IsUserDefined() || kind.IsLifted());
}
static bool isKnownNullOrNotNull(BoundExpression expr)
{
return expr.ConstantValue is object
|| (expr is BoundConversion { ConversionKind: ConversionKind.ExplicitNullable or ConversionKind.ImplicitNullable } conv
&& conv.Operand.Type!.IsNonNullableValueType());
}
static bool isEquals(BoundBinaryOperator binary)
=> binary.OperatorKind.Operator() == BinaryOperatorKind.Equal;
// Returns true if `binary.Right` was visited by the call.
bool learnFromOperator(BoundBinaryOperator binary)
{
// `true == a?.b(out x)`
if (isKnownNullOrNotNull(binary.Left) && TryVisitConditionalAccess(binary.Right, out var stateWhenNotNull))
{
var isNullConstant = binary.Left.ConstantValue?.IsNull == true;
SetConditionalState(isNullConstant == isEquals(binary)
? (State, stateWhenNotNull)
: (stateWhenNotNull, State));
return true;
}
// `a && b(out x) == true`
else if (IsConditionalState && binary.Right.ConstantValue is { IsBoolean: true } rightConstant)
{
var (stateWhenTrue, stateWhenFalse) = (StateWhenTrue.Clone(), StateWhenFalse.Clone());
Unsplit();
Visit(binary.Right);
SetConditionalState(isEquals(binary) == rightConstant.BooleanValue
? (stateWhenTrue, stateWhenFalse)
: (stateWhenFalse, stateWhenTrue));
return true;
}
// `true == a && b(out x)`
else if (binary.Left.ConstantValue is { IsBoolean: true } leftConstant)
{
Unsplit();
Visit(binary.Right);
if (IsConditionalState && isEquals(binary) != leftConstant.BooleanValue)
{
SetConditionalState(StateWhenFalse, StateWhenTrue);
}
return true;
}
return false;
}
}
protected void VisitBinaryInterpolatedStringAddition(BoundBinaryOperator node)
{
Debug.Assert(node.InterpolatedStringHandlerData.HasValue);
var stack = ArrayBuilder<BoundInterpolatedString>.GetInstance();
var data = node.InterpolatedStringHandlerData.GetValueOrDefault();
while (PushBinaryOperatorInterpolatedStringChildren(node, stack) is { } next)
{
node = next;
}
Debug.Assert(stack.Count >= 2);
VisitRvalue(data.Construction);
bool visitedFirst = false;
bool hasTrailingHandlerValidityParameter = data.HasTrailingHandlerValidityParameter;
bool hasConditionalEvaluation = data.UsesBoolReturns || hasTrailingHandlerValidityParameter;
TLocalState? shortCircuitState = hasConditionalEvaluation ? State.Clone() : default;
while (stack.TryPop(out var currentString))
{
visitedFirst |= VisitInterpolatedStringHandlerParts(currentString, data.UsesBoolReturns, firstPartIsConditional: visitedFirst || hasTrailingHandlerValidityParameter, ref shortCircuitState);
}
if (hasConditionalEvaluation)
{
Join(ref State, ref shortCircuitState);
}
stack.Free();
}
protected virtual BoundBinaryOperator? PushBinaryOperatorInterpolatedStringChildren(BoundBinaryOperator node, ArrayBuilder<BoundInterpolatedString> stack)
{
stack.Push((BoundInterpolatedString)node.Right);
switch (node.Left)
{
case BoundBinaryOperator next:
return next;
case BoundInterpolatedString @string:
stack.Push(@string);
return null;
default:
throw ExceptionUtilities.UnexpectedValue(node.Left.Kind);
}
}
protected virtual bool VisitInterpolatedStringHandlerParts(BoundInterpolatedStringBase node, bool usesBoolReturns, bool firstPartIsConditional, ref TLocalState? shortCircuitState)
{
Debug.Assert(shortCircuitState != null || (!usesBoolReturns && !firstPartIsConditional));
if (node.Parts.IsEmpty)
{
return false;
}
ReadOnlySpan<BoundExpression> parts;
if (firstPartIsConditional)
{
parts = node.Parts.AsSpan();
}
else
{
VisitRvalue(node.Parts[0]);
shortCircuitState = State.Clone();
parts = node.Parts.AsSpan()[1..];
}
foreach (var part in parts)
{
VisitRvalue(part);
if (usesBoolReturns)
{
Debug.Assert(shortCircuitState != null);
Join(ref shortCircuitState, ref State);
}
}
return true;
}
#nullable disable
public override BoundNode VisitUnaryOperator(BoundUnaryOperator node)
{
if (node.OperatorKind == UnaryOperatorKind.BoolLogicalNegation)
{
// We have a special case for the ! unary operator, which can operate in a boolean context (5.3.3.26)
VisitCondition(node.Operand);
// it inverts the sense of assignedWhenTrue and assignedWhenFalse.
SetConditionalState(StateWhenFalse, StateWhenTrue);
}
else
{
VisitRvalue(node.Operand);
}
return null;
}
public override BoundNode VisitRangeExpression(BoundRangeExpression node)
{
if (node.LeftOperandOpt != null)
{
VisitRvalue(node.LeftOperandOpt);
}
if (node.RightOperandOpt != null)
{
VisitRvalue(node.RightOperandOpt);
}
return null;
}
public override BoundNode VisitFromEndIndexExpression(BoundFromEndIndexExpression node)
{
VisitRvalue(node.Operand);
return null;
}
public override BoundNode VisitAwaitExpression(BoundAwaitExpression node)
{
VisitRvalue(node.Expression);
PendingBranches.Add(new PendingBranch(node, this.State, null));
return null;
}
public override BoundNode VisitIncrementOperator(BoundIncrementOperator node)
{
// TODO: should we also specially handle events?
if (RegularPropertyAccess(node.Operand))
{
var left = (BoundPropertyAccess)node.Operand;
var property = left.PropertySymbol;
if (property.RefKind == RefKind.None)
{
var readMethod = GetReadMethod(property);
var writeMethod = GetWriteMethod(property);
Debug.Assert(node.HasAnyErrors || (object)readMethod != (object)writeMethod);
VisitReceiverBeforeCall(left.ReceiverOpt, readMethod);
VisitReceiverAfterCall(left.ReceiverOpt, readMethod);
PropertySetter(node, left.ReceiverOpt, writeMethod); // followed by a write
return null;
}
}
VisitRvalue(node.Operand);
return null;
}
public override BoundNode VisitArrayCreation(BoundArrayCreation node)
{
foreach (var expr in node.Bounds)
{
VisitRvalue(expr);
}
if (node.InitializerOpt != null)
{
VisitArrayInitializationInternal(node, node.InitializerOpt);
}
return null;
}
private void VisitArrayInitializationInternal(BoundArrayCreation arrayCreation, BoundArrayInitialization node)
{
foreach (var child in node.Initializers)
{
if (child.Kind == BoundKind.ArrayInitialization)
{
VisitArrayInitializationInternal(arrayCreation, (BoundArrayInitialization)child);
}
else
{
VisitRvalue(child);
}
}
}
public override BoundNode VisitForStatement(BoundForStatement node)
{
if (node.Initializer != null)
{
VisitStatement(node.Initializer);
}
LoopHead(node);
TLocalState bodyState, breakState;
if (node.Condition != null)
{
VisitCondition(node.Condition);
bodyState = this.StateWhenTrue;
breakState = this.StateWhenFalse;
}
else
{
bodyState = this.State;
breakState = UnreachableState();
}
SetState(bodyState);
VisitStatement(node.Body);
ResolveContinues(node.ContinueLabel);
if (node.Increment != null)
{
VisitStatement(node.Increment);
}
LoopTail(node);
ResolveBreaks(breakState, node.BreakLabel);
return null;
}
public override BoundNode VisitForEachStatement(BoundForEachStatement node)
{
// foreach [await] ( var v in node.Expression ) { node.Body; node.ContinueLabel: } node.BreakLabel:
VisitForEachExpression(node);
var breakState = this.State.Clone();
LoopHead(node);
VisitForEachIterationVariables(node);
VisitStatement(node.Body);
ResolveContinues(node.ContinueLabel);
LoopTail(node);
ResolveBreaks(breakState, node.BreakLabel);
if (AwaitUsingAndForeachAddsPendingBranch && ((CommonForEachStatementSyntax)node.Syntax).AwaitKeyword != default)
{
PendingBranches.Add(new PendingBranch(node, this.State, null));
}
return null;
}
protected virtual void VisitForEachExpression(BoundForEachStatement node)
{
VisitRvalue(node.Expression);
}
public virtual void VisitForEachIterationVariables(BoundForEachStatement node)
{
}
public override BoundNode VisitAsOperator(BoundAsOperator node)
{
VisitRvalue(node.Operand);
return null;
}
public override BoundNode VisitIsOperator(BoundIsOperator node)
{
if (VisitPossibleConditionalAccess(node.Operand, out var stateWhenNotNull))
{
Debug.Assert(!IsConditionalState);
SetConditionalState(stateWhenNotNull, State);
}
else
{
// `(a && b.M(out x)) is bool` should discard conditional state from LHS
Unsplit();
}
return null;
}
public override BoundNode VisitMethodGroup(BoundMethodGroup node)
{
if (node.ReceiverOpt != null)
{
// An explicit or implicit receiver, for example in an expression such as (x.Goo is Action, or Goo is Action), is considered to be read.
VisitRvalue(node.ReceiverOpt);
}
return null;
}
#nullable enable
public override BoundNode? VisitNullCoalescingOperator(BoundNullCoalescingOperator node)
{
if (IsConstantNull(node.LeftOperand))
{
VisitRvalue(node.LeftOperand);
Visit(node.RightOperand);
}
else
{
TLocalState savedState;
if (VisitPossibleConditionalAccess(node.LeftOperand, out var stateWhenNotNull))
{
Debug.Assert(!IsConditionalState);
savedState = stateWhenNotNull;
}
else
{
Unsplit();
savedState = State.Clone();
}
if (node.LeftOperand.ConstantValue != null)
{
SetUnreachable();
}
Visit(node.RightOperand);
if (IsConditionalState)
{
Join(ref StateWhenTrue, ref savedState);
Join(ref StateWhenFalse, ref savedState);
}
else
{
Join(ref this.State, ref savedState);
}
}
return null;
}
/// <summary>
/// Visits a node only if it is a conditional access.
/// Returns 'true' if and only if the node was visited.
/// </summary>
private bool TryVisitConditionalAccess(BoundExpression node, [NotNullWhen(true)] out TLocalState? stateWhenNotNull)
{
var access = node switch
{
BoundConditionalAccess ca => ca,
BoundConversion { Conversion: Conversion conversion, Operand: BoundConditionalAccess ca } when CanPropagateStateWhenNotNull(conversion) => ca,
_ => null
};
if (access is not null)
{
EnterRegionIfNeeded(access);
Unsplit();
VisitConditionalAccess(access, out stateWhenNotNull);
Debug.Assert(!IsConditionalState);
LeaveRegionIfNeeded(access);
return true;
}
stateWhenNotNull = default;
return false;
}
/// <summary>
/// "State when not null" can only propagate out of a conditional access if
/// it is not subject to a user-defined conversion whose parameter is not of a non-nullable value type.
/// </summary>
protected static bool CanPropagateStateWhenNotNull(Conversion conversion)
{
if (!conversion.IsValid)
{
return false;
}
if (!conversion.IsUserDefined)
{
return true;
}
var method = conversion.Method;
Debug.Assert(method is object);
Debug.Assert(method.ParameterCount is 1);
var param = method.Parameters[0];
return param.Type.IsNonNullableValueType();
}
/// <summary>
/// Unconditionally visits an expression.
/// If the expression has "state when not null" after visiting,
/// the method returns 'true' and writes the state to <paramref name="stateWhenNotNull" />.
/// </summary>
private bool VisitPossibleConditionalAccess(BoundExpression node, [NotNullWhen(true)] out TLocalState? stateWhenNotNull)
{
if (TryVisitConditionalAccess(node, out stateWhenNotNull))
{
return true;
}
else
{
Visit(node);
return false;
}
}
private void VisitConditionalAccess(BoundConditionalAccess node, out TLocalState stateWhenNotNull)
{
// The receiver may also be a conditional access.
// `(a?.b(x = 1))?.c(y = 1)`
if (VisitPossibleConditionalAccess(node.Receiver, out var receiverStateWhenNotNull))
{
stateWhenNotNull = receiverStateWhenNotNull;
}
else
{
Unsplit();
stateWhenNotNull = this.State.Clone();
}
if (node.Receiver.ConstantValue != null && !IsConstantNull(node.Receiver))
{
// Consider a scenario like `"a"?.M0(x = 1)?.M0(y = 1)`.
// We can "know" that `.M0(x = 1)` was evaluated unconditionally but not `M0(y = 1)`.
// Therefore we do a VisitPossibleConditionalAccess here which unconditionally includes the "after receiver" state in State
// and includes the "after subsequent conditional accesses" in stateWhenNotNull
if (VisitPossibleConditionalAccess(node.AccessExpression, out var firstAccessStateWhenNotNull))
{
stateWhenNotNull = firstAccessStateWhenNotNull;
}
else
{
Unsplit();
stateWhenNotNull = this.State.Clone();
}
}
else
{
var savedState = this.State.Clone();
if (IsConstantNull(node.Receiver))
{
SetUnreachable();
}
else
{
SetState(stateWhenNotNull);
}
// We want to preserve stateWhenNotNull from accesses in the same "chain":
// a?.b(out x)?.c(out y); // expected to preserve stateWhenNotNull from both ?.b(out x) and ?.c(out y)
// but not accesses in nested expressions:
// a?.b(out x, c?.d(out y)); // expected to preserve stateWhenNotNull from a?.b(out x, ...) but not from c?.d(out y)
BoundExpression expr = node.AccessExpression;
while (expr is BoundConditionalAccess innerCondAccess)
{
Debug.Assert(innerCondAccess.Receiver is not (BoundConditionalAccess or BoundConversion));
// we assume that non-conditional accesses can never contain conditional accesses from the same "chain".
// that is, we never have to dig through non-conditional accesses to find and handle conditional accesses.
VisitRvalue(innerCondAccess.Receiver);
expr = innerCondAccess.AccessExpression;
// The savedState here represents the scenario where 0 or more of the access expressions could have been evaluated.
// e.g. after visiting `a?.b(x = null)?.c(x = new object())`, the "state when not null" of `x` is NotNull, but the "state when maybe null" of `x` is MaybeNull.
Join(ref savedState, ref State);
}
Debug.Assert(expr is BoundExpression);
VisitRvalue(expr);
stateWhenNotNull = State;
State = savedState;
Join(ref State, ref stateWhenNotNull);
}
}
public override BoundNode? VisitConditionalAccess(BoundConditionalAccess node)
{
VisitConditionalAccess(node, stateWhenNotNull: out _);
return null;
}
#nullable disable
public override BoundNode VisitLoweredConditionalAccess(BoundLoweredConditionalAccess node)
{
VisitRvalue(node.Receiver);
var savedState = this.State.Clone();
VisitRvalue(node.WhenNotNull);
Join(ref this.State, ref savedState);
if (node.WhenNullOpt != null)
{
savedState = this.State.Clone();
VisitRvalue(node.WhenNullOpt);
Join(ref this.State, ref savedState);
}
return null;
}
public override BoundNode VisitConditionalReceiver(BoundConditionalReceiver node)
{
return null;
}
public override BoundNode VisitComplexConditionalReceiver(BoundComplexConditionalReceiver node)
{
var savedState = this.State.Clone();
VisitRvalue(node.ValueTypeReceiver);
Join(ref this.State, ref savedState);
savedState = this.State.Clone();
VisitRvalue(node.ReferenceTypeReceiver);
Join(ref this.State, ref savedState);
return null;
}
public override BoundNode VisitSequence(BoundSequence node)
{
var sideEffects = node.SideEffects;
if (!sideEffects.IsEmpty)
{
foreach (var se in sideEffects)
{
VisitRvalue(se);
}
}
VisitRvalue(node.Value);
return null;
}
public override BoundNode VisitSequencePoint(BoundSequencePoint node)
{
if (node.StatementOpt != null)
{
VisitStatement(node.StatementOpt);
}
return null;
}
public override BoundNode VisitSequencePointExpression(BoundSequencePointExpression node)
{
VisitRvalue(node.Expression);
return null;
}
public override BoundNode VisitSequencePointWithSpan(BoundSequencePointWithSpan node)
{
if (node.StatementOpt != null)
{
VisitStatement(node.StatementOpt);
}
return null;
}
public override BoundNode VisitStatementList(BoundStatementList node)
{
return VisitStatementListWorker(node);
}
private BoundNode VisitStatementListWorker(BoundStatementList node)
{
foreach (var statement in node.Statements)
{
VisitStatement(statement);
}
return null;
}
public override BoundNode VisitTypeOrInstanceInitializers(BoundTypeOrInstanceInitializers node)
{
return VisitStatementListWorker(node);
}
public override BoundNode VisitUnboundLambda(UnboundLambda node)
{
// The presence of this node suggests an error was detected in an earlier phase.
return VisitLambda(node.BindForErrorRecovery());
}
public override BoundNode VisitBreakStatement(BoundBreakStatement node)
{
Debug.Assert(!this.IsConditionalState);
PendingBranches.Add(new PendingBranch(node, this.State, node.Label));
SetUnreachable();
return null;
}
public override BoundNode VisitContinueStatement(BoundContinueStatement node)
{
Debug.Assert(!this.IsConditionalState);
PendingBranches.Add(new PendingBranch(node, this.State, node.Label));
SetUnreachable();
return null;
}
public override BoundNode VisitUnconvertedConditionalOperator(BoundUnconvertedConditionalOperator node)
{
return VisitConditionalOperatorCore(node, isByRef: false, node.Condition, node.Consequence, node.Alternative);
}
public override BoundNode VisitConditionalOperator(BoundConditionalOperator node)
{
return VisitConditionalOperatorCore(node, node.IsRef, node.Condition, node.Consequence, node.Alternative);
}
#nullable enable
protected virtual BoundNode? VisitConditionalOperatorCore(
BoundExpression node,
bool isByRef,
BoundExpression condition,
BoundExpression consequence,
BoundExpression alternative)
{
VisitCondition(condition);
var consequenceState = this.StateWhenTrue;
var alternativeState = this.StateWhenFalse;
if (IsConstantTrue(condition))
{
VisitConditionalOperand(alternativeState, alternative, isByRef);
VisitConditionalOperand(consequenceState, consequence, isByRef);
}
else if (IsConstantFalse(condition))
{
VisitConditionalOperand(consequenceState, consequence, isByRef);
VisitConditionalOperand(alternativeState, alternative, isByRef);
}
else
{
// at this point, the state is conditional after a conditional expression if:
// 1. the state is conditional after the consequence, or
// 2. the state is conditional after the alternative
VisitConditionalOperand(consequenceState, consequence, isByRef);
var conditionalAfterConsequence = IsConditionalState;
var (afterConsequenceWhenTrue, afterConsequenceWhenFalse) = conditionalAfterConsequence ? (StateWhenTrue, StateWhenFalse) : (State, State);
VisitConditionalOperand(alternativeState, alternative, isByRef);
if (!conditionalAfterConsequence && !IsConditionalState)
{
// simplify in the common case
Join(ref this.State, ref afterConsequenceWhenTrue);
}
else
{
Split();
Join(ref this.StateWhenTrue, ref afterConsequenceWhenTrue);
Join(ref this.StateWhenFalse, ref afterConsequenceWhenFalse);
}
}
return null;
}
#nullable disable
private void VisitConditionalOperand(TLocalState state, BoundExpression operand, bool isByRef)
{
SetState(state);
if (isByRef)
{
VisitLvalue(operand);
// exposing ref is a potential write
WriteArgument(operand, RefKind.Ref, method: null);
}
else
{
Visit(operand);
}
}
public override BoundNode VisitBaseReference(BoundBaseReference node)
{
return null;
}
public override BoundNode VisitDoStatement(BoundDoStatement node)
{
// do { statements; node.ContinueLabel: } while (node.Condition) node.BreakLabel:
LoopHead(node);
VisitStatement(node.Body);
ResolveContinues(node.ContinueLabel);
VisitCondition(node.Condition);
TLocalState breakState = this.StateWhenFalse;
SetState(this.StateWhenTrue);
LoopTail(node);
ResolveBreaks(breakState, node.BreakLabel);
return null;
}
public override BoundNode VisitGotoStatement(BoundGotoStatement node)
{
Debug.Assert(!this.IsConditionalState);
PendingBranches.Add(new PendingBranch(node, this.State, node.Label));
SetUnreachable();
return null;
}
protected void VisitLabel(LabelSymbol label, BoundStatement node)
{
node.AssertIsLabeledStatementWithLabel(label);
ResolveBranches(label, node);
var state = LabelState(label);
Join(ref this.State, ref state);
_labels[label] = this.State.Clone();
_labelsSeen.Add(node);
}
protected virtual void VisitLabel(BoundLabeledStatement node)
{
VisitLabel(node.Label, node);
}
public override BoundNode VisitLabelStatement(BoundLabelStatement node)
{
VisitLabel(node.Label, node);
return null;
}
public override BoundNode VisitLabeledStatement(BoundLabeledStatement node)
{
VisitLabel(node);
VisitStatement(node.Body);
return null;
}
public override BoundNode VisitLockStatement(BoundLockStatement node)
{
VisitRvalue(node.Argument);
VisitStatement(node.Body);
return null;
}
public override BoundNode VisitNoOpStatement(BoundNoOpStatement node)
{
return null;
}
public override BoundNode VisitNamespaceExpression(BoundNamespaceExpression node)
{
return null;
}
public override BoundNode VisitUsingStatement(BoundUsingStatement node)
{
if (node.ExpressionOpt != null)
{
VisitRvalue(node.ExpressionOpt);
}
if (node.DeclarationsOpt != null)
{
VisitStatement(node.DeclarationsOpt);
}
VisitStatement(node.Body);
if (AwaitUsingAndForeachAddsPendingBranch && node.AwaitOpt != null)
{
PendingBranches.Add(new PendingBranch(node, this.State, null));
}
return null;
}
public abstract bool AwaitUsingAndForeachAddsPendingBranch { get; }
public override BoundNode VisitFixedStatement(BoundFixedStatement node)
{
VisitStatement(node.Declarations);
VisitStatement(node.Body);
return null;
}
public override BoundNode VisitFixedLocalCollectionInitializer(BoundFixedLocalCollectionInitializer node)
{
VisitRvalue(node.Expression);
return null;
}
public override BoundNode VisitThrowStatement(BoundThrowStatement node)
{
BoundExpression expr = node.ExpressionOpt;
VisitRvalue(expr);
SetUnreachable();
return null;
}
public override BoundNode VisitYieldBreakStatement(BoundYieldBreakStatement node)
{
Debug.Assert(!this.IsConditionalState);
PendingBranches.Add(new PendingBranch(node, this.State, null));
SetUnreachable();
return null;
}
public override BoundNode VisitYieldReturnStatement(BoundYieldReturnStatement node)
{
VisitRvalue(node.Expression);
PendingBranches.Add(new PendingBranch(node, this.State, null));
return null;
}
public override BoundNode VisitDefaultLiteral(BoundDefaultLiteral node)
{
return null;
}
public override BoundNode VisitDefaultExpression(BoundDefaultExpression node)
{
return null;
}
public override BoundNode VisitUnconvertedObjectCreationExpression(BoundUnconvertedObjectCreationExpression node)
{
throw ExceptionUtilities.Unreachable;
}
public override BoundNode VisitTypeOfOperator(BoundTypeOfOperator node)
{
VisitTypeExpression(node.SourceType);
return null;
}
public override BoundNode VisitNameOfOperator(BoundNameOfOperator node)
{
var savedState = this.State;
SetState(UnreachableState());
Visit(node.Argument);
SetState(savedState);
return null;
}
public override BoundNode VisitAddressOfOperator(BoundAddressOfOperator node)
{
VisitAddressOfOperand(node.Operand, shouldReadOperand: false);
return null;
}
protected void VisitAddressOfOperand(BoundExpression operand, bool shouldReadOperand)
{
if (shouldReadOperand)
{
this.VisitRvalue(operand);
}
else
{
this.VisitLvalue(operand);
}
this.WriteArgument(operand, RefKind.Out, null); //Out because we know it will definitely be assigned.
}
public override BoundNode VisitPointerIndirectionOperator(BoundPointerIndirectionOperator node)
{
VisitRvalue(node.Operand);
return null;
}
public override BoundNode VisitPointerElementAccess(BoundPointerElementAccess node)
{
VisitRvalue(node.Expression);
VisitRvalue(node.Index);
return null;
}
public override BoundNode VisitSizeOfOperator(BoundSizeOfOperator node)
{
return null;
}
private BoundNode VisitStackAllocArrayCreationBase(BoundStackAllocArrayCreationBase node)
{
VisitRvalue(node.Count);
if (node.InitializerOpt != null && !node.InitializerOpt.Initializers.IsDefault)
{
foreach (var element in node.InitializerOpt.Initializers)
{
VisitRvalue(element);
}
}
return null;
}
public override BoundNode VisitStackAllocArrayCreation(BoundStackAllocArrayCreation node)
{
return VisitStackAllocArrayCreationBase(node);
}
public override BoundNode VisitConvertedStackAllocExpression(BoundConvertedStackAllocExpression node)
{
return VisitStackAllocArrayCreationBase(node);
}
public override BoundNode VisitAnonymousObjectCreationExpression(BoundAnonymousObjectCreationExpression node)
{
// visit arguments as r-values
VisitArguments(node.Arguments, default(ImmutableArray<RefKind>), node.Constructor);
return null;
}
public override BoundNode VisitArrayLength(BoundArrayLength node)
{
VisitRvalue(node.Expression);
return null;
}
public override BoundNode VisitConditionalGoto(BoundConditionalGoto node)
{
VisitCondition(node.Condition);
Debug.Assert(this.IsConditionalState);
if (node.JumpIfTrue)
{
PendingBranches.Add(new PendingBranch(node, this.StateWhenTrue, node.Label));
this.SetState(this.StateWhenFalse);
}
else
{
PendingBranches.Add(new PendingBranch(node, this.StateWhenFalse, node.Label));
this.SetState(this.StateWhenTrue);
}
return null;
}
public override BoundNode VisitObjectInitializerExpression(BoundObjectInitializerExpression node)
{
return VisitObjectOrCollectionInitializerExpression(node.Initializers);
}
public override BoundNode VisitCollectionInitializerExpression(BoundCollectionInitializerExpression node)
{
return VisitObjectOrCollectionInitializerExpression(node.Initializers);
}
private BoundNode VisitObjectOrCollectionInitializerExpression(ImmutableArray<BoundExpression> initializers)
{
foreach (var initializer in initializers)
{
VisitRvalue(initializer);
}
return null;
}
public override BoundNode VisitObjectInitializerMember(BoundObjectInitializerMember node)
{
var arguments = node.Arguments;
if (!arguments.IsDefaultOrEmpty)
{
MethodSymbol method = null;
if (node.MemberSymbol?.Kind == SymbolKind.Property)
{
var property = (PropertySymbol)node.MemberSymbol;
method = GetReadMethod(property);
}
VisitArguments(node.Arguments, node.ArgumentRefKindsOpt, method);
}
return null;
}
public override BoundNode VisitDynamicObjectInitializerMember(BoundDynamicObjectInitializerMember node)
{
return null;
}
public override BoundNode VisitCollectionElementInitializer(BoundCollectionElementInitializer node)
{
if (node.AddMethod.CallsAreOmitted(node.SyntaxTree))
{
// If the underlying add method is a partial method without a definition, or is a conditional method
// whose condition is not true, then the call has no effect and it is ignored for the purposes of
// flow analysis.
TLocalState savedState = savedState = this.State.Clone();
SetUnreachable();
VisitArguments(node.Arguments, default(ImmutableArray<RefKind>), node.AddMethod);
this.State = savedState;
}
else
{
VisitArguments(node.Arguments, default(ImmutableArray<RefKind>), node.AddMethod);
}
return null;
}
public override BoundNode VisitDynamicCollectionElementInitializer(BoundDynamicCollectionElementInitializer node)
{
VisitArguments(node.Arguments, default(ImmutableArray<RefKind>), method: null);
return null;
}
public override BoundNode VisitImplicitReceiver(BoundImplicitReceiver node)
{
return null;
}
public override BoundNode VisitFieldEqualsValue(BoundFieldEqualsValue node)
{
VisitRvalue(node.Value);
return null;
}
public override BoundNode VisitPropertyEqualsValue(BoundPropertyEqualsValue node)
{
VisitRvalue(node.Value);
return null;
}
public override BoundNode VisitParameterEqualsValue(BoundParameterEqualsValue node)
{
VisitRvalue(node.Value);
return null;
}
public override BoundNode VisitDeconstructValuePlaceholder(BoundDeconstructValuePlaceholder node)
{
return null;
}
public override BoundNode VisitObjectOrCollectionValuePlaceholder(BoundObjectOrCollectionValuePlaceholder node)
{
return null;
}
public override BoundNode VisitAwaitableValuePlaceholder(BoundAwaitableValuePlaceholder node)
{
return null;
}
public sealed override BoundNode VisitOutVariablePendingInference(OutVariablePendingInference node)
{
throw ExceptionUtilities.Unreachable;
}
public sealed override BoundNode VisitDeconstructionVariablePendingInference(DeconstructionVariablePendingInference node)
{
throw ExceptionUtilities.Unreachable;
}
public override BoundNode VisitDiscardExpression(BoundDiscardExpression node)
{
return null;
}
private static MethodSymbol GetReadMethod(PropertySymbol property) =>
property.GetOwnOrInheritedGetMethod() ?? property.SetMethod;
private static MethodSymbol GetWriteMethod(PropertySymbol property) =>
property.GetOwnOrInheritedSetMethod() ?? property.GetMethod;
public override BoundNode VisitConstructorMethodBody(BoundConstructorMethodBody node)
{
Visit(node.Initializer);
VisitMethodBodies(node.BlockBody, node.ExpressionBody);
return null;
}
public override BoundNode VisitNonConstructorMethodBody(BoundNonConstructorMethodBody node)
{
VisitMethodBodies(node.BlockBody, node.ExpressionBody);
return null;
}
public override BoundNode VisitNullCoalescingAssignmentOperator(BoundNullCoalescingAssignmentOperator node)
{
TLocalState leftState;
if (RegularPropertyAccess(node.LeftOperand) &&
(BoundPropertyAccess)node.LeftOperand is var left &&
left.PropertySymbol is var property &&
property.RefKind == RefKind.None)
{
var readMethod = property.GetOwnOrInheritedGetMethod();
VisitReceiverBeforeCall(left.ReceiverOpt, readMethod);
VisitReceiverAfterCall(left.ReceiverOpt, readMethod);
var savedState = this.State.Clone();
AdjustStateForNullCoalescingAssignmentNonNullCase(node);
leftState = this.State.Clone();
SetState(savedState);
VisitAssignmentOfNullCoalescingAssignment(node, left);
}
else
{
VisitRvalue(node.LeftOperand, isKnownToBeAnLvalue: true);
var savedState = this.State.Clone();
AdjustStateForNullCoalescingAssignmentNonNullCase(node);
leftState = this.State.Clone();
SetState(savedState);
VisitAssignmentOfNullCoalescingAssignment(node, propertyAccessOpt: null);
}
Join(ref this.State, ref leftState);
return null;
}
public override BoundNode VisitReadOnlySpanFromArray(BoundReadOnlySpanFromArray node)
{
VisitRvalue(node.Operand);
return null;
}
public override BoundNode VisitFunctionPointerInvocation(BoundFunctionPointerInvocation node)
{
Visit(node.InvokedExpression);
VisitArguments(node.Arguments, node.ArgumentRefKindsOpt, node.FunctionPointer.Signature);
return null;
}
public override BoundNode VisitUnconvertedAddressOfOperator(BoundUnconvertedAddressOfOperator node)
{
// This is not encountered in correct programs, but can be seen if the function pointer was
// unable to be converted and the semantic model is used to query for information.
Visit(node.Operand);
return null;
}
/// <summary>
/// This visitor represents just the assignment part of the null coalescing assignment
/// operator.
/// </summary>
protected virtual void VisitAssignmentOfNullCoalescingAssignment(
BoundNullCoalescingAssignmentOperator node,
BoundPropertyAccess propertyAccessOpt)
{
VisitRvalue(node.RightOperand);
if (propertyAccessOpt != null)
{
var symbol = propertyAccessOpt.PropertySymbol;
var writeMethod = symbol.GetOwnOrInheritedSetMethod();
PropertySetter(node, propertyAccessOpt.ReceiverOpt, writeMethod);
}
}
public override BoundNode VisitSavePreviousSequencePoint(BoundSavePreviousSequencePoint node)
{
return null;
}
public override BoundNode VisitRestorePreviousSequencePoint(BoundRestorePreviousSequencePoint node)
{
return null;
}
public override BoundNode VisitStepThroughSequencePoint(BoundStepThroughSequencePoint node)
{
return null;
}
/// <summary>
/// This visitor represents just the non-assignment part of the null coalescing assignment
/// operator (when the left operand is non-null).
/// </summary>
protected virtual void AdjustStateForNullCoalescingAssignmentNonNullCase(BoundNullCoalescingAssignmentOperator node)
{
}
private void VisitMethodBodies(BoundBlock blockBody, BoundBlock expressionBody)
{
if (blockBody == null)
{
Visit(expressionBody);
return;
}
else if (expressionBody == null)
{
Visit(blockBody);
return;
}
// In error cases we have two bodies. These are two unrelated pieces of code,
// they are not executed one after another. As we don't really know which one the developer
// intended to use, we need to visit both. We are going to pretend that there is
// an unconditional fork in execution and then we are converging after each body is executed.
// For example, if only one body assigns an out parameter, then after visiting both bodies
// we should consider that parameter is not definitely assigned.
// Note, that today this code is not executed for regular definite assignment analysis. It is
// only executed for region analysis.
TLocalState initialState = this.State.Clone();
Visit(blockBody);
TLocalState afterBlock = this.State;
SetState(initialState);
Visit(expressionBody);
Join(ref this.State, ref afterBlock);
}
#endregion visitors
}
/// <summary>
/// The possible places that we are processing when there is a region.
/// </summary>
/// <remarks>
/// This should be nested inside <see cref="AbstractFlowPass{TLocalState, TLocalFunctionState}"/> but is not due to https://github.com/dotnet/roslyn/issues/36992 .
/// </remarks>
internal enum RegionPlace { Before, Inside, After };
}
| // 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.
#nullable disable
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Text;
using Microsoft.CodeAnalysis.CSharp.Symbols;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.PooledObjects;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.CSharp
{
/// <summary>
/// An abstract flow pass that takes some shortcuts in analyzing finally blocks, in order to enable
/// the analysis to take place without tracking exceptions or repeating the analysis of a finally block
/// for each exit from a try statement. The shortcut results in a slightly less precise
/// (but still conservative) analysis, but that less precise analysis is all that is required for
/// the language specification. The most significant shortcut is that we do not track the state
/// where exceptions can arise. That does not affect the soundness for most analyses, but for those
/// analyses whose soundness would be affected (e.g. "data flows out"), we track "unassignments" to keep
/// the analysis sound.
/// </summary>
/// <remarks>
/// Formally, this is a fairly conventional lattice flow analysis (<see
/// href="https://en.wikipedia.org/wiki/Data-flow_analysis"/>) that moves upward through the <see cref="Join(ref
/// TLocalState, ref TLocalState)"/> operation.
/// </remarks>
internal abstract partial class AbstractFlowPass<TLocalState, TLocalFunctionState> : BoundTreeVisitor
where TLocalState : AbstractFlowPass<TLocalState, TLocalFunctionState>.ILocalState
where TLocalFunctionState : AbstractFlowPass<TLocalState, TLocalFunctionState>.AbstractLocalFunctionState
{
protected int _recursionDepth;
/// <summary>
/// The compilation in which the analysis is taking place. This is needed to determine which
/// conditional methods will be compiled and which will be omitted.
/// </summary>
protected readonly CSharpCompilation compilation;
/// <summary>
/// The method whose body is being analyzed, or the field whose initializer is being analyzed.
/// May be a top-level member or a lambda or local function. It is used for
/// references to method parameters. Thus, '_symbol' should not be used directly, but
/// 'MethodParameters', 'MethodThisParameter' and 'AnalyzeOutParameters(...)' should be used
/// instead. _symbol is null during speculative binding.
/// </summary>
protected readonly Symbol _symbol;
/// <summary>
/// Reflects the enclosing member, lambda or local function at the current location (in the bound tree).
/// </summary>
protected Symbol CurrentSymbol;
/// <summary>
/// The bound node of the method or initializer being analyzed.
/// </summary>
protected readonly BoundNode methodMainNode;
/// <summary>
/// The flow analysis state at each label, computed by calling <see cref="Join(ref
/// TLocalState, ref TLocalState)"/> on the state from branches to that label with the state
/// when we fall into the label. Entries are created when the label is encountered. One
/// case deserves special attention: when the destination of the branch is a label earlier
/// in the code, it is possible (though rarely occurs in practice) that we are changing the
/// state at a label that we've already analyzed. In that case we run another pass of the
/// analysis to allow those changes to propagate. This repeats until no further changes to
/// the state of these labels occurs. This can result in quadratic performance in unlikely
/// but possible code such as this: "int x; if (cond) goto l1; x = 3; l5: print x; l4: goto
/// l5; l3: goto l4; l2: goto l3; l1: goto l2;"
/// </summary>
private readonly PooledDictionary<LabelSymbol, TLocalState> _labels;
/// <summary>
/// Set to true after an analysis scan if the analysis was incomplete due to state changing
/// after it was used by another analysis component. In this case the caller scans again (until
/// this is false). Since the analysis proceeds by monotonically changing the state computed
/// at each label, this must terminate.
/// </summary>
protected bool stateChangedAfterUse;
/// <summary>
/// All of the labels seen so far in this forward scan of the body
/// </summary>
private PooledHashSet<BoundStatement> _labelsSeen;
/// <summary>
/// Pending escapes generated in the current scope (or more deeply nested scopes). When jump
/// statements (goto, break, continue, return) are processed, they are placed in the
/// pendingBranches buffer to be processed later by the code handling the destination
/// statement. As a special case, the processing of try-finally statements might modify the
/// contents of the pendingBranches buffer to take into account the behavior of
/// "intervening" finally clauses.
/// </summary>
protected ArrayBuilder<PendingBranch> PendingBranches { get; private set; }
/// <summary>
/// The definite assignment and/or reachability state at the point currently being analyzed.
/// </summary>
protected TLocalState State;
protected TLocalState StateWhenTrue;
protected TLocalState StateWhenFalse;
protected bool IsConditionalState;
/// <summary>
/// Indicates that the transfer function for a particular node (the function mapping the
/// state before the node to the state after the node) is not monotonic, in the sense that
/// it can change the state in either direction in the lattice. If the transfer function is
/// monotonic, the transfer function can only change the state toward the <see
/// cref="UnreachableState"/>. Reachability and definite assignment are monotonic, and
/// permit a more efficient analysis. Region analysis and nullable analysis are not
/// monotonic. This is just an optimization; we could treat all of them as nonmonotonic
/// without much loss of performance. In fact, this only affects the analysis of (relatively
/// rare) try statements, and is only a slight optimization.
/// </summary>
private readonly bool _nonMonotonicTransfer;
protected void SetConditionalState((TLocalState whenTrue, TLocalState whenFalse) state)
{
SetConditionalState(state.whenTrue, state.whenFalse);
}
protected void SetConditionalState(TLocalState whenTrue, TLocalState whenFalse)
{
IsConditionalState = true;
State = default(TLocalState);
StateWhenTrue = whenTrue;
StateWhenFalse = whenFalse;
}
protected void SetState(TLocalState newState)
{
Debug.Assert(newState != null);
StateWhenTrue = StateWhenFalse = default(TLocalState);
IsConditionalState = false;
State = newState;
}
protected void Split()
{
if (!IsConditionalState)
{
SetConditionalState(State, State.Clone());
}
}
protected void Unsplit()
{
if (IsConditionalState)
{
Join(ref StateWhenTrue, ref StateWhenFalse);
SetState(StateWhenTrue);
}
}
/// <summary>
/// Where all diagnostics are deposited.
/// </summary>
protected DiagnosticBag Diagnostics { get; }
#region Region
// For region analysis, we maintain some extra data.
protected RegionPlace regionPlace; // tells whether we are currently analyzing code before, during, or after the region
protected readonly BoundNode firstInRegion, lastInRegion;
protected readonly bool TrackingRegions;
/// <summary>
/// A cache of the state at the backward branch point of each loop. This is not needed
/// during normal flow analysis, but is needed for DataFlowsOut region analysis.
/// </summary>
private readonly Dictionary<BoundLoopStatement, TLocalState> _loopHeadState;
#endregion Region
protected AbstractFlowPass(
CSharpCompilation compilation,
Symbol symbol,
BoundNode node,
BoundNode firstInRegion = null,
BoundNode lastInRegion = null,
bool trackRegions = false,
bool nonMonotonicTransferFunction = false)
{
Debug.Assert(node != null);
if (firstInRegion != null && lastInRegion != null)
{
trackRegions = true;
}
if (trackRegions)
{
Debug.Assert(firstInRegion != null);
Debug.Assert(lastInRegion != null);
int startLocation = firstInRegion.Syntax.SpanStart;
int endLocation = lastInRegion.Syntax.Span.End;
int length = endLocation - startLocation;
Debug.Assert(length >= 0, "last comes before first");
this.RegionSpan = new TextSpan(startLocation, length);
}
PendingBranches = ArrayBuilder<PendingBranch>.GetInstance();
_labelsSeen = PooledHashSet<BoundStatement>.GetInstance();
_labels = PooledDictionary<LabelSymbol, TLocalState>.GetInstance();
this.Diagnostics = DiagnosticBag.GetInstance();
this.compilation = compilation;
_symbol = symbol;
CurrentSymbol = symbol;
this.methodMainNode = node;
this.firstInRegion = firstInRegion;
this.lastInRegion = lastInRegion;
_loopHeadState = new Dictionary<BoundLoopStatement, TLocalState>(ReferenceEqualityComparer.Instance);
TrackingRegions = trackRegions;
_nonMonotonicTransfer = nonMonotonicTransferFunction;
}
protected abstract string Dump(TLocalState state);
protected string Dump()
{
return IsConditionalState
? $"true: {Dump(this.StateWhenTrue)} false: {Dump(this.StateWhenFalse)}"
: Dump(this.State);
}
#if DEBUG
protected string DumpLabels()
{
StringBuilder result = new StringBuilder();
result.Append("Labels{");
bool first = true;
foreach (var key in _labels.Keys)
{
if (!first)
{
result.Append(", ");
}
string name = key.Name;
if (string.IsNullOrEmpty(name))
{
name = "<Label>" + key.GetHashCode();
}
result.Append(name).Append(": ").Append(this.Dump(_labels[key]));
first = false;
}
result.Append("}");
return result.ToString();
}
#endif
private void EnterRegionIfNeeded(BoundNode node)
{
if (TrackingRegions && node == this.firstInRegion && this.regionPlace == RegionPlace.Before)
{
EnterRegion();
}
}
/// <summary>
/// Subclasses may override EnterRegion to perform any actions at the entry to the region.
/// </summary>
protected virtual void EnterRegion()
{
Debug.Assert(this.regionPlace == RegionPlace.Before);
this.regionPlace = RegionPlace.Inside;
}
private void LeaveRegionIfNeeded(BoundNode node)
{
if (TrackingRegions && node == this.lastInRegion && this.regionPlace == RegionPlace.Inside)
{
LeaveRegion();
}
}
/// <summary>
/// Subclasses may override LeaveRegion to perform any action at the end of the region.
/// </summary>
protected virtual void LeaveRegion()
{
Debug.Assert(IsInside);
this.regionPlace = RegionPlace.After;
}
protected readonly TextSpan RegionSpan;
protected bool RegionContains(TextSpan span)
{
// TODO: There are no scenarios involving a zero-length span
// currently. If the assert fails, add a corresponding test.
Debug.Assert(span.Length > 0);
if (span.Length == 0)
{
return RegionSpan.Contains(span.Start);
}
return RegionSpan.Contains(span);
}
protected bool IsInside
{
get
{
return regionPlace == RegionPlace.Inside;
}
}
protected virtual void EnterParameters(ImmutableArray<ParameterSymbol> parameters)
{
foreach (var parameter in parameters)
{
EnterParameter(parameter);
}
}
protected virtual void EnterParameter(ParameterSymbol parameter)
{ }
protected virtual void LeaveParameters(
ImmutableArray<ParameterSymbol> parameters,
SyntaxNode syntax,
Location location)
{
foreach (ParameterSymbol parameter in parameters)
{
LeaveParameter(parameter, syntax, location);
}
}
protected virtual void LeaveParameter(ParameterSymbol parameter, SyntaxNode syntax, Location location)
{ }
public override BoundNode Visit(BoundNode node)
{
return VisitAlways(node);
}
protected BoundNode VisitAlways(BoundNode node)
{
BoundNode result = null;
// We scan even expressions, because we must process lambdas contained within them.
if (node != null)
{
EnterRegionIfNeeded(node);
VisitWithStackGuard(node);
LeaveRegionIfNeeded(node);
}
return result;
}
[DebuggerStepThrough]
private BoundNode VisitWithStackGuard(BoundNode node)
{
var expression = node as BoundExpression;
if (expression != null)
{
return VisitExpressionWithStackGuard(ref _recursionDepth, expression);
}
return base.Visit(node);
}
[DebuggerStepThrough]
protected override BoundExpression VisitExpressionWithoutStackGuard(BoundExpression node)
{
return (BoundExpression)base.Visit(node);
}
protected override bool ConvertInsufficientExecutionStackExceptionToCancelledByStackGuardException()
{
return false; // just let the original exception bubble up.
}
/// <summary>
/// A pending branch. These are created for a return, break, continue, goto statement,
/// yield return, yield break, await expression, and await foreach/using. The idea is that
/// we don't know if the branch will eventually reach its destination because of an
/// intervening finally block that cannot complete normally. So we store them up and handle
/// them as we complete processing each construct. At the end of a block, if there are any
/// pending branches to a label in that block we process the branch. Otherwise we relay it
/// up to the enclosing construct as a pending branch of the enclosing construct.
/// </summary>
internal class PendingBranch
{
public readonly BoundNode Branch;
public bool IsConditionalState;
public TLocalState State;
public TLocalState StateWhenTrue;
public TLocalState StateWhenFalse;
public readonly LabelSymbol Label;
public PendingBranch(BoundNode branch, TLocalState state, LabelSymbol label, bool isConditionalState = false, TLocalState stateWhenTrue = default, TLocalState stateWhenFalse = default)
{
this.Branch = branch;
this.State = state.Clone();
this.IsConditionalState = isConditionalState;
if (isConditionalState)
{
this.StateWhenTrue = stateWhenTrue.Clone();
this.StateWhenFalse = stateWhenFalse.Clone();
}
this.Label = label;
}
}
/// <summary>
/// Perform a single pass of flow analysis. Note that after this pass,
/// this.backwardBranchChanged indicates if a further pass is required.
/// </summary>
protected virtual ImmutableArray<PendingBranch> Scan(ref bool badRegion)
{
var oldPending = SavePending();
Visit(methodMainNode);
this.Unsplit();
RestorePending(oldPending);
if (TrackingRegions && regionPlace != RegionPlace.After)
{
badRegion = true;
}
ImmutableArray<PendingBranch> result = RemoveReturns();
return result;
}
protected ImmutableArray<PendingBranch> Analyze(ref bool badRegion, Optional<TLocalState> initialState = default)
{
ImmutableArray<PendingBranch> returns;
do
{
// the entry point of a method is assumed reachable
regionPlace = RegionPlace.Before;
this.State = initialState.HasValue ? initialState.Value : TopState();
PendingBranches.Clear();
this.stateChangedAfterUse = false;
this.Diagnostics.Clear();
returns = this.Scan(ref badRegion);
}
while (this.stateChangedAfterUse);
return returns;
}
protected virtual void Free()
{
this.Diagnostics.Free();
PendingBranches.Free();
_labelsSeen.Free();
_labels.Free();
}
/// <summary>
/// If a method is currently being analyzed returns its parameters, returns an empty array
/// otherwise.
/// </summary>
protected ImmutableArray<ParameterSymbol> MethodParameters
{
get
{
var method = _symbol as MethodSymbol;
return (object)method == null ? ImmutableArray<ParameterSymbol>.Empty : method.Parameters;
}
}
/// <summary>
/// If a method is currently being analyzed returns its 'this' parameter, returns null
/// otherwise.
/// </summary>
protected ParameterSymbol MethodThisParameter
{
get
{
ParameterSymbol thisParameter = null;
(_symbol as MethodSymbol)?.TryGetThisParameter(out thisParameter);
return thisParameter;
}
}
/// <summary>
/// Specifies whether or not method's out parameters should be analyzed. If there's more
/// than one location in the method being analyzed, then the method is partial and we prefer
/// to report an out parameter in partial method error.
/// </summary>
/// <param name="location">location to be used</param>
/// <returns>true if the out parameters of the method should be analyzed</returns>
protected bool ShouldAnalyzeOutParameters(out Location location)
{
var method = _symbol as MethodSymbol;
if ((object)method == null || method.Locations.Length != 1)
{
location = null;
return false;
}
else
{
location = method.Locations[0];
return true;
}
}
/// <summary>
/// Return the flow analysis state associated with a label.
/// </summary>
/// <param name="label"></param>
/// <returns></returns>
protected virtual TLocalState LabelState(LabelSymbol label)
{
TLocalState result;
if (_labels.TryGetValue(label, out result))
{
return result;
}
result = UnreachableState();
_labels.Add(label, result);
return result;
}
/// <summary>
/// Return to the caller the set of pending return statements.
/// </summary>
/// <returns></returns>
protected virtual ImmutableArray<PendingBranch> RemoveReturns()
{
ImmutableArray<PendingBranch> result;
result = PendingBranches.ToImmutable();
PendingBranches.Clear();
// The caller should have handled and cleared labelsSeen.
Debug.Assert(_labelsSeen.Count == 0);
return result;
}
/// <summary>
/// Set the current state to one that indicates that it is unreachable.
/// </summary>
protected void SetUnreachable()
{
this.State = UnreachableState();
}
protected void VisitLvalue(BoundExpression node)
{
EnterRegionIfNeeded(node);
switch (node?.Kind)
{
case BoundKind.Parameter:
VisitLvalueParameter((BoundParameter)node);
break;
case BoundKind.Local:
VisitLvalue((BoundLocal)node);
break;
case BoundKind.ThisReference:
case BoundKind.BaseReference:
break;
case BoundKind.PropertyAccess:
var access = (BoundPropertyAccess)node;
if (Binder.AccessingAutoPropertyFromConstructor(access, _symbol))
{
var backingField = (access.PropertySymbol as SourcePropertySymbolBase)?.BackingField;
if (backingField != null)
{
VisitFieldAccessInternal(access.ReceiverOpt, backingField);
break;
}
}
goto default;
case BoundKind.FieldAccess:
{
BoundFieldAccess node1 = (BoundFieldAccess)node;
VisitFieldAccessInternal(node1.ReceiverOpt, node1.FieldSymbol);
break;
}
case BoundKind.EventAccess:
{
BoundEventAccess node1 = (BoundEventAccess)node;
VisitFieldAccessInternal(node1.ReceiverOpt, node1.EventSymbol.AssociatedField);
break;
}
case BoundKind.TupleLiteral:
case BoundKind.ConvertedTupleLiteral:
((BoundTupleExpression)node).VisitAllElements((x, self) => self.VisitLvalue(x), this);
break;
default:
VisitRvalue(node);
break;
}
LeaveRegionIfNeeded(node);
}
protected virtual void VisitLvalue(BoundLocal node)
{
}
/// <summary>
/// Visit a boolean condition expression.
/// </summary>
/// <param name="node"></param>
protected void VisitCondition(BoundExpression node)
{
Visit(node);
AdjustConditionalState(node);
}
private void AdjustConditionalState(BoundExpression node)
{
if (IsConstantTrue(node))
{
Unsplit();
SetConditionalState(this.State, UnreachableState());
}
else if (IsConstantFalse(node))
{
Unsplit();
SetConditionalState(UnreachableState(), this.State);
}
else if ((object)node.Type == null || node.Type.SpecialType != SpecialType.System_Boolean)
{
// a dynamic type or a type with operator true/false
Unsplit();
}
Split();
}
/// <summary>
/// Visit a general expression, where we will only need to determine if variables are
/// assigned (or not). That is, we will not be needing AssignedWhenTrue and
/// AssignedWhenFalse.
/// </summary>
/// <param name="isKnownToBeAnLvalue">True when visiting an rvalue that will actually be used as an lvalue,
/// for example a ref parameter when simulating a read of it, or an argument corresponding to an in parameter</param>
protected virtual void VisitRvalue(BoundExpression node, bool isKnownToBeAnLvalue = false)
{
Visit(node);
Unsplit();
}
/// <summary>
/// Visit a statement.
/// </summary>
[DebuggerHidden]
protected virtual void VisitStatement(BoundStatement statement)
{
Visit(statement);
Debug.Assert(!this.IsConditionalState);
}
protected static bool IsConstantTrue(BoundExpression node)
{
return node.ConstantValue == ConstantValue.True;
}
protected static bool IsConstantFalse(BoundExpression node)
{
return node.ConstantValue == ConstantValue.False;
}
protected static bool IsConstantNull(BoundExpression node)
{
return node.ConstantValue == ConstantValue.Null;
}
/// <summary>
/// Called at the point in a loop where the backwards branch would go to.
/// </summary>
private void LoopHead(BoundLoopStatement node)
{
TLocalState previousState;
if (_loopHeadState.TryGetValue(node, out previousState))
{
Join(ref this.State, ref previousState);
}
_loopHeadState[node] = this.State.Clone();
}
/// <summary>
/// Called at the point in a loop where the backward branch is placed.
/// </summary>
private void LoopTail(BoundLoopStatement node)
{
var oldState = _loopHeadState[node];
if (Join(ref oldState, ref this.State))
{
_loopHeadState[node] = oldState;
this.stateChangedAfterUse = true;
}
}
/// <summary>
/// Used to resolve break statements in each statement form that has a break statement
/// (loops, switch).
/// </summary>
private void ResolveBreaks(TLocalState breakState, LabelSymbol label)
{
var pendingBranches = PendingBranches;
var count = pendingBranches.Count;
if (count != 0)
{
int stillPending = 0;
for (int i = 0; i < count; i++)
{
var pending = pendingBranches[i];
if (pending.Label == label)
{
Join(ref breakState, ref pending.State);
}
else
{
if (stillPending != i)
{
pendingBranches[stillPending] = pending;
}
stillPending++;
}
}
pendingBranches.Clip(stillPending);
}
SetState(breakState);
}
/// <summary>
/// Used to resolve continue statements in each statement form that supports it.
/// </summary>
private void ResolveContinues(LabelSymbol continueLabel)
{
var pendingBranches = PendingBranches;
var count = pendingBranches.Count;
if (count != 0)
{
int stillPending = 0;
for (int i = 0; i < count; i++)
{
var pending = pendingBranches[i];
if (pending.Label == continueLabel)
{
// Technically, nothing in the language specification depends on the state
// at the continue label, so we could just discard them instead of merging
// the states. In fact, we need not have added continue statements to the
// pending jump queue in the first place if we were interested solely in the
// flow analysis. However, region analysis (in support of extract method)
// and other forms of more precise analysis
// depend on continue statements appearing in the pending branch queue, so
// we process them from the queue here.
Join(ref this.State, ref pending.State);
}
else
{
if (stillPending != i)
{
pendingBranches[stillPending] = pending;
}
stillPending++;
}
}
pendingBranches.Clip(stillPending);
}
}
/// <summary>
/// Subclasses override this if they want to take special actions on processing a goto
/// statement, when both the jump and the label have been located.
/// </summary>
protected virtual void NoteBranch(PendingBranch pending, BoundNode gotoStmt, BoundStatement target)
{
target.AssertIsLabeledStatement();
}
/// <summary>
/// To handle a label, we resolve all branches to that label. Returns true if the state of
/// the label changes as a result.
/// </summary>
/// <param name="label">Target label</param>
/// <param name="target">Statement containing the target label</param>
private bool ResolveBranches(LabelSymbol label, BoundStatement target)
{
target?.AssertIsLabeledStatementWithLabel(label);
bool labelStateChanged = false;
var pendingBranches = PendingBranches;
var count = pendingBranches.Count;
if (count != 0)
{
int stillPending = 0;
for (int i = 0; i < count; i++)
{
var pending = pendingBranches[i];
if (pending.Label == label)
{
ResolveBranch(pending, label, target, ref labelStateChanged);
}
else
{
if (stillPending != i)
{
pendingBranches[stillPending] = pending;
}
stillPending++;
}
}
pendingBranches.Clip(stillPending);
}
return labelStateChanged;
}
protected virtual void ResolveBranch(PendingBranch pending, LabelSymbol label, BoundStatement target, ref bool labelStateChanged)
{
var state = LabelState(label);
if (target != null)
{
NoteBranch(pending, pending.Branch, target);
}
var changed = Join(ref state, ref pending.State);
if (changed)
{
labelStateChanged = true;
_labels[label] = state;
}
}
protected struct SavedPending
{
public readonly ArrayBuilder<PendingBranch> PendingBranches;
public readonly PooledHashSet<BoundStatement> LabelsSeen;
public SavedPending(ArrayBuilder<PendingBranch> pendingBranches, PooledHashSet<BoundStatement> labelsSeen)
{
this.PendingBranches = pendingBranches;
this.LabelsSeen = labelsSeen;
}
}
/// <summary>
/// Since branches cannot branch into constructs, only out, we save the pending branches
/// when visiting more nested constructs. When tracking exceptions, we store the current
/// state as the exception state for the following code.
/// </summary>
protected SavedPending SavePending()
{
Debug.Assert(!this.IsConditionalState);
var result = new SavedPending(PendingBranches, _labelsSeen);
PendingBranches = ArrayBuilder<PendingBranch>.GetInstance();
_labelsSeen = PooledHashSet<BoundStatement>.GetInstance();
return result;
}
/// <summary>
/// We use this when closing a block that may contain labels or branches
/// - branches to new labels are resolved
/// - new labels are removed (no longer can be reached)
/// - unresolved pending branches are carried forward
/// </summary>
/// <param name="oldPending">The old pending branches, which are to be merged with the current ones</param>
protected void RestorePending(SavedPending oldPending)
{
foreach (var node in _labelsSeen)
{
switch (node.Kind)
{
case BoundKind.LabeledStatement:
{
var label = (BoundLabeledStatement)node;
stateChangedAfterUse |= ResolveBranches(label.Label, label);
}
break;
case BoundKind.LabelStatement:
{
var label = (BoundLabelStatement)node;
stateChangedAfterUse |= ResolveBranches(label.Label, label);
}
break;
case BoundKind.SwitchSection:
{
var sec = (BoundSwitchSection)node;
foreach (var label in sec.SwitchLabels)
{
stateChangedAfterUse |= ResolveBranches(label.Label, sec);
}
}
break;
default:
// there are no other kinds of labels
throw ExceptionUtilities.UnexpectedValue(node.Kind);
}
}
oldPending.PendingBranches.AddRange(this.PendingBranches);
PendingBranches.Free();
PendingBranches = oldPending.PendingBranches;
// We only use SavePending/RestorePending when there could be no branch into the region between them.
// So there is no need to save the labels seen between the calls. If there were such a need, we would
// do "this.labelsSeen.UnionWith(oldPending.LabelsSeen);" instead of the following assignment
_labelsSeen.Free();
_labelsSeen = oldPending.LabelsSeen;
}
#region visitors
/// <summary>
/// Since each language construct must be handled according to the rules of the language specification,
/// the default visitor reports that the construct for the node is not implemented in the compiler.
/// </summary>
public override BoundNode DefaultVisit(BoundNode node)
{
Debug.Assert(false, $"Should Visit{node.Kind} be overridden in {this.GetType().Name}?");
Diagnostics.Add(ErrorCode.ERR_InternalError, node.Syntax.Location);
return null;
}
public override BoundNode VisitAttribute(BoundAttribute node)
{
// No flow analysis is ever done in attributes (or their arguments).
return null;
}
public override BoundNode VisitThrowExpression(BoundThrowExpression node)
{
VisitRvalue(node.Expression);
SetUnreachable();
return node;
}
public override BoundNode VisitPassByCopy(BoundPassByCopy node)
{
VisitRvalue(node.Expression);
return node;
}
public override BoundNode VisitIsPatternExpression(BoundIsPatternExpression node)
{
Debug.Assert(!IsConditionalState);
bool negated = node.Pattern.IsNegated(out var pattern);
Debug.Assert(negated == node.IsNegated);
if (VisitPossibleConditionalAccess(node.Expression, out var stateWhenNotNull))
{
Debug.Assert(!IsConditionalState);
SetConditionalState(patternMatchesNull(pattern)
? (State, stateWhenNotNull)
: (stateWhenNotNull, State));
}
else if (IsConditionalState)
{
// Patterns which only match a single boolean value should propagate conditional state
// for example, `(a != null && a.M(out x)) is true` should have the same conditional state as `(a != null && a.M(out x))`.
if (isBoolTest(pattern) is bool value)
{
if (!value)
{
SetConditionalState(StateWhenFalse, StateWhenTrue);
}
}
else
{
// Patterns which match more than a single boolean value cannot propagate conditional state
// for example, `(a != null && a.M(out x)) is bool b` should not have conditional state
Unsplit();
}
}
VisitPattern(pattern);
var reachableLabels = node.DecisionDag.ReachableLabels;
if (!reachableLabels.Contains(node.WhenTrueLabel))
{
SetState(this.StateWhenFalse);
SetConditionalState(UnreachableState(), this.State);
}
else if (!reachableLabels.Contains(node.WhenFalseLabel))
{
SetState(this.StateWhenTrue);
SetConditionalState(this.State, UnreachableState());
}
if (negated)
{
SetConditionalState(this.StateWhenFalse, this.StateWhenTrue);
}
return node;
static bool patternMatchesNull(BoundPattern pattern)
{
switch (pattern)
{
case BoundTypePattern:
case BoundRecursivePattern:
case BoundITuplePattern:
case BoundRelationalPattern:
case BoundDeclarationPattern { IsVar: false }:
case BoundConstantPattern { ConstantValue: { IsNull: false } }:
return false;
case BoundConstantPattern { ConstantValue: { IsNull: true } }:
return true;
case BoundNegatedPattern negated:
return !patternMatchesNull(negated.Negated);
case BoundBinaryPattern binary:
if (binary.Disjunction)
{
// `a?.b(out x) is null or C`
// pattern matches null if either subpattern matches null
var leftNullTest = patternMatchesNull(binary.Left);
return patternMatchesNull(binary.Left) || patternMatchesNull(binary.Right);
}
// `a?.b out x is not null and var c`
// pattern matches null only if both subpatterns match null
return patternMatchesNull(binary.Left) && patternMatchesNull(binary.Right);
case BoundDeclarationPattern { IsVar: true }:
case BoundDiscardPattern:
return true;
default:
throw ExceptionUtilities.UnexpectedValue(pattern.Kind);
}
}
// Returns `true` if the pattern only matches a `true` input.
// Returns `false` if the pattern only matches a `false` input.
// Otherwise, returns `null`.
static bool? isBoolTest(BoundPattern pattern)
{
switch (pattern)
{
case BoundConstantPattern { ConstantValue: { IsBoolean: true, BooleanValue: var boolValue } }:
return boolValue;
case BoundNegatedPattern negated:
return !isBoolTest(negated.Negated);
case BoundBinaryPattern binary:
if (binary.Disjunction)
{
// `(a != null && a.b(out x)) is true or true` matches `true`
// `(a != null && a.b(out x)) is true or false` matches any boolean
// both subpatterns must have the same bool test for the test to propagate out
var leftNullTest = isBoolTest(binary.Left);
return leftNullTest is null ? null :
leftNullTest != isBoolTest(binary.Right) ? null :
leftNullTest;
}
// `(a != null && a.b(out x)) is true and true` matches `true`
// `(a != null && a.b(out x)) is true and var x` matches `true`
// `(a != null && a.b(out x)) is true and false` never matches and is a compile error
return isBoolTest(binary.Left) ?? isBoolTest(binary.Right);
case BoundConstantPattern { ConstantValue: { IsBoolean: false } }:
case BoundDiscardPattern:
case BoundTypePattern:
case BoundRecursivePattern:
case BoundITuplePattern:
case BoundRelationalPattern:
case BoundDeclarationPattern:
return null;
default:
throw ExceptionUtilities.UnexpectedValue(pattern.Kind);
}
}
}
public virtual void VisitPattern(BoundPattern pattern)
{
Split();
}
public override BoundNode VisitConstantPattern(BoundConstantPattern node)
{
// All patterns are handled by VisitPattern
throw ExceptionUtilities.Unreachable;
}
public override BoundNode VisitTupleLiteral(BoundTupleLiteral node)
{
return VisitTupleExpression(node);
}
public override BoundNode VisitConvertedTupleLiteral(BoundConvertedTupleLiteral node)
{
return VisitTupleExpression(node);
}
private BoundNode VisitTupleExpression(BoundTupleExpression node)
{
VisitArguments(node.Arguments, default(ImmutableArray<RefKind>), null);
return null;
}
public override BoundNode VisitTupleBinaryOperator(BoundTupleBinaryOperator node)
{
VisitRvalue(node.Left);
VisitRvalue(node.Right);
return null;
}
public override BoundNode VisitDynamicObjectCreationExpression(BoundDynamicObjectCreationExpression node)
{
VisitArguments(node.Arguments, node.ArgumentRefKindsOpt, null);
VisitRvalue(node.InitializerExpressionOpt);
return null;
}
public override BoundNode VisitDynamicIndexerAccess(BoundDynamicIndexerAccess node)
{
VisitRvalue(node.Receiver);
VisitArguments(node.Arguments, node.ArgumentRefKindsOpt, null);
return null;
}
public override BoundNode VisitDynamicMemberAccess(BoundDynamicMemberAccess node)
{
VisitRvalue(node.Receiver);
return null;
}
public override BoundNode VisitDynamicInvocation(BoundDynamicInvocation node)
{
VisitRvalue(node.Expression);
VisitArguments(node.Arguments, node.ArgumentRefKindsOpt, null);
return null;
}
#nullable enable
protected BoundNode? VisitInterpolatedStringBase(BoundInterpolatedStringBase node, InterpolatedStringHandlerData? data)
{
// If there can be any branching, then we need to treat the expressions
// as optionally evaluated. Otherwise, we treat them as always evaluated
(BoundExpression? construction, bool useBoolReturns, bool firstPartIsConditional) = data switch
{
null => (null, false, false),
{ } d => (d.Construction, d.UsesBoolReturns, d.HasTrailingHandlerValidityParameter)
};
VisitRvalue(construction);
bool hasConditionalEvaluation = useBoolReturns || firstPartIsConditional;
TLocalState? shortCircuitState = hasConditionalEvaluation ? State.Clone() : default;
_ = VisitInterpolatedStringHandlerParts(node, useBoolReturns, firstPartIsConditional, ref shortCircuitState);
if (hasConditionalEvaluation)
{
Debug.Assert(shortCircuitState != null);
Join(ref this.State, ref shortCircuitState);
}
return null;
}
#nullable disable
public override BoundNode VisitInterpolatedString(BoundInterpolatedString node)
{
return VisitInterpolatedStringBase(node, node.InterpolationData);
}
public override BoundNode VisitUnconvertedInterpolatedString(BoundUnconvertedInterpolatedString node)
{
// If the node is unconverted, we'll just treat it as if the contents are always evaluated
return VisitInterpolatedStringBase(node, data: null);
}
public override BoundNode VisitStringInsert(BoundStringInsert node)
{
VisitRvalue(node.Value);
if (node.Alignment != null)
{
VisitRvalue(node.Alignment);
}
if (node.Format != null)
{
VisitRvalue(node.Format);
}
return null;
}
public override BoundNode VisitInterpolatedStringHandlerPlaceholder(BoundInterpolatedStringHandlerPlaceholder node)
{
return null;
}
public override BoundNode VisitInterpolatedStringArgumentPlaceholder(BoundInterpolatedStringArgumentPlaceholder node)
{
return null;
}
public override BoundNode VisitArgList(BoundArgList node)
{
// The "__arglist" expression that is legal inside a varargs method has no
// effect on flow analysis and it has no children.
return null;
}
public override BoundNode VisitArgListOperator(BoundArgListOperator node)
{
// When we have M(__arglist(x, y, z)) we must visit x, y and z.
VisitArguments(node.Arguments, node.ArgumentRefKindsOpt, null);
return null;
}
public override BoundNode VisitRefTypeOperator(BoundRefTypeOperator node)
{
VisitRvalue(node.Operand);
return null;
}
public override BoundNode VisitMakeRefOperator(BoundMakeRefOperator node)
{
// Note that we require that the variable whose reference we are taking
// has been initialized; it is similar to passing the variable as a ref parameter.
VisitRvalue(node.Operand, isKnownToBeAnLvalue: true);
return null;
}
public override BoundNode VisitRefValueOperator(BoundRefValueOperator node)
{
VisitRvalue(node.Operand);
return null;
}
public override BoundNode VisitGlobalStatementInitializer(BoundGlobalStatementInitializer node)
{
VisitStatement(node.Statement);
return null;
}
public override BoundNode VisitLambda(BoundLambda node) => null;
public override BoundNode VisitLocal(BoundLocal node)
{
SplitIfBooleanConstant(node);
return null;
}
public override BoundNode VisitLocalDeclaration(BoundLocalDeclaration node)
{
if (node.InitializerOpt != null)
{
// analyze the expression
VisitRvalue(node.InitializerOpt, isKnownToBeAnLvalue: node.LocalSymbol.RefKind != RefKind.None);
// byref assignment is also a potential write
if (node.LocalSymbol.RefKind != RefKind.None)
{
WriteArgument(node.InitializerOpt, node.LocalSymbol.RefKind, method: null);
}
}
return null;
}
public override BoundNode VisitBlock(BoundBlock node)
{
VisitStatements(node.Statements);
return null;
}
private void VisitStatements(ImmutableArray<BoundStatement> statements)
{
foreach (var statement in statements)
{
VisitStatement(statement);
}
}
public override BoundNode VisitScope(BoundScope node)
{
VisitStatements(node.Statements);
return null;
}
public override BoundNode VisitExpressionStatement(BoundExpressionStatement node)
{
VisitRvalue(node.Expression);
return null;
}
public override BoundNode VisitCall(BoundCall node)
{
// If the method being called is a partial method without a definition, or is a conditional method
// whose condition is not true, then the call has no effect and it is ignored for the purposes of
// definite assignment analysis.
bool callsAreOmitted = node.Method.CallsAreOmitted(node.SyntaxTree);
TLocalState savedState = default(TLocalState);
if (callsAreOmitted)
{
savedState = this.State.Clone();
SetUnreachable();
}
VisitReceiverBeforeCall(node.ReceiverOpt, node.Method);
VisitArgumentsBeforeCall(node.Arguments, node.ArgumentRefKindsOpt);
if (node.Method?.OriginalDefinition is LocalFunctionSymbol localFunc)
{
VisitLocalFunctionUse(localFunc, node.Syntax, isCall: true);
}
VisitArgumentsAfterCall(node.Arguments, node.ArgumentRefKindsOpt, node.Method);
VisitReceiverAfterCall(node.ReceiverOpt, node.Method);
if (callsAreOmitted)
{
this.State = savedState;
}
return null;
}
protected void VisitLocalFunctionUse(LocalFunctionSymbol symbol, SyntaxNode syntax, bool isCall)
{
var localFuncState = GetOrCreateLocalFuncUsages(symbol);
VisitLocalFunctionUse(symbol, localFuncState, syntax, isCall);
}
protected virtual void VisitLocalFunctionUse(
LocalFunctionSymbol symbol,
TLocalFunctionState localFunctionState,
SyntaxNode syntax,
bool isCall)
{
if (isCall)
{
Join(ref State, ref localFunctionState.StateFromBottom);
Meet(ref State, ref localFunctionState.StateFromTop);
}
localFunctionState.Visited = true;
}
private void VisitReceiverBeforeCall(BoundExpression receiverOpt, MethodSymbol method)
{
if (method is null || method.MethodKind != MethodKind.Constructor)
{
VisitRvalue(receiverOpt);
}
}
private void VisitReceiverAfterCall(BoundExpression receiverOpt, MethodSymbol method)
{
if (receiverOpt is null)
{
return;
}
if (method is null)
{
WriteArgument(receiverOpt, RefKind.Ref, method: null);
}
else if (method.TryGetThisParameter(out var thisParameter)
&& thisParameter is object
&& !TypeIsImmutable(thisParameter.Type))
{
var thisRefKind = thisParameter.RefKind;
if (thisRefKind.IsWritableReference())
{
WriteArgument(receiverOpt, thisRefKind, method);
}
}
}
/// <summary>
/// Certain (struct) types are known by the compiler to be immutable. In these cases calling a method on
/// the type is known (by flow analysis) not to write the receiver.
/// </summary>
/// <param name="t"></param>
/// <returns></returns>
private static bool TypeIsImmutable(TypeSymbol t)
{
switch (t.SpecialType)
{
case SpecialType.System_Boolean:
case SpecialType.System_Char:
case SpecialType.System_SByte:
case SpecialType.System_Byte:
case SpecialType.System_Int16:
case SpecialType.System_UInt16:
case SpecialType.System_Int32:
case SpecialType.System_UInt32:
case SpecialType.System_Int64:
case SpecialType.System_UInt64:
case SpecialType.System_Decimal:
case SpecialType.System_Single:
case SpecialType.System_Double:
case SpecialType.System_DateTime:
return true;
default:
return t.IsNullableType();
}
}
public override BoundNode VisitIndexerAccess(BoundIndexerAccess node)
{
var method = GetReadMethod(node.Indexer);
VisitReceiverBeforeCall(node.ReceiverOpt, method);
VisitArguments(node.Arguments, node.ArgumentRefKindsOpt, method);
if ((object)method != null)
{
VisitReceiverAfterCall(node.ReceiverOpt, method);
}
return null;
}
public override BoundNode VisitIndexOrRangePatternIndexerAccess(BoundIndexOrRangePatternIndexerAccess node)
{
// Index or Range pattern indexers evaluate the following in order:
// 1. The receiver
// 1. The Count or Length method off the receiver
// 2. The argument to the access
// 3. The pattern method
VisitRvalue(node.Receiver);
var method = GetReadMethod(node.LengthOrCountProperty);
VisitReceiverAfterCall(node.Receiver, method);
VisitRvalue(node.Argument);
method = node.PatternSymbol switch
{
PropertySymbol p => GetReadMethod(p),
MethodSymbol m => m,
_ => throw ExceptionUtilities.UnexpectedValue(node.PatternSymbol)
};
VisitReceiverAfterCall(node.Receiver, method);
return null;
}
public override BoundNode VisitEventAssignmentOperator(BoundEventAssignmentOperator node)
{
VisitRvalue(node.ReceiverOpt);
VisitRvalue(node.Argument);
return null;
}
/// <summary>
/// Do not call for a local function.
/// </summary>
protected virtual void VisitArguments(ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> refKindsOpt, MethodSymbol method)
{
Debug.Assert(method?.OriginalDefinition.MethodKind != MethodKind.LocalFunction);
VisitArgumentsBeforeCall(arguments, refKindsOpt);
VisitArgumentsAfterCall(arguments, refKindsOpt, method);
}
private void VisitArgumentsBeforeCall(ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> refKindsOpt)
{
// first value and ref parameters are read...
for (int i = 0; i < arguments.Length; i++)
{
RefKind refKind = GetRefKind(refKindsOpt, i);
if (refKind != RefKind.Out)
{
VisitRvalue(arguments[i], isKnownToBeAnLvalue: refKind != RefKind.None);
}
else
{
VisitLvalue(arguments[i]);
}
}
}
/// <summary>
/// Writes ref and out parameters
/// </summary>
private void VisitArgumentsAfterCall(ImmutableArray<BoundExpression> arguments, ImmutableArray<RefKind> refKindsOpt, MethodSymbol method)
{
for (int i = 0; i < arguments.Length; i++)
{
RefKind refKind = GetRefKind(refKindsOpt, i);
// passing as a byref argument is also a potential write
if (refKind != RefKind.None)
{
WriteArgument(arguments[i], refKind, method);
}
}
}
protected static RefKind GetRefKind(ImmutableArray<RefKind> refKindsOpt, int index)
{
return refKindsOpt.IsDefault || refKindsOpt.Length <= index ? RefKind.None : refKindsOpt[index];
}
protected virtual void WriteArgument(BoundExpression arg, RefKind refKind, MethodSymbol method)
{
}
public override BoundNode VisitBadExpression(BoundBadExpression node)
{
foreach (var child in node.ChildBoundNodes)
{
VisitRvalue(child as BoundExpression);
}
return null;
}
public override BoundNode VisitBadStatement(BoundBadStatement node)
{
foreach (var child in node.ChildBoundNodes)
{
if (child is BoundStatement)
{
VisitStatement(child as BoundStatement);
}
else
{
VisitRvalue(child as BoundExpression);
}
}
return null;
}
// Can be called as part of a bad expression.
public override BoundNode VisitArrayInitialization(BoundArrayInitialization node)
{
foreach (var child in node.Initializers)
{
VisitRvalue(child);
}
return null;
}
public override BoundNode VisitDelegateCreationExpression(BoundDelegateCreationExpression node)
{
var methodGroup = node.Argument as BoundMethodGroup;
if (methodGroup != null)
{
if ((object)node.MethodOpt != null && node.MethodOpt.RequiresInstanceReceiver)
{
EnterRegionIfNeeded(methodGroup);
VisitRvalue(methodGroup.ReceiverOpt);
LeaveRegionIfNeeded(methodGroup);
}
else if (node.MethodOpt?.OriginalDefinition is LocalFunctionSymbol localFunc)
{
VisitLocalFunctionUse(localFunc, node.Syntax, isCall: false);
}
}
else
{
VisitRvalue(node.Argument);
}
return null;
}
public override BoundNode VisitTypeExpression(BoundTypeExpression node)
{
return null;
}
public override BoundNode VisitTypeOrValueExpression(BoundTypeOrValueExpression node)
{
// If we're seeing a node of this kind, then we failed to resolve the member access
// as either a type or a property/field/event/local/parameter. In such cases,
// the second interpretation applies so just visit the node for that.
return this.Visit(node.Data.ValueExpression);
}
public override BoundNode VisitLiteral(BoundLiteral node)
{
SplitIfBooleanConstant(node);
return null;
}
protected void SplitIfBooleanConstant(BoundExpression node)
{
if (node.ConstantValue is { IsBoolean: true, BooleanValue: bool booleanValue })
{
var unreachable = UnreachableState();
Split();
if (booleanValue)
{
StateWhenFalse = unreachable;
}
else
{
StateWhenTrue = unreachable;
}
}
}
public override BoundNode VisitMethodDefIndex(BoundMethodDefIndex node)
{
return null;
}
public override BoundNode VisitMaximumMethodDefIndex(BoundMaximumMethodDefIndex node)
{
return null;
}
public override BoundNode VisitModuleVersionId(BoundModuleVersionId node)
{
return null;
}
public override BoundNode VisitModuleVersionIdString(BoundModuleVersionIdString node)
{
return null;
}
public override BoundNode VisitInstrumentationPayloadRoot(BoundInstrumentationPayloadRoot node)
{
return null;
}
public override BoundNode VisitSourceDocumentIndex(BoundSourceDocumentIndex node)
{
return null;
}
public override BoundNode VisitConversion(BoundConversion node)
{
if (node.ConversionKind == ConversionKind.MethodGroup)
{
if (node.IsExtensionMethod || ((object)node.SymbolOpt != null && node.SymbolOpt.RequiresInstanceReceiver))
{
BoundExpression receiver = ((BoundMethodGroup)node.Operand).ReceiverOpt;
// A method group's "implicit this" is only used for instance methods.
EnterRegionIfNeeded(node.Operand);
VisitRvalue(receiver);
LeaveRegionIfNeeded(node.Operand);
}
else if (node.SymbolOpt?.OriginalDefinition is LocalFunctionSymbol localFunc)
{
VisitLocalFunctionUse(localFunc, node.Syntax, isCall: false);
}
}
else
{
Visit(node.Operand);
}
return null;
}
public override BoundNode VisitIfStatement(BoundIfStatement node)
{
// 5.3.3.5 If statements
VisitCondition(node.Condition);
TLocalState trueState = StateWhenTrue;
TLocalState falseState = StateWhenFalse;
SetState(trueState);
VisitStatement(node.Consequence);
trueState = this.State;
SetState(falseState);
if (node.AlternativeOpt != null)
{
VisitStatement(node.AlternativeOpt);
}
Join(ref this.State, ref trueState);
return null;
}
public override BoundNode VisitTryStatement(BoundTryStatement node)
{
var oldPending = SavePending(); // we do not allow branches into a try statement
var initialState = this.State.Clone();
// use this state to resolve all the branches introduced and internal to try/catch
var pendingBeforeTry = SavePending();
VisitTryBlockWithAnyTransferFunction(node.TryBlock, node, ref initialState);
var finallyState = initialState.Clone();
var endState = this.State;
foreach (var catchBlock in node.CatchBlocks)
{
SetState(initialState.Clone());
VisitCatchBlockWithAnyTransferFunction(catchBlock, ref finallyState);
Join(ref endState, ref this.State);
}
// Give a chance to branches internal to try/catch to resolve.
// Carry forward unresolved branches.
RestorePending(pendingBeforeTry);
// NOTE: At this point all branches that are internal to try or catch blocks have been resolved.
// However we have not yet restored the oldPending branches. Therefore all the branches
// that are currently pending must have been introduced in try/catch and do not terminate inside those blocks.
//
// With exception of YieldReturn, these branches logically go through finally, if such present,
// so we must Union/Intersect finally state as appropriate
if (node.FinallyBlockOpt != null)
{
// branches from the finally block, while illegal, should still not be considered
// to execute the finally block before occurring. Also, we do not handle branches
// *into* the finally block.
SetState(finallyState);
// capture tryAndCatchPending before going into finally
// we will need pending branches as they were before finally later
var tryAndCatchPending = SavePending();
var stateMovedUpInFinally = ReachableBottomState();
VisitFinallyBlockWithAnyTransferFunction(node.FinallyBlockOpt, ref stateMovedUpInFinally);
foreach (var pend in tryAndCatchPending.PendingBranches)
{
if (pend.Branch == null)
{
continue; // a tracked exception
}
if (pend.Branch.Kind != BoundKind.YieldReturnStatement)
{
updatePendingBranchState(ref pend.State, ref stateMovedUpInFinally);
if (pend.IsConditionalState)
{
updatePendingBranchState(ref pend.StateWhenTrue, ref stateMovedUpInFinally);
updatePendingBranchState(ref pend.StateWhenFalse, ref stateMovedUpInFinally);
}
}
}
RestorePending(tryAndCatchPending);
Meet(ref endState, ref this.State);
if (_nonMonotonicTransfer)
{
Join(ref endState, ref stateMovedUpInFinally);
}
}
SetState(endState);
RestorePending(oldPending);
return null;
void updatePendingBranchState(ref TLocalState stateToUpdate, ref TLocalState stateMovedUpInFinally)
{
Meet(ref stateToUpdate, ref this.State);
if (_nonMonotonicTransfer)
{
Join(ref stateToUpdate, ref stateMovedUpInFinally);
}
}
}
protected Optional<TLocalState> NonMonotonicState;
/// <summary>
/// Join state from other try block, potentially in a nested method.
/// </summary>
protected virtual void JoinTryBlockState(ref TLocalState self, ref TLocalState other)
{
Join(ref self, ref other);
}
private void VisitTryBlockWithAnyTransferFunction(BoundStatement tryBlock, BoundTryStatement node, ref TLocalState tryState)
{
if (_nonMonotonicTransfer)
{
Optional<TLocalState> oldTryState = NonMonotonicState;
NonMonotonicState = ReachableBottomState();
VisitTryBlock(tryBlock, node, ref tryState);
var tempTryStateValue = NonMonotonicState.Value;
Join(ref tryState, ref tempTryStateValue);
if (oldTryState.HasValue)
{
var oldTryStateValue = oldTryState.Value;
JoinTryBlockState(ref oldTryStateValue, ref tempTryStateValue);
oldTryState = oldTryStateValue;
}
NonMonotonicState = oldTryState;
}
else
{
VisitTryBlock(tryBlock, node, ref tryState);
}
}
protected virtual void VisitTryBlock(BoundStatement tryBlock, BoundTryStatement node, ref TLocalState tryState)
{
VisitStatement(tryBlock);
}
private void VisitCatchBlockWithAnyTransferFunction(BoundCatchBlock catchBlock, ref TLocalState finallyState)
{
if (_nonMonotonicTransfer)
{
Optional<TLocalState> oldTryState = NonMonotonicState;
NonMonotonicState = ReachableBottomState();
VisitCatchBlock(catchBlock, ref finallyState);
var tempTryStateValue = NonMonotonicState.Value;
Join(ref finallyState, ref tempTryStateValue);
if (oldTryState.HasValue)
{
var oldTryStateValue = oldTryState.Value;
JoinTryBlockState(ref oldTryStateValue, ref tempTryStateValue);
oldTryState = oldTryStateValue;
}
NonMonotonicState = oldTryState;
}
else
{
VisitCatchBlock(catchBlock, ref finallyState);
}
}
protected virtual void VisitCatchBlock(BoundCatchBlock catchBlock, ref TLocalState finallyState)
{
if (catchBlock.ExceptionSourceOpt != null)
{
VisitLvalue(catchBlock.ExceptionSourceOpt);
}
if (catchBlock.ExceptionFilterPrologueOpt is { })
{
VisitStatementList(catchBlock.ExceptionFilterPrologueOpt);
}
if (catchBlock.ExceptionFilterOpt != null)
{
VisitCondition(catchBlock.ExceptionFilterOpt);
SetState(StateWhenTrue);
}
VisitStatement(catchBlock.Body);
}
private void VisitFinallyBlockWithAnyTransferFunction(BoundStatement finallyBlock, ref TLocalState stateMovedUp)
{
if (_nonMonotonicTransfer)
{
Optional<TLocalState> oldTryState = NonMonotonicState;
NonMonotonicState = ReachableBottomState();
VisitFinallyBlock(finallyBlock, ref stateMovedUp);
var tempTryStateValue = NonMonotonicState.Value;
Join(ref stateMovedUp, ref tempTryStateValue);
if (oldTryState.HasValue)
{
var oldTryStateValue = oldTryState.Value;
JoinTryBlockState(ref oldTryStateValue, ref tempTryStateValue);
oldTryState = oldTryStateValue;
}
NonMonotonicState = oldTryState;
}
else
{
VisitFinallyBlock(finallyBlock, ref stateMovedUp);
}
}
protected virtual void VisitFinallyBlock(BoundStatement finallyBlock, ref TLocalState stateMovedUp)
{
VisitStatement(finallyBlock); // this should generate no pending branches
}
public override BoundNode VisitExtractedFinallyBlock(BoundExtractedFinallyBlock node)
{
return VisitBlock(node.FinallyBlock);
}
public override BoundNode VisitReturnStatement(BoundReturnStatement node)
{
var result = VisitReturnStatementNoAdjust(node);
PendingBranches.Add(new PendingBranch(node, this.State, label: null));
SetUnreachable();
return result;
}
protected virtual BoundNode VisitReturnStatementNoAdjust(BoundReturnStatement node)
{
VisitRvalue(node.ExpressionOpt, isKnownToBeAnLvalue: node.RefKind != RefKind.None);
// byref return is also a potential write
if (node.RefKind != RefKind.None)
{
WriteArgument(node.ExpressionOpt, node.RefKind, method: null);
}
return null;
}
public override BoundNode VisitThisReference(BoundThisReference node)
{
return null;
}
public override BoundNode VisitPreviousSubmissionReference(BoundPreviousSubmissionReference node)
{
return null;
}
public override BoundNode VisitHostObjectMemberReference(BoundHostObjectMemberReference node)
{
return null;
}
public override BoundNode VisitParameter(BoundParameter node)
{
return null;
}
protected virtual void VisitLvalueParameter(BoundParameter node)
{
}
public override BoundNode VisitObjectCreationExpression(BoundObjectCreationExpression node)
{
VisitArguments(node.Arguments, node.ArgumentRefKindsOpt, node.Constructor);
VisitRvalue(node.InitializerExpressionOpt);
return null;
}
public override BoundNode VisitNewT(BoundNewT node)
{
VisitRvalue(node.InitializerExpressionOpt);
return null;
}
public override BoundNode VisitNoPiaObjectCreationExpression(BoundNoPiaObjectCreationExpression node)
{
VisitRvalue(node.InitializerExpressionOpt);
return null;
}
// represents anything that occurs at the invocation of the property setter
protected virtual void PropertySetter(BoundExpression node, BoundExpression receiver, MethodSymbol setter, BoundExpression value = null)
{
VisitReceiverAfterCall(receiver, setter);
}
// returns false if expression is not a property access
// or if the property has a backing field
// and accessed in a corresponding constructor
private bool RegularPropertyAccess(BoundExpression expr)
{
if (expr.Kind != BoundKind.PropertyAccess)
{
return false;
}
return !Binder.AccessingAutoPropertyFromConstructor((BoundPropertyAccess)expr, _symbol);
}
public override BoundNode VisitAssignmentOperator(BoundAssignmentOperator node)
{
// TODO: should events be handled specially too?
if (RegularPropertyAccess(node.Left))
{
var left = (BoundPropertyAccess)node.Left;
var property = left.PropertySymbol;
if (property.RefKind == RefKind.None)
{
var method = GetWriteMethod(property);
VisitReceiverBeforeCall(left.ReceiverOpt, method);
VisitRvalue(node.Right);
PropertySetter(node, left.ReceiverOpt, method, node.Right);
return null;
}
}
VisitLvalue(node.Left);
VisitRvalue(node.Right, isKnownToBeAnLvalue: node.IsRef);
// byref assignment is also a potential write
if (node.IsRef)
{
// Assume that BadExpression is a ref location to avoid
// cascading diagnostics
var refKind = node.Left.Kind == BoundKind.BadExpression
? RefKind.Ref
: node.Left.GetRefKind();
WriteArgument(node.Right, refKind, method: null);
}
return null;
}
public override BoundNode VisitDeconstructionAssignmentOperator(BoundDeconstructionAssignmentOperator node)
{
VisitLvalue(node.Left);
VisitRvalue(node.Right);
return null;
}
public sealed override BoundNode VisitOutDeconstructVarPendingInference(OutDeconstructVarPendingInference node)
{
// OutDeconstructVarPendingInference nodes are only used within initial binding, but don't survive past that stage
throw ExceptionUtilities.Unreachable;
}
public override BoundNode VisitCompoundAssignmentOperator(BoundCompoundAssignmentOperator node)
{
VisitCompoundAssignmentTarget(node);
VisitRvalue(node.Right);
AfterRightHasBeenVisited(node);
return null;
}
protected void VisitCompoundAssignmentTarget(BoundCompoundAssignmentOperator node)
{
// TODO: should events be handled specially too?
if (RegularPropertyAccess(node.Left))
{
var left = (BoundPropertyAccess)node.Left;
var property = left.PropertySymbol;
if (property.RefKind == RefKind.None)
{
var readMethod = GetReadMethod(property);
Debug.Assert(node.HasAnyErrors || (object)readMethod != (object)GetWriteMethod(property));
VisitReceiverBeforeCall(left.ReceiverOpt, readMethod);
VisitReceiverAfterCall(left.ReceiverOpt, readMethod);
return;
}
}
VisitRvalue(node.Left, isKnownToBeAnLvalue: true);
}
protected void AfterRightHasBeenVisited(BoundCompoundAssignmentOperator node)
{
if (RegularPropertyAccess(node.Left))
{
var left = (BoundPropertyAccess)node.Left;
var property = left.PropertySymbol;
if (property.RefKind == RefKind.None)
{
var writeMethod = GetWriteMethod(property);
PropertySetter(node, left.ReceiverOpt, writeMethod);
VisitReceiverAfterCall(left.ReceiverOpt, writeMethod);
return;
}
}
}
public override BoundNode VisitFieldAccess(BoundFieldAccess node)
{
VisitFieldAccessInternal(node.ReceiverOpt, node.FieldSymbol);
SplitIfBooleanConstant(node);
return null;
}
private void VisitFieldAccessInternal(BoundExpression receiverOpt, FieldSymbol fieldSymbol)
{
bool asLvalue = (object)fieldSymbol != null &&
(fieldSymbol.IsFixedSizeBuffer ||
!fieldSymbol.IsStatic &&
fieldSymbol.ContainingType.TypeKind == TypeKind.Struct &&
receiverOpt != null &&
receiverOpt.Kind != BoundKind.TypeExpression &&
(object)receiverOpt.Type != null &&
!receiverOpt.Type.IsPrimitiveRecursiveStruct());
if (asLvalue)
{
VisitLvalue(receiverOpt);
}
else
{
VisitRvalue(receiverOpt);
}
}
public override BoundNode VisitFieldInfo(BoundFieldInfo node)
{
return null;
}
public override BoundNode VisitMethodInfo(BoundMethodInfo node)
{
return null;
}
public override BoundNode VisitPropertyAccess(BoundPropertyAccess node)
{
var property = node.PropertySymbol;
if (Binder.AccessingAutoPropertyFromConstructor(node, _symbol))
{
var backingField = (property as SourcePropertySymbolBase)?.BackingField;
if (backingField != null)
{
VisitFieldAccessInternal(node.ReceiverOpt, backingField);
return null;
}
}
var method = GetReadMethod(property);
VisitReceiverBeforeCall(node.ReceiverOpt, method);
VisitReceiverAfterCall(node.ReceiverOpt, method);
return null;
// TODO: In an expression such as
// M().Prop = G();
// Exceptions thrown from M() occur before those from G(), but exceptions from the property accessor
// occur after both. The precise abstract flow pass does not yet currently have this quite right.
// Probably what is needed is a VisitPropertyAccessInternal(BoundPropertyAccess node, bool read)
// which should assume that the receiver will have been handled by the caller. This can be invoked
// twice for read/write operations such as
// M().Prop += 1
// or at the appropriate place in the sequence for read or write operations.
// Do events require any special handling too?
}
public override BoundNode VisitEventAccess(BoundEventAccess node)
{
VisitFieldAccessInternal(node.ReceiverOpt, node.EventSymbol.AssociatedField);
return null;
}
public override BoundNode VisitRangeVariable(BoundRangeVariable node)
{
return null;
}
public override BoundNode VisitQueryClause(BoundQueryClause node)
{
VisitRvalue(node.UnoptimizedForm ?? node.Value);
return null;
}
private BoundNode VisitMultipleLocalDeclarationsBase(BoundMultipleLocalDeclarationsBase node)
{
foreach (var v in node.LocalDeclarations)
{
Visit(v);
}
return null;
}
public override BoundNode VisitMultipleLocalDeclarations(BoundMultipleLocalDeclarations node)
{
return VisitMultipleLocalDeclarationsBase(node);
}
public override BoundNode VisitUsingLocalDeclarations(BoundUsingLocalDeclarations node)
{
if (AwaitUsingAndForeachAddsPendingBranch && node.AwaitOpt != null)
{
PendingBranches.Add(new PendingBranch(node, this.State, null));
}
return VisitMultipleLocalDeclarationsBase(node);
}
public override BoundNode VisitWhileStatement(BoundWhileStatement node)
{
// while (node.Condition) { node.Body; node.ContinueLabel: } node.BreakLabel:
LoopHead(node);
VisitCondition(node.Condition);
TLocalState bodyState = StateWhenTrue;
TLocalState breakState = StateWhenFalse;
SetState(bodyState);
VisitStatement(node.Body);
ResolveContinues(node.ContinueLabel);
LoopTail(node);
ResolveBreaks(breakState, node.BreakLabel);
return null;
}
public override BoundNode VisitWithExpression(BoundWithExpression node)
{
VisitRvalue(node.Receiver);
VisitObjectOrCollectionInitializerExpression(node.InitializerExpression.Initializers);
return null;
}
public override BoundNode VisitArrayAccess(BoundArrayAccess node)
{
VisitRvalue(node.Expression);
foreach (var i in node.Indices)
{
VisitRvalue(i);
}
return null;
}
public override BoundNode VisitBinaryOperator(BoundBinaryOperator node)
{
if (node.OperatorKind.IsLogical())
{
Debug.Assert(!node.OperatorKind.IsUserDefined());
VisitBinaryLogicalOperatorChildren(node);
}
else if (node.InterpolatedStringHandlerData is { } data)
{
VisitBinaryInterpolatedStringAddition(node);
}
else
{
VisitBinaryOperatorChildren(node);
}
return null;
}
public override BoundNode VisitUserDefinedConditionalLogicalOperator(BoundUserDefinedConditionalLogicalOperator node)
{
VisitBinaryLogicalOperatorChildren(node);
return null;
}
private void VisitBinaryLogicalOperatorChildren(BoundExpression node)
{
// Do not blow the stack due to a deep recursion on the left.
var stack = ArrayBuilder<BoundExpression>.GetInstance();
BoundExpression binary;
BoundExpression child = node;
while (true)
{
var childKind = child.Kind;
if (childKind == BoundKind.BinaryOperator)
{
var binOp = (BoundBinaryOperator)child;
if (!binOp.OperatorKind.IsLogical())
{
break;
}
Debug.Assert(!binOp.OperatorKind.IsUserDefined());
binary = child;
child = binOp.Left;
}
else if (childKind == BoundKind.UserDefinedConditionalLogicalOperator)
{
binary = child;
child = ((BoundUserDefinedConditionalLogicalOperator)binary).Left;
}
else
{
break;
}
stack.Push(binary);
}
Debug.Assert(stack.Count > 0);
VisitCondition(child);
while (true)
{
binary = stack.Pop();
BinaryOperatorKind kind;
BoundExpression right;
switch (binary.Kind)
{
case BoundKind.BinaryOperator:
var binOp = (BoundBinaryOperator)binary;
kind = binOp.OperatorKind;
right = binOp.Right;
break;
case BoundKind.UserDefinedConditionalLogicalOperator:
var udBinOp = (BoundUserDefinedConditionalLogicalOperator)binary;
kind = udBinOp.OperatorKind;
right = udBinOp.Right;
break;
default:
throw ExceptionUtilities.UnexpectedValue(binary.Kind);
}
var op = kind.Operator();
var isAnd = op == BinaryOperatorKind.And;
var isBool = kind.OperandTypes() == BinaryOperatorKind.Bool;
Debug.Assert(isAnd || op == BinaryOperatorKind.Or);
var leftTrue = this.StateWhenTrue;
var leftFalse = this.StateWhenFalse;
SetState(isAnd ? leftTrue : leftFalse);
AfterLeftChildOfBinaryLogicalOperatorHasBeenVisited(binary, right, isAnd, isBool, ref leftTrue, ref leftFalse);
if (stack.Count == 0)
{
break;
}
AdjustConditionalState(binary);
}
Debug.Assert((object)binary == node);
stack.Free();
}
protected virtual void AfterLeftChildOfBinaryLogicalOperatorHasBeenVisited(BoundExpression binary, BoundExpression right, bool isAnd, bool isBool, ref TLocalState leftTrue, ref TLocalState leftFalse)
{
Visit(right); // First part of VisitCondition
AfterRightChildOfBinaryLogicalOperatorHasBeenVisited(binary, right, isAnd, isBool, ref leftTrue, ref leftFalse);
}
protected void AfterRightChildOfBinaryLogicalOperatorHasBeenVisited(BoundExpression binary, BoundExpression right, bool isAnd, bool isBool, ref TLocalState leftTrue, ref TLocalState leftFalse)
{
AdjustConditionalState(right); // Second part of VisitCondition
if (!isBool)
{
this.Unsplit();
this.Split();
}
var resultTrue = this.StateWhenTrue;
var resultFalse = this.StateWhenFalse;
if (isAnd)
{
Join(ref resultFalse, ref leftFalse);
}
else
{
Join(ref resultTrue, ref leftTrue);
}
SetConditionalState(resultTrue, resultFalse);
if (!isBool)
{
this.Unsplit();
}
}
private void VisitBinaryOperatorChildren(BoundBinaryOperator node)
{
// It is common in machine-generated code for there to be deep recursion on the left side of a binary
// operator, for example, if you have "a + b + c + ... " then the bound tree will be deep on the left
// hand side. To mitigate the risk of stack overflow we use an explicit stack.
//
// Of course we must ensure that we visit the left hand side before the right hand side.
var stack = ArrayBuilder<BoundBinaryOperator>.GetInstance();
BoundBinaryOperator binary = node;
do
{
stack.Push(binary);
binary = binary.Left as BoundBinaryOperator;
}
while (binary != null && !binary.OperatorKind.IsLogical() && binary.InterpolatedStringHandlerData is null);
VisitBinaryOperatorChildren(stack);
stack.Free();
}
#nullable enable
protected virtual void VisitBinaryOperatorChildren(ArrayBuilder<BoundBinaryOperator> stack)
{
var binary = stack.Pop();
// Only the leftmost operator of a left-associative binary operator chain can learn from a conditional access on the left
// For simplicity, we just special case it here.
// For example, `a?.b(out x) == true` has a conditional access on the left of the operator,
// but `expr == a?.b(out x) == true` has a conditional access on the right of the operator
if (VisitPossibleConditionalAccess(binary.Left, out var stateWhenNotNull)
&& canLearnFromOperator(binary)
&& isKnownNullOrNotNull(binary.Right))
{
if (_nonMonotonicTransfer)
{
// In this very specific scenario, we need to do extra work to track unassignments for region analysis.
// See `AbstractFlowPass.VisitCatchBlockWithAnyTransferFunction` for a similar scenario in catch blocks.
Optional<TLocalState> oldState = NonMonotonicState;
NonMonotonicState = ReachableBottomState();
VisitRvalue(binary.Right);
var tempStateValue = NonMonotonicState.Value;
Join(ref stateWhenNotNull, ref tempStateValue);
if (oldState.HasValue)
{
var oldStateValue = oldState.Value;
Join(ref oldStateValue, ref tempStateValue);
oldState = oldStateValue;
}
NonMonotonicState = oldState;
}
else
{
VisitRvalue(binary.Right);
Meet(ref stateWhenNotNull, ref State);
}
var isNullConstant = binary.Right.ConstantValue?.IsNull == true;
SetConditionalState(isNullConstant == isEquals(binary)
? (State, stateWhenNotNull)
: (stateWhenNotNull, State));
if (stack.Count == 0)
{
return;
}
binary = stack.Pop();
}
while (true)
{
if (!canLearnFromOperator(binary)
|| !learnFromOperator(binary))
{
Unsplit();
Visit(binary.Right);
}
if (stack.Count == 0)
{
break;
}
binary = stack.Pop();
}
static bool canLearnFromOperator(BoundBinaryOperator binary)
{
var kind = binary.OperatorKind;
return kind.Operator() is BinaryOperatorKind.Equal or BinaryOperatorKind.NotEqual
&& (!kind.IsUserDefined() || kind.IsLifted());
}
static bool isKnownNullOrNotNull(BoundExpression expr)
{
return expr.ConstantValue is object
|| (expr is BoundConversion { ConversionKind: ConversionKind.ExplicitNullable or ConversionKind.ImplicitNullable } conv
&& conv.Operand.Type!.IsNonNullableValueType());
}
static bool isEquals(BoundBinaryOperator binary)
=> binary.OperatorKind.Operator() == BinaryOperatorKind.Equal;
// Returns true if `binary.Right` was visited by the call.
bool learnFromOperator(BoundBinaryOperator binary)
{
// `true == a?.b(out x)`
if (isKnownNullOrNotNull(binary.Left) && TryVisitConditionalAccess(binary.Right, out var stateWhenNotNull))
{
var isNullConstant = binary.Left.ConstantValue?.IsNull == true;
SetConditionalState(isNullConstant == isEquals(binary)
? (State, stateWhenNotNull)
: (stateWhenNotNull, State));
return true;
}
// `a && b(out x) == true`
else if (IsConditionalState && binary.Right.ConstantValue is { IsBoolean: true } rightConstant)
{
var (stateWhenTrue, stateWhenFalse) = (StateWhenTrue.Clone(), StateWhenFalse.Clone());
Unsplit();
Visit(binary.Right);
SetConditionalState(isEquals(binary) == rightConstant.BooleanValue
? (stateWhenTrue, stateWhenFalse)
: (stateWhenFalse, stateWhenTrue));
return true;
}
// `true == a && b(out x)`
else if (binary.Left.ConstantValue is { IsBoolean: true } leftConstant)
{
Unsplit();
Visit(binary.Right);
if (IsConditionalState && isEquals(binary) != leftConstant.BooleanValue)
{
SetConditionalState(StateWhenFalse, StateWhenTrue);
}
return true;
}
return false;
}
}
protected void VisitBinaryInterpolatedStringAddition(BoundBinaryOperator node)
{
Debug.Assert(node.InterpolatedStringHandlerData.HasValue);
var stack = ArrayBuilder<BoundInterpolatedString>.GetInstance();
var data = node.InterpolatedStringHandlerData.GetValueOrDefault();
while (PushBinaryOperatorInterpolatedStringChildren(node, stack) is { } next)
{
node = next;
}
Debug.Assert(stack.Count >= 2);
VisitRvalue(data.Construction);
bool visitedFirst = false;
bool hasTrailingHandlerValidityParameter = data.HasTrailingHandlerValidityParameter;
bool hasConditionalEvaluation = data.UsesBoolReturns || hasTrailingHandlerValidityParameter;
TLocalState? shortCircuitState = hasConditionalEvaluation ? State.Clone() : default;
while (stack.TryPop(out var currentString))
{
visitedFirst |= VisitInterpolatedStringHandlerParts(currentString, data.UsesBoolReturns, firstPartIsConditional: visitedFirst || hasTrailingHandlerValidityParameter, ref shortCircuitState);
}
if (hasConditionalEvaluation)
{
Join(ref State, ref shortCircuitState);
}
stack.Free();
}
protected virtual BoundBinaryOperator? PushBinaryOperatorInterpolatedStringChildren(BoundBinaryOperator node, ArrayBuilder<BoundInterpolatedString> stack)
{
stack.Push((BoundInterpolatedString)node.Right);
switch (node.Left)
{
case BoundBinaryOperator next:
return next;
case BoundInterpolatedString @string:
stack.Push(@string);
return null;
default:
throw ExceptionUtilities.UnexpectedValue(node.Left.Kind);
}
}
protected virtual bool VisitInterpolatedStringHandlerParts(BoundInterpolatedStringBase node, bool usesBoolReturns, bool firstPartIsConditional, ref TLocalState? shortCircuitState)
{
Debug.Assert(shortCircuitState != null || (!usesBoolReturns && !firstPartIsConditional));
if (node.Parts.IsEmpty)
{
return false;
}
ReadOnlySpan<BoundExpression> parts;
if (firstPartIsConditional)
{
parts = node.Parts.AsSpan();
}
else
{
VisitRvalue(node.Parts[0]);
shortCircuitState = State.Clone();
parts = node.Parts.AsSpan()[1..];
}
foreach (var part in parts)
{
VisitRvalue(part);
if (usesBoolReturns)
{
Debug.Assert(shortCircuitState != null);
Join(ref shortCircuitState, ref State);
}
}
return true;
}
#nullable disable
public override BoundNode VisitUnaryOperator(BoundUnaryOperator node)
{
if (node.OperatorKind == UnaryOperatorKind.BoolLogicalNegation)
{
// We have a special case for the ! unary operator, which can operate in a boolean context (5.3.3.26)
VisitCondition(node.Operand);
// it inverts the sense of assignedWhenTrue and assignedWhenFalse.
SetConditionalState(StateWhenFalse, StateWhenTrue);
}
else
{
VisitRvalue(node.Operand);
}
return null;
}
public override BoundNode VisitRangeExpression(BoundRangeExpression node)
{
if (node.LeftOperandOpt != null)
{
VisitRvalue(node.LeftOperandOpt);
}
if (node.RightOperandOpt != null)
{
VisitRvalue(node.RightOperandOpt);
}
return null;
}
public override BoundNode VisitFromEndIndexExpression(BoundFromEndIndexExpression node)
{
VisitRvalue(node.Operand);
return null;
}
public override BoundNode VisitAwaitExpression(BoundAwaitExpression node)
{
VisitRvalue(node.Expression);
PendingBranches.Add(new PendingBranch(node, this.State, null));
return null;
}
public override BoundNode VisitIncrementOperator(BoundIncrementOperator node)
{
// TODO: should we also specially handle events?
if (RegularPropertyAccess(node.Operand))
{
var left = (BoundPropertyAccess)node.Operand;
var property = left.PropertySymbol;
if (property.RefKind == RefKind.None)
{
var readMethod = GetReadMethod(property);
var writeMethod = GetWriteMethod(property);
Debug.Assert(node.HasAnyErrors || (object)readMethod != (object)writeMethod);
VisitReceiverBeforeCall(left.ReceiverOpt, readMethod);
VisitReceiverAfterCall(left.ReceiverOpt, readMethod);
PropertySetter(node, left.ReceiverOpt, writeMethod); // followed by a write
return null;
}
}
VisitRvalue(node.Operand);
return null;
}
public override BoundNode VisitArrayCreation(BoundArrayCreation node)
{
foreach (var expr in node.Bounds)
{
VisitRvalue(expr);
}
if (node.InitializerOpt != null)
{
VisitArrayInitializationInternal(node, node.InitializerOpt);
}
return null;
}
private void VisitArrayInitializationInternal(BoundArrayCreation arrayCreation, BoundArrayInitialization node)
{
foreach (var child in node.Initializers)
{
if (child.Kind == BoundKind.ArrayInitialization)
{
VisitArrayInitializationInternal(arrayCreation, (BoundArrayInitialization)child);
}
else
{
VisitRvalue(child);
}
}
}
public override BoundNode VisitForStatement(BoundForStatement node)
{
if (node.Initializer != null)
{
VisitStatement(node.Initializer);
}
LoopHead(node);
TLocalState bodyState, breakState;
if (node.Condition != null)
{
VisitCondition(node.Condition);
bodyState = this.StateWhenTrue;
breakState = this.StateWhenFalse;
}
else
{
bodyState = this.State;
breakState = UnreachableState();
}
SetState(bodyState);
VisitStatement(node.Body);
ResolveContinues(node.ContinueLabel);
if (node.Increment != null)
{
VisitStatement(node.Increment);
}
LoopTail(node);
ResolveBreaks(breakState, node.BreakLabel);
return null;
}
public override BoundNode VisitForEachStatement(BoundForEachStatement node)
{
// foreach [await] ( var v in node.Expression ) { node.Body; node.ContinueLabel: } node.BreakLabel:
VisitForEachExpression(node);
var breakState = this.State.Clone();
LoopHead(node);
VisitForEachIterationVariables(node);
VisitStatement(node.Body);
ResolveContinues(node.ContinueLabel);
LoopTail(node);
ResolveBreaks(breakState, node.BreakLabel);
if (AwaitUsingAndForeachAddsPendingBranch && ((CommonForEachStatementSyntax)node.Syntax).AwaitKeyword != default)
{
PendingBranches.Add(new PendingBranch(node, this.State, null));
}
return null;
}
protected virtual void VisitForEachExpression(BoundForEachStatement node)
{
VisitRvalue(node.Expression);
}
public virtual void VisitForEachIterationVariables(BoundForEachStatement node)
{
}
public override BoundNode VisitAsOperator(BoundAsOperator node)
{
VisitRvalue(node.Operand);
return null;
}
public override BoundNode VisitIsOperator(BoundIsOperator node)
{
if (VisitPossibleConditionalAccess(node.Operand, out var stateWhenNotNull))
{
Debug.Assert(!IsConditionalState);
SetConditionalState(stateWhenNotNull, State);
}
else
{
// `(a && b.M(out x)) is bool` should discard conditional state from LHS
Unsplit();
}
return null;
}
public override BoundNode VisitMethodGroup(BoundMethodGroup node)
{
if (node.ReceiverOpt != null)
{
// An explicit or implicit receiver, for example in an expression such as (x.Goo is Action, or Goo is Action), is considered to be read.
VisitRvalue(node.ReceiverOpt);
}
return null;
}
#nullable enable
public override BoundNode? VisitNullCoalescingOperator(BoundNullCoalescingOperator node)
{
if (IsConstantNull(node.LeftOperand))
{
VisitRvalue(node.LeftOperand);
Visit(node.RightOperand);
}
else
{
TLocalState savedState;
if (VisitPossibleConditionalAccess(node.LeftOperand, out var stateWhenNotNull))
{
Debug.Assert(!IsConditionalState);
savedState = stateWhenNotNull;
}
else
{
Unsplit();
savedState = State.Clone();
}
if (node.LeftOperand.ConstantValue != null)
{
SetUnreachable();
}
Visit(node.RightOperand);
if (IsConditionalState)
{
Join(ref StateWhenTrue, ref savedState);
Join(ref StateWhenFalse, ref savedState);
}
else
{
Join(ref this.State, ref savedState);
}
}
return null;
}
/// <summary>
/// Visits a node only if it is a conditional access.
/// Returns 'true' if and only if the node was visited.
/// </summary>
private bool TryVisitConditionalAccess(BoundExpression node, [NotNullWhen(true)] out TLocalState? stateWhenNotNull)
{
var access = node switch
{
BoundConditionalAccess ca => ca,
BoundConversion { Conversion: Conversion conversion, Operand: BoundConditionalAccess ca } when CanPropagateStateWhenNotNull(conversion) => ca,
_ => null
};
if (access is not null)
{
EnterRegionIfNeeded(access);
Unsplit();
VisitConditionalAccess(access, out stateWhenNotNull);
Debug.Assert(!IsConditionalState);
LeaveRegionIfNeeded(access);
return true;
}
stateWhenNotNull = default;
return false;
}
/// <summary>
/// "State when not null" can only propagate out of a conditional access if
/// it is not subject to a user-defined conversion whose parameter is not of a non-nullable value type.
/// </summary>
protected static bool CanPropagateStateWhenNotNull(Conversion conversion)
{
if (!conversion.IsValid)
{
return false;
}
if (!conversion.IsUserDefined)
{
return true;
}
var method = conversion.Method;
Debug.Assert(method is object);
Debug.Assert(method.ParameterCount is 1);
var param = method.Parameters[0];
return param.Type.IsNonNullableValueType();
}
/// <summary>
/// Unconditionally visits an expression.
/// If the expression has "state when not null" after visiting,
/// the method returns 'true' and writes the state to <paramref name="stateWhenNotNull" />.
/// </summary>
private bool VisitPossibleConditionalAccess(BoundExpression node, [NotNullWhen(true)] out TLocalState? stateWhenNotNull)
{
if (TryVisitConditionalAccess(node, out stateWhenNotNull))
{
return true;
}
else
{
Visit(node);
return false;
}
}
private void VisitConditionalAccess(BoundConditionalAccess node, out TLocalState stateWhenNotNull)
{
// The receiver may also be a conditional access.
// `(a?.b(x = 1))?.c(y = 1)`
if (VisitPossibleConditionalAccess(node.Receiver, out var receiverStateWhenNotNull))
{
stateWhenNotNull = receiverStateWhenNotNull;
}
else
{
Unsplit();
stateWhenNotNull = this.State.Clone();
}
if (node.Receiver.ConstantValue != null && !IsConstantNull(node.Receiver))
{
// Consider a scenario like `"a"?.M0(x = 1)?.M0(y = 1)`.
// We can "know" that `.M0(x = 1)` was evaluated unconditionally but not `M0(y = 1)`.
// Therefore we do a VisitPossibleConditionalAccess here which unconditionally includes the "after receiver" state in State
// and includes the "after subsequent conditional accesses" in stateWhenNotNull
if (VisitPossibleConditionalAccess(node.AccessExpression, out var firstAccessStateWhenNotNull))
{
stateWhenNotNull = firstAccessStateWhenNotNull;
}
else
{
Unsplit();
stateWhenNotNull = this.State.Clone();
}
}
else
{
var savedState = this.State.Clone();
if (IsConstantNull(node.Receiver))
{
SetUnreachable();
}
else
{
SetState(stateWhenNotNull);
}
// We want to preserve stateWhenNotNull from accesses in the same "chain":
// a?.b(out x)?.c(out y); // expected to preserve stateWhenNotNull from both ?.b(out x) and ?.c(out y)
// but not accesses in nested expressions:
// a?.b(out x, c?.d(out y)); // expected to preserve stateWhenNotNull from a?.b(out x, ...) but not from c?.d(out y)
BoundExpression expr = node.AccessExpression;
while (expr is BoundConditionalAccess innerCondAccess)
{
Debug.Assert(innerCondAccess.Receiver is not (BoundConditionalAccess or BoundConversion));
// we assume that non-conditional accesses can never contain conditional accesses from the same "chain".
// that is, we never have to dig through non-conditional accesses to find and handle conditional accesses.
VisitRvalue(innerCondAccess.Receiver);
expr = innerCondAccess.AccessExpression;
// The savedState here represents the scenario where 0 or more of the access expressions could have been evaluated.
// e.g. after visiting `a?.b(x = null)?.c(x = new object())`, the "state when not null" of `x` is NotNull, but the "state when maybe null" of `x` is MaybeNull.
Join(ref savedState, ref State);
}
Debug.Assert(expr is BoundExpression);
VisitRvalue(expr);
stateWhenNotNull = State;
State = savedState;
Join(ref State, ref stateWhenNotNull);
}
}
public override BoundNode? VisitConditionalAccess(BoundConditionalAccess node)
{
VisitConditionalAccess(node, stateWhenNotNull: out _);
return null;
}
#nullable disable
public override BoundNode VisitLoweredConditionalAccess(BoundLoweredConditionalAccess node)
{
VisitRvalue(node.Receiver);
var savedState = this.State.Clone();
VisitRvalue(node.WhenNotNull);
Join(ref this.State, ref savedState);
if (node.WhenNullOpt != null)
{
savedState = this.State.Clone();
VisitRvalue(node.WhenNullOpt);
Join(ref this.State, ref savedState);
}
return null;
}
public override BoundNode VisitConditionalReceiver(BoundConditionalReceiver node)
{
return null;
}
public override BoundNode VisitComplexConditionalReceiver(BoundComplexConditionalReceiver node)
{
var savedState = this.State.Clone();
VisitRvalue(node.ValueTypeReceiver);
Join(ref this.State, ref savedState);
savedState = this.State.Clone();
VisitRvalue(node.ReferenceTypeReceiver);
Join(ref this.State, ref savedState);
return null;
}
public override BoundNode VisitSequence(BoundSequence node)
{
var sideEffects = node.SideEffects;
if (!sideEffects.IsEmpty)
{
foreach (var se in sideEffects)
{
VisitRvalue(se);
}
}
VisitRvalue(node.Value);
return null;
}
public override BoundNode VisitSequencePoint(BoundSequencePoint node)
{
if (node.StatementOpt != null)
{
VisitStatement(node.StatementOpt);
}
return null;
}
public override BoundNode VisitSequencePointExpression(BoundSequencePointExpression node)
{
VisitRvalue(node.Expression);
return null;
}
public override BoundNode VisitSequencePointWithSpan(BoundSequencePointWithSpan node)
{
if (node.StatementOpt != null)
{
VisitStatement(node.StatementOpt);
}
return null;
}
public override BoundNode VisitStatementList(BoundStatementList node)
{
return VisitStatementListWorker(node);
}
private BoundNode VisitStatementListWorker(BoundStatementList node)
{
foreach (var statement in node.Statements)
{
VisitStatement(statement);
}
return null;
}
public override BoundNode VisitTypeOrInstanceInitializers(BoundTypeOrInstanceInitializers node)
{
return VisitStatementListWorker(node);
}
public override BoundNode VisitUnboundLambda(UnboundLambda node)
{
// The presence of this node suggests an error was detected in an earlier phase.
return VisitLambda(node.BindForErrorRecovery());
}
public override BoundNode VisitBreakStatement(BoundBreakStatement node)
{
Debug.Assert(!this.IsConditionalState);
PendingBranches.Add(new PendingBranch(node, this.State, node.Label));
SetUnreachable();
return null;
}
public override BoundNode VisitContinueStatement(BoundContinueStatement node)
{
Debug.Assert(!this.IsConditionalState);
PendingBranches.Add(new PendingBranch(node, this.State, node.Label));
SetUnreachable();
return null;
}
public override BoundNode VisitUnconvertedConditionalOperator(BoundUnconvertedConditionalOperator node)
{
return VisitConditionalOperatorCore(node, isByRef: false, node.Condition, node.Consequence, node.Alternative);
}
public override BoundNode VisitConditionalOperator(BoundConditionalOperator node)
{
return VisitConditionalOperatorCore(node, node.IsRef, node.Condition, node.Consequence, node.Alternative);
}
#nullable enable
protected virtual BoundNode? VisitConditionalOperatorCore(
BoundExpression node,
bool isByRef,
BoundExpression condition,
BoundExpression consequence,
BoundExpression alternative)
{
VisitCondition(condition);
var consequenceState = this.StateWhenTrue;
var alternativeState = this.StateWhenFalse;
if (IsConstantTrue(condition))
{
VisitConditionalOperand(alternativeState, alternative, isByRef);
VisitConditionalOperand(consequenceState, consequence, isByRef);
}
else if (IsConstantFalse(condition))
{
VisitConditionalOperand(consequenceState, consequence, isByRef);
VisitConditionalOperand(alternativeState, alternative, isByRef);
}
else
{
// at this point, the state is conditional after a conditional expression if:
// 1. the state is conditional after the consequence, or
// 2. the state is conditional after the alternative
VisitConditionalOperand(consequenceState, consequence, isByRef);
var conditionalAfterConsequence = IsConditionalState;
var (afterConsequenceWhenTrue, afterConsequenceWhenFalse) = conditionalAfterConsequence ? (StateWhenTrue, StateWhenFalse) : (State, State);
VisitConditionalOperand(alternativeState, alternative, isByRef);
if (!conditionalAfterConsequence && !IsConditionalState)
{
// simplify in the common case
Join(ref this.State, ref afterConsequenceWhenTrue);
}
else
{
Split();
Join(ref this.StateWhenTrue, ref afterConsequenceWhenTrue);
Join(ref this.StateWhenFalse, ref afterConsequenceWhenFalse);
}
}
return null;
}
#nullable disable
private void VisitConditionalOperand(TLocalState state, BoundExpression operand, bool isByRef)
{
SetState(state);
if (isByRef)
{
VisitLvalue(operand);
// exposing ref is a potential write
WriteArgument(operand, RefKind.Ref, method: null);
}
else
{
Visit(operand);
}
}
public override BoundNode VisitBaseReference(BoundBaseReference node)
{
return null;
}
public override BoundNode VisitDoStatement(BoundDoStatement node)
{
// do { statements; node.ContinueLabel: } while (node.Condition) node.BreakLabel:
LoopHead(node);
VisitStatement(node.Body);
ResolveContinues(node.ContinueLabel);
VisitCondition(node.Condition);
TLocalState breakState = this.StateWhenFalse;
SetState(this.StateWhenTrue);
LoopTail(node);
ResolveBreaks(breakState, node.BreakLabel);
return null;
}
public override BoundNode VisitGotoStatement(BoundGotoStatement node)
{
Debug.Assert(!this.IsConditionalState);
PendingBranches.Add(new PendingBranch(node, this.State, node.Label));
SetUnreachable();
return null;
}
protected void VisitLabel(LabelSymbol label, BoundStatement node)
{
node.AssertIsLabeledStatementWithLabel(label);
ResolveBranches(label, node);
var state = LabelState(label);
Join(ref this.State, ref state);
_labels[label] = this.State.Clone();
_labelsSeen.Add(node);
}
protected virtual void VisitLabel(BoundLabeledStatement node)
{
VisitLabel(node.Label, node);
}
public override BoundNode VisitLabelStatement(BoundLabelStatement node)
{
VisitLabel(node.Label, node);
return null;
}
public override BoundNode VisitLabeledStatement(BoundLabeledStatement node)
{
VisitLabel(node);
VisitStatement(node.Body);
return null;
}
public override BoundNode VisitLockStatement(BoundLockStatement node)
{
VisitRvalue(node.Argument);
VisitStatement(node.Body);
return null;
}
public override BoundNode VisitNoOpStatement(BoundNoOpStatement node)
{
return null;
}
public override BoundNode VisitNamespaceExpression(BoundNamespaceExpression node)
{
return null;
}
public override BoundNode VisitUsingStatement(BoundUsingStatement node)
{
if (node.ExpressionOpt != null)
{
VisitRvalue(node.ExpressionOpt);
}
if (node.DeclarationsOpt != null)
{
VisitStatement(node.DeclarationsOpt);
}
VisitStatement(node.Body);
if (AwaitUsingAndForeachAddsPendingBranch && node.AwaitOpt != null)
{
PendingBranches.Add(new PendingBranch(node, this.State, null));
}
return null;
}
public abstract bool AwaitUsingAndForeachAddsPendingBranch { get; }
public override BoundNode VisitFixedStatement(BoundFixedStatement node)
{
VisitStatement(node.Declarations);
VisitStatement(node.Body);
return null;
}
public override BoundNode VisitFixedLocalCollectionInitializer(BoundFixedLocalCollectionInitializer node)
{
VisitRvalue(node.Expression);
return null;
}
public override BoundNode VisitThrowStatement(BoundThrowStatement node)
{
BoundExpression expr = node.ExpressionOpt;
VisitRvalue(expr);
SetUnreachable();
return null;
}
public override BoundNode VisitYieldBreakStatement(BoundYieldBreakStatement node)
{
Debug.Assert(!this.IsConditionalState);
PendingBranches.Add(new PendingBranch(node, this.State, null));
SetUnreachable();
return null;
}
public override BoundNode VisitYieldReturnStatement(BoundYieldReturnStatement node)
{
VisitRvalue(node.Expression);
PendingBranches.Add(new PendingBranch(node, this.State, null));
return null;
}
public override BoundNode VisitDefaultLiteral(BoundDefaultLiteral node)
{
return null;
}
public override BoundNode VisitDefaultExpression(BoundDefaultExpression node)
{
return null;
}
public override BoundNode VisitUnconvertedObjectCreationExpression(BoundUnconvertedObjectCreationExpression node)
{
throw ExceptionUtilities.Unreachable;
}
public override BoundNode VisitTypeOfOperator(BoundTypeOfOperator node)
{
VisitTypeExpression(node.SourceType);
return null;
}
public override BoundNode VisitNameOfOperator(BoundNameOfOperator node)
{
var savedState = this.State;
SetState(UnreachableState());
Visit(node.Argument);
SetState(savedState);
return null;
}
public override BoundNode VisitAddressOfOperator(BoundAddressOfOperator node)
{
VisitAddressOfOperand(node.Operand, shouldReadOperand: false);
return null;
}
protected void VisitAddressOfOperand(BoundExpression operand, bool shouldReadOperand)
{
if (shouldReadOperand)
{
this.VisitRvalue(operand);
}
else
{
this.VisitLvalue(operand);
}
this.WriteArgument(operand, RefKind.Out, null); //Out because we know it will definitely be assigned.
}
public override BoundNode VisitPointerIndirectionOperator(BoundPointerIndirectionOperator node)
{
VisitRvalue(node.Operand);
return null;
}
public override BoundNode VisitPointerElementAccess(BoundPointerElementAccess node)
{
VisitRvalue(node.Expression);
VisitRvalue(node.Index);
return null;
}
public override BoundNode VisitSizeOfOperator(BoundSizeOfOperator node)
{
return null;
}
private BoundNode VisitStackAllocArrayCreationBase(BoundStackAllocArrayCreationBase node)
{
VisitRvalue(node.Count);
if (node.InitializerOpt != null && !node.InitializerOpt.Initializers.IsDefault)
{
foreach (var element in node.InitializerOpt.Initializers)
{
VisitRvalue(element);
}
}
return null;
}
public override BoundNode VisitStackAllocArrayCreation(BoundStackAllocArrayCreation node)
{
return VisitStackAllocArrayCreationBase(node);
}
public override BoundNode VisitConvertedStackAllocExpression(BoundConvertedStackAllocExpression node)
{
return VisitStackAllocArrayCreationBase(node);
}
public override BoundNode VisitAnonymousObjectCreationExpression(BoundAnonymousObjectCreationExpression node)
{
// visit arguments as r-values
VisitArguments(node.Arguments, default(ImmutableArray<RefKind>), node.Constructor);
return null;
}
public override BoundNode VisitArrayLength(BoundArrayLength node)
{
VisitRvalue(node.Expression);
return null;
}
public override BoundNode VisitConditionalGoto(BoundConditionalGoto node)
{
VisitCondition(node.Condition);
Debug.Assert(this.IsConditionalState);
if (node.JumpIfTrue)
{
PendingBranches.Add(new PendingBranch(node, this.StateWhenTrue, node.Label));
this.SetState(this.StateWhenFalse);
}
else
{
PendingBranches.Add(new PendingBranch(node, this.StateWhenFalse, node.Label));
this.SetState(this.StateWhenTrue);
}
return null;
}
public override BoundNode VisitObjectInitializerExpression(BoundObjectInitializerExpression node)
{
return VisitObjectOrCollectionInitializerExpression(node.Initializers);
}
public override BoundNode VisitCollectionInitializerExpression(BoundCollectionInitializerExpression node)
{
return VisitObjectOrCollectionInitializerExpression(node.Initializers);
}
private BoundNode VisitObjectOrCollectionInitializerExpression(ImmutableArray<BoundExpression> initializers)
{
foreach (var initializer in initializers)
{
VisitRvalue(initializer);
}
return null;
}
public override BoundNode VisitObjectInitializerMember(BoundObjectInitializerMember node)
{
var arguments = node.Arguments;
if (!arguments.IsDefaultOrEmpty)
{
MethodSymbol method = null;
if (node.MemberSymbol?.Kind == SymbolKind.Property)
{
var property = (PropertySymbol)node.MemberSymbol;
method = GetReadMethod(property);
}
VisitArguments(node.Arguments, node.ArgumentRefKindsOpt, method);
}
return null;
}
public override BoundNode VisitDynamicObjectInitializerMember(BoundDynamicObjectInitializerMember node)
{
return null;
}
public override BoundNode VisitCollectionElementInitializer(BoundCollectionElementInitializer node)
{
if (node.AddMethod.CallsAreOmitted(node.SyntaxTree))
{
// If the underlying add method is a partial method without a definition, or is a conditional method
// whose condition is not true, then the call has no effect and it is ignored for the purposes of
// flow analysis.
TLocalState savedState = savedState = this.State.Clone();
SetUnreachable();
VisitArguments(node.Arguments, default(ImmutableArray<RefKind>), node.AddMethod);
this.State = savedState;
}
else
{
VisitArguments(node.Arguments, default(ImmutableArray<RefKind>), node.AddMethod);
}
return null;
}
public override BoundNode VisitDynamicCollectionElementInitializer(BoundDynamicCollectionElementInitializer node)
{
VisitArguments(node.Arguments, default(ImmutableArray<RefKind>), method: null);
return null;
}
public override BoundNode VisitImplicitReceiver(BoundImplicitReceiver node)
{
return null;
}
public override BoundNode VisitFieldEqualsValue(BoundFieldEqualsValue node)
{
VisitRvalue(node.Value);
return null;
}
public override BoundNode VisitPropertyEqualsValue(BoundPropertyEqualsValue node)
{
VisitRvalue(node.Value);
return null;
}
public override BoundNode VisitParameterEqualsValue(BoundParameterEqualsValue node)
{
VisitRvalue(node.Value);
return null;
}
public override BoundNode VisitDeconstructValuePlaceholder(BoundDeconstructValuePlaceholder node)
{
return null;
}
public override BoundNode VisitObjectOrCollectionValuePlaceholder(BoundObjectOrCollectionValuePlaceholder node)
{
return null;
}
public override BoundNode VisitAwaitableValuePlaceholder(BoundAwaitableValuePlaceholder node)
{
return null;
}
public sealed override BoundNode VisitOutVariablePendingInference(OutVariablePendingInference node)
{
throw ExceptionUtilities.Unreachable;
}
public sealed override BoundNode VisitDeconstructionVariablePendingInference(DeconstructionVariablePendingInference node)
{
throw ExceptionUtilities.Unreachable;
}
public override BoundNode VisitDiscardExpression(BoundDiscardExpression node)
{
return null;
}
private static MethodSymbol GetReadMethod(PropertySymbol property) =>
property.GetOwnOrInheritedGetMethod() ?? property.SetMethod;
private static MethodSymbol GetWriteMethod(PropertySymbol property) =>
property.GetOwnOrInheritedSetMethod() ?? property.GetMethod;
public override BoundNode VisitConstructorMethodBody(BoundConstructorMethodBody node)
{
Visit(node.Initializer);
VisitMethodBodies(node.BlockBody, node.ExpressionBody);
return null;
}
public override BoundNode VisitNonConstructorMethodBody(BoundNonConstructorMethodBody node)
{
VisitMethodBodies(node.BlockBody, node.ExpressionBody);
return null;
}
public override BoundNode VisitNullCoalescingAssignmentOperator(BoundNullCoalescingAssignmentOperator node)
{
TLocalState leftState;
if (RegularPropertyAccess(node.LeftOperand) &&
(BoundPropertyAccess)node.LeftOperand is var left &&
left.PropertySymbol is var property &&
property.RefKind == RefKind.None)
{
var readMethod = property.GetOwnOrInheritedGetMethod();
VisitReceiverBeforeCall(left.ReceiverOpt, readMethod);
VisitReceiverAfterCall(left.ReceiverOpt, readMethod);
var savedState = this.State.Clone();
AdjustStateForNullCoalescingAssignmentNonNullCase(node);
leftState = this.State.Clone();
SetState(savedState);
VisitAssignmentOfNullCoalescingAssignment(node, left);
}
else
{
VisitRvalue(node.LeftOperand, isKnownToBeAnLvalue: true);
var savedState = this.State.Clone();
AdjustStateForNullCoalescingAssignmentNonNullCase(node);
leftState = this.State.Clone();
SetState(savedState);
VisitAssignmentOfNullCoalescingAssignment(node, propertyAccessOpt: null);
}
Join(ref this.State, ref leftState);
return null;
}
public override BoundNode VisitReadOnlySpanFromArray(BoundReadOnlySpanFromArray node)
{
VisitRvalue(node.Operand);
return null;
}
public override BoundNode VisitFunctionPointerInvocation(BoundFunctionPointerInvocation node)
{
Visit(node.InvokedExpression);
VisitArguments(node.Arguments, node.ArgumentRefKindsOpt, node.FunctionPointer.Signature);
return null;
}
public override BoundNode VisitUnconvertedAddressOfOperator(BoundUnconvertedAddressOfOperator node)
{
// This is not encountered in correct programs, but can be seen if the function pointer was
// unable to be converted and the semantic model is used to query for information.
Visit(node.Operand);
return null;
}
/// <summary>
/// This visitor represents just the assignment part of the null coalescing assignment
/// operator.
/// </summary>
protected virtual void VisitAssignmentOfNullCoalescingAssignment(
BoundNullCoalescingAssignmentOperator node,
BoundPropertyAccess propertyAccessOpt)
{
VisitRvalue(node.RightOperand);
if (propertyAccessOpt != null)
{
var symbol = propertyAccessOpt.PropertySymbol;
var writeMethod = symbol.GetOwnOrInheritedSetMethod();
PropertySetter(node, propertyAccessOpt.ReceiverOpt, writeMethod);
}
}
public override BoundNode VisitSavePreviousSequencePoint(BoundSavePreviousSequencePoint node)
{
return null;
}
public override BoundNode VisitRestorePreviousSequencePoint(BoundRestorePreviousSequencePoint node)
{
return null;
}
public override BoundNode VisitStepThroughSequencePoint(BoundStepThroughSequencePoint node)
{
return null;
}
/// <summary>
/// This visitor represents just the non-assignment part of the null coalescing assignment
/// operator (when the left operand is non-null).
/// </summary>
protected virtual void AdjustStateForNullCoalescingAssignmentNonNullCase(BoundNullCoalescingAssignmentOperator node)
{
}
private void VisitMethodBodies(BoundBlock blockBody, BoundBlock expressionBody)
{
if (blockBody == null)
{
Visit(expressionBody);
return;
}
else if (expressionBody == null)
{
Visit(blockBody);
return;
}
// In error cases we have two bodies. These are two unrelated pieces of code,
// they are not executed one after another. As we don't really know which one the developer
// intended to use, we need to visit both. We are going to pretend that there is
// an unconditional fork in execution and then we are converging after each body is executed.
// For example, if only one body assigns an out parameter, then after visiting both bodies
// we should consider that parameter is not definitely assigned.
// Note, that today this code is not executed for regular definite assignment analysis. It is
// only executed for region analysis.
TLocalState initialState = this.State.Clone();
Visit(blockBody);
TLocalState afterBlock = this.State;
SetState(initialState);
Visit(expressionBody);
Join(ref this.State, ref afterBlock);
}
#endregion visitors
}
/// <summary>
/// The possible places that we are processing when there is a region.
/// </summary>
/// <remarks>
/// This should be nested inside <see cref="AbstractFlowPass{TLocalState, TLocalFunctionState}"/> but is not due to https://github.com/dotnet/roslyn/issues/36992 .
/// </remarks>
internal enum RegionPlace { Before, Inside, After };
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Analyzers/Core/Analyzers/AbstractParenthesesDiagnosticAnalyzer.cs | // 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.
#nullable disable
using System.Collections.Immutable;
using Microsoft.CodeAnalysis.CodeStyle;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Precedence;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.RemoveUnnecessaryParentheses
{
internal abstract class AbstractParenthesesDiagnosticAnalyzer : AbstractBuiltInCodeStyleDiagnosticAnalyzer
{
protected AbstractParenthesesDiagnosticAnalyzer(
string descriptorId, EnforceOnBuild enforceOnBuild, LocalizableString title, LocalizableString message, bool isUnnecessary = false)
: base(descriptorId,
enforceOnBuild,
options: ImmutableHashSet.Create<IPerLanguageOption>(CodeStyleOptions2.ArithmeticBinaryParentheses, CodeStyleOptions2.RelationalBinaryParentheses, CodeStyleOptions2.OtherBinaryParentheses, CodeStyleOptions2.OtherParentheses),
title,
message,
isUnnecessary: isUnnecessary)
{
}
protected static PerLanguageOption2<CodeStyleOption2<ParenthesesPreference>> GetLanguageOption(PrecedenceKind precedenceKind)
{
switch (precedenceKind)
{
case PrecedenceKind.Arithmetic:
case PrecedenceKind.Shift:
case PrecedenceKind.Bitwise:
return CodeStyleOptions2.ArithmeticBinaryParentheses;
case PrecedenceKind.Relational:
case PrecedenceKind.Equality:
return CodeStyleOptions2.RelationalBinaryParentheses;
case PrecedenceKind.Logical:
case PrecedenceKind.Coalesce:
return CodeStyleOptions2.OtherBinaryParentheses;
case PrecedenceKind.Other:
return CodeStyleOptions2.OtherParentheses;
}
throw ExceptionUtilities.UnexpectedValue(precedenceKind);
}
}
}
| // 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.
#nullable disable
using System.Collections.Immutable;
using Microsoft.CodeAnalysis.CodeStyle;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Precedence;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.RemoveUnnecessaryParentheses
{
internal abstract class AbstractParenthesesDiagnosticAnalyzer : AbstractBuiltInCodeStyleDiagnosticAnalyzer
{
protected AbstractParenthesesDiagnosticAnalyzer(
string descriptorId, EnforceOnBuild enforceOnBuild, LocalizableString title, LocalizableString message, bool isUnnecessary = false)
: base(descriptorId,
enforceOnBuild,
options: ImmutableHashSet.Create<IPerLanguageOption>(CodeStyleOptions2.ArithmeticBinaryParentheses, CodeStyleOptions2.RelationalBinaryParentheses, CodeStyleOptions2.OtherBinaryParentheses, CodeStyleOptions2.OtherParentheses),
title,
message,
isUnnecessary: isUnnecessary)
{
}
protected static PerLanguageOption2<CodeStyleOption2<ParenthesesPreference>> GetLanguageOption(PrecedenceKind precedenceKind)
{
switch (precedenceKind)
{
case PrecedenceKind.Arithmetic:
case PrecedenceKind.Shift:
case PrecedenceKind.Bitwise:
return CodeStyleOptions2.ArithmeticBinaryParentheses;
case PrecedenceKind.Relational:
case PrecedenceKind.Equality:
return CodeStyleOptions2.RelationalBinaryParentheses;
case PrecedenceKind.Logical:
case PrecedenceKind.Coalesce:
return CodeStyleOptions2.OtherBinaryParentheses;
case PrecedenceKind.Other:
return CodeStyleOptions2.OtherParentheses;
}
throw ExceptionUtilities.UnexpectedValue(precedenceKind);
}
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Utilities/IReferenceCountedDisposable.cs | // 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;
namespace Roslyn.Utilities
{
/// <summary>
/// A covariant interface form of <see cref="ReferenceCountedDisposable{T}"/> that lets you re-cast an <see cref="ReferenceCountedDisposable{T}"/>
/// to a more base type. This can include types that do not implement <see cref="IDisposable"/> if you want to prevent a caller from accidentally
/// disposing <see cref="Target"/> directly.
/// </summary>
/// <typeparam name="T"></typeparam>
internal interface IReferenceCountedDisposable<out T> : IDisposable
#if !CODE_STYLE
, IAsyncDisposable
#endif
where T : class
{
/// <summary>
/// Gets the target object.
/// </summary>
/// <remarks>
/// <para>This call is not valid after <see cref="IDisposable.Dispose"/> is called. If this property or the target
/// object is used concurrently with a call to <see cref="IDisposable.Dispose"/>, it is possible for the code to be
/// using a disposed object. After the current instance is disposed, this property throws
/// <see cref="ObjectDisposedException"/>. However, the exact time when this property starts throwing after
/// <see cref="IDisposable.Dispose"/> is called is unspecified; code is expected to not use this property or the object
/// it returns after any code invokes <see cref="IDisposable.Dispose"/>.</para>
/// </remarks>
/// <value>The target object.</value>
T Target { get; }
/// <summary>
/// Increments the reference count for the disposable object, and returns a new disposable reference to it.
/// </summary>
/// <remarks>
/// <para>The returned object is an independent reference to the same underlying object. Disposing of the
/// returned value multiple times will only cause the reference count to be decreased once.</para>
/// </remarks>
/// <returns>A new <see cref="ReferenceCountedDisposable{T}"/> pointing to the same underlying object, if it
/// has not yet been disposed; otherwise, <see langword="null"/> if this reference to the underlying object
/// has already been disposed.</returns>
IReferenceCountedDisposable<T>? TryAddReference();
}
}
| // 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;
namespace Roslyn.Utilities
{
/// <summary>
/// A covariant interface form of <see cref="ReferenceCountedDisposable{T}"/> that lets you re-cast an <see cref="ReferenceCountedDisposable{T}"/>
/// to a more base type. This can include types that do not implement <see cref="IDisposable"/> if you want to prevent a caller from accidentally
/// disposing <see cref="Target"/> directly.
/// </summary>
/// <typeparam name="T"></typeparam>
internal interface IReferenceCountedDisposable<out T> : IDisposable
#if !CODE_STYLE
, IAsyncDisposable
#endif
where T : class
{
/// <summary>
/// Gets the target object.
/// </summary>
/// <remarks>
/// <para>This call is not valid after <see cref="IDisposable.Dispose"/> is called. If this property or the target
/// object is used concurrently with a call to <see cref="IDisposable.Dispose"/>, it is possible for the code to be
/// using a disposed object. After the current instance is disposed, this property throws
/// <see cref="ObjectDisposedException"/>. However, the exact time when this property starts throwing after
/// <see cref="IDisposable.Dispose"/> is called is unspecified; code is expected to not use this property or the object
/// it returns after any code invokes <see cref="IDisposable.Dispose"/>.</para>
/// </remarks>
/// <value>The target object.</value>
T Target { get; }
/// <summary>
/// Increments the reference count for the disposable object, and returns a new disposable reference to it.
/// </summary>
/// <remarks>
/// <para>The returned object is an independent reference to the same underlying object. Disposing of the
/// returned value multiple times will only cause the reference count to be decreased once.</para>
/// </remarks>
/// <returns>A new <see cref="ReferenceCountedDisposable{T}"/> pointing to the same underlying object, if it
/// has not yet been disposed; otherwise, <see langword="null"/> if this reference to the underlying object
/// has already been disposed.</returns>
IReferenceCountedDisposable<T>? TryAddReference();
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Analyzers/Core/Analyzers/UseCollectionInitializer/AbstractObjectCreationExpressionAnalyzer.cs | // 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.
#nullable disable
using System.Collections.Immutable;
using System.Linq;
using System.Threading;
using Microsoft.CodeAnalysis.LanguageServices;
using Microsoft.CodeAnalysis.PooledObjects;
using Microsoft.CodeAnalysis.Shared.Extensions;
namespace Microsoft.CodeAnalysis.UseCollectionInitializer
{
internal abstract class AbstractObjectCreationExpressionAnalyzer<
TExpressionSyntax,
TStatementSyntax,
TObjectCreationExpressionSyntax,
TVariableDeclaratorSyntax,
TMatch>
where TExpressionSyntax : SyntaxNode
where TStatementSyntax : SyntaxNode
where TObjectCreationExpressionSyntax : TExpressionSyntax
where TVariableDeclaratorSyntax : SyntaxNode
{
protected SemanticModel _semanticModel;
protected ISyntaxFacts _syntaxFacts;
protected TObjectCreationExpressionSyntax _objectCreationExpression;
protected CancellationToken _cancellationToken;
protected TStatementSyntax _containingStatement;
private SyntaxNodeOrToken _valuePattern;
private ISymbol _initializedSymbol;
protected AbstractObjectCreationExpressionAnalyzer()
{
}
public void Initialize(
SemanticModel semanticModel,
ISyntaxFacts syntaxFacts,
TObjectCreationExpressionSyntax objectCreationExpression,
CancellationToken cancellationToken)
{
_semanticModel = semanticModel;
_syntaxFacts = syntaxFacts;
_objectCreationExpression = objectCreationExpression;
_cancellationToken = cancellationToken;
}
protected void Clear()
{
_semanticModel = null;
_syntaxFacts = null;
_objectCreationExpression = null;
_cancellationToken = default;
_containingStatement = null;
_valuePattern = default;
_initializedSymbol = null;
}
protected abstract void AddMatches(ArrayBuilder<TMatch> matches);
protected ImmutableArray<TMatch>? AnalyzeWorker()
{
if (_syntaxFacts.GetObjectCreationInitializer(_objectCreationExpression) != null)
{
// Don't bother if this already has an initializer.
return null;
}
if (!ShouldAnalyze())
{
return null;
}
_containingStatement = _objectCreationExpression.FirstAncestorOrSelf<TStatementSyntax>();
if (_containingStatement == null)
{
return null;
}
if (!TryInitializeVariableDeclarationCase() &&
!TryInitializeAssignmentCase())
{
return null;
}
using var _ = ArrayBuilder<TMatch>.GetInstance(out var matches);
AddMatches(matches);
return matches.ToImmutable();
}
private bool TryInitializeVariableDeclarationCase()
{
if (!_syntaxFacts.IsLocalDeclarationStatement(_containingStatement))
{
return false;
}
if (_objectCreationExpression.Parent.Parent is not TVariableDeclaratorSyntax containingDeclarator)
{
return false;
}
_initializedSymbol = _semanticModel.GetDeclaredSymbol(containingDeclarator, _cancellationToken);
if (_initializedSymbol is ILocalSymbol local &&
local.Type is IDynamicTypeSymbol)
{
// Not supported if we're creating a dynamic local. The object we're instantiating
// may not have the members that we're trying to access on the dynamic object.
return false;
}
if (!_syntaxFacts.IsDeclaratorOfLocalDeclarationStatement(containingDeclarator, _containingStatement))
{
return false;
}
_valuePattern = _syntaxFacts.GetIdentifierOfVariableDeclarator(containingDeclarator);
return true;
}
private bool TryInitializeAssignmentCase()
{
if (!_syntaxFacts.IsSimpleAssignmentStatement(_containingStatement))
{
return false;
}
_syntaxFacts.GetPartsOfAssignmentStatement(_containingStatement,
out var left, out var right);
if (right != _objectCreationExpression)
{
return false;
}
var typeInfo = _semanticModel.GetTypeInfo(left, _cancellationToken);
if (typeInfo.Type is IDynamicTypeSymbol || typeInfo.ConvertedType is IDynamicTypeSymbol)
{
// Not supported if we're initializing something dynamic. The object we're instantiating
// may not have the members that we're trying to access on the dynamic object.
return false;
}
_valuePattern = left;
_initializedSymbol = _semanticModel.GetSymbolInfo(left, _cancellationToken).GetAnySymbol();
return true;
}
protected bool ValuePatternMatches(TExpressionSyntax expression)
{
if (_valuePattern.IsToken)
{
return _syntaxFacts.IsIdentifierName(expression) &&
_syntaxFacts.AreEquivalent(
_valuePattern.AsToken(),
_syntaxFacts.GetIdentifierOfSimpleName(expression));
}
else
{
return _syntaxFacts.AreEquivalent(
_valuePattern.AsNode(), expression);
}
}
protected bool ExpressionContainsValuePatternOrReferencesInitializedSymbol(SyntaxNode expression)
{
foreach (var subExpression in expression.DescendantNodesAndSelf().OfType<TExpressionSyntax>())
{
if (!_syntaxFacts.IsNameOfSimpleMemberAccessExpression(subExpression) &&
!_syntaxFacts.IsNameOfMemberBindingExpression(subExpression))
{
if (ValuePatternMatches(subExpression))
{
return true;
}
}
if (_initializedSymbol != null &&
_initializedSymbol.Equals(
_semanticModel.GetSymbolInfo(subExpression, _cancellationToken).GetAnySymbol()))
{
return true;
}
}
return false;
}
protected abstract bool ShouldAnalyze();
}
}
| // 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.
#nullable disable
using System.Collections.Immutable;
using System.Linq;
using System.Threading;
using Microsoft.CodeAnalysis.LanguageServices;
using Microsoft.CodeAnalysis.PooledObjects;
using Microsoft.CodeAnalysis.Shared.Extensions;
namespace Microsoft.CodeAnalysis.UseCollectionInitializer
{
internal abstract class AbstractObjectCreationExpressionAnalyzer<
TExpressionSyntax,
TStatementSyntax,
TObjectCreationExpressionSyntax,
TVariableDeclaratorSyntax,
TMatch>
where TExpressionSyntax : SyntaxNode
where TStatementSyntax : SyntaxNode
where TObjectCreationExpressionSyntax : TExpressionSyntax
where TVariableDeclaratorSyntax : SyntaxNode
{
protected SemanticModel _semanticModel;
protected ISyntaxFacts _syntaxFacts;
protected TObjectCreationExpressionSyntax _objectCreationExpression;
protected CancellationToken _cancellationToken;
protected TStatementSyntax _containingStatement;
private SyntaxNodeOrToken _valuePattern;
private ISymbol _initializedSymbol;
protected AbstractObjectCreationExpressionAnalyzer()
{
}
public void Initialize(
SemanticModel semanticModel,
ISyntaxFacts syntaxFacts,
TObjectCreationExpressionSyntax objectCreationExpression,
CancellationToken cancellationToken)
{
_semanticModel = semanticModel;
_syntaxFacts = syntaxFacts;
_objectCreationExpression = objectCreationExpression;
_cancellationToken = cancellationToken;
}
protected void Clear()
{
_semanticModel = null;
_syntaxFacts = null;
_objectCreationExpression = null;
_cancellationToken = default;
_containingStatement = null;
_valuePattern = default;
_initializedSymbol = null;
}
protected abstract void AddMatches(ArrayBuilder<TMatch> matches);
protected ImmutableArray<TMatch>? AnalyzeWorker()
{
if (_syntaxFacts.GetObjectCreationInitializer(_objectCreationExpression) != null)
{
// Don't bother if this already has an initializer.
return null;
}
if (!ShouldAnalyze())
{
return null;
}
_containingStatement = _objectCreationExpression.FirstAncestorOrSelf<TStatementSyntax>();
if (_containingStatement == null)
{
return null;
}
if (!TryInitializeVariableDeclarationCase() &&
!TryInitializeAssignmentCase())
{
return null;
}
using var _ = ArrayBuilder<TMatch>.GetInstance(out var matches);
AddMatches(matches);
return matches.ToImmutable();
}
private bool TryInitializeVariableDeclarationCase()
{
if (!_syntaxFacts.IsLocalDeclarationStatement(_containingStatement))
{
return false;
}
if (_objectCreationExpression.Parent.Parent is not TVariableDeclaratorSyntax containingDeclarator)
{
return false;
}
_initializedSymbol = _semanticModel.GetDeclaredSymbol(containingDeclarator, _cancellationToken);
if (_initializedSymbol is ILocalSymbol local &&
local.Type is IDynamicTypeSymbol)
{
// Not supported if we're creating a dynamic local. The object we're instantiating
// may not have the members that we're trying to access on the dynamic object.
return false;
}
if (!_syntaxFacts.IsDeclaratorOfLocalDeclarationStatement(containingDeclarator, _containingStatement))
{
return false;
}
_valuePattern = _syntaxFacts.GetIdentifierOfVariableDeclarator(containingDeclarator);
return true;
}
private bool TryInitializeAssignmentCase()
{
if (!_syntaxFacts.IsSimpleAssignmentStatement(_containingStatement))
{
return false;
}
_syntaxFacts.GetPartsOfAssignmentStatement(_containingStatement,
out var left, out var right);
if (right != _objectCreationExpression)
{
return false;
}
var typeInfo = _semanticModel.GetTypeInfo(left, _cancellationToken);
if (typeInfo.Type is IDynamicTypeSymbol || typeInfo.ConvertedType is IDynamicTypeSymbol)
{
// Not supported if we're initializing something dynamic. The object we're instantiating
// may not have the members that we're trying to access on the dynamic object.
return false;
}
_valuePattern = left;
_initializedSymbol = _semanticModel.GetSymbolInfo(left, _cancellationToken).GetAnySymbol();
return true;
}
protected bool ValuePatternMatches(TExpressionSyntax expression)
{
if (_valuePattern.IsToken)
{
return _syntaxFacts.IsIdentifierName(expression) &&
_syntaxFacts.AreEquivalent(
_valuePattern.AsToken(),
_syntaxFacts.GetIdentifierOfSimpleName(expression));
}
else
{
return _syntaxFacts.AreEquivalent(
_valuePattern.AsNode(), expression);
}
}
protected bool ExpressionContainsValuePatternOrReferencesInitializedSymbol(SyntaxNode expression)
{
foreach (var subExpression in expression.DescendantNodesAndSelf().OfType<TExpressionSyntax>())
{
if (!_syntaxFacts.IsNameOfSimpleMemberAccessExpression(subExpression) &&
!_syntaxFacts.IsNameOfMemberBindingExpression(subExpression))
{
if (ValuePatternMatches(subExpression))
{
return true;
}
}
if (_initializedSymbol != null &&
_initializedSymbol.Equals(
_semanticModel.GetSymbolInfo(subExpression, _cancellationToken).GetAnySymbol()))
{
return true;
}
}
return false;
}
protected abstract bool ShouldAnalyze();
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/VisualStudio/Core/Def/Implementation/LanguageService/AbstractLanguageService`2.VsLanguageDebugInfo.cs | // 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.Linq;
using System.Threading;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Debugging;
using Microsoft.CodeAnalysis.Editor.Host;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Internal.Log;
using Microsoft.CodeAnalysis.Text;
using Microsoft.CodeAnalysis.Text.Shared.Extensions;
using Microsoft.VisualStudio.LanguageServices.Implementation.Extensions;
using Microsoft.VisualStudio.LanguageServices.Implementation.Utilities;
using Microsoft.VisualStudio.Utilities;
using Roslyn.Utilities;
using IVsDebugName = Microsoft.VisualStudio.TextManager.Interop.IVsDebugName;
using IVsEnumBSTR = Microsoft.VisualStudio.TextManager.Interop.IVsEnumBSTR;
using IVsTextBuffer = Microsoft.VisualStudio.TextManager.Interop.IVsTextBuffer;
using RESOLVENAMEFLAGS = Microsoft.VisualStudio.TextManager.Interop.RESOLVENAMEFLAGS;
using VsTextSpan = Microsoft.VisualStudio.TextManager.Interop.TextSpan;
namespace Microsoft.VisualStudio.LanguageServices.Implementation.LanguageService
{
internal abstract partial class AbstractLanguageService<TPackage, TLanguageService>
{
internal sealed class VsLanguageDebugInfo : IVsLanguageDebugInfo
{
private readonly Guid _languageId;
private readonly TLanguageService _languageService;
private readonly ILanguageDebugInfoService? _languageDebugInfo;
private readonly IBreakpointResolutionService? _breakpointService;
private readonly IProximityExpressionsService? _proximityExpressionsService;
private readonly IUIThreadOperationExecutor _uiThreadOperationExecutor;
public VsLanguageDebugInfo(
Guid languageId,
TLanguageService languageService,
HostLanguageServices languageServiceProvider,
IUIThreadOperationExecutor uiThreadOperationExecutor)
{
Contract.ThrowIfNull(languageService);
Contract.ThrowIfNull(languageServiceProvider);
_languageId = languageId;
_languageService = languageService;
_languageDebugInfo = languageServiceProvider.GetService<ILanguageDebugInfoService>();
_breakpointService = languageServiceProvider.GetService<IBreakpointResolutionService>();
_proximityExpressionsService = languageServiceProvider.GetService<IProximityExpressionsService>();
_uiThreadOperationExecutor = uiThreadOperationExecutor;
}
public int GetLanguageID(IVsTextBuffer pBuffer, int iLine, int iCol, out Guid pguidLanguageID)
{
pguidLanguageID = _languageId;
return VSConstants.S_OK;
}
public int GetLocationOfName(string pszName, out string? pbstrMkDoc, out VsTextSpan pspanLocation)
{
pbstrMkDoc = null;
pspanLocation = default;
return VSConstants.E_NOTIMPL;
}
public int GetNameOfLocation(IVsTextBuffer pBuffer, int iLine, int iCol, out string? pbstrName, out int piLineOffset)
{
using (Logger.LogBlock(FunctionId.Debugging_VsLanguageDebugInfo_GetNameOfLocation, CancellationToken.None))
{
string? name = null;
var lineOffset = 0;
if (_languageDebugInfo != null)
{
_uiThreadOperationExecutor.Execute(
title: ServicesVSResources.Debugger,
defaultDescription: ServicesVSResources.Determining_breakpoint_location,
allowCancellation: true,
showProgress: false,
action: waitContext =>
{
var cancellationToken = waitContext.UserCancellationToken;
var textBuffer = _languageService.EditorAdaptersFactoryService.GetDataBuffer(pBuffer);
if (textBuffer != null)
{
var nullablePoint = textBuffer.CurrentSnapshot.TryGetPoint(iLine, iCol);
if (nullablePoint.HasValue)
{
var point = nullablePoint.Value;
var document = point.Snapshot.GetOpenDocumentInCurrentContextWithChanges();
if (document != null)
{
// NOTE(cyrusn): We have to wait here because the debuggers'
// GetNameOfLocation is a blocking call. In the future, it
// would be nice if they could make it async.
var debugLocationInfo = _languageDebugInfo.GetLocationInfoAsync(document, point, cancellationToken).WaitAndGetResult(cancellationToken);
if (!debugLocationInfo.IsDefault)
{
name = debugLocationInfo.Name;
lineOffset = debugLocationInfo.LineOffset;
}
}
}
}
});
if (name != null)
{
pbstrName = name;
piLineOffset = lineOffset;
return VSConstants.S_OK;
}
}
// Note(DustinCa): Docs say that GetNameOfLocation should return S_FALSE if a name could not be found.
// Also, that's what the old native code does, so we should do it here.
pbstrName = null;
piLineOffset = 0;
return VSConstants.S_FALSE;
}
}
public int GetProximityExpressions(IVsTextBuffer pBuffer, int iLine, int iCol, int cLines, out IVsEnumBSTR? ppEnum)
{
// NOTE(cyrusn): cLines is ignored. This is to match existing dev10 behavior.
using (Logger.LogBlock(FunctionId.Debugging_VsLanguageDebugInfo_GetProximityExpressions, CancellationToken.None))
{
VsEnumBSTR? enumBSTR = null;
if (_proximityExpressionsService != null)
{
_uiThreadOperationExecutor.Execute(
title: ServicesVSResources.Debugger,
defaultDescription: ServicesVSResources.Determining_autos,
allowCancellation: true,
showProgress: false,
action: context =>
{
var textBuffer = _languageService.EditorAdaptersFactoryService.GetDataBuffer(pBuffer);
if (textBuffer != null)
{
var snapshot = textBuffer.CurrentSnapshot;
var nullablePoint = snapshot.TryGetPoint(iLine, iCol);
if (nullablePoint.HasValue)
{
var document = snapshot.GetOpenDocumentInCurrentContextWithChanges();
if (document != null)
{
var point = nullablePoint.Value;
var proximityExpressions = _proximityExpressionsService.GetProximityExpressionsAsync(document, point.Position, context.UserCancellationToken).WaitAndGetResult(context.UserCancellationToken);
if (proximityExpressions != null)
{
enumBSTR = new VsEnumBSTR(proximityExpressions);
}
}
}
}
});
}
ppEnum = enumBSTR;
return ppEnum != null ? VSConstants.S_OK : VSConstants.E_FAIL;
}
}
public int IsMappedLocation(IVsTextBuffer pBuffer, int iLine, int iCol)
=> VSConstants.E_NOTIMPL;
public int ResolveName(string pszName, uint dwFlags, out IVsEnumDebugName? ppNames)
{
using (Logger.LogBlock(FunctionId.Debugging_VsLanguageDebugInfo_ResolveName, CancellationToken.None))
{
// In VS, this method frequently get's called with an empty string to test if the language service
// supports this method (some language services, like F#, implement IVsLanguageDebugInfo but don't
// implement this method). In that scenario, there's no sense doing work, so we'll just return
// S_FALSE (as the old VB language service did).
if (string.IsNullOrEmpty(pszName))
{
ppNames = null;
return VSConstants.S_FALSE;
}
VsEnumDebugName? enumName = null;
_uiThreadOperationExecutor.Execute(
title: ServicesVSResources.Debugger,
defaultDescription: ServicesVSResources.Resolving_breakpoint_location,
allowCancellation: true,
showProgress: false,
action: waitContext =>
{
var cancellationToken = waitContext.UserCancellationToken;
if (dwFlags == (uint)RESOLVENAMEFLAGS.RNF_BREAKPOINT)
{
var solution = _languageService.Workspace.CurrentSolution;
// NOTE(cyrusn): We have to wait here because the debuggers' ResolveName
// call is synchronous. In the future it would be nice to make it async.
if (_breakpointService != null)
{
var breakpoints = _breakpointService.ResolveBreakpointsAsync(solution, pszName, cancellationToken).WaitAndGetResult(cancellationToken);
var debugNames = breakpoints.Select(bp => CreateDebugName(bp, solution, cancellationToken)).WhereNotNull().ToList();
enumName = new VsEnumDebugName(debugNames);
}
}
});
ppNames = enumName;
return ppNames != null ? VSConstants.S_OK : VSConstants.E_NOTIMPL;
}
}
private IVsDebugName CreateDebugName(BreakpointResolutionResult breakpoint, Solution solution, CancellationToken cancellationToken)
{
var document = breakpoint.Document;
var filePath = _languageService.Workspace.GetFilePath(document.Id);
var text = document.GetTextSynchronously(cancellationToken);
var span = text.GetVsTextSpanForSpan(breakpoint.TextSpan);
// If we're inside an Venus code nugget, we need to map the span to the surface buffer.
// Otherwise, we'll just use the original span.
if (!span.TryMapSpanFromSecondaryBufferToPrimaryBuffer(solution.Workspace, document.Id, out var mappedSpan))
{
mappedSpan = span;
}
return new VsDebugName(breakpoint.LocationNameOpt, filePath, mappedSpan);
}
public int ValidateBreakpointLocation(IVsTextBuffer pBuffer, int iLine, int iCol, VsTextSpan[] pCodeSpan)
{
using (Logger.LogBlock(FunctionId.Debugging_VsLanguageDebugInfo_ValidateBreakpointLocation, CancellationToken.None))
{
var result = VSConstants.E_NOTIMPL;
_uiThreadOperationExecutor.Execute(
title: ServicesVSResources.Debugger,
defaultDescription: ServicesVSResources.Validating_breakpoint_location,
allowCancellation: true,
showProgress: false,
action: waitContext =>
{
result = ValidateBreakpointLocationWorker(pBuffer, iLine, iCol, pCodeSpan, waitContext.UserCancellationToken);
});
return result;
}
}
private int ValidateBreakpointLocationWorker(
IVsTextBuffer pBuffer,
int iLine,
int iCol,
VsTextSpan[] pCodeSpan,
CancellationToken cancellationToken)
{
if (_breakpointService == null)
{
return VSConstants.E_FAIL;
}
var textBuffer = _languageService.EditorAdaptersFactoryService.GetDataBuffer(pBuffer);
if (textBuffer != null)
{
var snapshot = textBuffer.CurrentSnapshot;
var nullablePoint = snapshot.TryGetPoint(iLine, iCol);
if (nullablePoint == null)
{
// The point disappeared between sessions. Do not allow a breakpoint here.
return VSConstants.E_FAIL;
}
var document = snapshot.AsText().GetDocumentWithFrozenPartialSemantics(cancellationToken);
if (document != null)
{
var point = nullablePoint.Value;
var length = 0;
if (pCodeSpan != null && pCodeSpan.Length > 0)
{
// If we have a non-empty span then it means that the debugger is asking us to adjust an
// existing span. In Everett we didn't do this so we had some good and some bad
// behavior. For example if you had a breakpoint on: "int i = 1;" and you changed it to "int
// i = 1, j = 2;", then the breakpoint wouldn't adjust. That was bad. However, if you had the
// breakpoint on an open or close curly brace then it would always "stick" to that brace
// which was good.
//
// So we want to keep the best parts of both systems. We want to appropriately "stick"
// to tokens and we also want to adjust spans intelligently.
//
// However, it turns out the latter is hard to do when there are parse errors in the
// code. Things like missing name nodes cause a lot of havoc and make it difficult to
// track a closing curly brace.
//
// So the way we do this is that we default to not intelligently adjusting the spans
// while there are parse errors. But when there are no parse errors then the span is
// adjusted.
var initialBreakpointSpan = snapshot.GetSpan(pCodeSpan[0]);
if (initialBreakpointSpan.Length > 0 && document.SupportsSyntaxTree)
{
var tree = document.GetSyntaxTreeSynchronously(cancellationToken);
Contract.ThrowIfNull(tree);
if (tree.GetDiagnostics(cancellationToken).Any(d => d.Severity == DiagnosticSeverity.Error))
{
// Keep the span as is.
return VSConstants.S_OK;
}
}
// If a span is provided, and the requested position falls in that span, then just
// move the requested position to the start of the span.
// Length will be used to determine if we need further analysis, which is only required when text spans multiple lines.
if (initialBreakpointSpan.Contains(point))
{
point = initialBreakpointSpan.Start;
length = pCodeSpan[0].iEndLine > pCodeSpan[0].iStartLine ? initialBreakpointSpan.Length : 0;
}
}
// NOTE(cyrusn): we need to wait here because ValidateBreakpointLocation is
// synchronous. In the future, it would be nice for the debugger to provide
// an async entry point for this.
var breakpoint = _breakpointService.ResolveBreakpointAsync(document, new TextSpan(point.Position, length), cancellationToken).WaitAndGetResult(cancellationToken);
if (breakpoint == null)
{
// There should *not* be a breakpoint here. E_FAIL to let the debugger know
// that.
return VSConstants.E_FAIL;
}
if (breakpoint.IsLineBreakpoint)
{
// Let the debugger take care of this. They'll put a line breakpoint
// here. This is useful for when the user does something like put a
// breakpoint in inactive code. We want to allow this as they might
// just have different defines during editing versus debugging.
// TODO(cyrusn): Do we need to set the pCodeSpan in this case?
return VSConstants.E_NOTIMPL;
}
// There should be a breakpoint at the location passed back.
if (pCodeSpan != null && pCodeSpan.Length > 0)
{
pCodeSpan[0] = breakpoint.TextSpan.ToSnapshotSpan(snapshot).ToVsTextSpan();
}
return VSConstants.S_OK;
}
}
return VSConstants.E_NOTIMPL;
}
}
}
}
| // 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.Linq;
using System.Threading;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Debugging;
using Microsoft.CodeAnalysis.Editor.Host;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Internal.Log;
using Microsoft.CodeAnalysis.Text;
using Microsoft.CodeAnalysis.Text.Shared.Extensions;
using Microsoft.VisualStudio.LanguageServices.Implementation.Extensions;
using Microsoft.VisualStudio.LanguageServices.Implementation.Utilities;
using Microsoft.VisualStudio.Utilities;
using Roslyn.Utilities;
using IVsDebugName = Microsoft.VisualStudio.TextManager.Interop.IVsDebugName;
using IVsEnumBSTR = Microsoft.VisualStudio.TextManager.Interop.IVsEnumBSTR;
using IVsTextBuffer = Microsoft.VisualStudio.TextManager.Interop.IVsTextBuffer;
using RESOLVENAMEFLAGS = Microsoft.VisualStudio.TextManager.Interop.RESOLVENAMEFLAGS;
using VsTextSpan = Microsoft.VisualStudio.TextManager.Interop.TextSpan;
namespace Microsoft.VisualStudio.LanguageServices.Implementation.LanguageService
{
internal abstract partial class AbstractLanguageService<TPackage, TLanguageService>
{
internal sealed class VsLanguageDebugInfo : IVsLanguageDebugInfo
{
private readonly Guid _languageId;
private readonly TLanguageService _languageService;
private readonly ILanguageDebugInfoService? _languageDebugInfo;
private readonly IBreakpointResolutionService? _breakpointService;
private readonly IProximityExpressionsService? _proximityExpressionsService;
private readonly IUIThreadOperationExecutor _uiThreadOperationExecutor;
public VsLanguageDebugInfo(
Guid languageId,
TLanguageService languageService,
HostLanguageServices languageServiceProvider,
IUIThreadOperationExecutor uiThreadOperationExecutor)
{
Contract.ThrowIfNull(languageService);
Contract.ThrowIfNull(languageServiceProvider);
_languageId = languageId;
_languageService = languageService;
_languageDebugInfo = languageServiceProvider.GetService<ILanguageDebugInfoService>();
_breakpointService = languageServiceProvider.GetService<IBreakpointResolutionService>();
_proximityExpressionsService = languageServiceProvider.GetService<IProximityExpressionsService>();
_uiThreadOperationExecutor = uiThreadOperationExecutor;
}
public int GetLanguageID(IVsTextBuffer pBuffer, int iLine, int iCol, out Guid pguidLanguageID)
{
pguidLanguageID = _languageId;
return VSConstants.S_OK;
}
public int GetLocationOfName(string pszName, out string? pbstrMkDoc, out VsTextSpan pspanLocation)
{
pbstrMkDoc = null;
pspanLocation = default;
return VSConstants.E_NOTIMPL;
}
public int GetNameOfLocation(IVsTextBuffer pBuffer, int iLine, int iCol, out string? pbstrName, out int piLineOffset)
{
using (Logger.LogBlock(FunctionId.Debugging_VsLanguageDebugInfo_GetNameOfLocation, CancellationToken.None))
{
string? name = null;
var lineOffset = 0;
if (_languageDebugInfo != null)
{
_uiThreadOperationExecutor.Execute(
title: ServicesVSResources.Debugger,
defaultDescription: ServicesVSResources.Determining_breakpoint_location,
allowCancellation: true,
showProgress: false,
action: waitContext =>
{
var cancellationToken = waitContext.UserCancellationToken;
var textBuffer = _languageService.EditorAdaptersFactoryService.GetDataBuffer(pBuffer);
if (textBuffer != null)
{
var nullablePoint = textBuffer.CurrentSnapshot.TryGetPoint(iLine, iCol);
if (nullablePoint.HasValue)
{
var point = nullablePoint.Value;
var document = point.Snapshot.GetOpenDocumentInCurrentContextWithChanges();
if (document != null)
{
// NOTE(cyrusn): We have to wait here because the debuggers'
// GetNameOfLocation is a blocking call. In the future, it
// would be nice if they could make it async.
var debugLocationInfo = _languageDebugInfo.GetLocationInfoAsync(document, point, cancellationToken).WaitAndGetResult(cancellationToken);
if (!debugLocationInfo.IsDefault)
{
name = debugLocationInfo.Name;
lineOffset = debugLocationInfo.LineOffset;
}
}
}
}
});
if (name != null)
{
pbstrName = name;
piLineOffset = lineOffset;
return VSConstants.S_OK;
}
}
// Note(DustinCa): Docs say that GetNameOfLocation should return S_FALSE if a name could not be found.
// Also, that's what the old native code does, so we should do it here.
pbstrName = null;
piLineOffset = 0;
return VSConstants.S_FALSE;
}
}
public int GetProximityExpressions(IVsTextBuffer pBuffer, int iLine, int iCol, int cLines, out IVsEnumBSTR? ppEnum)
{
// NOTE(cyrusn): cLines is ignored. This is to match existing dev10 behavior.
using (Logger.LogBlock(FunctionId.Debugging_VsLanguageDebugInfo_GetProximityExpressions, CancellationToken.None))
{
VsEnumBSTR? enumBSTR = null;
if (_proximityExpressionsService != null)
{
_uiThreadOperationExecutor.Execute(
title: ServicesVSResources.Debugger,
defaultDescription: ServicesVSResources.Determining_autos,
allowCancellation: true,
showProgress: false,
action: context =>
{
var textBuffer = _languageService.EditorAdaptersFactoryService.GetDataBuffer(pBuffer);
if (textBuffer != null)
{
var snapshot = textBuffer.CurrentSnapshot;
var nullablePoint = snapshot.TryGetPoint(iLine, iCol);
if (nullablePoint.HasValue)
{
var document = snapshot.GetOpenDocumentInCurrentContextWithChanges();
if (document != null)
{
var point = nullablePoint.Value;
var proximityExpressions = _proximityExpressionsService.GetProximityExpressionsAsync(document, point.Position, context.UserCancellationToken).WaitAndGetResult(context.UserCancellationToken);
if (proximityExpressions != null)
{
enumBSTR = new VsEnumBSTR(proximityExpressions);
}
}
}
}
});
}
ppEnum = enumBSTR;
return ppEnum != null ? VSConstants.S_OK : VSConstants.E_FAIL;
}
}
public int IsMappedLocation(IVsTextBuffer pBuffer, int iLine, int iCol)
=> VSConstants.E_NOTIMPL;
public int ResolveName(string pszName, uint dwFlags, out IVsEnumDebugName? ppNames)
{
using (Logger.LogBlock(FunctionId.Debugging_VsLanguageDebugInfo_ResolveName, CancellationToken.None))
{
// In VS, this method frequently get's called with an empty string to test if the language service
// supports this method (some language services, like F#, implement IVsLanguageDebugInfo but don't
// implement this method). In that scenario, there's no sense doing work, so we'll just return
// S_FALSE (as the old VB language service did).
if (string.IsNullOrEmpty(pszName))
{
ppNames = null;
return VSConstants.S_FALSE;
}
VsEnumDebugName? enumName = null;
_uiThreadOperationExecutor.Execute(
title: ServicesVSResources.Debugger,
defaultDescription: ServicesVSResources.Resolving_breakpoint_location,
allowCancellation: true,
showProgress: false,
action: waitContext =>
{
var cancellationToken = waitContext.UserCancellationToken;
if (dwFlags == (uint)RESOLVENAMEFLAGS.RNF_BREAKPOINT)
{
var solution = _languageService.Workspace.CurrentSolution;
// NOTE(cyrusn): We have to wait here because the debuggers' ResolveName
// call is synchronous. In the future it would be nice to make it async.
if (_breakpointService != null)
{
var breakpoints = _breakpointService.ResolveBreakpointsAsync(solution, pszName, cancellationToken).WaitAndGetResult(cancellationToken);
var debugNames = breakpoints.Select(bp => CreateDebugName(bp, solution, cancellationToken)).WhereNotNull().ToList();
enumName = new VsEnumDebugName(debugNames);
}
}
});
ppNames = enumName;
return ppNames != null ? VSConstants.S_OK : VSConstants.E_NOTIMPL;
}
}
private IVsDebugName CreateDebugName(BreakpointResolutionResult breakpoint, Solution solution, CancellationToken cancellationToken)
{
var document = breakpoint.Document;
var filePath = _languageService.Workspace.GetFilePath(document.Id);
var text = document.GetTextSynchronously(cancellationToken);
var span = text.GetVsTextSpanForSpan(breakpoint.TextSpan);
// If we're inside an Venus code nugget, we need to map the span to the surface buffer.
// Otherwise, we'll just use the original span.
if (!span.TryMapSpanFromSecondaryBufferToPrimaryBuffer(solution.Workspace, document.Id, out var mappedSpan))
{
mappedSpan = span;
}
return new VsDebugName(breakpoint.LocationNameOpt, filePath, mappedSpan);
}
public int ValidateBreakpointLocation(IVsTextBuffer pBuffer, int iLine, int iCol, VsTextSpan[] pCodeSpan)
{
using (Logger.LogBlock(FunctionId.Debugging_VsLanguageDebugInfo_ValidateBreakpointLocation, CancellationToken.None))
{
var result = VSConstants.E_NOTIMPL;
_uiThreadOperationExecutor.Execute(
title: ServicesVSResources.Debugger,
defaultDescription: ServicesVSResources.Validating_breakpoint_location,
allowCancellation: true,
showProgress: false,
action: waitContext =>
{
result = ValidateBreakpointLocationWorker(pBuffer, iLine, iCol, pCodeSpan, waitContext.UserCancellationToken);
});
return result;
}
}
private int ValidateBreakpointLocationWorker(
IVsTextBuffer pBuffer,
int iLine,
int iCol,
VsTextSpan[] pCodeSpan,
CancellationToken cancellationToken)
{
if (_breakpointService == null)
{
return VSConstants.E_FAIL;
}
var textBuffer = _languageService.EditorAdaptersFactoryService.GetDataBuffer(pBuffer);
if (textBuffer != null)
{
var snapshot = textBuffer.CurrentSnapshot;
var nullablePoint = snapshot.TryGetPoint(iLine, iCol);
if (nullablePoint == null)
{
// The point disappeared between sessions. Do not allow a breakpoint here.
return VSConstants.E_FAIL;
}
var document = snapshot.AsText().GetDocumentWithFrozenPartialSemantics(cancellationToken);
if (document != null)
{
var point = nullablePoint.Value;
var length = 0;
if (pCodeSpan != null && pCodeSpan.Length > 0)
{
// If we have a non-empty span then it means that the debugger is asking us to adjust an
// existing span. In Everett we didn't do this so we had some good and some bad
// behavior. For example if you had a breakpoint on: "int i = 1;" and you changed it to "int
// i = 1, j = 2;", then the breakpoint wouldn't adjust. That was bad. However, if you had the
// breakpoint on an open or close curly brace then it would always "stick" to that brace
// which was good.
//
// So we want to keep the best parts of both systems. We want to appropriately "stick"
// to tokens and we also want to adjust spans intelligently.
//
// However, it turns out the latter is hard to do when there are parse errors in the
// code. Things like missing name nodes cause a lot of havoc and make it difficult to
// track a closing curly brace.
//
// So the way we do this is that we default to not intelligently adjusting the spans
// while there are parse errors. But when there are no parse errors then the span is
// adjusted.
var initialBreakpointSpan = snapshot.GetSpan(pCodeSpan[0]);
if (initialBreakpointSpan.Length > 0 && document.SupportsSyntaxTree)
{
var tree = document.GetSyntaxTreeSynchronously(cancellationToken);
Contract.ThrowIfNull(tree);
if (tree.GetDiagnostics(cancellationToken).Any(d => d.Severity == DiagnosticSeverity.Error))
{
// Keep the span as is.
return VSConstants.S_OK;
}
}
// If a span is provided, and the requested position falls in that span, then just
// move the requested position to the start of the span.
// Length will be used to determine if we need further analysis, which is only required when text spans multiple lines.
if (initialBreakpointSpan.Contains(point))
{
point = initialBreakpointSpan.Start;
length = pCodeSpan[0].iEndLine > pCodeSpan[0].iStartLine ? initialBreakpointSpan.Length : 0;
}
}
// NOTE(cyrusn): we need to wait here because ValidateBreakpointLocation is
// synchronous. In the future, it would be nice for the debugger to provide
// an async entry point for this.
var breakpoint = _breakpointService.ResolveBreakpointAsync(document, new TextSpan(point.Position, length), cancellationToken).WaitAndGetResult(cancellationToken);
if (breakpoint == null)
{
// There should *not* be a breakpoint here. E_FAIL to let the debugger know
// that.
return VSConstants.E_FAIL;
}
if (breakpoint.IsLineBreakpoint)
{
// Let the debugger take care of this. They'll put a line breakpoint
// here. This is useful for when the user does something like put a
// breakpoint in inactive code. We want to allow this as they might
// just have different defines during editing versus debugging.
// TODO(cyrusn): Do we need to set the pCodeSpan in this case?
return VSConstants.E_NOTIMPL;
}
// There should be a breakpoint at the location passed back.
if (pCodeSpan != null && pCodeSpan.Length > 0)
{
pCodeSpan[0] = breakpoint.TextSpan.ToSnapshotSpan(snapshot).ToVsTextSpan();
}
return VSConstants.S_OK;
}
}
return VSConstants.E_NOTIMPL;
}
}
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Compilers/VisualBasic/Portable/Symbols/MethodSymbolExtensions.vb | ' 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.
Imports System
Imports System.Collections.Immutable
Imports System.Runtime.CompilerServices
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
Friend Module MethodSymbolExtensions
''' <summary>
''' Determines if the method can be called with empty parameter list.
''' </summary>
''' <param name="method">The method.</param><returns></returns>
<Extension()>
Friend Function CanBeCalledWithNoParameters(method As MethodSymbol) As Boolean
Dim parameterCount = method.ParameterCount
If parameterCount = 0 Then
Return True
End If
Dim parameters = method.Parameters
For parameterIndex = 0 To parameterCount - 1
Dim param As ParameterSymbol = parameters(parameterIndex)
If param.IsParamArray AndAlso parameterIndex = parameterCount - 1 Then
' ParamArray may be ignored only if the type is an array of rank = 1
Dim type = param.Type
If Not type.IsArrayType OrElse Not DirectCast(type, ArrayTypeSymbol).IsSZArray Then
Return False
End If
ElseIf Not param.IsOptional Then
' We got non-optional parameter
Return False
End If
Next
Return True
End Function
<Extension()>
Friend Function GetParameterSymbol(parameters As ImmutableArray(Of ParameterSymbol), parameter As ParameterSyntax) As ParameterSymbol
Dim syntaxTree = parameter.SyntaxTree
For Each symbol In parameters
For Each location In symbol.Locations
If location.IsInSource AndAlso location.SourceTree Is syntaxTree AndAlso parameter.Span.Contains(location.SourceSpan) Then
Return symbol
End If
Next
Next
Return Nothing
End Function
''' <summary>
''' Determines if the method is partial
''' </summary>
''' <param name="method">The method</param>
<Extension()>
Friend Function IsPartial(method As MethodSymbol) As Boolean
Dim sourceMethod = TryCast(method, SourceMemberMethodSymbol)
Return sourceMethod IsNot Nothing AndAlso sourceMethod.IsPartial
End Function
''' <summary>
''' Determines if the method is partial and does NOT have implementation provided
''' </summary>
''' <param name="method">The method</param>
<Extension()>
Friend Function IsPartialWithoutImplementation(method As MethodSymbol) As Boolean
Dim sourceMethod = TryCast(method, SourceMemberMethodSymbol)
Return sourceMethod IsNot Nothing AndAlso sourceMethod.IsPartial AndAlso sourceMethod.OtherPartOfPartial Is Nothing
End Function
''' <summary>
''' Is method a user-defined operator.
''' </summary>
<Extension()>
Friend Function IsUserDefinedOperator(method As MethodSymbol) As Boolean
Select Case method.MethodKind
Case MethodKind.UserDefinedOperator, MethodKind.Conversion
Return True
End Select
Return False
End Function
''' <summary>
''' Returns a constructed method symbol if 'method' is generic, otherwise just returns 'method'
''' </summary>
<Extension()>
Friend Function ConstructIfGeneric(method As MethodSymbol, typeArguments As ImmutableArray(Of TypeSymbol)) As MethodSymbol
Debug.Assert(method.IsGenericMethod() = (typeArguments.Length > 0))
Return If(method.IsGenericMethod(), method.Construct(typeArguments), method)
End Function
End Module
End Namespace
| ' 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.
Imports System
Imports System.Collections.Immutable
Imports System.Runtime.CompilerServices
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
Friend Module MethodSymbolExtensions
''' <summary>
''' Determines if the method can be called with empty parameter list.
''' </summary>
''' <param name="method">The method.</param><returns></returns>
<Extension()>
Friend Function CanBeCalledWithNoParameters(method As MethodSymbol) As Boolean
Dim parameterCount = method.ParameterCount
If parameterCount = 0 Then
Return True
End If
Dim parameters = method.Parameters
For parameterIndex = 0 To parameterCount - 1
Dim param As ParameterSymbol = parameters(parameterIndex)
If param.IsParamArray AndAlso parameterIndex = parameterCount - 1 Then
' ParamArray may be ignored only if the type is an array of rank = 1
Dim type = param.Type
If Not type.IsArrayType OrElse Not DirectCast(type, ArrayTypeSymbol).IsSZArray Then
Return False
End If
ElseIf Not param.IsOptional Then
' We got non-optional parameter
Return False
End If
Next
Return True
End Function
<Extension()>
Friend Function GetParameterSymbol(parameters As ImmutableArray(Of ParameterSymbol), parameter As ParameterSyntax) As ParameterSymbol
Dim syntaxTree = parameter.SyntaxTree
For Each symbol In parameters
For Each location In symbol.Locations
If location.IsInSource AndAlso location.SourceTree Is syntaxTree AndAlso parameter.Span.Contains(location.SourceSpan) Then
Return symbol
End If
Next
Next
Return Nothing
End Function
''' <summary>
''' Determines if the method is partial
''' </summary>
''' <param name="method">The method</param>
<Extension()>
Friend Function IsPartial(method As MethodSymbol) As Boolean
Dim sourceMethod = TryCast(method, SourceMemberMethodSymbol)
Return sourceMethod IsNot Nothing AndAlso sourceMethod.IsPartial
End Function
''' <summary>
''' Determines if the method is partial and does NOT have implementation provided
''' </summary>
''' <param name="method">The method</param>
<Extension()>
Friend Function IsPartialWithoutImplementation(method As MethodSymbol) As Boolean
Dim sourceMethod = TryCast(method, SourceMemberMethodSymbol)
Return sourceMethod IsNot Nothing AndAlso sourceMethod.IsPartial AndAlso sourceMethod.OtherPartOfPartial Is Nothing
End Function
''' <summary>
''' Is method a user-defined operator.
''' </summary>
<Extension()>
Friend Function IsUserDefinedOperator(method As MethodSymbol) As Boolean
Select Case method.MethodKind
Case MethodKind.UserDefinedOperator, MethodKind.Conversion
Return True
End Select
Return False
End Function
''' <summary>
''' Returns a constructed method symbol if 'method' is generic, otherwise just returns 'method'
''' </summary>
<Extension()>
Friend Function ConstructIfGeneric(method As MethodSymbol, typeArguments As ImmutableArray(Of TypeSymbol)) As MethodSymbol
Debug.Assert(method.IsGenericMethod() = (typeArguments.Length > 0))
Return If(method.IsGenericMethod(), method.Construct(typeArguments), method)
End Function
End Module
End Namespace
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/VisualStudio/Core/Def/Implementation/Workspace/VisualStudioActiveDocumentTracker.cs | // 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.Collections.Immutable;
using System.ComponentModel.Composition;
using System.Linq;
using System.Runtime.InteropServices;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Editor;
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.PooledObjects;
using Microsoft.CodeAnalysis.Text;
using Microsoft.VisualStudio.Editor;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.TextManager.Interop;
using Microsoft.VisualStudio.Threading;
using Roslyn.Utilities;
using IAsyncServiceProvider = Microsoft.VisualStudio.Shell.IAsyncServiceProvider;
namespace Microsoft.VisualStudio.LanguageServices.Implementation
{
/// <summary>
/// A singleton that tracks the open IVsWindowFrames and can report which documents are visible or active in a given <see cref="Workspace"/>.
/// Can be accessed via the <see cref="IDocumentTrackingService"/> as a workspace service.
/// </summary>
[Export]
internal class VisualStudioActiveDocumentTracker : ForegroundThreadAffinitizedObject, IVsSelectionEvents
{
private readonly IVsEditorAdaptersFactoryService _editorAdaptersFactoryService;
/// <summary>
/// The list of tracked frames. This can only be written by the UI thread, although can be read (with care) from any thread.
/// </summary>
private ImmutableList<FrameListener> _visibleFrames = ImmutableList<FrameListener>.Empty;
/// <summary>
/// The active IVsWindowFrame. This can only be written by the UI thread, although can be read (with care) from any thread.
/// </summary>
private IVsWindowFrame? _activeFrame;
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public VisualStudioActiveDocumentTracker(
IThreadingContext threadingContext,
[Import(typeof(SVsServiceProvider))] IAsyncServiceProvider asyncServiceProvider,
IVsEditorAdaptersFactoryService editorAdaptersFactoryService)
: base(threadingContext, assertIsForeground: false)
{
_editorAdaptersFactoryService = editorAdaptersFactoryService;
ThreadingContext.RunWithShutdownBlockAsync(async cancellationToken =>
{
await ThreadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);
var monitorSelectionService = (IVsMonitorSelection?)await asyncServiceProvider.GetServiceAsync(typeof(SVsShellMonitorSelection)).ConfigureAwait(true);
Assumes.Present(monitorSelectionService);
// No need to track windows if we are shutting down
cancellationToken.ThrowIfCancellationRequested();
if (ErrorHandler.Succeeded(monitorSelectionService.GetCurrentElementValue((uint)VSConstants.VSSELELEMID.SEID_DocumentFrame, out var value)))
{
if (value is IVsWindowFrame windowFrame)
{
TrackNewActiveWindowFrame(windowFrame);
}
}
monitorSelectionService.AdviseSelectionEvents(this, out var _);
});
}
/// <summary>
/// Raised when the set of window frames being tracked changes, which means the results from <see cref="TryGetActiveDocument"/> or <see cref="GetVisibleDocuments"/> may change.
/// May be raised on any thread.
/// </summary>
public event EventHandler? DocumentsChanged;
/// <summary>
/// Raised when a non-Roslyn text buffer is edited, which can be used to back off of expensive background processing. May be raised on any thread.
/// </summary>
public event EventHandler<EventArgs>? NonRoslynBufferTextChanged;
/// <summary>
/// Returns the <see cref="DocumentId"/> of the active document in a given <see cref="Workspace"/>.
/// </summary>
public DocumentId? TryGetActiveDocument(Workspace workspace)
{
ThisCanBeCalledOnAnyThread();
// Fetch both fields locally. If there's a write between these, that's fine -- it might mean we
// don't return the DocumentId for something we could have if _activeFrame isn't listed in _visibleFrames.
// But given this API runs unsynchronized against the UI thread, even with locking the same could happen if somebody
// calls just a fraction of a second early.
var visibleFramesSnapshot = _visibleFrames;
var activeFrameSnapshot = _activeFrame;
if (activeFrameSnapshot == null || visibleFramesSnapshot.IsEmpty)
{
return null;
}
foreach (var listener in visibleFramesSnapshot)
{
if (listener.Frame == activeFrameSnapshot)
{
return listener.GetDocumentId(workspace);
}
}
return null;
}
/// <summary>
/// Get a read-only collection of the <see cref="DocumentId"/>s of all the visible documents in the given <see cref="Workspace"/>.
/// </summary>
public ImmutableArray<DocumentId> GetVisibleDocuments(Workspace workspace)
{
ThisCanBeCalledOnAnyThread();
var visibleFramesSnapshot = _visibleFrames;
var ids = ArrayBuilder<DocumentId>.GetInstance(visibleFramesSnapshot.Count);
foreach (var frame in visibleFramesSnapshot)
{
var documentId = frame.GetDocumentId(workspace);
if (documentId != null)
{
ids.Add(documentId);
}
}
return ids.ToImmutableAndFree();
}
public void TrackNewActiveWindowFrame(IVsWindowFrame frame)
{
AssertIsForeground();
Contract.ThrowIfNull(frame);
_activeFrame = frame;
if (!_visibleFrames.Any(f => f.Frame == frame))
{
_visibleFrames = _visibleFrames.Add(new FrameListener(this, frame));
}
this.DocumentsChanged?.Invoke(this, EventArgs.Empty);
}
private void RemoveFrame(FrameListener frame)
{
AssertIsForeground();
if (frame.Frame == _activeFrame)
{
_activeFrame = null;
}
_visibleFrames = _visibleFrames.Remove(frame);
this.DocumentsChanged?.Invoke(this, EventArgs.Empty);
}
int IVsSelectionEvents.OnSelectionChanged(IVsHierarchy pHierOld, [ComAliasName("Microsoft.VisualStudio.Shell.Interop.VSITEMID")] uint itemidOld, IVsMultiItemSelect pMISOld, ISelectionContainer pSCOld, IVsHierarchy pHierNew, [ComAliasName("Microsoft.VisualStudio.Shell.Interop.VSITEMID")] uint itemidNew, IVsMultiItemSelect pMISNew, ISelectionContainer pSCNew)
=> VSConstants.E_NOTIMPL;
int IVsSelectionEvents.OnElementValueChanged([ComAliasName("Microsoft.VisualStudio.Shell.Interop.VSSELELEMID")] uint elementid, object varValueOld, object varValueNew)
{
AssertIsForeground();
if (elementid == (uint)VSConstants.VSSELELEMID.SEID_DocumentFrame)
{
// Remember the newly activated frame so it can be read from another thread.
if (varValueNew is IVsWindowFrame frame)
{
TrackNewActiveWindowFrame(frame);
}
}
return VSConstants.S_OK;
}
int IVsSelectionEvents.OnCmdUIContextChanged([ComAliasName("Microsoft.VisualStudio.Shell.Interop.VSCOOKIE")] uint dwCmdUICookie, [ComAliasName("Microsoft.VisualStudio.OLE.Interop.BOOL")] int fActive)
=> VSConstants.E_NOTIMPL;
/// <summary>
/// Listens to frame notifications for a visible frame. When the frame becomes invisible or closes,
/// then it automatically disconnects.
/// </summary>
private class FrameListener : IVsWindowFrameNotify, IVsWindowFrameNotify2
{
public readonly IVsWindowFrame Frame;
private readonly VisualStudioActiveDocumentTracker _documentTracker;
private readonly uint _frameEventsCookie;
private readonly ITextBuffer? _textBuffer;
public FrameListener(VisualStudioActiveDocumentTracker service, IVsWindowFrame frame)
{
_documentTracker = service;
_documentTracker.AssertIsForeground();
this.Frame = frame;
((IVsWindowFrame2)frame).Advise(this, out _frameEventsCookie);
if (ErrorHandler.Succeeded(frame.GetProperty((int)__VSFPROPID.VSFPROPID_DocData, out var docData)))
{
if (docData is IVsTextBuffer bufferAdapter)
{
_textBuffer = _documentTracker._editorAdaptersFactoryService.GetDocumentBuffer(bufferAdapter);
if (_textBuffer != null && !_textBuffer.ContentType.IsOfType(ContentTypeNames.RoslynContentType))
{
_textBuffer.Changed += NonRoslynTextBuffer_Changed;
}
}
}
}
private void NonRoslynTextBuffer_Changed(object sender, TextContentChangedEventArgs e)
=> _documentTracker.NonRoslynBufferTextChanged?.Invoke(_documentTracker, EventArgs.Empty);
/// <summary>
/// Returns the current DocumentId for this window frame. Care must be made with this value, since "current" could change asynchronously as the document
/// could be unregistered from a workspace.
/// </summary>
public DocumentId? GetDocumentId(Workspace workspace)
{
if (_textBuffer == null)
{
return null;
}
var textContainer = _textBuffer.AsTextContainer();
return workspace.GetDocumentIdInCurrentContext(textContainer);
}
int IVsWindowFrameNotify.OnDockableChange(int fDockable)
=> VSConstants.S_OK;
int IVsWindowFrameNotify.OnMove()
=> VSConstants.S_OK;
int IVsWindowFrameNotify.OnShow(int fShow)
{
switch ((__FRAMESHOW)fShow)
{
case __FRAMESHOW.FRAMESHOW_WinClosed:
case __FRAMESHOW.FRAMESHOW_WinHidden:
case __FRAMESHOW.FRAMESHOW_TabDeactivated:
return Disconnect();
}
return VSConstants.S_OK;
}
int IVsWindowFrameNotify.OnSize()
=> VSConstants.S_OK;
int IVsWindowFrameNotify2.OnClose(ref uint pgrfSaveOptions)
=> Disconnect();
private int Disconnect()
{
_documentTracker.AssertIsForeground();
_documentTracker.RemoveFrame(this);
if (_textBuffer != null)
{
_textBuffer.Changed -= NonRoslynTextBuffer_Changed;
}
if (_frameEventsCookie != VSConstants.VSCOOKIE_NIL)
{
return ((IVsWindowFrame2)Frame).Unadvise(_frameEventsCookie);
}
else
{
return VSConstants.S_OK;
}
}
}
}
}
| // 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.Collections.Immutable;
using System.ComponentModel.Composition;
using System.Linq;
using System.Runtime.InteropServices;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Editor;
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.PooledObjects;
using Microsoft.CodeAnalysis.Text;
using Microsoft.VisualStudio.Editor;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.TextManager.Interop;
using Microsoft.VisualStudio.Threading;
using Roslyn.Utilities;
using IAsyncServiceProvider = Microsoft.VisualStudio.Shell.IAsyncServiceProvider;
namespace Microsoft.VisualStudio.LanguageServices.Implementation
{
/// <summary>
/// A singleton that tracks the open IVsWindowFrames and can report which documents are visible or active in a given <see cref="Workspace"/>.
/// Can be accessed via the <see cref="IDocumentTrackingService"/> as a workspace service.
/// </summary>
[Export]
internal class VisualStudioActiveDocumentTracker : ForegroundThreadAffinitizedObject, IVsSelectionEvents
{
private readonly IVsEditorAdaptersFactoryService _editorAdaptersFactoryService;
/// <summary>
/// The list of tracked frames. This can only be written by the UI thread, although can be read (with care) from any thread.
/// </summary>
private ImmutableList<FrameListener> _visibleFrames = ImmutableList<FrameListener>.Empty;
/// <summary>
/// The active IVsWindowFrame. This can only be written by the UI thread, although can be read (with care) from any thread.
/// </summary>
private IVsWindowFrame? _activeFrame;
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public VisualStudioActiveDocumentTracker(
IThreadingContext threadingContext,
[Import(typeof(SVsServiceProvider))] IAsyncServiceProvider asyncServiceProvider,
IVsEditorAdaptersFactoryService editorAdaptersFactoryService)
: base(threadingContext, assertIsForeground: false)
{
_editorAdaptersFactoryService = editorAdaptersFactoryService;
ThreadingContext.RunWithShutdownBlockAsync(async cancellationToken =>
{
await ThreadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);
var monitorSelectionService = (IVsMonitorSelection?)await asyncServiceProvider.GetServiceAsync(typeof(SVsShellMonitorSelection)).ConfigureAwait(true);
Assumes.Present(monitorSelectionService);
// No need to track windows if we are shutting down
cancellationToken.ThrowIfCancellationRequested();
if (ErrorHandler.Succeeded(monitorSelectionService.GetCurrentElementValue((uint)VSConstants.VSSELELEMID.SEID_DocumentFrame, out var value)))
{
if (value is IVsWindowFrame windowFrame)
{
TrackNewActiveWindowFrame(windowFrame);
}
}
monitorSelectionService.AdviseSelectionEvents(this, out var _);
});
}
/// <summary>
/// Raised when the set of window frames being tracked changes, which means the results from <see cref="TryGetActiveDocument"/> or <see cref="GetVisibleDocuments"/> may change.
/// May be raised on any thread.
/// </summary>
public event EventHandler? DocumentsChanged;
/// <summary>
/// Raised when a non-Roslyn text buffer is edited, which can be used to back off of expensive background processing. May be raised on any thread.
/// </summary>
public event EventHandler<EventArgs>? NonRoslynBufferTextChanged;
/// <summary>
/// Returns the <see cref="DocumentId"/> of the active document in a given <see cref="Workspace"/>.
/// </summary>
public DocumentId? TryGetActiveDocument(Workspace workspace)
{
ThisCanBeCalledOnAnyThread();
// Fetch both fields locally. If there's a write between these, that's fine -- it might mean we
// don't return the DocumentId for something we could have if _activeFrame isn't listed in _visibleFrames.
// But given this API runs unsynchronized against the UI thread, even with locking the same could happen if somebody
// calls just a fraction of a second early.
var visibleFramesSnapshot = _visibleFrames;
var activeFrameSnapshot = _activeFrame;
if (activeFrameSnapshot == null || visibleFramesSnapshot.IsEmpty)
{
return null;
}
foreach (var listener in visibleFramesSnapshot)
{
if (listener.Frame == activeFrameSnapshot)
{
return listener.GetDocumentId(workspace);
}
}
return null;
}
/// <summary>
/// Get a read-only collection of the <see cref="DocumentId"/>s of all the visible documents in the given <see cref="Workspace"/>.
/// </summary>
public ImmutableArray<DocumentId> GetVisibleDocuments(Workspace workspace)
{
ThisCanBeCalledOnAnyThread();
var visibleFramesSnapshot = _visibleFrames;
var ids = ArrayBuilder<DocumentId>.GetInstance(visibleFramesSnapshot.Count);
foreach (var frame in visibleFramesSnapshot)
{
var documentId = frame.GetDocumentId(workspace);
if (documentId != null)
{
ids.Add(documentId);
}
}
return ids.ToImmutableAndFree();
}
public void TrackNewActiveWindowFrame(IVsWindowFrame frame)
{
AssertIsForeground();
Contract.ThrowIfNull(frame);
_activeFrame = frame;
if (!_visibleFrames.Any(f => f.Frame == frame))
{
_visibleFrames = _visibleFrames.Add(new FrameListener(this, frame));
}
this.DocumentsChanged?.Invoke(this, EventArgs.Empty);
}
private void RemoveFrame(FrameListener frame)
{
AssertIsForeground();
if (frame.Frame == _activeFrame)
{
_activeFrame = null;
}
_visibleFrames = _visibleFrames.Remove(frame);
this.DocumentsChanged?.Invoke(this, EventArgs.Empty);
}
int IVsSelectionEvents.OnSelectionChanged(IVsHierarchy pHierOld, [ComAliasName("Microsoft.VisualStudio.Shell.Interop.VSITEMID")] uint itemidOld, IVsMultiItemSelect pMISOld, ISelectionContainer pSCOld, IVsHierarchy pHierNew, [ComAliasName("Microsoft.VisualStudio.Shell.Interop.VSITEMID")] uint itemidNew, IVsMultiItemSelect pMISNew, ISelectionContainer pSCNew)
=> VSConstants.E_NOTIMPL;
int IVsSelectionEvents.OnElementValueChanged([ComAliasName("Microsoft.VisualStudio.Shell.Interop.VSSELELEMID")] uint elementid, object varValueOld, object varValueNew)
{
AssertIsForeground();
if (elementid == (uint)VSConstants.VSSELELEMID.SEID_DocumentFrame)
{
// Remember the newly activated frame so it can be read from another thread.
if (varValueNew is IVsWindowFrame frame)
{
TrackNewActiveWindowFrame(frame);
}
}
return VSConstants.S_OK;
}
int IVsSelectionEvents.OnCmdUIContextChanged([ComAliasName("Microsoft.VisualStudio.Shell.Interop.VSCOOKIE")] uint dwCmdUICookie, [ComAliasName("Microsoft.VisualStudio.OLE.Interop.BOOL")] int fActive)
=> VSConstants.E_NOTIMPL;
/// <summary>
/// Listens to frame notifications for a visible frame. When the frame becomes invisible or closes,
/// then it automatically disconnects.
/// </summary>
private class FrameListener : IVsWindowFrameNotify, IVsWindowFrameNotify2
{
public readonly IVsWindowFrame Frame;
private readonly VisualStudioActiveDocumentTracker _documentTracker;
private readonly uint _frameEventsCookie;
private readonly ITextBuffer? _textBuffer;
public FrameListener(VisualStudioActiveDocumentTracker service, IVsWindowFrame frame)
{
_documentTracker = service;
_documentTracker.AssertIsForeground();
this.Frame = frame;
((IVsWindowFrame2)frame).Advise(this, out _frameEventsCookie);
if (ErrorHandler.Succeeded(frame.GetProperty((int)__VSFPROPID.VSFPROPID_DocData, out var docData)))
{
if (docData is IVsTextBuffer bufferAdapter)
{
_textBuffer = _documentTracker._editorAdaptersFactoryService.GetDocumentBuffer(bufferAdapter);
if (_textBuffer != null && !_textBuffer.ContentType.IsOfType(ContentTypeNames.RoslynContentType))
{
_textBuffer.Changed += NonRoslynTextBuffer_Changed;
}
}
}
}
private void NonRoslynTextBuffer_Changed(object sender, TextContentChangedEventArgs e)
=> _documentTracker.NonRoslynBufferTextChanged?.Invoke(_documentTracker, EventArgs.Empty);
/// <summary>
/// Returns the current DocumentId for this window frame. Care must be made with this value, since "current" could change asynchronously as the document
/// could be unregistered from a workspace.
/// </summary>
public DocumentId? GetDocumentId(Workspace workspace)
{
if (_textBuffer == null)
{
return null;
}
var textContainer = _textBuffer.AsTextContainer();
return workspace.GetDocumentIdInCurrentContext(textContainer);
}
int IVsWindowFrameNotify.OnDockableChange(int fDockable)
=> VSConstants.S_OK;
int IVsWindowFrameNotify.OnMove()
=> VSConstants.S_OK;
int IVsWindowFrameNotify.OnShow(int fShow)
{
switch ((__FRAMESHOW)fShow)
{
case __FRAMESHOW.FRAMESHOW_WinClosed:
case __FRAMESHOW.FRAMESHOW_WinHidden:
case __FRAMESHOW.FRAMESHOW_TabDeactivated:
return Disconnect();
}
return VSConstants.S_OK;
}
int IVsWindowFrameNotify.OnSize()
=> VSConstants.S_OK;
int IVsWindowFrameNotify2.OnClose(ref uint pgrfSaveOptions)
=> Disconnect();
private int Disconnect()
{
_documentTracker.AssertIsForeground();
_documentTracker.RemoveFrame(this);
if (_textBuffer != null)
{
_textBuffer.Changed -= NonRoslynTextBuffer_Changed;
}
if (_frameEventsCookie != VSConstants.VSCOOKIE_NIL)
{
return ((IVsWindowFrame2)Frame).Unadvise(_frameEventsCookie);
}
else
{
return VSConstants.S_OK;
}
}
}
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/VisualStudio/IntegrationTest/IntegrationTests/VisualBasic/BasicEditAndContinue.cs | // 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.
#nullable disable
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Shared.TestHooks;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.VisualStudio.IntegrationTest.Utilities;
using Microsoft.VisualStudio.IntegrationTest.Utilities.Input;
using Roslyn.Test.Utilities;
using Xunit;
using Xunit.Abstractions;
using ProjectUtils = Microsoft.VisualStudio.IntegrationTest.Utilities.Common.ProjectUtils;
namespace Roslyn.VisualStudio.IntegrationTests.VisualBasic
{
[Collection(nameof(SharedIntegrationHostFixture))]
public class BasicEditAndContinue : AbstractEditorTest
{
private const string module1FileName = "Module1.vb";
public BasicEditAndContinue(VisualStudioInstanceFactory instanceFactory)
: base(instanceFactory)
{
}
protected override string LanguageName => LanguageNames.VisualBasic;
public override async Task InitializeAsync()
{
await base.InitializeAsync();
VisualStudio.SolutionExplorer.CreateSolution(nameof(BasicBuild));
var testProj = new ProjectUtils.Project("TestProj");
VisualStudio.SolutionExplorer.AddProject(testProj, WellKnownProjectTemplates.ConsoleApplication, LanguageNames.VisualBasic);
}
// Also "https://github.com/dotnet/roslyn/issues/37689")]
[WpfFact(Skip = "https://github.com/dotnet/roslyn/issues/35965")]
[Trait(Traits.Feature, Traits.Features.DebuggingEditAndContinue)]
public void UpdateActiveStatementLeafNode()
{
VisualStudio.Editor.SetText(@"
Imports System
Imports System.Collections.Generic
Imports System.Linq
Module Module1
Sub Main()
Dim names(2) As String
names(0) = ""goo""
names(1) = ""bar""
For index = 0 To names.GetUpperBound(0)
Console.WriteLine(names(index))
Next
End Sub
End Module
");
VisualStudio.Workspace.WaitForAsyncOperations(Helper.HangMitigatingTimeout, FeatureAttribute.Workspace);
VisualStudio.Debugger.SetBreakPoint(module1FileName, "names(0)");
VisualStudio.Debugger.Go(waitForBreakMode: true);
VisualStudio.Editor.Activate();
VisualStudio.Editor.ReplaceText("names(0)", "names(1)");
VisualStudio.Debugger.StepOver(waitForBreakOrEnd: true);
VisualStudio.Debugger.CheckExpression("names(1)", "String", "\"goo\"");
VisualStudio.Debugger.StepOver(waitForBreakOrEnd: true);
VisualStudio.Debugger.CheckExpression("names(1)", "String", "\"bar\"");
}
// Also "https://github.com/dotnet/roslyn/issues/37689")]
[WpfFact(Skip = "https://github.com/dotnet/roslyn/issues/35965")]
[Trait(Traits.Feature, Traits.Features.DebuggingEditAndContinue)]
public void AddTryCatchAroundActiveStatement()
{
VisualStudio.Editor.SetText(@"
Imports System
Module Module1
Sub Main()
Goo()
End Sub
Private Sub Goo()
Console.WriteLine(1)
End Sub
End Module");
VisualStudio.Workspace.WaitForAsyncOperations(Helper.HangMitigatingTimeout, FeatureAttribute.Workspace);
VisualStudio.Debugger.SetBreakPoint(module1FileName, "Console.WriteLine(1)");
VisualStudio.Debugger.Go(waitForBreakMode: true);
VisualStudio.Editor.Activate();
VisualStudio.Editor.ReplaceText("Console.WriteLine(1)",
@"Try
Console.WriteLine(1)
Catch ex As Exception
End Try");
VisualStudio.Workspace.WaitForAsyncOperations(Helper.HangMitigatingTimeout, FeatureAttribute.Workspace);
VisualStudio.Debugger.StepOver(waitForBreakOrEnd: true);
VisualStudio.Editor.Verify.CurrentLineText("End Try");
}
// Also "https://github.com/dotnet/roslyn/issues/37689")]
[WpfFact(Skip = "https://github.com/dotnet/roslyn/issues/35965")]
[Trait(Traits.Feature, Traits.Features.DebuggingEditAndContinue)]
public void EditLambdaExpression()
{
VisualStudio.Editor.SetText(@"
Imports System
Module Module1
Private Delegate Function del(i As Integer) As Integer
Sub Main()
Dim myDel As del = Function(x) x * x
Dim j As Integer = myDel(5)
End Sub
End Module");
VisualStudio.Workspace.WaitForAsyncOperations(Helper.HangMitigatingTimeout, FeatureAttribute.Workspace);
VisualStudio.Debugger.SetBreakPoint(module1FileName, "x * x", charsOffset: -1);
VisualStudio.Debugger.Go(waitForBreakMode: true);
VisualStudio.Editor.Activate();
VisualStudio.Editor.ReplaceText("x * x", "x * 2");
VisualStudio.Debugger.StepOver(waitForBreakOrEnd: false);
VisualStudio.Debugger.Stop(waitForDesignMode: true);
VisualStudio.ErrorList.Verify.NoBuildErrors();
VisualStudio.Debugger.Go(waitForBreakMode: true);
VisualStudio.Editor.Activate();
VisualStudio.Editor.ReplaceText("x * 2", "x * x");
VisualStudio.Debugger.StepOver(waitForBreakOrEnd: true);
VisualStudio.Debugger.Stop(waitForDesignMode: true);
VisualStudio.ErrorList.Verify.NoBuildErrors();
}
// Also "https://github.com/dotnet/roslyn/issues/37689")]
[WpfFact(Skip = "https://github.com/dotnet/roslyn/issues/35965")]
[Trait(Traits.Feature, Traits.Features.DebuggingEditAndContinue)]
public void EnCWhileDebuggingFromImmediateWindow()
{
VisualStudio.Editor.SetText(@"
Imports System
Module Module1
Sub Main()
Dim x = 4
Console.WriteLine(x)
End Sub
End Module");
VisualStudio.Workspace.WaitForAsyncOperations(Helper.HangMitigatingTimeout, FeatureAttribute.Workspace);
VisualStudio.Debugger.Go(waitForBreakMode: true);
VisualStudio.Debugger.SetBreakPoint(module1FileName, "Dim x", charsOffset: 1);
VisualStudio.Debugger.ExecuteStatement("Module1.Main()");
VisualStudio.Editor.ReplaceText("x = 4", "x = 42");
VisualStudio.Debugger.StepOver(waitForBreakOrEnd: true);
VisualStudio.Debugger.CheckExpression("x", "Integer", "42");
VisualStudio.Debugger.ExecuteStatement("Module1.Main()");
}
private void SetupMultiProjectSolution()
{
var basicLibrary = new ProjectUtils.Project("BasicLibrary1");
VisualStudio.SolutionExplorer.AddProject(basicLibrary, WellKnownProjectTemplates.ClassLibrary, LanguageNames.VisualBasic);
var cSharpLibrary = new ProjectUtils.Project("CSharpLibrary1");
VisualStudio.SolutionExplorer.AddProject(cSharpLibrary, WellKnownProjectTemplates.ClassLibrary, LanguageNames.CSharp);
VisualStudio.SolutionExplorer.AddFile(cSharpLibrary, "File1.cs");
VisualStudio.SolutionExplorer.OpenFile(basicLibrary, "Class1.vb");
VisualStudio.Editor.SetText(@"
Imports System
Public Class Class1
Public Sub New()
End Sub
Public Sub PrintX(x As Integer)
Console.WriteLine(x)
End Sub
End Class
");
var project = new ProjectUtils.Project(ProjectName);
VisualStudio.SolutionExplorer.AddProjectReference(project, new ProjectUtils.ProjectReference("BasicLibrary1"));
VisualStudio.SolutionExplorer.OpenFile(project, module1FileName);
VisualStudio.Editor.SetText(@"
Imports System
Imports BasicLibrary1
Module Module1
Sub Main()
Dim c As New Class1()
c.PrintX(5)
End Sub
End Module
");
VisualStudio.Workspace.WaitForAsyncOperations(Helper.HangMitigatingTimeout, FeatureAttribute.Workspace);
}
// Also https://github.com/dotnet/roslyn/issues/36763
[WpfFact(Skip = "https://github.com/dotnet/roslyn/issues/35965")]
[Trait(Traits.Feature, Traits.Features.DebuggingEditAndContinue)]
public void MultiProjectDebuggingWhereNotAllModulesAreLoaded()
{
SetupMultiProjectSolution();
VisualStudio.Debugger.SetBreakPoint(module1FileName, "PrintX", charsOffset: 1);
VisualStudio.Debugger.Go(waitForBreakMode: true);
VisualStudio.Editor.Activate();
VisualStudio.Editor.ReplaceText("5", "42");
VisualStudio.Debugger.StepOver(waitForBreakOrEnd: false);
VisualStudio.ErrorList.Verify.NoErrors();
}
// Also "https://github.com/dotnet/roslyn/issues/37689")]
[WpfFact(Skip = "https://github.com/dotnet/roslyn/issues/35965")]
[Trait(Traits.Feature, Traits.Features.DebuggingEditAndContinue)]
public void LocalsWindowUpdatesAfterLocalGetsItsTypeUpdatedDuringEnC()
{
VisualStudio.Editor.SetText(@"
Imports System
Module Module1
Sub Main()
Dim goo As String = ""abc""
Console.WriteLine(goo)
End Sub
End Module
");
VisualStudio.Workspace.WaitForAsyncOperations(Helper.HangMitigatingTimeout, FeatureAttribute.Workspace);
VisualStudio.Debugger.SetBreakPoint(module1FileName, "End Sub");
VisualStudio.Debugger.Go(waitForBreakMode: true);
VisualStudio.Editor.Activate();
VisualStudio.Editor.ReplaceText("Dim goo As String = \"abc\"", "Dim goo As Single = 10");
VisualStudio.Editor.SelectTextInCurrentDocument("Sub Main()");
VisualStudio.Debugger.SetNextStatement();
VisualStudio.Debugger.Go(waitForBreakMode: true);
VisualStudio.LocalsWindow.Verify.CheckEntry("goo", "Single", "10");
}
// Also "https://github.com/dotnet/roslyn/issues/37689")]
[WpfFact(Skip = "https://github.com/dotnet/roslyn/issues/35965")]
[Trait(Traits.Feature, Traits.Features.DebuggingEditAndContinue)]
public void LocalsWindowUpdatesCorrectlyDuringEnC()
{
VisualStudio.Editor.SetText(@"
Imports System
Module Module1
Sub Main()
bar(5)
End Sub
Function bar(ByVal moo As Long) As Decimal
Dim iInt As Integer = 0
Dim lLng As Long = 5
iInt += 30
Return 4
End Function
End Module
");
VisualStudio.Workspace.WaitForAsyncOperations(Helper.HangMitigatingTimeout, FeatureAttribute.Workspace);
VisualStudio.Debugger.SetBreakPoint(module1FileName, "Function bar(ByVal moo As Long) As Decimal");
VisualStudio.Debugger.Go(waitForBreakMode: true);
VisualStudio.Editor.Activate();
VisualStudio.Editor.ReplaceText("Dim lLng As Long = 5", "Dim lLng As Long = 444");
VisualStudio.Debugger.SetBreakPoint(module1FileName, "Return 4");
VisualStudio.Debugger.Go(waitForBreakMode: true);
VisualStudio.LocalsWindow.Verify.CheckEntry("bar", "Decimal", "0");
VisualStudio.LocalsWindow.Verify.CheckEntry("moo", "Long", "5");
VisualStudio.LocalsWindow.Verify.CheckEntry("iInt", "Integer", "30");
VisualStudio.LocalsWindow.Verify.CheckEntry("lLng", "Long", "444");
}
// Also "https://github.com/dotnet/roslyn/issues/37689")]
[WpfFact(Skip = "https://github.com/dotnet/roslyn/issues/35965")]
[Trait(Traits.Feature, Traits.Features.DebuggingEditAndContinue)]
public void WatchWindowUpdatesCorrectlyDuringEnC()
{
VisualStudio.Editor.SetText(@"
Imports System
Module Module1
Sub Main()
Dim iInt As Integer = 0
System.Diagnostics.Debugger.Break()
End Sub
End Module
");
VisualStudio.Workspace.WaitForAsyncOperations(Helper.HangMitigatingTimeout, FeatureAttribute.Workspace);
VisualStudio.Debugger.Go(waitForBreakMode: true);
VisualStudio.Editor.Activate();
VisualStudio.Debugger.CheckExpression("iInt", "Integer", "0");
VisualStudio.Editor.ReplaceText("System.Diagnostics.Debugger.Break()", @"iInt = 5
System.Diagnostics.Debugger.Break()");
VisualStudio.Editor.SelectTextInCurrentDocument("iInt = 5");
VisualStudio.Debugger.SetNextStatement();
VisualStudio.Debugger.Go(waitForBreakMode: true);
VisualStudio.Debugger.CheckExpression("iInt", "Integer", "5");
}
}
}
| // 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.
#nullable disable
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Shared.TestHooks;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.VisualStudio.IntegrationTest.Utilities;
using Microsoft.VisualStudio.IntegrationTest.Utilities.Input;
using Roslyn.Test.Utilities;
using Xunit;
using Xunit.Abstractions;
using ProjectUtils = Microsoft.VisualStudio.IntegrationTest.Utilities.Common.ProjectUtils;
namespace Roslyn.VisualStudio.IntegrationTests.VisualBasic
{
[Collection(nameof(SharedIntegrationHostFixture))]
public class BasicEditAndContinue : AbstractEditorTest
{
private const string module1FileName = "Module1.vb";
public BasicEditAndContinue(VisualStudioInstanceFactory instanceFactory)
: base(instanceFactory)
{
}
protected override string LanguageName => LanguageNames.VisualBasic;
public override async Task InitializeAsync()
{
await base.InitializeAsync();
VisualStudio.SolutionExplorer.CreateSolution(nameof(BasicBuild));
var testProj = new ProjectUtils.Project("TestProj");
VisualStudio.SolutionExplorer.AddProject(testProj, WellKnownProjectTemplates.ConsoleApplication, LanguageNames.VisualBasic);
}
// Also "https://github.com/dotnet/roslyn/issues/37689")]
[WpfFact(Skip = "https://github.com/dotnet/roslyn/issues/35965")]
[Trait(Traits.Feature, Traits.Features.DebuggingEditAndContinue)]
public void UpdateActiveStatementLeafNode()
{
VisualStudio.Editor.SetText(@"
Imports System
Imports System.Collections.Generic
Imports System.Linq
Module Module1
Sub Main()
Dim names(2) As String
names(0) = ""goo""
names(1) = ""bar""
For index = 0 To names.GetUpperBound(0)
Console.WriteLine(names(index))
Next
End Sub
End Module
");
VisualStudio.Workspace.WaitForAsyncOperations(Helper.HangMitigatingTimeout, FeatureAttribute.Workspace);
VisualStudio.Debugger.SetBreakPoint(module1FileName, "names(0)");
VisualStudio.Debugger.Go(waitForBreakMode: true);
VisualStudio.Editor.Activate();
VisualStudio.Editor.ReplaceText("names(0)", "names(1)");
VisualStudio.Debugger.StepOver(waitForBreakOrEnd: true);
VisualStudio.Debugger.CheckExpression("names(1)", "String", "\"goo\"");
VisualStudio.Debugger.StepOver(waitForBreakOrEnd: true);
VisualStudio.Debugger.CheckExpression("names(1)", "String", "\"bar\"");
}
// Also "https://github.com/dotnet/roslyn/issues/37689")]
[WpfFact(Skip = "https://github.com/dotnet/roslyn/issues/35965")]
[Trait(Traits.Feature, Traits.Features.DebuggingEditAndContinue)]
public void AddTryCatchAroundActiveStatement()
{
VisualStudio.Editor.SetText(@"
Imports System
Module Module1
Sub Main()
Goo()
End Sub
Private Sub Goo()
Console.WriteLine(1)
End Sub
End Module");
VisualStudio.Workspace.WaitForAsyncOperations(Helper.HangMitigatingTimeout, FeatureAttribute.Workspace);
VisualStudio.Debugger.SetBreakPoint(module1FileName, "Console.WriteLine(1)");
VisualStudio.Debugger.Go(waitForBreakMode: true);
VisualStudio.Editor.Activate();
VisualStudio.Editor.ReplaceText("Console.WriteLine(1)",
@"Try
Console.WriteLine(1)
Catch ex As Exception
End Try");
VisualStudio.Workspace.WaitForAsyncOperations(Helper.HangMitigatingTimeout, FeatureAttribute.Workspace);
VisualStudio.Debugger.StepOver(waitForBreakOrEnd: true);
VisualStudio.Editor.Verify.CurrentLineText("End Try");
}
// Also "https://github.com/dotnet/roslyn/issues/37689")]
[WpfFact(Skip = "https://github.com/dotnet/roslyn/issues/35965")]
[Trait(Traits.Feature, Traits.Features.DebuggingEditAndContinue)]
public void EditLambdaExpression()
{
VisualStudio.Editor.SetText(@"
Imports System
Module Module1
Private Delegate Function del(i As Integer) As Integer
Sub Main()
Dim myDel As del = Function(x) x * x
Dim j As Integer = myDel(5)
End Sub
End Module");
VisualStudio.Workspace.WaitForAsyncOperations(Helper.HangMitigatingTimeout, FeatureAttribute.Workspace);
VisualStudio.Debugger.SetBreakPoint(module1FileName, "x * x", charsOffset: -1);
VisualStudio.Debugger.Go(waitForBreakMode: true);
VisualStudio.Editor.Activate();
VisualStudio.Editor.ReplaceText("x * x", "x * 2");
VisualStudio.Debugger.StepOver(waitForBreakOrEnd: false);
VisualStudio.Debugger.Stop(waitForDesignMode: true);
VisualStudio.ErrorList.Verify.NoBuildErrors();
VisualStudio.Debugger.Go(waitForBreakMode: true);
VisualStudio.Editor.Activate();
VisualStudio.Editor.ReplaceText("x * 2", "x * x");
VisualStudio.Debugger.StepOver(waitForBreakOrEnd: true);
VisualStudio.Debugger.Stop(waitForDesignMode: true);
VisualStudio.ErrorList.Verify.NoBuildErrors();
}
// Also "https://github.com/dotnet/roslyn/issues/37689")]
[WpfFact(Skip = "https://github.com/dotnet/roslyn/issues/35965")]
[Trait(Traits.Feature, Traits.Features.DebuggingEditAndContinue)]
public void EnCWhileDebuggingFromImmediateWindow()
{
VisualStudio.Editor.SetText(@"
Imports System
Module Module1
Sub Main()
Dim x = 4
Console.WriteLine(x)
End Sub
End Module");
VisualStudio.Workspace.WaitForAsyncOperations(Helper.HangMitigatingTimeout, FeatureAttribute.Workspace);
VisualStudio.Debugger.Go(waitForBreakMode: true);
VisualStudio.Debugger.SetBreakPoint(module1FileName, "Dim x", charsOffset: 1);
VisualStudio.Debugger.ExecuteStatement("Module1.Main()");
VisualStudio.Editor.ReplaceText("x = 4", "x = 42");
VisualStudio.Debugger.StepOver(waitForBreakOrEnd: true);
VisualStudio.Debugger.CheckExpression("x", "Integer", "42");
VisualStudio.Debugger.ExecuteStatement("Module1.Main()");
}
private void SetupMultiProjectSolution()
{
var basicLibrary = new ProjectUtils.Project("BasicLibrary1");
VisualStudio.SolutionExplorer.AddProject(basicLibrary, WellKnownProjectTemplates.ClassLibrary, LanguageNames.VisualBasic);
var cSharpLibrary = new ProjectUtils.Project("CSharpLibrary1");
VisualStudio.SolutionExplorer.AddProject(cSharpLibrary, WellKnownProjectTemplates.ClassLibrary, LanguageNames.CSharp);
VisualStudio.SolutionExplorer.AddFile(cSharpLibrary, "File1.cs");
VisualStudio.SolutionExplorer.OpenFile(basicLibrary, "Class1.vb");
VisualStudio.Editor.SetText(@"
Imports System
Public Class Class1
Public Sub New()
End Sub
Public Sub PrintX(x As Integer)
Console.WriteLine(x)
End Sub
End Class
");
var project = new ProjectUtils.Project(ProjectName);
VisualStudio.SolutionExplorer.AddProjectReference(project, new ProjectUtils.ProjectReference("BasicLibrary1"));
VisualStudio.SolutionExplorer.OpenFile(project, module1FileName);
VisualStudio.Editor.SetText(@"
Imports System
Imports BasicLibrary1
Module Module1
Sub Main()
Dim c As New Class1()
c.PrintX(5)
End Sub
End Module
");
VisualStudio.Workspace.WaitForAsyncOperations(Helper.HangMitigatingTimeout, FeatureAttribute.Workspace);
}
// Also https://github.com/dotnet/roslyn/issues/36763
[WpfFact(Skip = "https://github.com/dotnet/roslyn/issues/35965")]
[Trait(Traits.Feature, Traits.Features.DebuggingEditAndContinue)]
public void MultiProjectDebuggingWhereNotAllModulesAreLoaded()
{
SetupMultiProjectSolution();
VisualStudio.Debugger.SetBreakPoint(module1FileName, "PrintX", charsOffset: 1);
VisualStudio.Debugger.Go(waitForBreakMode: true);
VisualStudio.Editor.Activate();
VisualStudio.Editor.ReplaceText("5", "42");
VisualStudio.Debugger.StepOver(waitForBreakOrEnd: false);
VisualStudio.ErrorList.Verify.NoErrors();
}
// Also "https://github.com/dotnet/roslyn/issues/37689")]
[WpfFact(Skip = "https://github.com/dotnet/roslyn/issues/35965")]
[Trait(Traits.Feature, Traits.Features.DebuggingEditAndContinue)]
public void LocalsWindowUpdatesAfterLocalGetsItsTypeUpdatedDuringEnC()
{
VisualStudio.Editor.SetText(@"
Imports System
Module Module1
Sub Main()
Dim goo As String = ""abc""
Console.WriteLine(goo)
End Sub
End Module
");
VisualStudio.Workspace.WaitForAsyncOperations(Helper.HangMitigatingTimeout, FeatureAttribute.Workspace);
VisualStudio.Debugger.SetBreakPoint(module1FileName, "End Sub");
VisualStudio.Debugger.Go(waitForBreakMode: true);
VisualStudio.Editor.Activate();
VisualStudio.Editor.ReplaceText("Dim goo As String = \"abc\"", "Dim goo As Single = 10");
VisualStudio.Editor.SelectTextInCurrentDocument("Sub Main()");
VisualStudio.Debugger.SetNextStatement();
VisualStudio.Debugger.Go(waitForBreakMode: true);
VisualStudio.LocalsWindow.Verify.CheckEntry("goo", "Single", "10");
}
// Also "https://github.com/dotnet/roslyn/issues/37689")]
[WpfFact(Skip = "https://github.com/dotnet/roslyn/issues/35965")]
[Trait(Traits.Feature, Traits.Features.DebuggingEditAndContinue)]
public void LocalsWindowUpdatesCorrectlyDuringEnC()
{
VisualStudio.Editor.SetText(@"
Imports System
Module Module1
Sub Main()
bar(5)
End Sub
Function bar(ByVal moo As Long) As Decimal
Dim iInt As Integer = 0
Dim lLng As Long = 5
iInt += 30
Return 4
End Function
End Module
");
VisualStudio.Workspace.WaitForAsyncOperations(Helper.HangMitigatingTimeout, FeatureAttribute.Workspace);
VisualStudio.Debugger.SetBreakPoint(module1FileName, "Function bar(ByVal moo As Long) As Decimal");
VisualStudio.Debugger.Go(waitForBreakMode: true);
VisualStudio.Editor.Activate();
VisualStudio.Editor.ReplaceText("Dim lLng As Long = 5", "Dim lLng As Long = 444");
VisualStudio.Debugger.SetBreakPoint(module1FileName, "Return 4");
VisualStudio.Debugger.Go(waitForBreakMode: true);
VisualStudio.LocalsWindow.Verify.CheckEntry("bar", "Decimal", "0");
VisualStudio.LocalsWindow.Verify.CheckEntry("moo", "Long", "5");
VisualStudio.LocalsWindow.Verify.CheckEntry("iInt", "Integer", "30");
VisualStudio.LocalsWindow.Verify.CheckEntry("lLng", "Long", "444");
}
// Also "https://github.com/dotnet/roslyn/issues/37689")]
[WpfFact(Skip = "https://github.com/dotnet/roslyn/issues/35965")]
[Trait(Traits.Feature, Traits.Features.DebuggingEditAndContinue)]
public void WatchWindowUpdatesCorrectlyDuringEnC()
{
VisualStudio.Editor.SetText(@"
Imports System
Module Module1
Sub Main()
Dim iInt As Integer = 0
System.Diagnostics.Debugger.Break()
End Sub
End Module
");
VisualStudio.Workspace.WaitForAsyncOperations(Helper.HangMitigatingTimeout, FeatureAttribute.Workspace);
VisualStudio.Debugger.Go(waitForBreakMode: true);
VisualStudio.Editor.Activate();
VisualStudio.Debugger.CheckExpression("iInt", "Integer", "0");
VisualStudio.Editor.ReplaceText("System.Diagnostics.Debugger.Break()", @"iInt = 5
System.Diagnostics.Debugger.Break()");
VisualStudio.Editor.SelectTextInCurrentDocument("iInt = 5");
VisualStudio.Debugger.SetNextStatement();
VisualStudio.Debugger.Go(waitForBreakMode: true);
VisualStudio.Debugger.CheckExpression("iInt", "Integer", "5");
}
}
}
| -1 |
dotnet/roslyn | 55,098 | Use directory-scoped ALCs to load analyzers in .NET Core | Resolves #52177 | RikkiGibson | 2021-07-23T23:26:39Z | 2021-08-23T19:01:28Z | e079a36f3ade7cda2a464e4fdcde0a11577fd1ea | 99f45b7c174d1a2e9b6a1d810b4069600c80421d | Use directory-scoped ALCs to load analyzers in .NET Core. Resolves #52177 | ./src/Compilers/VisualBasic/Portable/Syntax/InternalSyntax/SyntaxSubKind.vb | ' 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.
Namespace Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax
Friend Enum SyntaxSubKind
None
BeginDocTypeToken
LessThanExclamationToken
OpenBracketToken
CloseBracketToken
End Enum
End Namespace
| ' 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.
Namespace Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax
Friend Enum SyntaxSubKind
None
BeginDocTypeToken
LessThanExclamationToken
OpenBracketToken
CloseBracketToken
End Enum
End Namespace
| -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.