Skip to content

Commit eed695d

Browse files
committed
Add some ASTGen tests
1 parent 400bfb2 commit eed695d

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

lib/Macros/Sources/SwiftMacros/DistributedResolvableMacro.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,11 @@ extension DistributedResolvableMacro {
151151
isGenericStub = false
152152

153153
case .expr:
154-
fatalError("Expression type not supported for distributed actor")
154+
throw DiagnosticsError(
155+
syntax: sameTypeReq.rightType,
156+
message: "Expression type not supported for distributed actor",
157+
id: .invalidGenericArgument
158+
)
155159
}
156160

157161
default:
@@ -277,6 +281,7 @@ struct DistributedResolvableMacroDiagnostic: DiagnosticMessage {
277281
enum ID: String {
278282
case invalidApplication = "invalid type"
279283
case missingInitializer = "missing initializer"
284+
case invalidGenericArgument = "invalid generic argument"
280285
}
281286

282287
var message: String

test/ASTGen/decls.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,3 +291,12 @@ struct ValueStruct<let N: Int> {}
291291
func genericTest1<T>(_: T) {}
292292
func genericTest2<each T>(_: repeat each T) {}
293293
func genericTest4<let T: Int>(_: ValueStruct<T>) {}
294+
295+
func concreteValueTest1(_: ValueStruct<123>) {}
296+
func concreteValueTest2(_: ValueStruct<-123>) {}
297+
298+
extension ValueStruct where N == 123 {}
299+
extension ValueStruct where 123 == N {}
300+
extension ValueStruct where N == -123 {}
301+
extension ValueStruct where -123 == N {}
302+

0 commit comments

Comments
 (0)