From 98d4da7602b6080aef6268901b78de3d71413eed Mon Sep 17 00:00:00 2001 From: TermiNexus Date: Tue, 3 Nov 2026 15:19:53 +0800 Subject: [PATCH] feat(option): allow case None on nullable pointers None stays a keyword literal; the pattern parser already produced MatchSingleton, and the nullable-pointer match now treats it as the Nil branch. LSP colors None as a keyword. --- App/lib/core/Gen/MatchGenMixin.vp | 1 + App/lib/lsp/LspSemantic.vp | 2 ++ 2 files changed, 3 insertions(+) diff --git a/App/lib/core/Gen/MatchGenMixin.vp b/App/lib/core/Gen/MatchGenMixin.vp index d02d4ef..b2ea532 100644 --- a/App/lib/core/Gen/MatchGenMixin.vp +++ b/App/lib/core/Gen/MatchGenMixin.vp @@ -301,6 +301,7 @@ novirtual class MatchGenMixin: if vnm is None: return 0 if string.strcmp(vnm, "Some") == 0: return 1 if string.strcmp(vnm, "Nil") == 0: return 2 + if k == ast.ASTKind.MatchSingleton: return 2 return 0 def _match_has_opt_pattern(self, node: ast.Match*) -> int: diff --git a/App/lib/lsp/LspSemantic.vp b/App/lib/lsp/LspSemantic.vp index ba649e3..eb5f157 100644 --- a/App/lib/lsp/LspSemantic.vp +++ b/App/lib/lsp/LspSemantic.vp @@ -535,6 +535,8 @@ def _LexStream(pool: memhub.MemManager*, typ = ST_NUMBER elif tok.type == ast.TokenType.Name and tok.str_val is not None and string.strcmp(tok.str_val, "own") == 0: typ = ST_KEYWORD + elif tok.type == ast.TokenType.Name and tok.str_val is not None and string.strcmp(tok.str_val, "None") == 0: + typ = ST_KEYWORD elif tok.type == ast.TokenType.Name and tok.str_val is not None and string.strcmp(tok.str_val, "Some") == 0: typ = ST_CLASS elif tok.type == ast.TokenType.Name and tok.str_val is not None and string.strcmp(tok.str_val, "Nil") == 0: