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

* Add FSharpCodeCompletionOptions ([PR #19030](https://github.com/dotnet/fsharp/pull/19030))
* Type checker: recover on checking binding parameter constraints ([#19046](https://github.com/dotnet/fsharp/pull/19046))
* Debugger: provide breakpoint ranges for short lambdas ([#19067](https://github.com/dotnet/fsharp/pull/19067))

### Changed
Expand Down
14 changes: 8 additions & 6 deletions src/Compiler/Checking/Expressions/CheckExpressions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -11561,12 +11561,14 @@ and TcLetBinding (cenv: cenv) isUse env containerInfo declKind tpenv (synBinds,

// Canonicalize constraints prior to generalization
let denv = env.DisplayEnv
CanonicalizePartialInferenceProblem cenv.css denv synBindsRange
(checkedBinds |> List.collect (fun tbinfo ->
let (CheckedBindingInfo(_, _, _, _, explicitTyparInfo, _, _, _, tauTy, _, _, _, _, _)) = tbinfo
let (ExplicitTyparInfo(_, declaredTypars, _)) = explicitTyparInfo
let maxInferredTypars = (freeInTypeLeftToRight g false tauTy)
declaredTypars @ maxInferredTypars))
try
CanonicalizePartialInferenceProblem cenv.css denv synBindsRange
(checkedBinds |> List.collect (fun tbinfo ->
let (CheckedBindingInfo(_, _, _, _, explicitTyparInfo, _, _, _, tauTy, _, _, _, _, _)) = tbinfo
let (ExplicitTyparInfo(_, declaredTypars, _)) = explicitTyparInfo
let maxInferredTypars = (freeInTypeLeftToRight g false tauTy)
declaredTypars @ maxInferredTypars))
with RecoverableException _ -> ()

let lazyFreeInEnv = lazy (GeneralizationHelpers.ComputeUngeneralizableTypars env)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,6 @@ let ``type check neg66`` () = singleNegTest ( "typecheck/sigs") "neg66"
[<FactForDESKTOP>]
let ``type check neg67`` () = singleNegTest ( "typecheck/sigs") "neg67"

[<FactForDESKTOP>]
let ``type check neg68`` () = singleNegTest ( "typecheck/sigs") "neg68"

[<FactForDESKTOP>]
let ``type check neg69`` () = singleNegTest ( "typecheck/sigs") "neg69"

Expand Down Expand Up @@ -498,4 +495,4 @@ let ``type check neg_byref_21`` () = singleNegTest ( "typecheck/sigs") "neg_byre
let ``type check neg_byref_22`` () = singleNegTest ( "typecheck/sigs") "neg_byref_22"

[<FactForDESKTOP>]
let ``type check neg_byref_23`` () = singleNegTest ( "typecheck/sigs") "neg_byref_23"
let ``type check neg_byref_23`` () = singleNegTest ( "typecheck/sigs") "neg_byref_23"
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
module FSharp.Compiler.Service.Tests.TypeChecker.TypeCheckerRecoveryTests

open FSharp.Compiler.Service.Tests
open FSharp.Compiler.Text
open FSharp.Test.Assert
open Xunit

let assertHasSymbolUsageAtCaret name source =
let context, checkResults = Checker.getCheckedResolveContext source

getSymbolUses checkResults
|> Seq.exists (fun symbolUse ->
Range.rangeContainsPos symbolUse.Range context.Pos &&
symbolUse.Symbol.DisplayNameCore = name
)
|> shouldEqual true

[<Fact>]
let ``Let 01`` () =
let _, checkResults = getParseAndCheckResults """
Expand Down Expand Up @@ -49,4 +60,24 @@ Math.Max(a,b,)
"(4,0--4,14)", 503
]

assertHasSymbolUsages ["Max"] checkResults
assertHasSymbolUsages ["Max"] checkResults

module Constraints =
[<Fact>]
let ``Type 01`` () =
assertHasSymbolUsageAtCaret "f" """
let f (x: string) =
x + 1

{caret}f ""
"""

[<Fact>]
let ``Type 02`` () =
assertHasSymbolUsageAtCaret "M" """
type T =
static member M(x: string) =
x + 1

T.M{caret} ""
"""
2 changes: 0 additions & 2 deletions tests/fsharp/typecheck/sigs/neg68.bsl

This file was deleted.

253 changes: 0 additions & 253 deletions tests/fsharp/typecheck/sigs/neg68.fsx

This file was deleted.

26 changes: 0 additions & 26 deletions tests/fsharp/typecheck/sigs/neg68.vsbsl

This file was deleted.

Loading