Reputation: 3591
I have a Swift Macro that does the following:
assertMacroExpansion(
#"""
struct MyStruct { var count: Int }
let obj = MyStruct(count: 42)
#destr(obj, \.count)
"""#,
expandedSource:
#"""
struct MyStruct { var count: Int }
let obj = MyStruct(count: 42)
let count = obj[keyPath: \.count]
"""#,
macros: testMacros)
The test passes, and expanding the macro in "main.swift" yields the desired result. However, I get the compiler error that the constant with the identifier cannot be found in scope like so:
I have found this Github Issue that may be related to the issue I'm experiencing.
Is this possibly a bug or am I doing something wrong?
Upvotes: 1
Views: 212