spacepaste

compiles.ml

  1.  
  2. class c1 =
  3. object
  4. method m1 = 1
  5. end
  6. class c2 =
  7. object
  8. inherit c1
  9. method m2 = 2
  10. end
  11. class c3 =
  12. object
  13. method m3 (x: c1) = x#m1
  14. end
  15. let () =
  16. let i1 = new c1
  17. and i2 = new c2
  18. and i3 = new c3 in
  19. let _ = i3#m3 i1, i3#m3 (i2 :> c1)
  20. in ()
  21.  

doesnt-compile.ml

  1.  
  2. class c1 =
  3. object
  4. method m1 = 1
  5. end
  6. class c2 =
  7. object
  8. inherit c1
  9. method m2 = 2
  10. end
  11. class c3 =
  12. object
  13. method m3 (x: c1) = x#m1
  14. end
  15. let () =
  16. let i1 = new c1
  17. and i2 = new c2
  18. and i3 = new c3 in
  19. let _ = i3#m3 i1, i3#m3 i2
  20. in ()
  21.