Files
TransPyV/Test/NegativeTest/App/main.py
2026-07-19 13:18:46 +08:00

22 lines
776 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import stdio
import t, c
# 故意不 import defs.SecretClass — 严格模式下应编译失败
# ============================================================
# 负向测试主入口
#
# 此文件故意不 import SecretClass但尝试使用 SecretClass()。
# 命名空间隔离严格模式下SecretClass 不可见,
# 构造器路径被跳过,生成 call i32 @SecretClass(...)
# llc 报错 "use of undefined value '@SecretClass'"。
#
# 预期TransPyV 编译失败exit code != 0
# ============================================================
def main() -> int:
# SecretClass 未导入,严格模式下不可见
s: SecretClass = SecretClass(42)
v: int = s.GetVal()
stdio.printf("negtest: v=%d (should not reach here)\n", v)
return 0