示例工程 16-macros-codegen

16-macros-codegen/Diagnostics/README.md

markdown · 0.4 KB

# Diagnostics
 
三个文件**故意编译失败**,用来复现第 16 章「报错现场」的真实诊断。
 
```bash
swiftc Diagnostics/ObservableOnStruct.swift  # error: '@Observable' cannot be applied to struct type
swiftc Diagnostics/MissingImport.swift       # error: unknown attribute 'Observable'
swiftc Diagnostics/ObservableOnVar.swift     # error: 'extension' macro cannot be attached to var
```