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

Update to .NET 9 rc1 #17698

Merged
merged 9 commits into from
Sep 12, 2024
Merged
Changes from 3 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
6 changes: 3 additions & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at:
{
"name": "F#",
"image": "mcr.microsoft.com/dotnet/sdk:9.0.100-preview.7",
"image": "mcr.microsoft.com/dotnet/sdk:9.0.100-rc.1",
"features": {
"ghcr.io/devcontainers/features/common-utils:2.4.6": {},
"ghcr.io/devcontainers/features/common-utils:2.5.1": {},
"ghcr.io/devcontainers/features/git:1.3.2": {},
"ghcr.io/devcontainers/features/github-cli:1.0.13": {},
"ghcr.io/devcontainers/features/dotnet:2.1.2": {}
"ghcr.io/devcontainers/features/dotnet:2.1.3": {}
},
"hostRequirements": {
"cpus": 2,
6 changes: 5 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -46,7 +46,10 @@

<PropertyGroup Condition="'$(BUILDING_USING_DOTNET)' == 'true'">
<DisableAutoSetFscCompilerPath>false</DisableAutoSetFscCompilerPath>
<FSHARPCORE_USE_PACKAGE Condition="'$(FSHARPCORE_USE_PACKAGE)' == ''">true</FSHARPCORE_USE_PACKAGE>

<!-- TODO(vlza): This probably should be `true` once fslib with nullness ships, since shipped library is preferred by default when building this solution. -->
<FSHARPCORE_USE_PACKAGE Condition="'$(FSHARPCORE_USE_PACKAGE)' == ''">false</FSHARPCORE_USE_PACKAGE>

Comment on lines +50 to +52
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That'd be a "workaround" to unblock plain builds, but it will by default use the project.

<DISABLE_ARCADE Condition="'$(DISABLE_ARCADE)' == ''">true</DISABLE_ARCADE>
<ArtifactsDir>$(MSBuildThisFileDirectory)artifacts/</ArtifactsDir>
<OutputPath>$(ArtifactsDir)/bin/$(MSBuildProjectName)/$(Configuration)/</OutputPath>
@@ -57,6 +60,7 @@
<FsYaccPath>$(ArtifactsDir)/bin/fsyacc/$(Configuration)/$(FSharpNetCoreProductDefaultTargetFramework)/$(RuntimeIdentifier)/fsyacc.dll</FsYaccPath>
<DefineConstants>NO_CHECKNULLS;BUILDING_WITH_LKG;NO_NULLCHECKING_LIB_SUPPORT;$(DefineConstants)</DefineConstants>
</PropertyGroup>

<Import Project="$(MSBuildThisFileDirectory)/eng/Versions.props" Condition="'$(DISABLE_ARCADE)' == 'true'" />

<Import Project="FSharpBuild.Directory.Build.props" Condition=" '$(FSharpTestCompilerVersion)' == '' " />
4 changes: 4 additions & 0 deletions FSharp.Profiles.props
Original file line number Diff line number Diff line change
@@ -22,6 +22,10 @@
<OtherFlags>$(OtherFlags) /langversion:preview</OtherFlags>
</PropertyGroup>

<PropertyGroup Condition="'$(BUILDING_USING_DOTNET)' == 'true'">
<CheckNulls>false</CheckNulls>
</PropertyGroup>

Comment on lines +25 to +28
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turning it off currently for the plain builds, so we don't get mismatches with defines we have.

<PropertyGroup Condition="'$(CheckNulls)' == 'true'">
<Nullable>enable</Nullable>
</PropertyGroup>
4 changes: 2 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"sdk": {
"version": "9.0.100-preview.7.24407.12",
"version": "9.0.100-rc.1.24452.12",
"allowPrerelease": true
},
"tools": {
"dotnet": "9.0.100-preview.7.24407.12",
"dotnet": "9.0.100-rc.1.24452.12",
"vs": {
"version": "17.8",
"components": [
12 changes: 12 additions & 0 deletions src/FSharp.Build/FSharpEmbedResourceText.fs
Original file line number Diff line number Diff line change
@@ -288,7 +288,11 @@ open Printf
if isNull s then
System.Diagnostics.Debug.Assert(false, sprintf ""**RESOURCE ERROR**: Resource token %s does not exist!"" name)
#endif
#if BUILDING_WITH_LKG || NO_NULLCHECKING_LIB_SUPPORT
s
#else
Unchecked.nonNull s
#endif


static let mkFunctionValue (tys: System.Type[]) (impl:obj->obj) =
@@ -314,7 +318,11 @@ open Printf
// PERF: this technique is a bit slow (e.g. in simple cases, like 'sprintf ""%x""')
mkFunctionValue tys (fun inp -> impl rty inp)

#if BUILDING_WITH_LKG || NO_NULLCHECKING_LIB_SUPPORT
static let capture1 (fmt:string) i args ty (go: obj list -> System.Type -> int -> obj) : obj =
#else
static let capture1 (fmt:string) i args ty (go: objnull list -> System.Type -> int -> obj) : obj =
#endif
match fmt.[i] with
| '%' -> go args ty (i+1)
| 'd'
@@ -336,7 +344,11 @@ open Printf
if i >= len || (fmt.[i] = '%' && i+1 >= len) then
let b = new System.Text.StringBuilder()
b.AppendFormat(messageString, [| for x in List.rev args -> x |]) |> ignore
#if BUILDING_WITH_LKG || NO_NULLCHECKING_LIB_SUPPORT
box(b.ToString())
#else
box(b.ToString()) |> Unchecked.nonNull
#endif
// REVIEW: For these purposes, this should be a nop, but I'm leaving it
// in incase we ever decide to support labels for the error format string
// E.g., ""<name>%s<foo>%d""
6 changes: 3 additions & 3 deletions tests/FSharp.Compiler.ComponentTests/Interop/ByrefTests.fs
Original file line number Diff line number Diff line change
@@ -115,7 +115,7 @@ open System.Collections.Generic
let myDict = ["x",1;"xyz",2] |> dict |> Dictionary

let checkIfPresent (input:ReadOnlySpan<char>) =
let altLookup = myDict.GetAlternateLookup<string,int,ReadOnlySpan<char>>()
let altLookup = myDict.GetAlternateLookup<ReadOnlySpan<char>>()
let present = altLookup.ContainsKey(input)
for c in input do
printf "%c" c
@@ -134,7 +134,7 @@ let main _args =
|> shouldSucceed
|> verifyOutputContains [|": false";"x: true";"xyz: true"|]
|> verifyIL
["call valuetype [System.Collections]System.Collections.Generic.Dictionary`2/AlternateLookup`1<!!0,!!1,!!2> [System.Collections]System.Collections.Generic.CollectionExtensions::GetAlternateLookup<string,int32,valuetype [runtime]System.ReadOnlySpan`1<char>>(class [System.Collections]System.Collections.Generic.Dictionary`2<!!0,!!1>)"]
["callvirt instance valuetype [System.Collections]System.Collections.Generic.Dictionary`2/AlternateLookup`1<!0,!1,!!0> class [System.Collections]System.Collections.Generic.Dictionary`2<string,int32>::GetAlternateLookup<valuetype [runtime]System.ReadOnlySpan`1<char>>()"]
T-Gro marked this conversation as resolved.
Show resolved Hide resolved

[<FactForNETCOREAPP>]
let ``Ref structs in generics - GetAlternateLookup`` () =
@@ -144,7 +144,7 @@ open System.Collections.Generic

let main _args =
let myDict = ["x",1;"y",2] |> dict |> Dictionary
let altLookup = myDict.GetAlternateLookup<string,int,ReadOnlySpan<char>>()
let altLookup = myDict.GetAlternateLookup<ReadOnlySpan<char>>()
altLookup.ContainsKey(ReadOnlySpan([|'x'|]))
"""
|> withLangVersionPreview