using Nemerle.IO; using Nemerle.Collections; interface IComparab ['a] { CompareTo (_ : 'a) : int; } variant Node ['a] where 'a : IComparab ['a] { | Red { key : 'a; lchild : Node ['a]; rchild : Node ['a]; } | Black { key : 'a; lchild : Node ['a]; rchild : Node ['a]; } | Leaf } class D ['a] : IComparab ['a] where 'a : IComparab ['a] { public CompareTo (_ : 'a) : int { 1 } } class A : System.IComparable { public CompareTo (_ : object) : int { 0 } } class B : System.IComparable [B] { public CompareTo (_ : B) : int { 0 } } namespace SystemActionVsAction { using System; public variant Action { | B | C } public module M { public foo (x : Action) : void { _ = x is Action.B } } } namespace Bug805 { public class X { } public class Y['t] : X { public foo () : void { def x = Hashtable (); // W: type arguments for constructor .* could not be inferred x.Add ("aaa", null); x.Add ("bbb", null); when (x.Contains ("aaa")) System.Console.WriteLine ("Got it"); } } public module A { public F['t](x : X) : bool { x is Y['t]; } public Run() : void { def y = Y() : Y[int]; def isY = A.F(y).ToString(); // W: type arguments for method .* could not be inferred System.Console.WriteLine(isY); y.foo (); } } } class C { public this (_ : int) { } } class C ['a] { public mutable x : 'a; } def x = C(1); def y = C(); y.x = "a"; printf ("x=%s y=%s y.x=%s\n", x.GetType ().Name, y.GetType ().Name, y.x); Bug805.A.Run(); /* OPTIONS: -dowarn:10008 BEGIN-OUTPUT x=C y=C`1 y.x=a False Got it END-OUTPUT */