test case:
//////////////////////////////////////
typeclass X[t] { virtual fun f: t -> int; }
instance X[double] { fun f:double -> int = "5555"; }
instance X[int] { fun f:int-> int = "7777"; }
instance X[string] { fun f:string-> int = "9999"; }
open X[double];
println (f 1.2); // 5555
//println (f "jhg"); // FAILS AS IT SHOULD
proc g[t with X[t]](a:t) {
var x = f 1; // BUG! should FAIL, not produce 7777
println x;
var y = f a; // should WORK due to function arg, 9999
println y;
var z = f 1.2; // BUG! should FAIL despite global open
println z; // because the 'with' in g should hide the global
}
g("Hello");
///////////////////////////////////
both the BUG statements actually work. The // FAILS AS IT SHOULD
correctly fails in similar circumstances.
--
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net
-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell. From the desktop to the data center, Linux is going
mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language