-- Tickle an odd bit of behaviour in alias checking of free names.
--
-- In thing.1 below, "foo" is a free name, so it's effectively abbreviated
-- whenever thing.1 is called; it shouldn't then be possible to use
-- foo[something] as a parameter to thing.1.
--
-- Now, in this case the compiler can tell that the code is obviously safe --
-- but should it?

DATA TYPE FOO
  RECORD
    INT x, y:
:

PROC test ()
  INITIAL FOO foo IS [0, 0]:

  #IF TRUE
  -- This works
  PROC thing.1 (RESULT INT r)
    r := foo[x] + 1
  :
  thing.1 (foo[y])
  #ELIF TRUE
  -- This doesn't work
  PROC thing.2 (FOO f, RESULT INT r)
    r := f[x] + 1
  :
  thing.2 (foo, foo[y])
  #ELIF TRUE
  -- This doesn't work
  PROC thing.3 (VAL FOO f, RESULT INT r)
    r := f[x] + 1
  :
  thing.3 (foo, foo[y])
  #ELSE
  -- This doesn't work
  PROC thing.4 (VAL INT l, RESULT INT r)
    r := l + 1
  :
  thing.4 (foo[x], foo[y])
  #ENDIF
:
