Prompt
Ensure code follows established Swift naming conventions and remains consistent with domain terminology:
- Use standard Swift parameter labels (e.g., use
named:instead ofcalled:): ```swift // Incorrect func expectOne(called name: String, among candidates: [T]) throws -> T { ... }
// Correct
func expectOne
2. Organize functions as methods on relevant types when appropriate:
```swift
// Less idiomatic
public func operandNames(for inst: Instruction) -> [String]? { ... }
// More idiomatic
extension Instruction {
public var operandNames: [String]? { ... }
}
-
Use domain-specific terminology consistently (e.g., “operand names” not “registers” in SIL context)
-
Avoid redundancy in type names, especially in enum cases: ```swift // Redundant public indirect enum Type { case addressType(_ type: Type) }
// Concise public indirect enum Type { case address(Type) } ```
- Maintain consistency with existing codebase conventions (e.g., using
instinstead ofinstrfor variables if that’s the established pattern)