syntax: Add `typegroup` blocks (#60569)
Introduces the `typegroup` syntax that allows multiple type
definitions to reference each other cyclically, solving a limitation
dating back to 2011 (issue #269).
The fundamental construct uses a `typegroup` block:
```julia
typegroup
struct Node
edges::Vector{Edge}
end
struct Edge
from::Node
to::Node
end
end
```
See the documentation for further examples. The fundamental
semantics here are that all (mutable) struct definitions
within the block have their names introduced at the top of
the block and then get created as a unit (constructor
definitions are deferred until all types are defined).
There was significant discussion about the correct semantics
for this (see https://github.com/JuliaLang/julia/pull/60569),
but what we ended up with is that there is that before the
types are created, the type names are `TypeVar`s and there's
a special new `TypeApp` that represents lazy type application
(which is not otherwise part of our Type algebra).
Instantiation, everything then gets resolved together.
Fixes #269
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>