Skip to content

Commit b3c5a23

Browse files
committed
wip
1 parent f1ca26a commit b3c5a23

File tree

3 files changed

+36
-23
lines changed

3 files changed

+36
-23
lines changed

src/Compiler/TypedTree/TcGlobals.fs

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -966,27 +966,28 @@ type TcGlobals(
966966
let mkDebuggerTypeProxyAttribute (ty : ILType) = mkILCustomAttribute (findSysILTypeRef tname_DebuggerTypeProxyAttribute, [ilg.typ_Type], [ILAttribElem.TypeRef (Some ty.TypeRef)], [])
967967

968968
let betterTyconEntries =
969-
[| "Int32" , v_int_tcr
970-
"IntPtr" , v_nativeint_tcr
971-
"UIntPtr" , v_unativeint_tcr
972-
"Int16" , v_int16_tcr
973-
"Int64" , v_int64_tcr
974-
"UInt16" , v_uint16_tcr
975-
"UInt32" , v_uint32_tcr
976-
"UInt64" , v_uint64_tcr
977-
"SByte" , v_sbyte_tcr
978-
"Decimal" , v_decimal_tcr
979-
"Byte" , v_byte_tcr
980-
"Boolean" , v_bool_tcr
981-
"String" , v_string_tcr
982-
"Object" , v_obj_tcr
983-
"Exception", v_exn_tcr
984-
"Char" , v_char_tcr
985-
"Double" , v_float_tcr
986-
"Single" , v_float32_tcr |]
987-
|> Array.map (fun (nm, tcr) ->
969+
[| sys, "Int32" , v_int_tcr
970+
sys, "IntPtr" , v_nativeint_tcr
971+
sys, "UIntPtr" , v_unativeint_tcr
972+
sys, "Int16" , v_int16_tcr
973+
sys, "Int64" , v_int64_tcr
974+
sys, "UInt16" , v_uint16_tcr
975+
sys, "UInt32" , v_uint32_tcr
976+
sys, "UInt64" , v_uint64_tcr
977+
sys, "SByte" , v_sbyte_tcr
978+
sys, "Decimal" , v_decimal_tcr
979+
sys, "Byte" , v_byte_tcr
980+
sys, "Boolean" , v_bool_tcr
981+
sys, "String" , v_string_tcr
982+
sys, "Object" , v_obj_tcr
983+
sys, "Exception" , v_exn_tcr
984+
sys, "Char" , v_char_tcr
985+
sys, "Double" , v_float_tcr
986+
sys, "Single" , v_float32_tcr
987+
sysGenerics, "IEnumerable`1", v_seq_tcr |]
988+
|> Array.map (fun (sysLib, nm, tcr) ->
988989
let ty = mkNonGenericTy tcr
989-
nm, findSysTyconRef sys nm, (fun _ nullness ->
990+
nm, findSysTyconRef sysLib nm, (fun _ nullness ->
990991
match nullness with
991992
| Nullness.Known NullnessInfo.WithoutNull -> ty
992993
| _ -> mkNonGenericTyWithNullness tcr nullness))

tests/FSharp.Compiler.Service.Tests/EditorTests.fs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,15 +130,15 @@ let ``GetMethodsAsSymbols should return all overloads of a method as FSharpSymbo
130130
yield ms.Symbol.DisplayName, extractCurriedParams ms ]
131131
|> List.sortBy (fun (_name, parameters) -> parameters.Length, (parameters |> List.map snd ))
132132
let expected =
133-
[("Concat", [("values", "Collections.Generic.IEnumerable<'T>")]);
134-
("Concat", [("values", "Collections.Generic.IEnumerable<string>")]);
133+
[("Concat", [("values", "'T seq")]);
135134
#if NETCOREAPP
136135
("Concat", [("args", "ReadOnlySpan<obj>")]);
137136
("Concat", [("values", "ReadOnlySpan<string>")]);
138137
#endif
139138
("Concat", [("arg0", "obj")]);
140139
("Concat", [("args", "obj array")]);
141-
("Concat", [("values", "string array")]);
140+
("Concat", [("values", "string array")])
141+
("Concat", [("values", "string seq")])
142142
#if NETCOREAPP
143143
("Concat", [("str0", "ReadOnlySpan<char>");("str1", "ReadOnlySpan<char>")]);
144144
#endif

tests/FSharp.Compiler.Service.Tests/Symbols.fs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,18 @@ let f2 b1 b2 b3 b4 b5 =
521521
let ``Nullable types`` declaredType formattedType =
522522
let _, checkResults = getParseAndCheckResults $"""
523523
let f (x: {declaredType}) = ()
524+
"""
525+
let symbolUse = findSymbolUseByName "x" checkResults
526+
let symbol = symbolUse.Symbol :?> FSharpMemberOrFunctionOrValue
527+
let typeArg = symbol.FullType
528+
typeArg.Format(symbolUse.DisplayContext) |> shouldEqual formattedType
529+
530+
[<Theory>]
531+
[<InlineData("IEnumerable<int>", "int seq")>]
532+
let ``Format IEnumerable as seq`` declaredType formattedType =
533+
let _, checkResults = getParseAndCheckResults $"""
534+
open System.Collections.Generic
535+
let f (x: {declaredType}) = ()
524536
"""
525537
let symbolUse = findSymbolUseByName "x" checkResults
526538
let symbol = symbolUse.Symbol :?> FSharpMemberOrFunctionOrValue

0 commit comments

Comments
 (0)