reflect_and_annotation

Installation
SKILL.md

仓颉语言反射与注解 Skill

1. 注解

1.1 整数溢出注解

三种内置注解控制函数的溢出策略:

  • @OverflowThrowing(默认):溢出时抛出 ArithmeticException。尽可能在编译时检测
  • @OverflowWrapping:截断高位(模运算)
  • @OverflowSaturating:饱和到类型最小/最大值

可溢出的运算符:+、-、*、/、**、++、--、<<、+=、-=、*=、/=、**=、<<=

1.2 测试框架注解

  • @EnsurePreparedToMock 为静态/顶层声明准备 mock
  • 仅在 --test/--mock=on 编译时允许
Installs
4
First Seen
Mar 11, 2026
reflect_and_annotation — kong-baiming/cangjie-doc-skills