File tree Expand file tree Collapse file tree 1 file changed +53
-0
lines changed
tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature Expand file tree Collapse file tree 1 file changed +53
-0
lines changed Original file line number Diff line number Diff line change @@ -1253,3 +1253,56 @@ module Test6
12531253 |> asLibrary
12541254 |> compile
12551255 |> shouldSucceed
1256+
1257+ [<Fact>]
1258+ let ``Calling protected static base member from `static do` does not raise MethodAccessException when -- realsig + `` () =
1259+ FSharp """
1260+ #nowarn "44" // using Uri.EscapeString just because it's protected static
1261+
1262+ type C(str : string) =
1263+ inherit System.Uri(str)
1264+
1265+ static do
1266+ System.Uri.EscapeString("http://www.myserver.com") |> ignore
1267+ printfn "Hello, World"
1268+
1269+ module M =
1270+ [<EntryPoint>]
1271+ let main args =
1272+ let res = C("http://www.myserver.com")
1273+ 0
1274+ """
1275+ |> withLangVersionPreview
1276+ |> withRealInternalSignature true
1277+ |> asLibrary
1278+ |> compile
1279+ |> compileExeAndRun
1280+ |> shouldSucceed
1281+ |> withStdOutContainsAllInOrder [
1282+ " Hello, World"
1283+ ]
1284+
1285+ [<Fact>]
1286+ let ``Calling protected static base member from `static do` raises MethodAccessException with -- realsig - `` () =
1287+ FSharp """
1288+ #nowarn "44" // using Uri.EscapeString just because it's protected static
1289+
1290+ type C(str : string) =
1291+ inherit System.Uri(str)
1292+
1293+ static do
1294+ System.Uri.EscapeString("http://www.myserver.com") |> ignore
1295+ printfn "Hello, World"
1296+
1297+ module M =
1298+ [<EntryPoint>]
1299+ let main args =
1300+ let res = C("http://www.myserver.com")
1301+ 0
1302+ """
1303+ |> withLangVersionPreview
1304+ |> withRealInternalSignature false
1305+ |> asLibrary
1306+ |> compile
1307+ |> compileExeAndRun
1308+ |> shouldFail
You can’t perform that action at this time.
0 commit comments