Phase 8.2.4: Lifetime syntax ('a) support

- Lexer tokenizes 'a as tkLifetime
- Parser accepts lifetimes in type params <'a> and reference types &'a T / &'a mut T
- AST TypeExpr has refLifetime field for tekRef/tekMutRef
- TypeParam gains isLifetime flag for generic monomorphization
- Sema infers lifetime params as no-op dummy values; unwraps pointee types for params inside refs
- HIR lower skips lifetime params when generating mangled names and substitution tables
- &mut expr syntax supported in parser (consumed as part of unary &)
This commit is contained in:
2026-06-01 11:32:40 +03:00
parent 5830548d54
commit bf9e73d56e
6 changed files with 114 additions and 29 deletions
+2
View File
@@ -58,6 +58,7 @@ type
tkStaticAssert # static_assert
tkComptime # comptime
tkDyn # dyn
tkLifetime # 'a (lifetime parameter)
##Punctuation
tkLParen # (
@@ -265,6 +266,7 @@ proc tokenKindName*(kind: TokenKind): string =
of tkStaticAssert: "'static_assert'"
of tkComptime: "'comptime'"
of tkDyn: "'dyn'"
of tkLifetime: "lifetime"
of tkLParen: "'('"
of tkRParen: "')'"
of tkLBrace: "'{'"