Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Compiler/Checking/CheckDeclarations.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4565,7 +4565,7 @@ and TcSignatureElementsMutRec cenv parent typeNames m mutRecNSInfo envInitial (d
| SynModuleSigDecl.Exception (exnSig=SynExceptionSig(exnRepr=exnRepr; withKeyword=withKeyword; members=members)) ->
let ( SynExceptionDefnRepr(synAttrs, SynUnionCase(ident=SynIdent(id,_)), _, xmlDoc, vis, m)) = exnRepr
let compInfo = SynComponentInfo(synAttrs, None, [], [id], xmlDoc, false, vis, id.idRange)
let decls = [ MutRecShape.Tycon(SynTypeDefnSig.SynTypeDefnSig(compInfo, SynTypeDefnSigRepr.Exception exnRepr, members, m, { TypeKeyword = None; WithKeyword = withKeyword; EqualsRange = None })) ]
let decls = [ MutRecShape.Tycon(SynTypeDefnSig.SynTypeDefnSig(compInfo, SynTypeDefnSigRepr.Exception exnRepr, members, m, { LeadingKeyword = SynTypeDefnLeadingKeyword.Synthetic; WithKeyword = withKeyword; EqualsRange = None })) ]
decls, (false, false)

| SynModuleSigDecl.Val (vspec, _) ->
Expand Down
6 changes: 2 additions & 4 deletions src/Compiler/Driver/ParseAndCheckInputs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,7 @@ let PostParseModuleImpl (_i, defaultNamespace, isLastCompiland, fileName, impl)

let trivia: SynModuleOrNamespaceTrivia =
{
ModuleKeyword = None
NamespaceKeyword = None
LeadingKeyword = SynModuleOrNamespaceLeadingKeyword.None
}

SynModuleOrNamespace(modname, false, SynModuleOrNamespaceKind.AnonModule, defs, PreXmlDoc.Empty, [], None, m, trivia)
Expand Down Expand Up @@ -194,8 +193,7 @@ let PostParseModuleSpec (_i, defaultNamespace, isLastCompiland, fileName, intf)

let trivia: SynModuleOrNamespaceSigTrivia =
{
ModuleKeyword = None
NamespaceKeyword = None
LeadingKeyword = SynModuleOrNamespaceLeadingKeyword.None
}

SynModuleOrNamespaceSig(modname, false, SynModuleOrNamespaceKind.AnonModule, defs, PreXmlDoc.Empty, [], None, m, trivia)
Expand Down
2 changes: 1 addition & 1 deletion src/Compiler/Interactive/fsi.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1847,7 +1847,7 @@ type internal FsiDynamicCompiler(
let m = match defs with [] -> rangeStdin0 | _ -> List.reduce unionRanges [for d in defs -> d.Range]
let prefix = mkFragmentPath m i
let prefixPath = pathOfLid prefix
let impl = SynModuleOrNamespace(prefix,false, SynModuleOrNamespaceKind.NamedModule,defs,PreXmlDoc.Empty,[],None,m, { ModuleKeyword = None; NamespaceKeyword = None })
let impl = SynModuleOrNamespace(prefix,false, SynModuleOrNamespaceKind.NamedModule,defs,PreXmlDoc.Empty,[],None,m, { LeadingKeyword = SynModuleOrNamespaceLeadingKeyword.None })
let isLastCompiland = true
let isExe = false
let input = ParsedInput.ImplFile (ParsedImplFileInput (fileName,true, ComputeQualifiedNameOfFileFromUniquePath (m,prefixPath),[],[],[impl],(isLastCompiland, isExe), { ConditionalDirectives = []; CodeComments = [] }))
Expand Down
27 changes: 19 additions & 8 deletions src/Compiler/SyntaxTree/SyntaxTrivia.fs
Original file line number Diff line number Diff line change
Expand Up @@ -125,32 +125,39 @@ type SynPatOrTrivia = { BarRange: range }
[<NoEquality; NoComparison>]
type SynPatListConsTrivia = { ColonColonRange: range }

[<NoEquality; NoComparison; RequireQualifiedAccess>]
type SynTypeDefnLeadingKeyword =
| Type of range
| And of range
| StaticType of staticRange: range * typeRange: range
| Synthetic

[<NoEquality; NoComparison>]
type SynTypeDefnTrivia =
{
TypeKeyword: range option
LeadingKeyword: SynTypeDefnLeadingKeyword
EqualsRange: range option
WithKeyword: range option
}

static member Zero: SynTypeDefnTrivia =
{
TypeKeyword = None
LeadingKeyword = SynTypeDefnLeadingKeyword.Synthetic
EqualsRange = None
WithKeyword = None
}

[<NoEquality; NoComparison>]
type SynTypeDefnSigTrivia =
{
TypeKeyword: range option
LeadingKeyword: SynTypeDefnLeadingKeyword
EqualsRange: range option
WithKeyword: range option
}

static member Zero: SynTypeDefnSigTrivia =
{
TypeKeyword = None
LeadingKeyword = SynTypeDefnLeadingKeyword.Synthetic
EqualsRange = None
WithKeyword = None
}
Expand Down Expand Up @@ -259,18 +266,22 @@ type SynModuleSigDeclNestedModuleTrivia =
EqualsRange = None
}

[<NoEquality; NoComparison; RequireQualifiedAccess>]
type SynModuleOrNamespaceLeadingKeyword =
| Module of moduleRange: range
| Namespace of namespaceRange: range
| None

[<NoEquality; NoComparison>]
type SynModuleOrNamespaceTrivia =
{
ModuleKeyword: range option
NamespaceKeyword: range option
LeadingKeyword: SynModuleOrNamespaceLeadingKeyword
}

[<NoEquality; NoComparison>]
type SynModuleOrNamespaceSigTrivia =
{
ModuleKeyword: range option
NamespaceKeyword: range option
LeadingKeyword: SynModuleOrNamespaceLeadingKeyword
}

[<NoEquality; NoComparison>]
Expand Down
38 changes: 24 additions & 14 deletions src/Compiler/SyntaxTree/SyntaxTrivia.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,21 @@ type SynPatListConsTrivia =
ColonColonRange: range
}

