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
|
;; -*-theme-d-*-
;; Copyright (C) 2025 Tommi Höynälänmaa
;; Distributed under GNU General Public License version 3,
;; see file doc/GPL-3.
;; Expected results: translation and running OK
(define-proper-program (tests test925)
(import (standard-library core))
(import (standard-library console-io))
(import (tests test924))
(define-class <b>
(superclass <a>)
(fields
(s <symbol> public public)))
(define-simple-virtual-method equal?
(((b1 <b>) (b2 <b>)) <boolean> pure)
(and
(equal? (field-ref b1 'i) (field-ref b2 'i))
(equal? (field-ref b1 's) (field-ref b2 's))))
(define-main-proc (() <none> nonpure)
(let ((b1 (create <b> 1 'abc))
(b2 (create <b> 1 'def))
(a1 (create <a> 2))
(a2 (create <a> 2)))
(mymethod b1 (list b2))
(console-display-line (equal? b1 b2))
(console-display-line (equal? a1 a2)))))
|