#989·expr

`find`,`findIndex`,`first` 和 `get` 以元素类型进行类型检查,它们返回 nil

作者: DRMacIver创建于 2026年9月23日更新于 2026年9月27日

`first` of an empty `[]int`, `get` with an out-of-range index and `find`/`findIndex` with no match are all type-checked as `int`, so `AsInt()` with `WarnOnAny()` accepts them at compile time and `Run` then fails with `invalid operation: int(<nil>)`; the same `find` over a `[]any` array is refused at compile time: