;; -*-theme-d-*-

;; Copyright (C) 2015 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 test547)


  (import (standard-library core)
	  (standard-library console-io))

  (define-param-class :a (%type) <object> #t #f #f public ()
    ((field1 %type public module)))

  (define-param-proc push (%type)
    (((store (:a %type)) (item %type)) <none> nonpure)
    (field-set! store 'field1 item))

  (define-param-proc pop (%type)
    (((store (:a %type))) %type nonpure)
    (field-ref store 'field1))

  (define-signature <stack> ()
    (push (this <integer>) <none> nonpure)
    (pop (this) <integer> nonpure))

  (define myproc
    (lambda (((s <stack>) (item <integer>)) <integer> nonpure)
      (push s item)
      (pop s)))

  (define main
    (lambda (() <none> nonpure)
      (let ((mystack (make (:a <integer>) 10)))
	(console-display-line (myproc mystack 1))))))
