From ee8af42b22447c68a15fc7fb6985cddbf0d5e2dc Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Wed, 27 May 2026 12:24:24 +0200 Subject: [PATCH 1/7] Remove wide mItem range, pass only narrow terminal-identifier range MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Simplifies the type-checking pipeline by removing the wide (module-qualified) range from resolved-item returns. Only the narrow terminal-identifier range flows through TcItemThen and downstream functions. Affected features: error/warning squiggles now point at the member name (e.g. 'Member') rather than the full qualified path ('Module.Member'). IDE hover, go-to-definition, and find-all-references use the narrow range from NameResolution sinks (unchanged). No impact on IL emission or binary compatibility — all changed APIs are internal. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../Checking/Expressions/CheckExpressions.fs | 73 +++++++++---------- src/Compiler/Checking/NameResolution.fs | 10 +-- src/Compiler/Checking/NameResolution.fsi | 8 +- .../AccessibilityAnnotations/Basic/Basic.fs | 16 ++-- .../OnTypeMembers/OnTypeMembers.fs | 4 +- .../ByrefSafetyAnalysis.fs | 8 +- .../Types/RecordTypes/RecordTypes.fs | 4 +- .../IWSAMsAndSRTPs/IWSAMsAndSRTPsTests.fs | 2 +- .../Types/UnionTypes/UnionTypes.fs | 2 +- .../Debugger/PortablePdbs.fs | 2 +- .../EmittedIL/Literals.fs | 2 +- .../ErrorMessages/TypeMismatchTests.fs | 2 +- .../Interop/RequiredAndInitOnlyProperties.fs | 4 +- .../Interop/VisibilityTests.fs | 6 +- .../Language/DotLambdaTests.fs | 4 +- .../Language/FixedBindings/FixedBindings.fs | 32 ++++---- .../Nullness/NullableCsharpImportTests.fs | 2 +- .../Nullness/NullableReferenceTypesTests.fs | 14 ++-- .../Nullness/NullableRegressionTests.fs | 2 +- .../ObsoleteAttributeCheckingTests.fs | 18 ++--- .../Shadowing/E_NoChangeForEvent.fsx.err.bsl | 4 +- .../Compiler/Language/StringInterpolation.fs | 2 +- .../Core/NativeInterop/StackallocTests.fs | 10 +-- tests/fsharp/core/auto-widen/preview/test.bsl | 16 ++-- tests/fsharp/core/quotesDebugInfo/test.fsx | 2 +- ...ROVIDER_GetInvokerExpression_Exception.bsl | 2 +- ...VIL_PROVIDER_GetInvokerExpression_Null.bsl | 2 +- .../negTests/InvalidInvokerExpression.bsl | 2 +- tests/fsharp/typeProviders/negTests/neg1.bsl | 2 +- tests/fsharp/typecheck/sigs/neg10.bsl | 20 ++--- tests/fsharp/typecheck/sigs/neg15.bsl | 14 ++-- tests/fsharp/typecheck/sigs/neg17.bsl | 4 +- tests/fsharp/typecheck/sigs/neg37_a.bsl | 2 +- tests/fsharp/typecheck/sigs/neg56_a.bsl | 2 +- tests/fsharp/typecheck/sigs/neg56_b.bsl | 4 +- tests/fsharp/typecheck/sigs/neg90.bsl | 2 +- tests/fsharp/typecheck/sigs/neg91.bsl | 8 +- tests/fsharp/typecheck/sigs/neg_byref_3.bsl | 4 +- tests/fsharp/typecheck/sigs/neg_byref_4.bsl | 4 +- 39 files changed, 159 insertions(+), 162 deletions(-) diff --git a/src/Compiler/Checking/Expressions/CheckExpressions.fs b/src/Compiler/Checking/Expressions/CheckExpressions.fs index 83e172628b5..7bb5c3079e8 100644 --- a/src/Compiler/Checking/Expressions/CheckExpressions.fs +++ b/src/Compiler/Checking/Expressions/CheckExpressions.fs @@ -6669,7 +6669,6 @@ and TcTyparExprThen (cenv: cenv) overallTy env tpenv synTypar m delayed = | DelayedDotLookup (ident :: rest, m2) :: delayed2 -> let ad = env.eAccessRights let tp, tpenv = TcTypar cenv env NoNewTypars tpenv synTypar - let mExprAndLongId = unionRanges synTypar.Range ident.idRange let ty = mkTyparTy tp let lookupKind = LookupKind.Expr LookupIsInstance.Ambivalent let item, _rest = ResolveLongIdentInType cenv.tcSink cenv.nameResolver env.NameEnv lookupKind ident.idRange ad ident IgnoreOverrides TypeNameResolutionInfo.Default ty @@ -6678,7 +6677,7 @@ and TcTyparExprThen (cenv: cenv) overallTy env tpenv synTypar m delayed = | [] -> delayed2 | _ -> DelayedDotLookup (rest, m2) :: delayed2 CallNameResolutionSink cenv.tcSink (ident.idRange, env.NameEnv, item, emptyTyparInst, ItemOccurrence.Use, env.AccessRights) - TcItemThen cenv overallTy env tpenv ([], item, mExprAndLongId, ident.idRange, [], AfterResolution.DoNothing) (Some ty) delayed3 + TcItemThen cenv overallTy env tpenv ([], item, ident.idRange, [], AfterResolution.DoNothing) (Some ty) delayed3 //TcLookupItemThen cenv overallTy env tpenv mObjExpr objExpr objExprTy delayed item mItem rest afterResolution | _ -> let (SynTypar(_, q, _)) = synTypar @@ -8667,7 +8666,7 @@ and TcNameOfExpr (cenv: cenv) env tpenv (synArg: SynExpr) = let nameResolutionResult = ResolveLongIdentAsExprAndComputeRange cenv.tcSink cenv.nameResolver (rangeOfLid longId) ad env.eNameResEnv typeNameResInfo longId None let resolvesAsExpr = match nameResolutionResult with - | Result (tinstEnclosing, item, mItem, mItemIdent, rest, afterRes) + | Result (tinstEnclosing, item, mItem, rest, afterRes) when (match item with | Item.DelegateCtor _ @@ -8678,7 +8677,7 @@ and TcNameOfExpr (cenv: cenv) env tpenv (synArg: SynExpr) = | _ -> true | _ -> true) -> let overallTy = match overallTyOpt with None -> MustEqual (NewInferenceType g) | Some t -> t - let _, _ = TcItemThen cenv overallTy env tpenv (tinstEnclosing, item, mItem, mItemIdent, rest, afterRes) None delayed + let _, _ = TcItemThen cenv overallTy env tpenv (tinstEnclosing, item, mItem, rest, afterRes) None delayed true | _ -> false @@ -8905,18 +8904,18 @@ and TcLongIdentThen (cenv: cenv) (overallTy: OverallTy) env tpenv (SynLongIdent( let ad = env.eAccessRights let typeNameResInfo = GetLongIdentTypeNameInfo delayed - let (tinstEnclosing, item, mItem, mItemIdent, rest, afterResolution) = + let (tinstEnclosing, item, mItem, rest, afterResolution) = let maybeAppliedArgExpr = DelayedItem.maybeAppliedArgForPreferExtensionOverProperty delayed ResolveLongIdentAsExprAndComputeRange cenv.tcSink cenv.nameResolver (rangeOfLid longId) ad env.eNameResEnv typeNameResInfo longId maybeAppliedArgExpr |> ForceRaise - TcItemThen cenv overallTy env tpenv (tinstEnclosing, item, mItem, mItemIdent, rest, afterResolution) None delayed + TcItemThen cenv overallTy env tpenv (tinstEnclosing, item, mItem, rest, afterResolution) None delayed //------------------------------------------------------------------------- // Typecheck "item+projections" //------------------------------------------------------------------------- *) -// mItem = range of all resolved long-ident segments; mItemIdent = terminal ident only (for diagnostic ranges) -and TcItemThen (cenv: cenv) (overallTy: OverallTy) env tpenv (tinstEnclosing, item, mItem, mItemIdent, rest, afterResolution) staticTyOpt delayed = +// mItem = range of the terminal identifier (for diagnostic and expression ranges) +and TcItemThen (cenv: cenv) (overallTy: OverallTy) env tpenv (tinstEnclosing, item, mItem, rest, afterResolution) staticTyOpt delayed = let delayed = delayRest rest mItem delayed match item with // x where x is a union case or active pattern result tag. @@ -8927,13 +8926,13 @@ and TcItemThen (cenv: cenv) (overallTy: OverallTy) env tpenv (tinstEnclosing, it TcTypeItemThen cenv overallTy env nm ty tpenv mItem tinstEnclosing delayed | Item.MethodGroup (methodName, minfos, _) -> - TcMethodItemThen cenv overallTy env item methodName minfos tpenv mItem mItemIdent afterResolution staticTyOpt delayed + TcMethodItemThen cenv overallTy env item methodName minfos tpenv mItem afterResolution staticTyOpt delayed | Item.Trait traitInfo -> TcTraitItemThen cenv overallTy env None traitInfo tpenv mItem delayed | Item.CtorGroup(nm, minfos) -> - TcCtorItemThen cenv overallTy env item nm minfos tinstEnclosing tpenv mItem mItemIdent afterResolution delayed + TcCtorItemThen cenv overallTy env item nm minfos tinstEnclosing tpenv mItem afterResolution delayed | Item.ImplicitOp(id, sln) -> TcImplicitOpItemThen cenv overallTy env id sln tpenv mItem delayed @@ -8945,7 +8944,7 @@ and TcItemThen (cenv: cenv) (overallTy: OverallTy) env tpenv (tinstEnclosing, it TcValueItemThen cenv overallTy env vref tpenv mItem afterResolution delayed | Item.Property (nm, pinfos, _) -> - TcPropertyItemThen cenv overallTy env nm pinfos tpenv mItem mItemIdent afterResolution staticTyOpt delayed + TcPropertyItemThen cenv overallTy env nm pinfos tpenv mItem afterResolution staticTyOpt delayed | Item.ILField finfo -> TcILFieldItemThen cenv overallTy env finfo tpenv mItem delayed @@ -9156,8 +9155,8 @@ and TcTypeItemThen (cenv: cenv) overallTy env nm ty tpenv mItem tinstEnclosing d let item = Item.Types(nm, [ty]) CallNameResolutionSink cenv.tcSink (mExprAndTypeArgs, env.NameEnv, item, emptyTyparInst, ItemOccurrence.Use, env.eAccessRights) let typeNameResInfo = GetLongIdentTypeNameInfo otherDelayed - let item, mItem, mItemIdent, rest, afterResolution = ResolveExprDotLongIdentAndComputeRange cenv.tcSink cenv.nameResolver (unionRanges mExprAndTypeArgs mLongId) ad env.eNameResEnv ty longId typeNameResInfo IgnoreOverrides true None - TcItemThen cenv overallTy env tpenv ((argsOfAppTy g ty), item, mItem, mItemIdent, rest, afterResolution) None otherDelayed + let item, mItem, rest, afterResolution = ResolveExprDotLongIdentAndComputeRange cenv.tcSink cenv.nameResolver (unionRanges mExprAndTypeArgs mLongId) ad env.eNameResEnv ty longId typeNameResInfo IgnoreOverrides true None + TcItemThen cenv overallTy env tpenv ((argsOfAppTy g ty), item, mItem, rest, afterResolution) None otherDelayed | DelayedTypeApp(tyargs, _mTypeArgs, mExprAndTypeArgs) :: _delayed' -> // A case where we have an incomplete name e.g. 'Foo.' - we still want to report it to VS! @@ -9177,13 +9176,13 @@ and TcTypeItemThen (cenv: cenv) overallTy env nm ty tpenv mItem tinstEnclosing d else error(Error(FSComp.SR.tcInvalidUseOfTypeName(), mItem)) -and TcMethodItemThen (cenv: cenv) overallTy env item methodName minfos tpenv mItem mItemIdent afterResolution staticTyOpt delayed = +and TcMethodItemThen (cenv: cenv) overallTy env item methodName minfos tpenv mItem afterResolution staticTyOpt delayed = let ad = env.eAccessRights // Static method calls Type.Foo(arg1, ..., argn) let meths = List.map (fun minfo -> minfo, None) minfos match delayed with | DelayedApp (atomicFlag, _, _, arg, mExprAndArg) :: otherDelayed -> - TcMethodApplicationThen cenv env overallTy None tpenv None [] mExprAndArg mItemIdent methodName ad NeverMutates false meths afterResolution NormalValUse [arg] atomicFlag staticTyOpt otherDelayed + TcMethodApplicationThen cenv env overallTy None tpenv None [] mExprAndArg mItem methodName ad NeverMutates false meths afterResolution NormalValUse [arg] atomicFlag staticTyOpt otherDelayed | DelayedTypeApp(tys, mTypeArgs, mExprAndTypeArgs) :: otherDelayed -> @@ -9197,9 +9196,9 @@ and TcMethodItemThen (cenv: cenv) overallTy env item methodName minfos tpenv mIt match otherDelayed with | DelayedApp(atomicFlag, _, _, arg, mExprAndArg) :: otherDelayed -> - TcMethodApplicationThen cenv env overallTy None tpenv None [] mExprAndArg mItemIdent methodName ad NeverMutates false [(minfoAfterStaticArguments, None)] afterResolution NormalValUse [arg] atomicFlag staticTyOpt otherDelayed + TcMethodApplicationThen cenv env overallTy None tpenv None [] mExprAndArg mItem methodName ad NeverMutates false [(minfoAfterStaticArguments, None)] afterResolution NormalValUse [arg] atomicFlag staticTyOpt otherDelayed | _ -> - TcMethodApplicationThen cenv env overallTy None tpenv None [] mExprAndTypeArgs mItemIdent methodName ad NeverMutates false [(minfoAfterStaticArguments, None)] afterResolution NormalValUse [] ExprAtomicFlag.Atomic staticTyOpt otherDelayed + TcMethodApplicationThen cenv env overallTy None tpenv None [] mExprAndTypeArgs mItem methodName ad NeverMutates false [(minfoAfterStaticArguments, None)] afterResolution NormalValUse [] ExprAtomicFlag.Atomic staticTyOpt otherDelayed | None -> #endif @@ -9213,18 +9212,18 @@ and TcMethodItemThen (cenv: cenv) overallTy env item methodName minfos tpenv mIt match otherDelayed with | DelayedApp(atomicFlag, _, _, arg, mExprAndArg) :: otherDelayed -> - TcMethodApplicationThen cenv env overallTy None tpenv (Some tyargs) [] mExprAndArg mItemIdent methodName ad NeverMutates false meths afterResolution NormalValUse [arg] atomicFlag staticTyOpt otherDelayed + TcMethodApplicationThen cenv env overallTy None tpenv (Some tyargs) [] mExprAndArg mItem methodName ad NeverMutates false meths afterResolution NormalValUse [arg] atomicFlag staticTyOpt otherDelayed | _ -> - TcMethodApplicationThen cenv env overallTy None tpenv (Some tyargs) [] mExprAndTypeArgs mItemIdent methodName ad NeverMutates false meths afterResolution NormalValUse [] ExprAtomicFlag.Atomic staticTyOpt otherDelayed + TcMethodApplicationThen cenv env overallTy None tpenv (Some tyargs) [] mExprAndTypeArgs mItem methodName ad NeverMutates false meths afterResolution NormalValUse [] ExprAtomicFlag.Atomic staticTyOpt otherDelayed | _ -> #if !NO_TYPEPROVIDERS if not minfos.IsEmpty && minfos[0].ProvidedStaticParameterInfo.IsSome then error(Error(FSComp.SR.etMissingStaticArgumentsToMethod(), mItem)) #endif - TcMethodApplicationThen cenv env overallTy None tpenv None [] mItem mItemIdent methodName ad NeverMutates false meths afterResolution NormalValUse [] ExprAtomicFlag.Atomic staticTyOpt delayed + TcMethodApplicationThen cenv env overallTy None tpenv None [] mItem mItem methodName ad NeverMutates false meths afterResolution NormalValUse [] ExprAtomicFlag.Atomic staticTyOpt delayed -and TcCtorItemThen (cenv: cenv) overallTy env item nm minfos tinstEnclosing tpenv mItem mItemIdent afterResolution delayed = +and TcCtorItemThen (cenv: cenv) overallTy env item nm minfos tinstEnclosing tpenv mItem afterResolution delayed = #if !NO_TYPEPROVIDERS let g = cenv.g let ad = env.eAccessRights @@ -9238,7 +9237,7 @@ and TcCtorItemThen (cenv: cenv) overallTy env item nm minfos tinstEnclosing tpen | DelayedApp(_, _, _, arg, mExprAndArg) :: otherDelayed -> CallExprHasTypeSink cenv.tcSink (mExprAndArg, env.NameEnv, objTy, env.eAccessRights) - TcCtorCall true cenv env tpenv overallTy objTy (Some mItemIdent) item false [arg] mExprAndArg otherDelayed (Some afterResolution) + TcCtorCall true cenv env tpenv overallTy objTy (Some mItem) item false [arg] mExprAndArg otherDelayed (Some afterResolution) | DelayedTypeApp(tyargs, _mTypeArgs, mExprAndTypeArgs) :: DelayedApp(_, _, _, arg, mExprAndArg) :: otherDelayed -> @@ -9259,7 +9258,7 @@ and TcCtorItemThen (cenv: cenv) overallTy env item nm minfos tinstEnclosing tpen item, minfos minfosAfterTyArgs |> List.iter (fun minfo -> UnifyTypes cenv env mExprAndTypeArgs minfo.ApparentEnclosingType objTyAfterTyArgs) - TcCtorCall true cenv env tpenv overallTy objTyAfterTyArgs (Some mItemIdent) itemAfterTyArgs false [arg] mExprAndArg otherDelayed (Some afterResolution) + TcCtorCall true cenv env tpenv overallTy objTyAfterTyArgs (Some mItem) itemAfterTyArgs false [arg] mExprAndArg otherDelayed (Some afterResolution) | DelayedTypeApp(tyargs, _mTypeArgs, mExprAndTypeArgs) :: otherDelayed -> @@ -9270,11 +9269,11 @@ and TcCtorItemThen (cenv: cenv) overallTy env item nm minfos tinstEnclosing tpen CallNameResolutionSink cenv.tcSink (mExprAndTypeArgs, env.NameEnv, resolvedItem, emptyTyparInst, ItemOccurrence.Use, env.eAccessRights) minfos |> List.iter (fun minfo -> UnifyTypes cenv env mExprAndTypeArgs minfo.ApparentEnclosingType objTy) - TcCtorCall true cenv env tpenv overallTy objTy (Some mItemIdent) item false [] mExprAndTypeArgs otherDelayed (Some afterResolution) + TcCtorCall true cenv env tpenv overallTy objTy (Some mItem) item false [] mExprAndTypeArgs otherDelayed (Some afterResolution) | _ -> - TcCtorCall true cenv env tpenv overallTy objTy (Some mItemIdent) item false [] mItem delayed (Some afterResolution) + TcCtorCall true cenv env tpenv overallTy objTy (Some mItem) item false [] mItem delayed (Some afterResolution) and TcTraitItemThen (cenv: cenv) overallTy env objOpt traitInfo tpenv mItem delayed = let g = cenv.g @@ -9580,7 +9579,7 @@ and TcValueItemThen cenv overallTy env vref tpenv mItem afterResolution delayed PropagateThenTcDelayed cenv overallTy env tpenv mItem vexpFlex vexpFlex.Type ExprAtomicFlag.Atomic delayed -and TcPropertyItemThen cenv overallTy env nm pinfos tpenv mItem mItemIdent afterResolution staticTyOpt delayed = +and TcPropertyItemThen cenv overallTy env nm pinfos tpenv mItem afterResolution staticTyOpt delayed = let g = cenv.g let ad = env.eAccessRights @@ -9618,19 +9617,19 @@ and TcPropertyItemThen cenv overallTy env nm pinfos tpenv mItem mItemIdent after // x.P <- ... byref setter if isNil meths then error (Error (FSComp.SR.tcPropertyIsNotReadable nm, mItem)) - TcMethodApplicationThen cenv env overallTy None tpenv tyArgsOpt [] mItem mItemIdent nm ad NeverMutates true meths afterResolution NormalValUse args ExprAtomicFlag.Atomic staticTyOpt delayed + TcMethodApplicationThen cenv env overallTy None tpenv tyArgsOpt [] mItem mItem nm ad NeverMutates true meths afterResolution NormalValUse args ExprAtomicFlag.Atomic staticTyOpt delayed else let args = if pinfo.IsIndexer then args else [] if isNil meths then errorR (Error (FSComp.SR.tcPropertyCannotBeSet1 nm, mItem)) // Note: static calls never mutate a struct object argument - TcMethodApplicationThen cenv env overallTy None tpenv tyArgsOpt [] mStmt mItemIdent nm ad NeverMutates true meths afterResolution NormalValUse (args@[expr2]) ExprAtomicFlag.NonAtomic staticTyOpt otherDelayed + TcMethodApplicationThen cenv env overallTy None tpenv tyArgsOpt [] mStmt mItem nm ad NeverMutates true meths afterResolution NormalValUse (args@[expr2]) ExprAtomicFlag.NonAtomic staticTyOpt otherDelayed | _ -> // Static Property Get (possibly indexer) let meths = pinfos |> GettersOfPropInfos if isNil meths then error (Error (FSComp.SR.tcPropertyIsNotReadable nm, mItem)) // Note: static calls never mutate a struct object argument - TcMethodApplicationThen cenv env overallTy None tpenv tyArgsOpt [] mItem mItemIdent nm ad NeverMutates true meths afterResolution NormalValUse args ExprAtomicFlag.Atomic staticTyOpt delayed + TcMethodApplicationThen cenv env overallTy None tpenv tyArgsOpt [] mItem mItem nm ad NeverMutates true meths afterResolution NormalValUse args ExprAtomicFlag.Atomic staticTyOpt delayed and TcILFieldItemThen cenv overallTy env finfo tpenv mItem delayed = let g = cenv.g @@ -9756,10 +9755,10 @@ and TcLookupThen cenv overallTy env tpenv mObjExpr objExpr objExprTy longId dela CanonicalizePartialInferenceProblem cenv.css env.DisplayEnv mExprAndLongId (freeInTypeLeftToRight g false objExprTy) let maybeAppliedArgExpr = DelayedItem.maybeAppliedArgForPreferExtensionOverProperty delayed - let item, mItem, mItemIdent, rest, afterResolution = ResolveExprDotLongIdentAndComputeRange cenv.tcSink cenv.nameResolver mExprAndLongId ad env.NameEnv objExprTy longId TypeNameResolutionInfo.Default findFlag false maybeAppliedArgExpr - TcLookupItemThen cenv overallTy env tpenv mObjExpr objExpr objExprTy delayed item mItem mItemIdent rest afterResolution + let item, mItem, rest, afterResolution = ResolveExprDotLongIdentAndComputeRange cenv.tcSink cenv.nameResolver mExprAndLongId ad env.NameEnv objExprTy longId TypeNameResolutionInfo.Default findFlag false maybeAppliedArgExpr + TcLookupItemThen cenv overallTy env tpenv mObjExpr objExpr objExprTy delayed item mItem rest afterResolution -and TcLookupItemThen cenv overallTy env tpenv mObjExpr objExpr objExprTy delayed item mItem mItemIdent rest afterResolution = +and TcLookupItemThen cenv overallTy env tpenv mObjExpr objExpr objExprTy delayed item mItem rest afterResolution = let g = cenv.g let ad = env.eAccessRights let objArgs = [objExpr] @@ -9785,7 +9784,7 @@ and TcLookupItemThen cenv overallTy env tpenv mObjExpr objExpr objExprTy delayed let item = Item.MethodGroup(methodName, [minfoAfterStaticArguments], Some minfos[0]) CallNameResolutionSinkReplacing cenv.tcSink (mExprAndItem, env.NameEnv, item, [], ItemOccurrence.Use, env.eAccessRights) - TcMethodApplicationThen cenv env overallTy None tpenv None objArgs mExprAndItem mItemIdent methodName ad mutates false [(minfoAfterStaticArguments, None)] afterResolution NormalValUse args atomicFlag None delayed + TcMethodApplicationThen cenv env overallTy None tpenv None objArgs mExprAndItem mItem methodName ad mutates false [(minfoAfterStaticArguments, None)] afterResolution NormalValUse args atomicFlag None delayed | None -> if not minfos.IsEmpty && minfos[0].ProvidedStaticParameterInfo.IsSome then error(Error(FSComp.SR.etMissingStaticArgumentsToMethod(), mItem)) @@ -9794,7 +9793,7 @@ and TcLookupItemThen cenv overallTy env tpenv mObjExpr objExpr objExprTy delayed let tyArgsOpt, tpenv = TcMemberTyArgsOpt cenv env tpenv tyArgsOpt let meths = minfos |> List.map (fun minfo -> minfo, None) - TcMethodApplicationThen cenv env overallTy None tpenv tyArgsOpt objArgs mExprAndItem mItemIdent methodName ad mutates false meths afterResolution NormalValUse args atomicFlag None delayed + TcMethodApplicationThen cenv env overallTy None tpenv tyArgsOpt objArgs mExprAndItem mItem methodName ad mutates false meths afterResolution NormalValUse args atomicFlag None delayed | Item.Property (nm, pinfos, _) -> // Instance property @@ -9822,7 +9821,7 @@ and TcLookupItemThen cenv overallTy env tpenv mObjExpr objExpr objExprTy delayed errorR (Error (FSComp.SR.tcPropertyCannotBeSet1 nm, mItem)) // x.P <- ... byref setter if isNil meths then error (Error (FSComp.SR.tcPropertyIsNotReadable nm, mItem)) - TcMethodApplicationThen cenv env overallTy None tpenv tyArgsOpt objArgs mExprAndItem mItemIdent nm ad PossiblyMutates true meths afterResolution NormalValUse args atomicFlag None delayed + TcMethodApplicationThen cenv env overallTy None tpenv tyArgsOpt objArgs mExprAndItem mItem nm ad PossiblyMutates true meths afterResolution NormalValUse args atomicFlag None delayed else if g.langVersion.SupportsFeature(LanguageFeature.RequiredPropertiesSupport) && pinfo.IsSetterInitOnly then @@ -9830,12 +9829,12 @@ and TcLookupItemThen cenv overallTy env tpenv mObjExpr objExpr objExprTy delayed let args = if pinfo.IsIndexer then args else [] let mut = (if isStructTy g (tyOfExpr g objExpr) then DefinitelyMutates else PossiblyMutates) - TcMethodApplicationThen cenv env overallTy None tpenv tyArgsOpt objArgs mStmt mItemIdent nm ad mut true meths afterResolution NormalValUse (args @ [expr2]) atomicFlag None [] + TcMethodApplicationThen cenv env overallTy None tpenv tyArgsOpt objArgs mStmt mItem nm ad mut true meths afterResolution NormalValUse (args @ [expr2]) atomicFlag None [] | _ -> // Instance property getter let meths = GettersOfPropInfos pinfos if isNil meths then error (Error (FSComp.SR.tcPropertyIsNotReadable nm, mItem)) - TcMethodApplicationThen cenv env overallTy None tpenv tyArgsOpt objArgs mExprAndItem mItemIdent nm ad PossiblyMutates true meths afterResolution NormalValUse args atomicFlag None delayed + TcMethodApplicationThen cenv env overallTy None tpenv tyArgsOpt objArgs mExprAndItem mItem nm ad PossiblyMutates true meths afterResolution NormalValUse args atomicFlag None delayed | Item.RecdField rfinfo -> // Get or set instance F# field or literal diff --git a/src/Compiler/Checking/NameResolution.fs b/src/Compiler/Checking/NameResolution.fs index 898dc78aa75..db2ef084879 100644 --- a/src/Compiler/Checking/NameResolution.fs +++ b/src/Compiler/Checking/NameResolution.fs @@ -4293,8 +4293,7 @@ let ResolveLongIdentAsExprAndComputeRange (sink: TcResultsSink) (ncenv: NameReso // #16621 match refinedItem with | Item.Property(_, pinfos, _) -> - let propIdentRange = if rest.IsEmpty then (List.last lid).idRange else itemRange - RegisterUnionCaseTesterForProperty sink propIdentRange pinfos + RegisterUnionCaseTesterForProperty sink itemIdentRange pinfos | _ -> () let callSinkWithSpecificOverload (minfo: MethInfo, pinfoOpt: PropInfo option, tpinst) = @@ -4321,7 +4320,7 @@ let ResolveLongIdentAsExprAndComputeRange (sink: TcResultsSink) (ncenv: NameReso callSink (item, emptyTyparInst) AfterResolution.DoNothing - success (tinstEnclosing, item, itemRange, itemIdentRange, rest, afterResolution) + success (tinstEnclosing, item, itemIdentRange, rest, afterResolution) [] let (|NonOverridable|_|) namedItem = @@ -4369,8 +4368,7 @@ let ResolveExprDotLongIdentAndComputeRange (sink: TcResultsSink) (ncenv: NameRes // #16621 match refinedItem with | Item.Property(_, pinfos, _) -> - let propIdentRange = if rest.IsEmpty then (List.last lid).idRange else itemRange - RegisterUnionCaseTesterForProperty sink propIdentRange pinfos + RegisterUnionCaseTesterForProperty sink itemIdentRange pinfos | _ -> () let callSinkWithSpecificOverload (minfo: MethInfo, pinfoOpt: PropInfo option, tpinst) = @@ -4391,7 +4389,7 @@ let ResolveExprDotLongIdentAndComputeRange (sink: TcResultsSink) (ncenv: NameRes callSink (unrefinedItem, emptyTyparInst) AfterResolution.DoNothing - item, itemRange, itemIdentRange, rest, afterResolution + item, itemIdentRange, rest, afterResolution //------------------------------------------------------------------------- diff --git a/src/Compiler/Checking/NameResolution.fsi b/src/Compiler/Checking/NameResolution.fsi index 1dc02a2245b..2746200d165 100755 --- a/src/Compiler/Checking/NameResolution.fsi +++ b/src/Compiler/Checking/NameResolution.fsi @@ -878,7 +878,7 @@ val internal ResolvePartialLongIdentToClassOrRecdFields: val internal ResolveRecordOrClassFieldsOfType: NameResolver -> range -> AccessorDomain -> TType -> bool -> Item list /// Resolve a long identifier occurring in an expression position. -/// Also returns the terminal identifier range for error diagnostics (#14284). +/// Returns the terminal identifier range for diagnostics and expression ranges (#14284). val internal ResolveLongIdentAsExprAndComputeRange: sink: TcResultsSink -> ncenv: NameResolver -> @@ -888,10 +888,10 @@ val internal ResolveLongIdentAsExprAndComputeRange: typeNameResInfo: TypeNameResolutionInfo -> lid: Ident list -> maybeAppliedArgExpr: SynExpr option -> - ResultOrException + ResultOrException /// Resolve a long identifier occurring in an expression position, qualified by a type. -/// Also returns the terminal identifier range for error diagnostics (#14284). +/// Returns the terminal identifier range for diagnostics and expression ranges (#14284). val internal ResolveExprDotLongIdentAndComputeRange: sink: TcResultsSink -> ncenv: NameResolver -> @@ -904,7 +904,7 @@ val internal ResolveExprDotLongIdentAndComputeRange: findFlag: FindMemberFlag -> staticOnly: bool -> maybeAppliedArgExpr: SynExpr option -> - Item * range * range * Ident list * AfterResolution + Item * range * Ident list * AfterResolution /// A generator of type instantiations used when no more specific type instantiation is known. val FakeInstantiationGenerator: range -> Typar list -> TType list diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/Basic.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/Basic.fs index f76552ba8d9..3a283f18cc0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/Basic.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/Basic.fs @@ -57,8 +57,8 @@ module AccessibilityAnnotations_Basic = |> verifyCompile |> shouldFail |> withDiagnostics [ - (Error 1094, Line 18, Col 17, Line 18, Col 41, "The value 'somePrivateField' is not accessible from this code location") - (Error 1094, Line 19, Col 17, Line 19, Col 42, "The value 'somePrivateMethod' is not accessible from this code location") + (Error 1094, Line 18, Col 25, Line 18, Col 41, "The value 'somePrivateField' is not accessible from this code location") + (Error 1094, Line 19, Col 25, Line 19, Col 42, "The value 'somePrivateMethod' is not accessible from this code location") (Error 491, Line 23, Col 17, Line 23, Col 34, "The member or object constructor 'PrivateMethod' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions.") ] @@ -70,11 +70,11 @@ module AccessibilityAnnotations_Basic = |> shouldFail |> withDiagnostics [ (Error 1092, Line 26, Col 19, Line 26, Col 32, "The type 'PrivateModule' is not accessible from this code location") - (Error 1094, Line 26, Col 17, Line 26, Col 34, "The value 'x' is not accessible from this code location") + (Error 1094, Line 26, Col 33, Line 26, Col 34, "The value 'x' is not accessible from this code location") (Error 1092, Line 27, Col 19, Line 27, Col 32, "The type 'PrivateModule' is not accessible from this code location") - (Error 1094, Line 27, Col 17, Line 27, Col 34, "The value 'f' is not accessible from this code location") - (Error 1094, Line 29, Col 17, Line 29, Col 20, "The value 'y' is not accessible from this code location") - (Error 1094, Line 30, Col 17, Line 30, Col 20, "The value 'g' is not accessible from this code location") + (Error 1094, Line 27, Col 33, Line 27, Col 34, "The value 'f' is not accessible from this code location") + (Error 1094, Line 29, Col 19, Line 29, Col 20, "The value 'y' is not accessible from this code location") + (Error 1094, Line 30, Col 19, Line 30, Col 20, "The value 'g' is not accessible from this code location") ] //SOURCE=E_privateThingsInaccessible03.fs SCFLAGS="--test:ErrorRanges" # E_privateThingsInaccessible03.fs @@ -85,7 +85,7 @@ module AccessibilityAnnotations_Basic = |> shouldFail |> withDiagnostics [ (Error 1092, Line 11, Col 15, Line 11, Col 28, "The type 'PrivateModule' is not accessible from this code location") - (Error 1094, Line 11, Col 13, Line 11, Col 30, "The value 'x' is not accessible from this code location") + (Error 1094, Line 11, Col 29, Line 11, Col 30, "The value 'x' is not accessible from this code location") (Error 39, Line 15, Col 13, Line 15, Col 26, "The value, namespace, type or module 'PrivateModule' is not defined.") ] @@ -109,7 +109,7 @@ module AccessibilityAnnotations_Basic = |> verifyCompile |> shouldFail |> withDiagnostics [ - (Error 1096, Line 11, Col 9, Line 11, Col 24, "The record, struct or class field 'foo' is not accessible from this code location") + (Error 1096, Line 11, Col 21, Line 11, Col 24, "The record, struct or class field 'foo' is not accessible from this code location") ] //SOURCE=E_PrivateImplicitCtor01.fs SCFLAGS="--test:ErrorRanges" # E_PrivateImplicitCtor01.fs diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnTypeMembers/OnTypeMembers.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnTypeMembers/OnTypeMembers.fs index 49c79c2600d..810ae5ecc20 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnTypeMembers/OnTypeMembers.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/OnTypeMembers/OnTypeMembers.fs @@ -67,12 +67,12 @@ module AccessibilityAnnotations_OnTypeMembers = (Error 491, Line 42, Col 19, Line 42, Col 26, "The member or object constructor 'test2' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions.") (Error 491, Line 42, Col 29, Line 42, Col 36, "The member or object constructor 'test5' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions.") (Error 491, Line 42, Col 40, Line 42, Col 47, "The member or object constructor 'test6' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions.") - (Error 807, Line 42, Col 60, Line 42, Col 67, "Property 'test8' is not readable") + (Error 807, Line 42, Col 62, Line 42, Col 67, "Property 'test8' is not readable") (Error 491, Line 43, Col 1, Line 43, Col 13, "The member or object constructor 'test3' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions.") (Error 491, Line 44, Col 1, Line 44, Col 13, "The member or object constructor 'test4' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions.") (Error 491, Line 45, Col 1, Line 45, Col 13, "The member or object constructor 'test5' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions.") (Error 491, Line 46, Col 1, Line 46, Col 13, "The member or object constructor 'test6' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions.") - (Error 810, Line 47, Col 1, Line 47, Col 8, "Property 'test7' cannot be set") + (Error 810, Line 47, Col 3, Line 47, Col 8, "Property 'test7' cannot be set") (Error 257, Line 47, Col 1, Line 47, Col 8, "Invalid mutation of a constant expression. Consider copying the expression to a mutable local, e.g. 'let mutable x = ...'.") ] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefSafetyAnalysis.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefSafetyAnalysis.fs index 40d511a028b..afcce5ec918 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefSafetyAnalysis.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefSafetyAnalysis.fs @@ -97,11 +97,11 @@ module ByrefSafetyAnalysis = (Error 412, Line 178, Col 13, Line 178, Col 24, "A type instantiation involves a byref type. This is not permitted by the rules of Common IL.") (Error 412, Line 183, Col 9, Line 183, Col 20, "A type instantiation involves a byref type. This is not permitted by the rules of Common IL.") (Error 412, Line 187, Col 13, Line 187, Col 14, "A type instantiation involves a byref type. This is not permitted by the rules of Common IL.") - (Error 412, Line 187, Col 17, Line 187, Col 32, "A type instantiation involves a byref type. This is not permitted by the rules of Common IL.") - (Error 425, Line 187, Col 17, Line 187, Col 32, "The type of a first-class function cannot contain byrefs") + (Error 412, Line 187, Col 28, Line 187, Col 32, "A type instantiation involves a byref type. This is not permitted by the rules of Common IL.") + (Error 425, Line 187, Col 28, Line 187, Col 32, "The type of a first-class function cannot contain byrefs") (Error 412, Line 191, Col 13, Line 191, Col 14, "A type instantiation involves a byref type. This is not permitted by the rules of Common IL.") - (Error 412, Line 193, Col 13, Line 193, Col 28, "A type instantiation involves a byref type. This is not permitted by the rules of Common IL.") - (Error 412, Line 198, Col 9, Line 198, Col 24, "A type instantiation involves a byref type. This is not permitted by the rules of Common IL.") + (Error 412, Line 193, Col 24, Line 193, Col 28, "A type instantiation involves a byref type. This is not permitted by the rules of Common IL.") + (Error 412, Line 198, Col 20, Line 198, Col 24, "A type instantiation involves a byref type. This is not permitted by the rules of Common IL.") (Error 3301, Line 201, Col 9, Line 201, Col 15, "The function or method has an invalid return type 'byref * int'. This is not permitted by the rules of Common IL.") (Error 412, Line 203, Col 10, Line 203, Col 15, "A type instantiation involves a byref type. This is not permitted by the rules of Common IL.") (Error 421, Line 203, Col 11, Line 203, Col 12, "The address of the variable 'x' cannot be used at this point") diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/RecordTypes.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/RecordTypes.fs index e5fefa0b7c2..3bae9db5802 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/RecordTypes.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/RecordTypes.fs @@ -115,9 +115,9 @@ module RecordTypes = |> withDiagnostics [ (Warning 464, Line 15, Col 22, Line 15, Col 28, "This code is less generic than indicated by its annotations. A unit-of-measure specified using '_' has been determined to be '1', i.e. dimensionless. Consider making the code generic, or removing the use of '_'.") (Warning 464, Line 15, Col 35, Line 15, Col 42, "This code is less generic than indicated by its annotations. A unit-of-measure specified using '_' has been determined to be '1', i.e. dimensionless. Consider making the code generic, or removing the use of '_'.") - (Error 5, Line 17, Col 1, Line 17, Col 5, "This field is not mutable") + (Error 5, Line 17, Col 4, Line 17, Col 5, "This field is not mutable") (Error 1, Line 17, Col 16, Line 17, Col 22, "The type 'float' does not match the type 'decimal'") - (Error 5, Line 18, Col 1, Line 18, Col 5, "This field is not mutable") + (Error 5, Line 18, Col 4, Line 18, Col 5, "This field is not mutable") (Error 1, Line 18, Col 16, Line 18, Col 21, "This expression was expected to have type\n 'float' \nbut here has type\n 'decimal' ") ] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/IWSAMsAndSRTPs/IWSAMsAndSRTPsTests.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/IWSAMsAndSRTPs/IWSAMsAndSRTPsTests.fs index fb6c648ca49..f03cfedf70b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/IWSAMsAndSRTPs/IWSAMsAndSRTPsTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/IWSAMsAndSRTPs/IWSAMsAndSRTPsTests.fs @@ -1811,7 +1811,7 @@ let _x3 = curryN f3 1 2 3 let private iwsamWarnings = [ "--nowarn:3536" ; "--nowarn:3535" ] [] - [] + [] [ int", "ITest.Parse \"42\"", "Parse", 3, 9, 3, 25)>] let ``Direct call to static abstract on interface produces error 3866`` (memberDef: string, call: string, memberName: string, l1, c1, l2, c2) = Fsx $"type ITest =\n {memberDef}\nlet x = {call}" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionTypes.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionTypes.fs index 7d5db82abde..9498f53905f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionTypes.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionTypes.fs @@ -124,7 +124,7 @@ module UnionTypes = |> shouldFail |> withDiagnostics [ (Warning 1125, Line 11, Col 29, Line 11, Col 41, "The instantiation of the generic type 'list1' is missing and can't be inferred from the arguments or return type of this member. Consider providing a type instantiation when accessing this type, e.g. 'list1<_>'.") - (Error 3068, Line 15, Col 10, Line 15, Col 25, "The function or member 'toList' is used in a way that requires further type annotations at its definition to ensure consistency of inferred types. The inferred signature is 'static member private list1.toList: ('a list1 -> 'a list)'.") + (Error 3068, Line 15, Col 19, Line 15, Col 25, "The function or member 'toList' is used in a way that requires further type annotations at its definition to ensure consistency of inferred types. The inferred signature is 'static member private list1.toList: ('a list1 -> 'a list)'.") ] //SOURCE=E_Interface_IComparable.fsx SCFLAGS="--test:ErrorRanges" # E_Interface_IComparable.fsx diff --git a/tests/FSharp.Compiler.ComponentTests/Debugger/PortablePdbs.fs b/tests/FSharp.Compiler.ComponentTests/Debugger/PortablePdbs.fs index 5d44d059cf7..cf722e0dbac 100644 --- a/tests/FSharp.Compiler.ComponentTests/Debugger/PortablePdbs.fs +++ b/tests/FSharp.Compiler.ComponentTests/Debugger/PortablePdbs.fs @@ -69,7 +69,7 @@ module Baz = ] ] VerifySequencePoints [ - Line 6, Col 21, Line 6, Col 49 + Line 6, Col 33, Line 6, Col 49 Line 8, Col 26, Line 8, Col 32 Line 16, Col 20, Line 16, Col 22 Line 21, Col 20, Line 21, Col 22 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Literals.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Literals.fs index d2de4a77bf5..38e8bef0ce6 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Literals.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Literals.fs @@ -169,7 +169,7 @@ let [] x = System.Int32.MaxValue + 1 |> withResult { Error = Error 3177 Range = { StartLine = 4 - StartColumn = 21 + StartColumn = 34 EndLine = 4 EndColumn = 46 } Message = "This literal expression or attribute argument results in an arithmetic overflow." diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/TypeMismatchTests.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/TypeMismatchTests.fs index 337a49d5352..914add221fe 100644 --- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/TypeMismatchTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/TypeMismatchTests.fs @@ -367,7 +367,7 @@ let main args = |> typecheck |> shouldFail |> withDiagnostics [ - (Error 1, Line 8, Col 25, Line 8, Col 37, "The tuples have differing lengths of 3 and 2") + (Error 1, Line 8, Col 29, Line 8, Col 37, "The tuples have differing lengths of 3 and 2") ] module ``Not a function`` = diff --git a/tests/FSharp.Compiler.ComponentTests/Interop/RequiredAndInitOnlyProperties.fs b/tests/FSharp.Compiler.ComponentTests/Interop/RequiredAndInitOnlyProperties.fs index 68d8022cc8d..1885328b541 100644 --- a/tests/FSharp.Compiler.ComponentTests/Interop/RequiredAndInitOnlyProperties.fs +++ b/tests/FSharp.Compiler.ComponentTests/Interop/RequiredAndInitOnlyProperties.fs @@ -181,7 +181,7 @@ let main _ = |> compile |> shouldFail |> withDiagnostics [ - Error 810, Line 9, Col 5, Line 9, Col 17, "Init-only property 'GetInit' cannot be set outside the initialization code. See https://aka.ms/fsharp-assigning-values-to-properties-at-initialization" + Error 810, Line 9, Col 10, Line 9, Col 17, "Init-only property 'GetInit' cannot be set outside the initialization code. See https://aka.ms/fsharp-assigning-values-to-properties-at-initialization" ] [] @@ -209,7 +209,7 @@ let main _ = |> compile |> shouldFail |> withDiagnostics [ - Error 810, Line 9, Col 5, Line 9, Col 21, "Cannot call 'set_GetInit' - a setter for init-only property, please use object initialization instead. See https://aka.ms/fsharp-assigning-values-to-properties-at-initialization" + Error 810, Line 9, Col 10, Line 9, Col 21, "Cannot call 'set_GetInit' - a setter for init-only property, please use object initialization instead. See https://aka.ms/fsharp-assigning-values-to-properties-at-initialization" ] [] diff --git a/tests/FSharp.Compiler.ComponentTests/Interop/VisibilityTests.fs b/tests/FSharp.Compiler.ComponentTests/Interop/VisibilityTests.fs index 8bb17ccb8ac..f88577d9e8f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Interop/VisibilityTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Interop/VisibilityTests.fs @@ -163,8 +163,8 @@ type MyFSharpClass () = |> compile |> shouldFail |> withDiagnostics [ - (Error 810, Line 21, Col 9, Line 21, Col 33, "Property 'GetPublicSetPrivate' cannot be set") - (Error 807, Line 28, Col 17, Line 28, Col 41, "Property 'SetPublicGetPrivate' is not readable")] + (Error 810, Line 21, Col 14, Line 21, Col 33, "Property 'GetPublicSetPrivate' cannot be set") + (Error 807, Line 28, Col 22, Line 28, Col 41, "Property 'SetPublicGetPrivate' is not readable")] [] let ``F# class F# non-derived class - access public`` () = @@ -192,4 +192,4 @@ type MyFSharpClass () = |> withReferences [csharpLib] |> compile |> shouldFail - |> withSingleDiagnostic (Error 810, Line 21, Col 9, Line 21, Col 31, "Property 'GetPublicSetPrivate' cannot be set") + |> withSingleDiagnostic (Error 810, Line 21, Col 12, Line 21, Col 31, "Property 'GetPublicSetPrivate' cannot be set") diff --git a/tests/FSharp.Compiler.ComponentTests/Language/DotLambdaTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/DotLambdaTests.fs index 500e03089ca..bc939111cf7 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/DotLambdaTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/DotLambdaTests.fs @@ -326,7 +326,7 @@ let onlyIdC (ids: MyId list) = ids |> List.choose _.IdC |> shouldFail |> withDiagnostics [ (Error 23, Line 7, Col 17, Line 7, Col 20, "The member 'IdA' cannot be defined because the name 'IdA' clashes with the union case 'IdA' in this type or module"); - (Error 812, Line 22, Col 51, Line 22, Col 56, "The syntax 'expr.id' may only be used with record labels, properties and fields"); + (Error 812, Line 22, Col 53, Line 22, Col 56, "The syntax 'expr.id' may only be used with record labels, properties and fields"); (Error 23, Line 17, Col 17, Line 17, Col 20, "The member 'IdC' cannot be defined because the name 'IdC' clashes with the union case 'IdC' in this type or module"); - (Error 812, Line 24, Col 51, Line 24, Col 56, "The syntax 'expr.id' may only be used with record labels, properties and fields") + (Error 812, Line 24, Col 53, Line 24, Col 56, "The syntax 'expr.id' may only be used with record labels, properties and fields") ] \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Language/FixedBindings/FixedBindings.fs b/tests/FSharp.Compiler.ComponentTests/Language/FixedBindings/FixedBindings.fs index 2fba7454498..ec8374a8d57 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/FixedBindings/FixedBindings.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/FixedBindings/FixedBindings.fs @@ -14,7 +14,7 @@ module FixedBindingsTests = |> shouldSucceed |> withDiagnostics [ (Warning 9, Line 5, Col 9, Line 5, Col 12, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") - (Warning 9, Line 6, Col 5, Line 6, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") + (Warning 9, Line 6, Col 15, Line 6, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") ] [] @@ -26,7 +26,7 @@ module FixedBindingsTests = |> shouldSucceed |> withDiagnostics [ (Warning 9, Line 5, Col 9, Line 5, Col 12, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") - (Warning 9, Line 6, Col 5, Line 6, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") + (Warning 9, Line 6, Col 15, Line 6, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") ] [] @@ -112,7 +112,7 @@ The type 'char' does not match the type 'byte'""") |> shouldSucceed |> withDiagnostics [ (Warning 9, Line 5, Col 9, Line 5, Col 12, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") - (Warning 9, Line 6, Col 5, Line 6, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") + (Warning 9, Line 6, Col 15, Line 6, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") ] [] @@ -124,7 +124,7 @@ The type 'char' does not match the type 'byte'""") |> shouldSucceed |> withDiagnostics [ (Warning 9, Line 7, Col 9, Line 7, Col 12, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") - (Warning 9, Line 8, Col 5, Line 8, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") + (Warning 9, Line 8, Col 15, Line 8, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") ] [] @@ -136,7 +136,7 @@ The type 'char' does not match the type 'byte'""") |> shouldSucceed |> withDiagnostics [ (Warning 9, Line 11, Col 13, Line 11, Col 16, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") - (Warning 9, Line 12, Col 9, Line 12, Col 22, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") + (Warning 9, Line 12, Col 19, Line 12, Col 22, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") ] [] @@ -196,7 +196,7 @@ module ExtendedFixedBindings = |> shouldSucceed |> withDiagnostics [ (Warning 9, Line 5, Col 9, Line 5, Col 12, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") - (Warning 9, Line 6, Col 5, Line 6, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") + (Warning 9, Line 6, Col 15, Line 6, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") ] [] @@ -209,7 +209,7 @@ module ExtendedFixedBindings = |> shouldSucceed |> withDiagnostics [ (Warning 9, Line 5, Col 9, Line 5, Col 12, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") - (Warning 9, Line 6, Col 5, Line 6, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") + (Warning 9, Line 6, Col 15, Line 6, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") ] [] @@ -222,7 +222,7 @@ module ExtendedFixedBindings = |> shouldSucceed |> withDiagnostics [ (Warning 9, Line 5, Col 9, Line 5, Col 12, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") - (Warning 9, Line 6, Col 5, Line 6, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") + (Warning 9, Line 6, Col 15, Line 6, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") ] [] @@ -237,7 +237,7 @@ module ExtendedFixedBindings = |> shouldSucceed |> withDiagnostics [ (Warning 9, Line 8, Col 13, Line 8, Col 16, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") - (Warning 9, Line 9, Col 9, Line 9, Col 22, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") + (Warning 9, Line 9, Col 19, Line 9, Col 22, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") ] [] @@ -250,7 +250,7 @@ module ExtendedFixedBindings = |> shouldSucceed |> withDiagnostics [ (Warning 9, Line 6, Col 9, Line 6, Col 12, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") - (Warning 9, Line 7, Col 5, Line 7, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") + (Warning 9, Line 7, Col 15, Line 7, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") ] #if NETCOREAPP @@ -264,7 +264,7 @@ module ExtendedFixedBindings = |> shouldSucceed |> withDiagnostics [ (Warning 9, Line 6, Col 9, Line 6, Col 12, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") - (Warning 9, Line 7, Col 5, Line 7, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") + (Warning 9, Line 7, Col 15, Line 7, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") ] #endif @@ -291,7 +291,7 @@ module ExtendedFixedBindings = |> shouldSucceed |> withDiagnostics [ (Warning 9, Line 9, Col 9, Line 9, Col 12, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") - (Warning 9, Line 10, Col 5, Line 10, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") + (Warning 9, Line 10, Col 15, Line 10, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") ] [] @@ -304,7 +304,7 @@ module ExtendedFixedBindings = |> shouldSucceed |> withDiagnostics [ (Warning 9, Line 9, Col 9, Line 9, Col 12, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") - (Warning 9, Line 10, Col 5, Line 10, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") + (Warning 9, Line 10, Col 15, Line 10, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") ] [] @@ -317,7 +317,7 @@ module ExtendedFixedBindings = |> shouldSucceed |> withDiagnostics [ (Warning 9, Line 13, Col 9, Line 13, Col 12, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") - (Warning 9, Line 14, Col 5, Line 14, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") + (Warning 9, Line 14, Col 15, Line 14, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") ] [] @@ -356,7 +356,7 @@ module ExtendedFixedBindings = |> shouldSucceed |> withDiagnostics [ (Warning 9, Line 11, Col 9, Line 11, Col 12, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") - (Warning 9, Line 12, Col 5, Line 12, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") + (Warning 9, Line 12, Col 15, Line 12, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") ] [] @@ -410,5 +410,5 @@ The type 'int' does not match the type 'char'") |> shouldFail |> withDiagnostics [ (Warning 9, Line 13, Col 9, Line 13, Col 12, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") - (Warning 9, Line 14, Col 5, Line 14, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") + (Warning 9, Line 14, Col 15, Line 14, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") ] diff --git a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableCsharpImportTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableCsharpImportTests.fs index d969afc538f..10718f84bc4 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableCsharpImportTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableCsharpImportTests.fs @@ -220,7 +220,7 @@ let ``Consumption of nullable C# - no generics, just strings in methods and fiel |> withDiagnostics [ Error 3261, Line 5, Col 40, Line 5, Col 85, "Nullness warning: The types 'string' and 'string | null' do not have compatible nullability." Error 3261, Line 5, Col 40, Line 5, Col 85, "Nullness warning: A non-nullable 'string' was expected but this expression is nullable. Consider either changing the target to also be nullable, or use pattern matching to safely handle the null case of this expression." - Error 3261, Line 14, Col 34, Line 14, Col 62, "Nullness warning: A non-nullable 'string' was expected but this expression is nullable. Consider either changing the target to also be nullable, or use pattern matching to safely handle the null case of this expression." + Error 3261, Line 14, Col 48, Line 14, Col 62, "Nullness warning: A non-nullable 'string' was expected but this expression is nullable. Consider either changing the target to also be nullable, or use pattern matching to safely handle the null case of this expression." Error 3261, Line 16, Col 35, Line 16, Col 39, "Nullness warning: The type 'string' does not support 'null'." Error 3261, Line 25, Col 85, Line 25, Col 97, "Nullness warning: A non-nullable 'string' was expected but this expression is nullable. Consider either changing the target to also be nullable, or use pattern matching to safely handle the null case of this expression." Error 3261, Line 28, Col 99, Line 28, Col 111, "Nullness warning: A non-nullable 'string' was expected but this expression is nullable. Consider either changing the target to also be nullable, or use pattern matching to safely handle the null case of this expression." diff --git a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableReferenceTypesTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableReferenceTypesTests.fs index c45d73553e2..00efa50fc5c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableReferenceTypesTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableReferenceTypesTests.fs @@ -67,7 +67,7 @@ let main _args = |> withDiagnostics [ Error 3265, Line 8, Col 13, Line 8, Col 60, "Application of method 'Deserialize' attempted to create a nullable type ('T | null) for '{| x: int |}'. Nullness warnings won't be reported correctly for such types." Error 3265, Line 11, Col 13, Line 11, Col 50, "Application of method 'Deserialize' attempted to create a nullable type ('T | null) for '{| x: int |}'. Nullness warnings won't be reported correctly for such types." - Error 3261, Line 15, Col 14, Line 15, Col 17, "Nullness warning: The types 'R' and 'R | null' do not have compatible nullability."] + Error 3261, Line 15, Col 16, Line 15, Col 17, "Nullness warning: The types 'R' and 'R | null' do not have compatible nullability."] [] let ``Report warning when generic type instance creates a null-disallowed type`` () = @@ -1072,7 +1072,7 @@ myNullReturningFunction myValOfY |> ignore |> shouldFail |> withDiagnostics [Error 3261, Line 17, Col 25, Line 17, Col 34, "Nullness warning: The type 'string' does not support 'null'." - Error 193, Line 19, Col 26, Line 19, Col 45, "The type 'System.DateTime' does not have 'null' as a proper value" + Error 193, Line 19, Col 42, Line 19, Col 45, "The type 'System.DateTime' does not have 'null' as a proper value" Error 1, Line 20, Col 25, Line 20, Col 36, "The type '{| Anon: 'a |}' does not have 'null' as a proper value" Error 1, Line 21, Col 26, Line 21, Col 31, "The type ''a * 'b * 'c' does not have 'null' as a proper value" Error 1, Line 23, Col 25, Line 23, Col 33, "The type 'Y' does not have 'null' as a proper value"] @@ -1335,7 +1335,7 @@ let bar = foo |> Option.ofObj // Should produce FS3262, but did not |> asLibrary |> typeCheckWithStrictNullness |> shouldFail - |> withDiagnostics [Error 3262, Line 4, Col 18, Line 4, Col 30, "Value known to be without null passed to a function meant for nullables: You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value."] + |> withDiagnostics [Error 3262, Line 4, Col 25, Line 4, Col 30, "Value known to be without null passed to a function meant for nullables: You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value."] [] let ``Useless null check when used in multi piping`` () = @@ -1347,7 +1347,7 @@ let myFunc whateverArg = |> asLibrary |> typeCheckWithStrictNullness |> shouldFail - |> withDiagnostics [Error 3262, Line 4, Col 30, Line 4, Col 42, "Value known to be without null passed to a function meant for nullables: You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value."] + |> withDiagnostics [Error 3262, Line 4, Col 37, Line 4, Col 42, "Value known to be without null passed to a function meant for nullables: You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value."] [] let ``Useless null check when used in more exotic pipes`` () = @@ -1362,9 +1362,9 @@ let pointfree = intToint >> string >> Option.ofObj |> typeCheckWithStrictNullness |> shouldFail |> withDiagnostics - [ Error 3262, Line 3, Col 45, Line 3, Col 57, "Value known to be without null passed to a function meant for nullables: You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value." + [ Error 3262, Line 3, Col 52, Line 3, Col 57, "Value known to be without null passed to a function meant for nullables: You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value." Error 3262, Line 4, Col 60, Line 4, Col 61, "Value known to be without null passed to a function meant for nullables: You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value." - Error 3262, Line 6, Col 39, Line 6, Col 51, "Value known to be without null passed to a function meant for nullables: You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value."] + Error 3262, Line 6, Col 46, Line 6, Col 51, "Value known to be without null passed to a function meant for nullables: You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value."] [] let ``Regression: Useless usage in nested calls`` () = @@ -1813,7 +1813,7 @@ let ``Type extension not null constraint rejects nullable type arg at call site` |> typeCheckWithStrictNullness |> shouldFail |> withDiagnostics [ - Error 3261, Line 8, Col 47, Line 8, Col 60, "Nullness warning: The type 'string | null' supports 'null' but a non-null type is expected." + Error 3261, Line 8, Col 55, Line 8, Col 60, "Nullness warning: The type 'string | null' supports 'null' but a non-null type is expected." ] [] diff --git a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableRegressionTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableRegressionTests.fs index a7ff6c2e89b..64c6151bdf3 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableRegressionTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableRegressionTests.fs @@ -42,7 +42,7 @@ let ``Signature conformance`` langVersion checknulls = |> compile |> shouldFail |> withDiagnostics - [Warning 3262, Line 18, Col 48, Line 18, Col 60, "Value known to be without null passed to a function meant for nullables: You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value." + [Warning 3262, Line 18, Col 55, Line 18, Col 60, "Value known to be without null passed to a function meant for nullables: You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value." (Warning 3261, Line 4, Col 5, Line 4, Col 10, "Nullness warning: Module 'M' contains val test2: x: (string | null) -> unit but its signature specifies diff --git a/tests/FSharp.Compiler.ComponentTests/Language/ObsoleteAttributeCheckingTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/ObsoleteAttributeCheckingTests.fs index 085cbc3599e..f5f9be3a179 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/ObsoleteAttributeCheckingTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/ObsoleteAttributeCheckingTests.fs @@ -602,7 +602,7 @@ let c = Color.Red |> compile |> shouldFail |> withDiagnostics [ - (Error 101, Line 7, Col 9, Line 7, Col 18, "This construct is deprecated. Use B instead") + (Error 101, Line 7, Col 15, Line 7, Col 18, "This construct is deprecated. Use B instead") ] [] @@ -618,7 +618,7 @@ let c = Color.Red |> compile |> shouldFail |> withDiagnostics [ - (Warning 44, Line 7, Col 9, Line 7, Col 18, "This construct is deprecated. Use B instead") + (Warning 44, Line 7, Col 15, Line 7, Col 18, "This construct is deprecated. Use B instead") ] [] @@ -653,7 +653,7 @@ let c = Color.Red |> compile |> shouldFail |> withDiagnostics [ - (Error 101, Line 8, Col 9, Line 8, Col 18, "This construct is deprecated. Use B instead") + (Error 101, Line 8, Col 15, Line 8, Col 18, "This construct is deprecated. Use B instead") ] [] @@ -670,7 +670,7 @@ let c = Color.Red |> compile |> shouldFail |> withDiagnostics [ - (Warning 44, Line 8, Col 9, Line 8, Col 18, "This construct is deprecated. Use B instead") + (Warning 44, Line 8, Col 15, Line 8, Col 18, "This construct is deprecated. Use B instead") ] [] @@ -889,7 +889,7 @@ type ButtonExtensions = |> compile |> shouldFail |> withDiagnostics [ - (Error 101, Line 17, Col 9, Line 17, Col 19, "This construct is deprecated. Use B instead") + (Error 101, Line 17, Col 16, Line 17, Col 19, "This construct is deprecated. Use B instead") ] [] @@ -1332,10 +1332,10 @@ Class.ObsoleteEvent |> ignore |> compile |> shouldFail |> withDiagnostics [ - (Warning 44, Line 3, Col 1, Line 3, Col 20, "This construct is deprecated. Field is obsolete"); + (Warning 44, Line 3, Col 7, Line 3, Col 20, "This construct is deprecated. Field is obsolete"); (Warning 44, Line 4, Col 7, Line 4, Col 21, "This construct is deprecated. Method is obsolete"); (Warning 44, Line 5, Col 7, Line 5, Col 23, "This construct is deprecated. Property is obsolete") - (Warning 44, Line 6, Col 1, Line 6, Col 20, "This construct is deprecated. Event is obsolete") + (Warning 44, Line 6, Col 7, Line 6, Col 20, "This construct is deprecated. Event is obsolete") ] [] @@ -1371,10 +1371,10 @@ Class.ObsoleteEvent |> ignore |> compile |> shouldFail |> withDiagnostics [ - (Error 101, Line 3, Col 1, Line 3, Col 20, "This construct is deprecated. Field is obsolete"); + (Error 101, Line 3, Col 7, Line 3, Col 20, "This construct is deprecated. Field is obsolete"); (Error 101, Line 4, Col 7, Line 4, Col 21, "This construct is deprecated. Method is obsolete"); (Error 101, Line 5, Col 7, Line 5, Col 23, "This construct is deprecated. Property is obsolete") - (Error 101, Line 6, Col 1, Line 6, Col 20, "This construct is deprecated. Event is obsolete") + (Error 101, Line 6, Col 7, Line 6, Col 20, "This construct is deprecated. Event is obsolete") ] [] diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/E_NoChangeForEvent.fsx.err.bsl b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/E_NoChangeForEvent.fsx.err.bsl index 5a3d39e8aee..0fe4a182e92 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/E_NoChangeForEvent.fsx.err.bsl +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/E_NoChangeForEvent.fsx.err.bsl @@ -1,3 +1,3 @@ E_NoChangeForEvent.fsx (9,9)-(9,30) typecheck warning It is recommended that objects supporting the IDisposable interface are created using the syntax 'new Type(args)', rather than 'Type(args)' or 'Type' as a function value representing the constructor, to indicate that resources may be owned by the generated value -E_NoChangeForEvent.fsx (10,1)-(10,11) typecheck error This value is not a function and cannot be applied. It has type 'IEvent', which does not accept arguments. -E_NoChangeForEvent.fsx (18,1)-(18,11) typecheck error This value is not a function and cannot be applied. It has type 'IEvent', which does not accept arguments. \ No newline at end of file +E_NoChangeForEvent.fsx (10,3)-(10,11) typecheck error This value is not a function and cannot be applied. It has type 'IEvent', which does not accept arguments. +E_NoChangeForEvent.fsx (18,3)-(18,11) typecheck error This value is not a function and cannot be applied. It has type 'IEvent', which does not accept arguments. \ No newline at end of file diff --git a/tests/fsharp/Compiler/Language/StringInterpolation.fs b/tests/fsharp/Compiler/Language/StringInterpolation.fs index eade5119a44..e4f96546203 100644 --- a/tests/fsharp/Compiler/Language/StringInterpolation.fs +++ b/tests/fsharp/Compiler/Language/StringInterpolation.fs @@ -636,7 +636,7 @@ let xe = $"%A{{1}}" // fake expression (delimiters escaped) """ CompilerAssert.TypeCheckWithErrorsAndOptions [| "--langversion:8.0" |] code - [|(FSharpDiagnosticSeverity.Error, 1, (2, 19, 2, 38), + [|(FSharpDiagnosticSeverity.Error, 1, (2, 33, 2, 38), "The type 'string' is not compatible with any of the types byte,int16,int32,int64,sbyte,uint16,uint32,uint64,nativeint,unativeint, arising from the use of a printf-style format string"); (FSharpDiagnosticSeverity.Error, 1, (3, 19, 3, 20), """This expression was expected to have type diff --git a/tests/fsharp/Compiler/Libraries/Core/NativeInterop/StackallocTests.fs b/tests/fsharp/Compiler/Libraries/Core/NativeInterop/StackallocTests.fs index b01da9cd01e..e9fbacb389b 100644 --- a/tests/fsharp/Compiler/Libraries/Core/NativeInterop/StackallocTests.fs +++ b/tests/fsharp/Compiler/Libraries/Core/NativeInterop/StackallocTests.fs @@ -69,7 +69,7 @@ let _ = NativeInterop.NativePtr.stackalloc 1 """ FSharpDiagnosticSeverity.Error 1 - (4, 9, 4, 43) + (4, 33, 4, 43) "A generic construct requires that the type 'System.Object' is an unmanaged type" [] @@ -82,7 +82,7 @@ let _ = NativeInterop.NativePtr.stackalloc 1 """ FSharpDiagnosticSeverity.Error 1 - (4, 9, 4, 43) + (4, 33, 4, 43) "A generic construct requires that the type 'System.Collections.IEnumerable' is an unmanaged type" [] @@ -95,7 +95,7 @@ let _ = NativeInterop.NativePtr.stackalloc 1 """ FSharpDiagnosticSeverity.Error 1 - (4, 9, 4, 43) + (4, 33, 4, 43) "A generic construct requires that the type 'System.EventHandler' is an unmanaged type" [] @@ -149,7 +149,7 @@ let _ = NativeInterop.NativePtr.stackalloc 1 """ FSharpDiagnosticSeverity.Error 1 - (10, 9, 10, 43) + (10, 33, 10, 43) "A generic construct requires that the type 'C' is an unmanaged type" [] @@ -164,7 +164,7 @@ let _ = NativeInterop.NativePtr.stackalloc 1 """ FSharpDiagnosticSeverity.Error 1 - (6, 9, 6, 43) + (6, 33, 6, 43) "A generic construct requires that the type 'R' is an unmanaged type" [] diff --git a/tests/fsharp/core/auto-widen/preview/test.bsl b/tests/fsharp/core/auto-widen/preview/test.bsl index c17dc66908f..49696054a20 100644 --- a/tests/fsharp/core/auto-widen/preview/test.bsl +++ b/tests/fsharp/core/auto-widen/preview/test.bsl @@ -1,7 +1,7 @@ test.fsx(11,20,11,21): typecheck error FS3388: This expression implicitly converts type 'int' to type 'obj'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(14,20,14,41): typecheck error FS3388: This expression implicitly converts type 'int' to type 'obj'. See https://aka.ms/fsharp-implicit-convs. +test.fsx(14,33,14,41): typecheck error FS3388: This expression implicitly converts type 'int' to type 'obj'. See https://aka.ms/fsharp-implicit-convs. test.fsx(20,21,20,24): typecheck error FS3388: This expression implicitly converts type 'int * int' to type 'obj'. See https://aka.ms/fsharp-implicit-convs. @@ -65,17 +65,17 @@ test.fsx(61,32,61,33): typecheck error FS3389: This expression uses a built-in i test.fsx(61,32,61,33): typecheck error FS3388: This expression implicitly converts type 'int' to type 'float'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(63,22,63,43): typecheck error FS3389: This expression uses a built-in implicit conversion to convert type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. +test.fsx(63,35,63,43): typecheck error FS3389: This expression uses a built-in implicit conversion to convert type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(63,22,63,43): typecheck error FS3388: This expression implicitly converts type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. +test.fsx(63,35,63,43): typecheck error FS3388: This expression implicitly converts type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(64,28,64,49): typecheck error FS3389: This expression uses a built-in implicit conversion to convert type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. +test.fsx(64,41,64,49): typecheck error FS3389: This expression uses a built-in implicit conversion to convert type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(64,28,64,49): typecheck error FS3388: This expression implicitly converts type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. +test.fsx(64,41,64,49): typecheck error FS3388: This expression implicitly converts type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(64,50,64,71): typecheck error FS3389: This expression uses a built-in implicit conversion to convert type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. +test.fsx(64,63,64,71): typecheck error FS3389: This expression uses a built-in implicit conversion to convert type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(64,50,64,71): typecheck error FS3388: This expression implicitly converts type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. +test.fsx(64,63,64,71): typecheck error FS3388: This expression implicitly converts type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. test.fsx(67,20,67,23): typecheck error FS3388: This expression implicitly converts type 'int' to type 'obj'. See https://aka.ms/fsharp-implicit-convs. @@ -251,7 +251,7 @@ test.fsx(258,30,258,38): typecheck error FS3388: This expression implicitly conv test.fsx(260,36,260,38): typecheck error FS3388: This expression implicitly converts type 'Numerics.BigInteger' to type 'IComparable'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(263,44,263,63): typecheck error FS3388: This expression implicitly converts type 'string' to type 'IComparable'. See https://aka.ms/fsharp-implicit-convs. +test.fsx(263,58,263,63): typecheck error FS3388: This expression implicitly converts type 'string' to type 'IComparable'. See https://aka.ms/fsharp-implicit-convs. test.fsx(275,35,275,36): typecheck error FS3388: This expression implicitly converts type 'int' to type 'obj'. See https://aka.ms/fsharp-implicit-convs. diff --git a/tests/fsharp/core/quotesDebugInfo/test.fsx b/tests/fsharp/core/quotesDebugInfo/test.fsx index e2bdcd55ce3..201b1b1609c 100644 --- a/tests/fsharp/core/quotesDebugInfo/test.fsx +++ b/tests/fsharp/core/quotesDebugInfo/test.fsx @@ -463,7 +463,7 @@ let f : FSharpFunc`2 = in [DebugRange(452:12 - 452:36)] <{ [DebugRange(452:12 - 452:13)] <{ f }>( - [DebugRange(452:14 - 452:33)] <{ DefaultOf ( + [DebugRange(452:24 - 452:33)] <{ DefaultOf ( ) }> ) diff --git a/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetInvokerExpression_Exception.bsl b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetInvokerExpression_Exception.bsl index 711a55cb552..d6c05ca27a6 100644 --- a/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetInvokerExpression_Exception.bsl +++ b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetInvokerExpression_Exception.bsl @@ -1,2 +1,2 @@ -EVIL_PROVIDER_GetInvokerExpression_Exception.fsx(7,9,7,80): typecheck error FS3033: The type provider 'Provider.EvilProviderWhereApplyGetInvokerExpressionRaisesException' reported an error in the context of provided type 'FSharp.EvilProviderWhereGetInvokerExpressionRaisesException.TheType', member 'get_Foo'. The error: deliberate error for testing purposes +EVIL_PROVIDER_GetInvokerExpression_Exception.fsx(7,77,7,80): typecheck error FS3033: The type provider 'Provider.EvilProviderWhereApplyGetInvokerExpressionRaisesException' reported an error in the context of provided type 'FSharp.EvilProviderWhereGetInvokerExpressionRaisesException.TheType', member 'get_Foo'. The error: deliberate error for testing purposes diff --git a/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetInvokerExpression_Null.bsl b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetInvokerExpression_Null.bsl index b2fc037734e..ef4ffbef3ec 100644 --- a/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetInvokerExpression_Null.bsl +++ b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetInvokerExpression_Null.bsl @@ -1,2 +1,2 @@ -EVIL_PROVIDER_GetInvokerExpression_Null.fsx(7,9,7,76): typecheck error FS3056: Type provider 'Provider.EvilProviderWhereApplyGetInvokerExpressionReturnsNull' returned null from GetInvokerExpression. +EVIL_PROVIDER_GetInvokerExpression_Null.fsx(7,73,7,76): typecheck error FS3056: Type provider 'Provider.EvilProviderWhereApplyGetInvokerExpressionReturnsNull' returned null from GetInvokerExpression. diff --git a/tests/fsharp/typeProviders/negTests/InvalidInvokerExpression.bsl b/tests/fsharp/typeProviders/negTests/InvalidInvokerExpression.bsl index 1806dc3960b..4e3f4637650 100644 --- a/tests/fsharp/typeProviders/negTests/InvalidInvokerExpression.bsl +++ b/tests/fsharp/typeProviders/negTests/InvalidInvokerExpression.bsl @@ -1,2 +1,2 @@ -InvalidInvokerExpression.fsx(4,9,4,79): typecheck error FS3056: Type provider 'Provider.GoodProviderForNegativeTypeTests1' returned null from GetInvokerExpression. +InvalidInvokerExpression.fsx(4,58,4,79): typecheck error FS3056: Type provider 'Provider.GoodProviderForNegativeTypeTests1' returned null from GetInvokerExpression. diff --git a/tests/fsharp/typeProviders/negTests/neg1.bsl b/tests/fsharp/typeProviders/negTests/neg1.bsl index f4442e42b83..d6d6ed366a2 100644 --- a/tests/fsharp/typeProviders/negTests/neg1.bsl +++ b/tests/fsharp/typeProviders/negTests/neg1.bsl @@ -1,5 +1,5 @@ -neg1.fsx(3,18,3,70): typecheck error FS0193: Type constraint mismatch. The type +neg1.fsx(3,67,3,70): typecheck error FS0193: Type constraint mismatch. The type 'int' is not compatible with type 'string' diff --git a/tests/fsharp/typecheck/sigs/neg10.bsl b/tests/fsharp/typecheck/sigs/neg10.bsl index 1a0f32e060c..6a25f9107a2 100644 --- a/tests/fsharp/typecheck/sigs/neg10.bsl +++ b/tests/fsharp/typecheck/sigs/neg10.bsl @@ -122,29 +122,29 @@ neg10.fs(245,50,245,51): typecheck error FS0193: A type parameter is missing a c neg10.fs(245,17,245,20): typecheck error FS0043: A type parameter is missing a constraint 'when 'b :> C' -neg10.fs(251,49,251,61): typecheck error FS0001: The type ''a -> 'a' does not support the 'equality' constraint because it is a function type +neg10.fs(251,59,251,61): typecheck error FS0001: The type ''a -> 'a' does not support the 'equality' constraint because it is a function type -neg10.fs(252,45,252,57): typecheck error FS0001: The type ''a -> 'a' does not support the 'comparison' constraint. For example, it does not support the 'System.IComparable' interface +neg10.fs(252,55,252,57): typecheck error FS0001: The type ''a -> 'a' does not support the 'comparison' constraint. For example, it does not support the 'System.IComparable' interface -neg10.fs(253,36,253,48): typecheck error FS0001: The type ''a -> 'a' does not support the 'equality' constraint because it is a function type +neg10.fs(253,46,253,48): typecheck error FS0001: The type ''a -> 'a' does not support the 'equality' constraint because it is a function type neg10.fs(297,22,297,24): typecheck error FS1187: An indexer property must be given at least one argument neg10.fs(298,22,298,24): typecheck error FS1187: An indexer property must be given at least one argument -neg10.fs(299,17,299,24): typecheck error FS0807: Property 'S2' is not readable +neg10.fs(299,22,299,24): typecheck error FS0807: Property 'S2' is not readable -neg10.fs(300,17,300,24): typecheck error FS0807: Property 'S3' is not readable +neg10.fs(300,22,300,24): typecheck error FS0807: Property 'S3' is not readable -neg10.fs(301,17,301,24): typecheck error FS0807: Property 'S4' is not readable +neg10.fs(301,22,301,24): typecheck error FS0807: Property 'S4' is not readable -neg10.fs(303,17,303,22): typecheck error FS0807: Property 'SS2' is not readable +neg10.fs(303,19,303,22): typecheck error FS0807: Property 'SS2' is not readable -neg10.fs(304,17,304,22): typecheck error FS0807: Property 'SS3' is not readable +neg10.fs(304,19,304,22): typecheck error FS0807: Property 'SS3' is not readable -neg10.fs(305,17,305,22): typecheck error FS0807: Property 'SS4' is not readable +neg10.fs(305,19,305,22): typecheck error FS0807: Property 'SS4' is not readable -neg10.fs(316,17,316,28): typecheck error FS0807: Property 'X' is not readable +neg10.fs(316,27,316,28): typecheck error FS0807: Property 'X' is not readable neg10.fs(324,28,324,29): typecheck error FS1187: An indexer property must be given at least one argument diff --git a/tests/fsharp/typecheck/sigs/neg15.bsl b/tests/fsharp/typecheck/sigs/neg15.bsl index e82c0042d11..3961d631255 100644 --- a/tests/fsharp/typecheck/sigs/neg15.bsl +++ b/tests/fsharp/typecheck/sigs/neg15.bsl @@ -1,13 +1,13 @@ -neg15.fs(102,17,102,31): typecheck error FS1094: The value 'privateValue' is not accessible from this code location +neg15.fs(102,19,102,31): typecheck error FS1094: The value 'privateValue' is not accessible from this code location -neg15.fs(103,18,103,43): typecheck error FS1092: The type 'PrivateUnionType' is not accessible from this code location +neg15.fs(103,20,103,43): typecheck error FS1092: The type 'PrivateUnionType' is not accessible from this code location -neg15.fs(106,18,106,66): typecheck error FS1093: The union cases or fields of the type 'UnionTypeWithPrivateRepresentation' are not accessible from this code location +neg15.fs(106,20,106,66): typecheck error FS1093: The union cases or fields of the type 'UnionTypeWithPrivateRepresentation' are not accessible from this code location neg15.fs(107,17,107,41): typecheck error FS0491: The member or object constructor 'PrivateProperty' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. -neg15.fs(108,17,108,45): typecheck error FS0491: The member or object constructor 'PrivateStaticProperty' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. +neg15.fs(108,24,108,45): typecheck error FS0491: The member or object constructor 'PrivateStaticProperty' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. neg15.fs(109,17,109,41): typecheck error FS0491: The member or object constructor 'PrivateMethod' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. @@ -45,17 +45,17 @@ neg15.fs(183,1,183,5): typecheck error FS0491: The member or object constructor neg15.fs(184,1,184,7): typecheck error FS0491: The member or object constructor 'M' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. -neg15.fs(185,1,185,5): typecheck error FS0491: The member or object constructor 'SP' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. +neg15.fs(185,3,185,5): typecheck error FS0491: The member or object constructor 'SP' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. neg15.fs(186,1,186,7): typecheck error FS0491: The member or object constructor 'SM' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. -neg15.fs(187,1,187,6): typecheck error FS1096: The record, struct or class field 'f' is not accessible from this code location +neg15.fs(187,5,187,6): typecheck error FS1096: The record, struct or class field 'f' is not accessible from this code location neg15.fs(188,1,188,6): typecheck error FS0491: The member or object constructor 'P' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. neg15.fs(189,1,189,8): typecheck error FS0491: The member or object constructor 'M' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. -neg15.fs(190,1,190,6): typecheck error FS0491: The member or object constructor 'SP' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. +neg15.fs(190,4,190,6): typecheck error FS0491: The member or object constructor 'SP' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. neg15.fs(191,1,191,8): typecheck error FS0491: The member or object constructor 'SM' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. diff --git a/tests/fsharp/typecheck/sigs/neg17.bsl b/tests/fsharp/typecheck/sigs/neg17.bsl index c09ddb99bb8..189617a26ae 100644 --- a/tests/fsharp/typecheck/sigs/neg17.bsl +++ b/tests/fsharp/typecheck/sigs/neg17.bsl @@ -1,9 +1,9 @@ neg17.fs(84,17,84,33): typecheck error FS0292: The type definitions for type 'PrivateUnionType' in the signature and implementation are not compatible because the accessibility specified in the signature is more than that specified in the implementation -neg17b.fs(7,17,7,31): typecheck error FS1094: The value 'privateValue' is not accessible from this code location +neg17b.fs(7,19,7,31): typecheck error FS1094: The value 'privateValue' is not accessible from this code location -neg17b.fs(8,18,8,43): typecheck error FS1092: The type 'PrivateUnionType' is not accessible from this code location +neg17b.fs(8,20,8,43): typecheck error FS1092: The type 'PrivateUnionType' is not accessible from this code location neg17b.fs(11,26,11,41): typecheck error FS0039: The type 'Type' does not define a field, constructor, or member named 'PrivateProperty'. diff --git a/tests/fsharp/typecheck/sigs/neg37_a.bsl b/tests/fsharp/typecheck/sigs/neg37_a.bsl index b1657dda675..3e255b8e5d3 100644 --- a/tests/fsharp/typecheck/sigs/neg37_a.bsl +++ b/tests/fsharp/typecheck/sigs/neg37_a.bsl @@ -1,2 +1,2 @@ -neg37_a.fs(7,26,7,41): typecheck error FS3068: The function or member 'Bar' is used in a way that requires further type annotations at its definition to ensure consistency of inferred types. The inferred signature is 'static member BBB.Bar: ('T -> unit)'. +neg37_a.fs(7,38,7,41): typecheck error FS3068: The function or member 'Bar' is used in a way that requires further type annotations at its definition to ensure consistency of inferred types. The inferred signature is 'static member BBB.Bar: ('T -> unit)'. diff --git a/tests/fsharp/typecheck/sigs/neg56_a.bsl b/tests/fsharp/typecheck/sigs/neg56_a.bsl index 7d477679f7b..696fbe5e7cb 100644 --- a/tests/fsharp/typecheck/sigs/neg56_a.bsl +++ b/tests/fsharp/typecheck/sigs/neg56_a.bsl @@ -1,4 +1,4 @@ neg56_a.fs(11,35,11,47): typecheck error FS1125: The instantiation of the generic type 'list1' is missing and can't be inferred from the arguments or return type of this member. Consider providing a type instantiation when accessing this type, e.g. 'list1<_>'. -neg56_a.fs(15,18,15,33): typecheck error FS3068: The function or member 'toList' is used in a way that requires further type annotations at its definition to ensure consistency of inferred types. The inferred signature is 'static member private list1.toList: ('a list1 -> 'a list)'. +neg56_a.fs(15,27,15,33): typecheck error FS3068: The function or member 'toList' is used in a way that requires further type annotations at its definition to ensure consistency of inferred types. The inferred signature is 'static member private list1.toList: ('a list1 -> 'a list)'. diff --git a/tests/fsharp/typecheck/sigs/neg56_b.bsl b/tests/fsharp/typecheck/sigs/neg56_b.bsl index 4e844fe5979..ad0570908cc 100644 --- a/tests/fsharp/typecheck/sigs/neg56_b.bsl +++ b/tests/fsharp/typecheck/sigs/neg56_b.bsl @@ -3,6 +3,6 @@ neg56_b.fs(8,36,8,39): typecheck error FS3068: The function or member 'Inf' is u neg56_b.fs(15,37,15,40): typecheck error FS3068: The function or member 'Inf' is used in a way that requires further type annotations at its definition to ensure consistency of inferred types. The inferred signature is 'static member Foo2.Inf: 'T ref'. -neg56_b.fs(26,13,26,23): typecheck error FS3068: The function or member 'Inf' is used in a way that requires further type annotations at its definition to ensure consistency of inferred types. The inferred signature is 'static member private Foo.Inf: ('T list -> 'T list)'. +neg56_b.fs(26,20,26,23): typecheck error FS3068: The function or member 'Inf' is used in a way that requires further type annotations at its definition to ensure consistency of inferred types. The inferred signature is 'static member private Foo.Inf: ('T list -> 'T list)'. -neg56_b.fs(36,13,36,23): typecheck error FS3068: The function or member 'Foo' is used in a way that requires further type annotations at its definition to ensure consistency of inferred types. The inferred signature is 'static member private Qux.Foo: ('T list -> 'T list)'. +neg56_b.fs(36,20,36,23): typecheck error FS3068: The function or member 'Foo' is used in a way that requires further type annotations at its definition to ensure consistency of inferred types. The inferred signature is 'static member private Qux.Foo: ('T list -> 'T list)'. diff --git a/tests/fsharp/typecheck/sigs/neg90.bsl b/tests/fsharp/typecheck/sigs/neg90.bsl index d04c6f2b059..7fc5ba3ede1 100644 --- a/tests/fsharp/typecheck/sigs/neg90.bsl +++ b/tests/fsharp/typecheck/sigs/neg90.bsl @@ -3,6 +3,6 @@ neg90.fs(4,9,4,12): typecheck error FS0001: A generic construct requires that th neg90.fs(7,22,7,25): typecheck error FS0039: The type 'foo' is not defined. -neg90.fs(16,9,16,21): typecheck error FS0035: This construct is deprecated: The union type for union case 'Member' was defined with the RequireQualifiedAccessAttribute. Include the name of the union type ('DU') in the name you are using. +neg90.fs(16,15,16,21): typecheck error FS0035: This construct is deprecated: The union type for union case 'Member' was defined with the RequireQualifiedAccessAttribute. Include the name of the union type ('DU') in the name you are using. neg90.fs(28,9,28,41): typecheck error FS0035: This construct is deprecated: The record type for the record field 'Field1' was defined with the RequireQualifiedAccessAttribute. Include the name of the record type ('Record1') in the name you are using. diff --git a/tests/fsharp/typecheck/sigs/neg91.bsl b/tests/fsharp/typecheck/sigs/neg91.bsl index 8cb3e21f836..7ac51180563 100644 --- a/tests/fsharp/typecheck/sigs/neg91.bsl +++ b/tests/fsharp/typecheck/sigs/neg91.bsl @@ -3,13 +3,13 @@ neg91.fs(7,9,7,30): typecheck error FS0896: Enumerations cannot have members neg91.fs(10,10,10,15): typecheck error FS0956: Members that extend interface, delegate or enum types must be placed in a module separate to the definition of the type. This module must either have the AutoOpen attribute or be opened explicitly by client code to bring the extension members into scope. -neg91.fs(24,13,24,16): typecheck error FS1094: The value 'x' is not accessible from this code location +neg91.fs(24,15,24,16): typecheck error FS1094: The value 'x' is not accessible from this code location -neg91.fs(34,13,34,16): typecheck error FS0044: This construct is deprecated. Don't touch me +neg91.fs(34,15,34,16): typecheck error FS0044: This construct is deprecated. Don't touch me -neg91.fs(44,13,44,16): typecheck error FS3003: Don't touch me +neg91.fs(44,15,44,16): typecheck error FS3003: Don't touch me -neg91.fs(54,13,54,16): typecheck error FS0057: This construct is experimental. It was just an experiment!. This warning can be disabled using '--nowarn:57' or '#nowarn "57"'. +neg91.fs(54,15,54,16): typecheck error FS0057: This construct is experimental. It was just an experiment!. This warning can be disabled using '--nowarn:57' or '#nowarn "57"'. neg91.fs(63,11,63,27): typecheck error FS3191: This literal pattern does not take arguments diff --git a/tests/fsharp/typecheck/sigs/neg_byref_3.bsl b/tests/fsharp/typecheck/sigs/neg_byref_3.bsl index 549f4e523a4..01c5e23d3bd 100644 --- a/tests/fsharp/typecheck/sigs/neg_byref_3.bsl +++ b/tests/fsharp/typecheck/sigs/neg_byref_3.bsl @@ -3,8 +3,8 @@ neg_byref_3.fs(2,5,2,8): typecheck error FS0431: A byref typed value would be st neg_byref_3.fs(2,5,2,8): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL. -neg_byref_3.fs(2,11,2,22): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL. +neg_byref_3.fs(2,16,2,22): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL. neg_byref_3.fs(3,5,3,6): typecheck error FS3301: The function or method has an invalid return type 'byref list -> int'. This is not permitted by the rules of Common IL. -neg_byref_3.fs(3,11,3,22): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL. +neg_byref_3.fs(3,16,3,22): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL. diff --git a/tests/fsharp/typecheck/sigs/neg_byref_4.bsl b/tests/fsharp/typecheck/sigs/neg_byref_4.bsl index 2fdf027ea71..50539092e90 100644 --- a/tests/fsharp/typecheck/sigs/neg_byref_4.bsl +++ b/tests/fsharp/typecheck/sigs/neg_byref_4.bsl @@ -1,4 +1,4 @@ -neg_byref_4.fs(4,11,4,29): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL. +neg_byref_4.fs(4,27,4,29): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL. -neg_byref_4.fs(5,11,5,29): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL. +neg_byref_4.fs(5,27,5,29): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL. From 293f3f13059320e94432fe044694ba8dcbb23e31 Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Thu, 28 May 2026 16:20:25 +0200 Subject: [PATCH 2/7] Simplify TcNameOfExpr and TcLongIdentThen to pass result tuples directly Revert to pre-#19505 patterns: use '_ as res' in TcNameOfExpr and pass-through binding in TcLongIdentThen instead of destructuring and reconstructing the 5-tuple. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/Compiler/Checking/Expressions/CheckExpressions.fs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Compiler/Checking/Expressions/CheckExpressions.fs b/src/Compiler/Checking/Expressions/CheckExpressions.fs index 7bb5c3079e8..175caf9737d 100644 --- a/src/Compiler/Checking/Expressions/CheckExpressions.fs +++ b/src/Compiler/Checking/Expressions/CheckExpressions.fs @@ -8666,7 +8666,7 @@ and TcNameOfExpr (cenv: cenv) env tpenv (synArg: SynExpr) = let nameResolutionResult = ResolveLongIdentAsExprAndComputeRange cenv.tcSink cenv.nameResolver (rangeOfLid longId) ad env.eNameResEnv typeNameResInfo longId None let resolvesAsExpr = match nameResolutionResult with - | Result (tinstEnclosing, item, mItem, rest, afterRes) + | Result (_, item, _, _, _ as res) when (match item with | Item.DelegateCtor _ @@ -8677,7 +8677,7 @@ and TcNameOfExpr (cenv: cenv) env tpenv (synArg: SynExpr) = | _ -> true | _ -> true) -> let overallTy = match overallTyOpt with None -> MustEqual (NewInferenceType g) | Some t -> t - let _, _ = TcItemThen cenv overallTy env tpenv (tinstEnclosing, item, mItem, rest, afterRes) None delayed + let _, _ = TcItemThen cenv overallTy env tpenv res None delayed true | _ -> false @@ -8904,11 +8904,11 @@ and TcLongIdentThen (cenv: cenv) (overallTy: OverallTy) env tpenv (SynLongIdent( let ad = env.eAccessRights let typeNameResInfo = GetLongIdentTypeNameInfo delayed - let (tinstEnclosing, item, mItem, rest, afterResolution) = + let nameResolutionResult = let maybeAppliedArgExpr = DelayedItem.maybeAppliedArgForPreferExtensionOverProperty delayed ResolveLongIdentAsExprAndComputeRange cenv.tcSink cenv.nameResolver (rangeOfLid longId) ad env.eNameResEnv typeNameResInfo longId maybeAppliedArgExpr |> ForceRaise - TcItemThen cenv overallTy env tpenv (tinstEnclosing, item, mItem, rest, afterResolution) None delayed + TcItemThen cenv overallTy env tpenv nameResolutionResult None delayed //------------------------------------------------------------------------- // Typecheck "item+projections" From 72acb18172c68e291f238b36211be531296efa82 Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Mon, 1 Jun 2026 16:32:25 +0200 Subject: [PATCH 3/7] Trim .fsi doc comments and update test baselines for narrowed ranges Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/Compiler/Checking/NameResolution.fsi | 4 +-- .../EmittedIL/Literals.fs | 2 +- .../OverloadResolutionErrorRangeTests.fs | 8 ++---- .../Nullness/NullableCsharpImportTests.fs | 10 +++---- .../Nullness/NullableReferenceTypesTests.fs | 26 +++++++++---------- ...s-syntax-positive.fs.checknulls_on.err.bsl | 22 ++++++++-------- .../Shadowing/E_NoChangeForEvent.fsx.err.bsl | 4 +-- 7 files changed, 36 insertions(+), 40 deletions(-) diff --git a/src/Compiler/Checking/NameResolution.fsi b/src/Compiler/Checking/NameResolution.fsi index 2746200d165..73728253f66 100755 --- a/src/Compiler/Checking/NameResolution.fsi +++ b/src/Compiler/Checking/NameResolution.fsi @@ -878,7 +878,7 @@ val internal ResolvePartialLongIdentToClassOrRecdFields: val internal ResolveRecordOrClassFieldsOfType: NameResolver -> range -> AccessorDomain -> TType -> bool -> Item list /// Resolve a long identifier occurring in an expression position. -/// Returns the terminal identifier range for diagnostics and expression ranges (#14284). +/// Returns the terminal identifier range (#14284). val internal ResolveLongIdentAsExprAndComputeRange: sink: TcResultsSink -> ncenv: NameResolver -> @@ -891,7 +891,7 @@ val internal ResolveLongIdentAsExprAndComputeRange: ResultOrException /// Resolve a long identifier occurring in an expression position, qualified by a type. -/// Returns the terminal identifier range for diagnostics and expression ranges (#14284). +/// Returns the terminal identifier range (#14284). val internal ResolveExprDotLongIdentAndComputeRange: sink: TcResultsSink -> ncenv: NameResolver -> diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Literals.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Literals.fs index 38e8bef0ce6..d2de4a77bf5 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Literals.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Literals.fs @@ -169,7 +169,7 @@ let [] x = System.Int32.MaxValue + 1 |> withResult { Error = Error 3177 Range = { StartLine = 4 - StartColumn = 34 + StartColumn = 21 EndLine = 4 EndColumn = 46 } Message = "This literal expression or attribute argument results in an arithmetic overflow." diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/OverloadResolutionErrorRangeTests.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/OverloadResolutionErrorRangeTests.fs index 95d45931a16..360ecdddeaa 100644 --- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/OverloadResolutionErrorRangeTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/OverloadResolutionErrorRangeTests.fs @@ -224,10 +224,8 @@ T.Instance.OldMethod() |> shouldFail |> withDiagnostics [ - // First: narrowed to "OldMethod" via mItem (Col 12-21), not the full "T.Instance.OldMethod" + // Narrowed to "OldMethod" via mItem (Col 12-21), not the full "T.Instance.OldMethod" (Warning 44, Line 8, Col 12, Line 8, Col 21, "This construct is deprecated. old method") - // Second: pre-existing duplicate from name resolution attribute check (whole application range) - (Warning 44, Line 8, Col 1, Line 8, Col 23, "This construct is deprecated. old method") ] [] @@ -245,10 +243,8 @@ M.Svc.OldMethod() |> shouldFail |> withDiagnostics [ - // First: narrowed to "OldMethod" via mItem (Col 7-16), not "M.Svc.OldMethod" + // Narrowed to "OldMethod" via mItem (Col 7-16), not "M.Svc.OldMethod" (Warning 44, Line 7, Col 7, Line 7, Col 16, "This construct is deprecated. use NewMethod instead") - // Second: pre-existing duplicate from name resolution attribute check (whole expression range) - (Warning 44, Line 7, Col 1, Line 7, Col 18, "This construct is deprecated. use NewMethod instead") ] [] diff --git a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableCsharpImportTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableCsharpImportTests.fs index 10718f84bc4..6e801408101 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableCsharpImportTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableCsharpImportTests.fs @@ -106,10 +106,10 @@ let y:System.Collections.Generic.LinkedListNode = ll.First |> typeCheckWithStrictNullness |> shouldFail |> withDiagnostics - [ Error 3261, Line 4, Col 59, Line 4, Col 66, "Nullness warning: The types 'System.Collections.Generic.LinkedListNode' and 'System.Collections.Generic.LinkedListNode | null' do not have compatible nullability." - Error 3261, Line 4, Col 59, Line 4, Col 66, "Nullness warning: A non-nullable 'System.Collections.Generic.LinkedListNode' was expected but this expression is nullable. Consider either changing the target to also be nullable, or use pattern matching to safely handle the null case of this expression." - Error 3261, Line 5, Col 59, Line 5, Col 67, "Nullness warning: The types 'System.Collections.Generic.LinkedListNode' and 'System.Collections.Generic.LinkedListNode | null' do not have compatible nullability." - Error 3261, Line 5, Col 59, Line 5, Col 67, "Nullness warning: A non-nullable 'System.Collections.Generic.LinkedListNode' was expected but this expression is nullable. Consider either changing the target to also be nullable, or use pattern matching to safely handle the null case of this expression." ] + [ Error 3261, Line 4, Col 62, Line 4, Col 66, "Nullness warning: The types 'System.Collections.Generic.LinkedListNode' and 'System.Collections.Generic.LinkedListNode | null' do not have compatible nullability." + Error 3261, Line 4, Col 62, Line 4, Col 66, "Nullness warning: A non-nullable 'System.Collections.Generic.LinkedListNode' was expected but this expression is nullable. Consider either changing the target to also be nullable, or use pattern matching to safely handle the null case of this expression." + Error 3261, Line 5, Col 62, Line 5, Col 67, "Nullness warning: The types 'System.Collections.Generic.LinkedListNode' and 'System.Collections.Generic.LinkedListNode | null' do not have compatible nullability." + Error 3261, Line 5, Col 62, Line 5, Col 67, "Nullness warning: A non-nullable 'System.Collections.Generic.LinkedListNode' was expected but this expression is nullable. Consider either changing the target to also be nullable, or use pattern matching to safely handle the null case of this expression." ] [] let ``Nullable directory info show warn on prop access`` () = @@ -123,7 +123,7 @@ let s : string = d.Name // should warn here!! |> asLibrary |> typeCheckWithStrictNullness |> shouldFail - |> withDiagnostics [Error 3261, Line 6, Col 18, Line 6, Col 24, "Nullness warning: The types 'DirectoryInfo' and 'DirectoryInfo | null' do not have compatible nullability."] + |> withDiagnostics [Error 3261, Line 6, Col 20, Line 6, Col 24, "Nullness warning: The types 'DirectoryInfo' and 'DirectoryInfo | null' do not have compatible nullability."] [] let ``Consumption of netstandard2 BCL api which is not annotated`` () = diff --git a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableReferenceTypesTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableReferenceTypesTests.fs index 00efa50fc5c..bd65a3fcff1 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableReferenceTypesTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableReferenceTypesTests.fs @@ -124,9 +124,9 @@ let parsedDate3 = DateTime.Parse(null) |> typeCheckWithStrictNullness |> shouldFail |> withDiagnostics - [Error 3261, Line 3, Col 18, Line 3, Col 52, "Nullness warning: The types 'string' and 'string | null' do not have compatible nullability." - Error 3261, Line 4, Col 33, Line 4, Col 50, "Nullness warning: The types 'string' and 'string | null' do not have compatible nullability." - Error 3261, Line 5, Col 19, Line 5, Col 39, "Nullness warning: The type 'string' does not support 'null'."] + [Error 3261, Line 3, Col 27, Line 3, Col 32, "Nullness warning: The types 'string' and 'string | null' do not have compatible nullability." + Error 3261, Line 4, Col 42, Line 4, Col 47, "Nullness warning: The types 'string' and 'string | null' do not have compatible nullability." + Error 3261, Line 5, Col 28, Line 5, Col 33, "Nullness warning: The type 'string' does not support 'null'."] [] let ``Downcasts and typetests with nullables``() = @@ -295,7 +295,7 @@ let getLength (x: string | null) = x.Length |> asLibrary |> typeCheckWithStrictNullness |> shouldFail - |> withDiagnostics [Error 3261, Line 3, Col 36, Line 3, Col 44, "Nullness warning: The types 'string' and 'string | null' do not have compatible nullability."] + |> withDiagnostics [Error 3261, Line 3, Col 38, Line 3, Col 44, "Nullness warning: The types 'string' and 'string | null' do not have compatible nullability."] [] let ``Does report warning on obj to static member`` () = @@ -318,13 +318,13 @@ Test.XString("x":(string|null)) |> shouldFail |> withDiagnostics [ Error 3261, Line 7, Col 8, Line 7, Col 9, "Nullness warning: The type 'obj | null' supports 'null' but a non-null type is expected." - Error 3261, Line 7, Col 1, Line 7, Col 9, "Nullness warning: The types 'obj' and 'obj | null' do not have compatible nullability." + Error 3261, Line 7, Col 6, Line 7, Col 7, "Nullness warning: The types 'obj' and 'obj | null' do not have compatible nullability." Error 3261, Line 8, Col 17, Line 8, Col 18, "Nullness warning: The type 'obj | null' supports 'null' but a non-null type is expected." - Error 3261, Line 8, Col 10, Line 8, Col 19, "Nullness warning: The types 'obj' and 'obj | null' do not have compatible nullability." + Error 3261, Line 8, Col 15, Line 8, Col 16, "Nullness warning: The types 'obj' and 'obj | null' do not have compatible nullability." Error 3261, Line 9, Col 8, Line 9, Col 23, "Nullness warning: The type 'obj | null' supports 'null' but a non-null type is expected." - Error 3261, Line 9, Col 1, Line 9, Col 24, "Nullness warning: The types 'obj' and 'obj | null' do not have compatible nullability." + Error 3261, Line 9, Col 6, Line 9, Col 7, "Nullness warning: The types 'obj' and 'obj | null' do not have compatible nullability." Error 3261, Line 11, Col 6, Line 11, Col 7, "Nullness warning: The type 'obj | null' supports 'null' but a non-null type is expected." - Error 3261, Line 11, Col 1, Line 11, Col 8, "Nullness warning: The types 'obj' and 'obj | null' do not have compatible nullability." + Error 3261, Line 11, Col 3, Line 11, Col 5, "Nullness warning: The types 'obj' and 'obj | null' do not have compatible nullability." Error 3261, Line 12, Col 14, Line 12, Col 18, "Nullness warning: The type 'string' does not support 'null'." Error 3261, Line 13, Col 14, Line 13, Col 31, "Nullness warning: A non-nullable 'string' was expected but this expression is nullable. Consider either changing the target to also be nullable, or use pattern matching to safely handle the null case of this expression."] @@ -2061,8 +2061,8 @@ let processMyStr (x:mystring) = |> typeCheckWithStrictNullness |> shouldFail |> withDiagnostics [ - Error 3261, Line 12, Col 27, Line 12, Col 39, "Nullness warning: The types 'string' and 'string | null' do not have compatible nullability." - Error 3261, Line 12, Col 27, Line 12, Col 39, "Nullness warning: A non-nullable 'string' was expected but this expression is nullable. Consider either changing the target to also be nullable, or use pattern matching to safely handle the null case of this expression." + Error 3261, Line 12, Col 29, Line 12, Col 37, "Nullness warning: The types 'string' and 'string | null' do not have compatible nullability." + Error 3261, Line 12, Col 29, Line 12, Col 37, "Nullness warning: A non-nullable 'string' was expected but this expression is nullable. Consider either changing the target to also be nullable, or use pattern matching to safely handle the null case of this expression." ] [] @@ -2218,8 +2218,8 @@ let processObj (x:obj) = |> typeCheckWithStrictNullness |> shouldFail |> withDiagnostics [ - Error 3261, Line 6, Col 27, Line 6, Col 39, "Nullness warning: The types 'string' and 'string | null' do not have compatible nullability." - Error 3261, Line 6, Col 27, Line 6, Col 39, "Nullness warning: A non-nullable 'string' was expected but this expression is nullable. Consider either changing the target to also be nullable, or use pattern matching to safely handle the null case of this expression." + Error 3261, Line 6, Col 29, Line 6, Col 37, "Nullness warning: The types 'string' and 'string | null' do not have compatible nullability." + Error 3261, Line 6, Col 29, Line 6, Col 37, "Nullness warning: A non-nullable 'string' was expected but this expression is nullable. Consider either changing the target to also be nullable, or use pattern matching to safely handle the null case of this expression." ] [] @@ -2372,7 +2372,7 @@ let test () = consumeNonNull (MyClass.Create()) |> typeCheckWithStrictNullness |> shouldFail |> withDiagnostics [ - Error 3261, Line 9, Col 31, Line 9, Col 47, "Nullness warning: The type 'MyClass' supports 'null' but a non-null type is expected." + Error 3261, Line 9, Col 39, Line 9, Col 45, "Nullness warning: The type 'MyClass' supports 'null' but a non-null type is expected." ] [] diff --git a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/using-nullness-syntax-positive.fs.checknulls_on.err.bsl b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/using-nullness-syntax-positive.fs.checknulls_on.err.bsl index aa8325df86b..fb3bb92816a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/using-nullness-syntax-positive.fs.checknulls_on.err.bsl +++ b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/using-nullness-syntax-positive.fs.checknulls_on.err.bsl @@ -5,27 +5,27 @@ using-nullness-syntax-positive.fs (17,15)-(17,19) typecheck error Nullness warni using-nullness-syntax-positive.fs (18,15)-(18,19) typecheck error Nullness warning: The type 'String | null' supports 'null' but a non-null type is expected. using-nullness-syntax-positive.fs (19,15)-(19,21) typecheck error Nullness warning: The type 'int option' uses 'null' as a representation value but a non-null type is expected. using-nullness-syntax-positive.fs (27,14)-(27,17) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. -using-nullness-syntax-positive.fs (27,14)-(27,17) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. -using-nullness-syntax-positive.fs (28,14)-(28,19) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. +using-nullness-syntax-positive.fs (27,16)-(27,17) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. using-nullness-syntax-positive.fs (28,14)-(28,19) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. +using-nullness-syntax-positive.fs (28,16)-(28,17) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. using-nullness-syntax-positive.fs (29,14)-(29,17) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. -using-nullness-syntax-positive.fs (29,14)-(29,17) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. +using-nullness-syntax-positive.fs (29,16)-(29,17) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. using-nullness-syntax-positive.fs (43,26)-(43,30) typecheck error Nullness warning: The type 'String' does not support 'null'. using-nullness-syntax-positive.fs (85,63)-(85,70) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. -using-nullness-syntax-positive.fs (85,63)-(85,70) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. -using-nullness-syntax-positive.fs (86,81)-(86,90) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. +using-nullness-syntax-positive.fs (85,65)-(85,70) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. using-nullness-syntax-positive.fs (86,81)-(86,90) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. +using-nullness-syntax-positive.fs (86,85)-(86,90) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. using-nullness-syntax-positive.fs (86,92)-(86,102) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. -using-nullness-syntax-positive.fs (86,92)-(86,102) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. -using-nullness-syntax-positive.fs (91,53)-(91,60) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. +using-nullness-syntax-positive.fs (86,97)-(86,102) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. using-nullness-syntax-positive.fs (91,53)-(91,60) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. +using-nullness-syntax-positive.fs (91,55)-(91,60) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. using-nullness-syntax-positive.fs (92,72)-(92,81) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. -using-nullness-syntax-positive.fs (92,72)-(92,81) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. -using-nullness-syntax-positive.fs (92,83)-(92,93) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. +using-nullness-syntax-positive.fs (92,76)-(92,81) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. using-nullness-syntax-positive.fs (92,83)-(92,93) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. +using-nullness-syntax-positive.fs (92,88)-(92,93) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. using-nullness-syntax-positive.fs (120,32)-(120,36) typecheck error Nullness warning: The type 'obj array' does not support 'null'. -using-nullness-syntax-positive.fs (129,4)-(129,34) typecheck error Nullness warning: The type 'String' does not support 'null'. -using-nullness-syntax-positive.fs (134,5)-(134,44) typecheck error Nullness warning: The type 'String' does not support 'null'. +using-nullness-syntax-positive.fs (129,19)-(129,28) typecheck error Nullness warning: The type 'String' does not support 'null'. +using-nullness-syntax-positive.fs (134,20)-(134,29) typecheck error Nullness warning: The type 'String' does not support 'null'. using-nullness-syntax-positive.fs (144,39)-(144,43) typecheck error Nullness warning: The type 'String' does not support 'null'. using-nullness-syntax-positive.fs (154,40)-(154,44) typecheck error Nullness warning: The type 'string' does not support 'null'. using-nullness-syntax-positive.fs (159,36)-(159,40) typecheck error Nullness warning: The type 'String' does not support 'null'. diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/E_NoChangeForEvent.fsx.err.bsl b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/E_NoChangeForEvent.fsx.err.bsl index 0fe4a182e92..5a3d39e8aee 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/E_NoChangeForEvent.fsx.err.bsl +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/E_NoChangeForEvent.fsx.err.bsl @@ -1,3 +1,3 @@ E_NoChangeForEvent.fsx (9,9)-(9,30) typecheck warning It is recommended that objects supporting the IDisposable interface are created using the syntax 'new Type(args)', rather than 'Type(args)' or 'Type' as a function value representing the constructor, to indicate that resources may be owned by the generated value -E_NoChangeForEvent.fsx (10,3)-(10,11) typecheck error This value is not a function and cannot be applied. It has type 'IEvent', which does not accept arguments. -E_NoChangeForEvent.fsx (18,3)-(18,11) typecheck error This value is not a function and cannot be applied. It has type 'IEvent', which does not accept arguments. \ No newline at end of file +E_NoChangeForEvent.fsx (10,1)-(10,11) typecheck error This value is not a function and cannot be applied. It has type 'IEvent', which does not accept arguments. +E_NoChangeForEvent.fsx (18,1)-(18,11) typecheck error This value is not a function and cannot be applied. It has type 'IEvent', which does not accept arguments. \ No newline at end of file From b6fc10214185ce2abaa7ce324f772dec0cb1af48 Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Tue, 2 Jun 2026 11:59:10 +0200 Subject: [PATCH 4/7] Restore dual-range architecture: wide mItem for expressions/PDB, narrow mItemIdent for diagnostics Restore itemRange (wide) alongside itemIdentRange (narrow) in name resolution return tuples. Thread mItemIdent through all TcItemThen handlers for attribute checks, error messages, and diagnostic squigglies while keeping mItem for expression construction and PDB sequence points. Revert test baselines for type unification and expression-range diagnostics to their original wide ranges. Update baselines for property/field access errors and other handler-specific diagnostics to their new narrow ranges. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../Checking/Expressions/CheckExpressions.fs | 183 +++++++++--------- src/Compiler/Checking/NameResolution.fs | 4 +- src/Compiler/Checking/NameResolution.fsi | 4 +- .../AccessibilityAnnotations/Basic/Basic.fs | 14 +- .../ByrefSafetyAnalysis.fs | 8 +- .../IWSAMsAndSRTPs/IWSAMsAndSRTPsTests.fs | 2 +- .../Types/UnionTypes/UnionTypes.fs | 2 +- .../Debugger/PortablePdbs.fs | 2 +- .../OverloadResolutionErrorRangeTests.fs | 4 +- .../ErrorMessages/TypeMismatchTests.fs | 2 +- .../Language/FixedBindings/FixedBindings.fs | 32 +-- .../Nullness/NullableCsharpImportTests.fs | 12 +- .../Nullness/NullableReferenceTypesTests.fs | 40 ++-- .../Nullness/NullableRegressionTests.fs | 2 +- ...s-syntax-positive.fs.checknulls_on.err.bsl | 22 +-- .../ObsoleteAttributeCheckingTests.fs | 2 +- .../Compiler/Language/StringInterpolation.fs | 2 +- .../Core/NativeInterop/StackallocTests.fs | 10 +- tests/fsharp/core/auto-widen/preview/test.bsl | 16 +- tests/fsharp/core/quotesDebugInfo/test.fsx | 2 +- ...ROVIDER_GetInvokerExpression_Exception.bsl | 2 +- ...VIL_PROVIDER_GetInvokerExpression_Null.bsl | 2 +- .../negTests/InvalidInvokerExpression.bsl | 2 +- tests/fsharp/typeProviders/negTests/neg1.bsl | 2 +- tests/fsharp/typecheck/sigs/neg10.bsl | 20 +- tests/fsharp/typecheck/sigs/neg15.bsl | 14 +- tests/fsharp/typecheck/sigs/neg17.bsl | 4 +- tests/fsharp/typecheck/sigs/neg37_a.bsl | 2 +- tests/fsharp/typecheck/sigs/neg56_a.bsl | 2 +- tests/fsharp/typecheck/sigs/neg56_b.bsl | 4 +- tests/fsharp/typecheck/sigs/neg90.bsl | 2 +- tests/fsharp/typecheck/sigs/neg91.bsl | 8 +- tests/fsharp/typecheck/sigs/neg_byref_3.bsl | 4 +- tests/fsharp/typecheck/sigs/neg_byref_4.bsl | 4 +- 34 files changed, 217 insertions(+), 220 deletions(-) diff --git a/src/Compiler/Checking/Expressions/CheckExpressions.fs b/src/Compiler/Checking/Expressions/CheckExpressions.fs index 175caf9737d..c8455669efe 100644 --- a/src/Compiler/Checking/Expressions/CheckExpressions.fs +++ b/src/Compiler/Checking/Expressions/CheckExpressions.fs @@ -2054,28 +2054,28 @@ let BuildFieldMap (cenv: cenv) env isPartial ty (flds: ((Ident list * Ident) * ' | _ -> error(Error(FSComp.SR.tcRecordFieldInconsistentTypes(), m))) Some(tinst, tcref, fldsmap, List.rev rfldsList) -let ApplyUnionCaseOrExn (makerForUnionCase, makerForExnTag) m (cenv: cenv) env overallTy item = +let ApplyUnionCaseOrExn (makerForUnionCase, makerForExnTag) m mDiag (cenv: cenv) env overallTy item = let g = cenv.g let ad = env.eAccessRights match item with | Item.ExnCase ecref -> - CheckEntityAttributes g ecref m |> CommitOperationResult + CheckEntityAttributes g ecref mDiag |> CommitOperationResult UnifyTypes cenv env m overallTy g.exn_ty - CheckTyconAccessible cenv.amap m ad ecref |> ignore + CheckTyconAccessible cenv.amap mDiag ad ecref |> ignore let mkf = makerForExnTag ecref mkf, recdFieldTysOfExnDefRef ecref, [ for f in (recdFieldsOfExnDefRef ecref) -> f.Id ] | Item.UnionCase(ucinfo, showDeprecated) -> if showDeprecated then - let diagnostic = Deprecated(FSComp.SR.nrUnionTypeNeedsQualifiedAccess(ucinfo.DisplayName, ucinfo.Tycon.DisplayName) |> snd, m) + let diagnostic = Deprecated(FSComp.SR.nrUnionTypeNeedsQualifiedAccess(ucinfo.DisplayName, ucinfo.Tycon.DisplayName) |> snd, mDiag) if g.langVersion.SupportsFeature(LanguageFeature.ErrorOnDeprecatedRequireQualifiedAccess) then errorR(diagnostic) else warning(diagnostic) let ucref = ucinfo.UnionCaseRef - CheckUnionCaseAttributes g ucref m |> CommitOperationResult - CheckUnionCaseAccessible cenv.amap m ad ucref |> ignore + CheckUnionCaseAttributes g ucref mDiag |> CommitOperationResult + CheckUnionCaseAccessible cenv.amap mDiag ad ucref |> ignore let resTy = actualResultTyOfUnionCase ucinfo.TypeInst ucref let inst = mkTyparInst ucref.TyconRef.TyparsNoRange ucinfo.TypeInst UnifyTypes cenv env m overallTy resTy @@ -2083,9 +2083,9 @@ let ApplyUnionCaseOrExn (makerForUnionCase, makerForExnTag) m (cenv: cenv) env o mkf, actualTysOfUnionCaseFields inst ucref, [ for f in ucref.AllFieldsAsList -> f.Id ] | _ -> invalidArg "item" "not a union case or exception reference" -let ApplyUnionCaseOrExnTypes m (cenv: cenv) env overallTy c = +let ApplyUnionCaseOrExnTypes m mDiag (cenv: cenv) env overallTy c = ApplyUnionCaseOrExn ((fun (a, b) mArgs args -> mkUnionCaseExpr(a, b, args, unionRanges m mArgs)), - (fun a mArgs args -> mkExnExpr (a, args, unionRanges m mArgs))) m cenv env overallTy c + (fun a mArgs args -> mkExnExpr (a, args, unionRanges m mArgs))) m mDiag cenv env overallTy c let UnionCaseOrExnCheck (env: TcEnv) numArgTys numArgs m = if numArgs <> numArgTys then error (UnionCaseWrongArguments(env.DisplayEnv, numArgTys, numArgs, m)) @@ -2096,7 +2096,7 @@ let TcUnionCaseOrExnField (cenv: cenv) (env: TcEnv) ty1 m longId fieldNum funcs let mkf, argTys, _argNames = match ResolvePatternLongIdent cenv.tcSink cenv.nameResolver AllIdsOK false m ad env.eNameResEnv TypeNameResolutionInfo.Default longId ExtraDotAfterIdentifier.No with | Item.UnionCase _ | Item.ExnCase _ as item -> - ApplyUnionCaseOrExn funcs m cenv env ty1 item + ApplyUnionCaseOrExn funcs m m cenv env ty1 item | _ -> error(Error(FSComp.SR.tcUnknownUnion(), m)) if fieldNum >= argTys.Length then @@ -6669,6 +6669,7 @@ and TcTyparExprThen (cenv: cenv) overallTy env tpenv synTypar m delayed = | DelayedDotLookup (ident :: rest, m2) :: delayed2 -> let ad = env.eAccessRights let tp, tpenv = TcTypar cenv env NoNewTypars tpenv synTypar + let mExprAndLongId = unionRanges synTypar.Range ident.idRange let ty = mkTyparTy tp let lookupKind = LookupKind.Expr LookupIsInstance.Ambivalent let item, _rest = ResolveLongIdentInType cenv.tcSink cenv.nameResolver env.NameEnv lookupKind ident.idRange ad ident IgnoreOverrides TypeNameResolutionInfo.Default ty @@ -6677,7 +6678,7 @@ and TcTyparExprThen (cenv: cenv) overallTy env tpenv synTypar m delayed = | [] -> delayed2 | _ -> DelayedDotLookup (rest, m2) :: delayed2 CallNameResolutionSink cenv.tcSink (ident.idRange, env.NameEnv, item, emptyTyparInst, ItemOccurrence.Use, env.AccessRights) - TcItemThen cenv overallTy env tpenv ([], item, ident.idRange, [], AfterResolution.DoNothing) (Some ty) delayed3 + TcItemThen cenv overallTy env tpenv ([], item, mExprAndLongId, ident.idRange, [], AfterResolution.DoNothing) (Some ty) delayed3 //TcLookupItemThen cenv overallTy env tpenv mObjExpr objExpr objExprTy delayed item mItem rest afterResolution | _ -> let (SynTypar(_, q, _)) = synTypar @@ -8666,7 +8667,7 @@ and TcNameOfExpr (cenv: cenv) env tpenv (synArg: SynExpr) = let nameResolutionResult = ResolveLongIdentAsExprAndComputeRange cenv.tcSink cenv.nameResolver (rangeOfLid longId) ad env.eNameResEnv typeNameResInfo longId None let resolvesAsExpr = match nameResolutionResult with - | Result (_, item, _, _, _ as res) + | Result (_, item, _, _, _, _ as res) when (match item with | Item.DelegateCtor _ @@ -8914,25 +8915,25 @@ and TcLongIdentThen (cenv: cenv) (overallTy: OverallTy) env tpenv (SynLongIdent( // Typecheck "item+projections" //------------------------------------------------------------------------- *) -// mItem = range of the terminal identifier (for diagnostic and expression ranges) -and TcItemThen (cenv: cenv) (overallTy: OverallTy) env tpenv (tinstEnclosing, item, mItem, rest, afterResolution) staticTyOpt delayed = +// mItem = range of all resolved long-ident segments; mItemIdent = terminal ident only (for diagnostic ranges) +and TcItemThen (cenv: cenv) (overallTy: OverallTy) env tpenv (tinstEnclosing, item, mItem, mItemIdent, rest, afterResolution) staticTyOpt delayed = let delayed = delayRest rest mItem delayed match item with // x where x is a union case or active pattern result tag. | Item.UnionCase _ | Item.ExnCase _ | Item.ActivePatternResult _ as item -> - TcUnionCaseOrExnCaseOrActivePatternResultItemThen cenv overallTy env item tpenv mItem delayed + TcUnionCaseOrExnCaseOrActivePatternResultItemThen cenv overallTy env item tpenv mItem mItemIdent delayed | Item.Types(nm, ty :: _) -> TcTypeItemThen cenv overallTy env nm ty tpenv mItem tinstEnclosing delayed | Item.MethodGroup (methodName, minfos, _) -> - TcMethodItemThen cenv overallTy env item methodName minfos tpenv mItem afterResolution staticTyOpt delayed + TcMethodItemThen cenv overallTy env item methodName minfos tpenv mItem mItemIdent afterResolution staticTyOpt delayed | Item.Trait traitInfo -> TcTraitItemThen cenv overallTy env None traitInfo tpenv mItem delayed | Item.CtorGroup(nm, minfos) -> - TcCtorItemThen cenv overallTy env item nm minfos tinstEnclosing tpenv mItem afterResolution delayed + TcCtorItemThen cenv overallTy env item nm minfos tinstEnclosing tpenv mItem mItemIdent afterResolution delayed | Item.ImplicitOp(id, sln) -> TcImplicitOpItemThen cenv overallTy env id sln tpenv mItem delayed @@ -8941,26 +8942,26 @@ and TcItemThen (cenv: cenv) (overallTy: OverallTy) env tpenv (tinstEnclosing, it TcDelegateCtorItemThen cenv overallTy env ty tinstEnclosing tpenv mItem delayed | Item.Value vref -> - TcValueItemThen cenv overallTy env vref tpenv mItem afterResolution delayed + TcValueItemThen cenv overallTy env vref tpenv mItem mItemIdent afterResolution delayed | Item.Property (nm, pinfos, _) -> - TcPropertyItemThen cenv overallTy env nm pinfos tpenv mItem afterResolution staticTyOpt delayed + TcPropertyItemThen cenv overallTy env nm pinfos tpenv mItem mItemIdent afterResolution staticTyOpt delayed | Item.ILField finfo -> - TcILFieldItemThen cenv overallTy env finfo tpenv mItem delayed + TcILFieldItemThen cenv overallTy env finfo tpenv mItem mItemIdent delayed | Item.RecdField rfinfo -> - TcRecdFieldItemThen cenv overallTy env rfinfo tpenv mItem delayed + TcRecdFieldItemThen cenv overallTy env rfinfo tpenv mItem mItemIdent delayed | Item.Event einfo -> - TcEventItemThen cenv overallTy env tpenv mItem mItem None einfo delayed + TcEventItemThen cenv overallTy env tpenv mItem mItemIdent mItem None einfo delayed | Item.CustomOperation (nm, usageTextOpt, _) -> // 'delayed' is about to be dropped on the floor, first do rudimentary checking to get name resolutions in its body RecordNameAndTypeResolutionsDelayed cenv env tpenv delayed match usageTextOpt() with - | None -> error(Error(FSComp.SR.tcCustomOperationNotUsedCorrectly nm, mItem)) - | Some usageText -> error(Error(FSComp.SR.tcCustomOperationNotUsedCorrectly2(nm, usageText), mItem)) + | None -> error(Error(FSComp.SR.tcCustomOperationNotUsedCorrectly nm, mItemIdent)) + | Some usageText -> error(Error(FSComp.SR.tcCustomOperationNotUsedCorrectly2(nm, usageText), mItemIdent)) // These items are not expected here - they are only used for reporting symbols from name resolution to language service | Item.ActivePatternCase _ @@ -8974,13 +8975,13 @@ and TcItemThen (cenv: cenv) (overallTy: OverallTy) env tpenv (tinstEnclosing, it | Item.UnionCaseField _ | Item.UnqualifiedType _ | Item.Types(_, []) -> - error(Error(FSComp.SR.tcLookupMayNotBeUsedHere(), mItem)) + error(Error(FSComp.SR.tcLookupMayNotBeUsedHere(), mItemIdent)) /// Type check the application of a union case. Also used to cover constructions of F# exception values, and /// applications of active pattern result labels. // // NOTE: the code for this is all a bit convoluted and should really be simplified/regularized. -and TcUnionCaseOrExnCaseOrActivePatternResultItemThen (cenv: cenv) overallTy env item tpenv mItem delayed = +and TcUnionCaseOrExnCaseOrActivePatternResultItemThen (cenv: cenv) overallTy env item tpenv mItem mItemIdent delayed = let g = cenv.g let ad = env.eAccessRights // ucaseAppTy is the type of the union constructor applied to its (optional) argument @@ -8997,9 +8998,9 @@ and TcUnionCaseOrExnCaseOrActivePatternResultItemThen (cenv: cenv) overallTy env let ucref = mkChoiceCaseRef g m aparity n let _, _, tinst, _ = FreshenTyconRef2 g mItem ucref.TyconRef let ucinfo = UnionCaseInfo (tinst, ucref) - ApplyUnionCaseOrExnTypes mItem cenv env ucaseAppTy (Item.UnionCase(ucinfo, false)) + ApplyUnionCaseOrExnTypes mItem mItemIdent cenv env ucaseAppTy (Item.UnionCase(ucinfo, false)) | _ -> - ApplyUnionCaseOrExnTypes mItem cenv env ucaseAppTy item + ApplyUnionCaseOrExnTypes mItem mItemIdent cenv env ucaseAppTy item let numArgTys = List.length argTys // Subsumption at data constructions if argument type is nominal prior to equations for any arguments or return types @@ -9155,8 +9156,8 @@ and TcTypeItemThen (cenv: cenv) overallTy env nm ty tpenv mItem tinstEnclosing d let item = Item.Types(nm, [ty]) CallNameResolutionSink cenv.tcSink (mExprAndTypeArgs, env.NameEnv, item, emptyTyparInst, ItemOccurrence.Use, env.eAccessRights) let typeNameResInfo = GetLongIdentTypeNameInfo otherDelayed - let item, mItem, rest, afterResolution = ResolveExprDotLongIdentAndComputeRange cenv.tcSink cenv.nameResolver (unionRanges mExprAndTypeArgs mLongId) ad env.eNameResEnv ty longId typeNameResInfo IgnoreOverrides true None - TcItemThen cenv overallTy env tpenv ((argsOfAppTy g ty), item, mItem, rest, afterResolution) None otherDelayed + let item, mItem, mItemIdent, rest, afterResolution = ResolveExprDotLongIdentAndComputeRange cenv.tcSink cenv.nameResolver (unionRanges mExprAndTypeArgs mLongId) ad env.eNameResEnv ty longId typeNameResInfo IgnoreOverrides true None + TcItemThen cenv overallTy env tpenv ((argsOfAppTy g ty), item, mItem, mItemIdent, rest, afterResolution) None otherDelayed | DelayedTypeApp(tyargs, _mTypeArgs, mExprAndTypeArgs) :: _delayed' -> // A case where we have an incomplete name e.g. 'Foo.' - we still want to report it to VS! @@ -9176,13 +9177,13 @@ and TcTypeItemThen (cenv: cenv) overallTy env nm ty tpenv mItem tinstEnclosing d else error(Error(FSComp.SR.tcInvalidUseOfTypeName(), mItem)) -and TcMethodItemThen (cenv: cenv) overallTy env item methodName minfos tpenv mItem afterResolution staticTyOpt delayed = +and TcMethodItemThen (cenv: cenv) overallTy env item methodName minfos tpenv mItem mItemIdent afterResolution staticTyOpt delayed = let ad = env.eAccessRights // Static method calls Type.Foo(arg1, ..., argn) let meths = List.map (fun minfo -> minfo, None) minfos match delayed with | DelayedApp (atomicFlag, _, _, arg, mExprAndArg) :: otherDelayed -> - TcMethodApplicationThen cenv env overallTy None tpenv None [] mExprAndArg mItem methodName ad NeverMutates false meths afterResolution NormalValUse [arg] atomicFlag staticTyOpt otherDelayed + TcMethodApplicationThen cenv env overallTy None tpenv None [] mExprAndArg mItemIdent methodName ad NeverMutates false meths afterResolution NormalValUse [arg] atomicFlag staticTyOpt otherDelayed | DelayedTypeApp(tys, mTypeArgs, mExprAndTypeArgs) :: otherDelayed -> @@ -9196,9 +9197,9 @@ and TcMethodItemThen (cenv: cenv) overallTy env item methodName minfos tpenv mIt match otherDelayed with | DelayedApp(atomicFlag, _, _, arg, mExprAndArg) :: otherDelayed -> - TcMethodApplicationThen cenv env overallTy None tpenv None [] mExprAndArg mItem methodName ad NeverMutates false [(minfoAfterStaticArguments, None)] afterResolution NormalValUse [arg] atomicFlag staticTyOpt otherDelayed + TcMethodApplicationThen cenv env overallTy None tpenv None [] mExprAndArg mItemIdent methodName ad NeverMutates false [(minfoAfterStaticArguments, None)] afterResolution NormalValUse [arg] atomicFlag staticTyOpt otherDelayed | _ -> - TcMethodApplicationThen cenv env overallTy None tpenv None [] mExprAndTypeArgs mItem methodName ad NeverMutates false [(minfoAfterStaticArguments, None)] afterResolution NormalValUse [] ExprAtomicFlag.Atomic staticTyOpt otherDelayed + TcMethodApplicationThen cenv env overallTy None tpenv None [] mExprAndTypeArgs mItemIdent methodName ad NeverMutates false [(minfoAfterStaticArguments, None)] afterResolution NormalValUse [] ExprAtomicFlag.Atomic staticTyOpt otherDelayed | None -> #endif @@ -9212,18 +9213,18 @@ and TcMethodItemThen (cenv: cenv) overallTy env item methodName minfos tpenv mIt match otherDelayed with | DelayedApp(atomicFlag, _, _, arg, mExprAndArg) :: otherDelayed -> - TcMethodApplicationThen cenv env overallTy None tpenv (Some tyargs) [] mExprAndArg mItem methodName ad NeverMutates false meths afterResolution NormalValUse [arg] atomicFlag staticTyOpt otherDelayed + TcMethodApplicationThen cenv env overallTy None tpenv (Some tyargs) [] mExprAndArg mItemIdent methodName ad NeverMutates false meths afterResolution NormalValUse [arg] atomicFlag staticTyOpt otherDelayed | _ -> - TcMethodApplicationThen cenv env overallTy None tpenv (Some tyargs) [] mExprAndTypeArgs mItem methodName ad NeverMutates false meths afterResolution NormalValUse [] ExprAtomicFlag.Atomic staticTyOpt otherDelayed + TcMethodApplicationThen cenv env overallTy None tpenv (Some tyargs) [] mExprAndTypeArgs mItemIdent methodName ad NeverMutates false meths afterResolution NormalValUse [] ExprAtomicFlag.Atomic staticTyOpt otherDelayed | _ -> #if !NO_TYPEPROVIDERS if not minfos.IsEmpty && minfos[0].ProvidedStaticParameterInfo.IsSome then - error(Error(FSComp.SR.etMissingStaticArgumentsToMethod(), mItem)) + error(Error(FSComp.SR.etMissingStaticArgumentsToMethod(), mItemIdent)) #endif - TcMethodApplicationThen cenv env overallTy None tpenv None [] mItem mItem methodName ad NeverMutates false meths afterResolution NormalValUse [] ExprAtomicFlag.Atomic staticTyOpt delayed + TcMethodApplicationThen cenv env overallTy None tpenv None [] mItem mItemIdent methodName ad NeverMutates false meths afterResolution NormalValUse [] ExprAtomicFlag.Atomic staticTyOpt delayed -and TcCtorItemThen (cenv: cenv) overallTy env item nm minfos tinstEnclosing tpenv mItem afterResolution delayed = +and TcCtorItemThen (cenv: cenv) overallTy env item nm minfos tinstEnclosing tpenv mItem mItemIdent afterResolution delayed = #if !NO_TYPEPROVIDERS let g = cenv.g let ad = env.eAccessRights @@ -9237,7 +9238,7 @@ and TcCtorItemThen (cenv: cenv) overallTy env item nm minfos tinstEnclosing tpen | DelayedApp(_, _, _, arg, mExprAndArg) :: otherDelayed -> CallExprHasTypeSink cenv.tcSink (mExprAndArg, env.NameEnv, objTy, env.eAccessRights) - TcCtorCall true cenv env tpenv overallTy objTy (Some mItem) item false [arg] mExprAndArg otherDelayed (Some afterResolution) + TcCtorCall true cenv env tpenv overallTy objTy (Some mItemIdent) item false [arg] mExprAndArg otherDelayed (Some afterResolution) | DelayedTypeApp(tyargs, _mTypeArgs, mExprAndTypeArgs) :: DelayedApp(_, _, _, arg, mExprAndArg) :: otherDelayed -> @@ -9258,7 +9259,7 @@ and TcCtorItemThen (cenv: cenv) overallTy env item nm minfos tinstEnclosing tpen item, minfos minfosAfterTyArgs |> List.iter (fun minfo -> UnifyTypes cenv env mExprAndTypeArgs minfo.ApparentEnclosingType objTyAfterTyArgs) - TcCtorCall true cenv env tpenv overallTy objTyAfterTyArgs (Some mItem) itemAfterTyArgs false [arg] mExprAndArg otherDelayed (Some afterResolution) + TcCtorCall true cenv env tpenv overallTy objTyAfterTyArgs (Some mItemIdent) itemAfterTyArgs false [arg] mExprAndArg otherDelayed (Some afterResolution) | DelayedTypeApp(tyargs, _mTypeArgs, mExprAndTypeArgs) :: otherDelayed -> @@ -9269,11 +9270,11 @@ and TcCtorItemThen (cenv: cenv) overallTy env item nm minfos tinstEnclosing tpen CallNameResolutionSink cenv.tcSink (mExprAndTypeArgs, env.NameEnv, resolvedItem, emptyTyparInst, ItemOccurrence.Use, env.eAccessRights) minfos |> List.iter (fun minfo -> UnifyTypes cenv env mExprAndTypeArgs minfo.ApparentEnclosingType objTy) - TcCtorCall true cenv env tpenv overallTy objTy (Some mItem) item false [] mExprAndTypeArgs otherDelayed (Some afterResolution) + TcCtorCall true cenv env tpenv overallTy objTy (Some mItemIdent) item false [] mExprAndTypeArgs otherDelayed (Some afterResolution) | _ -> - TcCtorCall true cenv env tpenv overallTy objTy (Some mItem) item false [] mItem delayed (Some afterResolution) + TcCtorCall true cenv env tpenv overallTy objTy (Some mItemIdent) item false [] mItem delayed (Some afterResolution) and TcTraitItemThen (cenv: cenv) overallTy env objOpt traitInfo tpenv mItem delayed = let g = cenv.g @@ -9481,7 +9482,7 @@ and TcDelegateCtorItemThen cenv overallTy env ty tinstEnclosing tpenv mItem dela | _ -> error(Error(FSComp.SR.tcInvalidUseOfDelegate(), mItem)) -and TcValueItemThen cenv overallTy env vref tpenv mItem afterResolution delayed = +and TcValueItemThen cenv overallTy env vref tpenv mItem mItemIdent afterResolution delayed = let g = cenv.g match delayed with // Mutable value set: 'v <- e' @@ -9489,8 +9490,8 @@ and TcValueItemThen cenv overallTy env vref tpenv mItem afterResolution delayed if not (isNil otherDelayed) then error(Error(FSComp.SR.tcInvalidAssignment(), mStmt)) UnifyTypes cenv env mStmt overallTy.Commit g.unit_ty vref.Deref.SetHasBeenReferenced() - CheckValAccessible mItem env.AccessRights vref - CheckValAttributes g vref mItem |> CommitOperationResult + CheckValAccessible mItemIdent env.AccessRights vref + CheckValAttributes g vref mItemIdent |> CommitOperationResult let vTy = vref.Type let vty2 = if isByrefTy g vTy then @@ -9579,7 +9580,7 @@ and TcValueItemThen cenv overallTy env vref tpenv mItem afterResolution delayed PropagateThenTcDelayed cenv overallTy env tpenv mItem vexpFlex vexpFlex.Type ExprAtomicFlag.Atomic delayed -and TcPropertyItemThen cenv overallTy env nm pinfos tpenv mItem afterResolution staticTyOpt delayed = +and TcPropertyItemThen cenv overallTy env nm pinfos tpenv mItem mItemIdent afterResolution staticTyOpt delayed = let g = cenv.g let ad = env.eAccessRights @@ -9597,7 +9598,7 @@ and TcPropertyItemThen cenv overallTy env nm pinfos tpenv mItem afterResolution ExprAtomicFlag.Atomic, None, [mkSynUnit mItem], delayed, tpenv if not pinfo.IsStatic then - error (Error (FSComp.SR.tcPropertyIsNotStatic nm, mItem)) + error (Error (FSComp.SR.tcPropertyIsNotStatic nm, mItemIdent)) match delayed with | DelayedSet(expr2, mStmt) :: otherDelayed -> @@ -9613,28 +9614,28 @@ and TcPropertyItemThen cenv overallTy env nm pinfos tpenv mItem afterResolution let isByrefMethReturnSetter = meths |> List.exists (function _,Some pinfo -> isByrefTy g (pinfo.GetPropertyType(cenv.amap,mItem)) | _ -> false) if not isByrefMethReturnSetter then - errorR (Error (FSComp.SR.tcPropertyCannotBeSet1 nm, mItem)) + errorR (Error (FSComp.SR.tcPropertyCannotBeSet1 nm, mItemIdent)) // x.P <- ... byref setter - if isNil meths then error (Error (FSComp.SR.tcPropertyIsNotReadable nm, mItem)) - TcMethodApplicationThen cenv env overallTy None tpenv tyArgsOpt [] mItem mItem nm ad NeverMutates true meths afterResolution NormalValUse args ExprAtomicFlag.Atomic staticTyOpt delayed + if isNil meths then error (Error (FSComp.SR.tcPropertyIsNotReadable nm, mItemIdent)) + TcMethodApplicationThen cenv env overallTy None tpenv tyArgsOpt [] mItem mItemIdent nm ad NeverMutates true meths afterResolution NormalValUse args ExprAtomicFlag.Atomic staticTyOpt delayed else let args = if pinfo.IsIndexer then args else [] if isNil meths then - errorR (Error (FSComp.SR.tcPropertyCannotBeSet1 nm, mItem)) + errorR (Error (FSComp.SR.tcPropertyCannotBeSet1 nm, mItemIdent)) // Note: static calls never mutate a struct object argument - TcMethodApplicationThen cenv env overallTy None tpenv tyArgsOpt [] mStmt mItem nm ad NeverMutates true meths afterResolution NormalValUse (args@[expr2]) ExprAtomicFlag.NonAtomic staticTyOpt otherDelayed + TcMethodApplicationThen cenv env overallTy None tpenv tyArgsOpt [] mStmt mItemIdent nm ad NeverMutates true meths afterResolution NormalValUse (args@[expr2]) ExprAtomicFlag.NonAtomic staticTyOpt otherDelayed | _ -> // Static Property Get (possibly indexer) let meths = pinfos |> GettersOfPropInfos - if isNil meths then error (Error (FSComp.SR.tcPropertyIsNotReadable nm, mItem)) + if isNil meths then error (Error (FSComp.SR.tcPropertyIsNotReadable nm, mItemIdent)) // Note: static calls never mutate a struct object argument - TcMethodApplicationThen cenv env overallTy None tpenv tyArgsOpt [] mItem mItem nm ad NeverMutates true meths afterResolution NormalValUse args ExprAtomicFlag.Atomic staticTyOpt delayed + TcMethodApplicationThen cenv env overallTy None tpenv tyArgsOpt [] mItem mItemIdent nm ad NeverMutates true meths afterResolution NormalValUse args ExprAtomicFlag.Atomic staticTyOpt delayed -and TcILFieldItemThen cenv overallTy env finfo tpenv mItem delayed = +and TcILFieldItemThen cenv overallTy env finfo tpenv mItem mItemIdent delayed = let g = cenv.g let ad = env.eAccessRights - ILFieldStaticChecks g cenv.amap cenv.infoReader ad mItem finfo + ILFieldStaticChecks g cenv.amap cenv.infoReader ad mItemIdent finfo let fref = finfo.ILFieldRef let exprTy = finfo.FieldType(cenv.amap, mItem) match delayed with @@ -9678,13 +9679,12 @@ and TcILFieldItemThen cenv overallTy env finfo tpenv mItem delayed = PropagateThenTcDelayed cenv overallTy env tpenv mItem exprFlex exprTy ExprAtomicFlag.Atomic delayed -and TcRecdFieldItemThen cenv overallTy env rfinfo tpenv mItem delayed = +and TcRecdFieldItemThen cenv overallTy env rfinfo tpenv mItem mItemIdent delayed = let g = cenv.g let ad = env.eAccessRights - // Get static F# field or literal - CheckRecdFieldInfoAccessible cenv.amap mItem ad rfinfo - if not rfinfo.IsStatic then error (Error (FSComp.SR.tcFieldIsNotStatic(rfinfo.DisplayName), mItem)) - CheckRecdFieldInfoAttributes g rfinfo mItem |> CommitOperationResult + CheckRecdFieldInfoAccessible cenv.amap mItemIdent ad rfinfo + if not rfinfo.IsStatic then error (Error (FSComp.SR.tcFieldIsNotStatic(rfinfo.DisplayName), mItemIdent)) + CheckRecdFieldInfoAttributes g rfinfo mItemIdent |> CommitOperationResult let fref = rfinfo.RecdFieldRef let fieldTy = rfinfo.FieldType match delayed with @@ -9755,10 +9755,10 @@ and TcLookupThen cenv overallTy env tpenv mObjExpr objExpr objExprTy longId dela CanonicalizePartialInferenceProblem cenv.css env.DisplayEnv mExprAndLongId (freeInTypeLeftToRight g false objExprTy) let maybeAppliedArgExpr = DelayedItem.maybeAppliedArgForPreferExtensionOverProperty delayed - let item, mItem, rest, afterResolution = ResolveExprDotLongIdentAndComputeRange cenv.tcSink cenv.nameResolver mExprAndLongId ad env.NameEnv objExprTy longId TypeNameResolutionInfo.Default findFlag false maybeAppliedArgExpr - TcLookupItemThen cenv overallTy env tpenv mObjExpr objExpr objExprTy delayed item mItem rest afterResolution + let item, mItem, mItemIdent, rest, afterResolution = ResolveExprDotLongIdentAndComputeRange cenv.tcSink cenv.nameResolver mExprAndLongId ad env.NameEnv objExprTy longId TypeNameResolutionInfo.Default findFlag false maybeAppliedArgExpr + TcLookupItemThen cenv overallTy env tpenv mObjExpr objExpr objExprTy delayed item mItem mItemIdent rest afterResolution -and TcLookupItemThen cenv overallTy env tpenv mObjExpr objExpr objExprTy delayed item mItem rest afterResolution = +and TcLookupItemThen cenv overallTy env tpenv mObjExpr objExpr objExprTy delayed item mItem mItemIdent rest afterResolution = let g = cenv.g let ad = env.eAccessRights let objArgs = [objExpr] @@ -9774,7 +9774,7 @@ and TcLookupItemThen cenv overallTy env tpenv mObjExpr objExpr objExprTy delayed match minfos with | minfo :: _ -> // Check if we have properties with "init-only" setters, which we try to call after init is done. - CheckInitProperties g minfo methodName mItem + CheckInitProperties g minfo methodName mItemIdent | _ -> () #if !NO_TYPEPROVIDERS @@ -9784,16 +9784,16 @@ and TcLookupItemThen cenv overallTy env tpenv mObjExpr objExpr objExprTy delayed let item = Item.MethodGroup(methodName, [minfoAfterStaticArguments], Some minfos[0]) CallNameResolutionSinkReplacing cenv.tcSink (mExprAndItem, env.NameEnv, item, [], ItemOccurrence.Use, env.eAccessRights) - TcMethodApplicationThen cenv env overallTy None tpenv None objArgs mExprAndItem mItem methodName ad mutates false [(minfoAfterStaticArguments, None)] afterResolution NormalValUse args atomicFlag None delayed + TcMethodApplicationThen cenv env overallTy None tpenv None objArgs mExprAndItem mItemIdent methodName ad mutates false [(minfoAfterStaticArguments, None)] afterResolution NormalValUse args atomicFlag None delayed | None -> if not minfos.IsEmpty && minfos[0].ProvidedStaticParameterInfo.IsSome then - error(Error(FSComp.SR.etMissingStaticArgumentsToMethod(), mItem)) + error(Error(FSComp.SR.etMissingStaticArgumentsToMethod(), mItemIdent)) #endif let tyArgsOpt, tpenv = TcMemberTyArgsOpt cenv env tpenv tyArgsOpt let meths = minfos |> List.map (fun minfo -> minfo, None) - TcMethodApplicationThen cenv env overallTy None tpenv tyArgsOpt objArgs mExprAndItem mItem methodName ad mutates false meths afterResolution NormalValUse args atomicFlag None delayed + TcMethodApplicationThen cenv env overallTy None tpenv tyArgsOpt objArgs mExprAndItem mItemIdent methodName ad mutates false meths afterResolution NormalValUse args atomicFlag None delayed | Item.Property (nm, pinfos, _) -> // Instance property @@ -9805,7 +9805,7 @@ and TcLookupItemThen cenv overallTy env tpenv mObjExpr objExpr objExprTy delayed if pinfo.IsIndexer then GetMemberApplicationArgs delayed cenv env tpenv else ExprAtomicFlag.Atomic, None, [mkSynUnit mItem], delayed, tpenv - if pinfo.IsStatic then error (Error (FSComp.SR.tcPropertyIsStatic nm, mItem)) + if pinfo.IsStatic then error (Error (FSComp.SR.tcPropertyIsStatic nm, mItemIdent)) match delayed with @@ -9818,27 +9818,26 @@ and TcLookupItemThen cenv overallTy env tpenv mObjExpr objExpr objExprTy delayed let meths = pinfos |> GettersOfPropInfos let isByrefMethReturnSetter = meths |> List.exists (function _,Some pinfo -> isByrefTy g (pinfo.GetPropertyType(cenv.amap,mItem)) | _ -> false) if not isByrefMethReturnSetter then - errorR (Error (FSComp.SR.tcPropertyCannotBeSet1 nm, mItem)) + errorR (Error (FSComp.SR.tcPropertyCannotBeSet1 nm, mItemIdent)) // x.P <- ... byref setter - if isNil meths then error (Error (FSComp.SR.tcPropertyIsNotReadable nm, mItem)) - TcMethodApplicationThen cenv env overallTy None tpenv tyArgsOpt objArgs mExprAndItem mItem nm ad PossiblyMutates true meths afterResolution NormalValUse args atomicFlag None delayed + if isNil meths then error (Error (FSComp.SR.tcPropertyIsNotReadable nm, mItemIdent)) + TcMethodApplicationThen cenv env overallTy None tpenv tyArgsOpt objArgs mExprAndItem mItemIdent nm ad PossiblyMutates true meths afterResolution NormalValUse args atomicFlag None delayed else if g.langVersion.SupportsFeature(LanguageFeature.RequiredPropertiesSupport) && pinfo.IsSetterInitOnly then - errorR (Error (FSComp.SR.tcInitOnlyPropertyCannotBeSet1 nm, mItem)) + errorR (Error (FSComp.SR.tcInitOnlyPropertyCannotBeSet1 nm, mItemIdent)) let args = if pinfo.IsIndexer then args else [] let mut = (if isStructTy g (tyOfExpr g objExpr) then DefinitelyMutates else PossiblyMutates) - TcMethodApplicationThen cenv env overallTy None tpenv tyArgsOpt objArgs mStmt mItem nm ad mut true meths afterResolution NormalValUse (args @ [expr2]) atomicFlag None [] + TcMethodApplicationThen cenv env overallTy None tpenv tyArgsOpt objArgs mStmt mItemIdent nm ad mut true meths afterResolution NormalValUse (args @ [expr2]) atomicFlag None [] | _ -> // Instance property getter let meths = GettersOfPropInfos pinfos - if isNil meths then error (Error (FSComp.SR.tcPropertyIsNotReadable nm, mItem)) - TcMethodApplicationThen cenv env overallTy None tpenv tyArgsOpt objArgs mExprAndItem mItem nm ad PossiblyMutates true meths afterResolution NormalValUse args atomicFlag None delayed + if isNil meths then error (Error (FSComp.SR.tcPropertyIsNotReadable nm, mItemIdent)) + TcMethodApplicationThen cenv env overallTy None tpenv tyArgsOpt objArgs mExprAndItem mItemIdent nm ad PossiblyMutates true meths afterResolution NormalValUse args atomicFlag None delayed | Item.RecdField rfinfo -> - // Get or set instance F# field or literal - RecdFieldInstanceChecks g cenv.amap ad mItem rfinfo + RecdFieldInstanceChecks g cenv.amap ad mItemIdent rfinfo let tgtTy = rfinfo.DeclaringType let boxity = isStructTy g tgtTy AddCxTypeMustSubsumeType ContextInfo.NoContext env.DisplayEnv cenv.css mItem NoTrace tgtTy objExprTy @@ -9847,8 +9846,8 @@ and TcLookupItemThen cenv overallTy env tpenv mObjExpr objExpr objExprTy delayed match delayed with | DelayedSet(expr2, mStmt) :: otherDelayed -> // Mutable value set: 'v <- e' - if not (isNil otherDelayed) then error(Error(FSComp.SR.tcInvalidAssignment(), mItem)) - CheckRecdFieldMutation mItem env.DisplayEnv rfinfo + if not (isNil otherDelayed) then error(Error(FSComp.SR.tcInvalidAssignment(), mItemIdent)) + CheckRecdFieldMutation mItemIdent env.DisplayEnv rfinfo UnifyTypes cenv env mStmt overallTy.Commit g.unit_ty // Always allow subsumption on assignment to fields let expr2R, tpenv = TcExprFlex cenv true false fieldTy env tpenv expr2 @@ -9866,15 +9865,14 @@ and TcLookupItemThen cenv overallTy env tpenv mObjExpr objExpr objExprTy delayed let fieldTy = List.item n tinst match delayed with | DelayedSet _ :: _otherDelayed -> - error(Error(FSComp.SR.tcInvalidAssignment(),mItem)) + error(Error(FSComp.SR.tcInvalidAssignment(),mItemIdent)) | _ -> // Instance F# Anonymous Record let objExpr' = mkAnonRecdFieldGet g (anonInfo,objExpr,tinst,n,mExprAndItem) PropagateThenTcDelayed cenv overallTy env tpenv mExprAndItem (MakeApplicableExprWithFlex cenv env objExpr') fieldTy ExprAtomicFlag.Atomic delayed | Item.ILField finfo -> - // Get or set instance IL field - ILFieldInstanceChecks g cenv.amap ad mItem finfo + ILFieldInstanceChecks g cenv.amap ad mItemIdent finfo let exprTy = finfo.FieldType(cenv.amap, mItem) match delayed with @@ -9890,13 +9888,12 @@ and TcLookupItemThen cenv overallTy env tpenv mObjExpr objExpr objExprTy delayed PropagateThenTcDelayed cenv overallTy env tpenv mExprAndItem (MakeApplicableExprWithFlex cenv env expr) exprTy ExprAtomicFlag.Atomic delayed | Item.Event einfo -> - // Instance IL event (fake up event-as-value) - TcEventItemThen cenv overallTy env tpenv mItem mExprAndItem (Some(objExpr, objExprTy)) einfo delayed + TcEventItemThen cenv overallTy env tpenv mItem mItemIdent mExprAndItem (Some(objExpr, objExprTy)) einfo delayed | Item.Trait traitInfo -> TcTraitItemThen cenv overallTy env (Some objExpr) traitInfo tpenv mItem delayed - | Item.DelegateCtor _ -> error (Error (FSComp.SR.tcConstructorsCannotBeFirstClassValues(), mItem)) + | Item.DelegateCtor _ -> error (Error (FSComp.SR.tcConstructorsCannotBeFirstClassValues(), mItemIdent)) | Item.UnionCase(info, _) -> let clashingNames = info.Tycon.MembersOfFSharpTyconSorted |> List.tryFind(fun mem -> mem.DisplayNameCore = info.DisplayNameCore) @@ -9906,7 +9903,7 @@ and TcLookupItemThen cenv overallTy env tpenv mObjExpr objExpr objExprTy delayed let kind = if value.IsMember then "member" else "value" errorR (NameClash(info.DisplayNameCore, kind, info.DisplayNameCore, value.Range, FSComp.SR.typeInfoUnionCase(), info.DisplayNameCore, value.Range)) - error (Error (FSComp.SR.tcSyntaxFormUsedOnlyWithRecordLabelsPropertiesAndFields(), mItem)) + error (Error (FSComp.SR.tcSyntaxFormUsedOnlyWithRecordLabelsPropertiesAndFields(), mItemIdent)) // These items are not expected here - they can't be the result of a instance member dot-lookup "expr.Ident" | Item.ActivePatternResult _ | Item.CustomOperation _ @@ -9925,27 +9922,27 @@ and TcLookupItemThen cenv overallTy env tpenv mObjExpr objExpr objExprTy delayed | Item.CustomBuilder _ | Item.OtherName _ | Item.ActivePatternCase _ -> - error (Error (FSComp.SR.tcSyntaxFormUsedOnlyWithRecordLabelsPropertiesAndFields(), mItem)) + error (Error (FSComp.SR.tcSyntaxFormUsedOnlyWithRecordLabelsPropertiesAndFields(), mItemIdent)) // Instance IL event (fake up event-as-value) -and TcEventItemThen (cenv: cenv) overallTy env tpenv mItem mExprAndItem objDetails (einfo: EventInfo) delayed = +and TcEventItemThen (cenv: cenv) overallTy env tpenv mItem mItemIdent mExprAndItem objDetails (einfo: EventInfo) delayed = let g = cenv.g let ad = env.eAccessRights let nm = einfo.EventName match objDetails, einfo.IsStatic with - | Some _, true -> error (Error (FSComp.SR.tcEventIsStatic nm, mItem)) - | None, false -> error (Error (FSComp.SR.tcEventIsNotStatic nm, mItem)) + | Some _, true -> error (Error (FSComp.SR.tcEventIsStatic nm, mItemIdent)) + | None, false -> error (Error (FSComp.SR.tcEventIsNotStatic nm, mItemIdent)) | _ -> () // The F# wrappers around events are null safe (impl is in FSharp.Core). Therefore, from an F# perspective, the type of the delegate can be considered Not Null. let delTy = einfo.GetDelegateType(cenv.amap, mItem) |> replaceNullnessOfTy KnownWithoutNull let (SigOfFunctionForDelegate(delInvokeMeth, delArgTys, _, _)) = GetSigOfFunctionForDelegate cenv.infoReader delTy mItem ad let objArgs = Option.toList (Option.map fst objDetails) - MethInfoChecks g cenv.amap true None objArgs env.eAccessRights mItem delInvokeMeth + MethInfoChecks g cenv.amap true None objArgs env.eAccessRights mItemIdent delInvokeMeth - CheckILEventAttributes g einfo.DeclaringTyconRef (einfo.GetCustomAttrs()) mItem |> CommitOperationResult + CheckILEventAttributes g einfo.DeclaringTyconRef (einfo.GetCustomAttrs()) mItemIdent |> CommitOperationResult // This checks for and drops the 'object' sender let argsTy = ArgsTypeOfEventInfo cenv.infoReader mItem ad einfo diff --git a/src/Compiler/Checking/NameResolution.fs b/src/Compiler/Checking/NameResolution.fs index db2ef084879..f2e636d3e44 100644 --- a/src/Compiler/Checking/NameResolution.fs +++ b/src/Compiler/Checking/NameResolution.fs @@ -4320,7 +4320,7 @@ let ResolveLongIdentAsExprAndComputeRange (sink: TcResultsSink) (ncenv: NameReso callSink (item, emptyTyparInst) AfterResolution.DoNothing - success (tinstEnclosing, item, itemIdentRange, rest, afterResolution) + success (tinstEnclosing, item, itemRange, itemIdentRange, rest, afterResolution) [] let (|NonOverridable|_|) namedItem = @@ -4389,7 +4389,7 @@ let ResolveExprDotLongIdentAndComputeRange (sink: TcResultsSink) (ncenv: NameRes callSink (unrefinedItem, emptyTyparInst) AfterResolution.DoNothing - item, itemIdentRange, rest, afterResolution + item, itemRange, itemIdentRange, rest, afterResolution //------------------------------------------------------------------------- diff --git a/src/Compiler/Checking/NameResolution.fsi b/src/Compiler/Checking/NameResolution.fsi index 73728253f66..a3b6869d9d6 100755 --- a/src/Compiler/Checking/NameResolution.fsi +++ b/src/Compiler/Checking/NameResolution.fsi @@ -888,7 +888,7 @@ val internal ResolveLongIdentAsExprAndComputeRange: typeNameResInfo: TypeNameResolutionInfo -> lid: Ident list -> maybeAppliedArgExpr: SynExpr option -> - ResultOrException + ResultOrException /// Resolve a long identifier occurring in an expression position, qualified by a type. /// Returns the terminal identifier range (#14284). @@ -904,7 +904,7 @@ val internal ResolveExprDotLongIdentAndComputeRange: findFlag: FindMemberFlag -> staticOnly: bool -> maybeAppliedArgExpr: SynExpr option -> - Item * range * Ident list * AfterResolution + Item * range * range * Ident list * AfterResolution /// A generator of type instantiations used when no more specific type instantiation is known. val FakeInstantiationGenerator: range -> Typar list -> TType list diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/Basic.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/Basic.fs index 3a283f18cc0..486316c3126 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/Basic.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/AccessibilityAnnotations/Basic/Basic.fs @@ -57,8 +57,8 @@ module AccessibilityAnnotations_Basic = |> verifyCompile |> shouldFail |> withDiagnostics [ - (Error 1094, Line 18, Col 25, Line 18, Col 41, "The value 'somePrivateField' is not accessible from this code location") - (Error 1094, Line 19, Col 25, Line 19, Col 42, "The value 'somePrivateMethod' is not accessible from this code location") + (Error 1094, Line 18, Col 17, Line 18, Col 41, "The value 'somePrivateField' is not accessible from this code location") + (Error 1094, Line 19, Col 17, Line 19, Col 42, "The value 'somePrivateMethod' is not accessible from this code location") (Error 491, Line 23, Col 17, Line 23, Col 34, "The member or object constructor 'PrivateMethod' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions.") ] @@ -70,11 +70,11 @@ module AccessibilityAnnotations_Basic = |> shouldFail |> withDiagnostics [ (Error 1092, Line 26, Col 19, Line 26, Col 32, "The type 'PrivateModule' is not accessible from this code location") - (Error 1094, Line 26, Col 33, Line 26, Col 34, "The value 'x' is not accessible from this code location") + (Error 1094, Line 26, Col 17, Line 26, Col 34, "The value 'x' is not accessible from this code location") (Error 1092, Line 27, Col 19, Line 27, Col 32, "The type 'PrivateModule' is not accessible from this code location") - (Error 1094, Line 27, Col 33, Line 27, Col 34, "The value 'f' is not accessible from this code location") - (Error 1094, Line 29, Col 19, Line 29, Col 20, "The value 'y' is not accessible from this code location") - (Error 1094, Line 30, Col 19, Line 30, Col 20, "The value 'g' is not accessible from this code location") + (Error 1094, Line 27, Col 17, Line 27, Col 34, "The value 'f' is not accessible from this code location") + (Error 1094, Line 29, Col 17, Line 29, Col 20, "The value 'y' is not accessible from this code location") + (Error 1094, Line 30, Col 17, Line 30, Col 20, "The value 'g' is not accessible from this code location") ] //SOURCE=E_privateThingsInaccessible03.fs SCFLAGS="--test:ErrorRanges" # E_privateThingsInaccessible03.fs @@ -85,7 +85,7 @@ module AccessibilityAnnotations_Basic = |> shouldFail |> withDiagnostics [ (Error 1092, Line 11, Col 15, Line 11, Col 28, "The type 'PrivateModule' is not accessible from this code location") - (Error 1094, Line 11, Col 29, Line 11, Col 30, "The value 'x' is not accessible from this code location") + (Error 1094, Line 11, Col 13, Line 11, Col 30, "The value 'x' is not accessible from this code location") (Error 39, Line 15, Col 13, Line 15, Col 26, "The value, namespace, type or module 'PrivateModule' is not defined.") ] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefSafetyAnalysis.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefSafetyAnalysis.fs index afcce5ec918..40d511a028b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefSafetyAnalysis.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefSafetyAnalysis.fs @@ -97,11 +97,11 @@ module ByrefSafetyAnalysis = (Error 412, Line 178, Col 13, Line 178, Col 24, "A type instantiation involves a byref type. This is not permitted by the rules of Common IL.") (Error 412, Line 183, Col 9, Line 183, Col 20, "A type instantiation involves a byref type. This is not permitted by the rules of Common IL.") (Error 412, Line 187, Col 13, Line 187, Col 14, "A type instantiation involves a byref type. This is not permitted by the rules of Common IL.") - (Error 412, Line 187, Col 28, Line 187, Col 32, "A type instantiation involves a byref type. This is not permitted by the rules of Common IL.") - (Error 425, Line 187, Col 28, Line 187, Col 32, "The type of a first-class function cannot contain byrefs") + (Error 412, Line 187, Col 17, Line 187, Col 32, "A type instantiation involves a byref type. This is not permitted by the rules of Common IL.") + (Error 425, Line 187, Col 17, Line 187, Col 32, "The type of a first-class function cannot contain byrefs") (Error 412, Line 191, Col 13, Line 191, Col 14, "A type instantiation involves a byref type. This is not permitted by the rules of Common IL.") - (Error 412, Line 193, Col 24, Line 193, Col 28, "A type instantiation involves a byref type. This is not permitted by the rules of Common IL.") - (Error 412, Line 198, Col 20, Line 198, Col 24, "A type instantiation involves a byref type. This is not permitted by the rules of Common IL.") + (Error 412, Line 193, Col 13, Line 193, Col 28, "A type instantiation involves a byref type. This is not permitted by the rules of Common IL.") + (Error 412, Line 198, Col 9, Line 198, Col 24, "A type instantiation involves a byref type. This is not permitted by the rules of Common IL.") (Error 3301, Line 201, Col 9, Line 201, Col 15, "The function or method has an invalid return type 'byref * int'. This is not permitted by the rules of Common IL.") (Error 412, Line 203, Col 10, Line 203, Col 15, "A type instantiation involves a byref type. This is not permitted by the rules of Common IL.") (Error 421, Line 203, Col 11, Line 203, Col 12, "The address of the variable 'x' cannot be used at this point") diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/IWSAMsAndSRTPs/IWSAMsAndSRTPsTests.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/IWSAMsAndSRTPs/IWSAMsAndSRTPsTests.fs index f03cfedf70b..fb6c648ca49 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/IWSAMsAndSRTPs/IWSAMsAndSRTPsTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/IWSAMsAndSRTPs/IWSAMsAndSRTPsTests.fs @@ -1811,7 +1811,7 @@ let _x3 = curryN f3 1 2 3 let private iwsamWarnings = [ "--nowarn:3536" ; "--nowarn:3535" ] [] - [] + [] [ int", "ITest.Parse \"42\"", "Parse", 3, 9, 3, 25)>] let ``Direct call to static abstract on interface produces error 3866`` (memberDef: string, call: string, memberName: string, l1, c1, l2, c2) = Fsx $"type ITest =\n {memberDef}\nlet x = {call}" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionTypes.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionTypes.fs index 9498f53905f..7d5db82abde 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionTypes.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionTypes.fs @@ -124,7 +124,7 @@ module UnionTypes = |> shouldFail |> withDiagnostics [ (Warning 1125, Line 11, Col 29, Line 11, Col 41, "The instantiation of the generic type 'list1' is missing and can't be inferred from the arguments or return type of this member. Consider providing a type instantiation when accessing this type, e.g. 'list1<_>'.") - (Error 3068, Line 15, Col 19, Line 15, Col 25, "The function or member 'toList' is used in a way that requires further type annotations at its definition to ensure consistency of inferred types. The inferred signature is 'static member private list1.toList: ('a list1 -> 'a list)'.") + (Error 3068, Line 15, Col 10, Line 15, Col 25, "The function or member 'toList' is used in a way that requires further type annotations at its definition to ensure consistency of inferred types. The inferred signature is 'static member private list1.toList: ('a list1 -> 'a list)'.") ] //SOURCE=E_Interface_IComparable.fsx SCFLAGS="--test:ErrorRanges" # E_Interface_IComparable.fsx diff --git a/tests/FSharp.Compiler.ComponentTests/Debugger/PortablePdbs.fs b/tests/FSharp.Compiler.ComponentTests/Debugger/PortablePdbs.fs index cf722e0dbac..5d44d059cf7 100644 --- a/tests/FSharp.Compiler.ComponentTests/Debugger/PortablePdbs.fs +++ b/tests/FSharp.Compiler.ComponentTests/Debugger/PortablePdbs.fs @@ -69,7 +69,7 @@ module Baz = ] ] VerifySequencePoints [ - Line 6, Col 33, Line 6, Col 49 + Line 6, Col 21, Line 6, Col 49 Line 8, Col 26, Line 8, Col 32 Line 16, Col 20, Line 16, Col 22 Line 21, Col 20, Line 21, Col 22 diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/OverloadResolutionErrorRangeTests.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/OverloadResolutionErrorRangeTests.fs index 360ecdddeaa..3f0dbf9095c 100644 --- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/OverloadResolutionErrorRangeTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/OverloadResolutionErrorRangeTests.fs @@ -224,8 +224,8 @@ T.Instance.OldMethod() |> shouldFail |> withDiagnostics [ - // Narrowed to "OldMethod" via mItem (Col 12-21), not the full "T.Instance.OldMethod" (Warning 44, Line 8, Col 12, Line 8, Col 21, "This construct is deprecated. old method") + (Warning 44, Line 8, Col 1, Line 8, Col 23, "This construct is deprecated. old method") ] [] @@ -243,8 +243,8 @@ M.Svc.OldMethod() |> shouldFail |> withDiagnostics [ - // Narrowed to "OldMethod" via mItem (Col 7-16), not "M.Svc.OldMethod" (Warning 44, Line 7, Col 7, Line 7, Col 16, "This construct is deprecated. use NewMethod instead") + (Warning 44, Line 7, Col 1, Line 7, Col 18, "This construct is deprecated. use NewMethod instead") ] [] diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/TypeMismatchTests.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/TypeMismatchTests.fs index 914add221fe..337a49d5352 100644 --- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/TypeMismatchTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/TypeMismatchTests.fs @@ -367,7 +367,7 @@ let main args = |> typecheck |> shouldFail |> withDiagnostics [ - (Error 1, Line 8, Col 29, Line 8, Col 37, "The tuples have differing lengths of 3 and 2") + (Error 1, Line 8, Col 25, Line 8, Col 37, "The tuples have differing lengths of 3 and 2") ] module ``Not a function`` = diff --git a/tests/FSharp.Compiler.ComponentTests/Language/FixedBindings/FixedBindings.fs b/tests/FSharp.Compiler.ComponentTests/Language/FixedBindings/FixedBindings.fs index ec8374a8d57..2fba7454498 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/FixedBindings/FixedBindings.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/FixedBindings/FixedBindings.fs @@ -14,7 +14,7 @@ module FixedBindingsTests = |> shouldSucceed |> withDiagnostics [ (Warning 9, Line 5, Col 9, Line 5, Col 12, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") - (Warning 9, Line 6, Col 15, Line 6, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") + (Warning 9, Line 6, Col 5, Line 6, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") ] [] @@ -26,7 +26,7 @@ module FixedBindingsTests = |> shouldSucceed |> withDiagnostics [ (Warning 9, Line 5, Col 9, Line 5, Col 12, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") - (Warning 9, Line 6, Col 15, Line 6, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") + (Warning 9, Line 6, Col 5, Line 6, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") ] [] @@ -112,7 +112,7 @@ The type 'char' does not match the type 'byte'""") |> shouldSucceed |> withDiagnostics [ (Warning 9, Line 5, Col 9, Line 5, Col 12, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") - (Warning 9, Line 6, Col 15, Line 6, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") + (Warning 9, Line 6, Col 5, Line 6, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") ] [] @@ -124,7 +124,7 @@ The type 'char' does not match the type 'byte'""") |> shouldSucceed |> withDiagnostics [ (Warning 9, Line 7, Col 9, Line 7, Col 12, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") - (Warning 9, Line 8, Col 15, Line 8, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") + (Warning 9, Line 8, Col 5, Line 8, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") ] [] @@ -136,7 +136,7 @@ The type 'char' does not match the type 'byte'""") |> shouldSucceed |> withDiagnostics [ (Warning 9, Line 11, Col 13, Line 11, Col 16, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") - (Warning 9, Line 12, Col 19, Line 12, Col 22, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") + (Warning 9, Line 12, Col 9, Line 12, Col 22, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") ] [] @@ -196,7 +196,7 @@ module ExtendedFixedBindings = |> shouldSucceed |> withDiagnostics [ (Warning 9, Line 5, Col 9, Line 5, Col 12, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") - (Warning 9, Line 6, Col 15, Line 6, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") + (Warning 9, Line 6, Col 5, Line 6, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") ] [] @@ -209,7 +209,7 @@ module ExtendedFixedBindings = |> shouldSucceed |> withDiagnostics [ (Warning 9, Line 5, Col 9, Line 5, Col 12, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") - (Warning 9, Line 6, Col 15, Line 6, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") + (Warning 9, Line 6, Col 5, Line 6, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") ] [] @@ -222,7 +222,7 @@ module ExtendedFixedBindings = |> shouldSucceed |> withDiagnostics [ (Warning 9, Line 5, Col 9, Line 5, Col 12, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") - (Warning 9, Line 6, Col 15, Line 6, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") + (Warning 9, Line 6, Col 5, Line 6, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") ] [] @@ -237,7 +237,7 @@ module ExtendedFixedBindings = |> shouldSucceed |> withDiagnostics [ (Warning 9, Line 8, Col 13, Line 8, Col 16, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") - (Warning 9, Line 9, Col 19, Line 9, Col 22, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") + (Warning 9, Line 9, Col 9, Line 9, Col 22, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") ] [] @@ -250,7 +250,7 @@ module ExtendedFixedBindings = |> shouldSucceed |> withDiagnostics [ (Warning 9, Line 6, Col 9, Line 6, Col 12, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") - (Warning 9, Line 7, Col 15, Line 7, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") + (Warning 9, Line 7, Col 5, Line 7, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") ] #if NETCOREAPP @@ -264,7 +264,7 @@ module ExtendedFixedBindings = |> shouldSucceed |> withDiagnostics [ (Warning 9, Line 6, Col 9, Line 6, Col 12, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") - (Warning 9, Line 7, Col 15, Line 7, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") + (Warning 9, Line 7, Col 5, Line 7, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") ] #endif @@ -291,7 +291,7 @@ module ExtendedFixedBindings = |> shouldSucceed |> withDiagnostics [ (Warning 9, Line 9, Col 9, Line 9, Col 12, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") - (Warning 9, Line 10, Col 15, Line 10, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") + (Warning 9, Line 10, Col 5, Line 10, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") ] [] @@ -304,7 +304,7 @@ module ExtendedFixedBindings = |> shouldSucceed |> withDiagnostics [ (Warning 9, Line 9, Col 9, Line 9, Col 12, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") - (Warning 9, Line 10, Col 15, Line 10, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") + (Warning 9, Line 10, Col 5, Line 10, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") ] [] @@ -317,7 +317,7 @@ module ExtendedFixedBindings = |> shouldSucceed |> withDiagnostics [ (Warning 9, Line 13, Col 9, Line 13, Col 12, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") - (Warning 9, Line 14, Col 15, Line 14, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") + (Warning 9, Line 14, Col 5, Line 14, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") ] [] @@ -356,7 +356,7 @@ module ExtendedFixedBindings = |> shouldSucceed |> withDiagnostics [ (Warning 9, Line 11, Col 9, Line 11, Col 12, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") - (Warning 9, Line 12, Col 15, Line 12, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") + (Warning 9, Line 12, Col 5, Line 12, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") ] [] @@ -410,5 +410,5 @@ The type 'int' does not match the type 'char'") |> shouldFail |> withDiagnostics [ (Warning 9, Line 13, Col 9, Line 13, Col 12, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") - (Warning 9, Line 14, Col 15, Line 14, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") + (Warning 9, Line 14, Col 5, Line 14, Col 18, """Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.""") ] diff --git a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableCsharpImportTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableCsharpImportTests.fs index 6e801408101..d969afc538f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableCsharpImportTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableCsharpImportTests.fs @@ -106,10 +106,10 @@ let y:System.Collections.Generic.LinkedListNode = ll.First |> typeCheckWithStrictNullness |> shouldFail |> withDiagnostics - [ Error 3261, Line 4, Col 62, Line 4, Col 66, "Nullness warning: The types 'System.Collections.Generic.LinkedListNode' and 'System.Collections.Generic.LinkedListNode | null' do not have compatible nullability." - Error 3261, Line 4, Col 62, Line 4, Col 66, "Nullness warning: A non-nullable 'System.Collections.Generic.LinkedListNode' was expected but this expression is nullable. Consider either changing the target to also be nullable, or use pattern matching to safely handle the null case of this expression." - Error 3261, Line 5, Col 62, Line 5, Col 67, "Nullness warning: The types 'System.Collections.Generic.LinkedListNode' and 'System.Collections.Generic.LinkedListNode | null' do not have compatible nullability." - Error 3261, Line 5, Col 62, Line 5, Col 67, "Nullness warning: A non-nullable 'System.Collections.Generic.LinkedListNode' was expected but this expression is nullable. Consider either changing the target to also be nullable, or use pattern matching to safely handle the null case of this expression." ] + [ Error 3261, Line 4, Col 59, Line 4, Col 66, "Nullness warning: The types 'System.Collections.Generic.LinkedListNode' and 'System.Collections.Generic.LinkedListNode | null' do not have compatible nullability." + Error 3261, Line 4, Col 59, Line 4, Col 66, "Nullness warning: A non-nullable 'System.Collections.Generic.LinkedListNode' was expected but this expression is nullable. Consider either changing the target to also be nullable, or use pattern matching to safely handle the null case of this expression." + Error 3261, Line 5, Col 59, Line 5, Col 67, "Nullness warning: The types 'System.Collections.Generic.LinkedListNode' and 'System.Collections.Generic.LinkedListNode | null' do not have compatible nullability." + Error 3261, Line 5, Col 59, Line 5, Col 67, "Nullness warning: A non-nullable 'System.Collections.Generic.LinkedListNode' was expected but this expression is nullable. Consider either changing the target to also be nullable, or use pattern matching to safely handle the null case of this expression." ] [] let ``Nullable directory info show warn on prop access`` () = @@ -123,7 +123,7 @@ let s : string = d.Name // should warn here!! |> asLibrary |> typeCheckWithStrictNullness |> shouldFail - |> withDiagnostics [Error 3261, Line 6, Col 20, Line 6, Col 24, "Nullness warning: The types 'DirectoryInfo' and 'DirectoryInfo | null' do not have compatible nullability."] + |> withDiagnostics [Error 3261, Line 6, Col 18, Line 6, Col 24, "Nullness warning: The types 'DirectoryInfo' and 'DirectoryInfo | null' do not have compatible nullability."] [] let ``Consumption of netstandard2 BCL api which is not annotated`` () = @@ -220,7 +220,7 @@ let ``Consumption of nullable C# - no generics, just strings in methods and fiel |> withDiagnostics [ Error 3261, Line 5, Col 40, Line 5, Col 85, "Nullness warning: The types 'string' and 'string | null' do not have compatible nullability." Error 3261, Line 5, Col 40, Line 5, Col 85, "Nullness warning: A non-nullable 'string' was expected but this expression is nullable. Consider either changing the target to also be nullable, or use pattern matching to safely handle the null case of this expression." - Error 3261, Line 14, Col 48, Line 14, Col 62, "Nullness warning: A non-nullable 'string' was expected but this expression is nullable. Consider either changing the target to also be nullable, or use pattern matching to safely handle the null case of this expression." + Error 3261, Line 14, Col 34, Line 14, Col 62, "Nullness warning: A non-nullable 'string' was expected but this expression is nullable. Consider either changing the target to also be nullable, or use pattern matching to safely handle the null case of this expression." Error 3261, Line 16, Col 35, Line 16, Col 39, "Nullness warning: The type 'string' does not support 'null'." Error 3261, Line 25, Col 85, Line 25, Col 97, "Nullness warning: A non-nullable 'string' was expected but this expression is nullable. Consider either changing the target to also be nullable, or use pattern matching to safely handle the null case of this expression." Error 3261, Line 28, Col 99, Line 28, Col 111, "Nullness warning: A non-nullable 'string' was expected but this expression is nullable. Consider either changing the target to also be nullable, or use pattern matching to safely handle the null case of this expression." diff --git a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableReferenceTypesTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableReferenceTypesTests.fs index bd65a3fcff1..c45d73553e2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableReferenceTypesTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableReferenceTypesTests.fs @@ -67,7 +67,7 @@ let main _args = |> withDiagnostics [ Error 3265, Line 8, Col 13, Line 8, Col 60, "Application of method 'Deserialize' attempted to create a nullable type ('T | null) for '{| x: int |}'. Nullness warnings won't be reported correctly for such types." Error 3265, Line 11, Col 13, Line 11, Col 50, "Application of method 'Deserialize' attempted to create a nullable type ('T | null) for '{| x: int |}'. Nullness warnings won't be reported correctly for such types." - Error 3261, Line 15, Col 16, Line 15, Col 17, "Nullness warning: The types 'R' and 'R | null' do not have compatible nullability."] + Error 3261, Line 15, Col 14, Line 15, Col 17, "Nullness warning: The types 'R' and 'R | null' do not have compatible nullability."] [] let ``Report warning when generic type instance creates a null-disallowed type`` () = @@ -124,9 +124,9 @@ let parsedDate3 = DateTime.Parse(null) |> typeCheckWithStrictNullness |> shouldFail |> withDiagnostics - [Error 3261, Line 3, Col 27, Line 3, Col 32, "Nullness warning: The types 'string' and 'string | null' do not have compatible nullability." - Error 3261, Line 4, Col 42, Line 4, Col 47, "Nullness warning: The types 'string' and 'string | null' do not have compatible nullability." - Error 3261, Line 5, Col 28, Line 5, Col 33, "Nullness warning: The type 'string' does not support 'null'."] + [Error 3261, Line 3, Col 18, Line 3, Col 52, "Nullness warning: The types 'string' and 'string | null' do not have compatible nullability." + Error 3261, Line 4, Col 33, Line 4, Col 50, "Nullness warning: The types 'string' and 'string | null' do not have compatible nullability." + Error 3261, Line 5, Col 19, Line 5, Col 39, "Nullness warning: The type 'string' does not support 'null'."] [] let ``Downcasts and typetests with nullables``() = @@ -295,7 +295,7 @@ let getLength (x: string | null) = x.Length |> asLibrary |> typeCheckWithStrictNullness |> shouldFail - |> withDiagnostics [Error 3261, Line 3, Col 38, Line 3, Col 44, "Nullness warning: The types 'string' and 'string | null' do not have compatible nullability."] + |> withDiagnostics [Error 3261, Line 3, Col 36, Line 3, Col 44, "Nullness warning: The types 'string' and 'string | null' do not have compatible nullability."] [] let ``Does report warning on obj to static member`` () = @@ -318,13 +318,13 @@ Test.XString("x":(string|null)) |> shouldFail |> withDiagnostics [ Error 3261, Line 7, Col 8, Line 7, Col 9, "Nullness warning: The type 'obj | null' supports 'null' but a non-null type is expected." - Error 3261, Line 7, Col 6, Line 7, Col 7, "Nullness warning: The types 'obj' and 'obj | null' do not have compatible nullability." + Error 3261, Line 7, Col 1, Line 7, Col 9, "Nullness warning: The types 'obj' and 'obj | null' do not have compatible nullability." Error 3261, Line 8, Col 17, Line 8, Col 18, "Nullness warning: The type 'obj | null' supports 'null' but a non-null type is expected." - Error 3261, Line 8, Col 15, Line 8, Col 16, "Nullness warning: The types 'obj' and 'obj | null' do not have compatible nullability." + Error 3261, Line 8, Col 10, Line 8, Col 19, "Nullness warning: The types 'obj' and 'obj | null' do not have compatible nullability." Error 3261, Line 9, Col 8, Line 9, Col 23, "Nullness warning: The type 'obj | null' supports 'null' but a non-null type is expected." - Error 3261, Line 9, Col 6, Line 9, Col 7, "Nullness warning: The types 'obj' and 'obj | null' do not have compatible nullability." + Error 3261, Line 9, Col 1, Line 9, Col 24, "Nullness warning: The types 'obj' and 'obj | null' do not have compatible nullability." Error 3261, Line 11, Col 6, Line 11, Col 7, "Nullness warning: The type 'obj | null' supports 'null' but a non-null type is expected." - Error 3261, Line 11, Col 3, Line 11, Col 5, "Nullness warning: The types 'obj' and 'obj | null' do not have compatible nullability." + Error 3261, Line 11, Col 1, Line 11, Col 8, "Nullness warning: The types 'obj' and 'obj | null' do not have compatible nullability." Error 3261, Line 12, Col 14, Line 12, Col 18, "Nullness warning: The type 'string' does not support 'null'." Error 3261, Line 13, Col 14, Line 13, Col 31, "Nullness warning: A non-nullable 'string' was expected but this expression is nullable. Consider either changing the target to also be nullable, or use pattern matching to safely handle the null case of this expression."] @@ -1072,7 +1072,7 @@ myNullReturningFunction myValOfY |> ignore |> shouldFail |> withDiagnostics [Error 3261, Line 17, Col 25, Line 17, Col 34, "Nullness warning: The type 'string' does not support 'null'." - Error 193, Line 19, Col 42, Line 19, Col 45, "The type 'System.DateTime' does not have 'null' as a proper value" + Error 193, Line 19, Col 26, Line 19, Col 45, "The type 'System.DateTime' does not have 'null' as a proper value" Error 1, Line 20, Col 25, Line 20, Col 36, "The type '{| Anon: 'a |}' does not have 'null' as a proper value" Error 1, Line 21, Col 26, Line 21, Col 31, "The type ''a * 'b * 'c' does not have 'null' as a proper value" Error 1, Line 23, Col 25, Line 23, Col 33, "The type 'Y' does not have 'null' as a proper value"] @@ -1335,7 +1335,7 @@ let bar = foo |> Option.ofObj // Should produce FS3262, but did not |> asLibrary |> typeCheckWithStrictNullness |> shouldFail - |> withDiagnostics [Error 3262, Line 4, Col 25, Line 4, Col 30, "Value known to be without null passed to a function meant for nullables: You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value."] + |> withDiagnostics [Error 3262, Line 4, Col 18, Line 4, Col 30, "Value known to be without null passed to a function meant for nullables: You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value."] [] let ``Useless null check when used in multi piping`` () = @@ -1347,7 +1347,7 @@ let myFunc whateverArg = |> asLibrary |> typeCheckWithStrictNullness |> shouldFail - |> withDiagnostics [Error 3262, Line 4, Col 37, Line 4, Col 42, "Value known to be without null passed to a function meant for nullables: You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value."] + |> withDiagnostics [Error 3262, Line 4, Col 30, Line 4, Col 42, "Value known to be without null passed to a function meant for nullables: You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value."] [] let ``Useless null check when used in more exotic pipes`` () = @@ -1362,9 +1362,9 @@ let pointfree = intToint >> string >> Option.ofObj |> typeCheckWithStrictNullness |> shouldFail |> withDiagnostics - [ Error 3262, Line 3, Col 52, Line 3, Col 57, "Value known to be without null passed to a function meant for nullables: You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value." + [ Error 3262, Line 3, Col 45, Line 3, Col 57, "Value known to be without null passed to a function meant for nullables: You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value." Error 3262, Line 4, Col 60, Line 4, Col 61, "Value known to be without null passed to a function meant for nullables: You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value." - Error 3262, Line 6, Col 46, Line 6, Col 51, "Value known to be without null passed to a function meant for nullables: You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value."] + Error 3262, Line 6, Col 39, Line 6, Col 51, "Value known to be without null passed to a function meant for nullables: You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value."] [] let ``Regression: Useless usage in nested calls`` () = @@ -1813,7 +1813,7 @@ let ``Type extension not null constraint rejects nullable type arg at call site` |> typeCheckWithStrictNullness |> shouldFail |> withDiagnostics [ - Error 3261, Line 8, Col 55, Line 8, Col 60, "Nullness warning: The type 'string | null' supports 'null' but a non-null type is expected." + Error 3261, Line 8, Col 47, Line 8, Col 60, "Nullness warning: The type 'string | null' supports 'null' but a non-null type is expected." ] [] @@ -2061,8 +2061,8 @@ let processMyStr (x:mystring) = |> typeCheckWithStrictNullness |> shouldFail |> withDiagnostics [ - Error 3261, Line 12, Col 29, Line 12, Col 37, "Nullness warning: The types 'string' and 'string | null' do not have compatible nullability." - Error 3261, Line 12, Col 29, Line 12, Col 37, "Nullness warning: A non-nullable 'string' was expected but this expression is nullable. Consider either changing the target to also be nullable, or use pattern matching to safely handle the null case of this expression." + Error 3261, Line 12, Col 27, Line 12, Col 39, "Nullness warning: The types 'string' and 'string | null' do not have compatible nullability." + Error 3261, Line 12, Col 27, Line 12, Col 39, "Nullness warning: A non-nullable 'string' was expected but this expression is nullable. Consider either changing the target to also be nullable, or use pattern matching to safely handle the null case of this expression." ] [] @@ -2218,8 +2218,8 @@ let processObj (x:obj) = |> typeCheckWithStrictNullness |> shouldFail |> withDiagnostics [ - Error 3261, Line 6, Col 29, Line 6, Col 37, "Nullness warning: The types 'string' and 'string | null' do not have compatible nullability." - Error 3261, Line 6, Col 29, Line 6, Col 37, "Nullness warning: A non-nullable 'string' was expected but this expression is nullable. Consider either changing the target to also be nullable, or use pattern matching to safely handle the null case of this expression." + Error 3261, Line 6, Col 27, Line 6, Col 39, "Nullness warning: The types 'string' and 'string | null' do not have compatible nullability." + Error 3261, Line 6, Col 27, Line 6, Col 39, "Nullness warning: A non-nullable 'string' was expected but this expression is nullable. Consider either changing the target to also be nullable, or use pattern matching to safely handle the null case of this expression." ] [] @@ -2372,7 +2372,7 @@ let test () = consumeNonNull (MyClass.Create()) |> typeCheckWithStrictNullness |> shouldFail |> withDiagnostics [ - Error 3261, Line 9, Col 39, Line 9, Col 45, "Nullness warning: The type 'MyClass' supports 'null' but a non-null type is expected." + Error 3261, Line 9, Col 31, Line 9, Col 47, "Nullness warning: The type 'MyClass' supports 'null' but a non-null type is expected." ] [] diff --git a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableRegressionTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableRegressionTests.fs index 64c6151bdf3..a7ff6c2e89b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableRegressionTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableRegressionTests.fs @@ -42,7 +42,7 @@ let ``Signature conformance`` langVersion checknulls = |> compile |> shouldFail |> withDiagnostics - [Warning 3262, Line 18, Col 55, Line 18, Col 60, "Value known to be without null passed to a function meant for nullables: You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value." + [Warning 3262, Line 18, Col 48, Line 18, Col 60, "Value known to be without null passed to a function meant for nullables: You can create 'Some value' directly instead of 'ofObj', or consider not using an option for this value." (Warning 3261, Line 4, Col 5, Line 4, Col 10, "Nullness warning: Module 'M' contains val test2: x: (string | null) -> unit but its signature specifies diff --git a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/using-nullness-syntax-positive.fs.checknulls_on.err.bsl b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/using-nullness-syntax-positive.fs.checknulls_on.err.bsl index fb3bb92816a..aa8325df86b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/using-nullness-syntax-positive.fs.checknulls_on.err.bsl +++ b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/using-nullness-syntax-positive.fs.checknulls_on.err.bsl @@ -5,27 +5,27 @@ using-nullness-syntax-positive.fs (17,15)-(17,19) typecheck error Nullness warni using-nullness-syntax-positive.fs (18,15)-(18,19) typecheck error Nullness warning: The type 'String | null' supports 'null' but a non-null type is expected. using-nullness-syntax-positive.fs (19,15)-(19,21) typecheck error Nullness warning: The type 'int option' uses 'null' as a representation value but a non-null type is expected. using-nullness-syntax-positive.fs (27,14)-(27,17) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. -using-nullness-syntax-positive.fs (27,16)-(27,17) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. +using-nullness-syntax-positive.fs (27,14)-(27,17) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. +using-nullness-syntax-positive.fs (28,14)-(28,19) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. using-nullness-syntax-positive.fs (28,14)-(28,19) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. -using-nullness-syntax-positive.fs (28,16)-(28,17) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. using-nullness-syntax-positive.fs (29,14)-(29,17) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. -using-nullness-syntax-positive.fs (29,16)-(29,17) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. +using-nullness-syntax-positive.fs (29,14)-(29,17) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. using-nullness-syntax-positive.fs (43,26)-(43,30) typecheck error Nullness warning: The type 'String' does not support 'null'. using-nullness-syntax-positive.fs (85,63)-(85,70) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. -using-nullness-syntax-positive.fs (85,65)-(85,70) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. +using-nullness-syntax-positive.fs (85,63)-(85,70) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. +using-nullness-syntax-positive.fs (86,81)-(86,90) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. using-nullness-syntax-positive.fs (86,81)-(86,90) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. -using-nullness-syntax-positive.fs (86,85)-(86,90) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. using-nullness-syntax-positive.fs (86,92)-(86,102) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. -using-nullness-syntax-positive.fs (86,97)-(86,102) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. +using-nullness-syntax-positive.fs (86,92)-(86,102) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. +using-nullness-syntax-positive.fs (91,53)-(91,60) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. using-nullness-syntax-positive.fs (91,53)-(91,60) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. -using-nullness-syntax-positive.fs (91,55)-(91,60) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. using-nullness-syntax-positive.fs (92,72)-(92,81) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. -using-nullness-syntax-positive.fs (92,76)-(92,81) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. +using-nullness-syntax-positive.fs (92,72)-(92,81) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. +using-nullness-syntax-positive.fs (92,83)-(92,93) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. using-nullness-syntax-positive.fs (92,83)-(92,93) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. -using-nullness-syntax-positive.fs (92,88)-(92,93) typecheck error Nullness warning: The types 'C' and 'C | null' do not have compatible nullability. using-nullness-syntax-positive.fs (120,32)-(120,36) typecheck error Nullness warning: The type 'obj array' does not support 'null'. -using-nullness-syntax-positive.fs (129,19)-(129,28) typecheck error Nullness warning: The type 'String' does not support 'null'. -using-nullness-syntax-positive.fs (134,20)-(134,29) typecheck error Nullness warning: The type 'String' does not support 'null'. +using-nullness-syntax-positive.fs (129,4)-(129,34) typecheck error Nullness warning: The type 'String' does not support 'null'. +using-nullness-syntax-positive.fs (134,5)-(134,44) typecheck error Nullness warning: The type 'String' does not support 'null'. using-nullness-syntax-positive.fs (144,39)-(144,43) typecheck error Nullness warning: The type 'String' does not support 'null'. using-nullness-syntax-positive.fs (154,40)-(154,44) typecheck error Nullness warning: The type 'string' does not support 'null'. using-nullness-syntax-positive.fs (159,36)-(159,40) typecheck error Nullness warning: The type 'String' does not support 'null'. diff --git a/tests/FSharp.Compiler.ComponentTests/Language/ObsoleteAttributeCheckingTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/ObsoleteAttributeCheckingTests.fs index f5f9be3a179..b6efad6eea6 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/ObsoleteAttributeCheckingTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/ObsoleteAttributeCheckingTests.fs @@ -889,7 +889,7 @@ type ButtonExtensions = |> compile |> shouldFail |> withDiagnostics [ - (Error 101, Line 17, Col 16, Line 17, Col 19, "This construct is deprecated. Use B instead") + (Error 101, Line 17, Col 9, Line 17, Col 19, "This construct is deprecated. Use B instead") ] [] diff --git a/tests/fsharp/Compiler/Language/StringInterpolation.fs b/tests/fsharp/Compiler/Language/StringInterpolation.fs index e4f96546203..eade5119a44 100644 --- a/tests/fsharp/Compiler/Language/StringInterpolation.fs +++ b/tests/fsharp/Compiler/Language/StringInterpolation.fs @@ -636,7 +636,7 @@ let xe = $"%A{{1}}" // fake expression (delimiters escaped) """ CompilerAssert.TypeCheckWithErrorsAndOptions [| "--langversion:8.0" |] code - [|(FSharpDiagnosticSeverity.Error, 1, (2, 33, 2, 38), + [|(FSharpDiagnosticSeverity.Error, 1, (2, 19, 2, 38), "The type 'string' is not compatible with any of the types byte,int16,int32,int64,sbyte,uint16,uint32,uint64,nativeint,unativeint, arising from the use of a printf-style format string"); (FSharpDiagnosticSeverity.Error, 1, (3, 19, 3, 20), """This expression was expected to have type diff --git a/tests/fsharp/Compiler/Libraries/Core/NativeInterop/StackallocTests.fs b/tests/fsharp/Compiler/Libraries/Core/NativeInterop/StackallocTests.fs index e9fbacb389b..b01da9cd01e 100644 --- a/tests/fsharp/Compiler/Libraries/Core/NativeInterop/StackallocTests.fs +++ b/tests/fsharp/Compiler/Libraries/Core/NativeInterop/StackallocTests.fs @@ -69,7 +69,7 @@ let _ = NativeInterop.NativePtr.stackalloc 1 """ FSharpDiagnosticSeverity.Error 1 - (4, 33, 4, 43) + (4, 9, 4, 43) "A generic construct requires that the type 'System.Object' is an unmanaged type" [] @@ -82,7 +82,7 @@ let _ = NativeInterop.NativePtr.stackalloc 1 """ FSharpDiagnosticSeverity.Error 1 - (4, 33, 4, 43) + (4, 9, 4, 43) "A generic construct requires that the type 'System.Collections.IEnumerable' is an unmanaged type" [] @@ -95,7 +95,7 @@ let _ = NativeInterop.NativePtr.stackalloc 1 """ FSharpDiagnosticSeverity.Error 1 - (4, 33, 4, 43) + (4, 9, 4, 43) "A generic construct requires that the type 'System.EventHandler' is an unmanaged type" [] @@ -149,7 +149,7 @@ let _ = NativeInterop.NativePtr.stackalloc 1 """ FSharpDiagnosticSeverity.Error 1 - (10, 33, 10, 43) + (10, 9, 10, 43) "A generic construct requires that the type 'C' is an unmanaged type" [] @@ -164,7 +164,7 @@ let _ = NativeInterop.NativePtr.stackalloc 1 """ FSharpDiagnosticSeverity.Error 1 - (6, 33, 6, 43) + (6, 9, 6, 43) "A generic construct requires that the type 'R' is an unmanaged type" [] diff --git a/tests/fsharp/core/auto-widen/preview/test.bsl b/tests/fsharp/core/auto-widen/preview/test.bsl index 49696054a20..c17dc66908f 100644 --- a/tests/fsharp/core/auto-widen/preview/test.bsl +++ b/tests/fsharp/core/auto-widen/preview/test.bsl @@ -1,7 +1,7 @@ test.fsx(11,20,11,21): typecheck error FS3388: This expression implicitly converts type 'int' to type 'obj'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(14,33,14,41): typecheck error FS3388: This expression implicitly converts type 'int' to type 'obj'. See https://aka.ms/fsharp-implicit-convs. +test.fsx(14,20,14,41): typecheck error FS3388: This expression implicitly converts type 'int' to type 'obj'. See https://aka.ms/fsharp-implicit-convs. test.fsx(20,21,20,24): typecheck error FS3388: This expression implicitly converts type 'int * int' to type 'obj'. See https://aka.ms/fsharp-implicit-convs. @@ -65,17 +65,17 @@ test.fsx(61,32,61,33): typecheck error FS3389: This expression uses a built-in i test.fsx(61,32,61,33): typecheck error FS3388: This expression implicitly converts type 'int' to type 'float'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(63,35,63,43): typecheck error FS3389: This expression uses a built-in implicit conversion to convert type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. +test.fsx(63,22,63,43): typecheck error FS3389: This expression uses a built-in implicit conversion to convert type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(63,35,63,43): typecheck error FS3388: This expression implicitly converts type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. +test.fsx(63,22,63,43): typecheck error FS3388: This expression implicitly converts type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(64,41,64,49): typecheck error FS3389: This expression uses a built-in implicit conversion to convert type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. +test.fsx(64,28,64,49): typecheck error FS3389: This expression uses a built-in implicit conversion to convert type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(64,41,64,49): typecheck error FS3388: This expression implicitly converts type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. +test.fsx(64,28,64,49): typecheck error FS3388: This expression implicitly converts type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(64,63,64,71): typecheck error FS3389: This expression uses a built-in implicit conversion to convert type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. +test.fsx(64,50,64,71): typecheck error FS3389: This expression uses a built-in implicit conversion to convert type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(64,63,64,71): typecheck error FS3388: This expression implicitly converts type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. +test.fsx(64,50,64,71): typecheck error FS3388: This expression implicitly converts type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. test.fsx(67,20,67,23): typecheck error FS3388: This expression implicitly converts type 'int' to type 'obj'. See https://aka.ms/fsharp-implicit-convs. @@ -251,7 +251,7 @@ test.fsx(258,30,258,38): typecheck error FS3388: This expression implicitly conv test.fsx(260,36,260,38): typecheck error FS3388: This expression implicitly converts type 'Numerics.BigInteger' to type 'IComparable'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(263,58,263,63): typecheck error FS3388: This expression implicitly converts type 'string' to type 'IComparable'. See https://aka.ms/fsharp-implicit-convs. +test.fsx(263,44,263,63): typecheck error FS3388: This expression implicitly converts type 'string' to type 'IComparable'. See https://aka.ms/fsharp-implicit-convs. test.fsx(275,35,275,36): typecheck error FS3388: This expression implicitly converts type 'int' to type 'obj'. See https://aka.ms/fsharp-implicit-convs. diff --git a/tests/fsharp/core/quotesDebugInfo/test.fsx b/tests/fsharp/core/quotesDebugInfo/test.fsx index 201b1b1609c..e2bdcd55ce3 100644 --- a/tests/fsharp/core/quotesDebugInfo/test.fsx +++ b/tests/fsharp/core/quotesDebugInfo/test.fsx @@ -463,7 +463,7 @@ let f : FSharpFunc`2 = in [DebugRange(452:12 - 452:36)] <{ [DebugRange(452:12 - 452:13)] <{ f }>( - [DebugRange(452:24 - 452:33)] <{ DefaultOf ( + [DebugRange(452:14 - 452:33)] <{ DefaultOf ( ) }> ) diff --git a/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetInvokerExpression_Exception.bsl b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetInvokerExpression_Exception.bsl index d6c05ca27a6..711a55cb552 100644 --- a/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetInvokerExpression_Exception.bsl +++ b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetInvokerExpression_Exception.bsl @@ -1,2 +1,2 @@ -EVIL_PROVIDER_GetInvokerExpression_Exception.fsx(7,77,7,80): typecheck error FS3033: The type provider 'Provider.EvilProviderWhereApplyGetInvokerExpressionRaisesException' reported an error in the context of provided type 'FSharp.EvilProviderWhereGetInvokerExpressionRaisesException.TheType', member 'get_Foo'. The error: deliberate error for testing purposes +EVIL_PROVIDER_GetInvokerExpression_Exception.fsx(7,9,7,80): typecheck error FS3033: The type provider 'Provider.EvilProviderWhereApplyGetInvokerExpressionRaisesException' reported an error in the context of provided type 'FSharp.EvilProviderWhereGetInvokerExpressionRaisesException.TheType', member 'get_Foo'. The error: deliberate error for testing purposes diff --git a/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetInvokerExpression_Null.bsl b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetInvokerExpression_Null.bsl index ef4ffbef3ec..b2fc037734e 100644 --- a/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetInvokerExpression_Null.bsl +++ b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetInvokerExpression_Null.bsl @@ -1,2 +1,2 @@ -EVIL_PROVIDER_GetInvokerExpression_Null.fsx(7,73,7,76): typecheck error FS3056: Type provider 'Provider.EvilProviderWhereApplyGetInvokerExpressionReturnsNull' returned null from GetInvokerExpression. +EVIL_PROVIDER_GetInvokerExpression_Null.fsx(7,9,7,76): typecheck error FS3056: Type provider 'Provider.EvilProviderWhereApplyGetInvokerExpressionReturnsNull' returned null from GetInvokerExpression. diff --git a/tests/fsharp/typeProviders/negTests/InvalidInvokerExpression.bsl b/tests/fsharp/typeProviders/negTests/InvalidInvokerExpression.bsl index 4e3f4637650..1806dc3960b 100644 --- a/tests/fsharp/typeProviders/negTests/InvalidInvokerExpression.bsl +++ b/tests/fsharp/typeProviders/negTests/InvalidInvokerExpression.bsl @@ -1,2 +1,2 @@ -InvalidInvokerExpression.fsx(4,58,4,79): typecheck error FS3056: Type provider 'Provider.GoodProviderForNegativeTypeTests1' returned null from GetInvokerExpression. +InvalidInvokerExpression.fsx(4,9,4,79): typecheck error FS3056: Type provider 'Provider.GoodProviderForNegativeTypeTests1' returned null from GetInvokerExpression. diff --git a/tests/fsharp/typeProviders/negTests/neg1.bsl b/tests/fsharp/typeProviders/negTests/neg1.bsl index d6d6ed366a2..f4442e42b83 100644 --- a/tests/fsharp/typeProviders/negTests/neg1.bsl +++ b/tests/fsharp/typeProviders/negTests/neg1.bsl @@ -1,5 +1,5 @@ -neg1.fsx(3,67,3,70): typecheck error FS0193: Type constraint mismatch. The type +neg1.fsx(3,18,3,70): typecheck error FS0193: Type constraint mismatch. The type 'int' is not compatible with type 'string' diff --git a/tests/fsharp/typecheck/sigs/neg10.bsl b/tests/fsharp/typecheck/sigs/neg10.bsl index 6a25f9107a2..1a0f32e060c 100644 --- a/tests/fsharp/typecheck/sigs/neg10.bsl +++ b/tests/fsharp/typecheck/sigs/neg10.bsl @@ -122,29 +122,29 @@ neg10.fs(245,50,245,51): typecheck error FS0193: A type parameter is missing a c neg10.fs(245,17,245,20): typecheck error FS0043: A type parameter is missing a constraint 'when 'b :> C' -neg10.fs(251,59,251,61): typecheck error FS0001: The type ''a -> 'a' does not support the 'equality' constraint because it is a function type +neg10.fs(251,49,251,61): typecheck error FS0001: The type ''a -> 'a' does not support the 'equality' constraint because it is a function type -neg10.fs(252,55,252,57): typecheck error FS0001: The type ''a -> 'a' does not support the 'comparison' constraint. For example, it does not support the 'System.IComparable' interface +neg10.fs(252,45,252,57): typecheck error FS0001: The type ''a -> 'a' does not support the 'comparison' constraint. For example, it does not support the 'System.IComparable' interface -neg10.fs(253,46,253,48): typecheck error FS0001: The type ''a -> 'a' does not support the 'equality' constraint because it is a function type +neg10.fs(253,36,253,48): typecheck error FS0001: The type ''a -> 'a' does not support the 'equality' constraint because it is a function type neg10.fs(297,22,297,24): typecheck error FS1187: An indexer property must be given at least one argument neg10.fs(298,22,298,24): typecheck error FS1187: An indexer property must be given at least one argument -neg10.fs(299,22,299,24): typecheck error FS0807: Property 'S2' is not readable +neg10.fs(299,17,299,24): typecheck error FS0807: Property 'S2' is not readable -neg10.fs(300,22,300,24): typecheck error FS0807: Property 'S3' is not readable +neg10.fs(300,17,300,24): typecheck error FS0807: Property 'S3' is not readable -neg10.fs(301,22,301,24): typecheck error FS0807: Property 'S4' is not readable +neg10.fs(301,17,301,24): typecheck error FS0807: Property 'S4' is not readable -neg10.fs(303,19,303,22): typecheck error FS0807: Property 'SS2' is not readable +neg10.fs(303,17,303,22): typecheck error FS0807: Property 'SS2' is not readable -neg10.fs(304,19,304,22): typecheck error FS0807: Property 'SS3' is not readable +neg10.fs(304,17,304,22): typecheck error FS0807: Property 'SS3' is not readable -neg10.fs(305,19,305,22): typecheck error FS0807: Property 'SS4' is not readable +neg10.fs(305,17,305,22): typecheck error FS0807: Property 'SS4' is not readable -neg10.fs(316,27,316,28): typecheck error FS0807: Property 'X' is not readable +neg10.fs(316,17,316,28): typecheck error FS0807: Property 'X' is not readable neg10.fs(324,28,324,29): typecheck error FS1187: An indexer property must be given at least one argument diff --git a/tests/fsharp/typecheck/sigs/neg15.bsl b/tests/fsharp/typecheck/sigs/neg15.bsl index 3961d631255..e82c0042d11 100644 --- a/tests/fsharp/typecheck/sigs/neg15.bsl +++ b/tests/fsharp/typecheck/sigs/neg15.bsl @@ -1,13 +1,13 @@ -neg15.fs(102,19,102,31): typecheck error FS1094: The value 'privateValue' is not accessible from this code location +neg15.fs(102,17,102,31): typecheck error FS1094: The value 'privateValue' is not accessible from this code location -neg15.fs(103,20,103,43): typecheck error FS1092: The type 'PrivateUnionType' is not accessible from this code location +neg15.fs(103,18,103,43): typecheck error FS1092: The type 'PrivateUnionType' is not accessible from this code location -neg15.fs(106,20,106,66): typecheck error FS1093: The union cases or fields of the type 'UnionTypeWithPrivateRepresentation' are not accessible from this code location +neg15.fs(106,18,106,66): typecheck error FS1093: The union cases or fields of the type 'UnionTypeWithPrivateRepresentation' are not accessible from this code location neg15.fs(107,17,107,41): typecheck error FS0491: The member or object constructor 'PrivateProperty' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. -neg15.fs(108,24,108,45): typecheck error FS0491: The member or object constructor 'PrivateStaticProperty' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. +neg15.fs(108,17,108,45): typecheck error FS0491: The member or object constructor 'PrivateStaticProperty' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. neg15.fs(109,17,109,41): typecheck error FS0491: The member or object constructor 'PrivateMethod' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. @@ -45,17 +45,17 @@ neg15.fs(183,1,183,5): typecheck error FS0491: The member or object constructor neg15.fs(184,1,184,7): typecheck error FS0491: The member or object constructor 'M' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. -neg15.fs(185,3,185,5): typecheck error FS0491: The member or object constructor 'SP' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. +neg15.fs(185,1,185,5): typecheck error FS0491: The member or object constructor 'SP' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. neg15.fs(186,1,186,7): typecheck error FS0491: The member or object constructor 'SM' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. -neg15.fs(187,5,187,6): typecheck error FS1096: The record, struct or class field 'f' is not accessible from this code location +neg15.fs(187,1,187,6): typecheck error FS1096: The record, struct or class field 'f' is not accessible from this code location neg15.fs(188,1,188,6): typecheck error FS0491: The member or object constructor 'P' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. neg15.fs(189,1,189,8): typecheck error FS0491: The member or object constructor 'M' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. -neg15.fs(190,4,190,6): typecheck error FS0491: The member or object constructor 'SP' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. +neg15.fs(190,1,190,6): typecheck error FS0491: The member or object constructor 'SP' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. neg15.fs(191,1,191,8): typecheck error FS0491: The member or object constructor 'SM' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. diff --git a/tests/fsharp/typecheck/sigs/neg17.bsl b/tests/fsharp/typecheck/sigs/neg17.bsl index 189617a26ae..c09ddb99bb8 100644 --- a/tests/fsharp/typecheck/sigs/neg17.bsl +++ b/tests/fsharp/typecheck/sigs/neg17.bsl @@ -1,9 +1,9 @@ neg17.fs(84,17,84,33): typecheck error FS0292: The type definitions for type 'PrivateUnionType' in the signature and implementation are not compatible because the accessibility specified in the signature is more than that specified in the implementation -neg17b.fs(7,19,7,31): typecheck error FS1094: The value 'privateValue' is not accessible from this code location +neg17b.fs(7,17,7,31): typecheck error FS1094: The value 'privateValue' is not accessible from this code location -neg17b.fs(8,20,8,43): typecheck error FS1092: The type 'PrivateUnionType' is not accessible from this code location +neg17b.fs(8,18,8,43): typecheck error FS1092: The type 'PrivateUnionType' is not accessible from this code location neg17b.fs(11,26,11,41): typecheck error FS0039: The type 'Type' does not define a field, constructor, or member named 'PrivateProperty'. diff --git a/tests/fsharp/typecheck/sigs/neg37_a.bsl b/tests/fsharp/typecheck/sigs/neg37_a.bsl index 3e255b8e5d3..b1657dda675 100644 --- a/tests/fsharp/typecheck/sigs/neg37_a.bsl +++ b/tests/fsharp/typecheck/sigs/neg37_a.bsl @@ -1,2 +1,2 @@ -neg37_a.fs(7,38,7,41): typecheck error FS3068: The function or member 'Bar' is used in a way that requires further type annotations at its definition to ensure consistency of inferred types. The inferred signature is 'static member BBB.Bar: ('T -> unit)'. +neg37_a.fs(7,26,7,41): typecheck error FS3068: The function or member 'Bar' is used in a way that requires further type annotations at its definition to ensure consistency of inferred types. The inferred signature is 'static member BBB.Bar: ('T -> unit)'. diff --git a/tests/fsharp/typecheck/sigs/neg56_a.bsl b/tests/fsharp/typecheck/sigs/neg56_a.bsl index 696fbe5e7cb..7d477679f7b 100644 --- a/tests/fsharp/typecheck/sigs/neg56_a.bsl +++ b/tests/fsharp/typecheck/sigs/neg56_a.bsl @@ -1,4 +1,4 @@ neg56_a.fs(11,35,11,47): typecheck error FS1125: The instantiation of the generic type 'list1' is missing and can't be inferred from the arguments or return type of this member. Consider providing a type instantiation when accessing this type, e.g. 'list1<_>'. -neg56_a.fs(15,27,15,33): typecheck error FS3068: The function or member 'toList' is used in a way that requires further type annotations at its definition to ensure consistency of inferred types. The inferred signature is 'static member private list1.toList: ('a list1 -> 'a list)'. +neg56_a.fs(15,18,15,33): typecheck error FS3068: The function or member 'toList' is used in a way that requires further type annotations at its definition to ensure consistency of inferred types. The inferred signature is 'static member private list1.toList: ('a list1 -> 'a list)'. diff --git a/tests/fsharp/typecheck/sigs/neg56_b.bsl b/tests/fsharp/typecheck/sigs/neg56_b.bsl index ad0570908cc..4e844fe5979 100644 --- a/tests/fsharp/typecheck/sigs/neg56_b.bsl +++ b/tests/fsharp/typecheck/sigs/neg56_b.bsl @@ -3,6 +3,6 @@ neg56_b.fs(8,36,8,39): typecheck error FS3068: The function or member 'Inf' is u neg56_b.fs(15,37,15,40): typecheck error FS3068: The function or member 'Inf' is used in a way that requires further type annotations at its definition to ensure consistency of inferred types. The inferred signature is 'static member Foo2.Inf: 'T ref'. -neg56_b.fs(26,20,26,23): typecheck error FS3068: The function or member 'Inf' is used in a way that requires further type annotations at its definition to ensure consistency of inferred types. The inferred signature is 'static member private Foo.Inf: ('T list -> 'T list)'. +neg56_b.fs(26,13,26,23): typecheck error FS3068: The function or member 'Inf' is used in a way that requires further type annotations at its definition to ensure consistency of inferred types. The inferred signature is 'static member private Foo.Inf: ('T list -> 'T list)'. -neg56_b.fs(36,20,36,23): typecheck error FS3068: The function or member 'Foo' is used in a way that requires further type annotations at its definition to ensure consistency of inferred types. The inferred signature is 'static member private Qux.Foo: ('T list -> 'T list)'. +neg56_b.fs(36,13,36,23): typecheck error FS3068: The function or member 'Foo' is used in a way that requires further type annotations at its definition to ensure consistency of inferred types. The inferred signature is 'static member private Qux.Foo: ('T list -> 'T list)'. diff --git a/tests/fsharp/typecheck/sigs/neg90.bsl b/tests/fsharp/typecheck/sigs/neg90.bsl index 7fc5ba3ede1..d04c6f2b059 100644 --- a/tests/fsharp/typecheck/sigs/neg90.bsl +++ b/tests/fsharp/typecheck/sigs/neg90.bsl @@ -3,6 +3,6 @@ neg90.fs(4,9,4,12): typecheck error FS0001: A generic construct requires that th neg90.fs(7,22,7,25): typecheck error FS0039: The type 'foo' is not defined. -neg90.fs(16,15,16,21): typecheck error FS0035: This construct is deprecated: The union type for union case 'Member' was defined with the RequireQualifiedAccessAttribute. Include the name of the union type ('DU') in the name you are using. +neg90.fs(16,9,16,21): typecheck error FS0035: This construct is deprecated: The union type for union case 'Member' was defined with the RequireQualifiedAccessAttribute. Include the name of the union type ('DU') in the name you are using. neg90.fs(28,9,28,41): typecheck error FS0035: This construct is deprecated: The record type for the record field 'Field1' was defined with the RequireQualifiedAccessAttribute. Include the name of the record type ('Record1') in the name you are using. diff --git a/tests/fsharp/typecheck/sigs/neg91.bsl b/tests/fsharp/typecheck/sigs/neg91.bsl index 7ac51180563..8cb3e21f836 100644 --- a/tests/fsharp/typecheck/sigs/neg91.bsl +++ b/tests/fsharp/typecheck/sigs/neg91.bsl @@ -3,13 +3,13 @@ neg91.fs(7,9,7,30): typecheck error FS0896: Enumerations cannot have members neg91.fs(10,10,10,15): typecheck error FS0956: Members that extend interface, delegate or enum types must be placed in a module separate to the definition of the type. This module must either have the AutoOpen attribute or be opened explicitly by client code to bring the extension members into scope. -neg91.fs(24,15,24,16): typecheck error FS1094: The value 'x' is not accessible from this code location +neg91.fs(24,13,24,16): typecheck error FS1094: The value 'x' is not accessible from this code location -neg91.fs(34,15,34,16): typecheck error FS0044: This construct is deprecated. Don't touch me +neg91.fs(34,13,34,16): typecheck error FS0044: This construct is deprecated. Don't touch me -neg91.fs(44,15,44,16): typecheck error FS3003: Don't touch me +neg91.fs(44,13,44,16): typecheck error FS3003: Don't touch me -neg91.fs(54,15,54,16): typecheck error FS0057: This construct is experimental. It was just an experiment!. This warning can be disabled using '--nowarn:57' or '#nowarn "57"'. +neg91.fs(54,13,54,16): typecheck error FS0057: This construct is experimental. It was just an experiment!. This warning can be disabled using '--nowarn:57' or '#nowarn "57"'. neg91.fs(63,11,63,27): typecheck error FS3191: This literal pattern does not take arguments diff --git a/tests/fsharp/typecheck/sigs/neg_byref_3.bsl b/tests/fsharp/typecheck/sigs/neg_byref_3.bsl index 01c5e23d3bd..549f4e523a4 100644 --- a/tests/fsharp/typecheck/sigs/neg_byref_3.bsl +++ b/tests/fsharp/typecheck/sigs/neg_byref_3.bsl @@ -3,8 +3,8 @@ neg_byref_3.fs(2,5,2,8): typecheck error FS0431: A byref typed value would be st neg_byref_3.fs(2,5,2,8): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL. -neg_byref_3.fs(2,16,2,22): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL. +neg_byref_3.fs(2,11,2,22): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL. neg_byref_3.fs(3,5,3,6): typecheck error FS3301: The function or method has an invalid return type 'byref list -> int'. This is not permitted by the rules of Common IL. -neg_byref_3.fs(3,16,3,22): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL. +neg_byref_3.fs(3,11,3,22): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL. diff --git a/tests/fsharp/typecheck/sigs/neg_byref_4.bsl b/tests/fsharp/typecheck/sigs/neg_byref_4.bsl index 50539092e90..2fdf027ea71 100644 --- a/tests/fsharp/typecheck/sigs/neg_byref_4.bsl +++ b/tests/fsharp/typecheck/sigs/neg_byref_4.bsl @@ -1,4 +1,4 @@ -neg_byref_4.fs(4,27,4,29): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL. +neg_byref_4.fs(4,11,4,29): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL. -neg_byref_4.fs(5,27,5,29): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL. +neg_byref_4.fs(5,11,5,29): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL. From d383666f3be50d0cc52bf2a049425477b65b80b7 Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Tue, 2 Jun 2026 12:31:03 +0200 Subject: [PATCH 5/7] Narrow remaining diagnostic ranges and restore context comments - CheckRecdFieldMutation in static field path: mItem -> mItemIdent (parity with instance path) - nonStandardEventError in TcEventItemThen: mItem -> mItemIdent (parity with sibling event diagnostics) - Restore section comments in TcLookupItemThen for scanability Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/Compiler/Checking/Expressions/CheckExpressions.fs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Compiler/Checking/Expressions/CheckExpressions.fs b/src/Compiler/Checking/Expressions/CheckExpressions.fs index c8455669efe..841c2c3b9c5 100644 --- a/src/Compiler/Checking/Expressions/CheckExpressions.fs +++ b/src/Compiler/Checking/Expressions/CheckExpressions.fs @@ -9679,6 +9679,7 @@ and TcILFieldItemThen cenv overallTy env finfo tpenv mItem mItemIdent delayed = PropagateThenTcDelayed cenv overallTy env tpenv mItem exprFlex exprTy ExprAtomicFlag.Atomic delayed +// Get static F# field or literal and TcRecdFieldItemThen cenv overallTy env rfinfo tpenv mItem mItemIdent delayed = let g = cenv.g let ad = env.eAccessRights @@ -9692,7 +9693,7 @@ and TcRecdFieldItemThen cenv overallTy env rfinfo tpenv mItem mItemIdent delayed if not (isNil otherDelayed) then error(Error(FSComp.SR.tcInvalidAssignment(), mStmt)) // Set static F# field - CheckRecdFieldMutation mItem env.DisplayEnv rfinfo + CheckRecdFieldMutation mItemIdent env.DisplayEnv rfinfo UnifyTypes cenv env mStmt overallTy.Commit g.unit_ty let fieldTy = rfinfo.FieldType // Always allow subsumption on assignment to fields @@ -9837,6 +9838,7 @@ and TcLookupItemThen cenv overallTy env tpenv mObjExpr objExpr objExprTy delayed TcMethodApplicationThen cenv env overallTy None tpenv tyArgsOpt objArgs mExprAndItem mItemIdent nm ad PossiblyMutates true meths afterResolution NormalValUse args atomicFlag None delayed | Item.RecdField rfinfo -> + // Get or set instance F# field or literal RecdFieldInstanceChecks g cenv.amap ad mItemIdent rfinfo let tgtTy = rfinfo.DeclaringType let boxity = isStructTy g tgtTy @@ -9872,6 +9874,7 @@ and TcLookupItemThen cenv overallTy env tpenv mObjExpr objExpr objExprTy delayed PropagateThenTcDelayed cenv overallTy env tpenv mExprAndItem (MakeApplicableExprWithFlex cenv env objExpr') fieldTy ExprAtomicFlag.Atomic delayed | Item.ILField finfo -> + // Get or set instance IL field ILFieldInstanceChecks g cenv.amap ad mItemIdent finfo let exprTy = finfo.FieldType(cenv.amap, mItem) @@ -9888,6 +9891,7 @@ and TcLookupItemThen cenv overallTy env tpenv mObjExpr objExpr objExprTy delayed PropagateThenTcDelayed cenv overallTy env tpenv mExprAndItem (MakeApplicableExprWithFlex cenv env expr) exprTy ExprAtomicFlag.Atomic delayed | Item.Event einfo -> + // Instance IL event (fake up event-as-value) TcEventItemThen cenv overallTy env tpenv mItem mItemIdent mExprAndItem (Some(objExpr, objExprTy)) einfo delayed | Item.Trait traitInfo -> @@ -9946,7 +9950,7 @@ and TcEventItemThen (cenv: cenv) overallTy env tpenv mItem mItemIdent mExprAndIt // This checks for and drops the 'object' sender let argsTy = ArgsTypeOfEventInfo cenv.infoReader mItem ad einfo - if not (slotSigHasVoidReturnTy (delInvokeMeth.GetSlotSig(cenv.amap, mItem))) then errorR (nonStandardEventError einfo.EventName mItem) + if not (slotSigHasVoidReturnTy (delInvokeMeth.GetSlotSig(cenv.amap, mItem))) then errorR (nonStandardEventError einfo.EventName mItemIdent) let delEventTy = mkIEventType g delTy argsTy let bindObjArgs f = From bc4ed5a2629a39b169b391a1afc5ecd29daeec73 Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Tue, 2 Jun 2026 12:40:14 +0200 Subject: [PATCH 6/7] Round 2 cleanup: consistent naming and restored test comments - Rename mDiag -> mItemIdent in ApplyUnionCaseOrExn for naming consistency - Add clarifying comment at m m call site in TcUnionCaseOrExnField - Restore explanatory comments for duplicate diagnostics in OverloadResolutionErrorRangeTests Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../Checking/Expressions/CheckExpressions.fs | 17 +++++++++-------- .../OverloadResolutionErrorRangeTests.fs | 4 ++++ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/Compiler/Checking/Expressions/CheckExpressions.fs b/src/Compiler/Checking/Expressions/CheckExpressions.fs index 841c2c3b9c5..e0478dac679 100644 --- a/src/Compiler/Checking/Expressions/CheckExpressions.fs +++ b/src/Compiler/Checking/Expressions/CheckExpressions.fs @@ -2054,28 +2054,28 @@ let BuildFieldMap (cenv: cenv) env isPartial ty (flds: ((Ident list * Ident) * ' | _ -> error(Error(FSComp.SR.tcRecordFieldInconsistentTypes(), m))) Some(tinst, tcref, fldsmap, List.rev rfldsList) -let ApplyUnionCaseOrExn (makerForUnionCase, makerForExnTag) m mDiag (cenv: cenv) env overallTy item = +let ApplyUnionCaseOrExn (makerForUnionCase, makerForExnTag) m mItemIdent (cenv: cenv) env overallTy item = let g = cenv.g let ad = env.eAccessRights match item with | Item.ExnCase ecref -> - CheckEntityAttributes g ecref mDiag |> CommitOperationResult + CheckEntityAttributes g ecref mItemIdent |> CommitOperationResult UnifyTypes cenv env m overallTy g.exn_ty - CheckTyconAccessible cenv.amap mDiag ad ecref |> ignore + CheckTyconAccessible cenv.amap mItemIdent ad ecref |> ignore let mkf = makerForExnTag ecref mkf, recdFieldTysOfExnDefRef ecref, [ for f in (recdFieldsOfExnDefRef ecref) -> f.Id ] | Item.UnionCase(ucinfo, showDeprecated) -> if showDeprecated then - let diagnostic = Deprecated(FSComp.SR.nrUnionTypeNeedsQualifiedAccess(ucinfo.DisplayName, ucinfo.Tycon.DisplayName) |> snd, mDiag) + let diagnostic = Deprecated(FSComp.SR.nrUnionTypeNeedsQualifiedAccess(ucinfo.DisplayName, ucinfo.Tycon.DisplayName) |> snd, mItemIdent) if g.langVersion.SupportsFeature(LanguageFeature.ErrorOnDeprecatedRequireQualifiedAccess) then errorR(diagnostic) else warning(diagnostic) let ucref = ucinfo.UnionCaseRef - CheckUnionCaseAttributes g ucref mDiag |> CommitOperationResult - CheckUnionCaseAccessible cenv.amap mDiag ad ucref |> ignore + CheckUnionCaseAttributes g ucref mItemIdent |> CommitOperationResult + CheckUnionCaseAccessible cenv.amap mItemIdent ad ucref |> ignore let resTy = actualResultTyOfUnionCase ucinfo.TypeInst ucref let inst = mkTyparInst ucref.TyconRef.TyparsNoRange ucinfo.TypeInst UnifyTypes cenv env m overallTy resTy @@ -2083,9 +2083,9 @@ let ApplyUnionCaseOrExn (makerForUnionCase, makerForExnTag) m mDiag (cenv: cenv) mkf, actualTysOfUnionCaseFields inst ucref, [ for f in ucref.AllFieldsAsList -> f.Id ] | _ -> invalidArg "item" "not a union case or exception reference" -let ApplyUnionCaseOrExnTypes m mDiag (cenv: cenv) env overallTy c = +let ApplyUnionCaseOrExnTypes m mItemIdent (cenv: cenv) env overallTy c = ApplyUnionCaseOrExn ((fun (a, b) mArgs args -> mkUnionCaseExpr(a, b, args, unionRanges m mArgs)), - (fun a mArgs args -> mkExnExpr (a, args, unionRanges m mArgs))) m mDiag cenv env overallTy c + (fun a mArgs args -> mkExnExpr (a, args, unionRanges m mArgs))) m mItemIdent cenv env overallTy c let UnionCaseOrExnCheck (env: TcEnv) numArgTys numArgs m = if numArgs <> numArgTys then error (UnionCaseWrongArguments(env.DisplayEnv, numArgTys, numArgs, m)) @@ -2096,6 +2096,7 @@ let TcUnionCaseOrExnField (cenv: cenv) (env: TcEnv) ty1 m longId fieldNum funcs let mkf, argTys, _argNames = match ResolvePatternLongIdent cenv.tcSink cenv.nameResolver AllIdsOK false m ad env.eNameResEnv TypeNameResolutionInfo.Default longId ExtraDotAfterIdentifier.No with | Item.UnionCase _ | Item.ExnCase _ as item -> + // mItemIdent = m: pattern context has no separate terminal-ident range ApplyUnionCaseOrExn funcs m m cenv env ty1 item | _ -> error(Error(FSComp.SR.tcUnknownUnion(), m)) diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/OverloadResolutionErrorRangeTests.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/OverloadResolutionErrorRangeTests.fs index 3f0dbf9095c..57f286a8cf3 100644 --- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/OverloadResolutionErrorRangeTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/OverloadResolutionErrorRangeTests.fs @@ -224,7 +224,9 @@ T.Instance.OldMethod() |> shouldFail |> withDiagnostics [ + // Narrowed to terminal ident "OldMethod" via mItemIdent (Warning 44, Line 8, Col 12, Line 8, Col 21, "This construct is deprecated. old method") + // Pre-existing duplicate from name-resolution attribute check (whole application range) (Warning 44, Line 8, Col 1, Line 8, Col 23, "This construct is deprecated. old method") ] @@ -243,7 +245,9 @@ M.Svc.OldMethod() |> shouldFail |> withDiagnostics [ + // Narrowed to terminal ident "OldMethod" via mItemIdent (Warning 44, Line 7, Col 7, Line 7, Col 16, "This construct is deprecated. use NewMethod instead") + // Pre-existing duplicate from name-resolution attribute check (whole application range) (Warning 44, Line 7, Col 1, Line 7, Col 18, "This construct is deprecated. use NewMethod instead") ] From cd98e635ba977c438247055a8f4427785d56dc52 Mon Sep 17 00:00:00 2001 From: Copilot Date: Wed, 3 Jun 2026 12:55:27 +0200 Subject: [PATCH 7/7] Update Desktop test baselines for narrowed diagnostic ranges The fsharp suite migrated tests (neg10, neg15, neg17, neg90, neg91) use .bsl baselines that were not updated for the narrowed mItemIdent ranges. - neg10: Property 'not readable' diagnostics now point at property name - neg15: Union case/field access errors point at terminal identifier - neg17: Union case type accessibility error points at case name - neg90: RequireQualifiedAccess deprecation points at case name - neg91: Value accessibility/obsolete errors on assignment point at value Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- tests/fsharp/typecheck/sigs/neg10.bsl | 14 +++++++------- tests/fsharp/typecheck/sigs/neg15.bsl | 6 +++--- tests/fsharp/typecheck/sigs/neg17.bsl | 2 +- tests/fsharp/typecheck/sigs/neg90.bsl | 2 +- tests/fsharp/typecheck/sigs/neg91.bsl | 8 ++++---- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/tests/fsharp/typecheck/sigs/neg10.bsl b/tests/fsharp/typecheck/sigs/neg10.bsl index 1a0f32e060c..3db874c5aef 100644 --- a/tests/fsharp/typecheck/sigs/neg10.bsl +++ b/tests/fsharp/typecheck/sigs/neg10.bsl @@ -132,19 +132,19 @@ neg10.fs(297,22,297,24): typecheck error FS1187: An indexer property must be giv neg10.fs(298,22,298,24): typecheck error FS1187: An indexer property must be given at least one argument -neg10.fs(299,17,299,24): typecheck error FS0807: Property 'S2' is not readable +neg10.fs(299,22,299,24): typecheck error FS0807: Property 'S2' is not readable -neg10.fs(300,17,300,24): typecheck error FS0807: Property 'S3' is not readable +neg10.fs(300,22,300,24): typecheck error FS0807: Property 'S3' is not readable -neg10.fs(301,17,301,24): typecheck error FS0807: Property 'S4' is not readable +neg10.fs(301,22,301,24): typecheck error FS0807: Property 'S4' is not readable -neg10.fs(303,17,303,22): typecheck error FS0807: Property 'SS2' is not readable +neg10.fs(303,19,303,22): typecheck error FS0807: Property 'SS2' is not readable -neg10.fs(304,17,304,22): typecheck error FS0807: Property 'SS3' is not readable +neg10.fs(304,19,304,22): typecheck error FS0807: Property 'SS3' is not readable -neg10.fs(305,17,305,22): typecheck error FS0807: Property 'SS4' is not readable +neg10.fs(305,19,305,22): typecheck error FS0807: Property 'SS4' is not readable -neg10.fs(316,17,316,28): typecheck error FS0807: Property 'X' is not readable +neg10.fs(316,27,316,28): typecheck error FS0807: Property 'X' is not readable neg10.fs(324,28,324,29): typecheck error FS1187: An indexer property must be given at least one argument diff --git a/tests/fsharp/typecheck/sigs/neg15.bsl b/tests/fsharp/typecheck/sigs/neg15.bsl index e82c0042d11..3c6fa8ff9ec 100644 --- a/tests/fsharp/typecheck/sigs/neg15.bsl +++ b/tests/fsharp/typecheck/sigs/neg15.bsl @@ -1,9 +1,9 @@ neg15.fs(102,17,102,31): typecheck error FS1094: The value 'privateValue' is not accessible from this code location -neg15.fs(103,18,103,43): typecheck error FS1092: The type 'PrivateUnionType' is not accessible from this code location +neg15.fs(103,20,103,43): typecheck error FS1092: The type 'PrivateUnionType' is not accessible from this code location -neg15.fs(106,18,106,66): typecheck error FS1093: The union cases or fields of the type 'UnionTypeWithPrivateRepresentation' are not accessible from this code location +neg15.fs(106,20,106,66): typecheck error FS1093: The union cases or fields of the type 'UnionTypeWithPrivateRepresentation' are not accessible from this code location neg15.fs(107,17,107,41): typecheck error FS0491: The member or object constructor 'PrivateProperty' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. @@ -49,7 +49,7 @@ neg15.fs(185,1,185,5): typecheck error FS0491: The member or object constructor neg15.fs(186,1,186,7): typecheck error FS0491: The member or object constructor 'SM' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. -neg15.fs(187,1,187,6): typecheck error FS1096: The record, struct or class field 'f' is not accessible from this code location +neg15.fs(187,5,187,6): typecheck error FS1096: The record, struct or class field 'f' is not accessible from this code location neg15.fs(188,1,188,6): typecheck error FS0491: The member or object constructor 'P' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. diff --git a/tests/fsharp/typecheck/sigs/neg17.bsl b/tests/fsharp/typecheck/sigs/neg17.bsl index c09ddb99bb8..7974d02dc2e 100644 --- a/tests/fsharp/typecheck/sigs/neg17.bsl +++ b/tests/fsharp/typecheck/sigs/neg17.bsl @@ -3,7 +3,7 @@ neg17.fs(84,17,84,33): typecheck error FS0292: The type definitions for type 'Pr neg17b.fs(7,17,7,31): typecheck error FS1094: The value 'privateValue' is not accessible from this code location -neg17b.fs(8,18,8,43): typecheck error FS1092: The type 'PrivateUnionType' is not accessible from this code location +neg17b.fs(8,20,8,43): typecheck error FS1092: The type 'PrivateUnionType' is not accessible from this code location neg17b.fs(11,26,11,41): typecheck error FS0039: The type 'Type' does not define a field, constructor, or member named 'PrivateProperty'. diff --git a/tests/fsharp/typecheck/sigs/neg90.bsl b/tests/fsharp/typecheck/sigs/neg90.bsl index d04c6f2b059..7fc5ba3ede1 100644 --- a/tests/fsharp/typecheck/sigs/neg90.bsl +++ b/tests/fsharp/typecheck/sigs/neg90.bsl @@ -3,6 +3,6 @@ neg90.fs(4,9,4,12): typecheck error FS0001: A generic construct requires that th neg90.fs(7,22,7,25): typecheck error FS0039: The type 'foo' is not defined. -neg90.fs(16,9,16,21): typecheck error FS0035: This construct is deprecated: The union type for union case 'Member' was defined with the RequireQualifiedAccessAttribute. Include the name of the union type ('DU') in the name you are using. +neg90.fs(16,15,16,21): typecheck error FS0035: This construct is deprecated: The union type for union case 'Member' was defined with the RequireQualifiedAccessAttribute. Include the name of the union type ('DU') in the name you are using. neg90.fs(28,9,28,41): typecheck error FS0035: This construct is deprecated: The record type for the record field 'Field1' was defined with the RequireQualifiedAccessAttribute. Include the name of the record type ('Record1') in the name you are using. diff --git a/tests/fsharp/typecheck/sigs/neg91.bsl b/tests/fsharp/typecheck/sigs/neg91.bsl index 8cb3e21f836..7ac51180563 100644 --- a/tests/fsharp/typecheck/sigs/neg91.bsl +++ b/tests/fsharp/typecheck/sigs/neg91.bsl @@ -3,13 +3,13 @@ neg91.fs(7,9,7,30): typecheck error FS0896: Enumerations cannot have members neg91.fs(10,10,10,15): typecheck error FS0956: Members that extend interface, delegate or enum types must be placed in a module separate to the definition of the type. This module must either have the AutoOpen attribute or be opened explicitly by client code to bring the extension members into scope. -neg91.fs(24,13,24,16): typecheck error FS1094: The value 'x' is not accessible from this code location +neg91.fs(24,15,24,16): typecheck error FS1094: The value 'x' is not accessible from this code location -neg91.fs(34,13,34,16): typecheck error FS0044: This construct is deprecated. Don't touch me +neg91.fs(34,15,34,16): typecheck error FS0044: This construct is deprecated. Don't touch me -neg91.fs(44,13,44,16): typecheck error FS3003: Don't touch me +neg91.fs(44,15,44,16): typecheck error FS3003: Don't touch me -neg91.fs(54,13,54,16): typecheck error FS0057: This construct is experimental. It was just an experiment!. This warning can be disabled using '--nowarn:57' or '#nowarn "57"'. +neg91.fs(54,15,54,16): typecheck error FS0057: This construct is experimental. It was just an experiment!. This warning can be disabled using '--nowarn:57' or '#nowarn "57"'. neg91.fs(63,11,63,27): typecheck error FS3191: This literal pattern does not take arguments