Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Arzt <arzt.samuel@live.de>2017-09-20 14:04:50 +0300
committerJan Kotas <jkotas@microsoft.com>2017-09-20 14:04:50 +0300
commitbceb1952e884253ec88a7ec518116edf1cef9e0b (patch)
treed88709534bb09fa29b11dea624347aecd6d5de81 /src/ILCompiler.TypeSystem
parent2d1cd5a05350f16e3910a6c72642327f800d42bf (diff)
[ILVerify] Implement Ldftn/Ldvirtftn instruction (#4497)
* Added VerifierError for ldftn/ldvirtftn of constructor. * Implemented basic ldftn and basic delegate creation functionality. * Added TestName attribute to TestCases to further shorten display name of tests. * Implemented basic ldftn functionality and constraint checks. Moved type conversions to helper class. * Added test cases for ldftn and newobj of constrained generic types. * Added test cases for ldvirtftn. Fixed display of invalid test errors. * Changed constraints checks to use ConstraintsHelper class. Added additional test cases for GenericParam as generic parameter with special constraints. * Added additional constraints check for generic parameters with special constraints. * Fixed typo in filename of TypeSystemConstraintsHelpers. * Fixed typo in 'ILDisassember'. * Slight code refactoring. Added reference to test case assert issue.
Diffstat (limited to 'src/ILCompiler.TypeSystem')
-rw-r--r--src/ILCompiler.TypeSystem/src/ILCompiler.TypeSystem.csproj8
-rw-r--r--src/ILCompiler.TypeSystem/tests/ConstraintsValidationTest.cs33
-rw-r--r--src/ILCompiler.TypeSystem/tests/ILDisassemblerTests.cs2
3 files changed, 38 insertions, 5 deletions
diff --git a/src/ILCompiler.TypeSystem/src/ILCompiler.TypeSystem.csproj b/src/ILCompiler.TypeSystem/src/ILCompiler.TypeSystem.csproj
index d68cff2c9..205778ede 100644
--- a/src/ILCompiler.TypeSystem/src/ILCompiler.TypeSystem.csproj
+++ b/src/ILCompiler.TypeSystem/src/ILCompiler.TypeSystem.csproj
@@ -223,8 +223,8 @@
<Compile Include="..\..\Common\src\TypeSystem\Common\TypeSystemHelpers.cs">
<Link>TypeSystem\Common\TypeSystemHelpers.cs</Link>
</Compile>
- <Compile Include="..\..\Common\src\TypeSystem\Common\TypeSystemConstaintsHelpers.cs">
- <Link>TypeSystem\Common\TypeSystemConstaintsHelpers.cs</Link>
+ <Compile Include="..\..\Common\src\TypeSystem\Common\TypeSystemConstraintsHelpers.cs">
+ <Link>TypeSystem\Common\TypeSystemConstraintsHelpers.cs</Link>
</Compile>
<Compile Include="..\..\Common\src\TypeSystem\Common\UniversalCanonLayoutAlgorithm.cs">
<Link>TypeSystem\Common\UniversalCanonLayoutAlgorithm.cs</Link>
@@ -385,8 +385,8 @@
<Compile Include="..\..\Common\src\TypeSystem\IL\MethodILDebugView.cs">
<Link>IL\MethodILDebugView.cs</Link>
</Compile>
- <Compile Include="..\..\Common\src\TypeSystem\IL\ILDisassember.cs">
- <Link>IL\ILDisassember.cs</Link>
+ <Compile Include="..\..\Common\src\TypeSystem\IL\ILDisassembler.cs">
+ <Link>IL\ILDisassembler.cs</Link>
</Compile>
<Compile Include="..\..\Common\src\TypeSystem\IL\InstantiatedMethodIL.cs">
<Link>IL\InstantiatedMethodIL.cs</Link>
diff --git a/src/ILCompiler.TypeSystem/tests/ConstraintsValidationTest.cs b/src/ILCompiler.TypeSystem/tests/ConstraintsValidationTest.cs
index 95bc0b5e7..e5417df4a 100644
--- a/src/ILCompiler.TypeSystem/tests/ConstraintsValidationTest.cs
+++ b/src/ILCompiler.TypeSystem/tests/ConstraintsValidationTest.cs
@@ -134,6 +134,39 @@ namespace TypeSystemTests
Assert.False(instantiatedType.CheckConstraints());
}
+ // Special constraints instantiated with generic parameter
+ {
+ instantiatedType = _referenceTypeConstraintType.MakeInstantiatedType(_referenceTypeConstraintType.Instantiation[0]);
+ Assert.True(instantiatedType.CheckConstraints());
+
+ instantiatedType = _defaultConstructorConstraintType.MakeInstantiatedType(_defaultConstructorConstraintType.Instantiation[0]);
+ Assert.True(instantiatedType.CheckConstraints());
+
+ instantiatedType = _notNullableValueTypeConstraintType.MakeInstantiatedType(_notNullableValueTypeConstraintType.Instantiation[0]);
+ Assert.True(instantiatedType.CheckConstraints());
+
+ instantiatedType = _defaultConstructorConstraintType.MakeInstantiatedType(_notNullableValueTypeConstraintType.Instantiation[0]);
+ Assert.True(instantiatedType.CheckConstraints());
+
+ instantiatedType = _referenceTypeConstraintType.MakeInstantiatedType(_arg2Type.Instantiation[0]);
+ Assert.False(instantiatedType.CheckConstraints());
+
+ instantiatedType = _defaultConstructorConstraintType.MakeInstantiatedType(_arg2Type.Instantiation[0]);
+ Assert.False(instantiatedType.CheckConstraints());
+
+ instantiatedType = _notNullableValueTypeConstraintType.MakeInstantiatedType(_arg2Type.Instantiation[0]);
+ Assert.False(instantiatedType.CheckConstraints());
+
+ instantiatedType = _referenceTypeConstraintType.MakeInstantiatedType(_simpleTypeConstraintType.Instantiation[0]);
+ Assert.True(instantiatedType.CheckConstraints());
+
+ instantiatedType = _defaultConstructorConstraintType.MakeInstantiatedType(_simpleTypeConstraintType.Instantiation[0]);
+ Assert.False(instantiatedType.CheckConstraints());
+
+ instantiatedType = _notNullableValueTypeConstraintType.MakeInstantiatedType(_simpleTypeConstraintType.Instantiation[0]);
+ Assert.False(instantiatedType.CheckConstraints());
+ }
+
// SimpleTypeConstraint and DoubleSimpleTypeConstraint
foreach(var genType in new MetadataType[] { _simpleTypeConstraintType , _doubleSimpleTypeConstraintType })
{
diff --git a/src/ILCompiler.TypeSystem/tests/ILDisassemblerTests.cs b/src/ILCompiler.TypeSystem/tests/ILDisassemblerTests.cs
index f763fe813..fc55923ae 100644
--- a/src/ILCompiler.TypeSystem/tests/ILDisassemblerTests.cs
+++ b/src/ILCompiler.TypeSystem/tests/ILDisassemblerTests.cs
@@ -54,7 +54,7 @@ namespace TypeSystemTests
{ 50, "IL_0084: initobj ILDisassembler.TestStruct" }
};
- ILDisassember disasm = new ILDisassember(methodIL);
+ ILDisassembler disasm = new ILDisassembler(methodIL);
int numLines = 1;
while (disasm.HasNextInstruction)