summaryrefslogtreecommitdiff
path: root/tests/src/Regressions
diff options
context:
space:
mode:
authorMichal Strehovský <MichalStrehovsky@users.noreply.github.com>2018-02-13 05:08:29 +0100
committerJan Kotas <jkotas@microsoft.com>2018-02-12 20:08:29 -0800
commitb83e8005cb6a343ee09c061d4f4bf1f9588c4687 (patch)
tree089181cb65bf83a8261872d68453b54c92ea3e23 /tests/src/Regressions
parente00d57abac979291de6f68d449a9e7ea726e2e1f (diff)
downloadcoreclr-b83e8005cb6a343ee09c061d4f4bf1f9588c4687.tar.gz
coreclr-b83e8005cb6a343ee09c061d4f4bf1f9588c4687.tar.bz2
coreclr-b83e8005cb6a343ee09c061d4f4bf1f9588c4687.zip
Define type initialization semantics for interface instance methods (#16340)
* Define type initialization semantics for interface instance methods Accessing an instance method on an interface should trigger non-beforefieldinit class constructors (same as it does for valuetypes). Fixes #15650.
Diffstat (limited to 'tests/src/Regressions')
-rw-r--r--tests/src/Regressions/coreclr/15650/interfacecctor.il52
-rw-r--r--tests/src/Regressions/coreclr/15650/interfacecctor.ilproj35
2 files changed, 87 insertions, 0 deletions
diff --git a/tests/src/Regressions/coreclr/15650/interfacecctor.il b/tests/src/Regressions/coreclr/15650/interfacecctor.il
new file mode 100644
index 0000000000..8568240df2
--- /dev/null
+++ b/tests/src/Regressions/coreclr/15650/interfacecctor.il
@@ -0,0 +1,52 @@
+// 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.
+
+.assembly extern mscorlib { }
+.assembly interfacecctor { }
+
+.class interface private abstract auto ansi IFoo
+{
+ .method private hidebysig specialname rtspecialname static
+ void .cctor() cil managed
+ {
+ .maxstack 8
+ ldc.i4.s 100
+ stsfld int32 s_result
+ ret
+ }
+
+ .method public hidebysig newslot virtual
+ instance void Frob() cil managed
+ {
+ .maxstack 8
+ ret
+ }
+}
+
+.class private auto ansi beforefieldinit Fooer
+ extends [mscorlib]System.Object
+ implements IFoo
+{
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ .maxstack 8
+ ldarg.0
+ call instance void [mscorlib]System.Object::.ctor()
+ ret
+ }
+}
+
+.field public static int32 s_result
+
+.method private hidebysig static int32
+ Main() cil managed
+{
+ .entrypoint
+ .maxstack 8
+ newobj instance void Fooer::.ctor()
+ callvirt instance void IFoo::Frob()
+ ldsfld int32 s_result
+ ret
+} \ No newline at end of file
diff --git a/tests/src/Regressions/coreclr/15650/interfacecctor.ilproj b/tests/src/Regressions/coreclr/15650/interfacecctor.ilproj
new file mode 100644
index 0000000000..4b6d609eb3
--- /dev/null
+++ b/tests/src/Regressions/coreclr/15650/interfacecctor.ilproj
@@ -0,0 +1,35 @@
+<?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>
+ <AssemblyName>interfacecctor</AssemblyName>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{85DFC527-4DB1-595E-A7D7-E94EE1F8140D}</ProjectGuid>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <ReferenceLocalMscorlib>true</ReferenceLocalMscorlib>
+ <OutputType>Exe</OutputType>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>0</CLRTestPriority>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+
+ <ItemGroup>
+ <Compile Include="interfacecctor.il" />
+ </ItemGroup>
+
+
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>