@@ -674,6 +674,8 @@ func expandAttachedMacro(
674
674
macroKind: UInt8 ,
675
675
discriminatorText: UnsafePointer < UInt8 > ,
676
676
discriminatorTextLength: Int ,
677
+ qualifiedTypeText: UnsafePointer < UInt8 > ,
678
+ qualifiedTypeLength: Int ,
677
679
rawMacroRole: UInt8 ,
678
680
customAttrSourceFilePtr: UnsafeRawPointer ,
679
681
customAttrSourceLocPointer: UnsafePointer < UInt8 > ? ,
@@ -725,6 +727,12 @@ func expandAttachedMacro(
725
727
)
726
728
let discriminator = String ( decoding: discriminatorBuffer, as: UTF8 . self)
727
729
730
+ let qualifiedTypeBuffer = UnsafeBufferPointer (
731
+ start: qualifiedTypeText, count: qualifiedTypeLength
732
+ )
733
+ let qualifiedType = String ( decoding: qualifiedTypeBuffer, as: UTF8 . self)
734
+
735
+
728
736
let expandedSource : String ?
729
737
switch MacroPluginKind ( rawValue: macroKind) ! {
730
738
case . Executable:
@@ -733,6 +741,7 @@ func expandAttachedMacro(
733
741
macroPtr: macroPtr,
734
742
rawMacroRole: rawMacroRole,
735
743
discriminator: discriminator,
744
+ qualifiedType: qualifiedType,
736
745
customAttrSourceFilePtr: customAttrSourceFilePtr,
737
746
customAttrNode: customAttrNode,
738
747
declarationSourceFilePtr: declarationSourceFilePtr,
@@ -745,6 +754,7 @@ func expandAttachedMacro(
745
754
macroPtr: macroPtr,
746
755
rawMacroRole: rawMacroRole,
747
756
discriminator: discriminator,
757
+ qualifiedType: qualifiedType,
748
758
customAttrSourceFilePtr: customAttrSourceFilePtr,
749
759
customAttrNode: customAttrNode,
750
760
declarationSourceFilePtr: declarationSourceFilePtr,
@@ -765,6 +775,7 @@ func expandAttachedMacroIPC(
765
775
macroPtr: UnsafeRawPointer ,
766
776
rawMacroRole: UInt8 ,
767
777
discriminator: String ,
778
+ qualifiedType: String ,
768
779
customAttrSourceFilePtr: UnsafePointer < ExportedSourceFile > ,
769
780
customAttrNode: AttributeSyntax ,
770
781
declarationSourceFilePtr: UnsafePointer < ExportedSourceFile > ,
@@ -810,6 +821,7 @@ func expandAttachedMacroIPC(
810
821
macro: . init( moduleName: macro. moduleName, typeName: macro. typeName, name: macroName) ,
811
822
macroRole: macroRole,
812
823
discriminator: discriminator,
824
+ qualifiedType: qualifiedType,
813
825
attributeSyntax: customAttributeSyntax,
814
826
declSyntax: declSyntax,
815
827
parentDeclSyntax: parentDeclSyntax)
@@ -876,6 +888,7 @@ func expandAttachedMacroInProcess(
876
888
macroPtr: UnsafeRawPointer ,
877
889
rawMacroRole: UInt8 ,
878
890
discriminator: String ,
891
+ qualifiedType: String ,
879
892
customAttrSourceFilePtr: UnsafePointer < ExportedSourceFile > ,
880
893
customAttrNode: AttributeSyntax ,
881
894
declarationSourceFilePtr: UnsafePointer < ExportedSourceFile > ,
@@ -921,13 +934,15 @@ func expandAttachedMacroInProcess(
921
934
)
922
935
let declarationNode = sourceManager. detach ( declarationNode)
923
936
let parentDeclNode = parentDeclNode. map { sourceManager. detach ( $0) }
937
+ let extendedType : TypeSyntax = " \( raw: qualifiedType) "
924
938
925
939
return SwiftSyntaxMacroExpansion . expandAttachedMacro (
926
940
definition: macro,
927
941
macroRole: MacroRole ( rawMacroRole: rawMacroRole) ,
928
942
attributeNode: attributeNode,
929
943
declarationNode: declarationNode,
930
944
parentDeclNode: parentDeclNode,
945
+ extendedType: extendedType,
931
946
in: context
932
947
)
933
948
}
0 commit comments