Skip to content

Commit

Permalink
temp
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinRansom committed Aug 17, 2023
1 parent a83080d commit 2af1d80
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<LangVersion Condition="'$(FSharpLangVersion)' != ''">$(FSharpLangVersion)</LangVersion>
<RepoRoot Condition="'$(RepoRoot)' == ''">$(MSBuildThisFileDirectory)</RepoRoot>
<AccelerateBuildsInVisualStudio>true</AccelerateBuildsInVisualStudio>
<!-- <OtherFlags Condition="'$(Configuration)' != 'Proto' and '$(MSBuildProjectName)' == 'FSharp.Core'">$(OtherFlags) - -test:RealInternalSignature</OtherFlags> -->
<!-- <OtherFlags Condition="'$(Configuration)' != 'Proto'">$(OtherFlags) - -test:RealInternalSignature</OtherFlags> -->
</PropertyGroup>
<!--
When developers load the FSharp.Compiler.Service solution we set FSHARPCORE_USE_PACKAGE to true if it hasn't already been set to a value.
Expand Down
10 changes: 4 additions & 6 deletions src/Compiler/CodeGen/IlxGen.fs
Original file line number Diff line number Diff line change
Expand Up @@ -10698,9 +10698,7 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) : ILTypeRef option

let hidden = IsHiddenTycon eenv.realInternalSignature eenv.sigToImplRemapInfo tycon
let hiddenRepr = hidden || IsHiddenTyconRepr eenv.realInternalSignature eenv.sigToImplRemapInfo tycon

let access =
ComputeTypeAccess tref hidden tycon.Accessibility cenv.g.realInternalSignature
let tyconAccess = ComputeTypeAccess tref hidden tycon.Accessibility cenv.g.realInternalSignature

// The implicit augmentation doesn't actually create CompareTo(object) or Object.Equals
// So we do it here.
Expand Down Expand Up @@ -11269,7 +11267,7 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) : ILTypeRef option

match tycon.TypeReprInfo with
| TILObjectRepr _ ->
let tdef = tycon.ILTyconRawMetadata.WithAccess access
let tdef = tycon.ILTyconRawMetadata.WithAccess tyconAccess

let tdef =
tdef.With(customAttrs = mkILCustomAttrs ilCustomAttrs, genericParams = ilGenParams)
Expand Down Expand Up @@ -11311,7 +11309,7 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) : ILTypeRef option
let tdef =
mkILGenericClass (
ilTypeName,
access,
tyconAccess,
ilGenParams,
ilBaseTy,
ilIntfTys,
Expand Down Expand Up @@ -11510,7 +11508,7 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) : ILTypeRef option
.WithSerializable(isSerializable)
.WithSealed(true)
.WithEncoding(ILDefaultPInvokeEncoding.Auto)
.WithAccess(access)
.WithAccess(tyconAccess)
// If there are static fields in the union, use the same kind of trigger as
// for class types
.WithInitSemantics(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -544,3 +544,46 @@ module internal PrintfImpl
"FormatParser.prefix: FormatParser.prefix : FormatString.findNextFormatSpecifier ()"
"Main program"
]



[<InlineData(true, true)>] // RealSig, Debug
[<InlineData(true, false)>] // RealSig, Release
[<InlineData(false,true)>] // Internal, Debug
[<InlineData(false,false)>] // Internal, Release
[<Theory>]
let ``Class Type visibility`` (realSig, symbol) =

FSharp """
namespace FSharp.Compiler.CodeAnalysis
open System
open System.IO
[<AbstractClass>]
type FSharpSource internal () =
abstract FilePath: string
type private FSharpSourceFromFile(filePath: string) =
inherit FSharpSource()
override _.FilePath = filePath
type FSharpSource with
static member CreateFromFile(filePath: string) =
FSharpSourceFromFile(filePath) :> FSharpSource
module doit =
FSharpSource.CreateFromFile("Hello") |> ignore
printfn "Main program"
"""
|> withLangVersionPreview
|> withOptions [if realSig then yield "--test:RealInternalSignature"]
|> withOptions [if symbol then yield! ["-g"; "--debug:embedded"]]
|> compileExeAndRun
|> shouldSucceed
|> withStdOutContainsAllInOrder [
"Main program"
]

0 comments on commit 2af1d80

Please sign in to comment.