[svn] r7630: nemerle/trunk/ncc: testsuite/positive/tyvars.n
typing/MType.n
malekith
svnadmin at nemerle.org
Mon Apr 30 11:56:04 CEST 2007
Log:
Don't assume that if something implements an interface, then its not a value type. Fixes #982, #995.
Author: malekith
Date: Mon Apr 30 11:56:03 2007
New Revision: 7630
Modified:
nemerle/trunk/ncc/testsuite/positive/tyvars.n
nemerle/trunk/ncc/typing/MType.n
Modified: nemerle/trunk/ncc/testsuite/positive/tyvars.n
==============================================================================
--- nemerle/trunk/ncc/testsuite/positive/tyvars.n (original)
+++ nemerle/trunk/ncc/testsuite/positive/tyvars.n Mon Apr 30 11:56:03 2007
@@ -37,6 +37,15 @@
}
}
+namespace Bug995 {
+// also #982
+public interface IFoo[T]{}
+
+public class Bar[T1, T2]
+ where T2 : struct, IFoo[T1]
+{}
+}
+
/*
BEGIN-OUTPUT
END-OUTPUT
Modified: nemerle/trunk/ncc/typing/MType.n
==============================================================================
--- nemerle/trunk/ncc/typing/MType.n (original)
+++ nemerle/trunk/ncc/typing/MType.n Mon Apr 30 11:56:03 2007
@@ -502,6 +502,9 @@
}
+ // This method actually checks if a given type is guaranteed
+ // to have null as one of the possible values. We should
+ // rethink the name.
public override CanBeNull : bool
{
get {
@@ -517,8 +520,11 @@
s.SpecialConstraints %&&
System.Reflection.GenericParameterAttributes.ReferenceTypeConstraint ||
found: {
- foreach (ctr in s.Constraints)
- when (ctr.CanBeNull) found (true);
+ foreach (ctr in s.Constraints) {
+ | Class (ti, _) when ti.IsInterface => {}
+ | _ when (ctr.CanBeNull) => found (true);
+ | _ => {}
+ }
false
}
More information about the svn
mailing list