;; -*-theme-d-*-

;; Copyright (C) 2014 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 test131)


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


  (define-class <a> <object> #t #f #f public ()
    ((fld1 <integer> public public)))

  (define-class <b> <object> #t #f #f public ()
    ((fld2 <string> public public)))

  (define-class <x> <a> #t #f #f public () ())

  (define-class <y> <b> #t #f #f public () ())

  (define-simple-method my-method (((a <a>) (y <y>)) <integer> pure)
    (field-ref a 'fld1))

  (define-simple-method my-method (((x <x>) (b <b>)) <integer> pure)
    (field-ref x 'fld1))

  (define main
    (lambda (() <none> nonpure)
      (let* ((x (make <x> 10))
	     (y (make <y> "abc"))
	     (n <integer> (my-method x y))
	     (m (+ n 1)))
	(console-display m)
	(console-newline)))))
