-
Notifications
You must be signed in to change notification settings - Fork 793
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signature of nested type with generic type parameter (#15259)
* Proof of concept * Add generic parameter names to ModuleOrType. * Revert ModuleOrType change * Process ticks in demangledPath of TType_app. * Only apply new logic when includeStaticParametersInTypeNames is active. * Use FactForNETCOREAPP * Fix build --------- Co-authored-by: Tomas Grosup <[email protected]>
- Loading branch information
Showing
5 changed files
with
180 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99 changes: 99 additions & 0 deletions
99
tests/FSharp.Compiler.ComponentTests/Signatures/NestedTypeTests.fs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
module FSharp.Compiler.ComponentTests.Signatures.NestedTypeTests | ||
|
||
open Xunit | ||
open FsUnit | ||
open FSharp.Test | ||
open FSharp.Test.Compiler | ||
open FSharp.Compiler.ComponentTests.Signatures.TestHelpers | ||
|
||
[<Fact>] | ||
let ``Nested type with generics`` () = | ||
let CSLib = | ||
CSharp """ | ||
namespace Lib | ||
{ | ||
public class Upper<T> | ||
{ | ||
public class Lower<U> | ||
{ | ||
public void Meh() | ||
{ | ||
} | ||
} | ||
} | ||
} | ||
""" | ||
|
||
FSharp | ||
""" | ||
module Sample | ||
open Lib | ||
let f (g: Upper<int>.Lower<string>) = g.Meh() | ||
""" | ||
|> withReferences [ CSLib ] | ||
|> printSignatures | ||
|> should equal | ||
""" | ||
module Sample | ||
val f: g: Lib.Upper<int>.Lower<string> -> unit""" | ||
|
||
[<Fact>] | ||
let ``Multiple generics in nested type`` () = | ||
let CSLib = | ||
CSharp """ | ||
namespace Lib | ||
{ | ||
public class Root<A, B, C, D, E> | ||
{ | ||
public class Foo<T, U, V, W> | ||
{ | ||
public class Bar<X, Y, Z> | ||
{ | ||
public void Meh() | ||
{ | ||
} | ||
} | ||
} | ||
} | ||
} | ||
""" | ||
|
||
FSharp | ||
""" | ||
module Sample | ||
open System | ||
open Lib | ||
let f (g: Root<TimeSpan,TimeSpan,TimeSpan,TimeSpan,TimeSpan>.Foo<int, float, string, System.DateTime>.Bar<char, int, string>) = g.Meh() | ||
""" | ||
|> withReferences [ CSLib ] | ||
|> printSignatures | ||
|> should equal | ||
""" | ||
module Sample | ||
val f: g: Lib.Root<System.TimeSpan,System.TimeSpan,System.TimeSpan,System.TimeSpan,System.TimeSpan>.Foo<int,float,string,System.DateTime>.Bar<char,int,string> -> unit""" | ||
|
||
[<FactForNETCOREAPP>] | ||
let ``ImmutableArray<'T>.Builder roundtrip`` () = | ||
let impl = | ||
""" | ||
module Library | ||
open System.Collections.Immutable | ||
type ImmutableArrayViaBuilder<'T>(builder: ImmutableArray<'T>.Builder) = class end | ||
""" | ||
|
||
let signature = printSignatures (Fs impl) | ||
|
||
Fsi signature | ||
|> withAdditionalSourceFile (FsSource impl) | ||
|> compile | ||
|> shouldSucceed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters