diff options
author | Pat Gavlin <pagavlin@microsoft.com> | 2015-12-04 14:22:14 -0800 |
---|---|---|
committer | Pat Gavlin <pagavlin@microsoft.com> | 2015-12-04 15:57:25 -0800 |
commit | d999a0aa9df21107e213f1c491b8961838e47a2e (patch) | |
tree | 83878ac83ddac7b33ec7669f0eb122abe1576a76 /tests/src/JIT/jit64/valuetypes/nullable/box-unbox | |
parent | 4feb6c40dd4d60783b54d8b58431bf069c143796 (diff) | |
download | coreclr-d999a0aa9df21107e213f1c491b8961838e47a2e.tar.gz coreclr-d999a0aa9df21107e213f1c491b8961838e47a2e.tar.bz2 coreclr-d999a0aa9df21107e213f1c491b8961838e47a2e.zip |
Import jit/jit64/valuetype/nullable tests.
This includes box/unbox and cast tests. There is also a small change
to jit/config/minimal/project.json to include
the System.Runtime.InteropServices package.
Diffstat (limited to 'tests/src/JIT/jit64/valuetypes/nullable/box-unbox')
393 files changed, 17500 insertions, 0 deletions
diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/app.config b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/app.config new file mode 100644 index 0000000000..8077c95440 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/app.config @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<configuration> + <runtime> + <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> + <dependentAssembly> + <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.20.0" newVersion="4.0.20.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Text.Encoding" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.IO" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Reflection" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + </assemblyBinding> + </runtime> +</configuration>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox001.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox001.cs new file mode 100644 index 0000000000..055705ef46 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox001.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(object o) + { + return Helper.Compare((char)o, Helper.Create(default(char))); + } + + private static bool BoxUnboxToQ(object o) + { + return Helper.Compare((char?)o, Helper.Create(default(char))); + } + + private static int Main() + { + char? s = Helper.Create(default(char)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox001.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox001.csproj new file mode 100644 index 0000000000..e66bc7e806 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox001.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox001.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project> diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox002.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox002.cs new file mode 100644 index 0000000000..a32522e683 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox002.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of bool using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(object o) + { + return Helper.Compare((bool)o, Helper.Create(default(bool))); + } + + private static bool BoxUnboxToQ(object o) + { + return Helper.Compare((bool?)o, Helper.Create(default(bool))); + } + + private static int Main() + { + bool? s = Helper.Create(default(bool)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox002.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox002.csproj new file mode 100644 index 0000000000..0c13b89ca2 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox002.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox002.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox003.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox003.cs new file mode 100644 index 0000000000..11590f7195 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox003.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(object o) + { + return Helper.Compare((byte)o, Helper.Create(default(byte))); + } + + private static bool BoxUnboxToQ(object o) + { + return Helper.Compare((byte?)o, Helper.Create(default(byte))); + } + + private static int Main() + { + byte? s = Helper.Create(default(byte)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox003.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox003.csproj new file mode 100644 index 0000000000..51c1291ea7 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox003.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox003.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox004.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox004.cs new file mode 100644 index 0000000000..11548102e9 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox004.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of sbyte using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(object o) + { + return Helper.Compare((sbyte)o, Helper.Create(default(sbyte))); + } + + private static bool BoxUnboxToQ(object o) + { + return Helper.Compare((sbyte?)o, Helper.Create(default(sbyte))); + } + + private static int Main() + { + sbyte? s = Helper.Create(default(sbyte)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox004.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox004.csproj new file mode 100644 index 0000000000..fbded7667a --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox004.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox004.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox005.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox005.cs new file mode 100644 index 0000000000..09b77390a4 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox005.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(object o) + { + return Helper.Compare((short)o, Helper.Create(default(short))); + } + + private static bool BoxUnboxToQ(object o) + { + return Helper.Compare((short?)o, Helper.Create(default(short))); + } + + private static int Main() + { + short? s = Helper.Create(default(short)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox005.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox005.csproj new file mode 100644 index 0000000000..f197b5eab3 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox005.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox005.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox006.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox006.cs new file mode 100644 index 0000000000..1da64c53c6 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox006.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of ushort using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(object o) + { + return Helper.Compare((ushort)o, Helper.Create(default(ushort))); + } + + private static bool BoxUnboxToQ(object o) + { + return Helper.Compare((ushort?)o, Helper.Create(default(ushort))); + } + + private static int Main() + { + ushort? s = Helper.Create(default(ushort)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox006.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox006.csproj new file mode 100644 index 0000000000..895c6aeafc --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox006.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox006.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox007.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox007.cs new file mode 100644 index 0000000000..80fc537c97 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox007.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(object o) + { + return Helper.Compare((int)o, Helper.Create(default(int))); + } + + private static bool BoxUnboxToQ(object o) + { + return Helper.Compare((int?)o, Helper.Create(default(int))); + } + + private static int Main() + { + int? s = Helper.Create(default(int)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox007.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox007.csproj new file mode 100644 index 0000000000..7dac143834 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox007.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox007.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox008.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox008.cs new file mode 100644 index 0000000000..e82794fdbe --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox008.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of uint using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(object o) + { + return Helper.Compare((uint)o, Helper.Create(default(uint))); + } + + private static bool BoxUnboxToQ(object o) + { + return Helper.Compare((uint?)o, Helper.Create(default(uint))); + } + + private static int Main() + { + uint? s = Helper.Create(default(uint)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox008.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox008.csproj new file mode 100644 index 0000000000..d59906b5a9 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox008.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox008.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox009.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox009.cs new file mode 100644 index 0000000000..e1b80e5d05 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox009.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(object o) + { + return Helper.Compare((long)o, Helper.Create(default(long))); + } + + private static bool BoxUnboxToQ(object o) + { + return Helper.Compare((long?)o, Helper.Create(default(long))); + } + + private static int Main() + { + long? s = Helper.Create(default(long)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox009.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox009.csproj new file mode 100644 index 0000000000..24a5a70316 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox009.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox009.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox010.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox010.cs new file mode 100644 index 0000000000..5b39240e80 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox010.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of ulong using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(object o) + { + return Helper.Compare((ulong)o, Helper.Create(default(ulong))); + } + + private static bool BoxUnboxToQ(object o) + { + return Helper.Compare((ulong?)o, Helper.Create(default(ulong))); + } + + private static int Main() + { + ulong? s = Helper.Create(default(ulong)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox010.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox010.csproj new file mode 100644 index 0000000000..39ac6a279a --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox010.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox010.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox011.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox011.cs new file mode 100644 index 0000000000..2df4d0bb59 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox011.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(object o) + { + return Helper.Compare((float)o, Helper.Create(default(float))); + } + + private static bool BoxUnboxToQ(object o) + { + return Helper.Compare((float?)o, Helper.Create(default(float))); + } + + private static int Main() + { + float? s = Helper.Create(default(float)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox011.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox011.csproj new file mode 100644 index 0000000000..bec7e50f9f --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox011.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox011.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox012.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox012.cs new file mode 100644 index 0000000000..a4c916fa5c --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox012.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of double using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(object o) + { + return Helper.Compare((double)o, Helper.Create(default(double))); + } + + private static bool BoxUnboxToQ(object o) + { + return Helper.Compare((double?)o, Helper.Create(default(double))); + } + + private static int Main() + { + double? s = Helper.Create(default(double)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox012.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox012.csproj new file mode 100644 index 0000000000..c639f9c20a --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox012.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox012.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox013.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox013.cs new file mode 100644 index 0000000000..9f796a7b92 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox013.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(object o) + { + return Helper.Compare((decimal)o, Helper.Create(default(decimal))); + } + + private static bool BoxUnboxToQ(object o) + { + return Helper.Compare((decimal?)o, Helper.Create(default(decimal))); + } + + private static int Main() + { + decimal? s = Helper.Create(default(decimal)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox013.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox013.csproj new file mode 100644 index 0000000000..b0ff6dacb6 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox013.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox013.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox014.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox014.cs new file mode 100644 index 0000000000..5e3fa61a5d --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox014.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of IntPtr using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(object o) + { + return Helper.Compare((IntPtr)o, Helper.Create(default(IntPtr))); + } + + private static bool BoxUnboxToQ(object o) + { + return Helper.Compare((IntPtr?)o, Helper.Create(default(IntPtr))); + } + + private static int Main() + { + IntPtr? s = Helper.Create(default(IntPtr)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox014.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox014.csproj new file mode 100644 index 0000000000..bfb2637f7c --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox014.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox014.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox015.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox015.cs new file mode 100644 index 0000000000..db4bd57e70 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox015.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(object o) + { + return Helper.Compare((UIntPtr)o, Helper.Create(default(UIntPtr))); + } + + private static bool BoxUnboxToQ(object o) + { + return Helper.Compare((UIntPtr?)o, Helper.Create(default(UIntPtr))); + } + + private static int Main() + { + UIntPtr? s = Helper.Create(default(UIntPtr)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox015.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox015.csproj new file mode 100644 index 0000000000..987c0d7a15 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox015.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox015.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox016.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox016.cs new file mode 100644 index 0000000000..c390bb2454 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox016.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of Guid using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(object o) + { + return Helper.Compare((Guid)o, Helper.Create(default(Guid))); + } + + private static bool BoxUnboxToQ(object o) + { + return Helper.Compare((Guid?)o, Helper.Create(default(Guid))); + } + + private static int Main() + { + Guid? s = Helper.Create(default(Guid)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox016.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox016.csproj new file mode 100644 index 0000000000..d4ec66fc4b --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox016.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox016.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox017.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox017.cs new file mode 100644 index 0000000000..e7f17e04f3 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox017.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(object o) + { + return Helper.Compare((GCHandle)o, Helper.Create(default(GCHandle))); + } + + private static bool BoxUnboxToQ(object o) + { + return Helper.Compare((GCHandle?)o, Helper.Create(default(GCHandle))); + } + + private static int Main() + { + GCHandle? s = Helper.Create(default(GCHandle)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox017.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox017.csproj new file mode 100644 index 0000000000..e742ab22e8 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox017.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox017.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox018.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox018.cs new file mode 100644 index 0000000000..886436268c --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox018.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of ByteE using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(object o) + { + return Helper.Compare((ByteE)o, Helper.Create(default(ByteE))); + } + + private static bool BoxUnboxToQ(object o) + { + return Helper.Compare((ByteE?)o, Helper.Create(default(ByteE))); + } + + private static int Main() + { + ByteE? s = Helper.Create(default(ByteE)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox018.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox018.csproj new file mode 100644 index 0000000000..e7aebbd7e6 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox018.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox018.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox019.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox019.cs new file mode 100644 index 0000000000..cbbf89d594 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox019.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(object o) + { + return Helper.Compare((IntE)o, Helper.Create(default(IntE))); + } + + private static bool BoxUnboxToQ(object o) + { + return Helper.Compare((IntE?)o, Helper.Create(default(IntE))); + } + + private static int Main() + { + IntE? s = Helper.Create(default(IntE)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox019.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox019.csproj new file mode 100644 index 0000000000..57f5aacf06 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox019.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox019.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox020.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox020.cs new file mode 100644 index 0000000000..37f29ef906 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox020.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of LongE using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(object o) + { + return Helper.Compare((LongE)o, Helper.Create(default(LongE))); + } + + private static bool BoxUnboxToQ(object o) + { + return Helper.Compare((LongE?)o, Helper.Create(default(LongE))); + } + + private static int Main() + { + LongE? s = Helper.Create(default(LongE)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox020.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox020.csproj new file mode 100644 index 0000000000..547b661e12 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox020.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox020.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox021.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox021.cs new file mode 100644 index 0000000000..9e16e6ef01 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox021.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(object o) + { + return Helper.Compare((EmptyStruct)o, Helper.Create(default(EmptyStruct))); + } + + private static bool BoxUnboxToQ(object o) + { + return Helper.Compare((EmptyStruct?)o, Helper.Create(default(EmptyStruct))); + } + + private static int Main() + { + EmptyStruct? s = Helper.Create(default(EmptyStruct)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox021.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox021.csproj new file mode 100644 index 0000000000..e6e986f8ab --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox021.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox021.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox022.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox022.cs new file mode 100644 index 0000000000..4d3398b2e0 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox022.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of NotEmptyStruct using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(object o) + { + return Helper.Compare((NotEmptyStruct)o, Helper.Create(default(NotEmptyStruct))); + } + + private static bool BoxUnboxToQ(object o) + { + return Helper.Compare((NotEmptyStruct?)o, Helper.Create(default(NotEmptyStruct))); + } + + private static int Main() + { + NotEmptyStruct? s = Helper.Create(default(NotEmptyStruct)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox022.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox022.csproj new file mode 100644 index 0000000000..575168657c --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox022.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox022.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox023.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox023.cs new file mode 100644 index 0000000000..27f1b38011 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox023.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(object o) + { + return Helper.Compare((NotEmptyStructQ)o, Helper.Create(default(NotEmptyStructQ))); + } + + private static bool BoxUnboxToQ(object o) + { + return Helper.Compare((NotEmptyStructQ?)o, Helper.Create(default(NotEmptyStructQ))); + } + + private static int Main() + { + NotEmptyStructQ? s = Helper.Create(default(NotEmptyStructQ)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox023.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox023.csproj new file mode 100644 index 0000000000..d0c75237a6 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox023.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox023.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox024.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox024.cs new file mode 100644 index 0000000000..830295f1cf --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox024.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of NotEmptyStructA using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(object o) + { + return Helper.Compare((NotEmptyStructA)o, Helper.Create(default(NotEmptyStructA))); + } + + private static bool BoxUnboxToQ(object o) + { + return Helper.Compare((NotEmptyStructA?)o, Helper.Create(default(NotEmptyStructA))); + } + + private static int Main() + { + NotEmptyStructA? s = Helper.Create(default(NotEmptyStructA)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox024.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox024.csproj new file mode 100644 index 0000000000..4ec7403952 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox024.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox024.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox025.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox025.cs new file mode 100644 index 0000000000..85aa2a29a1 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox025.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(object o) + { + return Helper.Compare((NotEmptyStructQA)o, Helper.Create(default(NotEmptyStructQA))); + } + + private static bool BoxUnboxToQ(object o) + { + return Helper.Compare((NotEmptyStructQA?)o, Helper.Create(default(NotEmptyStructQA))); + } + + private static int Main() + { + NotEmptyStructQA? s = Helper.Create(default(NotEmptyStructQA)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox025.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox025.csproj new file mode 100644 index 0000000000..821bda5eb8 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox025.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox025.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox026.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox026.cs new file mode 100644 index 0000000000..23e9f84a73 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox026.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of EmptyStructGen<int> using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(object o) + { + return Helper.Compare((EmptyStructGen<int>)o, Helper.Create(default(EmptyStructGen<int>))); + } + + private static bool BoxUnboxToQ(object o) + { + return Helper.Compare((EmptyStructGen<int>?)o, Helper.Create(default(EmptyStructGen<int>))); + } + + private static int Main() + { + EmptyStructGen<int>? s = Helper.Create(default(EmptyStructGen<int>)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox026.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox026.csproj new file mode 100644 index 0000000000..19e4584594 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox026.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox026.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox027.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox027.cs new file mode 100644 index 0000000000..0b079fed64 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox027.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(object o) + { + return Helper.Compare((NotEmptyStructGen<int>)o, Helper.Create(default(NotEmptyStructGen<int>))); + } + + private static bool BoxUnboxToQ(object o) + { + return Helper.Compare((NotEmptyStructGen<int>?)o, Helper.Create(default(NotEmptyStructGen<int>))); + } + + private static int Main() + { + NotEmptyStructGen<int>? s = Helper.Create(default(NotEmptyStructGen<int>)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox027.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox027.csproj new file mode 100644 index 0000000000..f1db4b71fc --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox027.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox027.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox028.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox028.cs new file mode 100644 index 0000000000..4dfb786976 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox028.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of NotEmptyStructConstrainedGen<int> using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(object o) + { + return Helper.Compare((NotEmptyStructConstrainedGen<int>)o, Helper.Create(default(NotEmptyStructConstrainedGen<int>))); + } + + private static bool BoxUnboxToQ(object o) + { + return Helper.Compare((NotEmptyStructConstrainedGen<int>?)o, Helper.Create(default(NotEmptyStructConstrainedGen<int>))); + } + + private static int Main() + { + NotEmptyStructConstrainedGen<int>? s = Helper.Create(default(NotEmptyStructConstrainedGen<int>)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox028.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox028.csproj new file mode 100644 index 0000000000..19ee778cfb --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox028.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox028.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox029.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox029.cs new file mode 100644 index 0000000000..18da1efcfb --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox029.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(object o) + { + return Helper.Compare((NotEmptyStructConstrainedGenA<int>)o, Helper.Create(default(NotEmptyStructConstrainedGenA<int>))); + } + + private static bool BoxUnboxToQ(object o) + { + return Helper.Compare((NotEmptyStructConstrainedGenA<int>?)o, Helper.Create(default(NotEmptyStructConstrainedGenA<int>))); + } + + private static int Main() + { + NotEmptyStructConstrainedGenA<int>? s = Helper.Create(default(NotEmptyStructConstrainedGenA<int>)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox029.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox029.csproj new file mode 100644 index 0000000000..e0a761a0a4 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox029.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox029.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox030.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox030.cs new file mode 100644 index 0000000000..7ac1ec14e1 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox030.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of NotEmptyStructConstrainedGenQ<int> using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(object o) + { + return Helper.Compare((NotEmptyStructConstrainedGenQ<int>)o, Helper.Create(default(NotEmptyStructConstrainedGenQ<int>))); + } + + private static bool BoxUnboxToQ(object o) + { + return Helper.Compare((NotEmptyStructConstrainedGenQ<int>?)o, Helper.Create(default(NotEmptyStructConstrainedGenQ<int>))); + } + + private static int Main() + { + NotEmptyStructConstrainedGenQ<int>? s = Helper.Create(default(NotEmptyStructConstrainedGenQ<int>)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox030.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox030.csproj new file mode 100644 index 0000000000..5332b8f522 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox030.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox030.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox031.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox031.cs new file mode 100644 index 0000000000..03b00fcaa2 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox031.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(object o) + { + return Helper.Compare((NotEmptyStructConstrainedGenQA<int>)o, Helper.Create(default(NotEmptyStructConstrainedGenQA<int>))); + } + + private static bool BoxUnboxToQ(object o) + { + return Helper.Compare((NotEmptyStructConstrainedGenQA<int>?)o, Helper.Create(default(NotEmptyStructConstrainedGenQA<int>))); + } + + private static int Main() + { + NotEmptyStructConstrainedGenQA<int>? s = Helper.Create(default(NotEmptyStructConstrainedGenQA<int>)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox031.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox031.csproj new file mode 100644 index 0000000000..6c15fe370d --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox031.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox031.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox032.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox032.cs new file mode 100644 index 0000000000..e09d68e256 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox032.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of NestedStruct using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(object o) + { + return Helper.Compare((NestedStruct)o, Helper.Create(default(NestedStruct))); + } + + private static bool BoxUnboxToQ(object o) + { + return Helper.Compare((NestedStruct?)o, Helper.Create(default(NestedStruct))); + } + + private static int Main() + { + NestedStruct? s = Helper.Create(default(NestedStruct)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox032.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox032.csproj new file mode 100644 index 0000000000..a62be05586 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox032.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox032.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox033.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox033.cs new file mode 100644 index 0000000000..ec467759aa --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox033.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(object o) + { + return Helper.Compare((NestedStructGen<int>)o, Helper.Create(default(NestedStructGen<int>))); + } + + private static bool BoxUnboxToQ(object o) + { + return Helper.Compare((NestedStructGen<int>?)o, Helper.Create(default(NestedStructGen<int>))); + } + + private static int Main() + { + NestedStructGen<int>? s = Helper.Create(default(NestedStructGen<int>)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox033.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox033.csproj new file mode 100644 index 0000000000..519edd3a6a --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox033.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox033.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox034.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox034.cs new file mode 100644 index 0000000000..53a3c2c21a --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox034.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of ExplicitFieldOffsetStruct using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(object o) + { + return Helper.Compare((ExplicitFieldOffsetStruct)o, Helper.Create(default(ExplicitFieldOffsetStruct))); + } + + private static bool BoxUnboxToQ(object o) + { + return Helper.Compare((ExplicitFieldOffsetStruct?)o, Helper.Create(default(ExplicitFieldOffsetStruct))); + } + + private static int Main() + { + ExplicitFieldOffsetStruct? s = Helper.Create(default(ExplicitFieldOffsetStruct)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox034.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox034.csproj new file mode 100644 index 0000000000..4318dd47ea --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox034.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox034.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox037.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox037.cs new file mode 100644 index 0000000000..c55582ea4f --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox037.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(object o) + { + return Helper.Compare((MarshalAsStruct)o, Helper.Create(default(MarshalAsStruct))); + } + + private static bool BoxUnboxToQ(object o) + { + return Helper.Compare((MarshalAsStruct?)o, Helper.Create(default(MarshalAsStruct))); + } + + private static int Main() + { + MarshalAsStruct? s = Helper.Create(default(MarshalAsStruct)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox037.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox037.csproj new file mode 100644 index 0000000000..bd6fe46434 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox037.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox037.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox038.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox038.cs new file mode 100644 index 0000000000..7297206410 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox038.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of ImplementOneInterface using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(object o) + { + return Helper.Compare((ImplementOneInterface)o, Helper.Create(default(ImplementOneInterface))); + } + + private static bool BoxUnboxToQ(object o) + { + return Helper.Compare((ImplementOneInterface?)o, Helper.Create(default(ImplementOneInterface))); + } + + private static int Main() + { + ImplementOneInterface? s = Helper.Create(default(ImplementOneInterface)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox038.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox038.csproj new file mode 100644 index 0000000000..2b8528424d --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox038.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox038.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox039.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox039.cs new file mode 100644 index 0000000000..6f409f75a9 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox039.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(object o) + { + return Helper.Compare((ImplementTwoInterface)o, Helper.Create(default(ImplementTwoInterface))); + } + + private static bool BoxUnboxToQ(object o) + { + return Helper.Compare((ImplementTwoInterface?)o, Helper.Create(default(ImplementTwoInterface))); + } + + private static int Main() + { + ImplementTwoInterface? s = Helper.Create(default(ImplementTwoInterface)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox039.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox039.csproj new file mode 100644 index 0000000000..f2c72e299a --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox039.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox039.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox040.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox040.cs new file mode 100644 index 0000000000..58984d19f6 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox040.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of ImplementOneInterfaceGen<int> using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(object o) + { + return Helper.Compare((ImplementOneInterfaceGen<int>)o, Helper.Create(default(ImplementOneInterfaceGen<int>))); + } + + private static bool BoxUnboxToQ(object o) + { + return Helper.Compare((ImplementOneInterfaceGen<int>?)o, Helper.Create(default(ImplementOneInterfaceGen<int>))); + } + + private static int Main() + { + ImplementOneInterfaceGen<int>? s = Helper.Create(default(ImplementOneInterfaceGen<int>)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox040.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox040.csproj new file mode 100644 index 0000000000..23ccd4c86e --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox040.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox040.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox041.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox041.cs new file mode 100644 index 0000000000..aaa93d1ba8 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox041.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(object o) + { + return Helper.Compare((ImplementTwoInterfaceGen<int>)o, Helper.Create(default(ImplementTwoInterfaceGen<int>))); + } + + private static bool BoxUnboxToQ(object o) + { + return Helper.Compare((ImplementTwoInterfaceGen<int>?)o, Helper.Create(default(ImplementTwoInterfaceGen<int>))); + } + + private static int Main() + { + ImplementTwoInterfaceGen<int>? s = Helper.Create(default(ImplementTwoInterfaceGen<int>)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox041.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox041.csproj new file mode 100644 index 0000000000..881db12a9b --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox041.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox041.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox042.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox042.cs new file mode 100644 index 0000000000..dab1a0a8df --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox042.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of ImplementAllInterface<int> using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(object o) + { + return Helper.Compare((ImplementAllInterface<int>)o, Helper.Create(default(ImplementAllInterface<int>))); + } + + private static bool BoxUnboxToQ(object o) + { + return Helper.Compare((ImplementAllInterface<int>?)o, Helper.Create(default(ImplementAllInterface<int>))); + } + + private static int Main() + { + ImplementAllInterface<int>? s = Helper.Create(default(ImplementAllInterface<int>)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox042.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox042.csproj new file mode 100644 index 0000000000..f7dd626158 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox042.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox042.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox043.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox043.cs new file mode 100644 index 0000000000..3e02d8a11e --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox043.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(object o) + { + return Helper.Compare((WithMultipleGCHandleStruct)o, Helper.Create(default(WithMultipleGCHandleStruct))); + } + + private static bool BoxUnboxToQ(object o) + { + return Helper.Compare((WithMultipleGCHandleStruct?)o, Helper.Create(default(WithMultipleGCHandleStruct))); + } + + private static int Main() + { + WithMultipleGCHandleStruct? s = Helper.Create(default(WithMultipleGCHandleStruct)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox043.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox043.csproj new file mode 100644 index 0000000000..e326f20a63 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox043.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox043.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox044.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox044.cs new file mode 100644 index 0000000000..d1d8067cf0 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox044.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of WithOnlyFXTypeStruct using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(object o) + { + return Helper.Compare((WithOnlyFXTypeStruct)o, Helper.Create(default(WithOnlyFXTypeStruct))); + } + + private static bool BoxUnboxToQ(object o) + { + return Helper.Compare((WithOnlyFXTypeStruct?)o, Helper.Create(default(WithOnlyFXTypeStruct))); + } + + private static int Main() + { + WithOnlyFXTypeStruct? s = Helper.Create(default(WithOnlyFXTypeStruct)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox044.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox044.csproj new file mode 100644 index 0000000000..3a7928e295 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox044.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox044.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox045.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox045.cs new file mode 100644 index 0000000000..b1a403acfc --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox045.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(object o) + { + return Helper.Compare((MixedAllStruct)o, Helper.Create(default(MixedAllStruct))); + } + + private static bool BoxUnboxToQ(object o) + { + return Helper.Compare((MixedAllStruct?)o, Helper.Create(default(MixedAllStruct))); + } + + private static int Main() + { + MixedAllStruct? s = Helper.Create(default(MixedAllStruct)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox045.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox045.csproj new file mode 100644 index 0000000000..de5533e027 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/box-unbox/box-unbox045.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox045.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/enum/app.config b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/enum/app.config new file mode 100644 index 0000000000..8077c95440 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/enum/app.config @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<configuration> + <runtime> + <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> + <dependentAssembly> + <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.20.0" newVersion="4.0.20.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Text.Encoding" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.IO" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Reflection" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + </assemblyBinding> + </runtime> +</configuration>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/enum/box-unbox-enum001.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/enum/box-unbox-enum001.cs new file mode 100644 index 0000000000..30fa5b69ea --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/enum/box-unbox-enum001.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of IntE using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(Enum o) + { + return Helper.Compare((IntE)o, Helper.Create(default(IntE))); + } + + private static bool BoxUnboxToQ(Enum o) + { + return Helper.Compare((IntE?)o, Helper.Create(default(IntE))); + } + + private static int Main() + { + IntE? s = Helper.Create(default(IntE)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/enum/box-unbox-enum001.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/enum/box-unbox-enum001.csproj new file mode 100644 index 0000000000..da35c58c18 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/enum/box-unbox-enum001.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-enum001.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/enum/box-unbox-enum002.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/enum/box-unbox-enum002.cs new file mode 100644 index 0000000000..f0899348da --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/enum/box-unbox-enum002.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(Enum o) + { + return Helper.Compare((ByteE)o, Helper.Create(default(ByteE))); + } + + private static bool BoxUnboxToQ(Enum o) + { + return Helper.Compare((ByteE?)o, Helper.Create(default(ByteE))); + } + + private static int Main() + { + ByteE? s = Helper.Create(default(ByteE)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/enum/box-unbox-enum002.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/enum/box-unbox-enum002.csproj new file mode 100644 index 0000000000..2158e0dd0e --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/enum/box-unbox-enum002.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-enum002.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/enum/box-unbox-enum003.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/enum/box-unbox-enum003.cs new file mode 100644 index 0000000000..bd5748e80f --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/enum/box-unbox-enum003.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of LongE using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(Enum o) + { + return Helper.Compare((LongE)o, Helper.Create(default(LongE))); + } + + private static bool BoxUnboxToQ(Enum o) + { + return Helper.Compare((LongE?)o, Helper.Create(default(LongE))); + } + + private static int Main() + { + LongE? s = Helper.Create(default(LongE)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/enum/box-unbox-enum003.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/enum/box-unbox-enum003.csproj new file mode 100644 index 0000000000..22fccce46d --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/enum/box-unbox-enum003.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-enum003.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/app.config b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/app.config new file mode 100644 index 0000000000..8077c95440 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/app.config @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<configuration> + <runtime> + <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> + <dependentAssembly> + <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.20.0" newVersion="4.0.20.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Text.Encoding" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.IO" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Reflection" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + </assemblyBinding> + </runtime> +</configuration>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics001.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics001.cs new file mode 100644 index 0000000000..ab353a5518 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics001.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ<T>(T o) + { + return Helper.Compare((char)(object)o, Helper.Create(default(char))); + } + + private static bool BoxUnboxToQ<T>(T o) + { + return Helper.Compare((char?)(object)o, Helper.Create(default(char))); + } + + private static int Main() + { + char? s = Helper.Create(default(char)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics001.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics001.csproj new file mode 100644 index 0000000000..c9bc47be3d --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics001.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-generics001.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics002.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics002.cs new file mode 100644 index 0000000000..4f7a5fcb99 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics002.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of bool using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ<T>(T o) + { + return Helper.Compare((bool)(object)o, Helper.Create(default(bool))); + } + + private static bool BoxUnboxToQ<T>(T o) + { + return Helper.Compare((bool?)(object)o, Helper.Create(default(bool))); + } + + private static int Main() + { + bool? s = Helper.Create(default(bool)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics002.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics002.csproj new file mode 100644 index 0000000000..8df3dd5706 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics002.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-generics002.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics003.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics003.cs new file mode 100644 index 0000000000..f7f37922e1 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics003.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ<T>(T o) + { + return Helper.Compare((byte)(object)o, Helper.Create(default(byte))); + } + + private static bool BoxUnboxToQ<T>(T o) + { + return Helper.Compare((byte?)(object)o, Helper.Create(default(byte))); + } + + private static int Main() + { + byte? s = Helper.Create(default(byte)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics003.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics003.csproj new file mode 100644 index 0000000000..f68e8412cf --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics003.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-generics003.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics004.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics004.cs new file mode 100644 index 0000000000..4cd69634f0 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics004.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of sbyte using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ<T>(T o) + { + return Helper.Compare((sbyte)(object)o, Helper.Create(default(sbyte))); + } + + private static bool BoxUnboxToQ<T>(T o) + { + return Helper.Compare((sbyte?)(object)o, Helper.Create(default(sbyte))); + } + + private static int Main() + { + sbyte? s = Helper.Create(default(sbyte)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics004.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics004.csproj new file mode 100644 index 0000000000..159a1d0758 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics004.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-generics004.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics005.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics005.cs new file mode 100644 index 0000000000..d287dd2805 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics005.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ<T>(T o) + { + return Helper.Compare((short)(object)o, Helper.Create(default(short))); + } + + private static bool BoxUnboxToQ<T>(T o) + { + return Helper.Compare((short?)(object)o, Helper.Create(default(short))); + } + + private static int Main() + { + short? s = Helper.Create(default(short)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics005.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics005.csproj new file mode 100644 index 0000000000..14ab9bd30c --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics005.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-generics005.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics006.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics006.cs new file mode 100644 index 0000000000..c01ad7a9ba --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics006.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of ushort using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ<T>(T o) + { + return Helper.Compare((ushort)(object)o, Helper.Create(default(ushort))); + } + + private static bool BoxUnboxToQ<T>(T o) + { + return Helper.Compare((ushort?)(object)o, Helper.Create(default(ushort))); + } + + private static int Main() + { + ushort? s = Helper.Create(default(ushort)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics006.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics006.csproj new file mode 100644 index 0000000000..364517baf4 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics006.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-generics006.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics007.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics007.cs new file mode 100644 index 0000000000..0bd843491e --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics007.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ<T>(T o) + { + return Helper.Compare((int)(object)o, Helper.Create(default(int))); + } + + private static bool BoxUnboxToQ<T>(T o) + { + return Helper.Compare((int?)(object)o, Helper.Create(default(int))); + } + + private static int Main() + { + int? s = Helper.Create(default(int)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics007.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics007.csproj new file mode 100644 index 0000000000..8ae3fc1e2d --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics007.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-generics007.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics008.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics008.cs new file mode 100644 index 0000000000..677de335f9 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics008.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of uint using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ<T>(T o) + { + return Helper.Compare((uint)(object)o, Helper.Create(default(uint))); + } + + private static bool BoxUnboxToQ<T>(T o) + { + return Helper.Compare((uint?)(object)o, Helper.Create(default(uint))); + } + + private static int Main() + { + uint? s = Helper.Create(default(uint)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics008.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics008.csproj new file mode 100644 index 0000000000..f7e2878d38 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics008.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-generics008.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics009.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics009.cs new file mode 100644 index 0000000000..f0a09261a3 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics009.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ<T>(T o) + { + return Helper.Compare((long)(object)o, Helper.Create(default(long))); + } + + private static bool BoxUnboxToQ<T>(T o) + { + return Helper.Compare((long?)(object)o, Helper.Create(default(long))); + } + + private static int Main() + { + long? s = Helper.Create(default(long)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics009.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics009.csproj new file mode 100644 index 0000000000..ed00f6912e --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics009.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-generics009.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics010.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics010.cs new file mode 100644 index 0000000000..f959d29bba --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics010.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of ulong using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ<T>(T o) + { + return Helper.Compare((ulong)(object)o, Helper.Create(default(ulong))); + } + + private static bool BoxUnboxToQ<T>(T o) + { + return Helper.Compare((ulong?)(object)o, Helper.Create(default(ulong))); + } + + private static int Main() + { + ulong? s = Helper.Create(default(ulong)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics010.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics010.csproj new file mode 100644 index 0000000000..42b8eb556b --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics010.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-generics010.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics011.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics011.cs new file mode 100644 index 0000000000..cbf4660eb3 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics011.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ<T>(T o) + { + return Helper.Compare((float)(object)o, Helper.Create(default(float))); + } + + private static bool BoxUnboxToQ<T>(T o) + { + return Helper.Compare((float?)(object)o, Helper.Create(default(float))); + } + + private static int Main() + { + float? s = Helper.Create(default(float)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics011.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics011.csproj new file mode 100644 index 0000000000..e334cc6169 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics011.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-generics011.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics012.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics012.cs new file mode 100644 index 0000000000..44162201d5 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics012.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of double using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ<T>(T o) + { + return Helper.Compare((double)(object)o, Helper.Create(default(double))); + } + + private static bool BoxUnboxToQ<T>(T o) + { + return Helper.Compare((double?)(object)o, Helper.Create(default(double))); + } + + private static int Main() + { + double? s = Helper.Create(default(double)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics012.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics012.csproj new file mode 100644 index 0000000000..23218f6723 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics012.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-generics012.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics013.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics013.cs new file mode 100644 index 0000000000..1e6449e59c --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics013.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ<T>(T o) + { + return Helper.Compare((decimal)(object)o, Helper.Create(default(decimal))); + } + + private static bool BoxUnboxToQ<T>(T o) + { + return Helper.Compare((decimal?)(object)o, Helper.Create(default(decimal))); + } + + private static int Main() + { + decimal? s = Helper.Create(default(decimal)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics013.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics013.csproj new file mode 100644 index 0000000000..41b944adfa --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics013.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-generics013.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics014.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics014.cs new file mode 100644 index 0000000000..b74e74dff8 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics014.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of IntPtr using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ<T>(T o) + { + return Helper.Compare((IntPtr)(object)o, Helper.Create(default(IntPtr))); + } + + private static bool BoxUnboxToQ<T>(T o) + { + return Helper.Compare((IntPtr?)(object)o, Helper.Create(default(IntPtr))); + } + + private static int Main() + { + IntPtr? s = Helper.Create(default(IntPtr)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics014.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics014.csproj new file mode 100644 index 0000000000..6d2e397955 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics014.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-generics014.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics015.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics015.cs new file mode 100644 index 0000000000..fc0d79326c --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics015.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ<T>(T o) + { + return Helper.Compare((UIntPtr)(object)o, Helper.Create(default(UIntPtr))); + } + + private static bool BoxUnboxToQ<T>(T o) + { + return Helper.Compare((UIntPtr?)(object)o, Helper.Create(default(UIntPtr))); + } + + private static int Main() + { + UIntPtr? s = Helper.Create(default(UIntPtr)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics015.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics015.csproj new file mode 100644 index 0000000000..29be0ad675 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics015.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-generics015.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics016.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics016.cs new file mode 100644 index 0000000000..10e0c0302f --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics016.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of Guid using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ<T>(T o) + { + return Helper.Compare((Guid)(object)o, Helper.Create(default(Guid))); + } + + private static bool BoxUnboxToQ<T>(T o) + { + return Helper.Compare((Guid?)(object)o, Helper.Create(default(Guid))); + } + + private static int Main() + { + Guid? s = Helper.Create(default(Guid)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics016.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics016.csproj new file mode 100644 index 0000000000..d2c59314de --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics016.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-generics016.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics017.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics017.cs new file mode 100644 index 0000000000..85cabc5415 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics017.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ<T>(T o) + { + return Helper.Compare((GCHandle)(object)o, Helper.Create(default(GCHandle))); + } + + private static bool BoxUnboxToQ<T>(T o) + { + return Helper.Compare((GCHandle?)(object)o, Helper.Create(default(GCHandle))); + } + + private static int Main() + { + GCHandle? s = Helper.Create(default(GCHandle)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics017.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics017.csproj new file mode 100644 index 0000000000..abc935ce98 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics017.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-generics017.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics018.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics018.cs new file mode 100644 index 0000000000..bef3b2524a --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics018.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of ByteE using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ<T>(T o) + { + return Helper.Compare((ByteE)(object)o, Helper.Create(default(ByteE))); + } + + private static bool BoxUnboxToQ<T>(T o) + { + return Helper.Compare((ByteE?)(object)o, Helper.Create(default(ByteE))); + } + + private static int Main() + { + ByteE? s = Helper.Create(default(ByteE)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics018.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics018.csproj new file mode 100644 index 0000000000..41aa64b0d3 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics018.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-generics018.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics019.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics019.cs new file mode 100644 index 0000000000..c0b21dee27 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics019.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ<T>(T o) + { + return Helper.Compare((IntE)(object)o, Helper.Create(default(IntE))); + } + + private static bool BoxUnboxToQ<T>(T o) + { + return Helper.Compare((IntE?)(object)o, Helper.Create(default(IntE))); + } + + private static int Main() + { + IntE? s = Helper.Create(default(IntE)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics019.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics019.csproj new file mode 100644 index 0000000000..8a173b60af --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics019.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-generics019.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics020.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics020.cs new file mode 100644 index 0000000000..86bad94a76 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics020.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of LongE using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ<T>(T o) + { + return Helper.Compare((LongE)(object)o, Helper.Create(default(LongE))); + } + + private static bool BoxUnboxToQ<T>(T o) + { + return Helper.Compare((LongE?)(object)o, Helper.Create(default(LongE))); + } + + private static int Main() + { + LongE? s = Helper.Create(default(LongE)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics020.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics020.csproj new file mode 100644 index 0000000000..246482a56c --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics020.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-generics020.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics021.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics021.cs new file mode 100644 index 0000000000..08693ed236 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics021.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ<T>(T o) + { + return Helper.Compare((EmptyStruct)(object)o, Helper.Create(default(EmptyStruct))); + } + + private static bool BoxUnboxToQ<T>(T o) + { + return Helper.Compare((EmptyStruct?)(object)o, Helper.Create(default(EmptyStruct))); + } + + private static int Main() + { + EmptyStruct? s = Helper.Create(default(EmptyStruct)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics021.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics021.csproj new file mode 100644 index 0000000000..d7bcc4ecd5 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics021.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-generics021.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics022.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics022.cs new file mode 100644 index 0000000000..c8619cdaa3 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics022.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of NotEmptyStruct using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ<T>(T o) + { + return Helper.Compare((NotEmptyStruct)(object)o, Helper.Create(default(NotEmptyStruct))); + } + + private static bool BoxUnboxToQ<T>(T o) + { + return Helper.Compare((NotEmptyStruct?)(object)o, Helper.Create(default(NotEmptyStruct))); + } + + private static int Main() + { + NotEmptyStruct? s = Helper.Create(default(NotEmptyStruct)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics022.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics022.csproj new file mode 100644 index 0000000000..888a86ef62 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics022.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-generics022.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics023.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics023.cs new file mode 100644 index 0000000000..958783f16a --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics023.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ<T>(T o) + { + return Helper.Compare((NotEmptyStructQ)(object)o, Helper.Create(default(NotEmptyStructQ))); + } + + private static bool BoxUnboxToQ<T>(T o) + { + return Helper.Compare((NotEmptyStructQ?)(object)o, Helper.Create(default(NotEmptyStructQ))); + } + + private static int Main() + { + NotEmptyStructQ? s = Helper.Create(default(NotEmptyStructQ)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics023.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics023.csproj new file mode 100644 index 0000000000..af1a4e0f8c --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics023.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-generics023.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics024.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics024.cs new file mode 100644 index 0000000000..4cb2bce39a --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics024.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of NotEmptyStructA using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ<T>(T o) + { + return Helper.Compare((NotEmptyStructA)(object)o, Helper.Create(default(NotEmptyStructA))); + } + + private static bool BoxUnboxToQ<T>(T o) + { + return Helper.Compare((NotEmptyStructA?)(object)o, Helper.Create(default(NotEmptyStructA))); + } + + private static int Main() + { + NotEmptyStructA? s = Helper.Create(default(NotEmptyStructA)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics024.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics024.csproj new file mode 100644 index 0000000000..7dd245c2a7 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics024.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-generics024.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics025.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics025.cs new file mode 100644 index 0000000000..122a594479 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics025.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ<T>(T o) + { + return Helper.Compare((NotEmptyStructQA)(object)o, Helper.Create(default(NotEmptyStructQA))); + } + + private static bool BoxUnboxToQ<T>(T o) + { + return Helper.Compare((NotEmptyStructQA?)(object)o, Helper.Create(default(NotEmptyStructQA))); + } + + private static int Main() + { + NotEmptyStructQA? s = Helper.Create(default(NotEmptyStructQA)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics025.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics025.csproj new file mode 100644 index 0000000000..30b88263c6 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics025.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-generics025.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics026.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics026.cs new file mode 100644 index 0000000000..b456f9c54c --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics026.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of EmptyStructGen<int> using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ<T>(T o) + { + return Helper.Compare((EmptyStructGen<int>)(object)o, Helper.Create(default(EmptyStructGen<int>))); + } + + private static bool BoxUnboxToQ<T>(T o) + { + return Helper.Compare((EmptyStructGen<int>?)(object)o, Helper.Create(default(EmptyStructGen<int>))); + } + + private static int Main() + { + EmptyStructGen<int>? s = Helper.Create(default(EmptyStructGen<int>)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics026.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics026.csproj new file mode 100644 index 0000000000..3d5b4c232a --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics026.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-generics026.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics027.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics027.cs new file mode 100644 index 0000000000..422b06474c --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics027.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ<T>(T o) + { + return Helper.Compare((NotEmptyStructGen<int>)(object)o, Helper.Create(default(NotEmptyStructGen<int>))); + } + + private static bool BoxUnboxToQ<T>(T o) + { + return Helper.Compare((NotEmptyStructGen<int>?)(object)o, Helper.Create(default(NotEmptyStructGen<int>))); + } + + private static int Main() + { + NotEmptyStructGen<int>? s = Helper.Create(default(NotEmptyStructGen<int>)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics027.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics027.csproj new file mode 100644 index 0000000000..e439a374f9 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics027.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-generics027.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics028.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics028.cs new file mode 100644 index 0000000000..e85f1a34cb --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics028.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of NotEmptyStructConstrainedGen<int> using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ<T>(T o) + { + return Helper.Compare((NotEmptyStructConstrainedGen<int>)(object)o, Helper.Create(default(NotEmptyStructConstrainedGen<int>))); + } + + private static bool BoxUnboxToQ<T>(T o) + { + return Helper.Compare((NotEmptyStructConstrainedGen<int>?)(object)o, Helper.Create(default(NotEmptyStructConstrainedGen<int>))); + } + + private static int Main() + { + NotEmptyStructConstrainedGen<int>? s = Helper.Create(default(NotEmptyStructConstrainedGen<int>)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics028.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics028.csproj new file mode 100644 index 0000000000..36a38760d5 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics028.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-generics028.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics029.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics029.cs new file mode 100644 index 0000000000..9daba67941 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics029.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ<T>(T o) + { + return Helper.Compare((NotEmptyStructConstrainedGenA<int>)(object)o, Helper.Create(default(NotEmptyStructConstrainedGenA<int>))); + } + + private static bool BoxUnboxToQ<T>(T o) + { + return Helper.Compare((NotEmptyStructConstrainedGenA<int>?)(object)o, Helper.Create(default(NotEmptyStructConstrainedGenA<int>))); + } + + private static int Main() + { + NotEmptyStructConstrainedGenA<int>? s = Helper.Create(default(NotEmptyStructConstrainedGenA<int>)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics029.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics029.csproj new file mode 100644 index 0000000000..0c50406aba --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics029.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-generics029.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics030.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics030.cs new file mode 100644 index 0000000000..c904e82cd0 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics030.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of NotEmptyStructConstrainedGenQ<int> using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ<T>(T o) + { + return Helper.Compare((NotEmptyStructConstrainedGenQ<int>)(object)o, Helper.Create(default(NotEmptyStructConstrainedGenQ<int>))); + } + + private static bool BoxUnboxToQ<T>(T o) + { + return Helper.Compare((NotEmptyStructConstrainedGenQ<int>?)(object)o, Helper.Create(default(NotEmptyStructConstrainedGenQ<int>))); + } + + private static int Main() + { + NotEmptyStructConstrainedGenQ<int>? s = Helper.Create(default(NotEmptyStructConstrainedGenQ<int>)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics030.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics030.csproj new file mode 100644 index 0000000000..35cd6a9172 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics030.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-generics030.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics031.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics031.cs new file mode 100644 index 0000000000..58638352b9 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics031.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ<T>(T o) + { + return Helper.Compare((NotEmptyStructConstrainedGenQA<int>)(object)o, Helper.Create(default(NotEmptyStructConstrainedGenQA<int>))); + } + + private static bool BoxUnboxToQ<T>(T o) + { + return Helper.Compare((NotEmptyStructConstrainedGenQA<int>?)(object)o, Helper.Create(default(NotEmptyStructConstrainedGenQA<int>))); + } + + private static int Main() + { + NotEmptyStructConstrainedGenQA<int>? s = Helper.Create(default(NotEmptyStructConstrainedGenQA<int>)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics031.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics031.csproj new file mode 100644 index 0000000000..45af06dedc --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics031.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-generics031.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics032.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics032.cs new file mode 100644 index 0000000000..da43073fdb --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics032.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of NestedStruct using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ<T>(T o) + { + return Helper.Compare((NestedStruct)(object)o, Helper.Create(default(NestedStruct))); + } + + private static bool BoxUnboxToQ<T>(T o) + { + return Helper.Compare((NestedStruct?)(object)o, Helper.Create(default(NestedStruct))); + } + + private static int Main() + { + NestedStruct? s = Helper.Create(default(NestedStruct)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics032.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics032.csproj new file mode 100644 index 0000000000..398f8be939 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics032.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-generics032.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics033.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics033.cs new file mode 100644 index 0000000000..5eb0c411fa --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics033.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ<T>(T o) + { + return Helper.Compare((NestedStructGen<int>)(object)o, Helper.Create(default(NestedStructGen<int>))); + } + + private static bool BoxUnboxToQ<T>(T o) + { + return Helper.Compare((NestedStructGen<int>?)(object)o, Helper.Create(default(NestedStructGen<int>))); + } + + private static int Main() + { + NestedStructGen<int>? s = Helper.Create(default(NestedStructGen<int>)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics033.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics033.csproj new file mode 100644 index 0000000000..bb8b1a2f9b --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics033.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-generics033.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics034.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics034.cs new file mode 100644 index 0000000000..0609d960b9 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics034.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of ExplicitFieldOffsetStruct using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ<T>(T o) + { + return Helper.Compare((ExplicitFieldOffsetStruct)(object)o, Helper.Create(default(ExplicitFieldOffsetStruct))); + } + + private static bool BoxUnboxToQ<T>(T o) + { + return Helper.Compare((ExplicitFieldOffsetStruct?)(object)o, Helper.Create(default(ExplicitFieldOffsetStruct))); + } + + private static int Main() + { + ExplicitFieldOffsetStruct? s = Helper.Create(default(ExplicitFieldOffsetStruct)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics034.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics034.csproj new file mode 100644 index 0000000000..6bb3f6177b --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics034.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-generics034.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics037.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics037.cs new file mode 100644 index 0000000000..31e96cc105 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics037.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ<T>(T o) + { + return Helper.Compare((MarshalAsStruct)(object)o, Helper.Create(default(MarshalAsStruct))); + } + + private static bool BoxUnboxToQ<T>(T o) + { + return Helper.Compare((MarshalAsStruct?)(object)o, Helper.Create(default(MarshalAsStruct))); + } + + private static int Main() + { + MarshalAsStruct? s = Helper.Create(default(MarshalAsStruct)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics037.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics037.csproj new file mode 100644 index 0000000000..83f4784513 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics037.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-generics037.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics038.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics038.cs new file mode 100644 index 0000000000..c032132494 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics038.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of ImplementOneInterface using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ<T>(T o) + { + return Helper.Compare((ImplementOneInterface)(object)o, Helper.Create(default(ImplementOneInterface))); + } + + private static bool BoxUnboxToQ<T>(T o) + { + return Helper.Compare((ImplementOneInterface?)(object)o, Helper.Create(default(ImplementOneInterface))); + } + + private static int Main() + { + ImplementOneInterface? s = Helper.Create(default(ImplementOneInterface)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics038.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics038.csproj new file mode 100644 index 0000000000..0d46f5ff4c --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics038.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-generics038.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics039.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics039.cs new file mode 100644 index 0000000000..a05b1103c7 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics039.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ<T>(T o) + { + return Helper.Compare((ImplementTwoInterface)(object)o, Helper.Create(default(ImplementTwoInterface))); + } + + private static bool BoxUnboxToQ<T>(T o) + { + return Helper.Compare((ImplementTwoInterface?)(object)o, Helper.Create(default(ImplementTwoInterface))); + } + + private static int Main() + { + ImplementTwoInterface? s = Helper.Create(default(ImplementTwoInterface)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics039.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics039.csproj new file mode 100644 index 0000000000..eb8069805d --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics039.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-generics039.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics040.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics040.cs new file mode 100644 index 0000000000..7c2fcfcc08 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics040.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of ImplementOneInterfaceGen<int> using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ<T>(T o) + { + return Helper.Compare((ImplementOneInterfaceGen<int>)(object)o, Helper.Create(default(ImplementOneInterfaceGen<int>))); + } + + private static bool BoxUnboxToQ<T>(T o) + { + return Helper.Compare((ImplementOneInterfaceGen<int>?)(object)o, Helper.Create(default(ImplementOneInterfaceGen<int>))); + } + + private static int Main() + { + ImplementOneInterfaceGen<int>? s = Helper.Create(default(ImplementOneInterfaceGen<int>)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics040.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics040.csproj new file mode 100644 index 0000000000..bd8539559b --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics040.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-generics040.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics041.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics041.cs new file mode 100644 index 0000000000..535a0bd2bb --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics041.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ<T>(T o) + { + return Helper.Compare((ImplementTwoInterfaceGen<int>)(object)o, Helper.Create(default(ImplementTwoInterfaceGen<int>))); + } + + private static bool BoxUnboxToQ<T>(T o) + { + return Helper.Compare((ImplementTwoInterfaceGen<int>?)(object)o, Helper.Create(default(ImplementTwoInterfaceGen<int>))); + } + + private static int Main() + { + ImplementTwoInterfaceGen<int>? s = Helper.Create(default(ImplementTwoInterfaceGen<int>)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics041.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics041.csproj new file mode 100644 index 0000000000..11128cd0e3 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics041.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-generics041.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics042.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics042.cs new file mode 100644 index 0000000000..b19d98d74a --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics042.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of ImplementAllInterface<int> using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ<T>(T o) + { + return Helper.Compare((ImplementAllInterface<int>)(object)o, Helper.Create(default(ImplementAllInterface<int>))); + } + + private static bool BoxUnboxToQ<T>(T o) + { + return Helper.Compare((ImplementAllInterface<int>?)(object)o, Helper.Create(default(ImplementAllInterface<int>))); + } + + private static int Main() + { + ImplementAllInterface<int>? s = Helper.Create(default(ImplementAllInterface<int>)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics042.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics042.csproj new file mode 100644 index 0000000000..89673fb3ca --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics042.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-generics042.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics043.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics043.cs new file mode 100644 index 0000000000..8f345493c8 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics043.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ<T>(T o) + { + return Helper.Compare((WithMultipleGCHandleStruct)(object)o, Helper.Create(default(WithMultipleGCHandleStruct))); + } + + private static bool BoxUnboxToQ<T>(T o) + { + return Helper.Compare((WithMultipleGCHandleStruct?)(object)o, Helper.Create(default(WithMultipleGCHandleStruct))); + } + + private static int Main() + { + WithMultipleGCHandleStruct? s = Helper.Create(default(WithMultipleGCHandleStruct)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics043.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics043.csproj new file mode 100644 index 0000000000..82144e6bb1 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics043.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-generics043.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics044.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics044.cs new file mode 100644 index 0000000000..9fa84b4f3a --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics044.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of WithOnlyFXTypeStruct using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ<T>(T o) + { + return Helper.Compare((WithOnlyFXTypeStruct)(object)o, Helper.Create(default(WithOnlyFXTypeStruct))); + } + + private static bool BoxUnboxToQ<T>(T o) + { + return Helper.Compare((WithOnlyFXTypeStruct?)(object)o, Helper.Create(default(WithOnlyFXTypeStruct))); + } + + private static int Main() + { + WithOnlyFXTypeStruct? s = Helper.Create(default(WithOnlyFXTypeStruct)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics044.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics044.csproj new file mode 100644 index 0000000000..57d44d948f --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics044.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-generics044.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics045.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics045.cs new file mode 100644 index 0000000000..ef35b7e671 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics045.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ<T>(T o) + { + return Helper.Compare((MixedAllStruct)(object)o, Helper.Create(default(MixedAllStruct))); + } + + private static bool BoxUnboxToQ<T>(T o) + { + return Helper.Compare((MixedAllStruct?)(object)o, Helper.Create(default(MixedAllStruct))); + } + + private static int Main() + { + MixedAllStruct? s = Helper.Create(default(MixedAllStruct)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics045.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics045.csproj new file mode 100644 index 0000000000..9db3f9af82 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/generics/box-unbox-generics045.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-generics045.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/app.config b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/app.config new file mode 100644 index 0000000000..8077c95440 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/app.config @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<configuration> + <runtime> + <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> + <dependentAssembly> + <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.20.0" newVersion="4.0.20.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Text.Encoding" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.IO" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Reflection" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + </assemblyBinding> + </runtime> +</configuration>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface001.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface001.cs new file mode 100644 index 0000000000..3bdeaf2598 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface001.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of ImplementOneInterface using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(IEmpty o) + { + return Helper.Compare((ImplementOneInterface)o, Helper.Create(default(ImplementOneInterface))); + } + + private static bool BoxUnboxToQ(IEmpty o) + { + return Helper.Compare((ImplementOneInterface?)o, Helper.Create(default(ImplementOneInterface))); + } + + private static int Main() + { + ImplementOneInterface? s = Helper.Create(default(ImplementOneInterface)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface001.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface001.csproj new file mode 100644 index 0000000000..aeb1b779e3 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface001.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-interface001.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface002.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface002.cs new file mode 100644 index 0000000000..4e77831bda --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface002.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(IEmpty o) + { + return Helper.Compare((ImplementTwoInterface)o, Helper.Create(default(ImplementTwoInterface))); + } + + private static bool BoxUnboxToQ(IEmpty o) + { + return Helper.Compare((ImplementTwoInterface?)o, Helper.Create(default(ImplementTwoInterface))); + } + + private static int Main() + { + ImplementTwoInterface? s = Helper.Create(default(ImplementTwoInterface)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface002.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface002.csproj new file mode 100644 index 0000000000..2fcd0f196b --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface002.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-interface002.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface003.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface003.cs new file mode 100644 index 0000000000..dcad64d26a --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface003.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of ImplementOneInterfaceGen<int> using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(IEmptyGen<int> o) + { + return Helper.Compare((ImplementOneInterfaceGen<int>)o, Helper.Create(default(ImplementOneInterfaceGen<int>))); + } + + private static bool BoxUnboxToQ(IEmptyGen<int> o) + { + return Helper.Compare((ImplementOneInterfaceGen<int>?)o, Helper.Create(default(ImplementOneInterfaceGen<int>))); + } + + private static int Main() + { + ImplementOneInterfaceGen<int>? s = Helper.Create(default(ImplementOneInterfaceGen<int>)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface003.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface003.csproj new file mode 100644 index 0000000000..90f15878cb --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface003.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-interface003.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface004.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface004.cs new file mode 100644 index 0000000000..46bec2bf68 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface004.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(IEmptyGen<int> o) + { + return Helper.Compare((ImplementTwoInterfaceGen<int>)o, Helper.Create(default(ImplementTwoInterfaceGen<int>))); + } + + private static bool BoxUnboxToQ(IEmptyGen<int> o) + { + return Helper.Compare((ImplementTwoInterfaceGen<int>?)o, Helper.Create(default(ImplementTwoInterfaceGen<int>))); + } + + private static int Main() + { + ImplementTwoInterfaceGen<int>? s = Helper.Create(default(ImplementTwoInterfaceGen<int>)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface004.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface004.csproj new file mode 100644 index 0000000000..c3c2b1b5a4 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface004.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-interface004.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface005.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface005.cs new file mode 100644 index 0000000000..27d813b8e2 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface005.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of ImplementAllInterface<int> using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(IEmpty o) + { + return Helper.Compare((ImplementAllInterface<int>)o, Helper.Create(default(ImplementAllInterface<int>))); + } + + private static bool BoxUnboxToQ(IEmpty o) + { + return Helper.Compare((ImplementAllInterface<int>?)o, Helper.Create(default(ImplementAllInterface<int>))); + } + + private static int Main() + { + ImplementAllInterface<int>? s = Helper.Create(default(ImplementAllInterface<int>)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface005.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface005.csproj new file mode 100644 index 0000000000..99cb715fbb --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface005.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-interface005.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface006.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface006.cs new file mode 100644 index 0000000000..e542b8feeb --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface006.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(IComparable o) + { + return Helper.Compare((char)o, Helper.Create(default(char))); + } + + private static bool BoxUnboxToQ(IComparable o) + { + return Helper.Compare((char?)o, Helper.Create(default(char))); + } + + private static int Main() + { + char? s = Helper.Create(default(char)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface006.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface006.csproj new file mode 100644 index 0000000000..89d39a4a39 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface006.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-interface006.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface007.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface007.cs new file mode 100644 index 0000000000..f962e53d41 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface007.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of bool using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(IComparable o) + { + return Helper.Compare((bool)o, Helper.Create(default(bool))); + } + + private static bool BoxUnboxToQ(IComparable o) + { + return Helper.Compare((bool?)o, Helper.Create(default(bool))); + } + + private static int Main() + { + bool? s = Helper.Create(default(bool)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface007.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface007.csproj new file mode 100644 index 0000000000..d7d5b8a8f5 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface007.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-interface007.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface008.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface008.cs new file mode 100644 index 0000000000..897398611f --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface008.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(IComparable o) + { + return Helper.Compare((byte)o, Helper.Create(default(byte))); + } + + private static bool BoxUnboxToQ(IComparable o) + { + return Helper.Compare((byte?)o, Helper.Create(default(byte))); + } + + private static int Main() + { + byte? s = Helper.Create(default(byte)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface008.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface008.csproj new file mode 100644 index 0000000000..0602110149 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface008.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-interface008.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface009.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface009.cs new file mode 100644 index 0000000000..dcfc384a95 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface009.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of sbyte using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(IComparable o) + { + return Helper.Compare((sbyte)o, Helper.Create(default(sbyte))); + } + + private static bool BoxUnboxToQ(IComparable o) + { + return Helper.Compare((sbyte?)o, Helper.Create(default(sbyte))); + } + + private static int Main() + { + sbyte? s = Helper.Create(default(sbyte)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface009.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface009.csproj new file mode 100644 index 0000000000..e6e697f5fc --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface009.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-interface009.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface010.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface010.cs new file mode 100644 index 0000000000..1ec8e9f72e --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface010.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(IComparable o) + { + return Helper.Compare((short)o, Helper.Create(default(short))); + } + + private static bool BoxUnboxToQ(IComparable o) + { + return Helper.Compare((short?)o, Helper.Create(default(short))); + } + + private static int Main() + { + short? s = Helper.Create(default(short)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface010.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface010.csproj new file mode 100644 index 0000000000..fd6d193aeb --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface010.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-interface010.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface011.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface011.cs new file mode 100644 index 0000000000..e06543ca8a --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface011.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of ushort using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(IComparable o) + { + return Helper.Compare((ushort)o, Helper.Create(default(ushort))); + } + + private static bool BoxUnboxToQ(IComparable o) + { + return Helper.Compare((ushort?)o, Helper.Create(default(ushort))); + } + + private static int Main() + { + ushort? s = Helper.Create(default(ushort)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface011.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface011.csproj new file mode 100644 index 0000000000..4ecd201efd --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface011.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-interface011.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface012.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface012.cs new file mode 100644 index 0000000000..58bdc7a6e5 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface012.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(IComparable o) + { + return Helper.Compare((int)o, Helper.Create(default(int))); + } + + private static bool BoxUnboxToQ(IComparable o) + { + return Helper.Compare((int?)o, Helper.Create(default(int))); + } + + private static int Main() + { + int? s = Helper.Create(default(int)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface012.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface012.csproj new file mode 100644 index 0000000000..dc86bc3635 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface012.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-interface012.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface013.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface013.cs new file mode 100644 index 0000000000..e39229d64a --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface013.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of uint using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(IComparable o) + { + return Helper.Compare((uint)o, Helper.Create(default(uint))); + } + + private static bool BoxUnboxToQ(IComparable o) + { + return Helper.Compare((uint?)o, Helper.Create(default(uint))); + } + + private static int Main() + { + uint? s = Helper.Create(default(uint)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface013.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface013.csproj new file mode 100644 index 0000000000..a44fac8338 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface013.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-interface013.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface014.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface014.cs new file mode 100644 index 0000000000..2221517e25 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface014.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(IComparable o) + { + return Helper.Compare((long)o, Helper.Create(default(long))); + } + + private static bool BoxUnboxToQ(IComparable o) + { + return Helper.Compare((long?)o, Helper.Create(default(long))); + } + + private static int Main() + { + long? s = Helper.Create(default(long)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface014.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface014.csproj new file mode 100644 index 0000000000..6568ac8e79 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface014.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-interface014.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface015.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface015.cs new file mode 100644 index 0000000000..d7991742fb --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface015.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of ulong using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(IComparable o) + { + return Helper.Compare((ulong)o, Helper.Create(default(ulong))); + } + + private static bool BoxUnboxToQ(IComparable o) + { + return Helper.Compare((ulong?)o, Helper.Create(default(ulong))); + } + + private static int Main() + { + ulong? s = Helper.Create(default(ulong)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface015.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface015.csproj new file mode 100644 index 0000000000..b94ba5fd1f --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface015.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-interface015.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface016.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface016.cs new file mode 100644 index 0000000000..f417010373 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface016.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(IComparable o) + { + return Helper.Compare((float)o, Helper.Create(default(float))); + } + + private static bool BoxUnboxToQ(IComparable o) + { + return Helper.Compare((float?)o, Helper.Create(default(float))); + } + + private static int Main() + { + float? s = Helper.Create(default(float)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface016.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface016.csproj new file mode 100644 index 0000000000..23198beede --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface016.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-interface016.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface017.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface017.cs new file mode 100644 index 0000000000..ccc826bbc9 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface017.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of double using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(IComparable o) + { + return Helper.Compare((double)o, Helper.Create(default(double))); + } + + private static bool BoxUnboxToQ(IComparable o) + { + return Helper.Compare((double?)o, Helper.Create(default(double))); + } + + private static int Main() + { + double? s = Helper.Create(default(double)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface017.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface017.csproj new file mode 100644 index 0000000000..1cd2e37017 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface017.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-interface017.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface018.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface018.cs new file mode 100644 index 0000000000..2152a418e0 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface018.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(IComparable o) + { + return Helper.Compare((decimal)o, Helper.Create(default(decimal))); + } + + private static bool BoxUnboxToQ(IComparable o) + { + return Helper.Compare((decimal?)o, Helper.Create(default(decimal))); + } + + private static int Main() + { + decimal? s = Helper.Create(default(decimal)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface018.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface018.csproj new file mode 100644 index 0000000000..0fbff9b365 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/interface/box-unbox-interface018.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-interface018.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/app.config b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/app.config new file mode 100644 index 0000000000..8077c95440 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/app.config @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<configuration> + <runtime> + <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> + <dependentAssembly> + <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.20.0" newVersion="4.0.20.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Text.Encoding" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.IO" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Reflection" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + </assemblyBinding> + </runtime> +</configuration>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null001.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null001.cs new file mode 100644 index 0000000000..7b5640a13f --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null001.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of char using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQGen<T>(T o) + { + return ((object)o) == null; + } + + private static bool BoxUnboxToQGen<T>(T? o) where T : struct + { + return ((T?)o) == null; + } + + private static bool BoxUnboxToNQ(object o) + { + return o == null; + } + + private static bool BoxUnboxToQ(object o) + { + return ((char?)o) == null; + } + + private static int Main() + { + char? s = null; + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s) && BoxUnboxToNQGen(s) && BoxUnboxToQGen(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null001.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null001.csproj new file mode 100644 index 0000000000..08b70a8f9d --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null001.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-null001.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null002.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null002.cs new file mode 100644 index 0000000000..25b3b715a4 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null002.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQGen<T>(T o) + { + return ((object)o) == null; + } + + private static bool BoxUnboxToQGen<T>(T? o) where T : struct + { + return ((T?)o) == null; + } + + private static bool BoxUnboxToNQ(object o) + { + return o == null; + } + + private static bool BoxUnboxToQ(object o) + { + return ((bool?)o) == null; + } + + private static int Main() + { + bool? s = null; + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s) && BoxUnboxToNQGen(s) && BoxUnboxToQGen(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null002.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null002.csproj new file mode 100644 index 0000000000..7015f89702 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null002.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-null002.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null003.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null003.cs new file mode 100644 index 0000000000..c01bcfb0a2 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null003.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of byte using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQGen<T>(T o) + { + return ((object)o) == null; + } + + private static bool BoxUnboxToQGen<T>(T? o) where T : struct + { + return ((T?)o) == null; + } + + private static bool BoxUnboxToNQ(object o) + { + return o == null; + } + + private static bool BoxUnboxToQ(object o) + { + return ((byte?)o) == null; + } + + private static int Main() + { + byte? s = null; + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s) && BoxUnboxToNQGen(s) && BoxUnboxToQGen(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null003.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null003.csproj new file mode 100644 index 0000000000..01b797531a --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null003.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-null003.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null004.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null004.cs new file mode 100644 index 0000000000..20d618f61f --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null004.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQGen<T>(T o) + { + return ((object)o) == null; + } + + private static bool BoxUnboxToQGen<T>(T? o) where T : struct + { + return ((T?)o) == null; + } + + private static bool BoxUnboxToNQ(object o) + { + return o == null; + } + + private static bool BoxUnboxToQ(object o) + { + return ((sbyte?)o) == null; + } + + private static int Main() + { + sbyte? s = null; + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s) && BoxUnboxToNQGen(s) && BoxUnboxToQGen(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null004.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null004.csproj new file mode 100644 index 0000000000..51a247fb20 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null004.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-null004.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null005.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null005.cs new file mode 100644 index 0000000000..a23538eef3 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null005.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of short using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQGen<T>(T o) + { + return ((object)o) == null; + } + + private static bool BoxUnboxToQGen<T>(T? o) where T : struct + { + return ((T?)o) == null; + } + + private static bool BoxUnboxToNQ(object o) + { + return o == null; + } + + private static bool BoxUnboxToQ(object o) + { + return ((short?)o) == null; + } + + private static int Main() + { + short? s = null; + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s) && BoxUnboxToNQGen(s) && BoxUnboxToQGen(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null005.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null005.csproj new file mode 100644 index 0000000000..34e9ff1a1f --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null005.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-null005.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null006.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null006.cs new file mode 100644 index 0000000000..c48103d805 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null006.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQGen<T>(T o) + { + return ((object)o) == null; + } + + private static bool BoxUnboxToQGen<T>(T? o) where T : struct + { + return ((T?)o) == null; + } + + private static bool BoxUnboxToNQ(object o) + { + return o == null; + } + + private static bool BoxUnboxToQ(object o) + { + return ((ushort?)o) == null; + } + + private static int Main() + { + ushort? s = null; + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s) && BoxUnboxToNQGen(s) && BoxUnboxToQGen(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null006.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null006.csproj new file mode 100644 index 0000000000..4d60875bba --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null006.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-null006.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null007.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null007.cs new file mode 100644 index 0000000000..2935d91c7a --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null007.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of int using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQGen<T>(T o) + { + return ((object)o) == null; + } + + private static bool BoxUnboxToQGen<T>(T? o) where T : struct + { + return ((T?)o) == null; + } + + private static bool BoxUnboxToNQ(object o) + { + return o == null; + } + + private static bool BoxUnboxToQ(object o) + { + return ((int?)o) == null; + } + + private static int Main() + { + int? s = null; + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s) && BoxUnboxToNQGen(s) && BoxUnboxToQGen(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null007.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null007.csproj new file mode 100644 index 0000000000..28c7d56c5e --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null007.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-null007.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null008.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null008.cs new file mode 100644 index 0000000000..1980350fbf --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null008.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQGen<T>(T o) + { + return ((object)o) == null; + } + + private static bool BoxUnboxToQGen<T>(T? o) where T : struct + { + return ((T?)o) == null; + } + + private static bool BoxUnboxToNQ(object o) + { + return o == null; + } + + private static bool BoxUnboxToQ(object o) + { + return ((uint?)o) == null; + } + + private static int Main() + { + uint? s = null; + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s) && BoxUnboxToNQGen(s) && BoxUnboxToQGen(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null008.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null008.csproj new file mode 100644 index 0000000000..c0aa858f81 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null008.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-null008.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null009.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null009.cs new file mode 100644 index 0000000000..966f0b1ebe --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null009.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of long using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQGen<T>(T o) + { + return ((object)o) == null; + } + + private static bool BoxUnboxToQGen<T>(T? o) where T : struct + { + return ((T?)o) == null; + } + + private static bool BoxUnboxToNQ(object o) + { + return o == null; + } + + private static bool BoxUnboxToQ(object o) + { + return ((long?)o) == null; + } + + private static int Main() + { + long? s = null; + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s) && BoxUnboxToNQGen(s) && BoxUnboxToQGen(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null009.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null009.csproj new file mode 100644 index 0000000000..5c5269d99f --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null009.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-null009.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null010.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null010.cs new file mode 100644 index 0000000000..8be0349f48 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null010.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQGen<T>(T o) + { + return ((object)o) == null; + } + + private static bool BoxUnboxToQGen<T>(T? o) where T : struct + { + return ((T?)o) == null; + } + + private static bool BoxUnboxToNQ(object o) + { + return o == null; + } + + private static bool BoxUnboxToQ(object o) + { + return ((ulong?)o) == null; + } + + private static int Main() + { + ulong? s = null; + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s) && BoxUnboxToNQGen(s) && BoxUnboxToQGen(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null010.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null010.csproj new file mode 100644 index 0000000000..f9da5c7293 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null010.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-null010.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null011.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null011.cs new file mode 100644 index 0000000000..64fdd76342 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null011.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of float using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQGen<T>(T o) + { + return ((object)o) == null; + } + + private static bool BoxUnboxToQGen<T>(T? o) where T : struct + { + return ((T?)o) == null; + } + + private static bool BoxUnboxToNQ(object o) + { + return o == null; + } + + private static bool BoxUnboxToQ(object o) + { + return ((float?)o) == null; + } + + private static int Main() + { + float? s = null; + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s) && BoxUnboxToNQGen(s) && BoxUnboxToQGen(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null011.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null011.csproj new file mode 100644 index 0000000000..edcca66637 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null011.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-null011.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null012.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null012.cs new file mode 100644 index 0000000000..8de79d9b78 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null012.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQGen<T>(T o) + { + return ((object)o) == null; + } + + private static bool BoxUnboxToQGen<T>(T? o) where T : struct + { + return ((T?)o) == null; + } + + private static bool BoxUnboxToNQ(object o) + { + return o == null; + } + + private static bool BoxUnboxToQ(object o) + { + return ((double?)o) == null; + } + + private static int Main() + { + double? s = null; + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s) && BoxUnboxToNQGen(s) && BoxUnboxToQGen(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null012.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null012.csproj new file mode 100644 index 0000000000..9cb9c2af00 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null012.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-null012.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null013.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null013.cs new file mode 100644 index 0000000000..21fe428d63 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null013.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of decimal using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQGen<T>(T o) + { + return ((object)o) == null; + } + + private static bool BoxUnboxToQGen<T>(T? o) where T : struct + { + return ((T?)o) == null; + } + + private static bool BoxUnboxToNQ(object o) + { + return o == null; + } + + private static bool BoxUnboxToQ(object o) + { + return ((decimal?)o) == null; + } + + private static int Main() + { + decimal? s = null; + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s) && BoxUnboxToNQGen(s) && BoxUnboxToQGen(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null013.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null013.csproj new file mode 100644 index 0000000000..0b998f4ea0 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null013.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-null013.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null014.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null014.cs new file mode 100644 index 0000000000..b3fffdf2f1 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null014.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQGen<T>(T o) + { + return ((object)o) == null; + } + + private static bool BoxUnboxToQGen<T>(T? o) where T : struct + { + return ((T?)o) == null; + } + + private static bool BoxUnboxToNQ(object o) + { + return o == null; + } + + private static bool BoxUnboxToQ(object o) + { + return ((IntPtr?)o) == null; + } + + private static int Main() + { + IntPtr? s = null; + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s) && BoxUnboxToNQGen(s) && BoxUnboxToQGen(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null014.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null014.csproj new file mode 100644 index 0000000000..1b256240c1 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null014.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-null014.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null015.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null015.cs new file mode 100644 index 0000000000..9aa6923bba --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null015.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of UIntPtr using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQGen<T>(T o) + { + return ((object)o) == null; + } + + private static bool BoxUnboxToQGen<T>(T? o) where T : struct + { + return ((T?)o) == null; + } + + private static bool BoxUnboxToNQ(object o) + { + return o == null; + } + + private static bool BoxUnboxToQ(object o) + { + return ((UIntPtr?)o) == null; + } + + private static int Main() + { + UIntPtr? s = null; + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s) && BoxUnboxToNQGen(s) && BoxUnboxToQGen(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null015.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null015.csproj new file mode 100644 index 0000000000..c471a8769b --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null015.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-null015.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null016.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null016.cs new file mode 100644 index 0000000000..b57e3550eb --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null016.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQGen<T>(T o) + { + return ((object)o) == null; + } + + private static bool BoxUnboxToQGen<T>(T? o) where T : struct + { + return ((T?)o) == null; + } + + private static bool BoxUnboxToNQ(object o) + { + return o == null; + } + + private static bool BoxUnboxToQ(object o) + { + return ((Guid?)o) == null; + } + + private static int Main() + { + Guid? s = null; + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s) && BoxUnboxToNQGen(s) && BoxUnboxToQGen(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null016.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null016.csproj new file mode 100644 index 0000000000..3084c44ff9 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null016.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-null016.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null017.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null017.cs new file mode 100644 index 0000000000..7158b97ee1 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null017.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of GCHandle using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQGen<T>(T o) + { + return ((object)o) == null; + } + + private static bool BoxUnboxToQGen<T>(T? o) where T : struct + { + return ((T?)o) == null; + } + + private static bool BoxUnboxToNQ(object o) + { + return o == null; + } + + private static bool BoxUnboxToQ(object o) + { + return ((GCHandle?)o) == null; + } + + private static int Main() + { + GCHandle? s = null; + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s) && BoxUnboxToNQGen(s) && BoxUnboxToQGen(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null017.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null017.csproj new file mode 100644 index 0000000000..2b934897b5 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null017.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-null017.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null018.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null018.cs new file mode 100644 index 0000000000..e2467577fb --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null018.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQGen<T>(T o) + { + return ((object)o) == null; + } + + private static bool BoxUnboxToQGen<T>(T? o) where T : struct + { + return ((T?)o) == null; + } + + private static bool BoxUnboxToNQ(object o) + { + return o == null; + } + + private static bool BoxUnboxToQ(object o) + { + return ((ByteE?)o) == null; + } + + private static int Main() + { + ByteE? s = null; + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s) && BoxUnboxToNQGen(s) && BoxUnboxToQGen(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null018.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null018.csproj new file mode 100644 index 0000000000..f0c01fbd55 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null018.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-null018.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null019.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null019.cs new file mode 100644 index 0000000000..f8a60b87ed --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null019.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of IntE using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQGen<T>(T o) + { + return ((object)o) == null; + } + + private static bool BoxUnboxToQGen<T>(T? o) where T : struct + { + return ((T?)o) == null; + } + + private static bool BoxUnboxToNQ(object o) + { + return o == null; + } + + private static bool BoxUnboxToQ(object o) + { + return ((IntE?)o) == null; + } + + private static int Main() + { + IntE? s = null; + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s) && BoxUnboxToNQGen(s) && BoxUnboxToQGen(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null019.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null019.csproj new file mode 100644 index 0000000000..eb69488a5a --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null019.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-null019.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null020.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null020.cs new file mode 100644 index 0000000000..19f623d464 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null020.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQGen<T>(T o) + { + return ((object)o) == null; + } + + private static bool BoxUnboxToQGen<T>(T? o) where T : struct + { + return ((T?)o) == null; + } + + private static bool BoxUnboxToNQ(object o) + { + return o == null; + } + + private static bool BoxUnboxToQ(object o) + { + return ((LongE?)o) == null; + } + + private static int Main() + { + LongE? s = null; + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s) && BoxUnboxToNQGen(s) && BoxUnboxToQGen(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null020.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null020.csproj new file mode 100644 index 0000000000..9c64824a26 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null020.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-null020.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null021.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null021.cs new file mode 100644 index 0000000000..4e7f496ea7 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null021.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of EmptyStruct using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQGen<T>(T o) + { + return ((object)o) == null; + } + + private static bool BoxUnboxToQGen<T>(T? o) where T : struct + { + return ((T?)o) == null; + } + + private static bool BoxUnboxToNQ(object o) + { + return o == null; + } + + private static bool BoxUnboxToQ(object o) + { + return ((EmptyStruct?)o) == null; + } + + private static int Main() + { + EmptyStruct? s = null; + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s) && BoxUnboxToNQGen(s) && BoxUnboxToQGen(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null021.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null021.csproj new file mode 100644 index 0000000000..2ca4c5f84a --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null021.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-null021.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null022.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null022.cs new file mode 100644 index 0000000000..4da034ed98 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null022.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQGen<T>(T o) + { + return ((object)o) == null; + } + + private static bool BoxUnboxToQGen<T>(T? o) where T : struct + { + return ((T?)o) == null; + } + + private static bool BoxUnboxToNQ(object o) + { + return o == null; + } + + private static bool BoxUnboxToQ(object o) + { + return ((NotEmptyStruct?)o) == null; + } + + private static int Main() + { + NotEmptyStruct? s = null; + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s) && BoxUnboxToNQGen(s) && BoxUnboxToQGen(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null022.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null022.csproj new file mode 100644 index 0000000000..6fa22909ca --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null022.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-null022.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null023.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null023.cs new file mode 100644 index 0000000000..da3f017321 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null023.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of NotEmptyStructQ using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQGen<T>(T o) + { + return ((object)o) == null; + } + + private static bool BoxUnboxToQGen<T>(T? o) where T : struct + { + return ((T?)o) == null; + } + + private static bool BoxUnboxToNQ(object o) + { + return o == null; + } + + private static bool BoxUnboxToQ(object o) + { + return ((NotEmptyStructQ?)o) == null; + } + + private static int Main() + { + NotEmptyStructQ? s = null; + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s) && BoxUnboxToNQGen(s) && BoxUnboxToQGen(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null023.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null023.csproj new file mode 100644 index 0000000000..6ab6af0d97 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null023.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-null023.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null024.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null024.cs new file mode 100644 index 0000000000..78a97365f1 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null024.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQGen<T>(T o) + { + return ((object)o) == null; + } + + private static bool BoxUnboxToQGen<T>(T? o) where T : struct + { + return ((T?)o) == null; + } + + private static bool BoxUnboxToNQ(object o) + { + return o == null; + } + + private static bool BoxUnboxToQ(object o) + { + return ((NotEmptyStructA?)o) == null; + } + + private static int Main() + { + NotEmptyStructA? s = null; + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s) && BoxUnboxToNQGen(s) && BoxUnboxToQGen(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null024.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null024.csproj new file mode 100644 index 0000000000..d85b324955 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null024.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-null024.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null025.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null025.cs new file mode 100644 index 0000000000..413fcd766a --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null025.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of NotEmptyStructQA using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQGen<T>(T o) + { + return ((object)o) == null; + } + + private static bool BoxUnboxToQGen<T>(T? o) where T : struct + { + return ((T?)o) == null; + } + + private static bool BoxUnboxToNQ(object o) + { + return o == null; + } + + private static bool BoxUnboxToQ(object o) + { + return ((NotEmptyStructQA?)o) == null; + } + + private static int Main() + { + NotEmptyStructQA? s = null; + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s) && BoxUnboxToNQGen(s) && BoxUnboxToQGen(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null025.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null025.csproj new file mode 100644 index 0000000000..3775e95bb6 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null025.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-null025.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null026.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null026.cs new file mode 100644 index 0000000000..ee90cdb62c --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null026.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQGen<T>(T o) + { + return ((object)o) == null; + } + + private static bool BoxUnboxToQGen<T>(T? o) where T : struct + { + return ((T?)o) == null; + } + + private static bool BoxUnboxToNQ(object o) + { + return o == null; + } + + private static bool BoxUnboxToQ(object o) + { + return ((EmptyStructGen<int>?)o) == null; + } + + private static int Main() + { + EmptyStructGen<int>? s = null; + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s) && BoxUnboxToNQGen(s) && BoxUnboxToQGen(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null026.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null026.csproj new file mode 100644 index 0000000000..af27a4900d --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null026.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-null026.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null027.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null027.cs new file mode 100644 index 0000000000..5af5df47da --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null027.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of NotEmptyStructGen<int> using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQGen<T>(T o) + { + return ((object)o) == null; + } + + private static bool BoxUnboxToQGen<T>(T? o) where T : struct + { + return ((T?)o) == null; + } + + private static bool BoxUnboxToNQ(object o) + { + return o == null; + } + + private static bool BoxUnboxToQ(object o) + { + return ((NotEmptyStructGen<int>?)o) == null; + } + + private static int Main() + { + NotEmptyStructGen<int>? s = null; + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s) && BoxUnboxToNQGen(s) && BoxUnboxToQGen(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null027.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null027.csproj new file mode 100644 index 0000000000..faa3c60fce --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null027.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-null027.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null028.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null028.cs new file mode 100644 index 0000000000..168093452f --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null028.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQGen<T>(T o) + { + return ((object)o) == null; + } + + private static bool BoxUnboxToQGen<T>(T? o) where T : struct + { + return ((T?)o) == null; + } + + private static bool BoxUnboxToNQ(object o) + { + return o == null; + } + + private static bool BoxUnboxToQ(object o) + { + return ((NotEmptyStructConstrainedGen<int>?)o) == null; + } + + private static int Main() + { + NotEmptyStructConstrainedGen<int>? s = null; + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s) && BoxUnboxToNQGen(s) && BoxUnboxToQGen(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null028.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null028.csproj new file mode 100644 index 0000000000..3edd828d80 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null028.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-null028.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null029.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null029.cs new file mode 100644 index 0000000000..dcea3c1e51 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null029.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of NotEmptyStructConstrainedGenA<int> using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQGen<T>(T o) + { + return ((object)o) == null; + } + + private static bool BoxUnboxToQGen<T>(T? o) where T : struct + { + return ((T?)o) == null; + } + + private static bool BoxUnboxToNQ(object o) + { + return o == null; + } + + private static bool BoxUnboxToQ(object o) + { + return ((NotEmptyStructConstrainedGenA<int>?)o) == null; + } + + private static int Main() + { + NotEmptyStructConstrainedGenA<int>? s = null; + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s) && BoxUnboxToNQGen(s) && BoxUnboxToQGen(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null029.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null029.csproj new file mode 100644 index 0000000000..56a479e9af --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null029.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-null029.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null030.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null030.cs new file mode 100644 index 0000000000..c477ca48f6 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null030.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQGen<T>(T o) + { + return ((object)o) == null; + } + + private static bool BoxUnboxToQGen<T>(T? o) where T : struct + { + return ((T?)o) == null; + } + + private static bool BoxUnboxToNQ(object o) + { + return o == null; + } + + private static bool BoxUnboxToQ(object o) + { + return ((NotEmptyStructConstrainedGenQ<int>?)o) == null; + } + + private static int Main() + { + NotEmptyStructConstrainedGenQ<int>? s = null; + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s) && BoxUnboxToNQGen(s) && BoxUnboxToQGen(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null030.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null030.csproj new file mode 100644 index 0000000000..dbdedae88c --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null030.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-null030.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null031.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null031.cs new file mode 100644 index 0000000000..690109c5b0 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null031.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of NotEmptyStructConstrainedGenQA<int> using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQGen<T>(T o) + { + return ((object)o) == null; + } + + private static bool BoxUnboxToQGen<T>(T? o) where T : struct + { + return ((T?)o) == null; + } + + private static bool BoxUnboxToNQ(object o) + { + return o == null; + } + + private static bool BoxUnboxToQ(object o) + { + return ((NotEmptyStructConstrainedGenQA<int>?)o) == null; + } + + private static int Main() + { + NotEmptyStructConstrainedGenQA<int>? s = null; + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s) && BoxUnboxToNQGen(s) && BoxUnboxToQGen(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null031.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null031.csproj new file mode 100644 index 0000000000..0fbc1b07c9 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null031.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-null031.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null032.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null032.cs new file mode 100644 index 0000000000..64063eb01e --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null032.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQGen<T>(T o) + { + return ((object)o) == null; + } + + private static bool BoxUnboxToQGen<T>(T? o) where T : struct + { + return ((T?)o) == null; + } + + private static bool BoxUnboxToNQ(object o) + { + return o == null; + } + + private static bool BoxUnboxToQ(object o) + { + return ((NestedStruct?)o) == null; + } + + private static int Main() + { + NestedStruct? s = null; + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s) && BoxUnboxToNQGen(s) && BoxUnboxToQGen(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null032.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null032.csproj new file mode 100644 index 0000000000..1877580e45 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null032.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-null032.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null033.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null033.cs new file mode 100644 index 0000000000..27021161a5 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null033.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of NestedStructGen<int> using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQGen<T>(T o) + { + return ((object)o) == null; + } + + private static bool BoxUnboxToQGen<T>(T? o) where T : struct + { + return ((T?)o) == null; + } + + private static bool BoxUnboxToNQ(object o) + { + return o == null; + } + + private static bool BoxUnboxToQ(object o) + { + return ((NestedStructGen<int>?)o) == null; + } + + private static int Main() + { + NestedStructGen<int>? s = null; + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s) && BoxUnboxToNQGen(s) && BoxUnboxToQGen(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null033.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null033.csproj new file mode 100644 index 0000000000..eec9f7c3fe --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null033.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-null033.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null034.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null034.cs new file mode 100644 index 0000000000..3d9a420bd1 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null034.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQGen<T>(T o) + { + return ((object)o) == null; + } + + private static bool BoxUnboxToQGen<T>(T? o) where T : struct + { + return ((T?)o) == null; + } + + private static bool BoxUnboxToNQ(object o) + { + return o == null; + } + + private static bool BoxUnboxToQ(object o) + { + return ((ExplicitFieldOffsetStruct?)o) == null; + } + + private static int Main() + { + ExplicitFieldOffsetStruct? s = null; + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s) && BoxUnboxToNQGen(s) && BoxUnboxToQGen(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null034.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null034.csproj new file mode 100644 index 0000000000..c089efa520 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null034.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-null034.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null037.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null037.cs new file mode 100644 index 0000000000..b9a74dfbcf --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null037.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of MarshalAsStruct using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQGen<T>(T o) + { + return ((object)o) == null; + } + + private static bool BoxUnboxToQGen<T>(T? o) where T : struct + { + return ((T?)o) == null; + } + + private static bool BoxUnboxToNQ(object o) + { + return o == null; + } + + private static bool BoxUnboxToQ(object o) + { + return ((MarshalAsStruct?)o) == null; + } + + private static int Main() + { + MarshalAsStruct? s = null; + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s) && BoxUnboxToNQGen(s) && BoxUnboxToQGen(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null037.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null037.csproj new file mode 100644 index 0000000000..464c9817ee --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null037.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-null037.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null038.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null038.cs new file mode 100644 index 0000000000..19d8d7ec23 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null038.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQGen<T>(T o) + { + return ((object)o) == null; + } + + private static bool BoxUnboxToQGen<T>(T? o) where T : struct + { + return ((T?)o) == null; + } + + private static bool BoxUnboxToNQ(object o) + { + return o == null; + } + + private static bool BoxUnboxToQ(object o) + { + return ((ImplementOneInterface?)o) == null; + } + + private static int Main() + { + ImplementOneInterface? s = null; + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s) && BoxUnboxToNQGen(s) && BoxUnboxToQGen(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null038.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null038.csproj new file mode 100644 index 0000000000..249e81d45b --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null038.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-null038.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null039.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null039.cs new file mode 100644 index 0000000000..7d8857fc76 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null039.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of ImplementTwoInterface using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQGen<T>(T o) + { + return ((object)o) == null; + } + + private static bool BoxUnboxToQGen<T>(T? o) where T : struct + { + return ((T?)o) == null; + } + + private static bool BoxUnboxToNQ(object o) + { + return o == null; + } + + private static bool BoxUnboxToQ(object o) + { + return ((ImplementTwoInterface?)o) == null; + } + + private static int Main() + { + ImplementTwoInterface? s = null; + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s) && BoxUnboxToNQGen(s) && BoxUnboxToQGen(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null039.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null039.csproj new file mode 100644 index 0000000000..fc04dfbbd0 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null039.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-null039.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null040.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null040.cs new file mode 100644 index 0000000000..7ce67b5f26 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null040.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQGen<T>(T o) + { + return ((object)o) == null; + } + + private static bool BoxUnboxToQGen<T>(T? o) where T : struct + { + return ((T?)o) == null; + } + + private static bool BoxUnboxToNQ(object o) + { + return o == null; + } + + private static bool BoxUnboxToQ(object o) + { + return ((ImplementOneInterfaceGen<int>?)o) == null; + } + + private static int Main() + { + ImplementOneInterfaceGen<int>? s = null; + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s) && BoxUnboxToNQGen(s) && BoxUnboxToQGen(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null040.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null040.csproj new file mode 100644 index 0000000000..33537bf735 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null040.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-null040.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null041.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null041.cs new file mode 100644 index 0000000000..1b26d309f6 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null041.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of ImplementTwoInterfaceGen<int> using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQGen<T>(T o) + { + return ((object)o) == null; + } + + private static bool BoxUnboxToQGen<T>(T? o) where T : struct + { + return ((T?)o) == null; + } + + private static bool BoxUnboxToNQ(object o) + { + return o == null; + } + + private static bool BoxUnboxToQ(object o) + { + return ((ImplementTwoInterfaceGen<int>?)o) == null; + } + + private static int Main() + { + ImplementTwoInterfaceGen<int>? s = null; + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s) && BoxUnboxToNQGen(s) && BoxUnboxToQGen(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null041.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null041.csproj new file mode 100644 index 0000000000..6076f62109 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null041.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-null041.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null042.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null042.cs new file mode 100644 index 0000000000..cd9663cc3e --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null042.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQGen<T>(T o) + { + return ((object)o) == null; + } + + private static bool BoxUnboxToQGen<T>(T? o) where T : struct + { + return ((T?)o) == null; + } + + private static bool BoxUnboxToNQ(object o) + { + return o == null; + } + + private static bool BoxUnboxToQ(object o) + { + return ((ImplementAllInterface<int>?)o) == null; + } + + private static int Main() + { + ImplementAllInterface<int>? s = null; + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s) && BoxUnboxToNQGen(s) && BoxUnboxToQGen(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null042.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null042.csproj new file mode 100644 index 0000000000..58d3f1eac4 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null042.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-null042.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null043.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null043.cs new file mode 100644 index 0000000000..f87dabad38 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null043.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of WithMultipleGCHandleStruct using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQGen<T>(T o) + { + return ((object)o) == null; + } + + private static bool BoxUnboxToQGen<T>(T? o) where T : struct + { + return ((T?)o) == null; + } + + private static bool BoxUnboxToNQ(object o) + { + return o == null; + } + + private static bool BoxUnboxToQ(object o) + { + return ((WithMultipleGCHandleStruct?)o) == null; + } + + private static int Main() + { + WithMultipleGCHandleStruct? s = null; + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s) && BoxUnboxToNQGen(s) && BoxUnboxToQGen(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null043.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null043.csproj new file mode 100644 index 0000000000..bb4905cfab --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null043.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-null043.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null044.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null044.cs new file mode 100644 index 0000000000..f7580d9a78 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null044.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQGen<T>(T o) + { + return ((object)o) == null; + } + + private static bool BoxUnboxToQGen<T>(T? o) where T : struct + { + return ((T?)o) == null; + } + + private static bool BoxUnboxToNQ(object o) + { + return o == null; + } + + private static bool BoxUnboxToQ(object o) + { + return ((WithOnlyFXTypeStruct?)o) == null; + } + + private static int Main() + { + WithOnlyFXTypeStruct? s = null; + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s) && BoxUnboxToNQGen(s) && BoxUnboxToQGen(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null044.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null044.csproj new file mode 100644 index 0000000000..9d42784506 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null044.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-null044.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null045.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null045.cs new file mode 100644 index 0000000000..a28dd4edc1 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null045.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of MixedAllStruct using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQGen<T>(T o) + { + return ((object)o) == null; + } + + private static bool BoxUnboxToQGen<T>(T? o) where T : struct + { + return ((T?)o) == null; + } + + private static bool BoxUnboxToNQ(object o) + { + return o == null; + } + + private static bool BoxUnboxToQ(object o) + { + return ((MixedAllStruct?)o) == null; + } + + private static int Main() + { + MixedAllStruct? s = null; + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s) && BoxUnboxToNQGen(s) && BoxUnboxToQGen(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null045.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null045.csproj new file mode 100644 index 0000000000..ab3f99b3d3 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null045.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-null045.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/structdef.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/structdef.cs new file mode 100644 index 0000000000..50eb1ce136 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/structdef.cs @@ -0,0 +1,402 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +#pragma warning disable 0183 // The given expression is always of the provided ('X') type + +using System.Runtime.InteropServices; +using System; +//using Microsoft; +using System.ComponentModel; +// primitives / CLR Types + +// interfaces +public interface IEmpty { } +public interface INotEmpty +{ + void DoNothing(); +} + +// generic interfaces +public interface IEmptyGen<T> { } +public interface INotEmptyGen<T> +{ + void DoNothing(); +} + +// struct +public struct EmptyStruct { } +public struct NotEmptyStruct +{ + public int Field; +} + +public struct NotEmptyStructQ +{ + public int? Field; +} + +public struct NotEmptyStructA +{ + public int[] Field; +} + +public struct NotEmptyStructQA +{ + public int?[] Field; +} + +// generic structs +public struct EmptyStructGen<T> { } +public struct NotEmptyStructGen<T> +{ + public T Field; +} + +public struct NotEmptyStructConstrainedGen<T> where T : struct +{ + public T Field; +} + +public struct NotEmptyStructConstrainedGenA<T> where T : struct +{ + public T[] Field; +} + +public struct NotEmptyStructConstrainedGenQ<T> where T : struct +{ + public T? Field; +} + +public struct NotEmptyStructConstrainedGenQA<T> where T : struct +{ + public T?[] Field; +} + +// nested struct +public struct NestedStruct +{ + public struct Nested { } +} + +public struct NestedStructGen<T> +{ + public struct Nested { } +} + + +// struct with Field Offset +[StructLayout(LayoutKind.Explicit)] +public struct ExplicitFieldOffsetStruct +{ + [FieldOffset(0)] + public int Field00; + [FieldOffset(0x0f)] + public int Field15; +} + +// struct with Attributes +internal struct MarshalAsStruct +{ + [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)] + public string StringField; +} + +// struct implement interfaces +internal struct ImplementOneInterface : IEmpty { } + +internal struct ImplementTwoInterface : IEmpty, INotEmpty +{ + public void DoNothing() { } +} + +internal struct ImplementOneInterfaceGen<T> : IEmptyGen<T> { } + +internal struct ImplementTwoInterfaceGen<T> : IEmptyGen<T>, INotEmptyGen<T> +{ + public void DoNothing() { } +} + +internal struct ImplementAllInterface<T> : IEmpty, INotEmpty, IEmptyGen<T>, INotEmptyGen<T> +{ + public void DoNothing() { } + void INotEmptyGen<T>.DoNothing() { } +} + +// enums +public enum IntE { start = 1, } +public enum ByteE : byte { start = 1, } +public enum LongE : long { start = 1, } + + +// other intersting structs +public struct WithMultipleGCHandleStruct +{ + public GCHandle H1; + public GCHandle H2; + public GCHandle H3; + public GCHandle H4; + public GCHandle H5; +} + +public struct WithOnlyFXTypeStruct +{ + public Guid GUID; + public decimal DECIMAL; +} + + +public struct MixedAllStruct +{ + public int INT; + public int? IntQ; + public int?[] IntQA; + public string STRING; + public IntE INTE; + public EmptyClass EMPTYCLASS; + public IEmpty IEMPTY; + public EmptyStruct EMPTYSTRUCT; + public IEmptyGen<int> IEMPTYGEN; + public EmptyStructGen<int> EMPTYSTRUCTGEN; + public WithOnlyFXTypeStruct WITHONLYFXTYPESTRUCT; + public GCHandle GCHANDLE; +} + + +// other types +public struct EmptyClass { } +public struct NotEmptyClass +{ + public int Field; +} + +public struct EmptyClassGen<T> { } +public struct NotEmptyClassGen<T> +{ + public T Field; +} + +public struct NotEmptyClassConstrainedGen<T> where T : class +{ + public T Field; +} +public struct NestedClass +{ + public struct Nested { } +} + +public struct NestedClassGen<T> +{ + public struct Nested { } +} + +internal class ImplementOneInterfaceC : IEmpty { } + +internal class ImplementTwoInterfaceC : IEmpty, INotEmpty +{ + public void DoNothing() { } +} + +internal class ImplementOneInterfaceGenC<T> : IEmptyGen<T> { } + +internal class ImplementTwoInterfaceGenC<T> : IEmptyGen<T>, INotEmptyGen<T> +{ + public void DoNothing() { } +} + +internal class ImplementAllInterfaceC<T> : IEmpty, INotEmpty, IEmptyGen<T>, INotEmptyGen<T> +{ + public void DoNothing() { } + void INotEmptyGen<T>.DoNothing() { } +} + +public sealed class SealedClass { } + +public delegate void SimpleDelegate(); +public delegate void GenericDelegate<T>(); + + +// ExitCode +public static class ExitCode +{ + public static int Failed = 101; + public static int Passed = 100; +} + + +// Create Value Instance +internal static class Helper +{ + public static GCHandle GCHANDLE; + static Helper() + { + GCHANDLE = GCHandle.Alloc(System.Console.Out); + } + + public static char Create(char val) { return 'c'; } + public static bool Create(bool val) { return true; } + public static byte Create(byte val) { return 0x08; } + public static sbyte Create(sbyte val) { return -0x0e; } + public static short Create(short val) { return -0x0f; } + public static ushort Create(ushort val) { return 0xff; } + public static int Create(int val) { return 100; } + public static uint Create(uint val) { return 200; } + public static long Create(long val) { return int.MaxValue; } + public static ulong Create(ulong val) { return 300; } + public static float Create(float val) { return 1.15f; } + public static double Create(double val) { return 0.05; } + public static decimal Create(decimal val) { return 1.0M; } + + public static IntPtr Create(IntPtr val) { return (IntPtr)1000; } + public static UIntPtr Create(UIntPtr val) { return (UIntPtr)2000; } + public static Guid Create(Guid val) { return new Guid("00020810-0001-0000-C000-000000000046"); } + public static GCHandle Create(GCHandle val) { return GCHANDLE; } + public static ByteE Create(ByteE val) { return (ByteE)9; } + public static IntE Create(IntE val) { return (IntE)55; } + public static LongE Create(LongE val) { return (LongE)34; } + public static EmptyStruct Create(EmptyStruct val) { return new EmptyStruct(); } + public static NotEmptyStruct Create(NotEmptyStruct val) { NotEmptyStruct ne = new NotEmptyStruct(); ne.Field = 100; return ne; } + public static NotEmptyStructQ Create(NotEmptyStructQ val) { NotEmptyStructQ neq = new NotEmptyStructQ(); neq.Field = 101; return neq; } + public static NotEmptyStructA Create(NotEmptyStructA val) { NotEmptyStructA nea = new NotEmptyStructA(); nea.Field = new int[] { 10 }; return nea; } + public static NotEmptyStructQA Create(NotEmptyStructQA val) { NotEmptyStructQA neq = new NotEmptyStructQA(); neq.Field = new int?[] { 10 }; return neq; } + public static EmptyStructGen<int> Create(EmptyStructGen<int> val) { return new EmptyStructGen<int>(); } + public static NotEmptyStructGen<int> Create(NotEmptyStructGen<int> val) { NotEmptyStructGen<int> ne = new NotEmptyStructGen<int>(); ne.Field = 88; return ne; } + public static NotEmptyStructConstrainedGen<int> Create(NotEmptyStructConstrainedGen<int> val) { NotEmptyStructConstrainedGen<int> ne = new NotEmptyStructConstrainedGen<int>(); ne.Field = 1010; return ne; } + public static NotEmptyStructConstrainedGenA<int> Create(NotEmptyStructConstrainedGenA<int> val) { NotEmptyStructConstrainedGenA<int> neq = new NotEmptyStructConstrainedGenA<int>(); neq.Field = new int[] { 11 }; return neq; } + public static NotEmptyStructConstrainedGenQ<int> Create(NotEmptyStructConstrainedGenQ<int> val) { NotEmptyStructConstrainedGenQ<int> neq = new NotEmptyStructConstrainedGenQ<int>(); neq.Field = 12; return neq; } + public static NotEmptyStructConstrainedGenQA<int> Create(NotEmptyStructConstrainedGenQA<int> val) { NotEmptyStructConstrainedGenQA<int> neq = new NotEmptyStructConstrainedGenQA<int>(); neq.Field = new int?[] { 17 }; return neq; } + public static NestedStruct Create(NestedStruct val) { NestedStruct ns = new NestedStruct(); return ns; } + public static NestedStructGen<int> Create(NestedStructGen<int> val) { NestedStructGen<int> nsg = new NestedStructGen<int>(); return nsg; } + public static ExplicitFieldOffsetStruct Create(ExplicitFieldOffsetStruct val) { ExplicitFieldOffsetStruct epl = new ExplicitFieldOffsetStruct(); epl.Field00 = 40; epl.Field15 = 15; return epl; } + public static MarshalAsStruct Create(MarshalAsStruct val) { MarshalAsStruct ma = new MarshalAsStruct(); ma.StringField = "Nullable"; return ma; } + public static ImplementOneInterface Create(ImplementOneInterface val) { ImplementOneInterface imp = new ImplementOneInterface(); return imp; } + public static ImplementTwoInterface Create(ImplementTwoInterface val) { ImplementTwoInterface imp = new ImplementTwoInterface(); return imp; } + public static ImplementOneInterfaceGen<int> Create(ImplementOneInterfaceGen<int> val) { ImplementOneInterfaceGen<int> imp = new ImplementOneInterfaceGen<int>(); return imp; } + public static ImplementTwoInterfaceGen<int> Create(ImplementTwoInterfaceGen<int> val) { ImplementTwoInterfaceGen<int> imp = new ImplementTwoInterfaceGen<int>(); return imp; } + public static ImplementAllInterface<int> Create(ImplementAllInterface<int> val) { ImplementAllInterface<int> imp = new ImplementAllInterface<int>(); return imp; } + public static WithMultipleGCHandleStruct Create(WithMultipleGCHandleStruct val) + { WithMultipleGCHandleStruct mgch = new WithMultipleGCHandleStruct(); mgch.H1 = GCHANDLE; mgch.H2 = GCHANDLE; mgch.H3 = GCHANDLE; mgch.H4 = GCHANDLE; mgch.H5 = GCHANDLE; return mgch; } + public static WithOnlyFXTypeStruct Create(WithOnlyFXTypeStruct val) { WithOnlyFXTypeStruct wofx = new WithOnlyFXTypeStruct(); wofx.DECIMAL = 50.0m; wofx.GUID = Create(default(Guid)); return wofx; } + public static MixedAllStruct Create(MixedAllStruct val) + { + MixedAllStruct mas; + mas.INT = 10; + mas.IntQ = null; + mas.IntQA = new int?[] { 10 }; + mas.STRING = "Nullable"; + mas.INTE = Create(default(IntE)); + mas.EMPTYCLASS = new EmptyClass(); + mas.IEMPTY = Create(default(ImplementOneInterface)); + mas.EMPTYSTRUCT = Create(default(EmptyStruct)); + mas.IEMPTYGEN = Create(default(ImplementOneInterfaceGen<int>)); + mas.EMPTYSTRUCTGEN = Create(default(EmptyStructGen<int>)); + mas.WITHONLYFXTYPESTRUCT = Create(default(WithOnlyFXTypeStruct)); + mas.GCHANDLE = Create(default(GCHandle)); + + return mas; + } + + public static bool Compare(char val, char val1) { return val == val1; } + public static bool Compare(bool val, bool val1) { return val == val1; } + public static bool Compare(byte val, byte val1) { return val == val1; } + public static bool Compare(sbyte val, sbyte val1) { return val == val1; } + public static bool Compare(short val, short val1) { return val == val1; } + public static bool Compare(ushort val, ushort val1) { return val == val1; } + public static bool Compare(int val, int val1) { return val == val1; } + public static bool Compare(uint val, uint val1) { return val == val1; } + public static bool Compare(long val, long val1) { return val == val1; } + public static bool Compare(ulong val, ulong val1) { return val == val1; } + public static bool Compare(float val, float val1) { return val == val1; } + public static bool Compare(double val, double val1) { return val == val1; } + public static bool Compare(decimal val, decimal val1) { return val == val1; } + + public static bool Compare(IntPtr val, IntPtr val1) { return val == val1; } + public static bool Compare(UIntPtr val, UIntPtr val1) { return val == val1; } + public static bool Compare(Guid val, Guid val1) { return val == val1; } + public static bool Compare(GCHandle val, GCHandle val1) { return val == val1; } + public static bool Compare(ByteE val, ByteE val1) { return val == val1; } + public static bool Compare(IntE val, IntE val1) { return val == val1; } + public static bool Compare(LongE val, LongE val1) { return val == val1; } + public static bool Compare(EmptyStruct val, EmptyStruct val1) { return val.Equals(val1); } + public static bool Compare(NotEmptyStruct val, NotEmptyStruct val1) { return val.Field == val1.Field; } + public static bool Compare(NotEmptyStructQ val, NotEmptyStructQ val1) { return val.Field == val1.Field; } + public static bool Compare(NotEmptyStructA val, NotEmptyStructA val1) { return val.Field[0] == val1.Field[0]; } + public static bool Compare(NotEmptyStructQA val, NotEmptyStructQA val1) { return val.Field[0] == val1.Field[0]; } + public static bool Compare(EmptyStructGen<int> val, EmptyStructGen<int> val1) { return val.Equals(val1); } + public static bool Compare(NotEmptyStructGen<int> val, NotEmptyStructGen<int> val1) { return val.Field == val1.Field; } + public static bool Compare(NotEmptyStructConstrainedGen<int> val, NotEmptyStructConstrainedGen<int> val1) { return val.Field == val1.Field; } + public static bool Compare(NotEmptyStructConstrainedGenA<int> val, NotEmptyStructConstrainedGenA<int> val1) { return val.Field[0] == val1.Field[0]; } + public static bool Compare(NotEmptyStructConstrainedGenQ<int> val, NotEmptyStructConstrainedGenQ<int> val1) { return val.Field == val1.Field; } + public static bool Compare(NotEmptyStructConstrainedGenQA<int> val, NotEmptyStructConstrainedGenQA<int> val1) { return val.Field[0] == val1.Field[0]; } + public static bool Compare(NestedStruct val, NestedStruct val1) { return val.Equals(val1); } + public static bool Compare(NestedStructGen<int> val, NestedStructGen<int> val1) { return val.Equals(val1); } + public static bool Compare(ExplicitFieldOffsetStruct val, ExplicitFieldOffsetStruct val1) { return (val.Field00 == val1.Field00) && (val.Field15 == val1.Field15); } + public static bool Compare(MarshalAsStruct val, MarshalAsStruct val1) { return val.Equals(val1); } + public static bool Compare(ImplementOneInterface val, ImplementOneInterface val1) { return (val is IEmpty) && val.Equals(val1); } + public static bool Compare(ImplementTwoInterface val, ImplementTwoInterface val1) { return (val is IEmpty) && val is INotEmpty && val.Equals(val1); } + public static bool Compare(ImplementOneInterfaceGen<int> val, ImplementOneInterfaceGen<int> val1) { return val is IEmptyGen<int> && val.Equals(val1); } + public static bool Compare(ImplementTwoInterfaceGen<int> val, ImplementTwoInterfaceGen<int> val1) { return val is IEmptyGen<int> && val is INotEmptyGen<int> && val.Equals(val1); } + public static bool Compare(ImplementAllInterface<int> val, ImplementAllInterface<int> val1) { return val is IEmpty && val is INotEmpty && val is IEmptyGen<int> && val is INotEmptyGen<int> && val.Equals(val1); } + public static bool Compare(WithMultipleGCHandleStruct val, WithMultipleGCHandleStruct val1) + { return val.H1 == val1.H1 && val.H2 == val1.H2 && val.H3 == val1.H3 && val.H4 == val1.H4 && val.H5 == val1.H5; } + public static bool Compare(WithOnlyFXTypeStruct val, WithOnlyFXTypeStruct val1) { return val.GUID == val1.GUID && val.DECIMAL == val1.DECIMAL; } + public static bool Compare(MixedAllStruct val, MixedAllStruct val1) + { + return val.INT == val1.INT && + val.IntQ == val1.IntQ && + val.IntQA[0] == val1.IntQA[0] && + val.STRING == val1.STRING && + val.INTE == val1.INTE && + val.EMPTYCLASS.Equals(val1.EMPTYCLASS) && + val.IEMPTY.Equals(val1.IEMPTY) && + Compare(val.EMPTYSTRUCT, val1.EMPTYSTRUCT) && + val.IEMPTYGEN.Equals(val1.IEMPTYGEN) && + Compare(val.EMPTYSTRUCTGEN, val1.EMPTYSTRUCTGEN) && + Compare(val.WITHONLYFXTYPESTRUCT, val1.WITHONLYFXTYPESTRUCT) && + Compare(val.GCHANDLE, val1.GCHANDLE); + } + + public static bool Compare(char? val, char val1) { return val == null ? false : Compare(val.Value, val1); } + public static bool Compare(bool? val, bool val1) { return val == null ? false : Compare(val.Value, val1); } + public static bool Compare(byte? val, byte val1) { return val == null ? false : Compare(val.Value, val1); } + public static bool Compare(sbyte? val, sbyte val1) { return val == null ? false : Compare(val.Value, val1); } + public static bool Compare(short? val, short val1) { return val == null ? false : Compare(val.Value, val1); } + public static bool Compare(ushort? val, ushort val1) { return val == null ? false : Compare(val.Value, val1); } + public static bool Compare(int? val, int val1) { return val == null ? false : Compare(val.Value, val1); } + public static bool Compare(uint? val, uint val1) { return val == null ? false : Compare(val.Value, val1); } + public static bool Compare(long? val, long val1) { return val == null ? false : Compare(val.Value, val1); } + public static bool Compare(ulong? val, ulong val1) { return val == null ? false : Compare(val.Value, val1); } + public static bool Compare(float? val, float val1) { return val == null ? false : Compare(val.Value, val1); } + public static bool Compare(double? val, double val1) { return val == null ? false : Compare(val.Value, val1); } + public static bool Compare(decimal? val, decimal val1) { return val == null ? false : Compare(val.Value, val1); } + + public static bool Compare(IntPtr? val, IntPtr val1) { return val == null ? false : Compare(val.Value, val1); } + public static bool Compare(UIntPtr? val, UIntPtr val1) { return val == null ? false : Compare(val.Value, val1); } + public static bool Compare(Guid? val, Guid val1) { return val == null ? false : Compare(val.Value, val1); } + public static bool Compare(GCHandle? val, GCHandle val1) { return val == null ? false : Compare(val.Value, val1); } + public static bool Compare(ByteE? val, ByteE val1) { return val == null ? false : Compare(val.Value, val1); } + public static bool Compare(IntE? val, IntE val1) { return val == null ? false : Compare(val.Value, val1); } + public static bool Compare(LongE? val, LongE val1) { return val == null ? false : Compare(val.Value, val1); } + public static bool Compare(EmptyStruct? val, EmptyStruct val1) { return val == null ? false : Compare(val.Value, val1); } + public static bool Compare(NotEmptyStruct? val, NotEmptyStruct val1) { return val == null ? false : Compare(val.Value, val1); } + public static bool Compare(NotEmptyStructQ? val, NotEmptyStructQ val1) { return val == null ? false : Compare(val.Value, val1); } + public static bool Compare(NotEmptyStructA? val, NotEmptyStructA val1) { return val == null ? false : Compare(val.Value, val1); } + public static bool Compare(NotEmptyStructQA? val, NotEmptyStructQA val1) { return val == null ? false : Compare(val.Value, val1); } + public static bool Compare(EmptyStructGen<int>? val, EmptyStructGen<int> val1) { return val == null ? false : Compare(val.Value, val1); } + public static bool Compare(NotEmptyStructGen<int>? val, NotEmptyStructGen<int> val1) { return val == null ? false : Compare(val.Value, val1); } + public static bool Compare(NotEmptyStructConstrainedGen<int>? val, NotEmptyStructConstrainedGen<int> val1) { return val == null ? false : Compare(val.Value, val1); } + public static bool Compare(NotEmptyStructConstrainedGenA<int>? val, NotEmptyStructConstrainedGenA<int> val1) { return val == null ? false : Compare(val.Value, val1); } + public static bool Compare(NotEmptyStructConstrainedGenQ<int>? val, NotEmptyStructConstrainedGenQ<int> val1) { return val == null ? false : Compare(val.Value, val1); } + public static bool Compare(NotEmptyStructConstrainedGenQA<int>? val, NotEmptyStructConstrainedGenQA<int> val1) { return val == null ? false : Compare(val.Value, val1); } + public static bool Compare(NestedStruct? val, NestedStruct val1) { return val == null ? false : Compare(val.Value, val1); } + public static bool Compare(NestedStructGen<int>? val, NestedStructGen<int> val1) { return val == null ? false : Compare(val.Value, val1); } + public static bool Compare(ExplicitFieldOffsetStruct? val, ExplicitFieldOffsetStruct val1) { return val == null ? false : Compare(val.Value, val1); } + public static bool Compare(MarshalAsStruct? val, MarshalAsStruct val1) { return val == null ? false : Compare(val.Value, val1); } + public static bool Compare(ImplementOneInterface? val, ImplementOneInterface val1) { return val == null ? false : Compare(val.Value, val1); } + public static bool Compare(ImplementTwoInterface? val, ImplementTwoInterface val1) { return val == null ? false : Compare(val.Value, val1); } + public static bool Compare(ImplementOneInterfaceGen<int>? val, ImplementOneInterfaceGen<int> val1) { return val == null ? false : Compare(val.Value, val1); } + public static bool Compare(ImplementTwoInterfaceGen<int>? val, ImplementTwoInterfaceGen<int> val1) { return val == null ? false : Compare(val.Value, val1); } + public static bool Compare(ImplementAllInterface<int>? val, ImplementAllInterface<int> val1) { return val == null ? false : Compare(val.Value, val1); } + public static bool Compare(WithMultipleGCHandleStruct? val, WithMultipleGCHandleStruct val1) { return val == null ? false : Compare(val.Value, val1); } + public static bool Compare(WithOnlyFXTypeStruct? val, WithOnlyFXTypeStruct val1) { return val == null ? false : Compare(val.Value, val1); } + public static bool Compare(MixedAllStruct? val, MixedAllStruct val1) { return val == null ? false : Compare(val.Value, val1); } +} diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/app.config b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/app.config new file mode 100644 index 0000000000..8077c95440 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/app.config @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<configuration> + <runtime> + <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> + <dependentAssembly> + <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.20.0" newVersion="4.0.20.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Text.Encoding" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.IO" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Reflection" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + </assemblyBinding> + </runtime> +</configuration>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value001.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value001.cs new file mode 100644 index 0000000000..d439428c69 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value001.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of char using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(ValueType o) + { + return Helper.Compare((char)o, Helper.Create(default(char))); + } + + private static bool BoxUnboxToQ(ValueType o) + { + return Helper.Compare((char?)o, Helper.Create(default(char))); + } + + private static int Main() + { + char? s = Helper.Create(default(char)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value001.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value001.csproj new file mode 100644 index 0000000000..d97717033c --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value001.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-value001.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value002.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value002.cs new file mode 100644 index 0000000000..94c402e821 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value002.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(ValueType o) + { + return Helper.Compare((bool)o, Helper.Create(default(bool))); + } + + private static bool BoxUnboxToQ(ValueType o) + { + return Helper.Compare((bool?)o, Helper.Create(default(bool))); + } + + private static int Main() + { + bool? s = Helper.Create(default(bool)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value002.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value002.csproj new file mode 100644 index 0000000000..8b4e7f3026 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value002.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-value002.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value003.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value003.cs new file mode 100644 index 0000000000..54bb9cc981 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value003.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of byte using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(ValueType o) + { + return Helper.Compare((byte)o, Helper.Create(default(byte))); + } + + private static bool BoxUnboxToQ(ValueType o) + { + return Helper.Compare((byte?)o, Helper.Create(default(byte))); + } + + private static int Main() + { + byte? s = Helper.Create(default(byte)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value003.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value003.csproj new file mode 100644 index 0000000000..d4cd7dafcc --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value003.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-value003.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value004.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value004.cs new file mode 100644 index 0000000000..ba80a63210 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value004.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(ValueType o) + { + return Helper.Compare((sbyte)o, Helper.Create(default(sbyte))); + } + + private static bool BoxUnboxToQ(ValueType o) + { + return Helper.Compare((sbyte?)o, Helper.Create(default(sbyte))); + } + + private static int Main() + { + sbyte? s = Helper.Create(default(sbyte)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value004.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value004.csproj new file mode 100644 index 0000000000..061dd18eb1 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value004.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-value004.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value005.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value005.cs new file mode 100644 index 0000000000..b571ca6dc1 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value005.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of short using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(ValueType o) + { + return Helper.Compare((short)o, Helper.Create(default(short))); + } + + private static bool BoxUnboxToQ(ValueType o) + { + return Helper.Compare((short?)o, Helper.Create(default(short))); + } + + private static int Main() + { + short? s = Helper.Create(default(short)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value005.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value005.csproj new file mode 100644 index 0000000000..6d67860360 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value005.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-value005.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value006.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value006.cs new file mode 100644 index 0000000000..153f311d79 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value006.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(ValueType o) + { + return Helper.Compare((ushort)o, Helper.Create(default(ushort))); + } + + private static bool BoxUnboxToQ(ValueType o) + { + return Helper.Compare((ushort?)o, Helper.Create(default(ushort))); + } + + private static int Main() + { + ushort? s = Helper.Create(default(ushort)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value006.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value006.csproj new file mode 100644 index 0000000000..a775ea3865 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value006.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-value006.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value007.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value007.cs new file mode 100644 index 0000000000..d57b7b34e6 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value007.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of int using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(ValueType o) + { + return Helper.Compare((int)o, Helper.Create(default(int))); + } + + private static bool BoxUnboxToQ(ValueType o) + { + return Helper.Compare((int?)o, Helper.Create(default(int))); + } + + private static int Main() + { + int? s = Helper.Create(default(int)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value007.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value007.csproj new file mode 100644 index 0000000000..99e41e96ba --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value007.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-value007.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value008.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value008.cs new file mode 100644 index 0000000000..14aab701ab --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value008.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(ValueType o) + { + return Helper.Compare((uint)o, Helper.Create(default(uint))); + } + + private static bool BoxUnboxToQ(ValueType o) + { + return Helper.Compare((uint?)o, Helper.Create(default(uint))); + } + + private static int Main() + { + uint? s = Helper.Create(default(uint)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value008.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value008.csproj new file mode 100644 index 0000000000..6cbb6c4edc --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value008.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-value008.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value009.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value009.cs new file mode 100644 index 0000000000..e96ebfff19 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value009.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of long using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(ValueType o) + { + return Helper.Compare((long)o, Helper.Create(default(long))); + } + + private static bool BoxUnboxToQ(ValueType o) + { + return Helper.Compare((long?)o, Helper.Create(default(long))); + } + + private static int Main() + { + long? s = Helper.Create(default(long)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value009.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value009.csproj new file mode 100644 index 0000000000..15bebb3ca9 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value009.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-value009.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value010.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value010.cs new file mode 100644 index 0000000000..11d1a86a23 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value010.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(ValueType o) + { + return Helper.Compare((ulong)o, Helper.Create(default(ulong))); + } + + private static bool BoxUnboxToQ(ValueType o) + { + return Helper.Compare((ulong?)o, Helper.Create(default(ulong))); + } + + private static int Main() + { + ulong? s = Helper.Create(default(ulong)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value010.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value010.csproj new file mode 100644 index 0000000000..c1b9759eab --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value010.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-value010.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value011.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value011.cs new file mode 100644 index 0000000000..4bf7b50a86 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value011.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of float using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(ValueType o) + { + return Helper.Compare((float)o, Helper.Create(default(float))); + } + + private static bool BoxUnboxToQ(ValueType o) + { + return Helper.Compare((float?)o, Helper.Create(default(float))); + } + + private static int Main() + { + float? s = Helper.Create(default(float)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value011.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value011.csproj new file mode 100644 index 0000000000..78414c793a --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value011.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-value011.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value012.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value012.cs new file mode 100644 index 0000000000..801d0c3cc5 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value012.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(ValueType o) + { + return Helper.Compare((double)o, Helper.Create(default(double))); + } + + private static bool BoxUnboxToQ(ValueType o) + { + return Helper.Compare((double?)o, Helper.Create(default(double))); + } + + private static int Main() + { + double? s = Helper.Create(default(double)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value012.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value012.csproj new file mode 100644 index 0000000000..b4ed69aa66 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value012.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-value012.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value013.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value013.cs new file mode 100644 index 0000000000..215bcf5306 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value013.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of decimal using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(ValueType o) + { + return Helper.Compare((decimal)o, Helper.Create(default(decimal))); + } + + private static bool BoxUnboxToQ(ValueType o) + { + return Helper.Compare((decimal?)o, Helper.Create(default(decimal))); + } + + private static int Main() + { + decimal? s = Helper.Create(default(decimal)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value013.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value013.csproj new file mode 100644 index 0000000000..0d84d084d2 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value013.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-value013.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value014.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value014.cs new file mode 100644 index 0000000000..98d3936b1f --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value014.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(ValueType o) + { + return Helper.Compare((IntPtr)o, Helper.Create(default(IntPtr))); + } + + private static bool BoxUnboxToQ(ValueType o) + { + return Helper.Compare((IntPtr?)o, Helper.Create(default(IntPtr))); + } + + private static int Main() + { + IntPtr? s = Helper.Create(default(IntPtr)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value014.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value014.csproj new file mode 100644 index 0000000000..6724b721a3 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value014.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-value014.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value015.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value015.cs new file mode 100644 index 0000000000..c440f08357 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value015.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of UIntPtr using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(ValueType o) + { + return Helper.Compare((UIntPtr)o, Helper.Create(default(UIntPtr))); + } + + private static bool BoxUnboxToQ(ValueType o) + { + return Helper.Compare((UIntPtr?)o, Helper.Create(default(UIntPtr))); + } + + private static int Main() + { + UIntPtr? s = Helper.Create(default(UIntPtr)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value015.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value015.csproj new file mode 100644 index 0000000000..5c6427eea2 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value015.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-value015.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value016.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value016.cs new file mode 100644 index 0000000000..73d8804610 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value016.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(ValueType o) + { + return Helper.Compare((Guid)o, Helper.Create(default(Guid))); + } + + private static bool BoxUnboxToQ(ValueType o) + { + return Helper.Compare((Guid?)o, Helper.Create(default(Guid))); + } + + private static int Main() + { + Guid? s = Helper.Create(default(Guid)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value016.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value016.csproj new file mode 100644 index 0000000000..ae93a50971 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value016.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-value016.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value017.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value017.cs new file mode 100644 index 0000000000..a4c9898441 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value017.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of GCHandle using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(ValueType o) + { + return Helper.Compare((GCHandle)o, Helper.Create(default(GCHandle))); + } + + private static bool BoxUnboxToQ(ValueType o) + { + return Helper.Compare((GCHandle?)o, Helper.Create(default(GCHandle))); + } + + private static int Main() + { + GCHandle? s = Helper.Create(default(GCHandle)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value017.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value017.csproj new file mode 100644 index 0000000000..e1b34d0fe0 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value017.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-value017.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value018.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value018.cs new file mode 100644 index 0000000000..37eb5a0900 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value018.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(ValueType o) + { + return Helper.Compare((ByteE)o, Helper.Create(default(ByteE))); + } + + private static bool BoxUnboxToQ(ValueType o) + { + return Helper.Compare((ByteE?)o, Helper.Create(default(ByteE))); + } + + private static int Main() + { + ByteE? s = Helper.Create(default(ByteE)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value018.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value018.csproj new file mode 100644 index 0000000000..e1d7e6e656 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value018.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-value018.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value019.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value019.cs new file mode 100644 index 0000000000..a4dcc454ed --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value019.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of IntE using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(ValueType o) + { + return Helper.Compare((IntE)o, Helper.Create(default(IntE))); + } + + private static bool BoxUnboxToQ(ValueType o) + { + return Helper.Compare((IntE?)o, Helper.Create(default(IntE))); + } + + private static int Main() + { + IntE? s = Helper.Create(default(IntE)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value019.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value019.csproj new file mode 100644 index 0000000000..50e698cd88 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value019.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-value019.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value020.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value020.cs new file mode 100644 index 0000000000..c6f95c75a5 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value020.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(ValueType o) + { + return Helper.Compare((LongE)o, Helper.Create(default(LongE))); + } + + private static bool BoxUnboxToQ(ValueType o) + { + return Helper.Compare((LongE?)o, Helper.Create(default(LongE))); + } + + private static int Main() + { + LongE? s = Helper.Create(default(LongE)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value020.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value020.csproj new file mode 100644 index 0000000000..70efada5a1 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value020.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-value020.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value021.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value021.cs new file mode 100644 index 0000000000..750bc0fa81 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value021.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of EmptyStruct using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(ValueType o) + { + return Helper.Compare((EmptyStruct)o, Helper.Create(default(EmptyStruct))); + } + + private static bool BoxUnboxToQ(ValueType o) + { + return Helper.Compare((EmptyStruct?)o, Helper.Create(default(EmptyStruct))); + } + + private static int Main() + { + EmptyStruct? s = Helper.Create(default(EmptyStruct)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value021.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value021.csproj new file mode 100644 index 0000000000..eefd3c5748 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value021.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-value021.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value022.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value022.cs new file mode 100644 index 0000000000..ef940a3149 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value022.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(ValueType o) + { + return Helper.Compare((NotEmptyStruct)o, Helper.Create(default(NotEmptyStruct))); + } + + private static bool BoxUnboxToQ(ValueType o) + { + return Helper.Compare((NotEmptyStruct?)o, Helper.Create(default(NotEmptyStruct))); + } + + private static int Main() + { + NotEmptyStruct? s = Helper.Create(default(NotEmptyStruct)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value022.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value022.csproj new file mode 100644 index 0000000000..d8b17cc133 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value022.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-value022.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value023.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value023.cs new file mode 100644 index 0000000000..6ae51b44bc --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value023.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of NotEmptyStructQ using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(ValueType o) + { + return Helper.Compare((NotEmptyStructQ)o, Helper.Create(default(NotEmptyStructQ))); + } + + private static bool BoxUnboxToQ(ValueType o) + { + return Helper.Compare((NotEmptyStructQ?)o, Helper.Create(default(NotEmptyStructQ))); + } + + private static int Main() + { + NotEmptyStructQ? s = Helper.Create(default(NotEmptyStructQ)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value023.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value023.csproj new file mode 100644 index 0000000000..392ad1e382 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value023.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-value023.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value024.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value024.cs new file mode 100644 index 0000000000..6023a2ad3a --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value024.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(ValueType o) + { + return Helper.Compare((NotEmptyStructA)o, Helper.Create(default(NotEmptyStructA))); + } + + private static bool BoxUnboxToQ(ValueType o) + { + return Helper.Compare((NotEmptyStructA?)o, Helper.Create(default(NotEmptyStructA))); + } + + private static int Main() + { + NotEmptyStructA? s = Helper.Create(default(NotEmptyStructA)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value024.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value024.csproj new file mode 100644 index 0000000000..b9c49cf2ef --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value024.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-value024.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value025.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value025.cs new file mode 100644 index 0000000000..f2de5887a4 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value025.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of NotEmptyStructQA using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(ValueType o) + { + return Helper.Compare((NotEmptyStructQA)o, Helper.Create(default(NotEmptyStructQA))); + } + + private static bool BoxUnboxToQ(ValueType o) + { + return Helper.Compare((NotEmptyStructQA?)o, Helper.Create(default(NotEmptyStructQA))); + } + + private static int Main() + { + NotEmptyStructQA? s = Helper.Create(default(NotEmptyStructQA)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value025.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value025.csproj new file mode 100644 index 0000000000..6946188211 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value025.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-value025.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value026.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value026.cs new file mode 100644 index 0000000000..b10570e4c3 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value026.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(ValueType o) + { + return Helper.Compare((EmptyStructGen<int>)o, Helper.Create(default(EmptyStructGen<int>))); + } + + private static bool BoxUnboxToQ(ValueType o) + { + return Helper.Compare((EmptyStructGen<int>?)o, Helper.Create(default(EmptyStructGen<int>))); + } + + private static int Main() + { + EmptyStructGen<int>? s = Helper.Create(default(EmptyStructGen<int>)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value026.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value026.csproj new file mode 100644 index 0000000000..11fd07c62c --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value026.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-value026.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value027.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value027.cs new file mode 100644 index 0000000000..7536471987 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value027.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of NotEmptyStructGen<int> using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(ValueType o) + { + return Helper.Compare((NotEmptyStructGen<int>)o, Helper.Create(default(NotEmptyStructGen<int>))); + } + + private static bool BoxUnboxToQ(ValueType o) + { + return Helper.Compare((NotEmptyStructGen<int>?)o, Helper.Create(default(NotEmptyStructGen<int>))); + } + + private static int Main() + { + NotEmptyStructGen<int>? s = Helper.Create(default(NotEmptyStructGen<int>)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value027.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value027.csproj new file mode 100644 index 0000000000..a94ac3b9d5 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value027.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-value027.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value028.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value028.cs new file mode 100644 index 0000000000..cb290c7585 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value028.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(ValueType o) + { + return Helper.Compare((NotEmptyStructConstrainedGen<int>)o, Helper.Create(default(NotEmptyStructConstrainedGen<int>))); + } + + private static bool BoxUnboxToQ(ValueType o) + { + return Helper.Compare((NotEmptyStructConstrainedGen<int>?)o, Helper.Create(default(NotEmptyStructConstrainedGen<int>))); + } + + private static int Main() + { + NotEmptyStructConstrainedGen<int>? s = Helper.Create(default(NotEmptyStructConstrainedGen<int>)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value028.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value028.csproj new file mode 100644 index 0000000000..2d6afa3bc3 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value028.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-value028.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value029.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value029.cs new file mode 100644 index 0000000000..bcfcc00d7b --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value029.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of NotEmptyStructConstrainedGenA<int> using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(ValueType o) + { + return Helper.Compare((NotEmptyStructConstrainedGenA<int>)o, Helper.Create(default(NotEmptyStructConstrainedGenA<int>))); + } + + private static bool BoxUnboxToQ(ValueType o) + { + return Helper.Compare((NotEmptyStructConstrainedGenA<int>?)o, Helper.Create(default(NotEmptyStructConstrainedGenA<int>))); + } + + private static int Main() + { + NotEmptyStructConstrainedGenA<int>? s = Helper.Create(default(NotEmptyStructConstrainedGenA<int>)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value029.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value029.csproj new file mode 100644 index 0000000000..15f30dfc08 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value029.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-value029.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value030.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value030.cs new file mode 100644 index 0000000000..dd864ad305 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value030.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(ValueType o) + { + return Helper.Compare((NotEmptyStructConstrainedGenQ<int>)o, Helper.Create(default(NotEmptyStructConstrainedGenQ<int>))); + } + + private static bool BoxUnboxToQ(ValueType o) + { + return Helper.Compare((NotEmptyStructConstrainedGenQ<int>?)o, Helper.Create(default(NotEmptyStructConstrainedGenQ<int>))); + } + + private static int Main() + { + NotEmptyStructConstrainedGenQ<int>? s = Helper.Create(default(NotEmptyStructConstrainedGenQ<int>)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value030.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value030.csproj new file mode 100644 index 0000000000..448c75140b --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value030.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-value030.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value031.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value031.cs new file mode 100644 index 0000000000..222745cdb0 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value031.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of NotEmptyStructConstrainedGenQA<int> using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(ValueType o) + { + return Helper.Compare((NotEmptyStructConstrainedGenQA<int>)o, Helper.Create(default(NotEmptyStructConstrainedGenQA<int>))); + } + + private static bool BoxUnboxToQ(ValueType o) + { + return Helper.Compare((NotEmptyStructConstrainedGenQA<int>?)o, Helper.Create(default(NotEmptyStructConstrainedGenQA<int>))); + } + + private static int Main() + { + NotEmptyStructConstrainedGenQA<int>? s = Helper.Create(default(NotEmptyStructConstrainedGenQA<int>)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value031.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value031.csproj new file mode 100644 index 0000000000..ccbae7df36 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value031.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-value031.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value032.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value032.cs new file mode 100644 index 0000000000..a17ae71a8d --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value032.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(ValueType o) + { + return Helper.Compare((NestedStruct)o, Helper.Create(default(NestedStruct))); + } + + private static bool BoxUnboxToQ(ValueType o) + { + return Helper.Compare((NestedStruct?)o, Helper.Create(default(NestedStruct))); + } + + private static int Main() + { + NestedStruct? s = Helper.Create(default(NestedStruct)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value032.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value032.csproj new file mode 100644 index 0000000000..1cb35d307d --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value032.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-value032.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value033.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value033.cs new file mode 100644 index 0000000000..e49168ff32 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value033.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of NestedStructGen<int> using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(ValueType o) + { + return Helper.Compare((NestedStructGen<int>)o, Helper.Create(default(NestedStructGen<int>))); + } + + private static bool BoxUnboxToQ(ValueType o) + { + return Helper.Compare((NestedStructGen<int>?)o, Helper.Create(default(NestedStructGen<int>))); + } + + private static int Main() + { + NestedStructGen<int>? s = Helper.Create(default(NestedStructGen<int>)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value033.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value033.csproj new file mode 100644 index 0000000000..14ec5d7f06 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value033.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-value033.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value034.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value034.cs new file mode 100644 index 0000000000..3f679907d7 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value034.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(ValueType o) + { + return Helper.Compare((ExplicitFieldOffsetStruct)o, Helper.Create(default(ExplicitFieldOffsetStruct))); + } + + private static bool BoxUnboxToQ(ValueType o) + { + return Helper.Compare((ExplicitFieldOffsetStruct?)o, Helper.Create(default(ExplicitFieldOffsetStruct))); + } + + private static int Main() + { + ExplicitFieldOffsetStruct? s = Helper.Create(default(ExplicitFieldOffsetStruct)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value034.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value034.csproj new file mode 100644 index 0000000000..cba13d1d32 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value034.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-value034.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value037.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value037.cs new file mode 100644 index 0000000000..59254c6e82 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value037.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of MarshalAsStruct using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(ValueType o) + { + return Helper.Compare((MarshalAsStruct)o, Helper.Create(default(MarshalAsStruct))); + } + + private static bool BoxUnboxToQ(ValueType o) + { + return Helper.Compare((MarshalAsStruct?)o, Helper.Create(default(MarshalAsStruct))); + } + + private static int Main() + { + MarshalAsStruct? s = Helper.Create(default(MarshalAsStruct)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value037.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value037.csproj new file mode 100644 index 0000000000..0f53d774ce --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value037.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-value037.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value038.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value038.cs new file mode 100644 index 0000000000..6f157d8565 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value038.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(ValueType o) + { + return Helper.Compare((ImplementOneInterface)o, Helper.Create(default(ImplementOneInterface))); + } + + private static bool BoxUnboxToQ(ValueType o) + { + return Helper.Compare((ImplementOneInterface?)o, Helper.Create(default(ImplementOneInterface))); + } + + private static int Main() + { + ImplementOneInterface? s = Helper.Create(default(ImplementOneInterface)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value038.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value038.csproj new file mode 100644 index 0000000000..c430d1e79b --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value038.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-value038.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value039.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value039.cs new file mode 100644 index 0000000000..cec5c0fa1c --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value039.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of ImplementTwoInterface using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(ValueType o) + { + return Helper.Compare((ImplementTwoInterface)o, Helper.Create(default(ImplementTwoInterface))); + } + + private static bool BoxUnboxToQ(ValueType o) + { + return Helper.Compare((ImplementTwoInterface?)o, Helper.Create(default(ImplementTwoInterface))); + } + + private static int Main() + { + ImplementTwoInterface? s = Helper.Create(default(ImplementTwoInterface)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value039.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value039.csproj new file mode 100644 index 0000000000..da46f74e14 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value039.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-value039.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value040.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value040.cs new file mode 100644 index 0000000000..c027001ab1 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value040.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(ValueType o) + { + return Helper.Compare((ImplementOneInterfaceGen<int>)o, Helper.Create(default(ImplementOneInterfaceGen<int>))); + } + + private static bool BoxUnboxToQ(ValueType o) + { + return Helper.Compare((ImplementOneInterfaceGen<int>?)o, Helper.Create(default(ImplementOneInterfaceGen<int>))); + } + + private static int Main() + { + ImplementOneInterfaceGen<int>? s = Helper.Create(default(ImplementOneInterfaceGen<int>)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value040.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value040.csproj new file mode 100644 index 0000000000..ca62a0bb42 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value040.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-value040.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value041.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value041.cs new file mode 100644 index 0000000000..ffc3ad3fbf --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value041.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of ImplementTwoInterfaceGen<int> using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(ValueType o) + { + return Helper.Compare((ImplementTwoInterfaceGen<int>)o, Helper.Create(default(ImplementTwoInterfaceGen<int>))); + } + + private static bool BoxUnboxToQ(ValueType o) + { + return Helper.Compare((ImplementTwoInterfaceGen<int>?)o, Helper.Create(default(ImplementTwoInterfaceGen<int>))); + } + + private static int Main() + { + ImplementTwoInterfaceGen<int>? s = Helper.Create(default(ImplementTwoInterfaceGen<int>)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value041.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value041.csproj new file mode 100644 index 0000000000..c3fa4e1207 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value041.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-value041.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value042.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value042.cs new file mode 100644 index 0000000000..387bcdda35 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value042.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(ValueType o) + { + return Helper.Compare((ImplementAllInterface<int>)o, Helper.Create(default(ImplementAllInterface<int>))); + } + + private static bool BoxUnboxToQ(ValueType o) + { + return Helper.Compare((ImplementAllInterface<int>?)o, Helper.Create(default(ImplementAllInterface<int>))); + } + + private static int Main() + { + ImplementAllInterface<int>? s = Helper.Create(default(ImplementAllInterface<int>)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value042.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value042.csproj new file mode 100644 index 0000000000..33ac731dc0 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value042.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-value042.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value043.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value043.cs new file mode 100644 index 0000000000..1808491cf3 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value043.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of WithMultipleGCHandleStruct using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(ValueType o) + { + return Helper.Compare((WithMultipleGCHandleStruct)o, Helper.Create(default(WithMultipleGCHandleStruct))); + } + + private static bool BoxUnboxToQ(ValueType o) + { + return Helper.Compare((WithMultipleGCHandleStruct?)o, Helper.Create(default(WithMultipleGCHandleStruct))); + } + + private static int Main() + { + WithMultipleGCHandleStruct? s = Helper.Create(default(WithMultipleGCHandleStruct)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value043.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value043.csproj new file mode 100644 index 0000000000..91c79d5477 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value043.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-value043.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value044.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value044.cs new file mode 100644 index 0000000000..a79f299d69 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value044.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(ValueType o) + { + return Helper.Compare((WithOnlyFXTypeStruct)o, Helper.Create(default(WithOnlyFXTypeStruct))); + } + + private static bool BoxUnboxToQ(ValueType o) + { + return Helper.Compare((WithOnlyFXTypeStruct?)o, Helper.Create(default(WithOnlyFXTypeStruct))); + } + + private static int Main() + { + WithOnlyFXTypeStruct? s = Helper.Create(default(WithOnlyFXTypeStruct)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value044.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value044.csproj new file mode 100644 index 0000000000..8761d9ce10 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value044.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-value044.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value045.cs b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value045.cs new file mode 100644 index 0000000000..351036dbeb --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value045.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// <Area> Nullable - Box-Unbox </Area> +// <Title> Nullable type with unbox box expr </Title> +// <Description> +// checking type of MixedAllStruct using is operator +// </Description> +// <RelatedBugs> </RelatedBugs> +//<Expects Status=success></Expects> +// <Code> + + +using System.Runtime.InteropServices; +using System; + +internal class NullableTest +{ + private static bool BoxUnboxToNQ(ValueType o) + { + return Helper.Compare((MixedAllStruct)o, Helper.Create(default(MixedAllStruct))); + } + + private static bool BoxUnboxToQ(ValueType o) + { + return Helper.Compare((MixedAllStruct?)o, Helper.Create(default(MixedAllStruct))); + } + + private static int Main() + { + MixedAllStruct? s = Helper.Create(default(MixedAllStruct)); + + if (BoxUnboxToNQ(s) && BoxUnboxToQ(s)) + return ExitCode.Passed; + else + return ExitCode.Failed; + } +} + + diff --git a/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value045.csproj b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value045.csproj new file mode 100644 index 0000000000..8549fd43c4 --- /dev/null +++ b/tests/src/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value045.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="box-unbox-value045.cs" /> + <Compile Include="..\structdef.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project>
\ No newline at end of file |