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 47 48 49 50 51
|
;; -*-theme-d-*-
;; Copyright (C) 2026 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 test941)
(import (standard-library core)
(standard-library console-io))
(define-simple-virtual-method plus1
(((r <real>)) <real> pure)
(+ r 1.0))
(define-simple-virtual-method plus1
(((i <integer>)) <integer> pure)
(+ i 1))
(define-param-virtual-method mymethod1
(%type)
(((x %type)) <none> nonpure)
(console-display-line (plus1 x)))
(define-simple-proc my-display-line1
(((x <object>)) <none> nonpure)
(console-write-line x))
(define-param-virtual-method mymethod2
(%type)
(((x %type)) <none> nonpure)
(my-display-line1 (plus1 x)))
(define-simple-virtual-method my-display-line2
(((x <object>)) <none> nonpure)
(console-write-line x))
(define-param-virtual-method mymethod3
(%type)
(((x %type)) <none> nonpure)
(my-display-line2 (plus1 x)))
(define-main-proc (() <none> nonpure)
(mymethod1 2)
(mymethod1 2.0)
(mymethod2 3)
(mymethod2 3.0)
(mymethod3 4)
(mymethod3 4.0)))
|