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 52 53 54
|
;; -*-theme-d-*-
;; Copyright (C) 2020 Tommi Höynälänmaa
;; Distributed under GNU General Public License version 3,
;; see file doc/GPL-3.
;; Expected results: translation error
(define-proper-program (tests test766)
(import (standard-library core)
(standard-library console-io))
(define-class <my-object>
(construct ((id1 <string>)))
(fields
(id <string> public public id1)))
(define-class <my-record>
(construct ((name1 <string>) (address1 <string>)))
(fields
(name <string> public public name1)
(address <string> public public address1)))
(define-class <my-stack>
(superclass <my-object>)
(construct ((id1 <string>)) (id1) ())
(fields
(contents (:uniform-list <my-record>) module module null)))
(define-class <my-counted-stack>
(superclass <my-stack>)
(fields
(count <integer> module module 0)))
(define-simple-proc my-push
(((stack <my-counted-stack>) (element <my-record>)) <none> nonpure)
(field-set! stack 'contents (cons element (field-ref stack 'contents)))
(field-set! stack 'count (+ (field-ref stack 'count) 1)))
(define main
(lambda (() <integer> nonpure)
(let ((my-stack (create <my-counted-stack>)))
(my-push my-stack (create <my-record> "Tommi" "PL 0"))
(my-push my-stack (create <my-record> "Jukka" "PL 1"))
(my-push my-stack (create <my-record> "Janne" "PL 2"))
0))))
|