File tree Expand file tree Collapse file tree 4 files changed +40
-3
lines changed
tests/fsharp/core/internalsvisible Expand file tree Collapse file tree 4 files changed +40
-3
lines changed Original file line number Diff line number Diff line change @@ -70,21 +70,28 @@ let private IsILMemberAccessible g amap m (tcrefOfViewedItem : TyconRef) ad acce
7070 match ad with
7171 | AccessibleFromEverywhere ->
7272 access = ILMemberAccess.Public
73+
7374 | AccessibleFromSomeFSharpCode ->
7475 ( access = ILMemberAccess.Public ||
7576 access = ILMemberAccess.Family ||
7677 access = ILMemberAccess.FamilyOrAssembly)
78+
7779 | AccessibleFrom ( cpaths, tcrefViewedFromOption) ->
80+
7881 let accessibleByFamily =
7982 (( access = ILMemberAccess.Family ||
8083 access = ILMemberAccess.FamilyOrAssembly) &&
8184 match tcrefViewedFromOption with
8285 | None -> false
8386 | Some tcrefViewedFrom ->
8487 ExistsHeadTypeInEntireHierarchy g amap m ( generalizedTyconRef tcrefViewedFrom) tcrefOfViewedItem)
88+
8589 let accessibleByInternalsVisibleTo =
86- ( access = ILMemberAccess.Assembly && canAccessFromOneOf cpaths tcrefOfViewedItem.CompilationPath)
90+ ( access = ILMemberAccess.Assembly || access = ILMemberAccess.FamilyOrAssembly) &&
91+ canAccessFromOneOf cpaths tcrefOfViewedItem.CompilationPath
92+
8793 ( access = ILMemberAccess.Public) || accessibleByFamily || accessibleByInternalsVisibleTo
94+
8895 | AccessibleFromSomewhere ->
8996 true
9097
Original file line number Diff line number Diff line change @@ -732,7 +732,7 @@ type ILMethInfo =
732732 let md = x.RawMetadata
733733 not md.IsConstructor &&
734734 not md.IsClassInitializer &&
735- ( md.Access = ILMemberAccess.Family)
735+ ( md.Access = ILMemberAccess.Family || md.Access = ILMemberAccess.FamilyOrAssembly )
736736
737737 /// Indicates if the IL method is marked virtual.
738738 member x.IsVirtual = x.RawMetadata.IsVirtual
Original file line number Diff line number Diff line change @@ -15,5 +15,17 @@ internal class APrivateClass
1515 {
1616 private static int PrivateProperty { get { return 2 ; } }
1717 internal static int InternalProperty { get { return 2 ; } }
18- }
18+ }
19+ public class Class1
20+ {
21+ public Class1 ( ) { }
22+ protected static int ProtectedStatic ;
23+ internal static int InternalStatic ;
24+ protected internal static int ProtectedInternalStatic ;
25+ public static int PublicStatic ;
26+ protected int Protected ;
27+ internal int Internal ;
28+ protected internal int ProtectedInternal ;
29+ public int Public ;
30+ }
1931}
Original file line number Diff line number Diff line change @@ -18,6 +18,24 @@ printf "APrivateClass.InternalProperty = %2d\n" LibraryCS.APrivateClass.Inter
1818
1919//printf "privateF 2 = %d\n" (Library.M.privateF 2) // inaccessable
2020
21+ module internal Repro1332 =
22+ let c = LibraryCS.Class1()
23+ //c.Protected |> ignore
24+ c.Internal |> ignore
25+ c.ProtectedInternal |> ignore
26+ LibraryCS.Class1.InternalStatic |> ignore
27+ LibraryCS.Class1.ProtectedInternalStatic |> ignore
28+
29+ type internal Class2 () =
30+ inherit LibraryCS.Class1()
31+ member c.M () =
32+ c.Internal |> ignore
33+ c.ProtectedInternal |> ignore
34+ c.Protected |> ignore
35+ LibraryCS.Class1.InternalStatic |> ignore
36+ LibraryCS.Class1.ProtectedInternalStatic |> ignore
37+ LibraryCS.Class1.ProtectedStatic |> ignore
38+
2139
2240(* Check that internalVisibleTo items can be used in internal items *)
2341module internal Repro3737 =
You can’t perform that action at this time.
0 commit comments