Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
8ba6c45
Align QuickInfo colors with classification colors
cartermp Jun 25, 2020
01a74f0
Color methods in tooltips properly
cartermp Jun 26, 2020
01d0e39
Tag locals and see if we can tag functions better
cartermp Jun 27, 2020
92e4d1a
Tag interface when value or return value properly
cartermp Jun 27, 2020
a5c7583
tag intrinsics better and refactor
cartermp Jun 27, 2020
f050fc4
Color functions in tooltips + consistent operator treatment
cartermp Jun 28, 2020
fa325fc
tag abbreviations for value types as value types
cartermp Jun 28, 2020
65b618e
Move isFunction and use it in pretty-printing
cartermp Jun 28, 2020
daa0be7
Be a little smarter about laying out IL reference and value types
cartermp Jun 29, 2020
a936718
Use entirely different routine for laying out object data
cartermp Jun 30, 2020
fc7ca1b
Don't show 'inherit ValueType'
cartermp Jun 30, 2020
5e0a8e1
filter out ctors when looking at methods
cartermp Jun 30, 2020
aa65819
Lay out everything else for types
cartermp Jun 30, 2020
a9ca0c9
final formatting changes for props probably
cartermp Jun 30, 2020
4380cde
Simplify
cartermp Jun 30, 2020
b418fc9
remove as much ILTyeRef printing as possible (so far)
cartermp Jun 30, 2020
ee15fb4
updates
cartermp Jul 1, 2020
ac0a377
remove nonsense + commented out stuff
cartermp Jul 1, 2020
d011ecf
Don't show compiler-generated interfaces for record/union/struct
cartermp Jul 1, 2020
8fda6b0
testing updates and some tweaks
cartermp Jul 1, 2020
040d00f
Updates
cartermp Jul 1, 2020
d2659a9
Updates
cartermp Jul 2, 2020
47d0255
updates
cartermp Jul 2, 2020
66d8ec1
updates
cartermp Jul 2, 2020
1a4ebf8
Update more tests
cartermp Jul 2, 2020
aedc087
updates
cartermp Jul 2, 2020
97518d8
updates + small refactor
cartermp Jul 2, 2020
92ab13f
test updates
cartermp Jul 2, 2020
30e0929
Test updates
cartermp Jul 3, 2020
b0e44e7
Don't shrink overloads when printing signatures
cartermp Jul 3, 2020
25f25dc
print members consistently
cartermp Jul 6, 2020
c901275
Update tests
cartermp Jul 6, 2020
6eaf3e1
test updates
cartermp Jul 7, 2020
8f33f3f
Update fsharpqa tests
cartermp Jul 7, 2020
624e48b
Handle delegates
cartermp Jul 7, 2020
2db31cb
Enums
cartermp Jul 7, 2020
2ecb32d
Show struct attribute for all structs
cartermp Jul 7, 2020
e2d8d00
Filter class constructors
cartermp Jul 8, 2020
b53677e
cleanup and test update
cartermp Jul 8, 2020
e0bf942
more filter
cartermp Jul 9, 2020
48a6b34
additional option for sigs
cartermp Jul 10, 2020
9a9f326
Updates
cartermp Jul 11, 2020
4ea1dae
cleanup
cartermp Jul 11, 2020
02ad676
more cleanup
cartermp Jul 11, 2020
b8fa5c9
Update printing baselines
cartermp Jul 11, 2020
55b4bbd
Don't omit attribute + clean up discard intrinsics (found almost excl…
cartermp Jul 11, 2020
0ef41a8
Test updates
cartermp Jul 12, 2020
a655036
Test updates
cartermp Jul 12, 2020
6a90d81
Test updates
cartermp Jul 13, 2020
6fcc552
Test updates
cartermp Jul 13, 2020
c88bc49
Fix 6160
cartermp Jul 13, 2020
fac0338
Fix classification for unresolved/impossible-to-construct constructors
cartermp Jul 13, 2020
f6dbaab
update test again lol
cartermp Jul 13, 2020
4027233
Updates
cartermp Aug 26, 2020
983c44b
Update
cartermp Aug 26, 2020
76beeda
Update netstandard surface
cartermp Aug 26, 2020
4ad02be
Try updating this baseline I guess
cartermp Sep 6, 2020
7f28a88
merge
cartermp Nov 12, 2020
4f9e718
yoop
cartermp Nov 12, 2020
b5a8f40
Update baselines
cartermp Nov 13, 2020
65506bd
Feedback
cartermp Nov 17, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Be a little smarter about laying out IL reference and value types
  • Loading branch information
