@@ -704,6 +704,8 @@ func expandAttachedMacro(
704
704
macroKind: UInt8 ,
705
705
discriminatorText: UnsafePointer < UInt8 > ,
706
706
discriminatorTextLength: Int ,
707
+ qualifiedTypeText: UnsafePointer < UInt8 > ,
708
+ qualifiedTypeLength: Int ,
707
709
rawMacroRole: UInt8 ,
708
710
customAttrSourceFilePtr: UnsafeRawPointer ,
709
711
customAttrSourceLocPointer: UnsafePointer < UInt8 > ? ,
@@ -755,6 +757,12 @@ func expandAttachedMacro(
755
757
)
756
758
let discriminator = String ( decoding: discriminatorBuffer, as: UTF8 . self)
757
759
760
+ let qualifiedTypeBuffer = UnsafeBufferPointer (
761
+ start: qualifiedTypeText, count: qualifiedTypeLength
762
+ )
763
+ let qualifiedType = String ( decoding: qualifiedTypeBuffer, as: UTF8 . self)
764
+
765
+
758
766
let expandedSource : String ?
759
767
switch MacroPluginKind ( rawValue: macroKind) ! {
760
768
case . Executable:
@@ -763,6 +771,7 @@ func expandAttachedMacro(
763
771
macroPtr: macroPtr,
764
772
rawMacroRole: rawMacroRole,
765
773
discriminator: discriminator,
774
+ qualifiedType: qualifiedType,
766
775
customAttrSourceFilePtr: customAttrSourceFilePtr,
767
776
customAttrNode: customAttrNode,
768
777
declarationSourceFilePtr: declarationSourceFilePtr,
@@ -775,6 +784,7 @@ func expandAttachedMacro(
775
784
macroPtr: macroPtr,
776
785
rawMacroRole: rawMacroRole,
777
786
discriminator: discriminator,
787
+ qualifiedType: qualifiedType,
778
788
customAttrSourceFilePtr: customAttrSourceFilePtr,
779
789
customAttrNode: customAttrNode,
780
790
declarationSourceFilePtr: declarationSourceFilePtr,
@@ -795,6 +805,7 @@ func expandAttachedMacroIPC(
795
805
macroPtr: UnsafeRawPointer ,
796
806
rawMacroRole: UInt8 ,
797
807
discriminator: String ,
808
+ qualifiedType: String ,
798
809
customAttrSourceFilePtr: UnsafePointer < ExportedSourceFile > ,
799
810
customAttrNode: AttributeSyntax ,
800
811
declarationSourceFilePtr: UnsafePointer < ExportedSourceFile > ,
@@ -840,6 +851,7 @@ func expandAttachedMacroIPC(
840
851
macro: . init( moduleName: macro. moduleName, typeName: macro. typeName, name: macroName) ,
841
852
macroRole: macroRole,
842
853
discriminator: discriminator,
854
+ qualifiedType: qualifiedType,
843
855
attributeSyntax: customAttributeSyntax,
844
856
declSyntax: declSyntax,
845
857
parentDeclSyntax: parentDeclSyntax)
@@ -906,6 +918,7 @@ func expandAttachedMacroInProcess(
906
918
macroPtr: UnsafeRawPointer ,
907
919
rawMacroRole: UInt8 ,
908
920
discriminator: String ,
921
+ qualifiedType: String ,
909
922
customAttrSourceFilePtr: UnsafePointer < ExportedSourceFile > ,
910
923
customAttrNode: AttributeSyntax ,
911
924
declarationSourceFilePtr: UnsafePointer < ExportedSourceFile > ,
@@ -951,13 +964,15 @@ func expandAttachedMacroInProcess(
951
964
)
952
965
let declarationNode = sourceManager. detach ( declarationNode)
953
966
let parentDeclNode = parentDeclNode. map { sourceManager. detach ( $0) }
967
+ let extendedType : TypeSyntax = " \( raw: qualifiedType) "
954
968
955
969
return SwiftSyntaxMacroExpansion . expandAttachedMacro (
956
970
definition: macro,
957
971
macroRole: MacroRole ( rawMacroRole: rawMacroRole) ,
958
972
attributeNode: attributeNode,
959
973
declarationNode: declarationNode,
960
974
parentDeclNode: parentDeclNode,
975
+ extendedType: extendedType,
961
976
in: context
962
977
)
963
978
}
0 commit comments