1 // Licensed to the .NET Foundation under one or more agreements.
2 // The .NET Foundation licenses this file to you under the MIT license.
3 // See the LICENSE file in the project root for more information.
4 
5 using Xunit;
6 
7 namespace ManagedTests.DynamicCSharp.Conformance.dynamic.dynamicType.generics.nested.nested001.nested001
8 {
9     // <Title>Generic constraints for nested types</Title>
10     // <Description>
11     // </Description>
12     // <RelatedBugs></RelatedBugs>
13     //<Expects Status=success></Expects>
14     // <Code>
15 
16     public class Base<T>
17     {
18         public class Derived<U>
19             where U : T
20         {
Foo()21             public void Foo()
22             {
23                 Test.Status = 1;
24             }
25         }
26     }
27 
28     public class Test
29     {
30         public static int Status;
31         [Fact]
DynamicCSharpRunTest()32         public static void DynamicCSharpRunTest()
33         {
34             Assert.Equal(0, MainMethod(null));
35         }
36 
MainMethod(string[] args)37         public static int MainMethod(string[] args)
38         {
39             Base<dynamic>.Derived<dynamic> d = new Base<dynamic>.Derived<dynamic>();
40             d.Foo();
41             if (Test.Status != 1)
42                 return 1;
43             return 0;
44         }
45     }
46     // </Code>
47 }
48 
49 
50 
51 namespace ManagedTests.DynamicCSharp.Conformance.dynamic.dynamicType.generics.nested.nested002.nested002
52 {
53     // <Title>Generic constraints for nested types</Title>
54     // <Description>
55     // </Description>
56     // <RelatedBugs></RelatedBugs>
57     //<Expects Status=success></Expects>
58     // <Code>
59 
60     public class Base<T>
61     {
62         public class Derived<U>
63             where U : T
64         {
Foo()65             public void Foo()
66             {
67                 Test.Status = 1;
68             }
69         }
70     }
71 
72     public class Test
73     {
74         public static int Status;
75         [Fact]
DynamicCSharpRunTest()76         public static void DynamicCSharpRunTest()
77         {
78             Assert.Equal(0, MainMethod(null));
79         }
80 
MainMethod(string[] args)81         public static int MainMethod(string[] args)
82         {
83             Base<object>.Derived<dynamic> d = new Base<object>.Derived<dynamic>();
84             d.Foo();
85             if (Test.Status != 1)
86                 return 1;
87             return 0;
88         }
89     }
90     // </Code>
91 }
92 
93 
94 
95 namespace ManagedTests.DynamicCSharp.Conformance.dynamic.dynamicType.generics.nested.nested003.nested003
96 {
97     // <Title>Generic constraints for nested types</Title>
98     // <Description>
99     // </Description>
100     // <RelatedBugs></RelatedBugs>
101     //<Expects Status=success></Expects>
102     // <Code>
103 
104     public class Base<T>
105     {
106         public class Derived<U>
107             where U : T
108         {
Foo()109             public void Foo()
110             {
111                 Test.Status = 1;
112             }
113         }
114     }
115 
116     public class Test
117     {
118         public static int Status;
119         [Fact]
DynamicCSharpRunTest()120         public static void DynamicCSharpRunTest()
121         {
122             Assert.Equal(0, MainMethod(null));
123         }
124 
MainMethod(string[] args)125         public static int MainMethod(string[] args)
126         {
127             Base<dynamic>.Derived<dynamic> d = new Base<object>.Derived<dynamic>();
128             d.Foo();
129             if (Test.Status != 1)
130                 return 1;
131             return 0;
132         }
133     }
134     // </Code>
135 }
136 
137 
138 
139 namespace ManagedTests.DynamicCSharp.Conformance.dynamic.dynamicType.generics.nested.nested004.nested004
140 {
141     // <Title>Generic constraints for nested types</Title>
142     // <Description>
143     // </Description>
144     // <RelatedBugs></RelatedBugs>
145     //<Expects Status=success></Expects>
146     // <Code>
147 
148     public class Base<T>
149     {
150         public class Derived<U>
151             where U : T
152         {
Foo()153             public void Foo()
154             {
155                 Test.Status = 1;
156             }
157         }
158     }
159 
160     public class Test
161     {
162         public static int Status;
163         [Fact]
DynamicCSharpRunTest()164         public static void DynamicCSharpRunTest()
165         {
166             Assert.Equal(0, MainMethod(null));
167         }
168 
MainMethod(string[] args)169         public static int MainMethod(string[] args)
170         {
171             Base<object>.Derived<object> d = new Base<dynamic>.Derived<dynamic>();
172             d.Foo();
173             if (Test.Status != 1)
174                 return 1;
175             return 0;
176         }
177     }
178     // </Code>
179 }
180 
181 
182 
183 namespace ManagedTests.DynamicCSharp.Conformance.dynamic.dynamicType.generics.nested.nested005.nested005
184 {
185     // <Title>Generic constraints for nested types</Title>
186     // <Description>
187     // </Description>
188     // <RelatedBugs></RelatedBugs>
189     //<Expects Status=success></Expects>
190     // <Code>
191 
192     public class Base<T>
193     {
194         public class Derived<U>
195             where U : T
196         {
Foo()197             public void Foo()
198             {
199                 Test.Status = 1;
200             }
201         }
202     }
203 
204     public class Test
205     {
206         public static int Status;
207         [Fact]
DynamicCSharpRunTest()208         public static void DynamicCSharpRunTest()
209         {
210             Assert.Equal(0, MainMethod(null));
211         }
212 
MainMethod(string[] args)213         public static int MainMethod(string[] args)
214         {
215             Base<object>.Derived<dynamic> d = new Base<object>.Derived<object>();
216             d.Foo();
217             if (Test.Status != 1)
218                 return 1;
219             return 0;
220         }
221     }
222     // </Code>
223 }
224 
225 
226 
227 namespace ManagedTests.DynamicCSharp.Conformance.dynamic.dynamicType.generics.nested.nested006.nested006
228 {
229     // <Title>Generic constraints for nested types</Title>
230     // <Description>
231     // </Description>
232     // <RelatedBugs></RelatedBugs>
233     //<Expects Status=success></Expects>
234     // <Code>
235 
236     public class Base<T>
237     {
238         public class Derived<U>
239             where U : T
240         {
Foo()241             public void Foo()
242             {
243                 Test.Status = 1;
244             }
245         }
246     }
247 
248     public class Test
249     {
250         public static int Status;
251         [Fact]
DynamicCSharpRunTest()252         public static void DynamicCSharpRunTest()
253         {
254             Assert.Equal(0, MainMethod(null));
255         }
256 
MainMethod(string[] args)257         public static int MainMethod(string[] args)
258         {
259             Base<object>.Derived<dynamic> d = new Base<object>.Derived<object>();
260             d.Foo();
261             if (Test.Status != 1)
262                 return 1;
263             return 0;
264         }
265     }
266     // </Code>
267 }
268 
269 
270 
271 namespace ManagedTests.DynamicCSharp.Conformance.dynamic.dynamicType.generics.nested.nested007.nested007
272 {
273     // <Title>Generic constraints for nested types</Title>
274     // <Description>
275     // </Description>
276     // <RelatedBugs></RelatedBugs>
277     // <Expects Status=success></Expects>
278     // <Code>
279 
280     public class Foo
281     {
282     }
283 
284     public class Base<T>
285         where T : Foo
286     {
287         public class Derived<U>
288             where U : T
289         {
Foo()290             public void Foo()
291             {
292                 Test.Status = 1;
293             }
294         }
295     }
296 
297     public class Test
298     {
299         public static int Status;
300         [Fact]
DynamicCSharpRunTest()301         public static void DynamicCSharpRunTest()
302         {
303             Assert.Equal(0, MainMethod(null));
304         }
305 
MainMethod(string[] args)306         public static int MainMethod(string[] args)
307         {
308             Base<Foo>.Derived<Foo> d = new Base<Foo>.Derived<Foo>();
309             d.Foo();
310             if (Test.Status == 1)
311                 return 0;
312             return 1;
313         }
314     }
315     // </Code>
316 }
317 
318 
319 
320 namespace ManagedTests.DynamicCSharp.Conformance.dynamic.dynamicType.generics.nested.nestedclass001.nestedclass001
321 {
322     // <Title>Generic nested types</Title>
323     // <Description>
324     //      Generic nested types with same type parameter names
325     // </Description>
326     // <RelatedBugs></RelatedBugs>
327     //<Expects Status=success></Expects>
328     // <Code>
329     //<Expects Status=warning>\(16,22\).*CS0693</Expects>
330     //<Expects Status=warning>\(19,20\).*CS0649</Expects>
331 
332     public class A<T>
333     {
334         public class Gen<T>
335         {
336             public int x;
337         }
338     }
339 
340     public class Test
341     {
342         [Fact]
DynamicCSharpRunTest()343         public static void DynamicCSharpRunTest()
344         {
345             Assert.Equal(0, MainMethod());
346         }
347 
MainMethod()348         public static int MainMethod()
349         {
350             dynamic Obj = new A<int>.Gen<int>();
351             Obj.x = 10;
352             if (Obj.x != 10)
353                 return 1;
354             return 0;
355         }
356     }
357     // </Code>
358 }
359 
360 
361 
362 namespace ManagedTests.DynamicCSharp.Conformance.dynamic.dynamicType.generics.nested.nestedclass002.nestedclass002
363 {
364     // <Title>Generic nested types</Title>
365     // <Description>
366     //      Generic nested types with same type parameter names
367     // </Description>
368     // <RelatedBugs></RelatedBugs>
369     //<Expects Status=success></Expects>
370     // <Code>
371     //<Expects Status=warning>\(18,21\).*CS0693</Expects>
372     //<Expects Status=warning>\(23,25\).*CS0693</Expects>
373     //<Expects Status=warning>\(21,20\).*CS0649</Expects>
374     //<Expects Status=warning>\(25,24\).*CS0649</Expects>
375 
376     public class A1<T, U>
377     {
378         public class A2<T>
379         {
380             public int x;
381             public class A3<U>
382             {
383                 public int x;
384             }
385         }
386     }
387 
388     public class Test
389     {
390         [Fact]
DynamicCSharpRunTest()391         public static void DynamicCSharpRunTest()
392         {
393             Assert.Equal(0, MainMethod());
394         }
395 
MainMethod()396         public static int MainMethod()
397         {
398             dynamic Obj1 = new A1<int, double>.A2<float>();
399             dynamic Obj2 = new A1<int, double>.A2<float>.A3<string>();
400             Obj1.x = 10;
401             Obj2.x = 45;
402             if (Obj1.x != 10)
403                 return 1;
404             if (Obj2.x != 45)
405                 return 1;
406             return 0;
407         }
408     }
409     // </Code>
410 }
411 
412 
413 
414 namespace ManagedTests.DynamicCSharp.Conformance.dynamic.dynamicType.generics.nested.nestedclass003.nestedclass003
415 {
416     // <Title>Generic nested types</Title>
417     // <Description>
418     //      Generic nested types with same type parameter names
419     // </Description>
420     // <RelatedBugs></RelatedBugs>
421     //<Expects Status=success></Expects>
422     // <Code>
423     //<Expects Status=warning>\(22,25\).*CS0693</Expects>
424     //<Expects Status=warning>\(20,20\).*CS0649</Expects>
425     //<Expects Status=warning>\(24,24\).*CS0649</Expects>
426 
427     public class A1<T, U>
428     {
429         public class A2<V>
430         {
431             public int x;
432             public class A3<V>
433             {
434                 public int x;
435             }
436         }
437     }
438 
439     public class Test
440     {
441         [Fact]
DynamicCSharpRunTest()442         public static void DynamicCSharpRunTest()
443         {
444             Assert.Equal(0, MainMethod());
445         }
446 
MainMethod()447         public static int MainMethod()
448         {
449             dynamic Obj1 = new A1<int, double>.A2<float>();
450             dynamic Obj2 = new A1<int, double>.A2<float>.A3<string>();
451             Obj1.x = 10;
452             Obj2.x = 45;
453             if (Obj1.x != 10)
454                 return 1;
455             if (Obj2.x != 45)
456                 return 1;
457             return 0;
458         }
459     }
460     // </Code>
461 }
462 
463 
464 
465 namespace ManagedTests.DynamicCSharp.Conformance.dynamic.dynamicType.generics.nested.nestedclass004.nestedclass004
466 {
467     // <Title>Generic nested types</Title>
468     // <Description>
469     //      Generic nested types with same type parameter names
470     // </Description>
471     // <RelatedBugs></RelatedBugs>
472     //<Expects Status=success></Expects>
473     // <Code>
474     //<Expects Status=warning>\(24,25\).*CS0693</Expects>
475     //<Expects Status=warning>\(28,29\).*CS0693</Expects>
476     //<Expects Status=warning>\(22,20\).*CS0649</Expects>
477     //<Expects Status=warning>\(26,24\).*CS0649</Expects>
478     //<Expects Status=warning>\(30,28\).*CS0649</Expects>
479 
480     public class A1<T>
481     {
482         public class A2<U>
483         {
484             public int x;
485             public class A3<T>
486             {
487                 public int x;
488                 public class A4<U>
489                 {
490                     public int x;
491                 }
492             }
493         }
494     }
495 
496     public class Test
497     {
498         [Fact]
DynamicCSharpRunTest()499         public static void DynamicCSharpRunTest()
500         {
501             Assert.Equal(0, MainMethod());
502         }
503 
MainMethod()504         public static int MainMethod()
505         {
506             dynamic Obj1 = new A1<int>.A2<float>();
507             dynamic Obj2 = new A1<int>.A2<float>.A3<string>();
508             dynamic Obj3 = new A1<int>.A2<string>.A3<Test>.A4<A1<int>>();
509             Obj1.x = 10;
510             Obj2.x = 45;
511             Obj3.x = 99;
512             if (Obj1.x != 10)
513                 return 1;
514             if (Obj2.x != 45)
515                 return 1;
516             if (Obj3.x != 99)
517                 return 1;
518             return 0;
519         }
520     }
521     // </Code>
522 }
523 
524 
525 
526 namespace ManagedTests.DynamicCSharp.Conformance.dynamic.dynamicType.generics.nested.nestedclass005.nestedclass005
527 {
528     // <Title>Generic nested types</Title>
529     // <Description>
530     //      Generic nested types with same type parameter names
531     // </Description>
532     // <RelatedBugs></RelatedBugs>
533     //<Expects Status=success></Expects>
534     // <Code>
535     //<Expects Status=warning>\(29,25\).*CS0693</Expects>
536     //<Expects Status=warning>\(33,29\).*CS0693</Expects>
537     //<Expects Status=warning>\(51,25\).*CS0693</Expects>
538     //<Expects Status=warning>\(55,29\).*CS0693</Expects>
539     //<Expects Status=warning>\(27,20\).*CS0649</Expects>
540     //<Expects Status=warning>\(31,24\).*CS0649</Expects>
541     //<Expects Status=warning>\(35,28\).*CS0649</Expects>
542     //<Expects Status=warning>\(49,20\).*CS0649</Expects>
543     //<Expects Status=warning>\(53,24\).*CS0649</Expects>
544     //<Expects Status=warning>\(57,28\).*CS0649</Expects>
545 
546     public class A1<T>
547     {
548         public class A2<U>
549         {
550             public int x;
551             public class A3<T>
552             {
553                 public int x;
554                 public class A4<U>
555                 {
556                     public int x;
557                 }
558             }
559         }
560     }
561 
562     public class B1<T>
563     {
564         public class A2<U>
565         {
566             public int x;
567             public class A3<T>
568             {
569                 public int x;
570                 public class A4<U>
571                 {
572                     public int x;
573                 }
574             }
575         }
576     }
577 
578     public class Test
579     {
580         [Fact]
DynamicCSharpRunTest()581         public static void DynamicCSharpRunTest()
582         {
583             Assert.Equal(0, MainMethod());
584         }
585 
MainMethod()586         public static int MainMethod()
587         {
588             dynamic Obj1 = new A1<int>.A2<float>();
589             dynamic Obj2 = new A1<int>.A2<float>.A3<string>();
590             dynamic Obj3 = new A1<int>.A2<string>.A3<Test>.A4<A1<int>>();
591             dynamic Obj4 = new B1<int>.A2<float>();
592             dynamic Obj5 = new B1<int>.A2<float>.A3<string>();
593             dynamic Obj6 = new B1<int>.A2<string>.A3<Test>.A4<A1<int>>();
594             Obj1.x = 10;
595             Obj2.x = 45;
596             Obj3.x = 99;
597             Obj4.x = -10;
598             Obj5.x = -45;
599             Obj6.x = -99;
600             if (Obj1.x != 10)
601                 return 1;
602             if (Obj2.x != 45)
603                 return 1;
604             if (Obj3.x != 99)
605                 return 1;
606             if (Obj4.x != -10)
607                 return 1;
608             if (Obj5.x != -45)
609                 return 1;
610             if (Obj6.x != -99)
611                 return 1;
612             return 0;
613         }
614     }
615     // </Code>
616 }
617 
618 
619 
620 namespace ManagedTests.DynamicCSharp.Conformance.dynamic.dynamicType.generics.nested.nestedclass006.nestedclass006
621 {
622     // <Title>Generic nested types</Title>
623     // <Description>
624     //      Generic nested types with same type parameter names
625     // </Description>
626     // <RelatedBugs></RelatedBugs>
627     //<Expects Status=success></Expects>
628     // <Code>
629     //<Expects Status=warning>\(15,22\).*CS0693</Expects>
630 
631     public class A<T>
632     {
Meth1(int a)633         public int Meth1<T>(int a)
634         {
635             return a;
636         }
637     }
638 
639     public class Test
640     {
641         [Fact]
DynamicCSharpRunTest()642         public static void DynamicCSharpRunTest()
643         {
644             Assert.Equal(0, MainMethod());
645         }
646 
MainMethod()647         public static int MainMethod()
648         {
649             dynamic Obj = new A<int>();
650             if (Obj.Meth1<string>(10) != 10)
651                 return 1;
652             return 0;
653         }
654     }
655     // </Code>
656 }
657 
658 
659 
660 namespace ManagedTests.DynamicCSharp.Conformance.dynamic.dynamicType.generics.nested.nestedclass007.nestedclass007
661 {
662     // <Title>Generic nested types</Title>
663     // <Description>
664     //      Generic nested types with same type parameter names
665     // </Description>
666     // <RelatedBugs></RelatedBugs>
667     //<Expects Status=success></Expects>
668     // <Code>
669     //<Expects Status=warning>\(19,21\).*CS0693</Expects>
670     //<Expects Status=warning>\(19,24\).*CS0693</Expects>
671     //<Expects Status=warning>\(24,25\).*CS0693</Expects>
672     //<Expects Status=warning>\(22,20\).*CS0649</Expects>
673     //<Expects Status=warning>\(26,24\).*CS0649</Expects>
674 
675     public class A1<T, U>
676     {
677         public class A2<T, U>
678         {
679             public int x;
680             public class A3<U>
681             {
682                 public int x;
683             }
684         }
685     }
686 
687     public class Test
688     {
689         [Fact]
DynamicCSharpRunTest()690         public static void DynamicCSharpRunTest()
691         {
692             Assert.Equal(0, MainMethod());
693         }
694 
MainMethod()695         public static int MainMethod()
696         {
697             dynamic Obj1 = new A1<int, double>.A2<float, decimal>();
698             dynamic Obj2 = new A1<int, double>.A2<float, decimal>.A3<string>();
699             Obj1.x = 10;
700             Obj2.x = 45;
701             if (Obj1.x != 10)
702                 return 1;
703             if (Obj2.x != 45)
704                 return 1;
705             return 0;
706         }
707     }
708     // </Code>
709 }
710 
711 
712 
713 namespace ManagedTests.DynamicCSharp.Conformance.dynamic.dynamicType.generics.nested.nestedstrct001.nestedstrct001
714 {
715     // <Title>Generic nested types</Title>
716     // <Description>
717     //      Generic nested types with same type parameter names
718     // </Description>
719     // <RelatedBugs></RelatedBugs>
720     //<Expects Status=success></Expects>
721     // <Code>
722     //<Expects Status=warning>\(16,23\).*CS0693</Expects>
723     //<Expects Status=warning>\(19,20\).*CS0649</Expects>
724 
725     public struct A<T>
726     {
727         public struct Gen<T>
728         {
729             public int x;
730         }
731     }
732 
733     public class Test
734     {
735         [Fact]
DynamicCSharpRunTest()736         public static void DynamicCSharpRunTest()
737         {
738             Assert.Equal(0, MainMethod());
739         }
740 
MainMethod()741         public static int MainMethod()
742         {
743             dynamic Obj = new A<int>.Gen<int>();
744             Obj.x = 10;
745             if (Obj.x != 10)
746                 return 1;
747             return 0;
748         }
749     }
750     // </Code>
751 }
752 
753 
754 
755 namespace ManagedTests.DynamicCSharp.Conformance.dynamic.dynamicType.generics.nested.nestedstrct002.nestedstrct002
756 {
757     // <Title>Generic nested types</Title>
758     // <Description>
759     //      Generic nested types with same type parameter names
760     // </Description>
761     // <RelatedBugs></RelatedBugs>
762     //<Expects Status=success></Expects>
763     // <Code>
764     //<Expects Status=warning>\(18,22\).*CS0693</Expects>
765     //<Expects Status=warning>\(23,26\).*CS0693</Expects>
766     //<Expects Status=warning>\(21,20\).*CS0649</Expects>
767     //<Expects Status=warning>\(25,24\).*CS0649</Expects>
768 
769     public struct A1<T, U>
770     {
771         public struct A2<T>
772         {
773             public int x;
774             public struct A3<U>
775             {
776                 public int x;
777             }
778         }
779     }
780 
781     public class Test
782     {
783         [Fact]
DynamicCSharpRunTest()784         public static void DynamicCSharpRunTest()
785         {
786             Assert.Equal(0, MainMethod());
787         }
788 
MainMethod()789         public static int MainMethod()
790         {
791             dynamic Obj1 = new A1<int, double>.A2<float>();
792             dynamic Obj2 = new A1<int, double>.A2<float>.A3<string>();
793             Obj1.x = 10;
794             Obj2.x = 45;
795             if (Obj1.x != 10)
796                 return 1;
797             if (Obj2.x != 45)
798                 return 1;
799             return 0;
800         }
801     }
802     // </Code>
803 }
804 
805 
806 
807 namespace ManagedTests.DynamicCSharp.Conformance.dynamic.dynamicType.generics.nested.nestedstrct003.nestedstrct003
808 {
809     // <Title>Generic nested types</Title>
810     // <Description>
811     //      Generic nested types with same type parameter names
812     // </Description>
813     // <RelatedBugs></RelatedBugs>
814     //<Expects Status=success></Expects>
815     // <Code>
816     //<Expects Status=warning>\(22,26\).*CS0693</Expects>
817     //<Expects Status=warning>\(20,20\).*CS0649</Expects>
818     //<Expects Status=warning>\(24,24\).*CS0649</Expects>
819 
820     public struct A1<T, U>
821     {
822         public struct A2<V>
823         {
824             public int x;
825             public struct A3<V>
826             {
827                 public int x;
828             }
829         }
830     }
831 
832     public class Test
833     {
834         [Fact]
DynamicCSharpRunTest()835         public static void DynamicCSharpRunTest()
836         {
837             Assert.Equal(0, MainMethod());
838         }
839 
MainMethod()840         public static int MainMethod()
841         {
842             dynamic Obj1 = new A1<int, double>.A2<float>();
843             dynamic Obj2 = new A1<int, double>.A2<float>.A3<string>();
844             Obj1.x = 10;
845             Obj2.x = 45;
846             if (Obj1.x != 10)
847                 return 1;
848             if (Obj2.x != 45)
849                 return 1;
850             return 0;
851         }
852     }
853     // </Code>
854 }
855 
856 
857 
858 namespace ManagedTests.DynamicCSharp.Conformance.dynamic.dynamicType.generics.nested.nestedstrct004.nestedstrct004
859 {
860     // <Title>Generic nested types</Title>
861     // <Description>
862     //      Generic nested types with same type parameter names
863     // </Description>
864     // <RelatedBugs></RelatedBugs>
865     //<Expects Status=success></Expects>
866     // <Code>
867     //<Expects Status=warning>\(24,26\).*CS0693</Expects>
868     //<Expects Status=warning>\(28,30\).*CS0693</Expects>
869     //<Expects Status=warning>\(22,20\).*CS0649</Expects>
870     //<Expects Status=warning>\(26,24\).*CS0649</Expects>
871     //<Expects Status=warning>\(30,28\).*CS0649</Expects>
872 
873     public struct A1<T>
874     {
875         public struct A2<U>
876         {
877             public int x;
878             public struct A3<T>
879             {
880                 public int x;
881                 public struct A4<U>
882                 {
883                     public int x;
884                 }
885             }
886         }
887     }
888 
889     public class Test
890     {
891         [Fact]
DynamicCSharpRunTest()892         public static void DynamicCSharpRunTest()
893         {
894             Assert.Equal(0, MainMethod());
895         }
896 
MainMethod()897         public static int MainMethod()
898         {
899             dynamic Obj1 = new A1<int>.A2<float>();
900             dynamic Obj2 = new A1<int>.A2<float>.A3<string>();
901             dynamic Obj3 = new A1<int>.A2<string>.A3<Test>.A4<A1<int>>();
902             Obj1.x = 10;
903             Obj2.x = 45;
904             Obj3.x = 99;
905             if (Obj1.x != 10)
906                 return 1;
907             if (Obj2.x != 45)
908                 return 1;
909             if (Obj3.x != 99)
910                 return 1;
911             return 0;
912         }
913     }
914     // </Code>
915 }
916 
917 
918 
919 namespace ManagedTests.DynamicCSharp.Conformance.dynamic.dynamicType.generics.nested.nestedstrct005.nestedstrct005
920 {
921     // <Title>Generic nested types</Title>
922     // <Description>
923     //      Generic nested types with same type parameter names
924     // </Description>
925     // <RelatedBugs></RelatedBugs>
926     //<Expects Status=success></Expects>
927     // <Code>
928     //<Expects Status=warning>\(29,26\).*CS0693</Expects>
929     //<Expects Status=warning>\(33,30\).*CS0693</Expects>
930     //<Expects Status=warning>\(51,26\).*CS0693</Expects>
931     //<Expects Status=warning>\(55,30\).*CS0693</Expects>
932     //<Expects Status=warning>\(27,20\).*CS0649</Expects>
933     //<Expects Status=warning>\(31,24\).*CS0649</Expects>
934     //<Expects Status=warning>\(35,28\).*CS0649</Expects>
935     //<Expects Status=warning>\(49,20\).*CS0649</Expects>
936     //<Expects Status=warning>\(53,24\).*CS0649</Expects>
937     //<Expects Status=warning>\(57,28\).*CS0649</Expects>
938 
939     public struct A1<T>
940     {
941         public struct A2<U>
942         {
943             public int x;
944             public struct A3<T>
945             {
946                 public int x;
947                 public struct A4<U>
948                 {
949                     public int x;
950                 }
951             }
952         }
953     }
954 
955     public struct B1<T>
956     {
957         public struct A2<U>
958         {
959             public int x;
960             public struct A3<T>
961             {
962                 public int x;
963                 public struct A4<U>
964                 {
965                     public int x;
966                 }
967             }
968         }
969     }
970 
971     public class Test
972     {
973         [Fact]
DynamicCSharpRunTest()974         public static void DynamicCSharpRunTest()
975         {
976             Assert.Equal(0, MainMethod());
977         }
978 
MainMethod()979         public static int MainMethod()
980         {
981             dynamic Obj1 = new A1<int>.A2<float>();
982             dynamic Obj2 = new A1<int>.A2<float>.A3<string>();
983             dynamic Obj3 = new A1<int>.A2<string>.A3<Test>.A4<A1<int>>();
984             dynamic Obj4 = new B1<int>.A2<float>();
985             dynamic Obj5 = new B1<int>.A2<float>.A3<string>();
986             dynamic Obj6 = new B1<int>.A2<string>.A3<Test>.A4<A1<int>>();
987             Obj1.x = 10;
988             Obj2.x = 45;
989             Obj3.x = 99;
990             Obj4.x = -10;
991             Obj5.x = -45;
992             Obj6.x = -99;
993             if (Obj1.x != 10)
994                 return 1;
995             if (Obj2.x != 45)
996                 return 1;
997             if (Obj3.x != 99)
998                 return 1;
999             if (Obj4.x != -10)
1000                 return 1;
1001             if (Obj5.x != -45)
1002                 return 1;
1003             if (Obj6.x != -99)
1004                 return 1;
1005             return 0;
1006         }
1007     }
1008     // </Code>
1009 }
1010 
1011 
1012 
1013 namespace ManagedTests.DynamicCSharp.Conformance.dynamic.dynamicType.generics.nested.nestedstrct006.nestedstrct006
1014 {
1015     // <Title>Generic nested types</Title>
1016     // <Description>
1017     //      Generic nested types with same type parameter names
1018     // </Description>
1019     // <RelatedBugs></RelatedBugs>
1020     //<Expects Status=success></Expects>
1021     // <Code>
1022     //<Expects Status=warning>\(15,22\).*CS0693</Expects>
1023 
1024     public struct A<T>
1025     {
Meth1ManagedTests.DynamicCSharp.Conformance.dynamic.dynamicType.generics.nested.nestedstrct006.nestedstrct006.A1026         public int Meth1<T>(int a)
1027         {
1028             return a;
1029         }
1030     }
1031 
1032     public class Test
1033     {
1034         [Fact]
DynamicCSharpRunTest()1035         public static void DynamicCSharpRunTest()
1036         {
1037             Assert.Equal(0, MainMethod());
1038         }
1039 
MainMethod()1040         public static int MainMethod()
1041         {
1042             dynamic Obj = new A<int>();
1043             if (Obj.Meth1<string>(10) != 10)
1044                 return 1;
1045             return 0;
1046         }
1047     }
1048     // </Code>
1049 }
1050 
1051 
1052 
1053 namespace ManagedTests.DynamicCSharp.Conformance.dynamic.dynamicType.generics.nested.nestedstrct007.nestedstrct007
1054 {
1055     // <Title>Generic nested types</Title>
1056     // <Description>
1057     //      Generic nested types with same type parameter names
1058     // </Description>
1059     // <RelatedBugs></RelatedBugs>
1060     //<Expects Status=success></Expects>
1061     // <Code>
1062     //<Expects Status=warning>\(19,22\).*CS0693</Expects>
1063     //<Expects Status=warning>\(19,25\).*CS0693</Expects>
1064     //<Expects Status=warning>\(24,26\).*CS0693</Expects>
1065     //<Expects Status=warning>\(22,20\).*CS0649</Expects>
1066     //<Expects Status=warning>\(26,24\).*CS0649</Expects>
1067 
1068     public struct A1<T, U>
1069     {
1070         public struct A2<T, U>
1071         {
1072             public int x;
1073             public struct A3<U>
1074             {
1075                 public int x;
1076             }
1077         }
1078     }
1079 
1080     public class Test
1081     {
1082         [Fact]
DynamicCSharpRunTest()1083         public static void DynamicCSharpRunTest()
1084         {
1085             Assert.Equal(0, MainMethod());
1086         }
1087 
MainMethod()1088         public static int MainMethod()
1089         {
1090             dynamic Obj1 = new A1<int, double>.A2<float, decimal>();
1091             dynamic Obj2 = new A1<int, double>.A2<float, decimal>.A3<string>();
1092             Obj1.x = 10;
1093             Obj2.x = 45;
1094             if (Obj1.x != 10)
1095                 return 1;
1096             if (Obj2.x != 45)
1097                 return 1;
1098             return 0;
1099         }
1100     }
1101     // </Code>
1102 }
1103