Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make FCS compatible with Fantomas. #16474

Closed
wants to merge 1 commit into from
Closed
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
11 changes: 9 additions & 2 deletions src/Compiler/Service/FSharpCheckerResults.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2392,6 +2392,7 @@ type FSharpParsingOptions =
StrictIndentation: bool option
CompilingFSharpCore: bool
IsExe: bool
OnlyUseSpecifiedDefines: bool
}

member x.LastFileName =
Expand All @@ -2410,6 +2411,7 @@ type FSharpParsingOptions =
StrictIndentation = None
CompilingFSharpCore = false
IsExe = false
OnlyUseSpecifiedDefines = false
}

static member FromTcConfig(tcConfig: TcConfig, sourceFiles, isInteractive: bool) =
Expand All @@ -2424,6 +2426,7 @@ type FSharpParsingOptions =
StrictIndentation = tcConfig.strictIndentation
CompilingFSharpCore = tcConfig.compilingFSharpCore
IsExe = tcConfig.target.IsExe
OnlyUseSpecifiedDefines = false
}

static member FromTcConfigBuilder(tcConfigB: TcConfigBuilder, sourceFiles, isInteractive: bool) =
Expand All @@ -2438,6 +2441,7 @@ type FSharpParsingOptions =
StrictIndentation = tcConfigB.strictIndentation
CompilingFSharpCore = tcConfigB.compilingFSharpCore
IsExe = tcConfigB.target.IsExe
OnlyUseSpecifiedDefines = false
}

module internal ParseAndCheckFile =
Expand Down Expand Up @@ -2550,8 +2554,11 @@ module internal ParseAndCheckFile =
// If we're editing a script then we define INTERACTIVE otherwise COMPILED.
// Since this parsing for intellisense we always define EDITING.
let conditionalDefines =
SourceFileImpl.GetImplicitConditionalDefinesForEditing options.IsInteractive
@ options.ConditionalDefines
[
if not options.OnlyUseSpecifiedDefines then
yield! SourceFileImpl.GetImplicitConditionalDefinesForEditing options.IsInteractive
yield! options.ConditionalDefines
]

// Note: we don't really attempt to intern strings across a large scope.
let lexResourceManager = LexResourceManager()
Expand Down
4 changes: 4 additions & 0 deletions src/Compiler/Service/FSharpCheckerResults.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,10 @@ type public FSharpParsingOptions =
CompilingFSharpCore: bool

IsExe: bool

/// Don't pass in any other conditional defines other than specified in the parsing options.
/// This avoid the passing `COMPILED` or `INTERACTIVE`.
OnlyUseSpecifiedDefines: bool
}

static member Default: FSharpParsingOptions
Expand Down
2 changes: 1 addition & 1 deletion src/Compiler/SyntaxTree/PrettyNaming.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ val internal isTildeOnlyString: s: string -> bool

val internal IsValidPrefixOperatorUse: s: string -> bool

val internal IsValidPrefixOperatorDefinitionName: s: string -> bool
val IsValidPrefixOperatorDefinitionName: s: string -> bool

