summaryrefslogtreecommitdiff
path: root/tests/src/Loader/classloader/generics/Constraints/ConstraintsOnType/Negative/Interface_DefaultCtorAndStructConstraint_Neg.il
diff options
context:
space:
mode:
authorFadi Hanna <fadim@microsoft.com>2016-04-13 10:40:38 -0700
committerFadi Hanna <fadim@microsoft.com>2016-04-13 10:40:38 -0700
commit517207b9d3f2a53c726a8682c1331cf7bdb0360b (patch)
tree0820a51d24dfc90797c64de3097653a213ed47ba /tests/src/Loader/classloader/generics/Constraints/ConstraintsOnType/Negative/Interface_DefaultCtorAndStructConstraint_Neg.il
parent8beda3c1561aa7a4b4a18ea98e719fc9fd52a638 (diff)
parentb7e35b9c3d87ba84b859f9f9f795857dfbbda653 (diff)
downloadcoreclr-517207b9d3f2a53c726a8682c1331cf7bdb0360b.tar.gz
coreclr-517207b9d3f2a53c726a8682c1331cf7bdb0360b.tar.bz2
coreclr-517207b9d3f2a53c726a8682c1331cf7bdb0360b.zip
Merge pull request #4295 from fadimounir/typesystemtests
Bulk port of TypeSystem test cases
Diffstat (limited to 'tests/src/Loader/classloader/generics/Constraints/ConstraintsOnType/Negative/Interface_DefaultCtorAndStructConstraint_Neg.il')
-rw-r--r--tests/src/Loader/classloader/generics/Constraints/ConstraintsOnType/Negative/Interface_DefaultCtorAndStructConstraint_Neg.il190
1 files changed, 190 insertions, 0 deletions
diff --git a/tests/src/Loader/classloader/generics/Constraints/ConstraintsOnType/Negative/Interface_DefaultCtorAndStructConstraint_Neg.il b/tests/src/Loader/classloader/generics/Constraints/ConstraintsOnType/Negative/Interface_DefaultCtorAndStructConstraint_Neg.il
new file mode 100644
index 0000000000..ea076ff329
--- /dev/null
+++ b/tests/src/Loader/classloader/generics/Constraints/ConstraintsOnType/Negative/Interface_DefaultCtorAndStructConstraint_Neg.il
@@ -0,0 +1,190 @@
+// 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 System.Console { }
+
+.assembly extern mscorlib{}
+.assembly extern types_implementI{}
+
+.assembly Interface_DefaultCtorAndStructConstraint_Neg {}
+
+
+// Generic class with new() constraint
+.class public auto ansi beforefieldinit E`1<valuetype .ctor ([types_implementI]I) T>
+ extends [mscorlib]System.Object
+{
+
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ .maxstack 8
+ ldarg.0
+ call instance void [mscorlib]System.Object::.ctor()
+ ret
+ }
+
+}
+
+.class public auto ansi beforefieldinit Interface_DefaultCtorAndStructConstraint
+ extends [mscorlib]System.Object
+{
+
+
+ // NEGATIVE TEST
+ // generic argument is a class with default ctor
+ .method public hidebysig static void Test1() cil managed
+ {
+ .maxstack 1
+
+ newobj instance void class E`1<class [types_implementI]ClassWithCtor>::.ctor()
+ pop
+
+ ret
+ }
+
+
+ // NEGATIVE TEST
+ // generic argument is a class with no default ctor
+ .method public hidebysig static void Test2() cil managed
+ {
+ .maxstack 1
+
+ newobj instance void class E`1<class [types_implementI]ClassNoCtor>::.ctor()
+ pop
+
+
+ ret
+ }
+
+ // NEGATIVE TEST
+ // generic argument is an mscorlib class with default ctor
+ .method public hidebysig static void Test3() cil managed
+ {
+ .maxstack 1
+
+ newobj instance void class E`1<class [mscorlib]System.Object>::.ctor()
+ pop
+
+ ret
+ }
+
+ // NEGATIVE TEST
+ // generic argument is a delegate (doesn't have public parameterless constructor)
+ .method public hidebysig static void Test4() cil managed
+ {
+ .maxstack 1
+
+ newobj instance void class E`1<class [types_implementI]Delegate1>::.ctor()
+ pop
+
+ ret
+ }
+
+
+ // NEGATIVE TEST
+ // generic argument is an enum (has default ctor since it's a valuetype)
+ .method public hidebysig static void Test5() cil managed
+ {
+ .maxstack 1
+
+ newobj instance void class E`1<valuetype [types_implementI]Enum1>::.ctor()
+ pop
+
+ ret
+ }
+
+ // NEGATIVE TEST
+ // generic argument is an mscorlib abstract class with no default ctor
+
+ .method public hidebysig static void Test6() cil managed
+ {
+ .maxstack 1
+
+ newobj instance void class E`1<class [mscorlib]System.ValueType>::.ctor()
+ pop
+ ret
+ }
+
+
+ // NEGATIVE TEST
+ // generic argument is an interface with no default ctor
+ .method public hidebysig static void Test7() cil managed
+ {
+ .maxstack 1
+
+ newobj instance void class E`1<class [types_implementI]NonGenInterface>::.ctor()
+ pop
+
+ ret
+ }
+
+
+ // NEGATIVE TEST
+ // generic argument is an array of classes with default ctor
+ .method public hidebysig static void Test8() cil managed
+ {
+ .maxstack 1
+
+ newobj instance void class E`1<class [types_implementI]ClassWithCtor[]>::.ctor()
+ pop
+
+ ret
+ }
+
+ // NEGATIVE TEST
+ // generic argument is a class with no default ctor
+ .method public hidebysig static void Test9() cil managed
+ {
+ .maxstack 1
+
+ newobj instance void class E`1<class [types_implementI]GenClassNoCtor<int32>>::.ctor()
+ pop
+
+ ret
+ }
+
+
+ // NEGATIVE TEST
+ // generic argument is an interface
+ .method public hidebysig static void Test10() cil managed
+ {
+ .maxstack 1
+
+ newobj instance void class E`1<class [types_implementI]GenInterface<int32>>::.ctor()
+ pop
+
+ ret
+ }
+
+
+ // NEGATIVE TEST
+ // generic argument is NUllable<T>
+ .method public hidebysig static void Test11() cil managed
+ {
+ .maxstack 1
+
+ newobj instance void class E`1<valuetype [mscorlib]System.'Nullable`1'<int32>>::.ctor()
+ pop
+
+ ret
+ }
+
+
+ // NEGATIVE TEST
+ // generic argument is a class with default ctor
+ .method public hidebysig static void Test12() cil managed
+ {
+ .maxstack 1
+
+ newobj instance void class E`1<class [types_implementI]GenClassWithCtor<int32>>::.ctor()
+ pop
+
+ ret
+ }
+
+}
+
+
+
+