1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
module ClassA
use int.Int
use mach.java.lang.Integer
type t = {
mutable a : integer;
mutable b : bool;
}
end
module DefaultMethods
use ClassA
use mach.java.lang.Integer
use mach.java.lang.Array
type t = {
mutable a : integer;
mutable c : ClassA.t;
mutable b : array (array bool);
mutable d : string;
mutable z : bool;
}
end
module HashCodeRedef
use mach.java.lang.Integer
type t = {
mutable a : integer;
mutable b : bool;
}
let hash_code(self : t) : integer =
7211 * self.a + (if self.b then 0 else 1)
end
module EqualsRedef
use mach.java.lang.Integer
type t = {
mutable a : integer;
mutable b : bool;
}
let equals(self obj: t) : bool =
self.a = obj.a && (if self.b then obj.b else not obj.b)
end
|