val IsLogicalPrefixOperator: logicalName: string -> bool

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2118,10 +2118,12 @@ FSharp.Compiler.CodeAnalysis.FSharpParsingOptions: Boolean Equals(System.Object)
FSharp.Compiler.CodeAnalysis.FSharpParsingOptions: Boolean Equals(System.Object, System.Collections.IEqualityComparer)
FSharp.Compiler.CodeAnalysis.FSharpParsingOptions: Boolean IsExe
FSharp.Compiler.CodeAnalysis.FSharpParsingOptions: Boolean IsInteractive
FSharp.Compiler.CodeAnalysis.FSharpParsingOptions: Boolean OnlyUseSpecifiedDefines
FSharp.Compiler.CodeAnalysis.FSharpParsingOptions: Boolean get_ApplyLineDirectives()
FSharp.Compiler.CodeAnalysis.FSharpParsingOptions: Boolean get_CompilingFSharpCore()
FSharp.Compiler.CodeAnalysis.FSharpParsingOptions: Boolean get_IsExe()
FSharp.Compiler.CodeAnalysis.FSharpParsingOptions: Boolean get_IsInteractive()
FSharp.Compiler.CodeAnalysis.FSharpParsingOptions: Boolean get_OnlyUseSpecifiedDefines()
FSharp.Compiler.CodeAnalysis.FSharpParsingOptions: FSharp.Compiler.CodeAnalysis.FSharpParsingOptions Default
FSharp.Compiler.CodeAnalysis.FSharpParsingOptions: FSharp.Compiler.CodeAnalysis.FSharpParsingOptions get_Default()
FSharp.Compiler.CodeAnalysis.FSharpParsingOptions: FSharp.Compiler.Diagnostics.FSharpDiagnosticOptions DiagnosticOptions
Expand All @@ -2142,7 +2144,7 @@ FSharp.Compiler.CodeAnalysis.FSharpParsingOptions: System.String ToString()
FSharp.Compiler.CodeAnalysis.FSharpParsingOptions: System.String get_LangVersionText()
FSharp.Compiler.CodeAnalysis.FSharpParsingOptions: System.String[] SourceFiles
FSharp.Compiler.CodeAnalysis.FSharpParsingOptions: System.String[] get_SourceFiles()
FSharp.Compiler.CodeAnalysis.FSharpParsingOptions: Void .ctor(System.String[], Boolean, Microsoft.FSharp.Collections.FSharpList`1[System.String], FSharp.Compiler.Diagnostics.FSharpDiagnosticOptions, System.String, Boolean, Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Boolean, Boolean)
FSharp.Compiler.CodeAnalysis.FSharpParsingOptions: Void .ctor(System.String[], Boolean, Microsoft.FSharp.Collections.FSharpList`1[System.String], FSharp.Compiler.Diagnostics.FSharpDiagnosticOptions, System.String, Boolean, Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Boolean, Boolean, Boolean)
FSharp.Compiler.CodeAnalysis.FSharpProjectContext: FSharp.Compiler.CodeAnalysis.FSharpProjectOptions ProjectOptions
FSharp.Compiler.CodeAnalysis.FSharpProjectContext: FSharp.Compiler.CodeAnalysis.FSharpProjectOptions get_ProjectOptions()
FSharp.Compiler.CodeAnalysis.FSharpProjectContext: FSharp.Compiler.Symbols.FSharpAccessibilityRights AccessibilityRights
Expand Down Expand Up @@ -5918,6 +5920,7 @@ FSharp.Compiler.Syntax.PrettyNaming: Boolean IsLogicalTernaryOperator(System.Str
FSharp.Compiler.Syntax.PrettyNaming: Boolean IsLongIdentifierPartCharacter(Char)
FSharp.Compiler.Syntax.PrettyNaming: Boolean IsOperatorDisplayName(System.String)
FSharp.Compiler.Syntax.PrettyNaming: Boolean IsPunctuation(System.String)
FSharp.Compiler.Syntax.PrettyNaming: Boolean IsValidPrefixOperatorDefinitionName(System.String)
FSharp.Compiler.Syntax.PrettyNaming: Microsoft.FSharp.Collections.FSharpList`1[System.String] GetLongNameFromString(System.String)
FSharp.Compiler.Syntax.PrettyNaming: Microsoft.FSharp.Core.FSharpOption`1[System.String] TryChopPropertyName(System.String)
FSharp.Compiler.Syntax.PrettyNaming: System.String CompileOpName(System.String)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2118,10 +2118,12 @@ FSharp.Compiler.CodeAnalysis.FSharpParsingOptions: Boolean Equals(System.Object)
FSharp.Compiler.CodeAnalysis.FSharpParsingOptions: Boolean Equals(System.Object, System.Collections.IEqualityComparer)
FSharp.Compiler.CodeAnalysis.FSharpParsingOptions: Boolean IsExe
FSharp.Compiler.CodeAnalysis.FSharpParsingOptions: Boolean IsInteractive
FSharp.Compiler.CodeAnalysis.FSharpParsingOptions: Boolean OnlyUseSpecifiedDefines
FSharp.Compiler.CodeAnalysis.FSharpParsingOptions: Boolean get_ApplyLineDirectives()
FSharp.Compiler.CodeAnalysis.FSharpParsingOptions: Boolean get_CompilingFSharpCore()
FSharp.Compiler.CodeAnalysis.FSharpParsingOptions: Boolean get_IsExe()
FSharp.Compiler.CodeAnalysis.FSharpParsingOptions: Boolean get_IsInteractive()
FSharp.Compiler.CodeAnalysis.FSharpParsingOptions: Boolean get_OnlyUseSpecifiedDefines()
FSharp.Compiler.CodeAnalysis.FSharpParsingOptions: FSharp.Compiler.CodeAnalysis.FSharpParsingOptions Default
FSharp.Compiler.CodeAnalysis.FSharpParsingOptions: FSharp.Compiler.CodeAnalysis.FSharpParsingOptions get_Default()
FSharp.Compiler.CodeAnalysis.FSharpParsingOptions: FSharp.Compiler.Diagnostics.FSharpDiagnosticOptions DiagnosticOptions
Expand All @@ -2142,7 +2144,7 @@ FSharp.Compiler.CodeAnalysis.FSharpParsingOptions: System.String ToString()
FSharp.Compiler.CodeAnalysis.FSharpParsingOptions: System.String get_LangVersionText()
FSharp.Compiler.CodeAnalysis.FSharpParsingOptions: System.String[] SourceFiles
FSharp.Compiler.CodeAnalysis.FSharpParsingOptions: System.String[] get_SourceFiles()
FSharp.Compiler.CodeAnalysis.FSharpParsingOptions: Void .ctor(System.String[], Boolean, Microsoft.FSharp.Collections.FSharpList`1[System.String], FSharp.Compiler.Diagnostics.FSharpDiagnosticOptions, System.String, Boolean, Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Boolean, Boolean)
FSharp.Compiler.CodeAnalysis.FSharpParsingOptions: Void .ctor(System.String[], Boolean, Microsoft.FSharp.Collections.FSharpList`1[System.String], FSharp.Compiler.Diagnostics.FSharpDiagnosticOptions, System.String, Boolean, Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Boolean, Boolean, Boolean)
FSharp.Compiler.CodeAnalysis.FSharpProjectContext: FSharp.Compiler.CodeAnalysis.FSharpProjectOptions ProjectOptions
FSharp.Compiler.CodeAnalysis.FSharpProjectContext: FSharp.Compiler.CodeAnalysis.FSharpProjectOptions get_ProjectOptions()
FSharp.Compiler.CodeAnalysis.FSharpProjectContext: FSharp.Compiler.Symbols.FSharpAccessibilityRights AccessibilityRights
Expand Down Expand Up @@ -5918,6 +5920,7 @@ FSharp.Compiler.Syntax.PrettyNaming: Boolean IsLogicalTernaryOperator(System.Str
FSharp.Compiler.Syntax.PrettyNaming: Boolean IsLongIdentifierPartCharacter(Char)
FSharp.Compiler.Syntax.PrettyNaming: Boolean IsOperatorDisplayName(System.String)
FSharp.Compiler.Syntax.PrettyNaming: Boolean IsPunctuation(System.String)
FSharp.Compiler.Syntax.PrettyNaming: Boolean IsValidPrefixOperatorDefinitionName(System.String)
FSharp.Compiler.Syntax.PrettyNaming: Microsoft.FSharp.Collections.FSharpList`1[System.String] GetLongNameFromString(System.String)
FSharp.Compiler.Syntax.PrettyNaming: Microsoft.FSharp.Core.FSharpOption`1[System.String] TryChopPropertyName(System.String)
FSharp.Compiler.Syntax.PrettyNaming: System.String CompileOpName(System.String)
Expand Down
Loading