You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Design and implement type alias feature (type MyType = ...) #166
Wave currently requires developers to explicitly repeat complex type definitions in full.
This makes code harder to maintain and reduces readability, especially when using deeply nested pointer types, tuples, or array types.
A type alias feature would allow defining shorthand names for types, improving clarity and reusability without affecting runtime behavior.
Expected Behavior:
Introduce a new declaration syntax for type aliases:
type MyInt = i32;
type Point = tuple<i32, i32>;
type Ptr10 = ptr<ptr<ptr<ptr<ptr<ptr<ptr<ptr<ptr<ptr<i32>>>>>>>>>>;
Aliases are fully expanded at compile time with no runtime overhead.
Type-checking uses the resolved underlying type — aliases are not treated as distinct types.
Nested and chained aliases are allowed:
type A = B;
type B = i64;
Recursive aliases are disallowed:
type A = ptr<A>; // ❌ invalid
User Scenarios:
A developer creates a reusable alias for a 10-layer pointer type: type Ptr10 = ptr<...>;
A team defines a standard alias type FileId = i32; for shared meaning across files.
Code becomes easier to maintain by using type Vector3 = tuple<f32, f32, f32>; rather than rewriting it.
Additional Information:
Language version: - (not yet assigned)
Target branch: develop
Parser: Add support for parsing type IDENT = TYPE; syntax
AST: Introduce TypeAliasNode or equivalent
IR Generator: Substitute type alias with the underlying resolved type during code generation
Validation: Must prevent infinite recursive aliasing
Activity
LunaStev commentedon Aug 3, 2026
Base type alias syntax and lowering are implemented. Recursive alias rejection remains tracked separately in #167, so this feature issue is complete.