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

Fix #5794: Module Suffix is added in rec module even if type with the same name is generic #5796

Merged
merged 2 commits into from
Oct 25, 2018
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
8 changes: 4 additions & 4 deletions src/fsharp/TypeChecker.fs
Original file line number Diff line number Diff line change
Expand Up @@ -14699,11 +14699,11 @@ module EstablishTypeDefinitionCores =
let AdjustModuleName modKind nm = (match modKind with FSharpModuleWithSuffix -> nm+FSharpModuleSuffix | _ -> nm)


let TypeNamesInMutRecDecls (compDecls: MutRecShapes<MutRecDefnsPhase1DataForTycon * 'MemberInfo, 'LetInfo, SynComponentInfo, _, _>) =
let TypeNamesInMutRecDecls cenv env (compDecls: MutRecShapes<MutRecDefnsPhase1DataForTycon * 'MemberInfo, 'LetInfo, SynComponentInfo, _, _>) =
[ for d in compDecls do
match d with
| MutRecShape.Tycon (MutRecDefnsPhase1DataForTycon(ComponentInfo(_, _, _, ids, _, _, _, _), _, _, _, _, isAtOriginalTyconDefn), _) ->
if isAtOriginalTyconDefn then
| MutRecShape.Tycon (MutRecDefnsPhase1DataForTycon(ComponentInfo(_, typars, _, ids, _, _, _, _), _, _, _, _, isAtOriginalTyconDefn), _) ->
if isAtOriginalTyconDefn && (TcTyparDecls cenv env typars |> List.forall (fun p -> p.Kind = TyparKind.Measure)) then
yield (List.last ids).idText
| _ -> () ]
|> set
Expand Down Expand Up @@ -14750,7 +14750,7 @@ module EstablishTypeDefinitionCores =
let envForDecls, mtypeAcc = MakeInnerEnv envInitial id modKind
let mspec = NewModuleOrNamespace (Some envInitial.eCompPath) vis id (xml.ToXmlDoc()) modAttrs (MaybeLazy.Strict (NewEmptyModuleOrNamespaceType modKind))
let innerParent = Parent (mkLocalModRef mspec)
let innerTypeNames = TypeNamesInMutRecDecls decls
let innerTypeNames = TypeNamesInMutRecDecls cenv envForDecls decls
MutRecDefnsPhase2DataForModule (mtypeAcc, mspec), (innerParent, innerTypeNames, envForDecls)

/// Establish 'type <vis1> C < T1... TN > = <vis2> ...' including
Expand Down
74 changes: 73 additions & 1 deletion tests/fsharp/core/longnames/test.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,79 @@ module rec Ok15 =

test "lkneecec09iew15" (not (typeof<A.Dummy>.FullName.Contains("AModule") ))

module rec Ok16 =

type A<'a> = A of 'a

module A =
type Dummy = A | B

test "lkneecec09iew16" (not (typeof<A.Dummy>.FullName.Contains("AModule") ))

module rec Ok17 =

type A<'a> = A of 'a
type A = A of int

module A =
type Dummy = A | B

test "lkneecec09iew17" (typeof<A.Dummy>.FullName.Contains("AModule") )

module rec Ok18 =

type A<[<Measure>]'u> = A of int<'u>

module A =
type Dummy = A | B

test "lkneecec09iew18" (typeof<A.Dummy>.FullName.Contains("AModule") )

module rec Ok19 =

type A<[<Measure>]'u, 'a> = | A of int<'u> | B of 'a

module A =
type Dummy = A | B

test "lkneecec09iew19" (not (typeof<A.Dummy>.FullName.Contains("AModule") ))

module rec Ok20 =

type A<'a, [<Measure>]'u> = A of int<'u> | B of 'a

module A =
type Dummy = A | B

test "lkneecec09iew20" (not (typeof<A.Dummy>.FullName.Contains("AModule") ))

module rec Ok21 =

type A<'a, 'b> = A of 'a | B of 'b

module A =
type Dummy = A | B

test "lkneecec09iew21" (not (typeof<A.Dummy>.FullName.Contains("AModule") ))

module rec Ok22 =

module A =
type Dummy = A | B

type A<'a> = A of 'a

test "lkneecec09iew22" (not (typeof<A.Dummy>.FullName.Contains("AModule") ))

module rec Ok23 =

module A =
type Dummy = A | B

type A = A of int

test "lkneecec09iew23" (typeof<A.Dummy>.FullName.Contains("AModule") )

#if TESTS_AS_APP
let RUN() = !failures
#else
Expand All @@ -628,4 +701,3 @@ let aa =
stdout.WriteLine "Test Failed"
exit 1
#endif