From 742efe3b3732f5ca0875196b2234c3ed3a32faa3 Mon Sep 17 00:00:00 2001 From: ncave <777696+ncave@users.noreply.github.com> Date: Fri, 5 Apr 2024 12:18:20 -0700 Subject: [PATCH] Fixed type visibility when parent is namespace --- .vscode/launch.json | 2 +- src/Fable.Transforms/FSharp2Fable.Util.fs | 20 +++++++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 7c175b7b9b..e98a666f7b 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -271,7 +271,7 @@ "request": "launch", "preLaunchTask": "build", "program": "${workspaceRoot}/src/Fable.Cli/bin/Debug/net6.0/fable.dll", - "args": ["--outDir", "${workspaceRoot}/../fable-test", "--fableLib", "../../Fable/build/fable-library-rust", "--exclude", "Fable.Core", "--lang", "Rust", "--noCache"], + "args": ["--outDir", "${workspaceRoot}/../fable-test", "--fableLib", "../../Fable/build/fable-library-rust", "--exclude", "Fable.Core", "--lang", "Rust", "--noCache", "--noParallelTypeCheck"], "cwd": "${workspaceRoot}/../fable-test", "stopAtEntry": false, "console": "internalConsole" diff --git a/src/Fable.Transforms/FSharp2Fable.Util.fs b/src/Fable.Transforms/FSharp2Fable.Util.fs index 91aee529d6..57b2db9c5a 100644 --- a/src/Fable.Transforms/FSharp2Fable.Util.fs +++ b/src/Fable.Transforms/FSharp2Fable.Util.fs @@ -826,10 +826,17 @@ module Helpers = | FSharpInlineAnnotation.AlwaysInline | FSharpInlineAnnotation.AggressiveInline -> true + let hasOwnSignatureFile (ent: FSharpEntity) = + not ent.IsNamespace + && ( + match ent.SignatureLocation with + | None -> false + | Some m -> m.FileName.EndsWith(".fsi", StringComparison.Ordinal) + ) + let parentHasSignatureFile (declaringEntity: FSharpEntity option) = declaringEntity - |> Option.bind (fun p -> p.SignatureLocation) - |> Option.map (fun m -> m.FileName.EndsWith(".fsi", StringComparison.Ordinal)) + |> Option.map (fun ent -> hasOwnSignatureFile ent) |> Option.defaultValue false let topLevelBindingHiddenBySignatureFile (v: FSharpMemberOrFunctionOrValue) = @@ -837,13 +844,8 @@ module Helpers = && not v.HasSignatureFile && parentHasSignatureFile v.DeclaringEntity - let typeIsHiddenBySignatureFile (ent: FSharpEntity) : bool = - let hasOwnSignatureFile = - match ent.SignatureLocation with - | None -> false - | Some m -> m.FileName.EndsWith(".fsi", StringComparison.Ordinal) - - not hasOwnSignatureFile && parentHasSignatureFile ent.DeclaringEntity + let typeIsHiddenBySignatureFile (ent: FSharpEntity) = + not (hasOwnSignatureFile ent) && parentHasSignatureFile ent.DeclaringEntity let isNotPrivate (memb: FSharpMemberOrFunctionOrValue) = if memb.IsCompilerGenerated then