$ fmt
= 0
lang/test/tree_full/long.g
$ fmt lang/test/tree_full/long.g
= 0
-- Every reference written in full where a shorter form reads back: not
-- this file's canonical form, which the formatter gives.

fn long -> int = {
  let s = lib.Circle { lib.FACTOR }
  var buf = arr N byte
  buf[0] = 7
  let y = match s {
    lib.Circle r => r
    lib.Dot => 0
  }
  lib.scale (helper ()) + count.a + lib.total.b + typed s Pair { 1, 2 } + y + int buf[0]
}

fn typed s lib.Shape, p Pair -> int = p.a

-- A local named as the root's definition and one named as a namespace:
-- the two full names stay, since nothing shorter reads back.
fn hidden -> int = {
  let helper = 3
  let lib = 4
  helper + lib + @helper () + @lib.scale 1
}
$ full lang/test/tree_full/long.g
= 0
-- Every reference written in full where a shorter form reads back: not
-- this file's canonical form, which the formatter gives.

fn long -> int = {
  let s = @lib.Circle { @lib.FACTOR }
  var buf = arr @N byte
  buf[0] = 7
  let y = match s {
    @lib.Circle r => r
    @lib.Dot => 0
  }
  @lib.scale (@helper ()) + @count.a + @lib.total.b + @long.typed s @Pair { 1, 2 } + y + int buf[0]
}

fn typed s @lib.Shape, p @Pair -> int = p.a

-- A local named as the root's definition and one named as a namespace:
-- the two full names stay, since nothing shorter reads back.
fn hidden -> int = {
  let helper = 3
  let lib = 4
  helper + lib + @helper () + @lib.scale 1
}
$ full a.b.main
= 0
fn main = {
  let x = @lib.scale (@helper ()) + @a.helper () + @count.a + @lib.total.b
  let s = @lib.Circle { @lib.FACTOR }
  var buf = arr @N byte
  buf[0] = 7
  let y = match s {
    @lib.Circle r => r
    @lib.Dot => 0
  }
  exit (x + y + @a.b.typed s @Pair { 1, 2 } + int buf[0])
}
$ check a.b.main
= 0
stacks 0
fn a.b.main none
fn lib.scale none
fn a.helper none
fn a.b.typed none
$ cc a.b.main
= 0
$ check long.long
= 0
stacks 0
fn long.long none
fn lib.scale none
fn long.typed none
$ check long.hidden
= 0
stacks 0
fn long.hidden none
fn lib.scale none
$ check gone.f
= 1
E007 gone.f:0 Unresolved @Memory
E007 gone.f:1 Unresolved @lib.nothing
E007 gone.f:1 Unresolved @nowhere
E007 gone.f:1 Unresolved @no
E007 gone.f:1 Unresolved @lib.Gone
$ full gone.f
= 0
fn f x cap @Memory -> int = @lib.nothing 1 + @nowhere 2 + @no.such.thing + @lib.Gone { 1 }.n
$ fmt gone.f
= 0
fn f x cap @Memory -> int = @lib.nothing 1 + @nowhere 2 + @no.such.thing + @lib.Gone { 1 }.n
$ check
= 1
E007 gone.f:0 Unresolved @Memory
E007 gone.f:1 Unresolved @lib.nothing
E007 gone.f:1 Unresolved @nowhere
E007 gone.f:1 Unresolved @no
E007 gone.f:1 Unresolved @lib.Gone
