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

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Baulig <martin@novell.com>2006-01-18 18:32:55 +0300
committerMartin Baulig <martin@novell.com>2006-01-18 18:32:55 +0300
commita6335857892fc2e5cab232212947257716c63020 (patch)
tree227dd6fb00b5f45a29337be664b3afdff4eedcdf /mcs/tests/gtest-236.cs
parent1212d1ddd0d78f6e87550860f39bfb3478f7125f (diff)
2006-01-18 Martin Baulig <martin@ximian.com>
Fix #76417: a generic class may now have methods which may unify for some type parameter substitutions. * class.cs (Method.IsDuplicateImplementation): Don't report CS0408 for methods which may unify anymore. * expression.cs (Invocation.MoreSpecific): New private static method; checks whether one method is more specific than another according to 14.4.2.2 of the spec. (Invocation.BetterFunction): Implement the tie-breaking rules from 14.4.2.2 of the spec: if two methods unify for some type parameter substitution, we need to pick the more specific one. svn path=/trunk/mcs/; revision=55728
Diffstat (limited to 'mcs/tests/gtest-236.cs')
-rw-r--r--mcs/tests/gtest-236.cs30
1 files changed, 30 insertions, 0 deletions
diff --git a/mcs/tests/gtest-236.cs b/mcs/tests/gtest-236.cs
new file mode 100644
index 00000000000..cce3049305d
--- /dev/null
+++ b/mcs/tests/gtest-236.cs
@@ -0,0 +1,30 @@
+using System;
+
+class Foo<T>
+{
+ public int Test (Foo<T> foo)
+ {
+ return 1;
+ }
+
+ public int Test (Foo<int> foo)
+ {
+ return 2;
+ }
+}
+
+class X
+{
+ static int Main ()
+ {
+ Foo<long> foo = new Foo<long> ();
+ Foo<int> bar = new Foo<int> ();
+ if (foo.Test (foo) != 1)
+ return 1;
+ if (foo.Test (bar) != 2)
+ return 2;
+ if (bar.Test (bar) != 2)
+ return 3;
+ return 0;
+ }
+}