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

Merge main to release/dev17.7 #15323

Merged
merged 4 commits into from
Jun 6, 2023
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
4 changes: 4 additions & 0 deletions INTERNAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ Update the `insertTargetBranch` value at the bottom of `azure-pipelines.yml` in
6. Ensure the subscription was added by repeating step 3 above.
7. Note, the help in the `darc` tool is really good. E.g., you can simply run `darc` to see a list of all commands available, and if you run `darc <some-command>` with no arguments, you'll be given a list of arguments you can use.
8. Ensure that version numbers are bumped for a new branch.
9. Change needed subscriptions for arcade and SDK:
1. `darc get-subscriptions --target-repo fsharp`, and then use `darc update-subscription --id <subscription id>` for corresponding channels (e.g. target new VS channel to specific SDK channel, or set up arcade auto-merges to release/* or main branch, depending on the timeline of release/upgrade cycle).
2. If new subscription needs to be added, the following command should be used `darc add-subscription --source-repo https://github.com/dotnet/arcade --target-repo https://github.com/dotnet/fsharp --target-branch <target_branch> --channel "<target_channel>" --update-frequency everyDay --standard-automerge
`

## Labeling issues on GitHub

Expand Down
10 changes: 9 additions & 1 deletion src/Compiler/Driver/CreateILModule.fs
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,16 @@ module MainModuleBuilder =

RequireCompilationThread ctok

let isEmbeddableTypeWithLocalSourceImplementation (td: ILTypeDef) =
(TcGlobals.IsInEmbeddableKnownSet td.Name)
&& not (codegenResults.ilTypeDefs |> List.exists (fun r -> r.Name = td.Name))

let ilTypeDefs =
mkILTypeDefs (codegenResults.ilTypeDefs @ tcGlobals.tryRemoveEmbeddedILTypeDefs ())
mkILTypeDefs (
codegenResults.ilTypeDefs
@ (tcGlobals.tryRemoveEmbeddedILTypeDefs ()
|> List.filter isEmbeddableTypeWithLocalSourceImplementation)
)

let mainModule =
let hashAlg =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,58 @@ type C() =
|> verifyIL [verifyProperty;verifyMethod;verifyIsReadOnlyAttribute]
|> ignore

[<Fact>]
let ``Returning an 'inref<_>' from a property should emit System.Runtime.CompilerServices.IsReadOnlyAttribute on the return type of the signature and generate the - Source contains ReadOnlyAttribute`` () =
let src =
"""
namespace System.Runtime.CompilerServices

type IsReadOnlyAttribute() =
inherit System.Attribute()

type C() =
let x = 59
member _.X: inref<_> = &x
"""

let verifyProperty = """.property instance int32& modreq([netstandard]System.Runtime.InteropServices.InAttribute)
X()
{
.custom instance void System.Runtime.CompilerServices.IsReadOnlyAttribute::.ctor() = ( 01 00 00 00 )
.get instance int32& modreq([netstandard]System.Runtime.InteropServices.InAttribute) System.Runtime.CompilerServices.C::get_X()
}"""

let verifyMethod = """.method public hidebysig specialname instance int32& modreq([netstandard]System.Runtime.InteropServices.InAttribute)
get_X() cil managed
{
.param [0]
.custom instance void System.Runtime.CompilerServices.IsReadOnlyAttribute::.ctor() = ( 01 00 00 00 )"""

let verifyIsReadOnlyAttribute = """
.class public auto ansi serializable System.Runtime.CompilerServices.IsReadOnlyAttribute
extends [netstandard]System.Attribute
{
.custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 )
.method public specialname rtspecialname
instance void .ctor() cil managed
{

.maxstack 8
IL_0000: ldarg.0
IL_0001: callvirt instance void [netstandard]System.Attribute::.ctor()
IL_0006: ldarg.0
IL_0007: pop
IL_0008: ret
}

}"""

FSharp src
|> asNetStandard20
|> compile
|> verifyIL [verifyProperty;verifyMethod;verifyIsReadOnlyAttribute]
|> ignore

[<Fact>]
let ``Returning an 'inref<_>' from a generic method should emit System.Runtime.CompilerServices.IsReadOnlyAttribute on the return type of the signature`` () =
let src =
Expand All @@ -366,6 +418,34 @@ type C<'T>() =
|> verifyIL [verifyMethod]
|> ignore

[<Fact>]
let ``Returning an 'inref<_>' from a generic method should emit System.Runtime.CompilerServices.IsReadOnlyAttribute on the return type of the signature - Source contains ReadOnlyAttribute`` () =
let src =
"""
namespace System.Runtime.CompilerServices

type IsReadOnlyAttribute() =
inherit System.Attribute()

module Test =

type C<'T>() =
let x = Unchecked.defaultof<'T>
member _.X<'U>(): inref<'T> = &x
"""

let verifyMethod = """.method public hidebysig instance !T& modreq([netstandard]System.Runtime.InteropServices.InAttribute)
X<U>() cil managed
{
.param [0]
.custom instance void System.Runtime.CompilerServices.IsReadOnlyAttribute::.ctor() = ( 01 00 00 00 )"""
FSharp src
|> asLibrary
|> asNetStandard20
|> compile
|> verifyIL [verifyMethod]


[<Fact>]
let ``Returning an 'inref<_>' from an abstract generic method should emit System.Runtime.CompilerServices.IsReadOnlyAttribute on the return type of the signature`` () =
let src =
Expand Down