Skip to content
Open
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
1 change: 1 addition & 0 deletions docs/release-notes/.FSharp.Compiler.Service/11.0.100.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
### Fixed

* Diagnostic FS0027 now emits a parameter-specific message (suggesting a `let mutable x = x` shadow or `byref<_>`) instead of the illegal `let mutable x = expression` shadow when the assignment target is a function or method parameter. ([Issue #15803](https://github.com/dotnet/fsharp/issues/15803), [PR #19866](https://github.com/dotnet/fsharp/pull/19866))
* Reject non-function bindings for single-case and partial active pattern names with FS1209, matching the existing multi-case behavior. ([PR #19763](https://github.com/dotnet/fsharp/pull/19763))
* Fix FS0421 "The address of the variable cannot be used at this point" incorrectly raised for the discard pattern `let _ = &expr` when `let x = &expr` compiles. ([Issue #18841](https://github.com/dotnet/fsharp/issues/18841), [PR #19811](https://github.com/dotnet/fsharp/pull/19811))
* Honor `--nowarn` and `--warnaserror` for warnings emitted during command-line option parsing ([Issue #19576](https://github.com/dotnet/fsharp/issues/19576), [PR #19776](https://github.com/dotnet/fsharp/pull/19776))
Expand Down
8 changes: 8 additions & 0 deletions src/Compiler/Checking/CheckIncrementalClasses.fs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,14 @@ let TcImplicitCtorInfo_Phase2A(cenv: cenv, env, tpenv, tcref: TyconRef, vis, att

// Put them in order
let ctorArgs = List.map (fun v -> NameMap.find v vspecs) ctorArgNames

// Mark constructor arguments as "displayed as parameters" so that diagnostics
// (e.g. FS0027 on assignment to a non-mutable parameter) can distinguish them
// from ordinary local bindings.
for v in ctorArgs do
if v.ArgReprInfoForDisplay.IsNone then
v.SetArgReprInfoForDisplay (Some (ValReprInfo.InferArgReprInfo v))

let safeThisValOpt = MakeAndPublishSafeThisVal cenv env thisIdOpt thisTy

// NOTE: the type scheme here is not complete!!! The ctorTy is more or less
Expand Down
12 changes: 11 additions & 1 deletion src/Compiler/Driver/CompilerDiagnostics.fs
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,7 @@ module OldStyleMessages =
let RuleNeverMatchedE () = Message("RuleNeverMatched", "")
let EnumMatchIncomplete1E () = Message("EnumMatchIncomplete1", "")
let ValNotMutableE () = Message("ValNotMutable", "%s")
let ValNotMutableParameterE () = Message("ValNotMutableParameter", "%s%s%s")
let ValNotLocalE () = Message("ValNotLocal", "")
let Obsolete1E () = Message("Obsolete1", "")
let Obsolete2E () = Message("Obsolete2", "%s")
Expand Down Expand Up @@ -1838,7 +1839,16 @@ type Exception with

| PatternMatchCompilation.RuleNeverMatched _ -> os.AppendString(RuleNeverMatchedE().Format)

| ValNotMutable(_, vref, _) -> os.AppendString(ValNotMutableE().Format(vref.DisplayName))
| ValNotMutable(_, vref, _) ->
let name = vref.DisplayName

let msg =
if vref.Deref.ArgReprInfoForDisplay.IsSome then
ValNotMutableParameterE().Format name name name
else
ValNotMutableE().Format name

os.AppendString msg

| ValNotLocal _ -> os.AppendString(ValNotLocalE().Format)

Expand Down
3 changes: 3 additions & 0 deletions src/Compiler/FSStrings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1041,6 +1041,9 @@
<data name="ValNotMutable" xml:space="preserve">
<value>This value is not mutable. Consider using the mutable keyword, e.g. 'let mutable {0} = expression'.</value>
</data>
<data name="ValNotMutableParameter" xml:space="preserve">
<value>The parameter '{0}' is not mutable. Either shadow it with a mutable binding (e.g. 'let mutable {1} = {2}'), or change its type to 'byref&lt;_&gt;'.</value>
</data>
<data name="ValNotLocal" xml:space="preserve">
<value>This value is not local</value>
</data>
Expand Down
5 changes: 5 additions & 0 deletions src/Compiler/xlf/FSStrings.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/FSStrings.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/FSStrings.es.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/FSStrings.fr.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/FSStrings.it.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/FSStrings.ja.xlf

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

Loading
Loading