Skip to content

Commit

Permalink
Merge pull request #18108 from dotnet/merges/main-to-release/dev17.13
Browse files Browse the repository at this point in the history
  • Loading branch information
vzarytovskii authored Dec 6, 2024
2 parents 4f84157 + 29b0172 commit 96e77ae
Show file tree
Hide file tree
Showing 23 changed files with 233 additions and 33 deletions.
15 changes: 9 additions & 6 deletions FSharp.sln
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "TestTP", "tests\service\dat
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Docs", "Docs", "{4E4F41D9-86A7-4F5D-B735-1A0744AB68AC}"
ProjectSection(SolutionItems) = preProject
docs\builder-caches.md = docs\builder-caches.md
docs\changing-the-ast.md = docs\changing-the-ast.md
docs\coding-standards.md = docs\coding-standards.md
docs\compiler-startup-performance.md = docs\compiler-startup-performance.md
docs\debug-emit.md = docs\debug-emit.md
Expand All @@ -57,12 +59,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Docs", "Docs", "{4E4F41D9-8
docs\index.md = docs\index.md
docs\large-inputs-and-stack-overflows.md = docs\large-inputs-and-stack-overflows.md
docs\memory-usage.md = docs\memory-usage.md
docs\optimizations.md = docs\optimizations.md
docs\names.md = docs\names.md
docs\optimizations-equality.md = docs\optimizations-equality.md
docs\optimizations.md = docs\optimizations.md
docs\overview.md = docs\overview.md
docs\builder-caches.md = docs\builder-caches.md
docs\changing-the-ast.md = docs\changing-the-ast.md
docs\names.md = docs\names.md
docs\perf-discussions-archive.md = docs\perf-discussions-archive.md
docs\project-builds.md = docs\project-builds.md
docs\representations.md = docs\representations.md
Expand All @@ -84,8 +84,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "fcs", "fcs", "{B86EBFF1-E03
docs\fcs\symbols.fsx = docs\fcs\symbols.fsx
docs\fcs\tokenizer.fsx = docs\fcs\tokenizer.fsx
docs\fcs\typedtree.fsx = docs\fcs\typedtree.fsx
docs\fcs\untypedtree.fsx = docs\fcs\untypedtree.fsx
docs\fcs\untypedtree-apis.fsx = docs\fcs\untypedtree-apis.fsx
docs\fcs\untypedtree.fsx = docs\fcs\untypedtree.fsx
EndProjectSection
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "fsc", "src\fsc\fscProject\fsc.fsproj", "{10D15DBB-EFF0-428C-BA83-41600A93EEC4}"
Expand Down Expand Up @@ -142,6 +142,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".FSharp.Compiler.Service",
docs\release-notes\.FSharp.Compiler.Service\8.0.200.md = docs\release-notes\.FSharp.Compiler.Service\8.0.200.md
docs\release-notes\.FSharp.Compiler.Service\8.0.202.md = docs\release-notes\.FSharp.Compiler.Service\8.0.202.md
docs\release-notes\.FSharp.Compiler.Service\8.0.300.md = docs\release-notes\.FSharp.Compiler.Service\8.0.300.md
docs\release-notes\.FSharp.Compiler.Service\8.0.400.md = docs\release-notes\.FSharp.Compiler.Service\8.0.400.md
docs\release-notes\.FSharp.Compiler.Service\9.0.100.md = docs\release-notes\.FSharp.Compiler.Service\9.0.100.md
docs\release-notes\.FSharp.Compiler.Service\9.0.200.md = docs\release-notes\.FSharp.Compiler.Service\9.0.200.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".FSharp.Core", ".FSharp.Core", "{23798638-A1E9-4DAE-9C9C-F5D87499ADD6}"
Expand All @@ -158,8 +161,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".Language", ".Language", "{
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".VisualStudio", ".VisualStudio", "{AF70EC5A-8E7C-4FDA-857D-AF08082CFC64}"
ProjectSection(SolutionItems) = preProject
docs\release-notes\.VisualStudio\17.9.md = docs\release-notes\.VisualStudio\17.9.md
docs\release-notes\.VisualStudio\17.10.md = docs\release-notes\.VisualStudio\17.10.md
docs\release-notes\.VisualStudio\17.9.md = docs\release-notes\.VisualStudio\17.9.md
EndProjectSection
EndProject
Global
Expand Down
25 changes: 13 additions & 12 deletions INTERNAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,19 +116,20 @@ https://github.com/dotnet/roslyn-tools/blob/6d7c182c46f8319d7922561e2c1586c7aadc
5. Set the new branch to receive auto-merges from `main`, and also set the old release branch to flow into the new one. [This PR](https://github.com/dotnet/roslyn-tools/pull/1245/files) is a good example of what to do when a new `release/dev17.4` branch is created that should receive merges from both `main` and the previous release branch, `release/dev17.3`. Old release branch should stop receiving updates from the `main`.

6. Set the packages from the new branch to flow into the correct package feeds via the `darc` tool. To do this:
1. Ensure the latest `darc` tool is installed by running `eng/common/darc-init.ps1`.
2. (only needed once) Run the command `darc authenticate`. A text file will be opened with instructions on how to populate access tokens.
3. Check the current package/channel subscriptions by running `darc get-default-channels --source-repo fsharp`. For this example, notice that the latest subscription shows the F# branch `release/dev17.3` is getting added to the `VS 17.3` channel.
4. Get the list of `darc` channels and determine the appropriate one to use for the new branch via the command `darc get-channels`. For this example, notice that a channel named `VS 17.4` is listed.
5. Add the new F# branch to the appropriate `darc` channel. In this example, run `darc add-default-channel --channel "VS 17.4" --branch release/dev17.4 --repo https://github.com/dotnet/fsharp`
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. To use `darc` you need to be a member of the `dotnetes-maestro-users` entitlement. You can request access at [coreidentity.microsoft.com](https://coreidentity.microsoft.com/manage/Entitlement/entitlement/dotnetesmaes-z54r)
2. Ensure the latest `darc` tool is installed by running `eng/common/darc-init.ps1`.
3. (only needed once) Run the command `darc authenticate`. A text file will be opened with instructions on how to populate access tokens.
4. Check the current package/channel subscriptions by running `darc get-default-channels --source-repo fsharp`. For this example, notice that the latest subscription shows the F# branch `release/dev17.3` is getting added to the `VS 17.3` channel.
5. Get the list of `darc` channels and determine the appropriate one to use for the new branch via the command `darc get-channels`. For this example, notice that a channel named `VS 17.4` is listed.
6. Add the new F# branch to the appropriate `darc` channel. In this example, run `darc add-default-channel --channel "VS 17.4" --branch release/dev17.4 --repo https://github.com/dotnet/fsharp`
7. Ensure the subscription was added by repeating step 3 above.
8. 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.
9. Ensure that version numbers are bumped for a new branch.
10. 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
10. Update mibc and other dependencies if needed, refer to https://github.com/dotnet/arcade/blob/main/Documentation/Darc.md#updating-dependencies-in-your-local-repository for more information
`
11. Update mibc and other dependencies if needed, refer to https://github.com/dotnet/arcade/blob/main/Documentation/Darc.md#updating-dependencies-in-your-local-repository for more information

## Labeling issues on GitHub

Expand Down Expand Up @@ -160,4 +161,4 @@ You need the following permissions to do the above investigations:
- "Queue builds"
- "Edit queue build configuration"

If anything, reach out to the "First Responders" team.
If anything, reach out to the "First Responders" team.
2 changes: 2 additions & 0 deletions docs/release-notes/.FSharp.Compiler.Service/9.0.200.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@
* Fix locals allocating for the special `copyOfStruct` defensive copy ([PR #18025](https://github.com/dotnet/fsharp/pull/18025))
* Fix lowering of computed array expressions when the expression consists of a simple mapping from a `uint64` or `unativeint` array. [PR #18081](https://github.com/dotnet/fsharp/pull/18081)


### Added

* Let `dotnet fsi --help` print a link to the documentation website. ([PR #18006](https://github.com/dotnet/fsharp/pull/18006))
* Deprecate places where `seq` can be omitted. ([Language suggestion #1033](https://github.com/fsharp/fslang-suggestions/issues/1033), [PR #17772](https://github.com/dotnet/fsharp/pull/17772))
* Support literal attribute on decimals ([PR #17769](https://github.com/dotnet/fsharp/pull/17769))
* Added type conversions cache, only enabled for compiler runs, guarded by language version preview ([PR #17668](https://github.com/dotnet/fsharp/pull/17668))
* Added project property ParallelCompilation which turns on graph based type checking, parallel ILXGen and parallel optimization. By default on for users of langversion=preview ([PR #17948](https://github.com/dotnet/fsharp/pull/17948))
* Adding warning when consuming generic method returning T|null for types not supporting nullness (structs,anons,tuples) ([PR #18057](https://github.com/dotnet/fsharp/pull/18057))

### Changed

Expand Down
4 changes: 2 additions & 2 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Dependencies>
<ProductDependencies>
<Dependency Name="Microsoft.SourceBuild.Intermediate.source-build-reference-packages" Version="10.0.0-alpha.1.24558.1">
<Dependency Name="Microsoft.SourceBuild.Intermediate.source-build-reference-packages" Version="9.0.0-alpha.1.24568.3">
<Uri>https://github.com/dotnet/source-build-reference-packages</Uri>
<Sha>1ebd9ce245112164207d961c0d2faea741c7c489</Sha>
<Sha>a3776f67d97bd5d9ada92122330454b284bfe915</Sha>
<SourceBuild RepoName="source-build-reference-packages" ManagedOnly="true" />
</Dependency>
<!-- Intermediate is necessary for source build. -->
Expand Down
5 changes: 4 additions & 1 deletion src/Compiler/Checking/Expressions/CheckExpressions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -9728,10 +9728,13 @@ and TcMethodApplicationThen
let (CallerNamedArg(id, _)) = List.head attributeAssignedNamedItems
errorR(Error(FSComp.SR.tcNamedArgumentDidNotMatch(id.idText), id.idRange))


// Resolve the "delayed" lookups
let exprTy = (tyOfExpr g expr)

for problematicTy in GetDisallowedNullness g exprTy do
let denv = env.DisplayEnv
warning(Error(FSComp.SR.tcDisallowedNullableApplication(methodName,NicePrint.minimalStringOfType denv problematicTy), m))

PropagateThenTcDelayed cenv overallTy env tpenv mWholeExpr (MakeApplicableExprNoFlex cenv expr) exprTy atomicFlag delayed

/// Infer initial type information at the callsite from the syntax of an argument, prior to overload resolution.
Expand Down
1 change: 1 addition & 0 deletions src/Compiler/FSComp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1538,6 +1538,7 @@ tcPassingWithoutNullToNonNullQuickAP,"You can remove this |NonNullQuick| pattern
tcPassingWithoutNullTononNullFunction,"You can remove this `nonNull` assertion."
3263,tcNullableToStringOverride,"With nullness checking enabled, overrides of .ToString() method must return a non-nullable string. You can handle potential nulls via the built-in string function."
3264,tcDowncastFromNullableToWithoutNull,"Nullness warning: Downcasting from '%s' into '%s' can introduce unexpected null values. Cast to '%s|null' instead or handle the null before downcasting."
3265,tcDisallowedNullableApplication,"Application of method '%s' attempted to create a nullable type ('T | null) for '%s'. Nullness warnings won't be reported correctly for such types."
3268,csNullNotNullConstraintInconsistent,"The constraints 'null' and 'not null' are inconsistent"
3271,tcNullnessCheckingNotEnabled,"The 'nullness checking' language feature is not enabled. This use of a nullness checking construct will be ignored."
csTypeHasNullAsTrueValue,"The type '%s' uses 'null' as a representation value but a non-null type is expected"
Expand Down
51 changes: 51 additions & 0 deletions src/Compiler/TypedTree/TypedTreeOps.fs
Original file line number Diff line number Diff line change
Expand Up @@ -9215,6 +9215,57 @@ let reqTyForArgumentNullnessInference g actualTy reqTy =
changeWithNullReqTyToVariable g reqTy
| _ -> reqTy


let GetDisallowedNullness (g:TcGlobals) (ty:TType) =
if g.checkNullness then
let rec hasWithNullAnyWhere ty alreadyWrappedInOuterWithNull =
match ty with
| TType_var (tp, n) ->
let withNull = alreadyWrappedInOuterWithNull || n.TryEvaluate() = (ValueSome NullnessInfo.WithNull)
match tp.Solution with
| None -> []
| Some t -> hasWithNullAnyWhere t withNull

| TType_app (tcr, tinst, nullnessOrig) ->
let tyArgs = tinst |> List.collect (fun t -> hasWithNullAnyWhere t false)

match alreadyWrappedInOuterWithNull, tcr.TypeAbbrev with
| true, _ when isStructTyconRef tcr -> ty :: tyArgs
| true, _ when tcr.IsMeasureableReprTycon ->
match tcr.TypeReprInfo with
| TMeasureableRepr realType ->
if hasWithNullAnyWhere realType true |> List.isEmpty then
[]
else [ty]
| _ -> []
| true, Some tAbbrev -> (hasWithNullAnyWhere tAbbrev true) @ tyArgs
| _ -> tyArgs

| TType_tuple (_,tupTypes) ->
let inner = tupTypes |> List.collect (fun t -> hasWithNullAnyWhere t false)
if alreadyWrappedInOuterWithNull then ty :: inner else inner

| TType_anon (anon,tys) ->
let inner = tys |> List.collect (fun t -> hasWithNullAnyWhere t false)
if alreadyWrappedInOuterWithNull then ty :: inner else inner
| TType_fun (d, r, _) ->
(hasWithNullAnyWhere d false) @ (hasWithNullAnyWhere r false)

| TType_forall _ -> []
| TType_ucase _ -> []
| TType_measure m ->
if alreadyWrappedInOuterWithNull then
let measuresInside =
ListMeasureVarOccs m
|> List.choose (fun x -> x.Solution)
|> List.collect (fun x -> hasWithNullAnyWhere x true)
ty :: measuresInside
else []

hasWithNullAnyWhere ty false
else
[]

let TypeHasAllowNull (tcref:TyconRef) g m =
not tcref.IsStructOrEnumTycon &&
not (isByrefLikeTyconRef g m tcref) &&
Expand Down
5 changes: 5 additions & 0 deletions src/Compiler/TypedTree/TypedTreeOps.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -1815,6 +1815,11 @@ val TypeNullIsTrueValue: TcGlobals -> TType -> bool

val TypeNullIsExtraValue: TcGlobals -> range -> TType -> bool

/// A type coming via interop from C# can be holding a nullness combination not supported in F#.
/// Prime example are APIs marked as T|null applied to structs, tuples and anons.
/// Unsupported values can also be nested within generic type arguments, e.g. a List<Tuple<string,T|null>> applied to an anon.
val GetDisallowedNullness: TcGlobals -> TType -> TType list

val TypeHasAllowNull: TyconRef -> TcGlobals -> range -> bool

val TypeNullIsExtraValueNew: TcGlobals -> range -> TType -> bool
Expand Down
5 changes: 5 additions & 0 deletions src/Compiler/xlf/FSComp.txt.cs.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Compiler/xlf/FSComp.txt.de.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Compiler/xlf/FSComp.txt.es.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 96e77ae

Please sign in to comment.