@@ -71,6 +71,37 @@ module private PrintUtilities =
7171| ( x:: rest) -> [ resultFunction x( layoutFunction x-- leftL( match rest.Lengthwith 1 -> FSComp.SR.nicePrintOtherOverloads1() | n-> FSComp.SR.nicePrintOtherOverloadsN( n))) ]
7272| _ -> []
7373
74+ /// Layout a reference to a type
75+ let layoutTyconRefImpl isAttribute ( denv : DisplayEnv ) ( tcref : TyconRef ) =
76+ let demangled =
77+ let name =
78+ if denv.includeStaticParametersInTypeNamesthen
79+ tcref.DisplayNameWithStaticParameters
80+ elif tcref.DisplayName= tcref.DisplayNameWithStaticParametersthen
81+ tcref.DisplayName// has no static params
82+ else
83+ tcref.DisplayName+ " <...>" // shorten
84+ if isAttributethen
85+ defaultArg( String.tryDropSuffix name" Attribute" ) name
86+ else name
87+ let tyconTextL = wordL demangled
88+ if denv.shortTypeNamesthen
89+ tyconTextL
90+ else
91+ let path = demangledPathOfCompPath tcref.CompilationPath
92+ let path =
93+ if denv.includeStaticParametersInTypeNamesthen
94+ path
95+ else
96+ path|> List.map( fun s -> let i = s.IndexOf( ',' )
97+ if i<> - 1 then s.Substring( 0 , i)+ " <...>" // apparently has static params, shorten
98+ else s)
99+ let pathText = trimPathByDisplayEnv denv path
100+ if pathText= " " then tyconTextLelse leftL pathText^^ tyconTextL
101+
102+ let layoutTyconAttribute ( denv : DisplayEnv ) ( tcref : TyconRef ) =
103+ squareAngleL( layoutTyconRefImpltrue denv tcref)
104+
74105module private PrintIL =
75106
76107open Microsoft.FSharp .Compiler .AbstractIL .IL
@@ -185,7 +216,9 @@ module private PrintIL =
185216// Layout an unnamed argument
186217| _, None, _ -> leftL" :"
187218// Layout a named argument
188- | true , Some nm,_ -> wordL" params" ^^ leftL( nm+ " :" )
219+ | true , Some nm,_ ->
220+ let typ = denv.g.attrib_ ParamArrayAttribute.TyconRef
221+ layoutTyconAttribute denv typ^^ leftL( nm+ " :" )
189222| false , Some nm,_ -> leftL( nm+ " :" )
190223 preL^^ ( layoutILType denv ilTyparSubst p.Type)
191224
@@ -549,28 +582,7 @@ module private PrintTypes =
549582| Internal, Private-> wordL" private" ++ itemL// print modifier, since more specific than context
550583| _ -> itemL
551584
552- /// Layout a reference to a type
553- let layoutTyconRef ( denv : DisplayEnv ) ( tcref : TyconRef ) =
554- let demangled = if denv.includeStaticParametersInTypeNamesthen
555- tcref.DisplayNameWithStaticParameters
556- elif tcref.DisplayName= tcref.DisplayNameWithStaticParametersthen
557- tcref.DisplayName// has no static params
558- else
559- tcref.DisplayName+ " <...>" // shorten
560- let tyconTextL = wordL demangled
561- if denv.shortTypeNamesthen
562- tyconTextL
563- else
564- let path = demangledPathOfCompPath tcref.CompilationPath
565- let path =
566- if denv.includeStaticParametersInTypeNamesthen
567- path
568- else
569- path|> List.map( fun s -> let i = s.IndexOf( ',' )
570- if i<> - 1 then s.Substring( 0 , i)+ " <...>" // apparently has static params, shorten
571- else s)
572- let pathText = trimPathByDisplayEnv denv path
573- if pathText= " " then tyconTextLelse leftL pathText^^ tyconTextL
585+ let layoutTyconRef denv tycon = layoutTyconRefImplfalse denv tycon
574586
575587/// Layout the flags of a member
576588let layoutMemberFlags memFlags =
@@ -918,7 +930,13 @@ module private PrintTypes =
918930 layoutTypeWithInfoAndPrec denv env2 ty
919931// Layout a named argument
920932| Some id,_, isParamArray,_ ->
921- leftL(( if isParamArraythen " params" else " " ) + id.idText) ^^ sepL" :" ^^ layoutTypeWithInfoAndPrec denv env2 ty
933+ let prefix =
934+ if isParamArraythen
935+ let typ = denv.g.attrib_ ParamArrayAttribute.TyconRef
936+ layoutTyconAttribute denv typ^^ leftL id.idText
937+ else
938+ leftL id.idText
939+ prefix^^ sepL" :" ^^ layoutTypeWithInfoAndPrec denv env2 ty
922940
923941let delimitReturnValue = if denv.useColonForReturnTypethen " :" else " ->"
924942
@@ -1147,7 +1165,9 @@ module InfoMemberPrinting =
11471165 outputTy denv os pty;
11481166// Layout a named argument
11491167| true , Some nm,_,_ ->
1150- bprintf os" params%s :" nm
1168+ let typ = denv.g.attrib_ ParamArrayAttribute.TyconRef
1169+ layoutTyconAttribute denv typ|> bufferL os
1170+ bprintf os" %s :" nm
11511171 outputTy denv os pty
11521172| false , Some nm,_,_ ->
11531173 bprintf os" %s :" nm