You've already forked linux-packaging-mono
Imported Upstream version 5.0.0.42
Former-commit-id: fd56571888259555122d8a0f58c68838229cea2b
This commit is contained in:
parent
1190d13a04
commit
6bdd276d05
41
external/corefx/src/System.Dynamic.Runtime/System.Dynamic.Runtime.sln
vendored
Normal file
41
external/corefx/src/System.Dynamic.Runtime/System.Dynamic.Runtime.sln
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.22613.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Dynamic.Runtime.Tests", "tests\System.Dynamic.Runtime.Tests.csproj", "{0BFD6D9F-DF9E-4B17-8ED4-29437AE5B04A}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{C4E89B8C-07DB-40CA-8C99-82A23E8F5F39} = {C4E89B8C-07DB-40CA-8C99-82A23E8F5F39}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Dynamic.Runtime", "src\System.Dynamic.Runtime.csproj", "{C4E89B8C-07DB-40CA-8C99-82A23E8F5F39}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
DebugNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU = DebugNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU
|
||||
ReleaseNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU = ReleaseNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU
|
||||
DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU = DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU
|
||||
ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU = ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{0BFD6D9F-DF9E-4B17-8ED4-29437AE5B04A}.DebugNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Debug|Any CPU
|
||||
{0BFD6D9F-DF9E-4B17-8ED4-29437AE5B04A}.DebugNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU.Build.0 = netcoreapp-Debug|Any CPU
|
||||
{0BFD6D9F-DF9E-4B17-8ED4-29437AE5B04A}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Release|Any CPU
|
||||
{0BFD6D9F-DF9E-4B17-8ED4-29437AE5B04A}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU.Build.0 = netcoreapp-Release|Any CPU
|
||||
{0BFD6D9F-DF9E-4B17-8ED4-29437AE5B04A}.DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Debug|Any CPU
|
||||
{0BFD6D9F-DF9E-4B17-8ED4-29437AE5B04A}.DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU.Build.0 = netcoreapp-Debug|Any CPU
|
||||
{0BFD6D9F-DF9E-4B17-8ED4-29437AE5B04A}.ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Release|Any CPU
|
||||
{0BFD6D9F-DF9E-4B17-8ED4-29437AE5B04A}.ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU.Build.0 = netcoreapp-Release|Any CPU
|
||||
{C4E89B8C-07DB-40CA-8C99-82A23E8F5F39}.DebugNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU.ActiveCfg = net463-Windows_NT-Debug|Any CPU
|
||||
{C4E89B8C-07DB-40CA-8C99-82A23E8F5F39}.DebugNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU.Build.0 = net463-Windows_NT-Debug|Any CPU
|
||||
{C4E89B8C-07DB-40CA-8C99-82A23E8F5F39}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU.ActiveCfg = net463-Windows_NT-Release|Any CPU
|
||||
{C4E89B8C-07DB-40CA-8C99-82A23E8F5F39}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU.Build.0 = net463-Windows_NT-Release|Any CPU
|
||||
{C4E89B8C-07DB-40CA-8C99-82A23E8F5F39}.DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Debug|Any CPU
|
||||
{C4E89B8C-07DB-40CA-8C99-82A23E8F5F39}.DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU.Build.0 = netcoreapp-Debug|Any CPU
|
||||
{C4E89B8C-07DB-40CA-8C99-82A23E8F5F39}.ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Release|Any CPU
|
||||
{C4E89B8C-07DB-40CA-8C99-82A23E8F5F39}.ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU.Build.0 = netcoreapp-Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
8
external/corefx/src/System.Dynamic.Runtime/dir.props
vendored
Normal file
8
external/corefx/src/System.Dynamic.Runtime/dir.props
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\dir.props" />
|
||||
<PropertyGroup>
|
||||
<AssemblyVersion>4.1.0.0</AssemblyVersion>
|
||||
<IsNETCoreApp>true</IsNETCoreApp>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
9
external/corefx/src/System.Dynamic.Runtime/ref/Configurations.props
vendored
Normal file
9
external/corefx/src/System.Dynamic.Runtime/ref/Configurations.props
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<BuildConfigurations>
|
||||
netcoreapp;
|
||||
uap;
|
||||
</BuildConfigurations>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
35
external/corefx/src/System.Dynamic.Runtime/ref/System.Dynamic.Runtime.cs
vendored
Normal file
35
external/corefx/src/System.Dynamic.Runtime/ref/System.Dynamic.Runtime.cs
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
// ------------------------------------------------------------------------------
|
||||
// Changes to this file must follow the http://aka.ms/api-review process.
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.CompilerServices.CallSiteBinder))]
|
||||
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.CompilerServices.CallSite))]
|
||||
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.CompilerServices.CallSite<>))]
|
||||
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.CompilerServices.CallSiteHelpers))]
|
||||
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.CompilerServices.DynamicAttribute))]
|
||||
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Linq.Expressions.DynamicExpression))]
|
||||
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Linq.Expressions.DynamicExpressionVisitor))]
|
||||
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Dynamic.DynamicMetaObject))]
|
||||
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Dynamic.DynamicMetaObjectBinder))]
|
||||
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Dynamic.BindingRestrictions))]
|
||||
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Dynamic.BinaryOperationBinder))]
|
||||
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Dynamic.CallInfo))]
|
||||
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Dynamic.ConvertBinder))]
|
||||
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Dynamic.CreateInstanceBinder))]
|
||||
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Dynamic.DeleteIndexBinder))]
|
||||
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Dynamic.DeleteMemberBinder))]
|
||||
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Dynamic.GetIndexBinder))]
|
||||
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Dynamic.GetMemberBinder))]
|
||||
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Dynamic.InvokeBinder))]
|
||||
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Dynamic.InvokeMemberBinder))]
|
||||
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Dynamic.SetIndexBinder))]
|
||||
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Dynamic.SetMemberBinder))]
|
||||
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Dynamic.UnaryOperationBinder))]
|
||||
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Dynamic.IDynamicMetaObjectProvider))]
|
||||
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Dynamic.DynamicObject))]
|
||||
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Dynamic.ExpandoObject))]
|
||||
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Dynamic.IInvokeOnGetBinder))]
|
||||
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.CompilerServices.ConditionalWeakTable<,>))]
|
||||
17
external/corefx/src/System.Dynamic.Runtime/ref/System.Dynamic.Runtime.csproj
vendored
Normal file
17
external/corefx/src/System.Dynamic.Runtime/ref/System.Dynamic.Runtime.csproj
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Release|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uap-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uap-Release|AnyCPU'" />
|
||||
<ItemGroup>
|
||||
<Compile Include="System.Dynamic.Runtime.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\System.Runtime\ref\System.Runtime.csproj" />
|
||||
<ProjectReference Include="..\..\System.ObjectModel\ref\System.ObjectModel.csproj" />
|
||||
<ProjectReference Include="..\..\System.Linq.Expressions\ref\System.Linq.Expressions.csproj" />
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
|
||||
</Project>
|
||||
9
external/corefx/src/System.Dynamic.Runtime/src/Configurations.props
vendored
Normal file
9
external/corefx/src/System.Dynamic.Runtime/src/Configurations.props
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<BuildConfigurations>
|
||||
net463-Windows_NT;
|
||||
netcoreapp;
|
||||
</BuildConfigurations>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
24
external/corefx/src/System.Dynamic.Runtime/src/System.Dynamic.Runtime.csproj
vendored
Normal file
24
external/corefx/src/System.Dynamic.Runtime/src/System.Dynamic.Runtime.csproj
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>{C4E89B8C-07DB-40CA-8C99-82A23E8F5F39}</ProjectGuid>
|
||||
<AssemblyName>System.Dynamic.Runtime</AssemblyName>
|
||||
<RootNamespace>System.Dynamic.Runtime</RootNamespace>
|
||||
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
|
||||
</PropertyGroup>
|
||||
<!-- Default configurations to help VS understand the configurations -->
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='net463-Windows_NT-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='net463-Windows_NT-Release|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netcoreapp-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netcoreapp-Release|AnyCPU'" />
|
||||
<ItemGroup Condition="'$(TargetGroup)' == 'netcoreapp'">
|
||||
<Reference Include="System.Linq.Expressions" />
|
||||
<Reference Include="System.Runtime" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(TargetGroup)' == 'net463'">
|
||||
<TargetingPackReference Include="mscorlib" />
|
||||
<TargetingPackReference Include="System.Core" />
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
|
||||
</Project>
|
||||
84
external/corefx/src/System.Dynamic.Runtime/tests/CallInfoTests.cs
vendored
Normal file
84
external/corefx/src/System.Dynamic.Runtime/tests/CallInfoTests.cs
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Xunit;
|
||||
|
||||
namespace System.Dynamic.Runtime.Tests
|
||||
{
|
||||
public class CallInfoTests
|
||||
{
|
||||
[Fact]
|
||||
public void NullNames()
|
||||
{
|
||||
Assert.Throws<ArgumentNullException>("argNames", () => new CallInfo(0, default(string[])));
|
||||
Assert.Throws<ArgumentNullException>("argNames", () => new CallInfo(0, default(IEnumerable<string>)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ArgCountTooLow()
|
||||
{
|
||||
Assert.Throws<ArgumentException>(null, () => new CallInfo(1, "a", "b"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void NullName()
|
||||
{
|
||||
Assert.Throws<ArgumentNullException>("argNames[1]", () => new CallInfo(3, "a", null, "c"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ArgCountRetained()
|
||||
{
|
||||
Assert.Equal(0, new CallInfo(0).ArgumentCount);
|
||||
Assert.Equal(4, new CallInfo(4).ArgumentCount);
|
||||
Assert.Equal(3, new CallInfo(3, "a", "b", "c").ArgumentCount);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ArgNamesRetained()
|
||||
{
|
||||
Assert.Equal(new[] { "a", "b", "c" }, new CallInfo(3, "a", "b", "c").ArgumentNames);
|
||||
// Having a singleton for empty name lists isn't required by the spec,
|
||||
// (any empty ReadOnlyCollection<string> will fulfill that),
|
||||
// but consider the impact (possibly breaking, possibly less performant)
|
||||
// before changing this.
|
||||
Assert.Same(new CallInfo(0).ArgumentNames, new CallInfo(1).ArgumentNames);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Equality()
|
||||
{
|
||||
CallInfo a = new CallInfo(5, "a", "b");
|
||||
CallInfo b = new CallInfo(5, "a", "b");
|
||||
CallInfo c = new CallInfo(5, a.ArgumentNames);
|
||||
CallInfo d = new CallInfo(5, "b", "a");
|
||||
CallInfo e = new CallInfo(4, "a", "b");
|
||||
CallInfo f = new CallInfo(5, "a");
|
||||
CallInfo x = new CallInfo(3);
|
||||
CallInfo y = new CallInfo(3);
|
||||
CallInfo z = new CallInfo(2);
|
||||
|
||||
Assert.Equal(a, a);
|
||||
Assert.Equal(a, b);
|
||||
Assert.Equal(a, c);
|
||||
Assert.NotEqual(a, d);
|
||||
Assert.NotEqual(a, e);
|
||||
Assert.NotEqual(a, f);
|
||||
Assert.Equal(x, y);
|
||||
Assert.NotEqual(x, z);
|
||||
|
||||
var dict = new Dictionary<CallInfo, int> { { a, 1 }, { x, 2 } };
|
||||
|
||||
Assert.Equal(1, dict[a]);
|
||||
Assert.Equal(1, dict[b]);
|
||||
Assert.Equal(1, dict[c]);
|
||||
Assert.False(dict.ContainsKey(d));
|
||||
Assert.False(dict.ContainsKey(e));
|
||||
Assert.False(dict.ContainsKey(f));
|
||||
Assert.Equal(2, dict[y]);
|
||||
Assert.False(dict.ContainsKey(z));
|
||||
}
|
||||
}
|
||||
}
|
||||
11
external/corefx/src/System.Dynamic.Runtime/tests/Common.cs
vendored
Normal file
11
external/corefx/src/System.Dynamic.Runtime/tests/Common.cs
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
namespace Dynamic.Tests
|
||||
{
|
||||
public static class Helpers
|
||||
{
|
||||
public static T Cast<T>(dynamic d) => (T)d;
|
||||
}
|
||||
}
|
||||
8
external/corefx/src/System.Dynamic.Runtime/tests/Configurations.props
vendored
Normal file
8
external/corefx/src/System.Dynamic.Runtime/tests/Configurations.props
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<BuildConfigurations>
|
||||
netstandard;
|
||||
</BuildConfigurations>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
44
external/corefx/src/System.Dynamic.Runtime/tests/Dynamic.Context/Common.cs
vendored
Normal file
44
external/corefx/src/System.Dynamic.Runtime/tests/Dynamic.Context/Common.cs
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
namespace Dynamic.Operator.Tests
|
||||
{
|
||||
public static class LiftCommon
|
||||
{
|
||||
public static bool? s_bool = null;
|
||||
public static byte? s_byte = null;
|
||||
public static char? s_char = null;
|
||||
public static decimal? s_decimal = null;
|
||||
public static double? s_double = null;
|
||||
public static float? s_float = null;
|
||||
public static int? s_int = null;
|
||||
public static long? s_long = null;
|
||||
public static object s_object = new object();
|
||||
public static sbyte? s_sbyte = null;
|
||||
public static short? s_short = 6;
|
||||
public static string s_string = "a";
|
||||
public static uint? s_uint = null;
|
||||
public static ulong? s_ulong = 2;
|
||||
public static ushort? s_ushort = 7;
|
||||
}
|
||||
|
||||
public static class TypeCommon
|
||||
{
|
||||
public static bool s_bool = true;
|
||||
public static byte s_byte = 1;
|
||||
public static char s_char = 'a';
|
||||
public static decimal s_decimal = 1M;
|
||||
public static double s_double = 10.1;
|
||||
public static float s_float = 10.1f;
|
||||
public static int s_int = 10;
|
||||
public static long s_long = 5;
|
||||
public static object s_object = new object();
|
||||
public static sbyte s_sbyte = 10;
|
||||
public static short s_short = 6;
|
||||
public static string s_string = "a";
|
||||
public static uint s_uint = 15;
|
||||
public static ulong s_ulong = 2;
|
||||
public static ushort s_ushort = 7;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using Microsoft.CSharp.RuntimeBinder;
|
||||
using Xunit;
|
||||
|
||||
namespace Dynamic.Tests
|
||||
{
|
||||
public class ExplicitlyImplementedGenericInterfaceTests
|
||||
{
|
||||
[Fact]
|
||||
public void NonGenericInterface_WithGenericMember1()
|
||||
{
|
||||
dynamic d = new ExplicitlyImplementedInterface1();
|
||||
Assert.Throws<RuntimeBinderException>(() => d.Foo<int>());
|
||||
|
||||
var x = Helpers.Cast<InterfaceWithGenericMember>(d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void NonGenericInterface_WithGenericMember2()
|
||||
{
|
||||
dynamic d = new ExplicitlyImplementedInterface2();
|
||||
Assert.Throws<RuntimeBinderException>(() => d.Foo<int>());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GenericInterface_WithNonGenericMember()
|
||||
{
|
||||
dynamic d = new ExplicitlyImplementedGenericInterface();
|
||||
Assert.Equal(2, d.Foo());
|
||||
var x = Helpers.Cast<GenericInterfaceWithNonGenericMember<int>>(d);
|
||||
|
||||
Assert.Throws<InvalidCastException>(() => Helpers.Cast<GenericInterfaceWithNonGenericMember<double>>(d));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GenericInterface_WithGenericMember1()
|
||||
{
|
||||
dynamic d = new ExplicitlyImplementedGenericInterfaceWithGenericMember1();
|
||||
Assert.Throws<RuntimeBinderException>(() => d.Foo(1));
|
||||
|
||||
var x = Helpers.Cast<GenericInterfaceWithGenericMember1<int>>(d);
|
||||
|
||||
Assert.Throws<InvalidCastException>(() => Helpers.Cast<GenericInterfaceWithGenericMember1<double>>(d));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GenericInterface_WithGenericMember2()
|
||||
{
|
||||
dynamic d = new ExplicitlyImplementedGenericInterfaceWithGenericMember2();
|
||||
Assert.Throws<RuntimeBinderException>(() => d.Foo<int>());
|
||||
|
||||
var x = Helpers.Cast<GenericInterfaceWithGenericMember2<int>>(d);
|
||||
|
||||
Assert.Throws<InvalidCastException>(() => Helpers.Cast<GenericInterfaceWithGenericMember2<double>>(d));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GenericInterface_WithInGenericParameter_BaseClass()
|
||||
{
|
||||
dynamic d = new ExplicitlyImplementedGenericInInterface<BaseClass>();
|
||||
Assert.Throws<RuntimeBinderException>(() => d.Foo());
|
||||
|
||||
var x = Helpers.Cast<GenericInInterface<SubClass>>(d);
|
||||
var y = Helpers.Cast<GenericInInterface<BaseClass>>(d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GenericInterface_WithInGenericParameter_SubClass()
|
||||
{
|
||||
dynamic d = new ExplicitlyImplementedGenericInInterface<SubClass>();
|
||||
Assert.Throws<RuntimeBinderException>(() => d.Foo());
|
||||
|
||||
Assert.Throws<InvalidCastException>(() => Helpers.Cast<GenericInInterface<BaseClass>>(d));
|
||||
|
||||
var y = Helpers.Cast<GenericInInterface<SubClass>>(d);
|
||||
Assert.Throws<InvalidCastException>(() => ((GenericInInterface<BaseClass>)d).Foo(new BaseClass()));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GenericInterface_WithOutGenericParameter_BaseClass()
|
||||
{
|
||||
dynamic d = new ExplicitlyImplementedGenericOutInterface<BaseClass>();
|
||||
Assert.Throws<RuntimeBinderException>(() => d.Foo());
|
||||
|
||||
Assert.Throws<InvalidCastException>(() => Helpers.Cast<GenericOutInterface<SubClass>>(d));
|
||||
|
||||
var y = Helpers.Cast<GenericOutInterface<BaseClass>>(d);
|
||||
|
||||
Assert.Throws<InvalidCastException>(() => ((GenericOutInterface<SubClass>)d).Foo());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GenericInterface_WithOutGenericParameter_SubClass()
|
||||
{
|
||||
dynamic d = new ExplicitlyImplementedGenericOutInterface<SubClass>();
|
||||
Assert.Throws<RuntimeBinderException>(() => d.Foo());
|
||||
|
||||
var x = Helpers.Cast<GenericOutInterface<SubClass>>(d);
|
||||
var y = Helpers.Cast<GenericOutInterface<BaseClass>>(d);
|
||||
}
|
||||
}
|
||||
|
||||
public interface InterfaceWithGenericMember
|
||||
{
|
||||
int Foo<T>();
|
||||
int Bar();
|
||||
}
|
||||
|
||||
public class ExplicitlyImplementedInterface1 : InterfaceWithGenericMember
|
||||
{
|
||||
int InterfaceWithGenericMember.Foo<T>() => 0;
|
||||
public int Bar() => 1;
|
||||
}
|
||||
|
||||
public class ExplicitlyImplementedInterface2 : InterfaceWithGenericMember
|
||||
{
|
||||
int InterfaceWithGenericMember.Foo<T>() => 0;
|
||||
public int Foo() => 2;
|
||||
public int Bar() => 1;
|
||||
}
|
||||
|
||||
public interface GenericInterfaceWithNonGenericMember<T>
|
||||
{
|
||||
int Foo();
|
||||
int Bar();
|
||||
}
|
||||
|
||||
public class ExplicitlyImplementedGenericInterface : GenericInterfaceWithNonGenericMember<int>
|
||||
{
|
||||
int GenericInterfaceWithNonGenericMember<int>.Foo() => 0;
|
||||
public int Foo() => 2;
|
||||
public int Bar() => 1;
|
||||
}
|
||||
|
||||
public interface GenericInterfaceWithGenericMember1<T>
|
||||
{
|
||||
int Foo(T t);
|
||||
int Bar();
|
||||
}
|
||||
|
||||
public class ExplicitlyImplementedGenericInterfaceWithGenericMember1 : GenericInterfaceWithGenericMember1<int>
|
||||
{
|
||||
int GenericInterfaceWithGenericMember1<int>.Foo(int i) => 0;
|
||||
public int Bar() => 1;
|
||||
}
|
||||
|
||||
public interface GenericInterfaceWithGenericMember2<T>
|
||||
{
|
||||
int Foo<U>();
|
||||
int Bar();
|
||||
}
|
||||
|
||||
public class ExplicitlyImplementedGenericInterfaceWithGenericMember2 : GenericInterfaceWithGenericMember2<int>
|
||||
{
|
||||
int GenericInterfaceWithGenericMember2<int>.Foo<U>() => 0;
|
||||
public int Bar() => 1;
|
||||
}
|
||||
|
||||
public class BaseClass { }
|
||||
public class SubClass : BaseClass { }
|
||||
|
||||
public interface GenericInInterface<in T>
|
||||
{
|
||||
int Foo(T t);
|
||||
}
|
||||
|
||||
public class ExplicitlyImplementedGenericInInterface<T> : GenericInInterface<T>
|
||||
{
|
||||
int GenericInInterface<T>.Foo(T t) => 0;
|
||||
}
|
||||
|
||||
public interface GenericOutInterface<out T>
|
||||
{
|
||||
T Foo();
|
||||
}
|
||||
|
||||
public class ExplicitlyImplementedGenericOutInterface<T> : GenericOutInterface<T> where T : new()
|
||||
{
|
||||
T GenericOutInterface<T>.Foo() => new T();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,222 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using Microsoft.CSharp.RuntimeBinder;
|
||||
using Xunit;
|
||||
|
||||
namespace Dynamic.Tests
|
||||
{
|
||||
public class ExplicitlyImplementedInheritedInterfaceTests
|
||||
{
|
||||
[Fact]
|
||||
public void SubInterface_BaseInterface()
|
||||
{
|
||||
dynamic d = new ExplicitlyImplementedBaseAndSubInterface();
|
||||
Assert.Throws<RuntimeBinderException>(() => d.Foo());
|
||||
|
||||
var x = Helpers.Cast<BaseInterfaceWithOneMember1>(d);
|
||||
var y = Helpers.Cast<SubInterfaceWithOneMember1>(d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SubInterfaceOnly()
|
||||
{
|
||||
dynamic d = new ExplicitlyImplementedSubInterface();
|
||||
Assert.Throws<RuntimeBinderException>(() => d.Foo());
|
||||
|
||||
var x = Helpers.Cast<BaseInterfaceWithOneMember1>(d);
|
||||
var y = Helpers.Cast<SubInterfaceWithOneMember1>(d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void BaseInterfaceOnly()
|
||||
{
|
||||
dynamic d = new ExplicitlyImplementedBaseInterfaceWithTwoMembers();
|
||||
Assert.Throws<RuntimeBinderException>(() => d.Foo());
|
||||
Assert.Throws<InvalidCastException>(() => Helpers.Cast<SubInterfaceWithNoMembers>(d));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SubInterface_WithNewMember()
|
||||
{
|
||||
dynamic d = new ExplicitlyImplementedSubInterfaceWithNewMember();
|
||||
Assert.Throws<RuntimeBinderException>(() => d.Foo());
|
||||
|
||||
Assert.Throws<InvalidCastException>(() => Helpers.Cast<SubInterfaceWithNoMembers>(d));
|
||||
Assert.Throws<InvalidCastException>(() => ((SubInterfaceWithNoMembers)d).Foo());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SubInterfaceWithNewMember_SubInterfaceWithNoMembers()
|
||||
{
|
||||
dynamic d = new ExplicitlyImplementedSubInterfaceWithNewMemberAndSubInterfaceWithNoMembers();
|
||||
Assert.Throws<RuntimeBinderException>(() => d.Foo());
|
||||
|
||||
var x = Helpers.Cast<SubInterfaceWithNoMembers>(d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void InterfaceWithTwoMembers_InSubClass()
|
||||
{
|
||||
dynamic d = new EmptyClass();
|
||||
Assert.Throws<RuntimeBinderException>(() => d.Foo());
|
||||
|
||||
Assert.Throws<InvalidCastException>(() => Helpers.Cast<BaseInterfaceWithTwoMembers>(d));
|
||||
Assert.Throws<InvalidCastException>(() => ((BaseInterfaceWithTwoMembers)d).Foo());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void InterfaceWithTwoMembers_InBaseClass()
|
||||
{
|
||||
dynamic d = new SubClassOfExplicitlyImplementedInterfaceWithTwoMembersAndEmptySubClass();
|
||||
Assert.Throws<RuntimeBinderException>(() => d.Foo());
|
||||
|
||||
var x = Helpers.Cast<BaseInterfaceWithTwoMembers>(d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void NonGenericInterface_Interface_WithTwoMembers_PartialClass()
|
||||
{
|
||||
dynamic d = new ExplicitlyImplementedInterfaceInPartialClass();
|
||||
Assert.Throws<RuntimeBinderException>(() => d.Foo());
|
||||
|
||||
var x = Helpers.Cast<BaseInterfaceWithTwoMembers>(d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PartialInterfaceWithTwoMembers()
|
||||
{
|
||||
dynamic d = new ExplicitlyImlementedPartialInterface();
|
||||
Assert.Throws<RuntimeBinderException>(() => d.Foo());
|
||||
|
||||
var x = Helpers.Cast<PartialInterfaceWithTwoMembers>(d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SubInterfaceWithOneMember_BaseClassWithOneVirtualMethod()
|
||||
{
|
||||
dynamic d = new ExplicitlyImplementedSubInterfaceWithOneMemberAndVirtualBaseClass();
|
||||
Assert.Equal(1, d.Foo());
|
||||
Assert.Equal(-1, ((SubInterfaceWithOneMember2)d).Foo());
|
||||
}
|
||||
}
|
||||
|
||||
public interface BaseInterfaceWithOneMember1
|
||||
{
|
||||
int Foo();
|
||||
}
|
||||
|
||||
public interface SubInterfaceWithOneMember1 : BaseInterfaceWithOneMember1
|
||||
{
|
||||
int Bar();
|
||||
}
|
||||
|
||||
public class ExplicitlyImplementedBaseAndSubInterface : BaseInterfaceWithOneMember1, SubInterfaceWithOneMember1
|
||||
{
|
||||
int BaseInterfaceWithOneMember1.Foo() => 0;
|
||||
public int Bar() => 1;
|
||||
}
|
||||
|
||||
public class ExplicitlyImplementedSubInterface : SubInterfaceWithOneMember1
|
||||
{
|
||||
int BaseInterfaceWithOneMember1.Foo() => 0;
|
||||
public int Bar() => 1;
|
||||
}
|
||||
|
||||
public interface BaseInterfaceWithTwoMembers
|
||||
{
|
||||
int Foo();
|
||||
int Bar();
|
||||
}
|
||||
|
||||
public interface SubInterfaceWithNoMembers : BaseInterfaceWithTwoMembers { }
|
||||
|
||||
public interface SubInterfaceWithNewMember : BaseInterfaceWithTwoMembers
|
||||
{
|
||||
new int Foo();
|
||||
}
|
||||
|
||||
public class ExplicitlyImplementedBaseInterfaceWithTwoMembers : BaseInterfaceWithTwoMembers
|
||||
{
|
||||
int BaseInterfaceWithTwoMembers.Foo() => 0;
|
||||
public int Bar() => 1;
|
||||
}
|
||||
|
||||
public class ExplicitlyImplementedSubInterfaceWithNewMember : SubInterfaceWithNewMember
|
||||
{
|
||||
int SubInterfaceWithNewMember.Foo() => 0;
|
||||
int BaseInterfaceWithTwoMembers.Foo() => 2;
|
||||
public int Bar() => 1;
|
||||
}
|
||||
|
||||
public class ExplicitlyImplementedSubInterfaceWithNewMemberAndSubInterfaceWithNoMembers : SubInterfaceWithNewMember, SubInterfaceWithNoMembers
|
||||
{
|
||||
int SubInterfaceWithNewMember.Foo() => 0;
|
||||
int BaseInterfaceWithTwoMembers.Foo() => 2;
|
||||
public int Bar() => 1;
|
||||
}
|
||||
|
||||
public class EmptyClass { }
|
||||
|
||||
public class ExplicitlyImplementedInterfaceWithTwoMembersAndEmptyBaseClass : EmptyClass, BaseInterfaceWithTwoMembers
|
||||
{
|
||||
int BaseInterfaceWithTwoMembers.Foo() => 0;
|
||||
public int Bar() => 1;
|
||||
}
|
||||
|
||||
public class ExplicitlyImplementedInterfaceWithTwoMembersAndEmptySubClass : BaseInterfaceWithTwoMembers
|
||||
{
|
||||
int BaseInterfaceWithTwoMembers.Foo() => 0;
|
||||
public int Bar() => 1;
|
||||
}
|
||||
|
||||
public class SubClassOfExplicitlyImplementedInterfaceWithTwoMembersAndEmptySubClass : ExplicitlyImplementedInterfaceWithTwoMembersAndEmptySubClass { }
|
||||
|
||||
public partial class ExplicitlyImplementedInterfaceInPartialClass { }
|
||||
|
||||
public partial class ExplicitlyImplementedInterfaceInPartialClass : BaseInterfaceWithTwoMembers
|
||||
{
|
||||
int BaseInterfaceWithTwoMembers.Foo() => 0;
|
||||
public int Bar() => 1;
|
||||
}
|
||||
|
||||
public partial interface PartialInterfaceWithTwoMembers
|
||||
{
|
||||
int Foo();
|
||||
}
|
||||
|
||||
public partial interface PartialInterfaceWithTwoMembers
|
||||
{
|
||||
int Bar();
|
||||
}
|
||||
|
||||
public class ExplicitlyImlementedPartialInterface : PartialInterfaceWithTwoMembers
|
||||
{
|
||||
int PartialInterfaceWithTwoMembers.Foo() => 0;
|
||||
public int Bar() => 1;
|
||||
}
|
||||
|
||||
public class BaseClassWithVirtualMethod
|
||||
{
|
||||
public virtual int Foo() => -1;
|
||||
}
|
||||
|
||||
public interface BaseInterfaceWithOneMember2
|
||||
{
|
||||
int Bar();
|
||||
}
|
||||
|
||||
public interface SubInterfaceWithOneMember2 : BaseInterfaceWithOneMember2
|
||||
{
|
||||
int Foo();
|
||||
}
|
||||
|
||||
public class ExplicitlyImplementedSubInterfaceWithOneMemberAndVirtualBaseClass : BaseClassWithVirtualMethod, SubInterfaceWithOneMember2
|
||||
{
|
||||
int SubInterfaceWithOneMember2.Foo() => -1;
|
||||
public override int Foo() => 1;
|
||||
public int Bar() => 1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,227 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using Microsoft.CSharp.RuntimeBinder;
|
||||
using Xunit;
|
||||
|
||||
namespace Dynamic.Tests
|
||||
{
|
||||
public class ExplicitlyImplementedBasicTests
|
||||
{
|
||||
[Fact]
|
||||
public void NonGenericInterface_OneInterface_Class()
|
||||
{
|
||||
dynamic d = new OneExplicitlyImplementedNonGenericInterface1();
|
||||
Assert.Throws<RuntimeBinderException>(() => d.Foo());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void NonGenericInterface_OneInterface_Struct()
|
||||
{
|
||||
dynamic d = new OneExplicitlyImplementedNonGenericInterface2();
|
||||
Assert.Equal(2, d.Foo());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void NonGenericInterface_TwoInterfaces_Class1()
|
||||
{
|
||||
dynamic d = new TwoExplicitlyImplementedNonGenericInterface1();
|
||||
Assert.Throws<RuntimeBinderException>(() => d.Foo());
|
||||
|
||||
var x = Helpers.Cast<NonGenericInterface2>(d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void NonGenericInterface_TwoInterfaces_Class2()
|
||||
{
|
||||
dynamic d = new TwoExplicitlyImplementedNonGenericInterface2();
|
||||
Assert.Throws<RuntimeBinderException>(() => d.Foo());
|
||||
|
||||
var x = Helpers.Cast<NonGenericInterface3>(d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void NonGenericInterface_OneInterfaceClass2()
|
||||
{
|
||||
dynamic d = new OneExplicitlyImplementedNonGenericInterface3();
|
||||
Assert.Equal(2, d.Foo());
|
||||
|
||||
Assert.Throws<InvalidCastException>(() => Helpers.Cast<NonGenericInterface3>(d));
|
||||
Assert.Throws<InvalidCastException>(() => ((NonGenericInterface3)d).Foo());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void NonGenericInterface_WithGetter()
|
||||
{
|
||||
dynamic d = new ExplicitlyImplementedInterfaceWithGetter();
|
||||
Assert.Throws<RuntimeBinderException>(() => d.Property);
|
||||
|
||||
var x = Helpers.Cast<InterfaceWithGetter>(d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void NonGenericInterface_WithSetter()
|
||||
{
|
||||
dynamic d = new ExplicitlyImplementedInterfaceWithSetter();
|
||||
Assert.Throws<RuntimeBinderException>(() => d.Prop = 1);
|
||||
|
||||
var x = Helpers.Cast<InterfaceWithSetter>(d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void NonGenericInterface_WithGetterAndSetter()
|
||||
{
|
||||
dynamic d = new ExplicitlyImplementedInterfaceWithGetterAndSetter();
|
||||
Assert.Throws<RuntimeBinderException>(() => d.Property);
|
||||
Assert.Throws<RuntimeBinderException>(() => d.Property = 1);
|
||||
|
||||
var x = Helpers.Cast<InterfaceWithGetterAndSetter>(d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void NonGenericInterface_WithEvent()
|
||||
{
|
||||
dynamic d = new ExplicitlyImplementedInterfaceWithEvent();
|
||||
Assert.Throws<RuntimeBinderException>(() => d.Event += (Func<int, int>)(y => y));
|
||||
Assert.Throws<RuntimeBinderException>(() => d.Event -= (Func<int, int>)(y => y));
|
||||
var x = Helpers.Cast<InterfaceWithEvent>(d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void NonGenericInterface_WithIndexer()
|
||||
{
|
||||
dynamic d = new ExplicitlyImplementedInterfaceWithIndexer();
|
||||
Assert.Throws<RuntimeBinderException>(() => d[0]);
|
||||
Assert.Throws<RuntimeBinderException>(() => d[0] = 1);
|
||||
|
||||
var x = Helpers.Cast<InterfaceWithIndexer>(d);
|
||||
}
|
||||
}
|
||||
|
||||
public interface NonGenericInterface1
|
||||
{
|
||||
int Foo();
|
||||
int Bar();
|
||||
}
|
||||
|
||||
public interface NonGenericInterface2
|
||||
{
|
||||
int Bar();
|
||||
}
|
||||
|
||||
public interface NonGenericInterface3
|
||||
{
|
||||
int Foo();
|
||||
}
|
||||
|
||||
public class OneExplicitlyImplementedNonGenericInterface1 : NonGenericInterface1
|
||||
{
|
||||
int NonGenericInterface1.Foo() => 0;
|
||||
public int Bar() => 1;
|
||||
}
|
||||
|
||||
public struct OneExplicitlyImplementedNonGenericInterface2 : NonGenericInterface1
|
||||
{
|
||||
int NonGenericInterface1.Foo() => 0;
|
||||
public int Foo() => 2;
|
||||
public int Bar() => 1;
|
||||
}
|
||||
|
||||
public class OneExplicitlyImplementedNonGenericInterface3 : NonGenericInterface1
|
||||
{
|
||||
int NonGenericInterface1.Foo() => 0;
|
||||
public int Foo() => 2;
|
||||
public int Bar() => 1;
|
||||
}
|
||||
|
||||
public class TwoExplicitlyImplementedNonGenericInterface1 : NonGenericInterface1, NonGenericInterface2
|
||||
{
|
||||
int NonGenericInterface1.Foo() => 0;
|
||||
public int Bar() => 1;
|
||||
}
|
||||
|
||||
public class TwoExplicitlyImplementedNonGenericInterface2 : NonGenericInterface1, NonGenericInterface3
|
||||
{
|
||||
int NonGenericInterface1.Foo() => 0;
|
||||
int NonGenericInterface3.Foo() => 2;
|
||||
public int Bar() => 1;
|
||||
}
|
||||
|
||||
public interface InterfaceWithSetter
|
||||
{
|
||||
int Property { set; }
|
||||
}
|
||||
|
||||
public class ExplicitlyImplementedInterfaceWithSetter : InterfaceWithSetter
|
||||
{
|
||||
public static bool s_setterCalled;
|
||||
int InterfaceWithSetter.Property
|
||||
{
|
||||
set { s_setterCalled = true; }
|
||||
}
|
||||
}
|
||||
|
||||
public interface InterfaceWithGetter
|
||||
{
|
||||
int Property { get; }
|
||||
}
|
||||
|
||||
public class ExplicitlyImplementedInterfaceWithGetter : InterfaceWithGetter
|
||||
{
|
||||
public static bool s_getterCalled;
|
||||
int InterfaceWithGetter.Property
|
||||
{
|
||||
get { s_getterCalled = true; return 2; }
|
||||
}
|
||||
}
|
||||
|
||||
public interface InterfaceWithGetterAndSetter
|
||||
{
|
||||
int Property { get; set; }
|
||||
}
|
||||
|
||||
public class ExplicitlyImplementedInterfaceWithGetterAndSetter : InterfaceWithGetterAndSetter
|
||||
{
|
||||
public static bool s_getterCalled;
|
||||
public static bool s_setterCalled;
|
||||
int InterfaceWithGetterAndSetter.Property
|
||||
{
|
||||
get { s_getterCalled = true; return 1; }
|
||||
set { s_setterCalled = true; }
|
||||
}
|
||||
}
|
||||
|
||||
public interface InterfaceWithEvent
|
||||
{
|
||||
event Func<int, int> Event;
|
||||
}
|
||||
|
||||
public class ExplicitlyImplementedInterfaceWithEvent : InterfaceWithEvent
|
||||
{
|
||||
public static bool s_addCalled;
|
||||
public static bool s_removeCalled;
|
||||
event Func<int, int> InterfaceWithEvent.Event
|
||||
{
|
||||
add { s_addCalled = true; }
|
||||
remove { s_addCalled = true; }
|
||||
}
|
||||
}
|
||||
|
||||
public interface InterfaceWithIndexer
|
||||
{
|
||||
long this[byte index] { get; set; }
|
||||
}
|
||||
|
||||
public class ExplicitlyImplementedInterfaceWithIndexer : InterfaceWithIndexer
|
||||
{
|
||||
public static bool s_getCalled;
|
||||
public static bool s_setCalled;
|
||||
long InterfaceWithIndexer.this[byte index]
|
||||
{
|
||||
get { s_getCalled = true; return 1; }
|
||||
set { s_setCalled = true; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
namespace ManagedTests.DynamicCSharp.Conformance.dynamic.context.attribute.publickeydecl001.publickeydecl001
|
||||
{
|
||||
using ManagedTests.DynamicCSharp.Conformance.dynamic.context.attribute.publickeydecl001.publickeydecl001;
|
||||
// <Title>
|
||||
// Using PublicKey attribute as part of the InternalsVisibleTo attribute
|
||||
// </Title>
|
||||
// <Description>
|
||||
// Using PublicKey attribute as part of the InternalsVisibleTo attribute
|
||||
// </Description>
|
||||
// <RelatedBugs></RelatedBugs>
|
||||
// <Expects Status=success></Expects>
|
||||
// <Code>
|
||||
using System;
|
||||
|
||||
//[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("publickey001,PublicKey=002400000480000094000000060200000024000052534131000400000100010027be9b82deaeb8b98e5f455cbbde386f80f5c19516548cac1f2ffeea96f1712f51540946f2a8133c03d349cf0611788215da54989dcc88ee262c385d2c17343cf5cb969c436fb94fe399cc46f74bf0af2eb1f46aed1fb0adee16721c40ae02baf3d3d8b50a2dd6466829465db165a0f2915f74e1b67a63b4cf76c215cdba4ba6")]
|
||||
public class A
|
||||
{
|
||||
public string returnme()
|
||||
{
|
||||
return "hello world";
|
||||
}
|
||||
|
||||
int unit = 0;
|
||||
public int Unit
|
||||
{
|
||||
get
|
||||
{
|
||||
return unit;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
unit = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
// </Code>
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user