cartermp committed Nov 12, 2020
commit daa0be7f9b66c278a1c7ae0c73a01dc643706964
26 changes: 13 additions & 13 deletions src/fsharp/NicePrint.fs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ module private PrintIL =
let fullySplitILTypeRef (tref: ILTypeRef) =
(List.collect IL.splitNamespace (tref.Enclosing @ [PrettyNaming.DemangleGenericTypeName tref.Name]))

let layoutILTypeRefName denv path =
let layoutILTypeRefName isValueType denv path =
let path =
match path with
| [ "System"; "Void" ] -> ["unit"]
Expand All @@ -139,22 +139,22 @@ module private PrintIL =
| [ "System"; "Int32" ] -> ["int" ]
| [ "System"; "Int64" ] -> ["int64" ]
| [ "System"; "UInt16" ] -> ["uint16" ]
| [ "System"; "UInt32" ] -> ["uint32" ]
| [ "System"; "UInt32" ] -> ["uint" ]
| [ "System"; "UInt64" ] -> ["uint64" ]
| [ "System"; "IntPtr" ] -> ["nativeint" ]
| [ "System"; "UIntPtr" ] -> ["unativeint" ]
| [ "System"; "Boolean"] -> ["bool"]
| _ -> path
let p2, n = List.frontAndBack path
let tagged = if n = "obj" || n = "string" then tagClass n else tagStruct n
let tagged = if isValueType then tagStruct n else tagClass n
if denv.shortTypeNames then
wordL tagged
else
leftL (tagNamespace (trimPathByDisplayEnv denv p2)) ^^ wordL tagged

let layoutILTypeRef denv tref =
let layoutILTypeRef isValueType denv tref =
let path = fullySplitILTypeRef tref
layoutILTypeRefName denv path
layoutILTypeRefName isValueType denv path

/// this fixes up a name just like adjustILName but also handles F#
/// operators
Expand Down Expand Up @@ -195,8 +195,8 @@ module private PrintIL =
match ty with
| ILType.Void -> WordL.structUnit // These are type-theoretically totally different type-theoretically `void` is Fin 0 and `unit` is Fin (S 0) ... but, this looks like as close as we can get.
| ILType.Array (sh, t) -> layoutILType denv ilTyparSubst t ^^ layoutILArrayShape sh
| ILType.Value t
| ILType.Boxed t -> layoutILTypeRef denv t.TypeRef ^^ (t.GenericArgs |> List.map (layoutILType denv ilTyparSubst) |> paramsL)
| ILType.Value t -> layoutILTypeRef true denv t.TypeRef ^^ (t.GenericArgs |> List.map (layoutILType denv ilTyparSubst) |> paramsL)
| ILType.Boxed t -> layoutILTypeRef false denv t.TypeRef ^^ (t.GenericArgs |> List.map (layoutILType denv ilTyparSubst) |> paramsL)
| ILType.Ptr t
| ILType.Byref t -> layoutILType denv ilTyparSubst t
| ILType.FunctionPointer t -> layoutILCallingSignature denv ilTyparSubst None t
Expand All @@ -215,7 +215,7 @@ module private PrintIL =
| Some className ->
let names = SplitNamesForILPath (PrettyNaming.DemangleGenericTypeName className)
// special case for constructor return-type (viz., the class itself)
layoutILTypeRefName denv names ^^ (pruneParams className ilTyparSubst |> paramsL)
layoutILTypeRefName false denv names ^^ (pruneParams className ilTyparSubst |> paramsL)
| None ->
signature.ReturnType |> layoutILType denv ilTyparSubst

