I just implemented this for EnumeratorMacro:
This will basically report back if a function call is invalid, and won't result in a silent failure.
Note that this is only possible because EnumeratorMacro defines its own wrapper types to have control over the transforms.
How it works is using a TaskLocal: https://github.com/MahdiBM/enumerator-macro/blob/0a1b67d2941dec346f59f06d0c7c86888712aae0/Sources/EnumeratorMacroImpl/EnumeratorMacroType.swift#L50
Which are used to store an error: https://github.com/MahdiBM/enumerator-macro/blob/0a1b67d2941dec346f59f06d0c7c86888712aae0/Sources/EnumeratorMacroImpl/Types/EString.swift#L70
I think swift-mustache can also have such an option. If the user has inserted a value for the TaskLocal, swift-mustache will populate it. swift-mustache seems a nil task-local value and just moves on with the current behavior.
The TaskLocal should be defined in swift-mustache, but it just defaults to nil which would result in no capturing of errors.
I just implemented this for EnumeratorMacro:
This will basically report back if a function call is invalid, and won't result in a silent failure.
Note that this is only possible because
EnumeratorMacrodefines its own wrapper types to have control over the transforms.How it works is using a
TaskLocal: https://github.com/MahdiBM/enumerator-macro/blob/0a1b67d2941dec346f59f06d0c7c86888712aae0/Sources/EnumeratorMacroImpl/EnumeratorMacroType.swift#L50Which are used to store an error: https://github.com/MahdiBM/enumerator-macro/blob/0a1b67d2941dec346f59f06d0c7c86888712aae0/Sources/EnumeratorMacroImpl/Types/EString.swift#L70
I think swift-mustache can also have such an option. If the user has inserted a value for the TaskLocal, swift-mustache will populate it. swift-mustache seems a
niltask-local value and just moves on with the current behavior.The TaskLocal should be defined in swift-mustache, but it just defaults to
nilwhich would result in no capturing of errors.