diff --git a/.fantomasignore b/.fantomasignore
index 119fe1d5ca3..1dbc12d4d73 100644
--- a/.fantomasignore
+++ b/.fantomasignore
@@ -39,6 +39,9 @@ src/Compiler/Checking/SignatureConformance.fs
src/Compiler/Checking/TypeHierarchy.fs
src/Compiler/Checking/TypeRelations.fs
+# Incorrectly formatted: https://github.com/dotnet/fsharp/pull/14645/commits/49443a67ea8a17670c8a7c80c8bdf91f82231e91 or https://github.com/fsprojects/fantomas/issues/2733
+src/Compiler/Driver/CompilerImports.fs
+
src/Compiler/DependencyManager/AssemblyResolveHandler.fs
src/Compiler/DependencyManager/DependencyProvider.fs
src/Compiler/DependencyManager/NativeDllResolveHandler.fs
diff --git a/FSharpBuild.Directory.Build.props b/FSharpBuild.Directory.Build.props
index 21e531409e8..5be07042285 100644
--- a/FSharpBuild.Directory.Build.props
+++ b/FSharpBuild.Directory.Build.props
@@ -30,6 +30,10 @@
$(OtherFlags) $(AdditionalFscCmdFlags)
+
+ $(OtherFlags) --define:NO_TYPEPROVIDERS
+
+
$(MSBuildThisFileDirectory)icon.png
diff --git a/src/Compiler/Checking/NicePrint.fs b/src/Compiler/Checking/NicePrint.fs
index 6f02548b084..e2e7adf1b65 100644
--- a/src/Compiler/Checking/NicePrint.fs
+++ b/src/Compiler/Checking/NicePrint.fs
@@ -2112,9 +2112,10 @@ module TastDefinitionPrinting =
| _ when isNil allDecls ->
lhsL
-
+#if !NO_TYPEPROVIDERS
| TProvidedNamespaceRepr _
| TProvidedTypeRepr _
+#endif
| TNoRepr ->
allDecls
|> applyMaxMembers denv.maxMembers
diff --git a/src/Compiler/Driver/CompilerImports.fs b/src/Compiler/Driver/CompilerImports.fs
index 4def1237b11..2b6fc09a653 100644
--- a/src/Compiler/Driver/CompilerImports.fs
+++ b/src/Compiler/Driver/CompilerImports.fs
@@ -1096,8 +1096,9 @@ and [] TcImports
initialResolutions: TcAssemblyResolutions,
importsBase: TcImports option,
dependencyProviderOpt: DependencyProvider option
- ) as this
+ )
#if !NO_TYPEPROVIDERS
+ as this
#endif
=
@@ -2016,10 +2017,14 @@ and [] TcImports
UsesFSharp20PlusQuotations = minfo.usesQuotations
MemberSignatureEquality = (fun ty1 ty2 -> typeEquivAux EraseAll (tcImports.GetTcGlobals()) ty1 ty2)
TypeForwarders = ImportILAssemblyTypeForwarders(tcImports.GetImportMap, m, ilModule.GetRawTypeForwarders())
+#if !NO_TYPEPROVIDERS
XmlDocumentationInfo =
match tcConfig.xmlDocInfoLoader with
| Some xmlDocInfoLoader -> xmlDocInfoLoader.TryLoad(fileName)
| _ -> None
+#else
+ XmlDocumentationInfo = None
+#endif
}
let ccu = CcuThunk.Create(ccuName, ccuData)
diff --git a/src/Compiler/Interactive/fsi.fs b/src/Compiler/Interactive/fsi.fs
index 30a55989edf..5c9e60af2b9 100644
--- a/src/Compiler/Interactive/fsi.fs
+++ b/src/Compiler/Interactive/fsi.fs
@@ -3473,8 +3473,8 @@ type FsiEvaluationSession (fsi: FsiEvaluationSessionHostConfig, argv:string[], i
let resolveAssemblyRef (aref: ILAssemblyRef) =
// Explanation: This callback is invoked during compilation to resolve assembly references
// We don't yet propagate the ctok through these calls (though it looks plausible to do so).
- let ctok = AssumeCompilationThreadWithoutEvidence ()
#if !NO_TYPEPROVIDERS
+ let ctok = AssumeCompilationThreadWithoutEvidence ()
match tcImports.TryFindProviderGeneratedAssemblyByName (ctok, aref.Name) with
| Some assembly -> Some (Choice2Of2 assembly)
| None ->
diff --git a/src/Compiler/Service/IncrementalBuild.fs b/src/Compiler/Service/IncrementalBuild.fs
index 152d5119fb0..a15fc768778 100644
--- a/src/Compiler/Service/IncrementalBuild.fs
+++ b/src/Compiler/Service/IncrementalBuild.fs
@@ -759,8 +759,11 @@ module IncrementalBuilderHelpers =
enableBackgroundItemKeyStoreAndSemanticClassification,
defaultPartialTypeChecking,
beforeFileChecked,
- fileChecked,
- importsInvalidatedByTypeProvider: Event) : NodeCode =
+ fileChecked
+#if !NO_TYPEPROVIDERS
+ ,importsInvalidatedByTypeProvider: Event
+#endif
+ ) : NodeCode =
node {
let diagnosticsLogger = CompilationDiagnosticLogger("CombineImportedAssembliesTask", tcConfig.diagnosticsOptions)
@@ -1664,8 +1667,10 @@ type IncrementalBuilder(initialState: IncrementalBuilderInitialState, state: Inc
enableBackgroundItemKeyStoreAndSemanticClassification,
enablePartialTypeChecking,
beforeFileChecked,
- fileChecked,
- importsInvalidatedByTypeProvider
+ fileChecked
+#if !NO_TYPEPROVIDERS
+ ,importsInvalidatedByTypeProvider
+#endif
)
let getFSharpSource fileName =
diff --git a/src/Compiler/Service/ServiceDeclarationLists.fs b/src/Compiler/Service/ServiceDeclarationLists.fs
index 06cf656b078..5fbef4db665 100644
--- a/src/Compiler/Service/ServiceDeclarationLists.fs
+++ b/src/Compiler/Service/ServiceDeclarationLists.fs
@@ -952,6 +952,9 @@ module internal DescriptionListsImpl =
/// Select the items that participate in a MethodGroup.
let SelectMethodGroupItems g m item =
+#if NO_TYPEPROVIDERS
+ ignore m
+#endif
match item with
| Item.CtorGroup(nm, cinfos) -> List.map (fun minfo -> Item.CtorGroup(nm, [minfo])) cinfos
| Item.Trait traitInfo ->