feat(vipeye-internal): long/longlong 也作为内置 C 基本类型 typedef
Validation / Typecheck (push) Has been cancelled
Validation / Style (push) Has been cancelled
Validation / Test macos-latest (push) Has been cancelled
Validation / Test ubuntu-latest (push) Has been cancelled
Validation / Test windows-latest (push) Has been cancelled
Validation / Build (push) Has been cancelled
Validation / Required (push) Has been cancelled

对齐编译器 t.py 的 _CNAME_ALIAS(char/short/long/unsigned 等是语言内置名称,
无需 import):在 builtins.vpi 内置 long → t.CLong、longlong → t.CLongLong。
C 的 "long long" 含空格不能作标识符,故 Viper 写作 longlong;无符号形式仍可用
t.CUnsignedLongLong。

回归用例补充 g(e: long, h: longlong) -> long 的注解类型断言(CLong/CLongLong)。
版本号提升至 1.1.418 并更新 CHANGELOG。
This commit is contained in:
TermiNexus committed 2026-09-22 20:39:52 +08:00
1 parent f547737cf0
commit 4bc462e0f3
9 files changed
+32 -9

No files matched your search

+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "vipeye-internal",
"version": "1.1.417",
"version": "1.1.418",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "vipeye-internal",
"version": "1.1.417",
"version": "1.1.418",
"license": "MIT",
"dependencies": {
"@yarnpkg/fslib": "2.10.4",
+1 -1
View File
@@ -2,7 +2,7 @@
"name": "vipeye-internal",
"displayName": "vipeye",
"description": "Type checker for the Viper language",
"version": "1.1.417",
"version": "1.1.418",
"license": "MIT",
"private": true,
"files": [
@@ -314,6 +314,9 @@ test('无 includes/builtins.vp 时,内建 builtins.vpi 提供 uint32/sizet/int
def f(a: uint32, b: sizet, c: int8, d: uint64) -> uint32:
return a
def g(e: long, h: longlong) -> long:
return e
`,
'utf8'
);
@@ -365,6 +368,15 @@ def f(a: uint32, b: sizet, c: int8, d: uint64) -> uint32:
);
}
// C 基本类型名:long → CLong,longlong → CLongLong
const gTypes = types.get('g') ?? [];
for (const expected of ['CLong', 'CLongLong']) {
assert(
gTypes.some((t) => t.includes(expected)),
`g() 参数注解应包含 ${expected},实际: ${JSON.stringify(gTypes)}`
);
}
program.dispose();
serviceProvider.dispose();
fs.rmSync(testRoot, { recursive: true, force: true });
@@ -2751,6 +2751,13 @@ rawptr: t.CTypedef = t.CPtr
# "未定义"(同一工程在不同编辑器里表现不一致)。
# 因此在 builtins stub 中内建一份等价声明:任意 Viper 工程无需配置 includes 即可
# 解析;工程自带 builtins.vp 时仍以工程声明为准(合并逻辑会覆盖同名符号)。
#
# C 基本类型名(对齐编译器 t.py 的 _CNAME_ALIAS:char/short/long/unsigned 等是
# 语言内置名称,无需 import)。C 的 "long long" 含空格、不能作标识符,Viper 写作
# longlong;"unsigned long long" 同理不内建,需要时写 t.CUnsignedLongLong。
long: t.CTypedef = t.CLong
longlong: t.CTypedef = t.CLongLong
sizet: t.CTypedef = t.CSizeT
size_t: t.CTypedef = sizet
uzt: t.CTypedef = sizet
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "vipeye",
"version": "1.1.417",
"version": "1.1.418",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "vipeye",
"version": "1.1.417",
"version": "1.1.418",
"license": "MIT",
"bin": {
"vipeye": "index.js",
+1 -1
View File
@@ -2,7 +2,7 @@
"name": "vipeye",
"displayName": "Vipeye",
"description": "Type checker for the Viper language",
"version": "1.1.417",
"version": "1.1.418",
"license": "MIT",
"author": {
"name": "TermiNexus"
+4
View File
@@ -1,5 +1,9 @@
# Change Log
## 1.1.418
- **Built-in C basic type names**: `long` (`t.CLong`) and `longlong` (`t.CLongLong`) are now built-in typedefs, mirroring the compiler's `_CNAME_ALIAS` table (`char`, `short`, `long`, `unsigned` and friends are language built-ins that need no import). C's `long long` cannot be spelled with a space, so Viper writes `longlong`; the unsigned form stays available as `t.CUnsignedLongLong`
## 1.1.417
- **Built-in C integer typedefs**: `sizet`, `size_t`, `uzt`, `int8`–`uint64`, `intfast*`/`uintfast*`, `intleast*`/`uintleast*` are now declared in the built-in `builtins.vpi` stub, mirroring the compiler's `includes/builtins.vp`. Any Viper project resolves them without configuring `includes`, which fixes `uint32` (and the rest) being reported as undefined in setups where the project-level `builtins.vp` cannot be located — that lookup depends on the workspace root and the set of opened files, so the same project could behave differently across editors
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "vscode-vipeye",
"version": "1.1.417",
"version": "1.1.418",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "vscode-vipeye",
"version": "1.1.417",
"version": "1.1.418",
"license": "MIT",
"dependencies": {
"mermaid": "^11.12.0",
+1 -1
View File
@@ -2,7 +2,7 @@
"name": "vscode-vipeye",
"displayName": "Vipeye",
"description": "VS Code language support for Viper (LSP client)",
"version": "1.1.417",
"version": "1.1.418",
"private": true,
"license": "MIT",
"author": {