diff --git a/src/fsharp/TypeChecker.fs b/src/fsharp/TypeChecker.fs index c77de8b545f..8f7a0a97a9d 100755 --- a/src/fsharp/TypeChecker.fs +++ b/src/fsharp/TypeChecker.fs @@ -8249,16 +8249,16 @@ and TcItemThen cenv overallTy env tpenv (item,mItem,rest,afterOverloadResolution else error(Error(FSComp.SR.tcUnionCaseFieldCannotBeUsedMoreThanOnce(id.idText), id.idRange)) currentIndex <- SEEN_NAMED_ARGUMENT | None -> - // ambiguity may apprear only when if argument is boolean\generic. + // ambiguity may appear only when if argument is boolean\generic. // if // - we didn't find argument with specified name AND // - we have not seen any named arguments so far AND // - type of current argument is bool\generic // then we'll favor old behavior and treat current argument as positional. let isSpecialCaseForBackwardCompatibility = - if currentIndex = SEEN_NAMED_ARGUMENT then false - else - match stripTyEqns cenv.g (List.item currentIndex argtys) with + (currentIndex <> SEEN_NAMED_ARGUMENT) && + (currentIndex < nargtys) && + match stripTyEqns cenv.g argtys.[currentIndex] with | TType_app(tcref, _) -> tyconRefEq cenv.g cenv.g.bool_tcr tcref || tyconRefEq cenv.g cenv.g.system_Bool_tcref tcref | TType_var(_) -> true | _ -> false diff --git a/tests/fsharp/core/libtest/test.fsx b/tests/fsharp/core/libtest/test.fsx index 472e74ea318..a53ec68ab7e 100644 --- a/tests/fsharp/core/libtest/test.fsx +++ b/tests/fsharp/core/libtest/test.fsx @@ -5662,6 +5662,10 @@ module Regression_139182 = static member Prop4 = str.ToLower() // ok member x.Prop5 = s2.TheMethod() // ok +module LittleTestFor823 = + let x, y = 1, 2 + let v = Some ((x = y), (x = x)) + (*--------------------------------------------------------------------------- !* wrap up *--------------------------------------------------------------------------- *)