示例工程 24-performance-instruments

24-performance-instruments/Diagnostics/README.md

markdown · 0.5 KB

# Diagnostics
 
两个文件**故意编译失败**;一个文件演示 `-Ounchecked` 的语义变化。
 
```bash
swiftc -typecheck Diagnostics/MissingOSImport.swift  # error: cannot find 'OSSignposter' in scope
swiftc -typecheck Diagnostics/DurationPlusInt.swift  # error: binary operator '+' cannot be applied to 'Duration' and 'Int'
swiftc Diagnostics/PreconditionRemoved.swift -o /tmp/pre && /tmp/pre
swiftc -Ounchecked Diagnostics/PreconditionRemoved.swift -o /tmp/pre-u && /tmp/pre-u
```