$ check main
= 0
stacks 0
fn a.b.both none
fn a.keep none
fn a.b.field none
fn a.put none
fn a.b.put none
fn a.width none
$ cc main
= 0
$ fmt
= 0
lang/test/tree_short/a.g
lang/test/tree_short/a/b.g
$ fmt a.keep
= 0
-- The local put hides a.put, so the qualified name is the shortest.
fn keep put int -> int = a.put put + LIMIT
$ fmt a.b.both
= 0
-- put is a.b.put here, so a.put stays qualified; a.b.put and a.LIMIT do not.
fn both x int -> int = a.put x + put x + LIMIT
$ full a.b.both
= 0
-- put is a.b.put here, so a.put stays qualified; a.b.put and a.LIMIT do not.
fn both x int -> int = @a.put x + @a.b.put x + @a.LIMIT
$ fmt a.b.field
= 0
-- count alone is a.count, but count.n is n of the namespace a.b.count: the
-- field of a.count keeps its namespace, where a.count alone does not.
fn field -> int = a.count.n + count.n + width count
$ full a.b.field
= 0
-- count alone is a.count, but count.n is n of the namespace a.b.count: the
-- field of a.count keeps its namespace, where a.count alone does not.
fn field -> int = @a.count.n + @a.b.count.n + @a.width @a.count
$ full lang/test/tree_short/
= 0
11 lang/test/tree_short/a.g
const LIMIT int = 9

type Rec = rec n int

global count @a.Rec = @a.Rec { 1 }

-- The local put hides a.put, so the qualified name is the shortest.
fn keep put int -> int = @a.put put + @a.LIMIT

fn put x int -> int = x
fn width r @a.Rec -> int = r.n
1 lang/test/tree_short/prelude.g
fn main = { exit (@a.b.both 1 + @a.keep 2 + @a.b.field ()) }
8 lang/test/tree_short/a/b.g
-- put is a.b.put here, so a.put stays qualified; a.b.put and a.LIMIT do not.
fn both x int -> int = @a.put x + @a.b.put x + @a.LIMIT

-- count alone is a.count, but count.n is n of the namespace a.b.count: the
-- field of a.count keeps its namespace, where a.count alone does not.
fn field -> int = @a.count.n + @a.b.count.n + @a.width @a.count

fn put x int -> int = x + 1
1 lang/test/tree_short/a/b/count.g
global n int = 9
0 lang/test/tree_short/a/b/empty.g
$ fmt lang/test/tree_short/a/
= 0
8 lang/test/tree_short/a/b.g
-- put is a.b.put here, so a.put stays qualified; a.b.put and a.LIMIT do not.
fn both x int -> int = a.put x + put x + LIMIT

-- count alone is a.count, but count.n is n of the namespace a.b.count: the
-- field of a.count keeps its namespace, where a.count alone does not.
fn field -> int = a.count.n + count.n + width count

fn put x int -> int = x + 1
1 lang/test/tree_short/a/b/count.g
global n int = 9
0 lang/test/tree_short/a/b/empty.g
$ fmt lang/test/tree_short/none/
= 2
lang: no file under lang/test/tree_short/none/ in the tree
