diff --git a/docs/release-notes/.FSharp.Compiler.Service/9.0.100.md b/docs/release-notes/.FSharp.Compiler.Service/9.0.100.md index a9ef9b621af..22eee3e2e5b 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/9.0.100.md +++ b/docs/release-notes/.FSharp.Compiler.Service/9.0.100.md @@ -16,6 +16,7 @@ * Add missing byte chars notations, enforce limits in decimal notation in byte char & string (Issues [#15867](https://github.com/dotnet/fsharp/issues/15867), [#15868](https://github.com/dotnet/fsharp/issues/15868), [#15869](https://github.com/dotnet/fsharp/issues/15869), [PR #15898](https://github.com/dotnet/fsharp/pull/15898)) * Parentheses analysis: keep extra parentheses around unit & tuples in method definitions. ([PR #17618](https://github.com/dotnet/fsharp/pull/17618)) * Fix IsUnionCaseTester throwing for non-methods/properties [#17301](https://github.com/dotnet/fsharp/pull/17634) +* Fix xmlc doc tooltip display for nullable types [#17741](https://github.com/dotnet/fsharp/pull/17741) * Consider `open type` used when the type is an enum and any of the enum cases is used unqualified. ([PR #17628](https://github.com/dotnet/fsharp/pull/17628)) * Guard for possible StackOverflowException when typechecking non recursive modules and namespaces ([PR #17654](https://github.com/dotnet/fsharp/pull/17654)) * Nullable - fix for processing System.Nullable types with nesting ([PR #17736](https://github.com/dotnet/fsharp/pull/17736)) @@ -36,6 +37,8 @@ * Enable LanguageFeature.EnforceAttributeTargets in F# 9.0. ([Issue #17514](https://github.com/dotnet/fsharp/issues/17558), [PR #17516](https://github.com/dotnet/fsharp/pull/17558)) * Parser: better recovery for unfinished patterns ([PR #17231](https://github.com/dotnet/fsharp/pull/17231), [PR #17232](https://github.com/dotnet/fsharp/pull/17232))) * Enable consuming generic arguments defined as `allows ref struct` in C# ([Issue #17597](https://github.com/dotnet/fsharp/issues/17597) +* Trivia for SynTypeConstraint.WhereTyparNotSupportsNull. ([Issue #17721](https://github.com/dotnet/fsharp/issues/17721), [PR #17745](https://github.com/dotnet/fsharp/pull/17745)) +* Trivia for SynType.WithNull. ([Issue #17720](https://github.com/dotnet/fsharp/issues/17720), [PR #17745](https://github.com/dotnet/fsharp/pull/17745)) ### Changed diff --git a/src/Compiler/Checking/CheckDeclarations.fs b/src/Compiler/Checking/CheckDeclarations.fs index 96d3bb2b28d..e739169ea9c 100644 --- a/src/Compiler/Checking/CheckDeclarations.fs +++ b/src/Compiler/Checking/CheckDeclarations.fs @@ -431,7 +431,7 @@ module TcRecdUnionAndEnumDeclarations = let TcFieldDecl (cenv: cenv) env parent isIncrClass tpenv (isStatic, synAttrs, id: Ident, nameGenerated, ty, isMutable, xmldoc, vis) = let g = cenv.g let m = id.idRange - let attrs, _ = TcAttributesWithPossibleTargets false cenv env AttributeTargets.FieldDecl synAttrs + let attrs, _ = TcAttributesWithPossibleTargets TcCanFail.ReportAllErrors cenv env AttributeTargets.FieldDecl synAttrs let attrsForProperty, attrsForField = attrs |> List.partition (fun (attrTargets, _) -> (attrTargets &&& AttributeTargets.Property) <> enum 0) let attrsForProperty = (List.map snd attrsForProperty) @@ -455,7 +455,7 @@ module TcRecdUnionAndEnumDeclarations = match parent with | Parent tcref when useGenuineField tcref.Deref rfspec -> // Recheck the attributes for errors if the definition only generates a field - TcAttributesWithPossibleTargets false cenv env AttributeTargets.FieldDeclRestricted synAttrs |> ignore + TcAttributesWithPossibleTargets TcCanFail.ReportAllErrors cenv env AttributeTargets.FieldDeclRestricted synAttrs |> ignore | _ -> () rfspec @@ -2909,9 +2909,9 @@ module EstablishTypeDefinitionCores = if reportAttributeTargetsErrors then if hasStructAttr then - TcAttributesWithPossibleTargets false cenv envinner AttributeTargets.Struct synAttrs |> ignore + TcAttributesWithPossibleTargets TcCanFail.IgnoreMemberResoutionError cenv envinner AttributeTargets.Struct synAttrs |> ignore else - TcAttributesWithPossibleTargets false cenv envinner AttributeTargets.Class synAttrs |> ignore + TcAttributesWithPossibleTargets TcCanFail.IgnoreMemberResoutionError cenv envinner AttributeTargets.Class synAttrs |> ignore // Note: the table of union cases is initially empty Construct.MakeUnionRepr [] @@ -2934,9 +2934,9 @@ module EstablishTypeDefinitionCores = if reportAttributeTargetsErrors then if hasStructAttr then - TcAttributesWithPossibleTargets false cenv envinner AttributeTargets.Struct synAttrs |> ignore + TcAttributesWithPossibleTargets TcCanFail.IgnoreMemberResoutionError cenv envinner AttributeTargets.Struct synAttrs |> ignore else - TcAttributesWithPossibleTargets false cenv envinner AttributeTargets.Class synAttrs |> ignore + TcAttributesWithPossibleTargets TcCanFail.IgnoreMemberResoutionError cenv envinner AttributeTargets.Class synAttrs |> ignore // Note: the table of record fields is initially empty TFSharpTyconRepr (Construct.NewEmptyFSharpTyconData TFSharpRecord) @@ -2952,19 +2952,19 @@ module EstablishTypeDefinitionCores = match kind with | SynTypeDefnKind.Class -> if reportAttributeTargetsErrors then - TcAttributesWithPossibleTargets false cenv envinner AttributeTargets.Class synAttrs |> ignore + TcAttributesWithPossibleTargets TcCanFail.IgnoreMemberResoutionError cenv envinner AttributeTargets.Class synAttrs |> ignore TFSharpClass | SynTypeDefnKind.Interface -> if reportAttributeTargetsErrors then - TcAttributesWithPossibleTargets false cenv envinner AttributeTargets.Interface synAttrs |> ignore + TcAttributesWithPossibleTargets TcCanFail.IgnoreMemberResoutionError cenv envinner AttributeTargets.Interface synAttrs |> ignore TFSharpInterface | SynTypeDefnKind.Delegate _ -> if reportAttributeTargetsErrors then - TcAttributesWithPossibleTargets false cenv envinner AttributeTargets.Delegate synAttrs |> ignore + TcAttributesWithPossibleTargets TcCanFail.IgnoreMemberResoutionError cenv envinner AttributeTargets.Delegate synAttrs |> ignore TFSharpDelegate (MakeSlotSig("Invoke", g.unit_ty, [], [], [], None)) | SynTypeDefnKind.Struct -> if reportAttributeTargetsErrors then - TcAttributesWithPossibleTargets false cenv envinner AttributeTargets.Struct synAttrs |> ignore + TcAttributesWithPossibleTargets TcCanFail.IgnoreMemberResoutionError cenv envinner AttributeTargets.Struct synAttrs |> ignore TFSharpStruct | _ -> error(InternalError("should have inferred tycon kind", m)) @@ -2973,7 +2973,7 @@ module EstablishTypeDefinitionCores = | SynTypeDefnSimpleRepr.Enum _ -> noCLIMutableAttributeCheck() if reportAttributeTargetsErrors then - TcAttributesWithPossibleTargets false cenv envinner AttributeTargets.Enum synAttrs |> ignore + TcAttributesWithPossibleTargets TcCanFail.IgnoreMemberResoutionError cenv envinner AttributeTargets.Enum synAttrs |> ignore TFSharpTyconRepr (Construct.NewEmptyFSharpTyconData TFSharpEnum) // OK, now fill in the (partially computed) type representation @@ -4035,7 +4035,7 @@ module EstablishTypeDefinitionCores = // Phase 1B. Establish the kind of each type constructor // Here we run InferTyconKind and record partial information about the kind of the type constructor. // This means FSharpTyconKind is set, which means isSealedTy, isInterfaceTy etc. give accurate results. - let withAttrs = + let withAttrs = (envMutRecPrelim, withEnvs) ||> MutRecShapes.mapTyconsWithEnv (fun envForDecls (origInfo, tyconOpt) -> let res = match origInfo, tyconOpt with @@ -5202,7 +5202,7 @@ let TcModuleOrNamespaceElementsMutRec (cenv: cenv) parent typeNames m envInitial let mutRecDefnsChecked, envAfter = TcDeclarations.TcMutRecDefinitions cenv envInitial parent typeNames tpenv m scopem mutRecNSInfo mutRecDefns true // Check the assembly attributes - let attrs, _ = TcAttributesWithPossibleTargets false cenv envAfter AttributeTargets.Top synAttrs + let attrs, _ = TcAttributesWithPossibleTargets TcCanFail.ReportAllErrors cenv envAfter AttributeTargets.Top synAttrs // Check the non-escaping condition as we build the list of module expressions on the way back up let moduleContents = TcMutRecDefsFinish cenv mutRecDefnsChecked m @@ -5279,7 +5279,7 @@ let rec TcModuleOrNamespaceElementNonMutRec (cenv: cenv) parent typeNames scopem return! failwith "unreachable" | SynModuleDecl.Attributes (Attributes synAttrs, _) -> - let attrs, _ = TcAttributesWithPossibleTargets false cenv env AttributeTargets.Top synAttrs + let attrs, _ = TcAttributesWithPossibleTargets TcCanFail.ReportAllErrors cenv env AttributeTargets.Top synAttrs return ([], [], attrs), env, env | SynModuleDecl.HashDirective _ -> diff --git a/src/Compiler/Checking/Expressions/CheckExpressions.fs b/src/Compiler/Checking/Expressions/CheckExpressions.fs index a3cee51a48d..615e4251893 100644 --- a/src/Compiler/Checking/Expressions/CheckExpressions.fs +++ b/src/Compiler/Checking/Expressions/CheckExpressions.fs @@ -1010,6 +1010,13 @@ let TranslatePartialValReprInfo tps (PrelimValReprInfo (argsData, retData)) = // Members //------------------------------------------------------------------------- + +[] +type TcCanFail = + | IgnoreMemberResoutionError + | IgnoreAllErrors + | ReportAllErrors + let TcAddNullnessToType (warn: bool) (cenv: cenv) (env: TcEnv) nullness innerTyC m = let g = cenv.g if g.langFeatureNullness then @@ -4028,7 +4035,7 @@ let rec TcTyparConstraint ridx (cenv: cenv) newOk checkConstraints occ (env: TcE | SynTypeConstraint.WhereTyparSupportsNull(tp, m) -> TcSimpleTyparConstraint cenv env newOk tpenv tp m AddCxTypeUseSupportsNull - | SynTypeConstraint.WhereTyparNotSupportsNull(tp, m) -> + | SynTypeConstraint.WhereTyparNotSupportsNull(tp, m, _) -> if g.langFeatureNullness then TcSimpleTyparConstraint cenv env newOk tpenv tp m AddCxTypeDefnNotSupportsNull else @@ -4472,7 +4479,7 @@ and TcTypeOrMeasure kindOpt (cenv: cenv) newOk checkConstraints occ (iwsam: Warn errorR(Error(FSComp.SR.parsInvalidLiteralInType(), m)) NewErrorType (), tpenv - | SynType.WithNull(innerTy, ambivalent, m) -> + | SynType.WithNull(innerTy, ambivalent, m, _) -> let innerTyC, tpenv = TcTypeAndRecover cenv newOk checkConstraints occ WarnOnIWSAM.Yes env tpenv innerTy let nullness = if ambivalent then KnownAmbivalentToNull else KnownWithNull let tyWithNull = TcAddNullnessToType false cenv env nullness innerTyC m @@ -10869,7 +10876,7 @@ and TcNormalizedBinding declKind (cenv: cenv) env tpenv overallTy safeThisValOpt // For all but attributes positioned at the return value, disallow implicitly // targeting the return value. let tgtEx = if isRet then enum 0 else AttributeTargets.ReturnValue - let attrs, _ = TcAttributesMaybeFailEx false cenv envinner tgt tgtEx attrs + let attrs, _ = TcAttributesMaybeFailEx TcCanFail.ReportAllErrors cenv envinner tgt tgtEx attrs let attrs: Attrib list = attrs if attrTgt = enum 0 && not (isNil attrs) then for attr in attrs do @@ -11131,7 +11138,7 @@ and TcAttributeTargetsOnLetBindings (cenv: cenv) env attrs overallPatTy overallE else AttributeTargets.ReturnValue ||| AttributeTargets.Field ||| AttributeTargets.Property - TcAttributesWithPossibleTargets false cenv env attrTgt attrs |> ignore + TcAttributesWithPossibleTargets TcCanFail.ReportAllErrors cenv env attrTgt attrs |> ignore and TcLiteral (cenv: cenv) overallTy env tpenv (attrs, synLiteralValExpr) = @@ -11291,7 +11298,7 @@ and TcAttributeEx canFail (cenv: cenv) (env: TcEnv) attrTgt attrEx (synAttr: Syn error(Error(FSComp.SR.tcAttributeIsNotValidForLanguageElement(), mAttr)) match ResolveObjectConstructor cenv.nameResolver env.DisplayEnv mAttr ad ty with - | Exception _ when canFail -> [ ], true + | Exception _ when canFail = TcCanFail.IgnoreAllErrors || canFail = TcCanFail.IgnoreMemberResoutionError -> [ ], true | res -> let item = ForceRaise res @@ -11396,11 +11403,11 @@ and TcAttributesMaybeFail canFail cenv env attrTgt synAttribs = TcAttributesMaybeFailEx canFail cenv env attrTgt (enum 0) synAttribs and TcAttributesCanFail cenv env attrTgt synAttribs = - let attrs, didFail = TcAttributesMaybeFail true cenv env attrTgt synAttribs + let attrs, didFail = TcAttributesMaybeFail TcCanFail.IgnoreAllErrors cenv env attrTgt synAttribs attrs, (fun () -> if didFail then TcAttributes cenv env attrTgt synAttribs else attrs) and TcAttributes cenv env attrTgt synAttribs = - TcAttributesMaybeFail false cenv env attrTgt synAttribs |> fst + TcAttributesMaybeFail TcCanFail.ReportAllErrors cenv env attrTgt synAttribs |> fst //------------------------------------------------------------------------- // TcLetBinding diff --git a/src/Compiler/Checking/Expressions/CheckExpressions.fsi b/src/Compiler/Checking/Expressions/CheckExpressions.fsi index 6612194d1a5..cccb19f8abf 100644 --- a/src/Compiler/Checking/Expressions/CheckExpressions.fsi +++ b/src/Compiler/Checking/Expressions/CheckExpressions.fsi @@ -345,6 +345,12 @@ type PostSpecialValsRecursiveBinding = { ValScheme: ValScheme Binding: Binding } +[] +type TcCanFail = + | IgnoreMemberResoutionError + | IgnoreAllErrors + | ReportAllErrors + /// Represents a recursive binding after it has been both checked and generalized, but /// before initialization recursion has been rewritten type PreInitializationGraphEliminationBinding = @@ -598,7 +604,7 @@ val TcAttributesCanFail: /// Check a set of attributes which can only target specific elements val TcAttributesWithPossibleTargets: - canFail: bool -> + canFail: TcCanFail -> cenv: TcFileState -> env: TcEnv -> attrTgt: AttributeTargets -> diff --git a/src/Compiler/Service/ServiceParseTreeWalk.fs b/src/Compiler/Service/ServiceParseTreeWalk.fs index 621d89e4cca..e0957fe0140 100644 --- a/src/Compiler/Service/ServiceParseTreeWalk.fs +++ b/src/Compiler/Service/ServiceParseTreeWalk.fs @@ -838,7 +838,7 @@ module SyntaxTraversal = | SynType.Fun(argType = ty1; returnType = ty2) -> [ ty1; ty2 ] |> List.tryPick (traverseSynType path) | SynType.MeasurePower(ty, _, _) | SynType.HashConstraint(ty, _) - | SynType.WithNull(ty, _, _) + | SynType.WithNull(innerType = ty) | SynType.WithGlobalConstraints(ty, _, _) | SynType.Array(_, ty, _) -> traverseSynType path ty | SynType.StaticConstantNamed(ty1, ty2, _) diff --git a/src/Compiler/Service/ServiceParsedInputOps.fs b/src/Compiler/Service/ServiceParsedInputOps.fs index 64e7f282b33..0b3f0134545 100644 --- a/src/Compiler/Service/ServiceParsedInputOps.fs +++ b/src/Compiler/Service/ServiceParsedInputOps.fs @@ -647,7 +647,7 @@ module ParsedInput = | SynTypeConstraint.WhereTyparIsReferenceType(t, _) -> walkTypar t | SynTypeConstraint.WhereTyparIsUnmanaged(t, _) -> walkTypar t | SynTypeConstraint.WhereTyparSupportsNull(t, _) -> walkTypar t - | SynTypeConstraint.WhereTyparNotSupportsNull(t, _) -> walkTypar t + | SynTypeConstraint.WhereTyparNotSupportsNull(genericName = t) -> walkTypar t | SynTypeConstraint.WhereTyparIsComparable(t, _) -> walkTypar t | SynTypeConstraint.WhereTyparIsEquatable(t, _) -> walkTypar t | SynTypeConstraint.WhereTyparSubtypeOfType(t, ty, _) -> walkTypar t |> Option.orElseWith (fun () -> walkType ty) @@ -711,7 +711,7 @@ module ParsedInput = | SynType.Array(_, t, _) -> walkType t | SynType.Fun(argType = t1; returnType = t2) -> walkType t1 |> Option.orElseWith (fun () -> walkType t2) | SynType.WithGlobalConstraints(t, _, _) -> walkType t - | SynType.WithNull(t, _, _) + | SynType.WithNull(innerType = t) | SynType.HashConstraint(t, _) -> walkType t | SynType.Or(t1, t2, _, _) -> walkType t1 |> Option.orElseWith (fun () -> walkType t2) | SynType.MeasurePower(t, _, _) -> walkType t @@ -1914,7 +1914,7 @@ module ParsedInput = | SynTypeConstraint.WhereTyparIsReferenceType(t, _) | SynTypeConstraint.WhereTyparIsUnmanaged(t, _) | SynTypeConstraint.WhereTyparSupportsNull(t, _) - | SynTypeConstraint.WhereTyparNotSupportsNull(t, _) + | SynTypeConstraint.WhereTyparNotSupportsNull(genericName = t) | SynTypeConstraint.WhereTyparIsComparable(t, _) | SynTypeConstraint.WhereTyparIsEquatable(t, _) -> walkTypar t | SynTypeConstraint.WhereTyparDefaultsToType(t, ty, _) @@ -1976,7 +1976,7 @@ module ParsedInput = | SynType.Array(_, t, _) | SynType.HashConstraint(t, _) | SynType.MeasurePower(t, _, _) - | SynType.WithNull(t, _, _) + | SynType.WithNull(innerType = t) | SynType.Paren(t, _) | SynType.SignatureParameter(usedType = t) -> walkType t | SynType.Fun(argType = t1; returnType = t2) diff --git a/src/Compiler/SyntaxTree/SyntaxTree.fs b/src/Compiler/SyntaxTree/SyntaxTree.fs index 50c81fdcc58..962188c2f21 100644 --- a/src/Compiler/SyntaxTree/SyntaxTree.fs +++ b/src/Compiler/SyntaxTree/SyntaxTree.fs @@ -332,7 +332,7 @@ type SynTypeConstraint = | WhereTyparSupportsNull of typar: SynTypar * range: range - | WhereTyparNotSupportsNull of genericName: SynTypar * range: range + | WhereTyparNotSupportsNull of genericName: SynTypar * range: range * trivia: SynTypeConstraintWhereTyparNotSupportsNullTrivia | WhereTyparIsComparable of typar: SynTypar * range: range @@ -465,7 +465,7 @@ type SynType = | StaticConstantNamed of ident: SynType * value: SynType * range: range - | WithNull of innerType: SynType * ambivalent: bool * range: range + | WithNull of innerType: SynType * ambivalent: bool * range: range * trivia: SynTypeWithNullTrivia | Paren of innerType: SynType * range: range diff --git a/src/Compiler/SyntaxTree/SyntaxTree.fsi b/src/Compiler/SyntaxTree/SyntaxTree.fsi index 2cc6b14947a..f2c75d8dfac 100644 --- a/src/Compiler/SyntaxTree/SyntaxTree.fsi +++ b/src/Compiler/SyntaxTree/SyntaxTree.fsi @@ -409,7 +409,10 @@ type SynTypeConstraint = | WhereTyparSupportsNull of typar: SynTypar * range: range /// F# syntax is 'typar : null - | WhereTyparNotSupportsNull of genericName: SynTypar * range: range + | WhereTyparNotSupportsNull of + genericName: SynTypar * + range: range * + trivia: SynTypeConstraintWhereTyparNotSupportsNullTrivia /// F# syntax is 'typar: comparison | WhereTyparIsComparable of typar: SynTypar * range: range @@ -527,7 +530,7 @@ type SynType = /// F# syntax: ident=1 etc., used in static parameters to type providers | StaticConstantNamed of ident: SynType * value: SynType * range: range - | WithNull of innerType: SynType * ambivalent: bool * range: range + | WithNull of innerType: SynType * ambivalent: bool * range: range * trivia: SynTypeWithNullTrivia | Paren of innerType: SynType * range: range diff --git a/src/Compiler/SyntaxTree/SyntaxTrivia.fs b/src/Compiler/SyntaxTree/SyntaxTrivia.fs index f259746cfff..0932befd7c1 100644 --- a/src/Compiler/SyntaxTree/SyntaxTrivia.fs +++ b/src/Compiler/SyntaxTree/SyntaxTrivia.fs @@ -404,6 +404,9 @@ type SynFieldTrivia = [] type SynTypeOrTrivia = { OrKeyword: range } +[] +type SynTypeWithNullTrivia = { BarRange: range } + [] type SynBindingReturnInfoTrivia = { ColonRange: range option } @@ -429,3 +432,6 @@ type SynMeasureConstantTrivia = LessRange: range GreaterRange: range } + +[] +type SynTypeConstraintWhereTyparNotSupportsNullTrivia = { ColonRange: range; NotRange: range } diff --git a/src/Compiler/SyntaxTree/SyntaxTrivia.fsi b/src/Compiler/SyntaxTree/SyntaxTrivia.fsi index 567586081f2..24bfc1b7a52 100644 --- a/src/Compiler/SyntaxTree/SyntaxTrivia.fsi +++ b/src/Compiler/SyntaxTree/SyntaxTrivia.fsi @@ -512,6 +512,14 @@ type SynTypeOrTrivia = OrKeyword: range } +/// Represents additional information for SynType.WithNull +[] +type SynTypeWithNullTrivia = + { + /// The syntax range of the `|` token + BarRange: range + } + /// Represents additional information for SynBindingReturnInfo [] type SynBindingReturnInfoTrivia = @@ -545,3 +553,14 @@ type SynTyparDeclTrivia = type SynMeasureConstantTrivia = { LessRange: range GreaterRange: range } + +/// Represents additional information for SynTypeConstraint.WhereTyparNotSupportsNull +[] +type SynTypeConstraintWhereTyparNotSupportsNullTrivia = + { + /// The syntax range of `:` + ColonRange: range + + /// The syntax range of `not` + NotRange: range + } diff --git a/src/Compiler/TypedTree/TcGlobals.fs b/src/Compiler/TypedTree/TcGlobals.fs index c78933864be..2c065437f2b 100644 --- a/src/Compiler/TypedTree/TcGlobals.fs +++ b/src/Compiler/TypedTree/TcGlobals.fs @@ -193,9 +193,7 @@ type TcGlobals( realsig: bool) = let v_langFeatureNullness = langVersion.SupportsFeature LanguageFeature.NullnessChecking - - let v_renderNullness = checkNullness && v_langFeatureNullness - + let v_knownWithNull = if v_langFeatureNullness then KnownWithNull else KnownAmbivalentToNull @@ -1113,8 +1111,6 @@ type TcGlobals( member _.langFeatureNullness = v_langFeatureNullness - member _.renderNullnessAnnotations = v_renderNullness - member _.knownWithNull = v_knownWithNull member _.knownWithoutNull = v_knownWithoutNull diff --git a/src/Compiler/TypedTree/TcGlobals.fsi b/src/Compiler/TypedTree/TcGlobals.fsi index 83b390e299e..950d5217500 100644 --- a/src/Compiler/TypedTree/TcGlobals.fsi +++ b/src/Compiler/TypedTree/TcGlobals.fsi @@ -1055,8 +1055,6 @@ type internal TcGlobals = member reference_equality_inner_vref: FSharp.Compiler.TypedTree.ValRef - member renderNullnessAnnotations: bool - member reraise_info: IntrinsicValRef member reraise_vref: FSharp.Compiler.TypedTree.ValRef diff --git a/src/Compiler/TypedTree/TypedTreeOps.fs b/src/Compiler/TypedTree/TypedTreeOps.fs index 60ab98e8c5f..333b29cd78f 100644 --- a/src/Compiler/TypedTree/TypedTreeOps.fs +++ b/src/Compiler/TypedTree/TypedTreeOps.fs @@ -8926,10 +8926,7 @@ let typarEnc _g (gtpsType, gtpsMethod) typar = warning(InternalError("Typar not found during XmlDoc generation", typar.Range)) "``0" -let nullnessEnc (g:TcGlobals) (nullness:Nullness) = - if g.renderNullnessAnnotations then nullness.ToFsharpCodeString() else "" - -let rec typeEnc g (gtpsType, gtpsMethod) ty = +let rec typeEnc g (gtpsType, gtpsMethod) ty = let stripped = stripTyEqnsAndMeasureEqns g ty match stripped with | TType_forall _ -> @@ -8943,26 +8940,26 @@ let rec typeEnc g (gtpsType, gtpsMethod) ty = let ety = destNativePtrTy g ty typeEnc g (gtpsType, gtpsMethod) ety + "*" - | TType_app (_, _, nullness) when isArrayTy g ty -> + | TType_app (_, _, _nullness) when isArrayTy g ty -> let tcref, tinst = destAppTy g ty let rank = rankOfArrayTyconRef g tcref let arraySuffix = "[" + String.concat ", " (List.replicate (rank-1) "0:") + "]" - typeEnc g (gtpsType, gtpsMethod) (List.head tinst) + arraySuffix + nullnessEnc g nullness + typeEnc g (gtpsType, gtpsMethod) (List.head tinst) + arraySuffix | TType_ucase (_, tinst) | TType_app (_, tinst, _) -> - let tyName,nullness = + let tyName = let ty = stripTyEqnsAndMeasureEqns g ty match ty with - | TType_app (tcref, _tinst, nullness) -> + | TType_app (tcref, _tinst, _nullness) -> // Generic type names are (name + "`" + digits) where name does not contain "`". // In XML doc, when used in type instances, these do not use the ticks. let path = Array.toList (fullMangledPathToTyconRef tcref) @ [tcref.CompiledName] - textOfPath (List.map DemangleGenericTypeName path),nullness + textOfPath (List.map DemangleGenericTypeName path) | _ -> assert false failwith "impossible" - tyName + tyargsEnc g (gtpsType, gtpsMethod) tinst + nullnessEnc g nullness + tyName + tyargsEnc g (gtpsType, gtpsMethod) tinst | TType_anon (anonInfo, tinst) -> sprintf "%s%s" anonInfo.ILTypeRef.FullName (tyargsEnc g (gtpsType, gtpsMethod) tinst) @@ -8973,11 +8970,11 @@ let rec typeEnc g (gtpsType, gtpsMethod) ty = else sprintf "System.Tuple%s"(tyargsEnc g (gtpsType, gtpsMethod) tys) - | TType_fun (domainTy, rangeTy, nullness) -> - "Microsoft.FSharp.Core.FSharpFunc" + tyargsEnc g (gtpsType, gtpsMethod) [domainTy; rangeTy] + nullnessEnc g nullness + | TType_fun (domainTy, rangeTy, _nullness) -> + "Microsoft.FSharp.Core.FSharpFunc" + tyargsEnc g (gtpsType, gtpsMethod) [domainTy; rangeTy] - | TType_var (typar, nullness) -> - typarEnc g (gtpsType, gtpsMethod) typar + nullnessEnc g nullness + | TType_var (typar, _nullness) -> + typarEnc g (gtpsType, gtpsMethod) typar | TType_measure _ -> "?" diff --git a/src/Compiler/pars.fsy b/src/Compiler/pars.fsy index 2588f9d128b..54d47b7c4fb 100644 --- a/src/Compiler/pars.fsy +++ b/src/Compiler/pars.fsy @@ -2652,8 +2652,9 @@ typeConstraint: { SynTypeConstraint.WhereTyparSupportsNull($1, lhs parseState) } | typar COLON IDENT NULL - { if $3 <> "not" then reportParseErrorAt (rhs parseState 3) (FSComp.SR.parsUnexpectedIdentifier($3 + " (2)")) - SynTypeConstraint.WhereTyparNotSupportsNull($1, lhs parseState) } + { if $3 <> "not" then reportParseErrorAt (rhs parseState 3) (FSComp.SR.parsUnexpectedIdentifier($3 + " (2)")) + let trivia : SynTypeConstraintWhereTyparNotSupportsNullTrivia = { ColonRange = rhs parseState 2; NotRange = rhs parseState 3 } + SynTypeConstraint.WhereTyparNotSupportsNull($1, lhs parseState, trivia) } | typar COLON LPAREN classMemberSpfn rparen { let tp = $1 @@ -3241,7 +3242,7 @@ cType: SynType.App(SynType.LongIdent(SynLongIdent([ident("nativeptr", m)], [], [ Some(IdentTrivia.OriginalNotation "*") ])), None, [$1], [], None, true, m) } | cType BAR_JUST_BEFORE_NULL NULL - { SynType.WithNull($1, false, lhs parseState) } + { SynType.WithNull($1, false, lhs parseState, { BarRange = rhs parseState 2 }) } | cType AMP { let m = lhs parseState @@ -6193,7 +6194,7 @@ appTypeConPower: appTypeCanBeNullable: | appTypeWithoutNull BAR_JUST_BEFORE_NULL NULL - { SynType.WithNull($1, false, lhs parseState) } + { SynType.WithNull($1, false, lhs parseState, { BarRange = rhs parseState 2 }) } | appTypeWithoutNull { $1 } diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeUsage.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeUsage.fs index adfe0e3cfcb..bf413c777d3 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeUsage.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeUsage.fs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Conformance.BasicGrammarElements @@ -875,7 +875,7 @@ type InterruptibleLazy<'T> private (valueFactory: unit -> 'T) = (Error 948, Line 8, Col 6, Line 8, Col 24, "Interface types cannot be sealed") (Error 942, Line 14, Col 6, Line 14, Col 33, "Delegate types are always sealed") ] - + // SOURCE= E_StructLayout01.fs # E_StructLayout01.fs [] let ``E_StructLayout01 9.0`` compilation = @@ -890,7 +890,7 @@ type InterruptibleLazy<'T> private (valueFactory: unit -> 'T) = (Error 937, Line 14, Col 6, Line 14, Col 8, "Only structs and classes without primary constructors may be given the 'StructLayout' attribute") (Error 937, Line 17, Col 6, Line 17, Col 8, "Only structs and classes without primary constructors may be given the 'StructLayout' attribute") ] - + // SOURCE=E_StructLayout01.fs # E_StructLayout01.fs [] let ``E_StructLayout01 preview`` compilation = @@ -904,4 +904,32 @@ type InterruptibleLazy<'T> private (valueFactory: unit -> 'T) = (Error 937, Line 11, Col 6, Line 11, Col 8, "Only structs and classes without primary constructors may be given the 'StructLayout' attribute") (Error 937, Line 14, Col 6, Line 14, Col 8, "Only structs and classes without primary constructors may be given the 'StructLayout' attribute") (Error 937, Line 17, Col 6, Line 17, Col 8, "Only structs and classes without primary constructors may be given the 'StructLayout' attribute") - ] \ No newline at end of file + ] + +#if NETCOREAPP + let missingConstructorRepro = + """ +open System.Text.Json.Serialization + +type internal ApplicationTenantJsonDerivedTypeAttribute () = + inherit JsonDerivedTypeAttribute (typeof, "a") + +// -------------------------------------------------------------------------- +// IMPORTANT: Read ReadMe before modifying this сlass and any referenced types +// -------------------------------------------------------------------------- +and [] + ApplicationTenant + [] (id, name, loginProvider, allowedDomains, authorizedTenants, properties) = + + member _.Id = "" + """ + + [] + [] + [] + let ``Regression for - F# 9 compiler cannot find constructor for attribute`` langVersion = + FSharp missingConstructorRepro + |> withLangVersion langVersion + |> verifyCompile + |> shouldSucceed +#endif diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl index 03b461d6a54..3ae2414fc07 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl @@ -9197,6 +9197,8 @@ FSharp.Compiler.Syntax.SynType+WithNull: Boolean ambivalent FSharp.Compiler.Syntax.SynType+WithNull: Boolean get_ambivalent() FSharp.Compiler.Syntax.SynType+WithNull: FSharp.Compiler.Syntax.SynType get_innerType() FSharp.Compiler.Syntax.SynType+WithNull: FSharp.Compiler.Syntax.SynType innerType +FSharp.Compiler.Syntax.SynType+WithNull: FSharp.Compiler.SyntaxTrivia.SynTypeWithNullTrivia get_trivia() +FSharp.Compiler.Syntax.SynType+WithNull: FSharp.Compiler.SyntaxTrivia.SynTypeWithNullTrivia trivia FSharp.Compiler.Syntax.SynType+WithNull: FSharp.Compiler.Text.Range get_range() FSharp.Compiler.Syntax.SynType+WithNull: FSharp.Compiler.Text.Range range FSharp.Compiler.Syntax.SynType: Boolean IsAnon @@ -9264,7 +9266,7 @@ FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewStaticConstant FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewTuple(Boolean, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynTupleTypeSegment], FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewVar(FSharp.Compiler.Syntax.SynTypar, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewWithGlobalConstraints(FSharp.Compiler.Syntax.SynType, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynTypeConstraint], FSharp.Compiler.Text.Range) -FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewWithNull(FSharp.Compiler.Syntax.SynType, Boolean, FSharp.Compiler.Text.Range) +FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewWithNull(FSharp.Compiler.Syntax.SynType, Boolean, FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynTypeWithNullTrivia) FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+Anon FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+AnonRecd FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+App @@ -9350,6 +9352,8 @@ FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparIsValueType: FSharp.Compiler. FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparIsValueType: FSharp.Compiler.Text.Range range FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparNotSupportsNull: FSharp.Compiler.Syntax.SynTypar genericName FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparNotSupportsNull: FSharp.Compiler.Syntax.SynTypar get_genericName() +FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparNotSupportsNull: FSharp.Compiler.SyntaxTrivia.SynTypeConstraintWhereTyparNotSupportsNullTrivia get_trivia() +FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparNotSupportsNull: FSharp.Compiler.SyntaxTrivia.SynTypeConstraintWhereTyparNotSupportsNullTrivia trivia FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparNotSupportsNull: FSharp.Compiler.Text.Range get_range() FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparNotSupportsNull: FSharp.Compiler.Text.Range range FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparSubtypeOfType: FSharp.Compiler.Syntax.SynTypar get_typar() @@ -9403,7 +9407,7 @@ FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstrai FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint NewWhereTyparIsReferenceType(FSharp.Compiler.Syntax.SynTypar, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint NewWhereTyparIsUnmanaged(FSharp.Compiler.Syntax.SynTypar, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint NewWhereTyparIsValueType(FSharp.Compiler.Syntax.SynTypar, FSharp.Compiler.Text.Range) -FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint NewWhereTyparNotSupportsNull(FSharp.Compiler.Syntax.SynTypar, FSharp.Compiler.Text.Range) +FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint NewWhereTyparNotSupportsNull(FSharp.Compiler.Syntax.SynTypar, FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynTypeConstraintWhereTyparNotSupportsNullTrivia) FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint NewWhereTyparSubtypeOfType(FSharp.Compiler.Syntax.SynTypar, FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint NewWhereTyparSupportsMember(FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Syntax.SynMemberSig, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint NewWhereTyparSupportsNull(FSharp.Compiler.Syntax.SynTypar, FSharp.Compiler.Text.Range) @@ -10573,6 +10577,12 @@ FSharp.Compiler.SyntaxTrivia.SynTyparDeclTrivia: Microsoft.FSharp.Collections.FS FSharp.Compiler.SyntaxTrivia.SynTyparDeclTrivia: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Text.Range] get_AmpersandRanges() FSharp.Compiler.SyntaxTrivia.SynTyparDeclTrivia: System.String ToString() FSharp.Compiler.SyntaxTrivia.SynTyparDeclTrivia: Void .ctor(Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Text.Range]) +FSharp.Compiler.SyntaxTrivia.SynTypeConstraintWhereTyparNotSupportsNullTrivia: FSharp.Compiler.Text.Range ColonRange +FSharp.Compiler.SyntaxTrivia.SynTypeConstraintWhereTyparNotSupportsNullTrivia: FSharp.Compiler.Text.Range NotRange +FSharp.Compiler.SyntaxTrivia.SynTypeConstraintWhereTyparNotSupportsNullTrivia: FSharp.Compiler.Text.Range get_ColonRange() +FSharp.Compiler.SyntaxTrivia.SynTypeConstraintWhereTyparNotSupportsNullTrivia: FSharp.Compiler.Text.Range get_NotRange() +FSharp.Compiler.SyntaxTrivia.SynTypeConstraintWhereTyparNotSupportsNullTrivia: System.String ToString() +FSharp.Compiler.SyntaxTrivia.SynTypeConstraintWhereTyparNotSupportsNullTrivia: Void .ctor(FSharp.Compiler.Text.Range, FSharp.Compiler.Text.Range) FSharp.Compiler.SyntaxTrivia.SynTypeDefnLeadingKeyword+And: FSharp.Compiler.Text.Range Item FSharp.Compiler.SyntaxTrivia.SynTypeDefnLeadingKeyword+And: FSharp.Compiler.Text.Range get_Item() FSharp.Compiler.SyntaxTrivia.SynTypeDefnLeadingKeyword+StaticType: FSharp.Compiler.Text.Range get_staticRange() @@ -10635,6 +10645,10 @@ FSharp.Compiler.SyntaxTrivia.SynTypeOrTrivia: FSharp.Compiler.Text.Range OrKeywo FSharp.Compiler.SyntaxTrivia.SynTypeOrTrivia: FSharp.Compiler.Text.Range get_OrKeyword() FSharp.Compiler.SyntaxTrivia.SynTypeOrTrivia: System.String ToString() FSharp.Compiler.SyntaxTrivia.SynTypeOrTrivia: Void .ctor(FSharp.Compiler.Text.Range) +FSharp.Compiler.SyntaxTrivia.SynTypeWithNullTrivia: FSharp.Compiler.Text.Range BarRange +FSharp.Compiler.SyntaxTrivia.SynTypeWithNullTrivia: FSharp.Compiler.Text.Range get_BarRange() +FSharp.Compiler.SyntaxTrivia.SynTypeWithNullTrivia: System.String ToString() +FSharp.Compiler.SyntaxTrivia.SynTypeWithNullTrivia: Void .ctor(FSharp.Compiler.Text.Range) FSharp.Compiler.SyntaxTrivia.SynUnionCaseTrivia: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] BarRange FSharp.Compiler.SyntaxTrivia.SynUnionCaseTrivia: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] get_BarRange() FSharp.Compiler.SyntaxTrivia.SynUnionCaseTrivia: System.String ToString() diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl index 03b461d6a54..3ae2414fc07 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl @@ -9197,6 +9197,8 @@ FSharp.Compiler.Syntax.SynType+WithNull: Boolean ambivalent FSharp.Compiler.Syntax.SynType+WithNull: Boolean get_ambivalent() FSharp.Compiler.Syntax.SynType+WithNull: FSharp.Compiler.Syntax.SynType get_innerType() FSharp.Compiler.Syntax.SynType+WithNull: FSharp.Compiler.Syntax.SynType innerType +FSharp.Compiler.Syntax.SynType+WithNull: FSharp.Compiler.SyntaxTrivia.SynTypeWithNullTrivia get_trivia() +FSharp.Compiler.Syntax.SynType+WithNull: FSharp.Compiler.SyntaxTrivia.SynTypeWithNullTrivia trivia FSharp.Compiler.Syntax.SynType+WithNull: FSharp.Compiler.Text.Range get_range() FSharp.Compiler.Syntax.SynType+WithNull: FSharp.Compiler.Text.Range range FSharp.Compiler.Syntax.SynType: Boolean IsAnon @@ -9264,7 +9266,7 @@ FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewStaticConstant FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewTuple(Boolean, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynTupleTypeSegment], FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewVar(FSharp.Compiler.Syntax.SynTypar, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewWithGlobalConstraints(FSharp.Compiler.Syntax.SynType, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynTypeConstraint], FSharp.Compiler.Text.Range) -FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewWithNull(FSharp.Compiler.Syntax.SynType, Boolean, FSharp.Compiler.Text.Range) +FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewWithNull(FSharp.Compiler.Syntax.SynType, Boolean, FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynTypeWithNullTrivia) FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+Anon FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+AnonRecd FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+App @@ -9350,6 +9352,8 @@ FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparIsValueType: FSharp.Compiler. FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparIsValueType: FSharp.Compiler.Text.Range range FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparNotSupportsNull: FSharp.Compiler.Syntax.SynTypar genericName FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparNotSupportsNull: FSharp.Compiler.Syntax.SynTypar get_genericName() +FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparNotSupportsNull: FSharp.Compiler.SyntaxTrivia.SynTypeConstraintWhereTyparNotSupportsNullTrivia get_trivia() +FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparNotSupportsNull: FSharp.Compiler.SyntaxTrivia.SynTypeConstraintWhereTyparNotSupportsNullTrivia trivia FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparNotSupportsNull: FSharp.Compiler.Text.Range get_range() FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparNotSupportsNull: FSharp.Compiler.Text.Range range FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparSubtypeOfType: FSharp.Compiler.Syntax.SynTypar get_typar() @@ -9403,7 +9407,7 @@ FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstrai FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint NewWhereTyparIsReferenceType(FSharp.Compiler.Syntax.SynTypar, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint NewWhereTyparIsUnmanaged(FSharp.Compiler.Syntax.SynTypar, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint NewWhereTyparIsValueType(FSharp.Compiler.Syntax.SynTypar, FSharp.Compiler.Text.Range) -FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint NewWhereTyparNotSupportsNull(FSharp.Compiler.Syntax.SynTypar, FSharp.Compiler.Text.Range) +FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint NewWhereTyparNotSupportsNull(FSharp.Compiler.Syntax.SynTypar, FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynTypeConstraintWhereTyparNotSupportsNullTrivia) FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint NewWhereTyparSubtypeOfType(FSharp.Compiler.Syntax.SynTypar, FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint NewWhereTyparSupportsMember(FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Syntax.SynMemberSig, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint NewWhereTyparSupportsNull(FSharp.Compiler.Syntax.SynTypar, FSharp.Compiler.Text.Range) @@ -10573,6 +10577,12 @@ FSharp.Compiler.SyntaxTrivia.SynTyparDeclTrivia: Microsoft.FSharp.Collections.FS FSharp.Compiler.SyntaxTrivia.SynTyparDeclTrivia: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Text.Range] get_AmpersandRanges() FSharp.Compiler.SyntaxTrivia.SynTyparDeclTrivia: System.String ToString() FSharp.Compiler.SyntaxTrivia.SynTyparDeclTrivia: Void .ctor(Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Text.Range]) +FSharp.Compiler.SyntaxTrivia.SynTypeConstraintWhereTyparNotSupportsNullTrivia: FSharp.Compiler.Text.Range ColonRange +FSharp.Compiler.SyntaxTrivia.SynTypeConstraintWhereTyparNotSupportsNullTrivia: FSharp.Compiler.Text.Range NotRange +FSharp.Compiler.SyntaxTrivia.SynTypeConstraintWhereTyparNotSupportsNullTrivia: FSharp.Compiler.Text.Range get_ColonRange() +FSharp.Compiler.SyntaxTrivia.SynTypeConstraintWhereTyparNotSupportsNullTrivia: FSharp.Compiler.Text.Range get_NotRange() +FSharp.Compiler.SyntaxTrivia.SynTypeConstraintWhereTyparNotSupportsNullTrivia: System.String ToString() +FSharp.Compiler.SyntaxTrivia.SynTypeConstraintWhereTyparNotSupportsNullTrivia: Void .ctor(FSharp.Compiler.Text.Range, FSharp.Compiler.Text.Range) FSharp.Compiler.SyntaxTrivia.SynTypeDefnLeadingKeyword+And: FSharp.Compiler.Text.Range Item FSharp.Compiler.SyntaxTrivia.SynTypeDefnLeadingKeyword+And: FSharp.Compiler.Text.Range get_Item() FSharp.Compiler.SyntaxTrivia.SynTypeDefnLeadingKeyword+StaticType: FSharp.Compiler.Text.Range get_staticRange() @@ -10635,6 +10645,10 @@ FSharp.Compiler.SyntaxTrivia.SynTypeOrTrivia: FSharp.Compiler.Text.Range OrKeywo FSharp.Compiler.SyntaxTrivia.SynTypeOrTrivia: FSharp.Compiler.Text.Range get_OrKeyword() FSharp.Compiler.SyntaxTrivia.SynTypeOrTrivia: System.String ToString() FSharp.Compiler.SyntaxTrivia.SynTypeOrTrivia: Void .ctor(FSharp.Compiler.Text.Range) +FSharp.Compiler.SyntaxTrivia.SynTypeWithNullTrivia: FSharp.Compiler.Text.Range BarRange +FSharp.Compiler.SyntaxTrivia.SynTypeWithNullTrivia: FSharp.Compiler.Text.Range get_BarRange() +FSharp.Compiler.SyntaxTrivia.SynTypeWithNullTrivia: System.String ToString() +FSharp.Compiler.SyntaxTrivia.SynTypeWithNullTrivia: Void .ctor(FSharp.Compiler.Text.Range) FSharp.Compiler.SyntaxTrivia.SynUnionCaseTrivia: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] BarRange FSharp.Compiler.SyntaxTrivia.SynUnionCaseTrivia: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] get_BarRange() FSharp.Compiler.SyntaxTrivia.SynUnionCaseTrivia: System.String ToString() diff --git a/tests/FSharp.Compiler.Service.Tests/TooltipTests.fs b/tests/FSharp.Compiler.Service.Tests/TooltipTests.fs index 1edac6d4f6e..e9ce93a37cd 100644 --- a/tests/FSharp.Compiler.Service.Tests/TooltipTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/TooltipTests.fs @@ -9,6 +9,7 @@ open FSharp.Compiler.Text open FSharp.Compiler.Tokenization open FSharp.Compiler.EditorServices open FSharp.Compiler.Symbols +open FSharp.Compiler.Xml open FSharp.Test open Xunit @@ -398,16 +399,24 @@ let getCheckResults source options = let _, checkResults = parseAndCheckFile fileName source options checkResults -let assertAndGetSingleToolTipText (ToolTipText(items)) = + +let taggedTextsToString (t: TaggedText array) = + t + |> Array.map (fun taggedText -> taggedText.Text) + |> String.concat "" +let assertAndExtractTooltip (ToolTipText(items)) = Assert.Equal(1,items.Length) match items.[0] with - | ToolTipElement.Group [ { MainDescription = description } ] -> + | ToolTipElement.Group [ singleElement ] -> let toolTipText = - description - |> Array.map (fun taggedText -> taggedText.Text) - |> String.concat "" - toolTipText + singleElement.MainDescription + |> taggedTextsToString + toolTipText, singleElement.XmlDoc, singleElement.Remarks |> Option.map taggedTextsToString | _ -> failwith $"Expected group, got {items.[0]}" + +let assertAndGetSingleToolTipText items = + let text,_xml,_remarks = assertAndExtractTooltip items + text let normalize (s:string) = s.Replace("\r\n", "\n").Replace("\n\n", "\n") @@ -436,6 +445,42 @@ let exists() = System.IO.Path.Exists(null:string) checkResults.GetToolTip(2, 36, "let exists() = System.IO.Path.Exists(null:string)", [ "Exists" ], FSharpTokenTag.Identifier) |> assertAndGetSingleToolTipText |> Assert.shouldBeEquivalentTo "System.IO.Path.Exists([] path: string | null) : bool" + +[] +let ``Should display xml doc on a nullable BLC method`` () = + + let source = """module Foo +let exists() = System.IO.Path.Exists(null:string) +""" + let checkResults = getCheckResults source [|"--checknulls+";"--langversion:preview"|] + checkResults.GetToolTip(2, 36, "let exists() = System.IO.Path.Exists(null:string)", [ "Exists" ], FSharpTokenTag.Identifier) + |> assertAndExtractTooltip + |> fun (text,xml,remarks) -> + text |> Assert.shouldBeEquivalentTo "System.IO.Path.Exists([] path: string | null) : bool" + match xml with + | FSharpXmlDoc.FromXmlFile (_dll,sigPath) -> sigPath |> Assert.shouldBeEquivalentTo "M:System.IO.Path.Exists(System.String)" + | _ -> failwith $"Xml wrong type %A{xml}" + + +[] +let ``Should display xml doc on fsharp hosted nullable function`` () = + + let source = """module Foo +/// This is a xml doc above myFunc +let myFunc(x:string|null) : string | null = x + +let exists() = myFunc(null) +""" + let checkResults = getCheckResults source [|"--checknulls+";"--langversion:preview"|] + checkResults.GetToolTip(5, 21, "let exists() = myFunc(null)", [ "myFunc" ], FSharpTokenTag.Identifier) + |> assertAndExtractTooltip + |> fun (text,xml,remarks) -> + match xml with + | FSharpXmlDoc.FromXmlText t -> + t.UnprocessedLines |> Assert.shouldBeEquivalentTo [|" This is a xml doc above myFunc"|] + | _ -> failwith $"xml was %A{xml}" + text |> Assert.shouldBeEquivalentTo "val myFunc: x: string | null -> string | null" + remarks |> Assert.shouldBeEquivalentTo (Some "Full name: Foo.myFunc") [] diff --git a/tests/service/data/SyntaxTree/Nullness/AbstractClassProperty.fs.bsl b/tests/service/data/SyntaxTree/Nullness/AbstractClassProperty.fs.bsl index 11735a1d0c3..fa15e544c36 100644 --- a/tests/service/data/SyntaxTree/Nullness/AbstractClassProperty.fs.bsl +++ b/tests/service/data/SyntaxTree/Nullness/AbstractClassProperty.fs.bsl @@ -29,7 +29,7 @@ ImplFile SynValTyparDecls (None, true), WithNull (LongIdent (SynLongIdent ([string], [], [None])), - false, (3,24--3,37)), + false, (3,24--3,37), { BarRange = (3,31--3,32) }), SynValInfo ([], SynArgInfo ([], false, None)), false, false, PreXmlDoc ((3,3), FSharp.Compiler.Xml.XmlDocCollector), diff --git a/tests/service/data/SyntaxTree/Nullness/DuCaseStringOrNull.fs.bsl b/tests/service/data/SyntaxTree/Nullness/DuCaseStringOrNull.fs.bsl index fd375837c54..e60a05e853d 100644 --- a/tests/service/data/SyntaxTree/Nullness/DuCaseStringOrNull.fs.bsl +++ b/tests/service/data/SyntaxTree/Nullness/DuCaseStringOrNull.fs.bsl @@ -22,8 +22,9 @@ ImplFile (WithNull (LongIdent (SynLongIdent ([string], [], [None])), - false, (1,21--1,34)), (1,20--1,35)), - false, + false, (1,21--1,34), + { BarRange = (1,28--1,29) }), + (1,20--1,35)), false, PreXmlDoc ((1,20), FSharp.Compiler.Xml.XmlDocCollector), None, (1,20--1,35), { LeadingKeyword = None MutableKeyword = None })], diff --git a/tests/service/data/SyntaxTree/Nullness/DuCaseTuplePrecedence.fs.bsl b/tests/service/data/SyntaxTree/Nullness/DuCaseTuplePrecedence.fs.bsl index 3af1fc28bd5..1ae968787e3 100644 --- a/tests/service/data/SyntaxTree/Nullness/DuCaseTuplePrecedence.fs.bsl +++ b/tests/service/data/SyntaxTree/Nullness/DuCaseTuplePrecedence.fs.bsl @@ -22,8 +22,9 @@ ImplFile (WithNull (LongIdent (SynLongIdent ([string], [], [None])), - false, (1,21--1,34)), (1,20--1,35)), - false, + false, (1,21--1,34), + { BarRange = (1,28--1,29) }), + (1,20--1,35)), false, PreXmlDoc ((1,20), FSharp.Compiler.Xml.XmlDocCollector), None, (1,20--1,35), { LeadingKeyword = None MutableKeyword = None }); diff --git a/tests/service/data/SyntaxTree/Nullness/ExplicitField.fs.bsl b/tests/service/data/SyntaxTree/Nullness/ExplicitField.fs.bsl index 93c49b868bf..b590e85bce5 100644 --- a/tests/service/data/SyntaxTree/Nullness/ExplicitField.fs.bsl +++ b/tests/service/data/SyntaxTree/Nullness/ExplicitField.fs.bsl @@ -17,7 +17,8 @@ ImplFile ([], false, Some myString, WithNull (LongIdent (SynLongIdent ([string], [], [None])), - false, (3,31--3,44)), true, + false, (3,31--3,44), { BarRange = (3,38--3,39) }), + true, PreXmlDoc ((3,8), FSharp.Compiler.Xml.XmlDocCollector), None, (3,8--3,44), { LeadingKeyword = Some (Val (3,8--3,11)) diff --git a/tests/service/data/SyntaxTree/Nullness/FunctionArgAsPatternWithNullCase.fs.bsl b/tests/service/data/SyntaxTree/Nullness/FunctionArgAsPatternWithNullCase.fs.bsl index 016adb52e2b..1d72ceec00a 100644 --- a/tests/service/data/SyntaxTree/Nullness/FunctionArgAsPatternWithNullCase.fs.bsl +++ b/tests/service/data/SyntaxTree/Nullness/FunctionArgAsPatternWithNullCase.fs.bsl @@ -30,8 +30,10 @@ ImplFile WithNull (LongIdent (SynLongIdent ([string], [], [None])), - false, (1,25--1,38)), (1,20--1,38)), - (1,12--1,38), { BarRange = (1,18--1,19) }), + false, (1,25--1,38), + { BarRange = (1,32--1,33) }), + (1,20--1,38)), (1,12--1,38), + { BarRange = (1,18--1,19) }), Const (String ("123", Regular, (1,41--1,46)), (1,41--1,46)), (1,12--1,46), diff --git a/tests/service/data/SyntaxTree/Nullness/GenericFunctionTyparNotNull.fs.bsl b/tests/service/data/SyntaxTree/Nullness/GenericFunctionTyparNotNull.fs.bsl index 2989025967c..f03151197dd 100644 --- a/tests/service/data/SyntaxTree/Nullness/GenericFunctionTyparNotNull.fs.bsl +++ b/tests/service/data/SyntaxTree/Nullness/GenericFunctionTyparNotNull.fs.bsl @@ -24,13 +24,14 @@ ImplFile WithGlobalConstraints (Var (SynTypar (T, None, false), (1,15--1,17)), [WhereTyparNotSupportsNull - (SynTypar (T, None, false), (1,23--1,35))], - (1,15--1,35)), (1,12--1,35)), (1,11--1,36))], - None, (1,4--1,36)), None, Const (Int32 42, (1,39--1,41)), - (1,4--1,36), NoneAtLet, { LeadingKeyword = Let (1,0--1,3) - InlineKeyword = None - EqualsRange = Some (1,37--1,38) })], - (1,0--1,41))], PreXmlDocEmpty, [], None, (1,0--2,0), - { LeadingKeyword = None })], (true, true), - { ConditionalDirectives = [] - CodeComments = [] }, set [])) + (SynTypar (T, None, false), (1,23--1,35), + { ColonRange = (1,25--1,26) + NotRange = (1,27--1,30) })], (1,15--1,35)), + (1,12--1,35)), (1,11--1,36))], None, (1,4--1,36)), + None, Const (Int32 42, (1,39--1,41)), (1,4--1,36), NoneAtLet, + { LeadingKeyword = Let (1,0--1,3) + InlineKeyword = None + EqualsRange = Some (1,37--1,38) })], (1,0--1,41))], + PreXmlDocEmpty, [], None, (1,0--2,0), { LeadingKeyword = None })], + (true, true), { ConditionalDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Nullness/GenericTypeNotNull.fs.bsl b/tests/service/data/SyntaxTree/Nullness/GenericTypeNotNull.fs.bsl index e874ec38674..92d0d1a136c 100644 --- a/tests/service/data/SyntaxTree/Nullness/GenericTypeNotNull.fs.bsl +++ b/tests/service/data/SyntaxTree/Nullness/GenericTypeNotNull.fs.bsl @@ -14,9 +14,10 @@ ImplFile ([], SynTypar (T, None, false), [], { AmpersandRanges = [] })], [WhereTyparNotSupportsNull - (SynTypar (T, None, false), (1,15--1,27))], - (1,6--1,28))), [], [C], - PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), + (SynTypar (T, None, false), (1,15--1,27), + { ColonRange = (1,17--1,18) + NotRange = (1,19--1,22) })], (1,6--1,28))), [], + [C], PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), true, None, (1,5--1,6)), ObjectModel (Class, [], (1,31--1,40)), [], None, (1,5--1,40), { LeadingKeyword = Type (1,0--1,4) diff --git a/tests/service/data/SyntaxTree/Nullness/GenericTypeNotNullAndOtherConstraint.fs.bsl b/tests/service/data/SyntaxTree/Nullness/GenericTypeNotNullAndOtherConstraint.fs.bsl index 7a53c3be066..0906d86df22 100644 --- a/tests/service/data/SyntaxTree/Nullness/GenericTypeNotNullAndOtherConstraint.fs.bsl +++ b/tests/service/data/SyntaxTree/Nullness/GenericTypeNotNullAndOtherConstraint.fs.bsl @@ -14,7 +14,9 @@ ImplFile ([], SynTypar (T, None, false), [], { AmpersandRanges = [] })], [WhereTyparNotSupportsNull - (SynTypar (T, None, false), (1,15--1,27)); + (SynTypar (T, None, false), (1,15--1,27), + { ColonRange = (1,17--1,18) + NotRange = (1,19--1,22) }); WhereTyparIsEquatable (SynTypar (T, None, false), (1,32--1,43))], (1,6--1,44))), [], [C], diff --git a/tests/service/data/SyntaxTree/Nullness/GenericTypeOtherConstraintAndThenNotNull.fs.bsl b/tests/service/data/SyntaxTree/Nullness/GenericTypeOtherConstraintAndThenNotNull.fs.bsl index 14ce1cec8b7..c6f6f52d871 100644 --- a/tests/service/data/SyntaxTree/Nullness/GenericTypeOtherConstraintAndThenNotNull.fs.bsl +++ b/tests/service/data/SyntaxTree/Nullness/GenericTypeOtherConstraintAndThenNotNull.fs.bsl @@ -16,9 +16,10 @@ ImplFile [WhereTyparIsEquatable (SynTypar (T, None, false), (1,15--1,26)); WhereTyparNotSupportsNull - (SynTypar (T, None, false), (1,31--1,43))], - (1,6--1,44))), [], [C], - PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), + (SynTypar (T, None, false), (1,31--1,43), + { ColonRange = (1,33--1,34) + NotRange = (1,35--1,38) })], (1,6--1,44))), [], + [C], PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), true, None, (1,5--1,6)), ObjectModel (Class, [], (1,47--1,56)), [], None, (1,5--1,56), { LeadingKeyword = Type (1,0--1,4) diff --git a/tests/service/data/SyntaxTree/Nullness/IntListOrNull.fs.bsl b/tests/service/data/SyntaxTree/Nullness/IntListOrNull.fs.bsl index 38442d6c68e..c678aa83577 100644 --- a/tests/service/data/SyntaxTree/Nullness/IntListOrNull.fs.bsl +++ b/tests/service/data/SyntaxTree/Nullness/IntListOrNull.fs.bsl @@ -19,19 +19,21 @@ ImplFile (LongIdent (SynLongIdent ([list], [], [None])), None, [LongIdent (SynLongIdent ([int], [], [None]))], [], - None, true, (1,8--1,16)), false, (1,8--1,23)), - (1,8--1,23), [], { ColonRange = Some (1,6--1,7) })), + None, true, (1,8--1,16)), false, (1,8--1,23), + { BarRange = (1,17--1,18) }), (1,8--1,23), [], + { ColonRange = Some (1,6--1,7) })), Typed (ArrayOrList (false, [], (1,26--1,28)), WithNull (App (LongIdent (SynLongIdent ([list], [], [None])), None, [LongIdent (SynLongIdent ([int], [], [None]))], [], - None, true, (1,8--1,16)), false, (1,8--1,23)), - (1,26--1,28)), (1,4--1,5), Yes (1,0--1,28), - { LeadingKeyword = Let (1,0--1,3) - InlineKeyword = None - EqualsRange = Some (1,24--1,25) })], (1,0--1,28))], - PreXmlDocEmpty, [], None, (1,0--2,0), { LeadingKeyword = None })], - (true, true), { ConditionalDirectives = [] - CodeComments = [] }, set [])) + None, true, (1,8--1,16)), false, (1,8--1,23), + { BarRange = (1,17--1,18) }), (1,26--1,28)), (1,4--1,5), + Yes (1,0--1,28), { LeadingKeyword = Let (1,0--1,3) + InlineKeyword = None + EqualsRange = Some (1,24--1,25) })], + (1,0--1,28))], PreXmlDocEmpty, [], None, (1,0--2,0), + { LeadingKeyword = None })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Nullness/IntListOrNullOrNullOrNull.fs.bsl b/tests/service/data/SyntaxTree/Nullness/IntListOrNullOrNullOrNull.fs.bsl index e538c6dc34b..2ba94607f41 100644 --- a/tests/service/data/SyntaxTree/Nullness/IntListOrNullOrNullOrNull.fs.bsl +++ b/tests/service/data/SyntaxTree/Nullness/IntListOrNullOrNullOrNull.fs.bsl @@ -19,21 +19,22 @@ ImplFile (LongIdent (SynLongIdent ([list], [], [None])), None, [LongIdent (SynLongIdent ([int], [], [None]))], [], - None, true, (1,8--1,16)), false, (1,8--1,23)), - (1,8--1,23), [], { ColonRange = Some (1,6--1,7) })), + None, true, (1,8--1,16)), false, (1,8--1,23), + { BarRange = (1,17--1,18) }), (1,8--1,23), [], + { ColonRange = Some (1,6--1,7) })), Typed (ArbitraryAfterError ("localBinding2", (1,23--1,23)), WithNull (App (LongIdent (SynLongIdent ([list], [], [None])), None, [LongIdent (SynLongIdent ([int], [], [None]))], [], - None, true, (1,8--1,16)), false, (1,8--1,23)), - (1,23--1,23)), (1,4--1,5), Yes (1,0--1,23), - { LeadingKeyword = Let (1,0--1,3) - InlineKeyword = None - EqualsRange = None })], (1,0--1,23))], PreXmlDocEmpty, [], - None, (1,0--2,0), { LeadingKeyword = None })], (true, true), - { ConditionalDirectives = [] - CodeComments = [] }, set [])) + None, true, (1,8--1,16)), false, (1,8--1,23), + { BarRange = (1,17--1,18) }), (1,23--1,23)), (1,4--1,5), + Yes (1,0--1,23), { LeadingKeyword = Let (1,0--1,3) + InlineKeyword = None + EqualsRange = None })], (1,0--1,23))], + PreXmlDocEmpty, [], None, (1,0--2,0), { LeadingKeyword = None })], + (true, true), { ConditionalDirectives = [] + CodeComments = [] }, set [])) (1,24)-(1,25) parse error Unexpected symbol '|' (directly before 'null') in binding. Expected '=' or other token. diff --git a/tests/service/data/SyntaxTree/Nullness/MatchWithTypeCastParens.fs.bsl b/tests/service/data/SyntaxTree/Nullness/MatchWithTypeCastParens.fs.bsl index e3a174fcf11..2c465e58091 100644 --- a/tests/service/data/SyntaxTree/Nullness/MatchWithTypeCastParens.fs.bsl +++ b/tests/service/data/SyntaxTree/Nullness/MatchWithTypeCastParens.fs.bsl @@ -12,8 +12,9 @@ ImplFile (Paren (WithNull (LongIdent (SynLongIdent ([string], [], [None])), - false, (2,6--2,19)), (2,5--2,20)), (2,2--2,20)), - None, Const (Unit, (2,24--2,26)), (2,2--2,26), Yes, + false, (2,6--2,19), { BarRange = (2,13--2,14) }), + (2,5--2,20)), (2,2--2,20)), None, + Const (Unit, (2,24--2,26)), (2,2--2,26), Yes, { ArrowRange = Some (2,21--2,23) BarRange = Some (2,0--2,1) })], (1,0--2,26), { MatchKeyword = (1,0--1,5) diff --git a/tests/service/data/SyntaxTree/Nullness/MatchWithTypeCastParensAndSeparateNullCase.fs.bsl b/tests/service/data/SyntaxTree/Nullness/MatchWithTypeCastParensAndSeparateNullCase.fs.bsl index 2c62cd5cd41..aa2e5f0787c 100644 --- a/tests/service/data/SyntaxTree/Nullness/MatchWithTypeCastParensAndSeparateNullCase.fs.bsl +++ b/tests/service/data/SyntaxTree/Nullness/MatchWithTypeCastParensAndSeparateNullCase.fs.bsl @@ -13,9 +13,9 @@ ImplFile (Paren (WithNull (LongIdent (SynLongIdent ([string], [], [None])), - false, (2,6--2,19)), (2,5--2,20)), (2,2--2,20)), - Null (2,23--2,27), (2,2--2,27), - { BarRange = (2,21--2,22) }), None, + false, (2,6--2,19), { BarRange = (2,13--2,14) }), + (2,5--2,20)), (2,2--2,20)), Null (2,23--2,27), + (2,2--2,27), { BarRange = (2,21--2,22) }), None, Const (Unit, (2,31--2,33)), (2,2--2,33), Yes, { ArrowRange = Some (2,28--2,30) BarRange = Some (2,0--2,1) })], (1,0--2,33), diff --git a/tests/service/data/SyntaxTree/Nullness/NullAnnotatedExpression.fs.bsl b/tests/service/data/SyntaxTree/Nullness/NullAnnotatedExpression.fs.bsl index 0b9c6e0da1f..207a76250e4 100644 --- a/tests/service/data/SyntaxTree/Nullness/NullAnnotatedExpression.fs.bsl +++ b/tests/service/data/SyntaxTree/Nullness/NullAnnotatedExpression.fs.bsl @@ -27,14 +27,18 @@ ImplFile [WithNull (LongIdent (SynLongIdent ([string], [], [None])), - false, (1,24--1,37)); + false, (1,24--1,37), + { BarRange = (1,31--1,32) }); WithNull (LongIdent (SynLongIdent ([T], [], [None])), - false, (1,39--1,47))], [(1,37--1,38)], - Some (1,47--1,48), false, (1,19--1,48)), - false, (1,19--1,55))], [], Some (1,55--1,56), - false, (1,8--1,56)), false, (1,8--1,63)), + false, (1,39--1,47), + { BarRange = (1,41--1,42) })], + [(1,37--1,38)], Some (1,47--1,48), false, + (1,19--1,48)), false, (1,19--1,55), + { BarRange = (1,49--1,50) })], [], + Some (1,55--1,56), false, (1,8--1,56)), false, + (1,8--1,63), { BarRange = (1,57--1,58) }), (1,8--1,63), [], { ColonRange = Some (1,6--1,7) })), Typed (Null (1,66--1,70), @@ -49,13 +53,17 @@ ImplFile [WithNull (LongIdent (SynLongIdent ([string], [], [None])), - false, (1,24--1,37)); + false, (1,24--1,37), + { BarRange = (1,31--1,32) }); WithNull (LongIdent (SynLongIdent ([T], [], [None])), - false, (1,39--1,47))], [(1,37--1,38)], - Some (1,47--1,48), false, (1,19--1,48)), false, - (1,19--1,55))], [], Some (1,55--1,56), false, - (1,8--1,56)), false, (1,8--1,63)), (1,66--1,70)), + false, (1,39--1,47), + { BarRange = (1,41--1,42) })], + [(1,37--1,38)], Some (1,47--1,48), false, + (1,19--1,48)), false, (1,19--1,55), + { BarRange = (1,49--1,50) })], [], + Some (1,55--1,56), false, (1,8--1,56)), false, + (1,8--1,63), { BarRange = (1,57--1,58) }), (1,66--1,70)), (1,4--1,5), Yes (1,0--1,70), { LeadingKeyword = Let (1,0--1,3) InlineKeyword = None diff --git a/tests/service/data/SyntaxTree/Nullness/RegressionAnnotatedInlinePatternMatch.fs.bsl b/tests/service/data/SyntaxTree/Nullness/RegressionAnnotatedInlinePatternMatch.fs.bsl index 54e114c95ab..aaa2b2bafc3 100644 --- a/tests/service/data/SyntaxTree/Nullness/RegressionAnnotatedInlinePatternMatch.fs.bsl +++ b/tests/service/data/SyntaxTree/Nullness/RegressionAnnotatedInlinePatternMatch.fs.bsl @@ -15,7 +15,7 @@ ImplFile Fun (WithNull (LongIdent (SynLongIdent ([string], [], [None])), - false, (2,15--2,28)), + false, (2,15--2,28), { BarRange = (2,22--2,23) }), StaticConstant (String ("456", Regular, (2,32--2,37)), (2,32--2,37)), (2,15--2,37), diff --git a/tests/service/data/SyntaxTree/Nullness/SignatureInAbstractMember.fs.bsl b/tests/service/data/SyntaxTree/Nullness/SignatureInAbstractMember.fs.bsl index 93923eb78f5..f1ba6080294 100644 --- a/tests/service/data/SyntaxTree/Nullness/SignatureInAbstractMember.fs.bsl +++ b/tests/service/data/SyntaxTree/Nullness/SignatureInAbstractMember.fs.bsl @@ -24,12 +24,12 @@ ImplFile (WithNull (LongIdent (SynLongIdent ([string], [], [None])), false, - (2,31--2,44)), + (2,31--2,44), { BarRange = (2,38--2,39) }), WithNull (LongIdent (SynLongIdent ([string], [], [None])), false, - (2,48--2,61)), (2,31--2,61), - { ArrowRange = (2,45--2,47) }), + (2,48--2,61), { BarRange = (2,55--2,56) }), + (2,31--2,61), { ArrowRange = (2,45--2,47) }), SynValInfo ([[SynArgInfo ([], false, None)]], SynArgInfo ([], false, None)), false, false, diff --git a/tests/service/data/SyntaxTree/Nullness/StringOrNull.fs.bsl b/tests/service/data/SyntaxTree/Nullness/StringOrNull.fs.bsl index e803aeedb1f..4e8240dd5fb 100644 --- a/tests/service/data/SyntaxTree/Nullness/StringOrNull.fs.bsl +++ b/tests/service/data/SyntaxTree/Nullness/StringOrNull.fs.bsl @@ -16,13 +16,14 @@ ImplFile (SynBindingReturnInfo (WithNull (LongIdent (SynLongIdent ([string], [], [None])), - false, (1,8--1,21)), (1,8--1,21), [], - { ColonRange = Some (1,6--1,7) })), + false, (1,8--1,21), { BarRange = (1,15--1,16) }), + (1,8--1,21), [], { ColonRange = Some (1,6--1,7) })), Typed (Null (1,24--1,28), WithNull (LongIdent (SynLongIdent ([string], [], [None])), false, - (1,8--1,21)), (1,24--1,28)), (1,4--1,5), Yes (1,0--1,28), + (1,8--1,21), { BarRange = (1,15--1,16) }), (1,24--1,28)), + (1,4--1,5), Yes (1,0--1,28), { LeadingKeyword = Let (1,0--1,3) InlineKeyword = None EqualsRange = Some (1,22--1,23) })], (1,0--1,28))], diff --git a/tests/service/data/SyntaxTree/Nullness/StringOrNullInFunctionArg.fs.bsl b/tests/service/data/SyntaxTree/Nullness/StringOrNullInFunctionArg.fs.bsl index f369e771916..864e6e38365 100644 --- a/tests/service/data/SyntaxTree/Nullness/StringOrNullInFunctionArg.fs.bsl +++ b/tests/service/data/SyntaxTree/Nullness/StringOrNullInFunctionArg.fs.bsl @@ -25,7 +25,8 @@ ImplFile (WithNull (LongIdent (SynLongIdent ([string], [], [None])), - false, (1,16--1,29)), (1,15--1,30)), + false, (1,16--1,29), + { BarRange = (1,23--1,24) }), (1,15--1,30)), (1,12--1,30)), (1,11--1,31))], None, (1,4--1,31)), None, Const (Int32 42, (1,34--1,36)), (1,4--1,31), NoneAtLet, { LeadingKeyword = Let (1,0--1,3) diff --git a/tests/service/data/SyntaxTree/Nullness/TypeAbbreviationAddingWithNull.fs.bsl b/tests/service/data/SyntaxTree/Nullness/TypeAbbreviationAddingWithNull.fs.bsl index 1a874cb67b7..61d17ea291a 100644 --- a/tests/service/data/SyntaxTree/Nullness/TypeAbbreviationAddingWithNull.fs.bsl +++ b/tests/service/data/SyntaxTree/Nullness/TypeAbbreviationAddingWithNull.fs.bsl @@ -15,10 +15,11 @@ ImplFile (Ok, WithNull (LongIdent (SynLongIdent ([string], [], [None])), - false, (1,20--1,33)), (1,20--1,33)), (1,20--1,33)), - [], None, (1,5--1,33), { LeadingKeyword = Type (1,0--1,4) - EqualsRange = Some (1,18--1,19) - WithKeyword = None })], (1,0--1,33))], - PreXmlDocEmpty, [], None, (1,0--1,33), { LeadingKeyword = None })], - (true, true), { ConditionalDirectives = [] - CodeComments = [] }, set [])) + false, (1,20--1,33), { BarRange = (1,27--1,28) }), + (1,20--1,33)), (1,20--1,33)), [], None, (1,5--1,33), + { LeadingKeyword = Type (1,0--1,4) + EqualsRange = Some (1,18--1,19) + WithKeyword = None })], (1,0--1,33))], PreXmlDocEmpty, [], + None, (1,0--1,33), { LeadingKeyword = None })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set []))