diff --git a/src/fsharp/CheckFormatStrings.fs b/src/fsharp/CheckFormatStrings.fs
index 703de5ff167..f4be062b8bf 100644
--- a/src/fsharp/CheckFormatStrings.fs
+++ b/src/fsharp/CheckFormatStrings.fs
@@ -76,7 +76,7 @@ let parseFormatStringInternal (m: range) (fragRanges: range list) (g: TcGlobals)
// Note this also means that when compiling (command-line or background IncrementalBuilder in the IDE
// there are no accurate intra-string ranges available for exact error message locations within the string.
// The 'm' range passed as an input is however accurate and covers the whole string.
- ///
+ //
let fmt, fragments =
//printfn "--------------------"
diff --git a/src/fsharp/DependencyManager/DependencyProvider.fsi b/src/fsharp/DependencyManager/DependencyProvider.fsi
index 3cfc94d1edf..097ccd4a883 100644
--- a/src/fsharp/DependencyManager/DependencyProvider.fsi
+++ b/src/fsharp/DependencyManager/DependencyProvider.fsi
@@ -1,6 +1,6 @@
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-/// Helper members to integrate DependencyManagers into F# codebase
+// Helper members to integrate DependencyManagers into F# codebase
namespace FSharp.Compiler.DependencyManager
open System.Runtime.InteropServices
diff --git a/src/fsharp/FSharp.Core/SI.fs b/src/fsharp/FSharp.Core/SI.fs
index 10a0798445c..83791bfa85b 100644
--- a/src/fsharp/FSharp.Core/SI.fs
+++ b/src/fsharp/FSharp.Core/SI.fs
@@ -1,6 +1,6 @@
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
-/// The International System of Units (SI)
+// The International System of Units (SI)
namespace Microsoft.FSharp.Data.UnitSystems.SI.UnitNames
open Microsoft.FSharp.Core
@@ -113,7 +113,7 @@ namespace Microsoft.FSharp.Data.UnitSystems.SI.UnitNames
type katal = mole/second
-/// Common abbreviations for the International System of Units (SI)
+// Common abbreviations for the International System of Units (SI)
namespace Microsoft.FSharp.Data.UnitSystems.SI.UnitSymbols
open Microsoft.FSharp.Core
open Microsoft.FSharp.Data.UnitSystems.SI.UnitNames
diff --git a/src/fsharp/FSharp.Core/collections.fsi b/src/fsharp/FSharp.Core/collections.fsi
index 5c374b3ec5e..67c251c38c8 100644
--- a/src/fsharp/FSharp.Core/collections.fsi
+++ b/src/fsharp/FSharp.Core/collections.fsi
@@ -1,7 +1,6 @@
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
-/// This namespace contains some common collections in a style primarily designed for use from F#.
-
+// This namespace contains some common collections in a style primarily designed for use from F#.
namespace Microsoft.FSharp.Collections
open Microsoft.FSharp.Core
diff --git a/src/fsharp/FSharp.Core/fslib-extra-pervasives.fsi b/src/fsharp/FSharp.Core/fslib-extra-pervasives.fsi
index e65c8df0610..29915a1b5ba 100644
--- a/src/fsharp/FSharp.Core/fslib-extra-pervasives.fsi
+++ b/src/fsharp/FSharp.Core/fslib-extra-pervasives.fsi
@@ -1,6 +1,6 @@
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
-/// Pervasives: Additional bindings available at the top level
+// Pervasives: Additional bindings available at the top level
namespace Microsoft.FSharp.Core
/// A set of extra operators and functions. This module is automatically opened in all F# code.
diff --git a/src/fsharp/FSharp.Core/local.fsi b/src/fsharp/FSharp.Core/local.fsi
index 2c9996d4f11..b3ac9ec4006 100644
--- a/src/fsharp/FSharp.Core/local.fsi
+++ b/src/fsharp/FSharp.Core/local.fsi
@@ -17,7 +17,7 @@ module internal DetailedExceptions =
val invalidArgDifferentArrayLength: arg1:string -> len1:int -> arg2:string -> len2:int -> _
val invalidArg3ArraysDifferent: arg1:string -> arg2:string -> arg3:string -> len1:int -> len2:int -> len3:int -> _
-/// Definitions internal for this library.
+// Definitions internal for this library.
namespace Microsoft.FSharp.Primitives.Basics
open Microsoft.FSharp.Core
diff --git a/src/fsharp/FSharp.Core/prim-types-prelude.fsi b/src/fsharp/FSharp.Core/prim-types-prelude.fsi
index d09a9d1d461..1704a18e75f 100644
--- a/src/fsharp/FSharp.Core/prim-types-prelude.fsi
+++ b/src/fsharp/FSharp.Core/prim-types-prelude.fsi
@@ -4,7 +4,7 @@
#nowarn "61" // The containing type can use null as a representation value for its nullary union case. This member will be compiled as a static member.
#nowarn "62" // This construct is for ML compatibility. The syntax module ... : sig .. end is deprecated unless OCaml compatibility is enabled. Consider using module ... = begin .. end'.
-/// Basic F# type definitions, functions and operators.
+// Basic F# type definitions, functions and operators.
namespace Microsoft.FSharp.Core
open System
diff --git a/src/fsharp/FSharp.Core/prim-types.fs b/src/fsharp/FSharp.Core/prim-types.fs
index db6a2f7620f..bef9923e35b 100644
--- a/src/fsharp/FSharp.Core/prim-types.fs
+++ b/src/fsharp/FSharp.Core/prim-types.fs
@@ -2319,7 +2319,7 @@ namespace Microsoft.FSharp.Core
// 0oOOOOOOO
// -0oOOOOOOO
// without leading/trailing spaces.
- ///
+ //
// Note: Parse defaults to NumberStyles.Integer = AllowLeadingWhite ||| AllowTrailingWhite ||| AllowLeadingSign
// However, that is not the required behaviour of 'int32', 'int64' etc. when used on string
// arguments: we explicitly disallow AllowLeadingWhite ||| AllowTrailingWhite
diff --git a/src/fsharp/FSharp.Core/prim-types.fsi b/src/fsharp/FSharp.Core/prim-types.fsi
index b14bd33e17c..34babecc2ed 100644
--- a/src/fsharp/FSharp.Core/prim-types.fsi
+++ b/src/fsharp/FSharp.Core/prim-types.fsi
@@ -3,7 +3,7 @@
#nowarn "35" // This construct is deprecated: the treatment of this operator is now handled directly by the F# compiler and its meaning may not be redefined.
#nowarn "61" // The containing type can use 'null' as a representation value for its nullary union case. This member will be compiled as a static member.
-/// Basic F# type definitions, functions and operators
+// Basic F# type definitions, functions and operators
namespace Microsoft.FSharp.Core
open System
diff --git a/src/fsharp/FSharp.Core/printf.fsi b/src/fsharp/FSharp.Core/printf.fsi
index 8564c75a25d..e496e3d361f 100644
--- a/src/fsharp/FSharp.Core/printf.fsi
+++ b/src/fsharp/FSharp.Core/printf.fsi
@@ -1,6 +1,6 @@
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
-/// This namespace contains types and modules for generating and formatting text with F#
+// This namespace contains types and modules for generating and formatting text with F#
namespace Microsoft.FSharp.Core
open Microsoft.FSharp.Core
diff --git a/src/fsharp/FSharp.Core/quotations.fsi b/src/fsharp/FSharp.Core/quotations.fsi
index 2e7623b6ce4..c2dc915c9ba 100644
--- a/src/fsharp/FSharp.Core/quotations.fsi
+++ b/src/fsharp/FSharp.Core/quotations.fsi
@@ -1,6 +1,6 @@
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
-/// Types and functions related to expression quotations
+// Types and functions related to expression quotations
namespace Microsoft.FSharp.Quotations
open Microsoft.FSharp.Core
diff --git a/src/fsharp/FSharp.Core/reflect.fsi b/src/fsharp/FSharp.Core/reflect.fsi
index 88017d1f37a..d083cecb50b 100644
--- a/src/fsharp/FSharp.Core/reflect.fsi
+++ b/src/fsharp/FSharp.Core/reflect.fsi
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
-/// This namespace contains constructs for reflecting on the representation of
-/// F# values and types. It augments the design of System.Reflection.
+// This namespace contains constructs for reflecting on the representation of
+// F# values and types. It augments the design of System.Reflection.
namespace Microsoft.FSharp.Reflection
open System
diff --git a/src/fsharp/FSharp.Core/tasks.fsi b/src/fsharp/FSharp.Core/tasks.fsi
index 1daa50523a3..b32cd287316 100644
--- a/src/fsharp/FSharp.Core/tasks.fsi
+++ b/src/fsharp/FSharp.Core/tasks.fsi
@@ -164,7 +164,7 @@ namespace Microsoft.FSharp.Control
val backgroundTask: BackgroundTaskBuilder
-/// Contains the `task` computation expression builder.
+// Contains the `task` computation expression builder.
namespace Microsoft.FSharp.Control.TaskBuilderExtensions
open System
diff --git a/src/fsharp/TextLayoutRender.fsi b/src/fsharp/TextLayoutRender.fsi
index f2d71063e8a..4d8b5415e04 100644
--- a/src/fsharp/TextLayoutRender.fsi
+++ b/src/fsharp/TextLayoutRender.fsi
@@ -1,6 +1,6 @@
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
-/// DSL to create structured layout objects with optional breaks and render them
+// DSL to create structured layout objects with optional breaks and render them
namespace FSharp.Compiler.Text
open System.Text
diff --git a/src/fsharp/TypedTreePickle.fs b/src/fsharp/TypedTreePickle.fs
index 13e1bb3f88d..098894cede6 100644
--- a/src/fsharp/TypedTreePickle.fs
+++ b/src/fsharp/TypedTreePickle.fs
@@ -680,7 +680,7 @@ let u_lazy u st =
let res =
lazy (let st = { st with is = st.is.CloneAndSeek idx1 }
u st)
- /// Force the reading of the data as a "tripwire" for each of the OSGN thunks
+ // Force the reading of the data as a "tripwire" for each of the OSGN thunks
for i = otyconsIdx1 to otyconsIdx2-1 do wire (st.ientities.Get i) res done
for i = ovalsIdx1 to ovalsIdx2-1 do wire (st.ivals.Get i) res done
for i = otyparsIdx1 to otyparsIdx2-1 do wire (st.itypars.Get i) res done
diff --git a/src/fsharp/fsiaux.fsi b/src/fsharp/fsiaux.fsi
index a225e48e7aa..715a346f6d0 100644
--- a/src/fsharp/fsiaux.fsi
+++ b/src/fsharp/fsiaux.fsi
@@ -19,8 +19,8 @@ namespace FSharp.Compiler.Interactive
/// Schedule a restart for the event loop.
abstract ScheduleRestart : unit -> unit
+ /// Operations supported by the currently executing F# Interactive session.
[]
- /// Operations supported by the currently executing F# Interactive session.
type InteractiveSession =
/// Get or set the floating point format used in the output of the interactive session.
diff --git a/src/fsharp/infos.fsi b/src/fsharp/infos.fsi
index 30a96aeb08a..44e9bff3053 100644
--- a/src/fsharp/infos.fsi
+++ b/src/fsharp/infos.fsi
@@ -432,7 +432,7 @@ type MethInfo =
member ImplementedSlotSignatures: SlotSig list
// Is this particular MethInfo one that doesn't provide an implementation?
- ///
+ //
// For F# methods, this is 'true' for the MethInfos corresponding to 'abstract' declarations,
// and false for the (potentially) matching 'default' implementation MethInfos that eventually
// provide an implementation for the dispatch slot.
diff --git a/src/fsharp/pars.fsy b/src/fsharp/pars.fsy
index e7ea83caa78..3c9c1ad93f5 100644
--- a/src/fsharp/pars.fsy
+++ b/src/fsharp/pars.fsy
@@ -754,7 +754,8 @@ fileModuleSpec:
| _ ->
let lastDeclRange = List.tryLast $1 |> Option.map (fun decl -> decl.Range) |> Option.defaultValue (rhs parseState 1)
let m = mkRange lastDeclRange.FileName (lhs parseState).Start lastDeclRange.End
- ParsedSigFileFragment.NamespaceFragment(path, isRec, SynModuleOrNamespaceKind.DeclaredNamespace, $1, xml, [], m)) }
+ xml.MarkAsInvalid()
+ ParsedSigFileFragment.NamespaceFragment(path, isRec, SynModuleOrNamespaceKind.DeclaredNamespace, $1, PreXmlDoc.Empty, [], m)) }
moduleSpfnsPossiblyEmptyBlock:
@@ -1242,7 +1243,8 @@ fileModuleImpl:
| _ ->
let lastDeclRange = List.tryLast $1 |> Option.map (fun decl -> decl.Range) |> Option.defaultValue (rhs parseState 1)
let m = mkRange lastDeclRange.FileName (lhs parseState).Start lastDeclRange.End
- ParsedImplFileFragment.NamespaceFragment(path, isRec, SynModuleOrNamespaceKind.DeclaredNamespace, $1, xml, [], m)) }
+ xml.MarkAsInvalid()
+ ParsedImplFileFragment.NamespaceFragment(path, isRec, SynModuleOrNamespaceKind.DeclaredNamespace, $1, PreXmlDoc.Empty, [], m)) }
/* A collection/block of definitions or expressions making up a module or namespace, possibly empty */
@@ -2120,7 +2122,8 @@ classDefnMember:
| opt_attributes opt_declVisibility NEW atomicPattern optAsSpec EQUALS typedSequentialExprBlock opt_ODECLEND
{ let mWholeBindLhs = rhs2 parseState 1 (if Option.isSome $5 then 5 else 4)
- let m = unionRanges mWholeBindLhs $7.Range
+ let xmlDoc = grabXmlDoc(parseState, $1, 1)
+ let m = unionRanges mWholeBindLhs $7.Range |> unionRangeWithXmlDoc xmlDoc
let mEquals = rhs parseState 6
let expr = $7
let valSynData = SynValData (Some (CtorMemberFlags SynMemberFlagsTrivia.Zero), SynValInfo([SynInfo.InferSynArgInfoFromPat $4], SynInfo.unnamedRetVal), $5)
@@ -2129,7 +2132,7 @@ classDefnMember:
// Check that 'SynPatForConstructorDecl' matches this correctly
assert (match declPat with SynPatForConstructorDecl _ -> true | _ -> false)
let synBindingTrivia: SynBindingTrivia = { LetKeyword = None; EqualsRange = Some mEquals }
- [ SynMemberDefn.Member(SynBinding (None, SynBindingKind.Normal, false, false, $1, grabXmlDoc(parseState, $1, 1), valSynData, declPat, None, expr, mWholeBindLhs, DebugPointAtBinding.NoneAtInvisible, synBindingTrivia), m) ] }
+ [ SynMemberDefn.Member(SynBinding (None, SynBindingKind.Normal, false, false, $1, xmlDoc, valSynData, declPat, None, expr, mWholeBindLhs, DebugPointAtBinding.NoneAtInvisible, synBindingTrivia), m) ] }
| opt_attributes opt_declVisibility STATIC typeKeyword tyconDefn
{ if Option.isSome $2 then errorR(Error(FSComp.SR.parsVisibilityDeclarationsShouldComePriorToIdentifier(), rhs parseState 2))
diff --git a/src/fsharp/range.fs b/src/fsharp/range.fs
index 46ed09e6262..0daf4c01d24 100755
--- a/src/fsharp/range.fs
+++ b/src/fsharp/range.fs
@@ -1,6 +1,6 @@
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
-/// Anything to do with special names of identifiers and other lexical rules
+// Anything to do with special names of identifiers and other lexical rules
namespace FSharp.Compiler.Text
open System
diff --git a/src/fsharp/range.fsi b/src/fsharp/range.fsi
index b4e00434789..5f1c139c4f1 100755
--- a/src/fsharp/range.fsi
+++ b/src/fsharp/range.fsi
@@ -1,6 +1,6 @@
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
-/// The Range and Pos types form part of the public API of FSharp.Compiler.Service
+// The Range and Pos types form part of the public API of FSharp.Compiler.Service
namespace FSharp.Compiler.Text
open System.Collections.Generic
diff --git a/src/fsharp/service/ServiceDeclarationLists.fsi b/src/fsharp/service/ServiceDeclarationLists.fsi
index 508e7297529..7e55928419f 100644
--- a/src/fsharp/service/ServiceDeclarationLists.fsi
+++ b/src/fsharp/service/ServiceDeclarationLists.fsi
@@ -1,6 +1,6 @@
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
-/// API for declaration lists and method overload lists
+// API for declaration lists and method overload lists
namespace FSharp.Compiler.EditorServices
open FSharp.Compiler.NameResolution
diff --git a/src/fsharp/service/service.fsi b/src/fsharp/service/service.fsi
index a841cdcbc3b..c27fc86ca3f 100644
--- a/src/fsharp/service/service.fsi
+++ b/src/fsharp/service/service.fsi
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
-/// SourceCodeServices API to the compiler as an incremental service for parsing,
-/// type checking and intellisense-like environment-reporting.
+// SourceCodeServices API to the compiler as an incremental service for parsing,
+// type checking and intellisense-like environment-reporting.
namespace FSharp.Compiler.CodeAnalysis
open System
diff --git a/src/fsharp/utils/PathMap.fs b/src/fsharp/utils/PathMap.fs
index 906c3831e6d..29a391e3737 100644
--- a/src/fsharp/utils/PathMap.fs
+++ b/src/fsharp/utils/PathMap.fs
@@ -1,6 +1,6 @@
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
-/// Functions to map real paths to paths to be written to PDB/IL
+// Functions to map real paths to paths to be written to PDB/IL
namespace Internal.Utilities
open System
diff --git a/src/fsharp/utils/PathMap.fsi b/src/fsharp/utils/PathMap.fsi
index 061b623c53d..53d354f92d9 100644
--- a/src/fsharp/utils/PathMap.fsi
+++ b/src/fsharp/utils/PathMap.fsi
@@ -1,6 +1,6 @@
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
-/// Functions to map real paths to paths to be written to PDB/IL
+// Functions to map real paths to paths to be written to PDB/IL
namespace Internal.Utilities
type internal PathMap
diff --git a/src/fsharp/utils/TaggedCollections.fsi b/src/fsharp/utils/TaggedCollections.fsi
index 323324c719d..25552d0d92c 100644
--- a/src/fsharp/utils/TaggedCollections.fsi
+++ b/src/fsharp/utils/TaggedCollections.fsi
@@ -1,6 +1,6 @@
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
-/// This namespace contains FSharp.PowerPack extensions for the F# collection types
+// This namespace contains FSharp.PowerPack extensions for the F# collection types
namespace Internal.Utilities.Collections.Tagged
open System
diff --git a/tests/fsharp/Compiler/Service/SignatureGenerationTests.fs b/tests/fsharp/Compiler/Service/SignatureGenerationTests.fs
index 5807c51b644..765eab42fe4 100644
--- a/tests/fsharp/Compiler/Service/SignatureGenerationTests.fs
+++ b/tests/fsharp/Compiler/Service/SignatureGenerationTests.fs
@@ -40,7 +40,6 @@ module SignatureGenerationTests =
[]
let ``can generate sigs with comments`` () =
"""
-/// namespace comments
namespace Sample
/// exception comments
diff --git a/tests/service/XmlDocTests.fs b/tests/service/XmlDocTests.fs
index fe5c8acdf44..5fcb4bc6913 100644
--- a/tests/service/XmlDocTests.fs
+++ b/tests/service/XmlDocTests.fs
@@ -940,7 +940,7 @@ type A ///CTOR1
failwith $"Unexpected ParsedInput %A{x}"
[]
-let ``type members 07 - explicit ctor``(): unit =
+let ``type members 07 - explicit ctor signature``(): unit =
let parseResults, checkResults = getParseAndCheckResultsOfSignatureFile """
module Test
@@ -963,6 +963,29 @@ type A =
| x ->
failwith $"Unexpected ParsedInput %A{x}"
+[]
+let ``type members 08 - explicit ctor definition``(): unit =
+ let parseResults, checkResults = getParseAndCheckResults """
+type A =
+ ///ctor
+ new() = ()
+"""
+ checkResults
+ |> checkXmls [
+ "A", [||]
+ ".ctor", [|"ctor"|]
+ ]
+
+ parseResults
+ |> checkParsingErrors [||]
+
+ match parseResults.ParseTree with
+ | Members([SynMemberDefn.Member(range = range)]) ->
+ assertRange (3, 4) (4, 14) range
+ | x ->
+ failwith $"Unexpected ParsedInput %A{x}"
+
+
[]
let record(): unit =
checkSignatureAndImplementation """
@@ -1327,6 +1350,24 @@ val a: int
| x ->
failwith $"Unexpected ParsedInput %A{x}"
+[]
+let ``namespace 01``(): unit =
+ checkSignatureAndImplementation """
+///N
+namespace N
+"""
+ (checkXml "N" [||])
+ (fun parseResults ->
+ parseResults |>
+ checkParsingErrors [|Information 3520, Line 2, Col 0, Line 2, Col 4, "XML comment is not placed on a valid language element."|]
+
+ match parseResults.ParseTree with
+ | ParsedInput.ImplFile(ParsedImplFileInput(modules = [SynModuleOrNamespace.SynModuleOrNamespace(range = range)]))
+ | ParsedInput.SigFile(ParsedSigFileInput(modules = [SynModuleOrNamespaceSig.SynModuleOrNamespaceSig(range = range)])) ->
+ assertRange (3, 0) (3, 11) range
+ | x ->
+ failwith $"Unexpected ParsedInput %A{x}")
+
[]
let ``Verify that OCaml style xml-doc are gone (i.e. treated as regular comments)``(): unit =
let parseResults, checkResults = getParseAndCheckResultsOfSignatureFile """
diff --git a/tests/service/data/TestTP/ProvidedTypes.fsi b/tests/service/data/TestTP/ProvidedTypes.fsi
index 935f1cd5634..6f56c2e4e31 100644
--- a/tests/service/data/TestTP/ProvidedTypes.fsi
+++ b/tests/service/data/TestTP/ProvidedTypes.fsi
@@ -394,8 +394,8 @@ type ProvidedAssembly =
#endif
-[]
/// Represents the context for which code is to be generated. Normally you should not need to use this directly.
+[]
type ProvidedTypesContext =
/// Try to find the given target assembly in the context