/// Represents the leading keyword in a SynTypeDefn or SynTypeDefnSig
[<NoEquality; NoComparison; RequireQualifiedAccess>]
type SynTypeDefnLeadingKeyword =
| Type of range
| And of range
// Can happen in SynMemberDefn.NestedType or SynMemberSig.NestedType
| StaticType of staticRange: range * typeRange: range
| Synthetic

/// Represents additional information for SynTypeDefn
[<NoEquality; NoComparison>]
type SynTypeDefnTrivia =
{
/// The syntax range of the `type` keyword.
TypeKeyword: range option
/// The syntax range of the `type` or `and` keyword.
LeadingKeyword: SynTypeDefnLeadingKeyword

/// The syntax range of the `=` token.
EqualsRange: range option
Expand All @@ -227,8 +236,8 @@ type SynTypeDefnTrivia =
[<NoEquality; NoComparison>]
type SynTypeDefnSigTrivia =
{
/// The syntax range of the `type` keyword.
TypeKeyword: range option
/// The syntax range of the `type` or `and` keyword.
LeadingKeyword: SynTypeDefnLeadingKeyword

/// The syntax range of the `=` token.
EqualsRange: range option
Expand Down Expand Up @@ -321,26 +330,27 @@ type SynModuleSigDeclNestedModuleTrivia =

static member Zero: SynModuleSigDeclNestedModuleTrivia

/// Represents the leading keyword in a SynModuleOrNamespace or SynModuleOrNamespaceSig
[<NoEquality; NoComparison; RequireQualifiedAccess>]
type SynModuleOrNamespaceLeadingKeyword =
| Module of moduleRange: range
| Namespace of namespaceRange: range
| None

/// Represents additional information for SynModuleOrNamespace
[<NoEquality; NoComparison>]
type SynModuleOrNamespaceTrivia =
{
/// The syntax range of the `module` keyword
ModuleKeyword: range option

/// The syntax range of the `namespace` keyword
NamespaceKeyword: range option
/// The syntax range of the `module` or `namespace` keyword
LeadingKeyword: SynModuleOrNamespaceLeadingKeyword
}

/// Represents additional information for SynModuleOrNamespaceSig
[<NoEquality; NoComparison>]
type SynModuleOrNamespaceSigTrivia =
{
/// The syntax range of the `module` keyword
ModuleKeyword: range option

/// The syntax range of the `namespace` keyword
NamespaceKeyword: range option
/// The syntax range of the `module` or `namespace` keyword
LeadingKeyword: SynModuleOrNamespaceLeadingKeyword
}

/// Represents additional information for SynValSig
Expand Down
Loading