From 83016235e6de7ba3e8848a1b73c816c2011ec541 Mon Sep 17 00:00:00 2001 From: Vlad Zarytovskii Date: Mon, 23 Jan 2023 14:08:46 +0100 Subject: [PATCH 1/8] Fix no_typeproviders build --- FSharpBuild.Directory.Build.props | 4 ++++ src/Compiler/Checking/NicePrint.fs | 3 ++- src/Compiler/Driver/CompilerImports.fs | 7 ++++++- src/Compiler/Interactive/fsi.fs | 2 +- src/Compiler/Service/IncrementalBuild.fs | 13 +++++++++---- src/Compiler/Service/ServiceDeclarationLists.fs | 2 +- 6 files changed, 23 insertions(+), 8 deletions(-) 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..079c46ee91d 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 e1d59dc904b..1252dfc155b 100644 --- a/src/Compiler/Service/IncrementalBuild.fs +++ b/src/Compiler/Service/IncrementalBuild.fs @@ -758,8 +758,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) @@ -1644,8 +1647,10 @@ type IncrementalBuilder(initialState: IncrementalBuilderInitialState, state: Inc enableBackgroundItemKeyStoreAndSemanticClassification, enablePartialTypeChecking, beforeFileChecked, - fileChecked, - importsInvalidatedByTypeProvider + fileChecked +#if !NO_TYPEPROVIDERS + ,importsInvalidatedByTypeProvider +#endif ) let sourceFiles = diff --git a/src/Compiler/Service/ServiceDeclarationLists.fs b/src/Compiler/Service/ServiceDeclarationLists.fs index 06cf656b078..ee9d5b6441f 100644 --- a/src/Compiler/Service/ServiceDeclarationLists.fs +++ b/src/Compiler/Service/ServiceDeclarationLists.fs @@ -951,7 +951,7 @@ module internal DescriptionListsImpl = /// Select the items that participate in a MethodGroup. - let SelectMethodGroupItems g m item = + let SelectMethodGroupItems g _ item = match item with | Item.CtorGroup(nm, cinfos) -> List.map (fun minfo -> Item.CtorGroup(nm, [minfo])) cinfos | Item.Trait traitInfo -> From 9c1b02cd7569a372cc5cd969225a013c14a23fe1 Mon Sep 17 00:00:00 2001 From: Vlad Zarytovskii Date: Mon, 23 Jan 2023 14:14:39 +0100 Subject: [PATCH 2/8] fix --- src/Compiler/Service/ServiceDeclarationLists.fs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Compiler/Service/ServiceDeclarationLists.fs b/src/Compiler/Service/ServiceDeclarationLists.fs index ee9d5b6441f..5fbef4db665 100644 --- a/src/Compiler/Service/ServiceDeclarationLists.fs +++ b/src/Compiler/Service/ServiceDeclarationLists.fs @@ -951,7 +951,10 @@ module internal DescriptionListsImpl = /// Select the items that participate in a MethodGroup. - let SelectMethodGroupItems g _ item = + 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 -> From 49443a67ea8a17670c8a7c80c8bdf91f82231e91 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 23 Jan 2023 13:21:55 +0000 Subject: [PATCH 3/8] Automated command ran: fantomas Co-authored-by: vzarytovskii <1260985+vzarytovskii@users.noreply.github.com> --- src/Compiler/Driver/CompilerImports.fs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Compiler/Driver/CompilerImports.fs b/src/Compiler/Driver/CompilerImports.fs index 079c46ee91d..91b208979b6 100644 --- a/src/Compiler/Driver/CompilerImports.fs +++ b/src/Compiler/Driver/CompilerImports.fs @@ -1096,9 +1096,8 @@ and [] TcImports initialResolutions: TcAssemblyResolutions, importsBase: TcImports option, dependencyProviderOpt: DependencyProvider option - ) + ) as this #if !NO_TYPEPROVIDERS - as this #endif = From f8ed0ba524ff60732b4790a50ba491cd545980ec Mon Sep 17 00:00:00 2001 From: Vlad Zarytovskii Date: Mon, 23 Jan 2023 14:26:23 +0100 Subject: [PATCH 4/8] fix --- .fantomasignore | 3 +++ src/Compiler/Driver/CompilerImports.fs | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) 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/src/Compiler/Driver/CompilerImports.fs b/src/Compiler/Driver/CompilerImports.fs index 91b208979b6..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 = From 5aa5277837fe861ab73ab42c18d2ee9d43b9f680 Mon Sep 17 00:00:00 2001 From: Vlad Zarytovskii Date: Wed, 1 Feb 2023 13:06:11 +0100 Subject: [PATCH 5/8] fix --- .fantomasignore | 3 --- src/Compiler/Driver/CompilerImports.fs | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.fantomasignore b/.fantomasignore index 1dbc12d4d73..119fe1d5ca3 100644 --- a/.fantomasignore +++ b/.fantomasignore @@ -39,9 +39,6 @@ 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/src/Compiler/Driver/CompilerImports.fs b/src/Compiler/Driver/CompilerImports.fs index 2b6fc09a653..40ae0488d83 100644 --- a/src/Compiler/Driver/CompilerImports.fs +++ b/src/Compiler/Driver/CompilerImports.fs @@ -1096,9 +1096,9 @@ and [] TcImports initialResolutions: TcAssemblyResolutions, importsBase: TcImports option, dependencyProviderOpt: DependencyProvider option - ) + ) as this #if !NO_TYPEPROVIDERS - as this + ignore this #endif = From 6f6e34144f837f9e701896444cbada26c83ee04b Mon Sep 17 00:00:00 2001 From: Vlad Zarytovskii Date: Wed, 1 Feb 2023 13:54:02 +0100 Subject: [PATCH 6/8] fix --- src/Compiler/Driver/CompilerImports.fs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Compiler/Driver/CompilerImports.fs b/src/Compiler/Driver/CompilerImports.fs index 40ae0488d83..ddff4f07459 100644 --- a/src/Compiler/Driver/CompilerImports.fs +++ b/src/Compiler/Driver/CompilerImports.fs @@ -1096,11 +1096,11 @@ and [] TcImports initialResolutions: TcAssemblyResolutions, importsBase: TcImports option, dependencyProviderOpt: DependencyProvider option - ) as this + ) as this = + #if !NO_TYPEPROVIDERS ignore this #endif - = let tciLock = TcImportsLock() From 5dd7717b482e32c1f3e097fc467fdf94722ebaeb Mon Sep 17 00:00:00 2001 From: Vlad Zarytovskii Date: Wed, 1 Feb 2023 14:01:59 +0100 Subject: [PATCH 7/8] fix --- src/Compiler/Driver/CompilerImports.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Compiler/Driver/CompilerImports.fs b/src/Compiler/Driver/CompilerImports.fs index ddff4f07459..f454f7c9b77 100644 --- a/src/Compiler/Driver/CompilerImports.fs +++ b/src/Compiler/Driver/CompilerImports.fs @@ -1098,7 +1098,7 @@ and [] TcImports dependencyProviderOpt: DependencyProvider option ) as this = -#if !NO_TYPEPROVIDERS +#if NO_TYPEPROVIDERS ignore this #endif From 21fe64206487c2e1d476037a32b92b0997e7e351 Mon Sep 17 00:00:00 2001 From: Vlad Zarytovskii Date: Wed, 1 Feb 2023 15:47:36 +0100 Subject: [PATCH 8/8] revert everything --- .fantomasignore | 3 +++ src/Compiler/Driver/CompilerImports.fs | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) 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/src/Compiler/Driver/CompilerImports.fs b/src/Compiler/Driver/CompilerImports.fs index f454f7c9b77..2b6fc09a653 100644 --- a/src/Compiler/Driver/CompilerImports.fs +++ b/src/Compiler/Driver/CompilerImports.fs @@ -1096,11 +1096,11 @@ and [] TcImports initialResolutions: TcAssemblyResolutions, importsBase: TcImports option, dependencyProviderOpt: DependencyProvider option - ) as this = - -#if NO_TYPEPROVIDERS - ignore this + ) +#if !NO_TYPEPROVIDERS + as this #endif + = let tciLock = TcImportsLock()