Expand Down Expand Up @@ -251,7 +251,7 @@ module private PrintIL =
match cons with
| Some className ->
let names = SplitNamesForILPath (PrettyNaming.DemangleGenericTypeName className)
layoutILTypeRefName denv names ^^ (pruneParams className ilTyparSubst |> paramsL)
layoutILTypeRefName false denv names ^^ (pruneParams className ilTyparSubst |> paramsL)
| None -> retType |> layoutILType denv ilTyparSubst

match parameters with
Expand Down Expand Up @@ -684,7 +684,7 @@ module private PrintTypes =
name
let tref = ilMethRef.DeclaringTypeRef
let tref = ILTypeRef.Create(scope= tref.Scope, enclosing=tref.Enclosing, name=trimmedName)
PrintIL.layoutILTypeRef denv tref ++ argsL
PrintIL.layoutILTypeRef true denv tref ++ argsL
| FSAttrib vref ->
// REVIEW: this is not trimming "Attribute"
let _, _, _, rty, _ = GetTypeOfMemberInMemberForm denv.g vref
Expand Down Expand Up @@ -727,7 +727,7 @@ module private PrintTypes =
LeftL.keywordTypeof ^^ SepL.leftAngle ^^ PrintIL.layoutILType denv [] ty ^^ RightL.rightAngle
| ILAttribElem.Type None -> wordL (tagText "")
| ILAttribElem.TypeRef (Some ty) ->
LeftL.keywordTypedefof ^^ SepL.leftAngle ^^ PrintIL.layoutILTypeRef denv ty ^^ RightL.rightAngle
LeftL.keywordTypedefof ^^ SepL.leftAngle ^^ PrintIL.layoutILTypeRef false denv ty ^^ RightL.rightAngle
| ILAttribElem.TypeRef None -> emptyL

and layoutILAttrib denv (ty, args) =
Expand Down Expand Up @@ -2233,9 +2233,9 @@ let stringOfParamData denv paramData = bufs (fun buf -> InfoMemberPrinting.forma

let layoutOfParamData denv paramData = InfoMemberPrinting.layoutParamData denv paramData

let outputILTypeRef denv os x = x |> PrintIL.layoutILTypeRef denv |> bufferL os
let outputILTypeRef isValueType denv os x = x |> PrintIL.layoutILTypeRef isValueType denv |> bufferL os

let layoutILTypeRef denv x = x |> PrintIL.layoutILTypeRef denv
let layoutILTypeRef isValueType denv x = x |> PrintIL.layoutILTypeRef isValueType denv

let outputExnDef denv os x = x |> TastDefinitionPrinting.layoutExnDefn denv |> bufferL os

Expand Down
4 changes: 2 additions & 2 deletions src/fsharp/symbols/SymbolHelpers.fs
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,7 @@ module internal SymbolHelpers =
| Item.AnonRecdField(anon, _argTys, i, _) -> anon.SortedNames.[i]
| Item.RecdField rfinfo -> fullDisplayTextOfRecdFieldRef rfinfo.RecdFieldRef
| Item.NewDef id -> id.idText
| Item.ILField finfo -> bufs (fun os -> NicePrint.outputILTypeRef denv os finfo.ILTypeRef; bprintf os ".%s" finfo.FieldName)
| Item.ILField finfo -> bufs (fun os -> NicePrint.outputILTypeRef finfo.IsValueType denv os finfo.ILTypeRef; bprintf os ".%s" finfo.FieldName)
| Item.Event einfo -> bufs (fun os -> NicePrint.outputTyconRef denv os einfo.DeclaringTyconRef; bprintf os ".%s" einfo.EventName)
| Item.Property(_, (pinfo :: _)) -> bufs (fun os -> NicePrint.outputTyconRef denv os pinfo.DeclaringTyconRef; bprintf os ".%s" pinfo.PropertyName)
| Item.CustomOperation (customOpName, _, _) -> customOpName
Expand Down Expand Up @@ -1135,7 +1135,7 @@ module internal SymbolHelpers =
| Item.ILField finfo ->
let layout =
wordL (tagText (FSComp.SR.typeInfoField())) ^^
NicePrint.layoutILTypeRef denv finfo.ILTypeRef ^^
NicePrint.layoutILTypeRef finfo.IsValueType denv finfo.ILTypeRef ^^
SepL.dot ^^
wordL (tagField finfo.FieldName) ^^
RightL.colon ^^
Expand Down