1.2.47. test/regress/rt-1.01.47

Start felix section to test/regress/rt-1.01.47-0.flx[1 /1 ]
     1: #line 1861 "./lpsrc/flx_regress.pak"
     2: //Check typeclasses:inheritance
     3: //Check inherit:specialisation
     4: #import <flx.flxh>
     5: header '#include <iostream>';
     6: 
     7: typeclass XEq[t] {
     8:   virtual fun xeq: t * t -> bool;
     9:   virtual fun xne: t * t -> bool;
    10: }
    11: 
    12: typeclass XCmp[t] {
    13:   inherit XEq[t];
    14:   virtual fun xlt: t * t -> bool;
    15:   virtual fun xgt: t * t -> bool;
    16:   virtual fun xle: t * t -> bool;
    17:   virtual fun xge: t * t -> bool;
    18: }
    19: 
    20: instance XEq[int] {
    21:   fun xeq: int * int -> bool = "$1==$2";
    22:   fun xne: int * int -> bool = "$1!=$2";
    23: }
    24: 
    25: instance XCmp[int] {
    26:   fun xlt: int * int -> bool = "$1<$2" ;
    27:   fun xgt: int * int -> bool = "$1>$2" ;
    28:   fun xle: int * int -> bool = "$1<=$2" ;
    29:   fun xge: int * int -> bool = "$1>=$2" ;
    30: }
    31: 
    32: fun feq[with XEq[int]] (x:int,y:int) => xeq(x,y);
    33: fun geq[with XCmp[int]] (x:int,y:int) => xeq(x,y);
    34: 
    35: print$ feq(1,2); endl;
    36: print$ geq(1,2); endl;
    37: 
    38: module Fred[t]
    39: {
    40:   proc pr: t = "std::cout<<$1<<endl;";
    41: }
    42: 
    43: Fred::pr 1;
    44: 
    45: module Joe
    46: {
    47:   inherit Fred[int];
    48: }
    49: 
    50: Joe::pr 1;
    51: 
    52: open Joe;
    53: pr 1;
End felix section to test/regress/rt-1.01.47-0.flx[1]
Start data section to test/regress/rt-1.01.47-0.expect[1 /1 ]
     1: false
     2: false
     3: 1
     4: 1
     5: 1
End data section to test/regress/rt-1.01.47-0.expect[1]