Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable includeStaticParametersInTypeNames in DisplayEnv. #15319

Merged
merged 3 commits into from
Jun 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 8 additions & 6 deletions src/Compiler/Symbols/Symbols.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2357,13 +2357,15 @@ type FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) =

member x.GetValSignatureText (displayContext: FSharpDisplayContext, m: range) =
checkIsResolved()
let displayEnv = { displayContext.Contents cenv.g with includeStaticParametersInTypeNames = true }

let stringValOfMethInfo methInfo =
match methInfo with
| FSMeth(valRef = vref) -> NicePrint.stringValOrMember (displayContext.Contents cenv.g) cenv.infoReader vref
| _ -> NicePrint.stringOfMethInfo cenv.infoReader m (displayContext.Contents cenv.g) methInfo
| FSMeth(valRef = vref) -> NicePrint.stringValOrMember displayEnv cenv.infoReader vref
| _ -> NicePrint.stringOfMethInfo cenv.infoReader m displayEnv methInfo

let stringValOfPropInfo (p: PropInfo) =
let t = p.GetPropertyType(cenv.amap, m ) |> NicePrint.layoutType (displayContext.Contents cenv.g) |> LayoutRender.showL
let t = p.GetPropertyType(cenv.amap, m ) |> NicePrint.layoutType displayEnv |> LayoutRender.showL
let withGetSet =
if p.HasGetter && p.HasSetter then "with get, set"
elif p.HasGetter then "with get"
Expand All @@ -2375,12 +2377,12 @@ type FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) =
match d with
| E _ -> None
| V v ->
NicePrint.stringValOrMember (displayContext.Contents cenv.g) cenv.infoReader v
NicePrint.stringValOrMember displayEnv cenv.infoReader v
|> Some
| C methInfo
| M methInfo -> stringValOfMethInfo methInfo |> Some
| P p -> stringValOfPropInfo p |> Some


member x.GetWitnessPassingInfo() =
let witnessInfos =
Expand Down
18 changes: 18 additions & 0 deletions tests/service/Symbols.fs
Original file line number Diff line number Diff line change
Expand Up @@ -646,3 +646,21 @@ type Foo() =
member this.Bar (a:int) (b:int) : int = 0
"""
(3, 19, " member this.Bar (a:int) (b:int) : int = 0", "Bar")

#if NETCOREAPP
[<Test>]
let ``Signature text for type with generic parameter in path`` () =
assertSignature
"new: builder: ImmutableArray<'T>.Builder -> ImmutableArrayViaBuilder<'T>"
"""
module Telplin

open System
open System.Collections.Generic
open System.Collections.Immutable

type ImmutableArrayViaBuilder<'T>(builder: ImmutableArray<'T>.Builder) =
class end
"""
(8, 29, "type ImmutableArrayViaBuilder<'T>(builder: ImmutableArray<'T>.Builder) =", ".ctor")
#endif