Skip to content

Commit 4762985

Browse files
committed
[ASTGen] Add diagnostics stubs for some builting pound syntax
1 parent 92a6fec commit 4762985

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

lib/ASTGen/Sources/ASTGen/BuiltinPound.swift

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,15 @@ extension ASTGenVisitor {
119119
// return
120120
}
121121

122+
guard
123+
node.genericArgumentClause == nil,
124+
node.trailingClosure == nil,
125+
node.additionalTrailingClosures.isEmpty
126+
else {
127+
// TODO: Diagnose.
128+
fatalError("#error/#warning with generic specialization")
129+
}
130+
122131
guard node.arguments.count == 1,
123132
let arg = node.arguments.first,
124133
arg.label == nil,
@@ -195,6 +204,15 @@ extension ASTGenVisitor {
195204
}
196205

197206
func generateObjCSelectorExpr(freestandingMacroExpansion node: some FreestandingMacroExpansionSyntax) -> BridgedExpr {
207+
guard
208+
node.genericArgumentClause == nil,
209+
node.trailingClosure == nil,
210+
node.additionalTrailingClosures.isEmpty
211+
else {
212+
// TODO: Diagnose.
213+
fatalError("#selector with generic specialization")
214+
}
215+
198216
var args = node.arguments[...]
199217
guard let arg = args.popFirst() else {
200218
// TODO: Diagnose
@@ -229,6 +247,14 @@ extension ASTGenVisitor {
229247
}
230248

231249
func generateObjCKeyPathExpr(freestandingMacroExpansion node: some FreestandingMacroExpansionSyntax) -> BridgedExpr {
250+
guard
251+
node.genericArgumentClause == nil,
252+
node.trailingClosure == nil,
253+
node.additionalTrailingClosures.isEmpty
254+
else {
255+
// TODO: Diagnose.
256+
fatalError("#keyPath with generic specialization")
257+
}
232258

233259
var names: [BridgedDeclNameRef] = []
234260
var nameLocs: [BridgedDeclNameLoc] = []

0 commit comments

Comments
 (0)