From a31dc23510d656a7853d07af19390026a810c641 Mon Sep 17 00:00:00 2001 From: pezi_pink Date: Wed, 21 Apr 2021 17:01:35 +0100 Subject: [PATCH 01/42] prevent exception from race condition in tryGetReflectedDefinition --- src/fsharp/FSharp.Core/quotations.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fsharp/FSharp.Core/quotations.fs b/src/fsharp/FSharp.Core/quotations.fs index aabae7bfda5..94e6d36fe08 100644 --- a/src/fsharp/FSharp.Core/quotations.fs +++ b/src/fsharp/FSharp.Core/quotations.fs @@ -1856,7 +1856,7 @@ module Patterns = |> List.iter (fun (resourceName, defns) -> defns |> List.iter (fun (methodBase, exprBuilder) -> reflectedDefinitionTable.[ReflectedDefinitionTableKey.GetKey methodBase] <- Entry exprBuilder) - decodedTopResources.Add((assem, resourceName), 0)) + decodedTopResources.[(assem, resourceName)] <- 0) // we know it's in the table now, if it's ever going to be there reflectedDefinitionTable.TryGetValue key ) From f66c3f1c8e27ed860f4fdc6f5656cad3f1bfba72 Mon Sep 17 00:00:00 2001 From: Will Smith Date: Mon, 7 Jun 2021 16:50:08 -0700 Subject: [PATCH 02/42] Partial fix for FSharp scripts in VS --- .../FSharpProjectOptionsManager.fs | 17 ++-- .../LanguageService/SingleFileWorkspaceMap.fs | 83 ++++++++++++++++--- 2 files changed, 82 insertions(+), 18 deletions(-) diff --git a/vsintegration/src/FSharp.Editor/LanguageService/FSharpProjectOptionsManager.fs b/vsintegration/src/FSharp.Editor/LanguageService/FSharpProjectOptionsManager.fs index aa5d35b0815..b2055057cc4 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/FSharpProjectOptionsManager.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/FSharpProjectOptionsManager.fs @@ -108,12 +108,14 @@ type private FSharpProjectOptionsReactor (workspace: Workspace, settings: Editor let legacyProjectSites = ConcurrentDictionary() let cache = ConcurrentDictionary() - let singleFileCache = ConcurrentDictionary() + let singleFileCache = ConcurrentDictionary() // This is used to not constantly emit the same compilation. let weakPEReferences = ConditionalWeakTable() let lastSuccessfulCompilations = ConcurrentDictionary() + let scriptUpdatedEvent = Event() + let createPEReference (referencedProject: Project) (comp: Compilation) = let projectId = referencedProject.Id @@ -193,6 +195,7 @@ type private FSharpProjectOptionsReactor (workspace: Workspace, settings: Editor let projectOptions = if isScriptFile document.FilePath then + scriptUpdatedEvent.Trigger(scriptProjectOptions) scriptProjectOptions else { @@ -211,12 +214,12 @@ type private FSharpProjectOptionsReactor (workspace: Workspace, settings: Editor let parsingOptions, _ = checkerProvider.Checker.GetParsingOptionsFromProjectOptions(projectOptions) - singleFileCache.[document.Id] <- (fileStamp, parsingOptions, projectOptions) + singleFileCache.[document.Id] <- (document.Project, fileStamp, parsingOptions, projectOptions) return Some(parsingOptions, projectOptions) - | true, (fileStamp2, parsingOptions, projectOptions) -> - if fileStamp <> fileStamp2 then + | true, (oldProject, oldFileStamp, parsingOptions, projectOptions) -> + if fileStamp <> oldFileStamp || isProjectInvalidated document.Project oldProject settings ct then singleFileCache.TryRemove(document.Id) |> ignore return! tryComputeOptionsBySingleScriptOrFile document ct userOpName else @@ -407,7 +410,7 @@ type private FSharpProjectOptionsReactor (workspace: Workspace, settings: Editor legacyProjectSites.TryRemove(projectId) |> ignore | FSharpProjectOptionsMessage.ClearSingleFileOptionsCache(documentId) -> match singleFileCache.TryRemove(documentId) with - | true, (_, _, projectOptions) -> + | true, (_, _, _, projectOptions) -> lastSuccessfulCompilations.TryRemove(documentId.ProjectId) |> ignore checkerProvider.Checker.ClearCache([projectOptions]) | _ -> @@ -446,6 +449,8 @@ type private FSharpProjectOptionsReactor (workspace: Workspace, settings: Editor singleFileCache.Clear() lastSuccessfulCompilations.Clear() + member _.ScriptUpdated = scriptUpdatedEvent.Publish + interface IDisposable with member _.Dispose() = cancellationTokenSource.Cancel() @@ -488,6 +493,8 @@ type internal FSharpProjectOptionsManager reactor.ClearSingleFileOptionsCache(doc.Id) ) + member _.ScriptUpdated = reactor.ScriptUpdated + member _.SetLegacyProjectSite (projectId, projectSite) = reactor.SetLegacyProjectSite (projectId, projectSite) diff --git a/vsintegration/src/FSharp.Editor/LanguageService/SingleFileWorkspaceMap.fs b/vsintegration/src/FSharp.Editor/LanguageService/SingleFileWorkspaceMap.fs index 91106217e99..8ed75459ac4 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/SingleFileWorkspaceMap.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/SingleFileWorkspaceMap.fs @@ -11,6 +11,7 @@ open Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem open Microsoft.VisualStudio.LanguageServices.ProjectSystem open Microsoft.VisualStudio.Shell.Interop open Microsoft.VisualStudio.LanguageServices +open FSharp.Compiler.CodeAnalysis [] type internal SingleFileWorkspaceMap(workspace: VisualStudioWorkspace, @@ -19,6 +20,7 @@ type internal SingleFileWorkspaceMap(workspace: VisualStudioWorkspace, projectContextFactory: IWorkspaceProjectContextFactory, rdt: IVsRunningDocumentTable) as this = + let gate = obj() let files = ConcurrentDictionary(StringComparer.OrdinalIgnoreCase) let createSourceCodeKind (filePath: string) = @@ -31,36 +33,91 @@ type internal SingleFileWorkspaceMap(workspace: VisualStudioWorkspace, let projectContext = projectContextFactory.CreateProjectContext(FSharpConstants.FSharpLanguageName, filePath, filePath, Guid.NewGuid(), null, null) projectContext.DisplayName <- FSharpConstants.FSharpMiscellaneousFilesName projectContext.AddSourceFile(filePath, sourceCodeKind = createSourceCodeKind filePath) - projectContext + projectContext, ResizeArray() do + optionsManager.ScriptUpdated.Add(fun scriptProjectOptions -> + if scriptProjectOptions.SourceFiles.Length > 0 then + // The last file in the project options is the main script file. + let filePath = scriptProjectOptions.SourceFiles.[scriptProjectOptions.SourceFiles.Length - 1] + + lock gate (fun () -> + match files.TryGetValue(filePath) with + | true, (projectContext: IWorkspaceProjectContext, currentDepSourceFiles: ResizeArray<_>) -> + + let depSourceFiles = scriptProjectOptions.SourceFiles |> Array.filter (fun x -> x.Equals(filePath, StringComparison.OrdinalIgnoreCase) |> not) + + if depSourceFiles.Length <> currentDepSourceFiles.Count || + ( + (currentDepSourceFiles, depSourceFiles) + ||> Seq.forall2 (fun (x: string) y -> x.Equals(y, StringComparison.OrdinalIgnoreCase)) + |> not + + ) then + currentDepSourceFiles + |> Seq.iter (fun x -> + match files.TryGetValue(x) with + | true, (depProjectContext, _) -> + projectContext.RemoveProjectReference(depProjectContext) + | _ -> + () + ) + + currentDepSourceFiles.Clear() + depSourceFiles + |> Array.iter (fun filePath -> + currentDepSourceFiles.Add(filePath) + match files.TryGetValue(filePath) with + | true, (depProjectContext, _) -> + projectContext.AddProjectReference(depProjectContext, MetadataReferenceProperties.Assembly) + | _ -> + let result = createProjectContext filePath + files.[filePath] <- result + let depProjectContext, _ = result + projectContext.AddProjectReference(depProjectContext, MetadataReferenceProperties.Assembly) + ) + + | _ -> () + ) + ) + miscFilesWorkspace.DocumentOpened.Add(fun args -> let document = args.Document if document.Project.Language = FSharpConstants.FSharpLanguageName && workspace.CurrentSolution.GetDocumentIdsWithFilePath(document.FilePath).Length = 0 then - files.[document.FilePath] <- createProjectContext document.FilePath + let filePath = document.FilePath + lock gate (fun () -> + if files.ContainsKey(filePath) |> not then + files.[filePath] <- createProjectContext filePath + ) ) workspace.DocumentOpened.Add(fun args -> let document = args.Document if document.Project.Language = FSharpConstants.FSharpLanguageName && not document.Project.IsFSharpMiscellaneousOrMetadata then - match files.TryRemove(document.FilePath) with - | true, projectContext -> - optionsManager.ClearSingleFileOptionsCache(document.Id) - projectContext.Dispose() - | _ -> () + optionsManager.ClearSingleFileOptionsCache(document.Id) + + lock gate (fun () -> + match files.TryRemove(document.FilePath) with + | true, (projectContext, _) -> + projectContext.Dispose() + | _ -> () + ) ) workspace.DocumentClosed.Add(fun args -> let document = args.Document if document.Project.Language = FSharpConstants.FSharpLanguageName && document.Project.IsFSharpMiscellaneousOrMetadata then - match files.TryRemove(document.FilePath) with - | true, projectContext -> - optionsManager.ClearSingleFileOptionsCache(document.Id) - projectContext.Dispose() - | _ -> () + optionsManager.ClearSingleFileOptionsCache(document.Id) + + lock gate (fun () -> + match files.TryRemove(document.FilePath) with + | true, (projectContext, _) -> + projectContext.Dispose() + | _ -> () + ) ) do @@ -88,7 +145,7 @@ type internal SingleFileWorkspaceMap(workspace: VisualStudioWorkspace, // Handles renaming of a misc file if (grfAttribs &&& (uint32 __VSRDTATTRIB.RDTA_MkDocument)) <> 0u && files.ContainsKey(pszMkDocumentOld) then match files.TryRemove(pszMkDocumentOld) with - | true, projectContext -> + | true, (projectContext, _) -> let project = workspace.CurrentSolution.GetProject(projectContext.Id) if project <> null then let documentOpt = From 469748078fa704f3a1a9da7e12dda0869b112d8d Mon Sep 17 00:00:00 2001 From: Will Smith Date: Thu, 24 Jun 2021 10:16:07 -0700 Subject: [PATCH 03/42] Fixing build --- .../LanguageService/FSharpProjectOptionsManager.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vsintegration/src/FSharp.Editor/LanguageService/FSharpProjectOptionsManager.fs b/vsintegration/src/FSharp.Editor/LanguageService/FSharpProjectOptionsManager.fs index e69a155eed8..e30c178f5b6 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/FSharpProjectOptionsManager.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/FSharpProjectOptionsManager.fs @@ -211,7 +211,7 @@ type private FSharpProjectOptionsReactor (checker: FSharpChecker) = return Some(parsingOptions, projectOptions) | true, (oldProject, oldFileStamp, parsingOptions, projectOptions) -> - if fileStamp <> oldFileStamp || isProjectInvalidated document.Project oldProject settings ct then + if fileStamp <> oldFileStamp || isProjectInvalidated document.Project oldProject ct then singleFileCache.TryRemove(document.Id) |> ignore return! tryComputeOptionsBySingleScriptOrFile document ct userOpName else From 682c4c067e9a88289eecdfb29454068660affde2 Mon Sep 17 00:00:00 2001 From: Will Smith Date: Thu, 24 Jun 2021 11:28:14 -0700 Subject: [PATCH 04/42] Added DocumentInfo/ProjectInfo CreateFSharp extension --- .../src/FSharp.Editor/Common/Extensions.fs | 45 ++++++++- .../src/FSharp.Editor/FSharp.Editor.fsproj | 1 + .../IFSharpWorkspaceService.fs | 15 +++ .../LanguageService/LanguageService.fs | 11 +-- .../LanguageService/SingleFileWorkspaceMap.fs | 93 ++++++++++++------- .../tests/UnitTests/Tests.RoslynHelpers.fs | 31 ++----- .../UnitTests/VisualFSharp.UnitTests.fsproj | 4 +- 7 files changed, 125 insertions(+), 75 deletions(-) create mode 100644 vsintegration/src/FSharp.Editor/LanguageService/IFSharpWorkspaceService.fs diff --git a/vsintegration/src/FSharp.Editor/Common/Extensions.fs b/vsintegration/src/FSharp.Editor/Common/Extensions.fs index f6f07117b52..686ecca15a1 100644 --- a/vsintegration/src/FSharp.Editor/Common/Extensions.fs +++ b/vsintegration/src/FSharp.Editor/Common/Extensions.fs @@ -39,10 +39,49 @@ type ProjectId with this.Id.ToString("D").ToLowerInvariant() type Project with - member this.IsFSharpMiscellaneous = this.Name = FSharpConstants.FSharpMiscellaneousFilesName - member this.IsFSharpMetadata = this.Name.StartsWith(FSharpConstants.FSharpMetadataName) - member this.IsFSharpMiscellaneousOrMetadata = this.IsFSharpMiscellaneous || this.IsFSharpMetadata member this.IsFSharp = this.Language = LanguageNames.FSharp + member this.IsFSharpMiscellaneous = this.IsFSharp && this.Name = FSharpConstants.FSharpMiscellaneousFilesName + member this.IsFSharpMetadata = this.IsFSharp && this.Name.StartsWith(FSharpConstants.FSharpMetadataName) + member this.IsFSharpMiscellaneousOrMetadata = this.IsFSharp && (this.IsFSharpMiscellaneous || this.IsFSharpMetadata) + +type DocumentInfo with + + static member CreateFSharp(projectId, filePath, ?loader) = + let isScript = isScriptFile filePath + let docId = DocumentId.CreateNewId(projectId) + DocumentInfo.Create( + docId, + filePath, + filePath=filePath, + loader = defaultArg loader null, + sourceCodeKind= if isScript then SourceCodeKind.Script else SourceCodeKind.Regular) + +type ProjectInfo with + + static member CreateFSharp(name, assemblyName: string, sourceFiles: string seq, ?filePath: string) = + let projId = ProjectId.CreateNewId() + + let docInfos = + sourceFiles + |> Seq.map (fun sourceFile -> + let isScript = isScriptFile sourceFile + let docId = DocumentId.CreateNewId(projId) + DocumentInfo.Create( + docId, + sourceFile, + filePath=sourceFile, + sourceCodeKind= if isScript then SourceCodeKind.Script else SourceCodeKind.Regular) + ) + + ProjectInfo.Create( + projId, + VersionStamp.Create(DateTime.UtcNow), + name, + assemblyName, + LanguageNames.FSharp, + documents = docInfos, + filePath = defaultArg filePath null + ) type Document with member this.TryGetLanguageService<'T when 'T :> ILanguageService>() = diff --git a/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj b/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj index aff4b4c25d8..da325f32a96 100644 --- a/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj +++ b/vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj @@ -46,6 +46,7 @@ + diff --git a/vsintegration/src/FSharp.Editor/LanguageService/IFSharpWorkspaceService.fs b/vsintegration/src/FSharp.Editor/LanguageService/IFSharpWorkspaceService.fs new file mode 100644 index 00000000000..db1794308b6 --- /dev/null +++ b/vsintegration/src/FSharp.Editor/LanguageService/IFSharpWorkspaceService.fs @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace Microsoft.VisualStudio.FSharp.Editor + +open FSharp.Compiler.CodeAnalysis +open Microsoft.VisualStudio.FSharp.Editor +open Microsoft.CodeAnalysis.Host + +// Used to expose FSharpChecker/ProjectInfo manager to diagnostic providers +// Diagnostic providers can be executed in environment that does not use MEF so they can rely only +// on services exposed by the workspace +type internal IFSharpWorkspaceService = + inherit IWorkspaceService + abstract Checker: FSharpChecker + abstract FSharpProjectOptionsManager: FSharpProjectOptionsManager \ No newline at end of file diff --git a/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs b/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs index 6a921b01cb7..9373b4d131c 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs @@ -29,14 +29,6 @@ open Microsoft.CodeAnalysis.Host.Mef #nowarn "9" // NativePtr.toNativeInt -// Used to expose FSharpChecker/ProjectInfo manager to diagnostic providers -// Diagnostic providers can be executed in environment that does not use MEF so they can rely only -// on services exposed by the workspace -type internal IFSharpWorkspaceService = - inherit IWorkspaceService - abstract Checker: FSharpChecker - abstract FSharpProjectOptionsManager: FSharpProjectOptionsManager - type internal RoamingProfileStorageLocation(keyName: string) = inherit OptionStorageLocation() @@ -270,8 +262,7 @@ type internal FSharpPackage() as this = let _singleFileWorkspaceMap = new SingleFileWorkspaceMap( workspace, - miscFilesWorkspace, - optionsManager, + miscFilesWorkspace, projectContextFactory, rdt) let _legacyProjectWorkspaceMap = new LegacyProjectWorkspaceMap(solution, optionsManager, projectContextFactory) diff --git a/vsintegration/src/FSharp.Editor/LanguageService/SingleFileWorkspaceMap.fs b/vsintegration/src/FSharp.Editor/LanguageService/SingleFileWorkspaceMap.fs index 8ed75459ac4..9052a69578e 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/SingleFileWorkspaceMap.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/SingleFileWorkspaceMap.fs @@ -13,47 +13,51 @@ open Microsoft.VisualStudio.Shell.Interop open Microsoft.VisualStudio.LanguageServices open FSharp.Compiler.CodeAnalysis +type private ScriptDependencies = ResizeArray + [] -type internal SingleFileWorkspaceMap(workspace: VisualStudioWorkspace, +type internal SingleFileWorkspaceMap(workspace: Workspace, miscFilesWorkspace: MiscellaneousFilesWorkspace, - optionsManager: FSharpProjectOptionsManager, projectContextFactory: IWorkspaceProjectContextFactory, rdt: IVsRunningDocumentTable) as this = + // We have a lock because the `ScriptUpdated` event may happen concurrently when a document opens or closes. let gate = obj() let files = ConcurrentDictionary(StringComparer.OrdinalIgnoreCase) + let optionsManager = workspace.Services.GetRequiredService().FSharpProjectOptionsManager - let createSourceCodeKind (filePath: string) = + static let createSourceCodeKind (filePath: string) = if isScriptFile filePath then SourceCodeKind.Script else SourceCodeKind.Regular - let createProjectContext filePath = + static let canUpdateScript (depSourceFiles: string []) (currentDepSourceFiles: ScriptDependencies) = + depSourceFiles.Length <> currentDepSourceFiles.Count || + ( + (currentDepSourceFiles, depSourceFiles) + ||> Seq.forall2 (fun (x: string) y -> x.Equals(y, StringComparison.OrdinalIgnoreCase)) + |> not + + ) + + static let createProjectContext (projectContextFactory: IWorkspaceProjectContextFactory) filePath = let projectContext = projectContextFactory.CreateProjectContext(FSharpConstants.FSharpLanguageName, filePath, filePath, Guid.NewGuid(), null, null) projectContext.DisplayName <- FSharpConstants.FSharpMiscellaneousFilesName projectContext.AddSourceFile(filePath, sourceCodeKind = createSourceCodeKind filePath) - projectContext, ResizeArray() + projectContext, ScriptDependencies() do optionsManager.ScriptUpdated.Add(fun scriptProjectOptions -> if scriptProjectOptions.SourceFiles.Length > 0 then // The last file in the project options is the main script file. let filePath = scriptProjectOptions.SourceFiles.[scriptProjectOptions.SourceFiles.Length - 1] + let depSourceFiles = scriptProjectOptions.SourceFiles |> Array.take (scriptProjectOptions.SourceFiles.Length - 1) lock gate (fun () -> match files.TryGetValue(filePath) with - | true, (projectContext: IWorkspaceProjectContext, currentDepSourceFiles: ResizeArray<_>) -> - - let depSourceFiles = scriptProjectOptions.SourceFiles |> Array.filter (fun x -> x.Equals(filePath, StringComparison.OrdinalIgnoreCase) |> not) - - if depSourceFiles.Length <> currentDepSourceFiles.Count || - ( - (currentDepSourceFiles, depSourceFiles) - ||> Seq.forall2 (fun (x: string) y -> x.Equals(y, StringComparison.OrdinalIgnoreCase)) - |> not - - ) then + | true, (projectContext: IWorkspaceProjectContext, currentDepSourceFiles: ScriptDependencies) -> + if canUpdateScript depSourceFiles currentDepSourceFiles then currentDepSourceFiles |> Seq.iter (fun x -> match files.TryGetValue(x) with @@ -71,12 +75,11 @@ type internal SingleFileWorkspaceMap(workspace: VisualStudioWorkspace, | true, (depProjectContext, _) -> projectContext.AddProjectReference(depProjectContext, MetadataReferenceProperties.Assembly) | _ -> - let result = createProjectContext filePath + let result = createProjectContext projectContextFactory filePath files.[filePath] <- result let depProjectContext, _ = result projectContext.AddProjectReference(depProjectContext, MetadataReferenceProperties.Assembly) ) - | _ -> () ) ) @@ -84,40 +87,58 @@ type internal SingleFileWorkspaceMap(workspace: VisualStudioWorkspace, miscFilesWorkspace.DocumentOpened.Add(fun args -> let document = args.Document - if document.Project.Language = FSharpConstants.FSharpLanguageName && workspace.CurrentSolution.GetDocumentIdsWithFilePath(document.FilePath).Length = 0 then + // If the file does not exist in the current solution, then we can create new project in the VisualStudioWorkspace that represents + // a F# miscellaneous project, which could be a script or not. + if document.Project.IsFSharp && workspace.CurrentSolution.GetDocumentIdsWithFilePath(document.FilePath).Length = 0 then let filePath = document.FilePath lock gate (fun () -> if files.ContainsKey(filePath) |> not then - files.[filePath] <- createProjectContext filePath + files.[filePath] <- createProjectContext projectContextFactory filePath ) ) workspace.DocumentOpened.Add(fun args -> let document = args.Document - if document.Project.Language = FSharpConstants.FSharpLanguageName && - not document.Project.IsFSharpMiscellaneousOrMetadata then + if not document.Project.IsFSharpMiscellaneousOrMetadata then optionsManager.ClearSingleFileOptionsCache(document.Id) - lock gate (fun () -> - match files.TryRemove(document.FilePath) with - | true, (projectContext, _) -> - projectContext.Dispose() - | _ -> () - ) + let projectContextOpt = + lock gate (fun () -> + match files.TryRemove(document.FilePath) with + | true, (projectContext, _) -> + Some projectContext + | _ -> + None + ) + + match projectContextOpt with + | Some projectContext -> + projectContext.Dispose() + | _ -> + () ) workspace.DocumentClosed.Add(fun args -> let document = args.Document - if document.Project.Language = FSharpConstants.FSharpLanguageName && - document.Project.IsFSharpMiscellaneousOrMetadata then + if document.Project.IsFSharpMiscellaneousOrMetadata then optionsManager.ClearSingleFileOptionsCache(document.Id) - lock gate (fun () -> - match files.TryRemove(document.FilePath) with - | true, (projectContext, _) -> + let projectContextOpt = + lock gate (fun () -> + match files.TryRemove(document.FilePath) with + | true, (projectContext, _) -> + Some projectContext + | _ -> + None + ) + + match projectContextOpt with + | Some projectContext -> + let projIds = document.Project.Solution.GetDependentProjectIds(document.Project.Id) + if projIds.Count = 0 then projectContext.Dispose() - | _ -> () - ) + | _ -> + () ) do @@ -156,7 +177,7 @@ type internal SingleFileWorkspaceMap(workspace: VisualStudioWorkspace, | Some(document) -> optionsManager.ClearSingleFileOptionsCache(document.Id) projectContext.Dispose() - files.[pszMkDocumentNew] <- createProjectContext pszMkDocumentNew + files.[pszMkDocumentNew] <- createProjectContext projectContextFactory pszMkDocumentNew else projectContext.Dispose() // fallback, shouldn't happen, but in case it does let's dispose of the project context so we don't leak | _ -> () diff --git a/vsintegration/tests/UnitTests/Tests.RoslynHelpers.fs b/vsintegration/tests/UnitTests/Tests.RoslynHelpers.fs index 7481753ec30..e6d5ba9a3f5 100644 --- a/vsintegration/tests/UnitTests/Tests.RoslynHelpers.fs +++ b/vsintegration/tests/UnitTests/Tests.RoslynHelpers.fs @@ -205,28 +205,11 @@ type RoslynTestHelpers private () = let workspace = new AdhocWorkspace(TestHostServices()) - let projId = ProjectId.CreateNewId() - let docId = DocumentId.CreateNewId(projId) - - let docInfo = - DocumentInfo.Create( - docId, - filePath, - loader=TextLoader.From(text.Container, VersionStamp.Create(DateTime.UtcNow)), - filePath=filePath, - sourceCodeKind= if isScript then SourceCodeKind.Script else SourceCodeKind.Regular) - let projFilePath = "C:\\test.fsproj" - let projInfo = - ProjectInfo.Create( - projId, - VersionStamp.Create(DateTime.UtcNow), - projFilePath, - "test.dll", - LanguageNames.FSharp, - documents = [docInfo], - filePath = projFilePath - ) + let projInfo = ProjectInfo.CreateFSharp(projFilePath, "test.dll", Seq.empty, filePath = projFilePath) + let docInfo = DocumentInfo.CreateFSharp(projInfo.Id, filePath, loader = TextLoader.From(text.Container, VersionStamp.Create(DateTime.UtcNow))) + + let projInfo = projInfo.WithDocuments([docInfo]) let solutionInfo = SolutionInfo.Create(SolutionId.CreateNewId(), VersionStamp.Create(DateTime.UtcNow), "test.sln", [projInfo]) @@ -234,15 +217,15 @@ type RoslynTestHelpers private () = let workspaceService = workspace.Services.GetService() - let document = solution.GetProject(projId).GetDocument(docId) + let document = solution.GetProject(projInfo.Id).GetDocument(docInfo.Id) match options with | Some options -> let options = { options with ProjectId = Some(Guid.NewGuid().ToString()) } - workspaceService.FSharpProjectOptionsManager.SetCommandLineOptions(projId, options.SourceFiles, options.OtherOptions |> ImmutableArray.CreateRange) + workspaceService.FSharpProjectOptionsManager.SetCommandLineOptions(projInfo.Id, options.SourceFiles, options.OtherOptions |> ImmutableArray.CreateRange) document.SetFSharpProjectOptionsForTesting(options) | _ -> - workspaceService.FSharpProjectOptionsManager.SetCommandLineOptions(projId, [|filePath|], ImmutableArray.Empty) + workspaceService.FSharpProjectOptionsManager.SetCommandLineOptions(projInfo.Id, [|filePath|], ImmutableArray.Empty) document diff --git a/vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj b/vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj index baa2c21ae98..63c7fe2f60b 100644 --- a/vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj +++ b/vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj @@ -131,7 +131,7 @@ - + From ed34c0508443e0979212e5d57d20851b4c23addf Mon Sep 17 00:00:00 2001 From: Will Smith Date: Thu, 24 Jun 2021 11:30:13 -0700 Subject: [PATCH 05/42] Uncomment --- vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj b/vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj index 63c7fe2f60b..baa2c21ae98 100644 --- a/vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj +++ b/vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj @@ -131,7 +131,7 @@ - + From 45c788717341c3597c1bbbdca83fbfc37b66c3f6 Mon Sep 17 00:00:00 2001 From: Will Smith Date: Thu, 24 Jun 2021 11:30:42 -0700 Subject: [PATCH 06/42] minor cleanup --- vsintegration/tests/UnitTests/Tests.RoslynHelpers.fs | 2 -- 1 file changed, 2 deletions(-) diff --git a/vsintegration/tests/UnitTests/Tests.RoslynHelpers.fs b/vsintegration/tests/UnitTests/Tests.RoslynHelpers.fs index e6d5ba9a3f5..b97acd38a49 100644 --- a/vsintegration/tests/UnitTests/Tests.RoslynHelpers.fs +++ b/vsintegration/tests/UnitTests/Tests.RoslynHelpers.fs @@ -201,8 +201,6 @@ type TestHostServices() = type RoslynTestHelpers private () = static member CreateDocument (filePath, text: SourceText, ?options: FSharp.Compiler.CodeAnalysis.FSharpProjectOptions) = - let isScript = String.Equals(Path.GetExtension(filePath), ".fsx", StringComparison.OrdinalIgnoreCase) - let workspace = new AdhocWorkspace(TestHostServices()) let projFilePath = "C:\\test.fsproj" From 06d35a622245d8c90eeabf5e4d9799c32e12d804 Mon Sep 17 00:00:00 2001 From: Will Smith Date: Thu, 24 Jun 2021 12:24:04 -0700 Subject: [PATCH 07/42] Reverting ProjectInfo/DocumentInfo additions --- .../src/FSharp.Editor/Common/Extensions.fs | 39 ------------------- .../tests/UnitTests/Tests.RoslynHelpers.fs | 27 +++++++++++-- 2 files changed, 23 insertions(+), 43 deletions(-) diff --git a/vsintegration/src/FSharp.Editor/Common/Extensions.fs b/vsintegration/src/FSharp.Editor/Common/Extensions.fs index 686ecca15a1..2480f8ce9ac 100644 --- a/vsintegration/src/FSharp.Editor/Common/Extensions.fs +++ b/vsintegration/src/FSharp.Editor/Common/Extensions.fs @@ -44,45 +44,6 @@ type Project with member this.IsFSharpMetadata = this.IsFSharp && this.Name.StartsWith(FSharpConstants.FSharpMetadataName) member this.IsFSharpMiscellaneousOrMetadata = this.IsFSharp && (this.IsFSharpMiscellaneous || this.IsFSharpMetadata) -type DocumentInfo with - - static member CreateFSharp(projectId, filePath, ?loader) = - let isScript = isScriptFile filePath - let docId = DocumentId.CreateNewId(projectId) - DocumentInfo.Create( - docId, - filePath, - filePath=filePath, - loader = defaultArg loader null, - sourceCodeKind= if isScript then SourceCodeKind.Script else SourceCodeKind.Regular) - -type ProjectInfo with - - static member CreateFSharp(name, assemblyName: string, sourceFiles: string seq, ?filePath: string) = - let projId = ProjectId.CreateNewId() - - let docInfos = - sourceFiles - |> Seq.map (fun sourceFile -> - let isScript = isScriptFile sourceFile - let docId = DocumentId.CreateNewId(projId) - DocumentInfo.Create( - docId, - sourceFile, - filePath=sourceFile, - sourceCodeKind= if isScript then SourceCodeKind.Script else SourceCodeKind.Regular) - ) - - ProjectInfo.Create( - projId, - VersionStamp.Create(DateTime.UtcNow), - name, - assemblyName, - LanguageNames.FSharp, - documents = docInfos, - filePath = defaultArg filePath null - ) - type Document with member this.TryGetLanguageService<'T when 'T :> ILanguageService>() = match this.Project with diff --git a/vsintegration/tests/UnitTests/Tests.RoslynHelpers.fs b/vsintegration/tests/UnitTests/Tests.RoslynHelpers.fs index b97acd38a49..5b659eaae2d 100644 --- a/vsintegration/tests/UnitTests/Tests.RoslynHelpers.fs +++ b/vsintegration/tests/UnitTests/Tests.RoslynHelpers.fs @@ -201,13 +201,32 @@ type TestHostServices() = type RoslynTestHelpers private () = static member CreateDocument (filePath, text: SourceText, ?options: FSharp.Compiler.CodeAnalysis.FSharpProjectOptions) = + let isScript = String.Equals(Path.GetExtension(filePath), ".fsx", StringComparison.OrdinalIgnoreCase) + let workspace = new AdhocWorkspace(TestHostServices()) - let projFilePath = "C:\\test.fsproj" - let projInfo = ProjectInfo.CreateFSharp(projFilePath, "test.dll", Seq.empty, filePath = projFilePath) - let docInfo = DocumentInfo.CreateFSharp(projInfo.Id, filePath, loader = TextLoader.From(text.Container, VersionStamp.Create(DateTime.UtcNow))) + let projId = ProjectId.CreateNewId() + let docId = DocumentId.CreateNewId(projId) - let projInfo = projInfo.WithDocuments([docInfo]) + let docInfo = + DocumentInfo.Create( + docId, + filePath, + loader=TextLoader.From(text.Container, VersionStamp.Create(DateTime.UtcNow)), + filePath=filePath, + sourceCodeKind= if isScript then SourceCodeKind.Script else SourceCodeKind.Regular) + + let projFilePath = "C:\\test.fsproj" + let projInfo = + ProjectInfo.Create( + projId, + VersionStamp.Create(DateTime.UtcNow), + projFilePath, + "test.dll", + LanguageNames.FSharp, + documents = [docInfo], + filePath = projFilePath + ) let solutionInfo = SolutionInfo.Create(SolutionId.CreateNewId(), VersionStamp.Create(DateTime.UtcNow), "test.sln", [projInfo]) From fa5d33408cbe43fe349b6c57484485d2f56059d7 Mon Sep 17 00:00:00 2001 From: Will Smith Date: Thu, 24 Jun 2021 12:29:09 -0700 Subject: [PATCH 08/42] Minor change --- vsintegration/tests/UnitTests/Tests.RoslynHelpers.fs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vsintegration/tests/UnitTests/Tests.RoslynHelpers.fs b/vsintegration/tests/UnitTests/Tests.RoslynHelpers.fs index 5b659eaae2d..7481753ec30 100644 --- a/vsintegration/tests/UnitTests/Tests.RoslynHelpers.fs +++ b/vsintegration/tests/UnitTests/Tests.RoslynHelpers.fs @@ -234,15 +234,15 @@ type RoslynTestHelpers private () = let workspaceService = workspace.Services.GetService() - let document = solution.GetProject(projInfo.Id).GetDocument(docInfo.Id) + let document = solution.GetProject(projId).GetDocument(docId) match options with | Some options -> let options = { options with ProjectId = Some(Guid.NewGuid().ToString()) } - workspaceService.FSharpProjectOptionsManager.SetCommandLineOptions(projInfo.Id, options.SourceFiles, options.OtherOptions |> ImmutableArray.CreateRange) + workspaceService.FSharpProjectOptionsManager.SetCommandLineOptions(projId, options.SourceFiles, options.OtherOptions |> ImmutableArray.CreateRange) document.SetFSharpProjectOptionsForTesting(options) | _ -> - workspaceService.FSharpProjectOptionsManager.SetCommandLineOptions(projInfo.Id, [|filePath|], ImmutableArray.Empty) + workspaceService.FSharpProjectOptionsManager.SetCommandLineOptions(projId, [|filePath|], ImmutableArray.Empty) document From c88dcb0a2ca0490f3797adf577161c1d6dc47955 Mon Sep 17 00:00:00 2001 From: Will Smith Date: Thu, 24 Jun 2021 12:31:18 -0700 Subject: [PATCH 09/42] Minor revert --- vsintegration/src/FSharp.Editor/Common/Extensions.fs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vsintegration/src/FSharp.Editor/Common/Extensions.fs b/vsintegration/src/FSharp.Editor/Common/Extensions.fs index 2480f8ce9ac..f6f07117b52 100644 --- a/vsintegration/src/FSharp.Editor/Common/Extensions.fs +++ b/vsintegration/src/FSharp.Editor/Common/Extensions.fs @@ -39,10 +39,10 @@ type ProjectId with this.Id.ToString("D").ToLowerInvariant() type Project with + member this.IsFSharpMiscellaneous = this.Name = FSharpConstants.FSharpMiscellaneousFilesName + member this.IsFSharpMetadata = this.Name.StartsWith(FSharpConstants.FSharpMetadataName) + member this.IsFSharpMiscellaneousOrMetadata = this.IsFSharpMiscellaneous || this.IsFSharpMetadata member this.IsFSharp = this.Language = LanguageNames.FSharp - member this.IsFSharpMiscellaneous = this.IsFSharp && this.Name = FSharpConstants.FSharpMiscellaneousFilesName - member this.IsFSharpMetadata = this.IsFSharp && this.Name.StartsWith(FSharpConstants.FSharpMetadataName) - member this.IsFSharpMiscellaneousOrMetadata = this.IsFSharp && (this.IsFSharpMiscellaneous || this.IsFSharpMetadata) type Document with member this.TryGetLanguageService<'T when 'T :> ILanguageService>() = From c24e14ac0428bf1cc9406c7a8e7e26978b98bbd1 Mon Sep 17 00:00:00 2001 From: Will Smith Date: Thu, 24 Jun 2021 13:57:41 -0700 Subject: [PATCH 10/42] Added IFSharpWorkspaceProjectContext and IFSharpWorkspaceProjectContextFactory --- .../LanguageService/LanguageService.fs | 8 +- .../LanguageService/SingleFileWorkspaceMap.fs | 281 +++++++++++------- 2 files changed, 185 insertions(+), 104 deletions(-) diff --git a/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs b/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs index 9373b4d131c..19b9fe30a39 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs @@ -261,9 +261,11 @@ type internal FSharpPackage() as this = let miscFilesWorkspace = this.ComponentModel.GetService() let _singleFileWorkspaceMap = new SingleFileWorkspaceMap( - workspace, - miscFilesWorkspace, - projectContextFactory, + FSharpMiscellaneousFileService( + workspace, + miscFilesWorkspace, + FSharpWorkspaceProjectContextFactory(projectContextFactory) + ), rdt) let _legacyProjectWorkspaceMap = new LegacyProjectWorkspaceMap(solution, optionsManager, projectContextFactory) () diff --git a/vsintegration/src/FSharp.Editor/LanguageService/SingleFileWorkspaceMap.fs b/vsintegration/src/FSharp.Editor/LanguageService/SingleFileWorkspaceMap.fs index 9052a69578e..d82cb40a2ac 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/SingleFileWorkspaceMap.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/SingleFileWorkspaceMap.fs @@ -4,6 +4,7 @@ namespace Microsoft.VisualStudio.FSharp.Editor open System open System.Collections.Concurrent +open System.Collections.Immutable open Microsoft.CodeAnalysis open Microsoft.VisualStudio open Microsoft.VisualStudio.FSharp.Editor @@ -13,18 +14,73 @@ open Microsoft.VisualStudio.Shell.Interop open Microsoft.VisualStudio.LanguageServices open FSharp.Compiler.CodeAnalysis -type private ScriptDependencies = ResizeArray +type internal IFSharpWorkspaceProjectContext = + inherit IDisposable -[] -type internal SingleFileWorkspaceMap(workspace: Workspace, - miscFilesWorkspace: MiscellaneousFilesWorkspace, - projectContextFactory: IWorkspaceProjectContextFactory, - rdt: IVsRunningDocumentTable) as this = + abstract Id : ProjectId - // We have a lock because the `ScriptUpdated` event may happen concurrently when a document opens or closes. - let gate = obj() - let files = ConcurrentDictionary(StringComparer.OrdinalIgnoreCase) - let optionsManager = workspace.Services.GetRequiredService().FSharpProjectOptionsManager + abstract FilePath : string + + abstract ProjectReferenceCount : int + + abstract HasProjectReference : filePath: string -> bool + + abstract SetProjectReferences : IFSharpWorkspaceProjectContext seq -> unit + +type internal IFSharpWorkspaceProjectContextFactory = + + abstract CreateProjectContext : filePath: string -> IFSharpWorkspaceProjectContext + +type internal FSharpWorkspaceProjectContext(vsProjectContext: IWorkspaceProjectContext) = + + let mutable refs = ImmutableDictionary.Create(StringComparer.OrdinalIgnoreCase) + + member private _.VisualStudioProjectContext = vsProjectContext + + member private _.AddProjectReference(builder: ImmutableDictionary<_, _>.Builder, projectContext: IFSharpWorkspaceProjectContext) = + match projectContext with + | :? FSharpWorkspaceProjectContext as fsProjectContext -> + vsProjectContext.AddProjectReference(fsProjectContext.VisualStudioProjectContext, MetadataReferenceProperties.Assembly) + builder.Add(projectContext.FilePath, projectContext) + | _ -> + () + + member private _.RemoveProjectReference(projectContext: IFSharpWorkspaceProjectContext) = + match projectContext with + | :? FSharpWorkspaceProjectContext as fsProjectContext -> + vsProjectContext.RemoveProjectReference(fsProjectContext.VisualStudioProjectContext) + | _ -> + () + + interface IFSharpWorkspaceProjectContext with + + member _.Id = vsProjectContext.Id + + member _.FilePath = vsProjectContext.ProjectFilePath + + member _.ProjectReferenceCount = refs.Count + + member _.HasProjectReference(filePath) = refs.ContainsKey(filePath) + + member this.SetProjectReferences(projRefs) = + let builder = ImmutableDictionary.CreateBuilder() + + refs.Values + |> Seq.iter (fun x -> + this.RemoveProjectReference(x) + ) + + projRefs + |> Seq.iter (fun x -> + this.AddProjectReference(builder, x) + ) + + refs <- builder.ToImmutable() + + member _.Dispose() = + vsProjectContext.Dispose() + +type internal FSharpWorkspaceProjectContextFactory(projectContextFactory: IWorkspaceProjectContextFactory) = static let createSourceCodeKind (filePath: string) = if isScriptFile filePath then @@ -32,56 +88,68 @@ type internal SingleFileWorkspaceMap(workspace: Workspace, else SourceCodeKind.Regular - static let canUpdateScript (depSourceFiles: string []) (currentDepSourceFiles: ScriptDependencies) = - depSourceFiles.Length <> currentDepSourceFiles.Count || + interface IFSharpWorkspaceProjectContextFactory with + + member _.CreateProjectContext filePath = + let projectContext = projectContextFactory.CreateProjectContext(FSharpConstants.FSharpLanguageName, filePath, filePath, Guid.NewGuid(), null, null) + projectContext.DisplayName <- FSharpConstants.FSharpMiscellaneousFilesName + projectContext.AddSourceFile(filePath, sourceCodeKind = createSourceCodeKind filePath) + new FSharpWorkspaceProjectContext(projectContext) :> IFSharpWorkspaceProjectContext + +type internal FSharpMiscellaneousFileService(workspace: Workspace, + miscFilesWorkspace: Workspace, + projectContextFactory: IFSharpWorkspaceProjectContextFactory) = + + // We have a lock because the `ScriptUpdated` event may happen concurrently when a document opens or closes. + let gate = obj() + let files = ConcurrentDictionary(StringComparer.OrdinalIgnoreCase) + let optionsManager = workspace.Services.GetRequiredService().FSharpProjectOptionsManager + + static let mustUpdateProject (refSourceFiles: string []) (projectContext: IFSharpWorkspaceProjectContext) = + refSourceFiles.Length <> projectContext.ProjectReferenceCount || ( - (currentDepSourceFiles, depSourceFiles) - ||> Seq.forall2 (fun (x: string) y -> x.Equals(y, StringComparison.OrdinalIgnoreCase)) + refSourceFiles + |> Seq.forall projectContext.HasProjectReference |> not - ) - static let createProjectContext (projectContextFactory: IWorkspaceProjectContextFactory) filePath = - let projectContext = projectContextFactory.CreateProjectContext(FSharpConstants.FSharpLanguageName, filePath, filePath, Guid.NewGuid(), null, null) - projectContext.DisplayName <- FSharpConstants.FSharpMiscellaneousFilesName - projectContext.AddSourceFile(filePath, sourceCodeKind = createSourceCodeKind filePath) - projectContext, ScriptDependencies() + let tryRemove (document: Document) = + optionsManager.ClearSingleFileOptionsCache(document.Id) + + match files.TryRemove(document.FilePath) with + | true, projectContext -> + let projIds = document.Project.Solution.GetDependentProjectIds(document.Project.Id) + if projIds.Count = 0 then + (projectContext :> IDisposable).Dispose() + | _ -> + () do optionsManager.ScriptUpdated.Add(fun scriptProjectOptions -> if scriptProjectOptions.SourceFiles.Length > 0 then // The last file in the project options is the main script file. let filePath = scriptProjectOptions.SourceFiles.[scriptProjectOptions.SourceFiles.Length - 1] - let depSourceFiles = scriptProjectOptions.SourceFiles |> Array.take (scriptProjectOptions.SourceFiles.Length - 1) - - lock gate (fun () -> - match files.TryGetValue(filePath) with - | true, (projectContext: IWorkspaceProjectContext, currentDepSourceFiles: ScriptDependencies) -> - if canUpdateScript depSourceFiles currentDepSourceFiles then - currentDepSourceFiles - |> Seq.iter (fun x -> - match files.TryGetValue(x) with - | true, (depProjectContext, _) -> - projectContext.RemoveProjectReference(depProjectContext) - | _ -> - () - ) - - currentDepSourceFiles.Clear() - depSourceFiles - |> Array.iter (fun filePath -> - currentDepSourceFiles.Add(filePath) - match files.TryGetValue(filePath) with - | true, (depProjectContext, _) -> - projectContext.AddProjectReference(depProjectContext, MetadataReferenceProperties.Assembly) - | _ -> - let result = createProjectContext projectContextFactory filePath - files.[filePath] <- result - let depProjectContext, _ = result - projectContext.AddProjectReference(depProjectContext, MetadataReferenceProperties.Assembly) - ) - | _ -> () - ) + let refSourceFiles = scriptProjectOptions.SourceFiles |> Array.take (scriptProjectOptions.SourceFiles.Length - 1) + + match files.TryGetValue(filePath) with + | true, (projectContext: IFSharpWorkspaceProjectContext) -> + if mustUpdateProject refSourceFiles projectContext then + lock gate (fun () -> + let newProjRefs = + refSourceFiles + |> Array.map (fun filePath -> + match files.TryGetValue(filePath) with + | true, refProjectContext -> refProjectContext + | _ -> + let refProjectContext = projectContextFactory.CreateProjectContext(filePath) + files.[filePath] <- refProjectContext + refProjectContext + ) + + projectContext.SetProjectReferences(newProjRefs) + ) + | _ -> + () ) miscFilesWorkspace.DocumentOpened.Add(fun args -> @@ -93,56 +161,82 @@ type internal SingleFileWorkspaceMap(workspace: Workspace, let filePath = document.FilePath lock gate (fun () -> if files.ContainsKey(filePath) |> not then - files.[filePath] <- createProjectContext projectContextFactory filePath + files.[filePath] <- projectContextFactory.CreateProjectContext(filePath) ) ) workspace.DocumentOpened.Add(fun args -> let document = args.Document if not document.Project.IsFSharpMiscellaneousOrMetadata then - optionsManager.ClearSingleFileOptionsCache(document.Id) - - let projectContextOpt = + if files.ContainsKey(document.FilePath) then lock gate (fun () -> - match files.TryRemove(document.FilePath) with - | true, (projectContext, _) -> - Some projectContext - | _ -> - None + tryRemove document ) - - match projectContextOpt with - | Some projectContext -> - projectContext.Dispose() - | _ -> - () ) workspace.DocumentClosed.Add(fun args -> let document = args.Document if document.Project.IsFSharpMiscellaneousOrMetadata then - optionsManager.ClearSingleFileOptionsCache(document.Id) - - let projectContextOpt = - lock gate (fun () -> - match files.TryRemove(document.FilePath) with - | true, (projectContext, _) -> - Some projectContext - | _ -> - None - ) + lock gate (fun () -> + tryRemove document + ) + ) - match projectContextOpt with - | Some projectContext -> - let projIds = document.Project.Solution.GetDependentProjectIds(document.Project.Id) - if projIds.Count = 0 then - projectContext.Dispose() - | _ -> - () + workspace.WorkspaceChanged.Add(fun args -> + match args.Kind with + | WorkspaceChangeKind.ProjectRemoved -> + let proj = args.OldSolution.GetProject(args.ProjectId) + if proj.IsFSharpMiscellaneousOrMetadata then + let projRefs = + proj.GetAllProjectsThisProjectDependsOn() + |> Array.ofSeq + + if projRefs.Length > 0 then + lock gate (fun () -> + projRefs + |> Array.iter (fun proj -> + if proj.IsFSharpMiscellaneousOrMetadata then + match proj.Documents |> Seq.tryExactlyOne with + | Some doc when not (workspace.IsDocumentOpen(doc.Id)) -> + tryRemove doc + | _ -> + () + ) + ) + | _ -> + () ) - do - rdt.AdviseRunningDocTableEvents(this) |> ignore + member _.Workspace = workspace + + member _.ProjectContextFactory = projectContextFactory + + member _.ContainsFile filePath = files.ContainsKey(filePath) + + member _.RenameFile(filePath, newFilePath) = + match files.TryRemove(filePath) with + | true, projectContext -> + let project = workspace.CurrentSolution.GetProject(projectContext.Id) + if project <> null then + let documentOpt = + project.Documents + |> Seq.tryFind (fun x -> String.Equals(x.FilePath, filePath, StringComparison.OrdinalIgnoreCase)) + match documentOpt with + | None -> () + | Some(document) -> + optionsManager.ClearSingleFileOptionsCache(document.Id) + projectContext.Dispose() + files.[newFilePath] <- projectContextFactory.CreateProjectContext(newFilePath) + else + projectContext.Dispose() // fallback, shouldn't happen, but in case it does let's dispose of the project context so we don't leak + | _ -> () + +[] +type internal SingleFileWorkspaceMap(miscFileService: FSharpMiscellaneousFileService, + rdt: IVsRunningDocumentTable) as this = + + do + rdt.AdviseRunningDocTableEvents(this) |> ignore interface IVsRunningDocTableEvents with @@ -164,23 +258,8 @@ type internal SingleFileWorkspaceMap(workspace: Workspace, member _.OnAfterAttributeChangeEx(_, grfAttribs, _, _, pszMkDocumentOld, _, _, pszMkDocumentNew) = // Handles renaming of a misc file - if (grfAttribs &&& (uint32 __VSRDTATTRIB.RDTA_MkDocument)) <> 0u && files.ContainsKey(pszMkDocumentOld) then - match files.TryRemove(pszMkDocumentOld) with - | true, (projectContext, _) -> - let project = workspace.CurrentSolution.GetProject(projectContext.Id) - if project <> null then - let documentOpt = - project.Documents - |> Seq.tryFind (fun x -> String.Equals(x.FilePath, pszMkDocumentOld, StringComparison.OrdinalIgnoreCase)) - match documentOpt with - | None -> () - | Some(document) -> - optionsManager.ClearSingleFileOptionsCache(document.Id) - projectContext.Dispose() - files.[pszMkDocumentNew] <- createProjectContext projectContextFactory pszMkDocumentNew - else - projectContext.Dispose() // fallback, shouldn't happen, but in case it does let's dispose of the project context so we don't leak - | _ -> () + if (grfAttribs &&& (uint32 __VSRDTATTRIB.RDTA_MkDocument)) <> 0u && miscFileService.ContainsFile(pszMkDocumentOld) then + miscFileService.RenameFile(pszMkDocumentOld, pszMkDocumentNew) VSConstants.S_OK member _.OnAfterDocumentWindowHide(_, _) = VSConstants.E_NOTIMPL From 634b7d981877867723da21cb102f4cd0a3058b85 Mon Sep 17 00:00:00 2001 From: Will Smith Date: Thu, 24 Jun 2021 14:51:08 -0700 Subject: [PATCH 11/42] Added basic misc file workspace test --- .../tests/UnitTests/Tests.RoslynHelpers.fs | 53 ++++++++ .../UnitTests/VisualFSharp.UnitTests.fsproj | 1 + .../UnitTests/Workspace/WorkspaceTests.fs | 124 ++++++++++++++++++ 3 files changed, 178 insertions(+) create mode 100644 vsintegration/tests/UnitTests/Workspace/WorkspaceTests.fs diff --git a/vsintegration/tests/UnitTests/Tests.RoslynHelpers.fs b/vsintegration/tests/UnitTests/Tests.RoslynHelpers.fs index 7481753ec30..0c6e2939f82 100644 --- a/vsintegration/tests/UnitTests/Tests.RoslynHelpers.fs +++ b/vsintegration/tests/UnitTests/Tests.RoslynHelpers.fs @@ -200,6 +200,59 @@ type TestHostServices() = [] type RoslynTestHelpers private () = + static member CreateProjectInfoWithSingleDocument(docFilePath) = + let isScript = String.Equals(Path.GetExtension(docFilePath), ".fsx", StringComparison.OrdinalIgnoreCase) + + let projId = ProjectId.CreateNewId() + let docId = DocumentId.CreateNewId(projId) + + let docInfo = + DocumentInfo.Create( + docId, + docFilePath, + filePath=docFilePath, + sourceCodeKind= if isScript then SourceCodeKind.Script else SourceCodeKind.Regular) + + let projFilePath = "C:\\test.fsproj" + ProjectInfo.Create( + projId, + VersionStamp.Create(DateTime.UtcNow), + projFilePath, + "test.dll", + LanguageNames.FSharp, + documents = [docInfo], + filePath = projFilePath + ) + + static member CreateSolutionInfoWithSingleDocument(docFilePath) = + let isScript = String.Equals(Path.GetExtension(docFilePath), ".fsx", StringComparison.OrdinalIgnoreCase) + + let projId = ProjectId.CreateNewId() + let docId = DocumentId.CreateNewId(projId) + + let docInfo = + DocumentInfo.Create( + docId, + docFilePath, + filePath=docFilePath, + sourceCodeKind= if isScript then SourceCodeKind.Script else SourceCodeKind.Regular) + + let projFilePath = "C:\\test.fsproj" + let projInfo = + ProjectInfo.Create( + projId, + VersionStamp.Create(DateTime.UtcNow), + projFilePath, + "test.dll", + LanguageNames.FSharp, + documents = [docInfo], + filePath = projFilePath + ) + + let solutionInfo = SolutionInfo.Create(SolutionId.CreateNewId(), VersionStamp.Create(DateTime.UtcNow), "test.sln", [projInfo]) + + solutionInfo + static member CreateDocument (filePath, text: SourceText, ?options: FSharp.Compiler.CodeAnalysis.FSharpProjectOptions) = let isScript = String.Equals(Path.GetExtension(filePath), ".fsx", StringComparison.OrdinalIgnoreCase) diff --git a/vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj b/vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj index baa2c21ae98..d4a67482ad2 100644 --- a/vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj +++ b/vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj @@ -37,6 +37,7 @@ + diff --git a/vsintegration/tests/UnitTests/Workspace/WorkspaceTests.fs b/vsintegration/tests/UnitTests/Workspace/WorkspaceTests.fs new file mode 100644 index 00000000000..7b96820de9c --- /dev/null +++ b/vsintegration/tests/UnitTests/Workspace/WorkspaceTests.fs @@ -0,0 +1,124 @@ +namespace VisualFSharp.UnitTests + +open System +open System.IO +open System.Reflection +open System.Linq +open System.Composition.Hosting +open System.Collections.Generic +open System.Collections.Immutable +open Microsoft.VisualStudio.Composition +open Microsoft.CodeAnalysis +open Microsoft.CodeAnalysis.Host +open Microsoft.CodeAnalysis.Text +open Microsoft.VisualStudio.FSharp.Editor +open Microsoft.CodeAnalysis.Host.Mef +open Microsoft.VisualStudio.LanguageServices +open Microsoft.VisualStudio.Shell +open Microsoft.VisualStudio.FSharp.Editor.Tests.Roslyn +open NUnit.Framework + +[] +module WorkspaceTests = + + type TestFSharpWorkspaceProjectContext(mainProj: Project) = + + let mutable mainProj = mainProj + + interface IFSharpWorkspaceProjectContext with + + member this.Dispose(): unit = () + + member this.FilePath: string = mainProj.FilePath + + member this.HasProjectReference(filePath: string): bool = + mainProj.ProjectReferences + |> Seq.exists (fun x -> + let projRef = mainProj.Solution.GetProject(x.ProjectId) + if projRef <> null then + String.Equals(filePath, projRef.FilePath, StringComparison.OrdinalIgnoreCase) + else + false + ) + + member this.Id: ProjectId = mainProj.Id + + member this.ProjectReferenceCount: int = mainProj.ProjectReferences.Count() + + member this.SetProjectReferences(projRefs: seq): unit = + let currentProj = mainProj + let mutable solution = currentProj.Solution + + mainProj.ProjectReferences + |> Seq.iter (fun projRef -> + solution <- solution.RemoveProjectReference(currentProj.Id, projRef) + ) + + projRefs + |> Seq.iter (fun projRef -> + solution <- + solution.AddProjectReference( + currentProj.Id, + ProjectReference(projRef.Id) + ) + ) + + if not (solution.Workspace.TryApplyChanges(solution)) then + failwith "Unable to apply workspace changes." + + mainProj <- solution.GetProject(currentProj.Id) + + type TestFSharpWorkspaceProjectContextFactory(workspace: Workspace) = + + interface IFSharpWorkspaceProjectContextFactory with + member this.CreateProjectContext(filePath: string): IFSharpWorkspaceProjectContext = + let projInfo = RoslynTestHelpers.CreateProjectInfoWithSingleDocument(filePath) + if not (workspace.TryApplyChanges(workspace.CurrentSolution.AddProject(projInfo))) then + failwith "Unable to apply workspace changes." + + let proj = workspace.CurrentSolution.GetProject(projInfo.Id) + new TestFSharpWorkspaceProjectContext(proj) :> IFSharpWorkspaceProjectContext + + let createOnDiskScript src = + let tmpFilePath = Path.GetTempFileName() + let tmpRealFilePath = Path.ChangeExtension(tmpFilePath, ".fsx") + try File.Delete(tmpFilePath) with | _ -> () + File.WriteAllText(tmpRealFilePath, src) + tmpRealFilePath + + let createWorkspace() = + new AdhocWorkspace(TestHostServices()) + + let createMiscFileWorkspace() = + createWorkspace() + + [] + let ``Script file opened in misc files workspace will get transferred to normal workspace``() = + let workspace = createWorkspace() + let miscFilesWorkspace = createMiscFileWorkspace() + let projectContextFactory = TestFSharpWorkspaceProjectContextFactory(workspace) + + let miscFileService = FSharpMiscellaneousFileService(workspace, miscFilesWorkspace, projectContextFactory) + + let filePath = + createOnDiskScript + """ +module Script1 + +let x = 1 + """ + + try + let solutionInfo = RoslynTestHelpers.CreateSolutionInfoWithSingleDocument(filePath) + miscFilesWorkspace.AddSolution(solutionInfo) |> ignore + + let doc = + miscFilesWorkspace.CurrentSolution.GetDocumentIdsWithFilePath(filePath) + |> Seq.exactlyOne + |> miscFilesWorkspace.CurrentSolution.GetDocument + + Assert.IsFalse(miscFilesWorkspace.IsDocumentOpen(doc.Id)) + Assert.AreEqual(0, workspace.CurrentSolution.GetDocumentIdsWithFilePath(filePath).Length) + + finally + try File.Delete(filePath) with | _ -> () From 3148886fc3e0d83f2a5d9214090a2a120f0b0709 Mon Sep 17 00:00:00 2001 From: Will Smith Date: Thu, 24 Jun 2021 15:30:48 -0700 Subject: [PATCH 12/42] First workspace script test done --- .../tests/UnitTests/Tests.RoslynHelpers.fs | 29 --------------- .../UnitTests/Workspace/WorkspaceTests.fs | 36 ++++++++++++++++--- 2 files changed, 31 insertions(+), 34 deletions(-) diff --git a/vsintegration/tests/UnitTests/Tests.RoslynHelpers.fs b/vsintegration/tests/UnitTests/Tests.RoslynHelpers.fs index 0c6e2939f82..32036ef44ff 100644 --- a/vsintegration/tests/UnitTests/Tests.RoslynHelpers.fs +++ b/vsintegration/tests/UnitTests/Tests.RoslynHelpers.fs @@ -224,35 +224,6 @@ type RoslynTestHelpers private () = filePath = projFilePath ) - static member CreateSolutionInfoWithSingleDocument(docFilePath) = - let isScript = String.Equals(Path.GetExtension(docFilePath), ".fsx", StringComparison.OrdinalIgnoreCase) - - let projId = ProjectId.CreateNewId() - let docId = DocumentId.CreateNewId(projId) - - let docInfo = - DocumentInfo.Create( - docId, - docFilePath, - filePath=docFilePath, - sourceCodeKind= if isScript then SourceCodeKind.Script else SourceCodeKind.Regular) - - let projFilePath = "C:\\test.fsproj" - let projInfo = - ProjectInfo.Create( - projId, - VersionStamp.Create(DateTime.UtcNow), - projFilePath, - "test.dll", - LanguageNames.FSharp, - documents = [docInfo], - filePath = projFilePath - ) - - let solutionInfo = SolutionInfo.Create(SolutionId.CreateNewId(), VersionStamp.Create(DateTime.UtcNow), "test.sln", [projInfo]) - - solutionInfo - static member CreateDocument (filePath, text: SourceText, ?options: FSharp.Compiler.CodeAnalysis.FSharpProjectOptions) = let isScript = String.Equals(Path.GetExtension(filePath), ".fsx", StringComparison.OrdinalIgnoreCase) diff --git a/vsintegration/tests/UnitTests/Workspace/WorkspaceTests.fs b/vsintegration/tests/UnitTests/Workspace/WorkspaceTests.fs index 7b96820de9c..ffb61ca196c 100644 --- a/vsintegration/tests/UnitTests/Workspace/WorkspaceTests.fs +++ b/vsintegration/tests/UnitTests/Workspace/WorkspaceTests.fs @@ -7,6 +7,7 @@ open System.Linq open System.Composition.Hosting open System.Collections.Generic open System.Collections.Immutable +open System.Threading open Microsoft.VisualStudio.Composition open Microsoft.CodeAnalysis open Microsoft.CodeAnalysis.Host @@ -68,10 +69,18 @@ module WorkspaceTests = mainProj <- solution.GetProject(currentProj.Id) - type TestFSharpWorkspaceProjectContextFactory(workspace: Workspace) = + type TestFSharpWorkspaceProjectContextFactory(workspace: Workspace, miscFilesWorkspace: Workspace) = interface IFSharpWorkspaceProjectContextFactory with member this.CreateProjectContext(filePath: string): IFSharpWorkspaceProjectContext = + match miscFilesWorkspace.CurrentSolution.GetDocumentIdsWithFilePath(filePath) |> Seq.tryExactlyOne with + | Some docId -> + let doc = miscFilesWorkspace.CurrentSolution.GetDocument(docId) + if not (miscFilesWorkspace.TryApplyChanges(miscFilesWorkspace.CurrentSolution.RemoveProject(doc.Project.Id))) then + failwith "Unable to apply workspace changes." + | _ -> + () + let projInfo = RoslynTestHelpers.CreateProjectInfoWithSingleDocument(filePath) if not (workspace.TryApplyChanges(workspace.CurrentSolution.AddProject(projInfo))) then failwith "Unable to apply workspace changes." @@ -92,13 +101,21 @@ module WorkspaceTests = let createMiscFileWorkspace() = createWorkspace() + let openDocument (workspace: Workspace) (docId: DocumentId) = + use waitHandle = new ManualResetEventSlim(false) + use _sub = workspace.DocumentOpened.Subscribe(fun _ -> + waitHandle.Set() + ) + workspace.OpenDocument(docId) + waitHandle.Wait() + [] let ``Script file opened in misc files workspace will get transferred to normal workspace``() = let workspace = createWorkspace() let miscFilesWorkspace = createMiscFileWorkspace() - let projectContextFactory = TestFSharpWorkspaceProjectContextFactory(workspace) + let projectContextFactory = TestFSharpWorkspaceProjectContextFactory(workspace, miscFilesWorkspace) - let miscFileService = FSharpMiscellaneousFileService(workspace, miscFilesWorkspace, projectContextFactory) + let _miscFileService = FSharpMiscellaneousFileService(workspace, miscFilesWorkspace, projectContextFactory) let filePath = createOnDiskScript @@ -109,8 +126,9 @@ let x = 1 """ try - let solutionInfo = RoslynTestHelpers.CreateSolutionInfoWithSingleDocument(filePath) - miscFilesWorkspace.AddSolution(solutionInfo) |> ignore + let projInfo = RoslynTestHelpers.CreateProjectInfoWithSingleDocument(filePath) + if not (miscFilesWorkspace.TryApplyChanges(miscFilesWorkspace.CurrentSolution.AddProject(projInfo))) then + failwith "Unable to apply workspace changes." let doc = miscFilesWorkspace.CurrentSolution.GetDocumentIdsWithFilePath(filePath) @@ -120,5 +138,13 @@ let x = 1 Assert.IsFalse(miscFilesWorkspace.IsDocumentOpen(doc.Id)) Assert.AreEqual(0, workspace.CurrentSolution.GetDocumentIdsWithFilePath(filePath).Length) + openDocument miscFilesWorkspace doc.Id + // Although we opened the document, this is false as it has been transferred to the other workspace. + Assert.IsFalse(miscFilesWorkspace.IsDocumentOpen(doc.Id)) + + Assert.AreEqual(0, miscFilesWorkspace.CurrentSolution.GetDocumentIdsWithFilePath(filePath).Length) + Assert.AreEqual(1, workspace.CurrentSolution.GetDocumentIdsWithFilePath(filePath).Length) + Assert.IsFalse(workspace.IsDocumentOpen(doc.Id)) + finally try File.Delete(filePath) with | _ -> () From bc96ed8796959f0423770e989ad966c32d23966b Mon Sep 17 00:00:00 2001 From: Will Smith Date: Thu, 24 Jun 2021 16:32:18 -0700 Subject: [PATCH 13/42] Added tests for scripts referencing scripts --- .../tests/UnitTests/Tests.RoslynHelpers.fs | 6 +- .../UnitTests/Workspace/WorkspaceTests.fs | 237 +++++++++++++++--- 2 files changed, 206 insertions(+), 37 deletions(-) diff --git a/vsintegration/tests/UnitTests/Tests.RoslynHelpers.fs b/vsintegration/tests/UnitTests/Tests.RoslynHelpers.fs index 32036ef44ff..4387329518f 100644 --- a/vsintegration/tests/UnitTests/Tests.RoslynHelpers.fs +++ b/vsintegration/tests/UnitTests/Tests.RoslynHelpers.fs @@ -2,6 +2,7 @@ open System open System.IO +open System.Text open System.Reflection open System.Linq open System.Composition.Hosting @@ -200,7 +201,7 @@ type TestHostServices() = [] type RoslynTestHelpers private () = - static member CreateProjectInfoWithSingleDocument(docFilePath) = + static member CreateProjectInfoWithSingleDocument(projName, docFilePath) = let isScript = String.Equals(Path.GetExtension(docFilePath), ".fsx", StringComparison.OrdinalIgnoreCase) let projId = ProjectId.CreateNewId() @@ -211,13 +212,14 @@ type RoslynTestHelpers private () = docId, docFilePath, filePath=docFilePath, + loader = new FileTextLoader(docFilePath, Encoding.Default), sourceCodeKind= if isScript then SourceCodeKind.Script else SourceCodeKind.Regular) let projFilePath = "C:\\test.fsproj" ProjectInfo.Create( projId, VersionStamp.Create(DateTime.UtcNow), - projFilePath, + projName, "test.dll", LanguageNames.FSharp, documents = [docInfo], diff --git a/vsintegration/tests/UnitTests/Workspace/WorkspaceTests.fs b/vsintegration/tests/UnitTests/Workspace/WorkspaceTests.fs index ffb61ca196c..e9c2bfe5fee 100644 --- a/vsintegration/tests/UnitTests/Workspace/WorkspaceTests.fs +++ b/vsintegration/tests/UnitTests/Workspace/WorkspaceTests.fs @@ -22,6 +22,53 @@ open NUnit.Framework [] module WorkspaceTests = + let createOnDiskScript src = + let tmpFilePath = Path.GetTempFileName() + let tmpRealFilePath = Path.ChangeExtension(tmpFilePath, ".fsx") + try File.Delete(tmpFilePath) with | _ -> () + File.WriteAllText(tmpRealFilePath, src) + tmpRealFilePath + + let createWorkspace() = + new AdhocWorkspace(TestHostServices()) + + let createMiscFileWorkspace() = + createWorkspace() + + let openDocument (workspace: Workspace) (docId: DocumentId) = + use waitHandle = new ManualResetEventSlim(false) + use _sub = workspace.DocumentOpened.Subscribe(fun _ -> + waitHandle.Set() + ) + workspace.OpenDocument(docId) + waitHandle.Wait() + + let getDocument (workspace: Workspace) filePath = + let solution = workspace.CurrentSolution + solution.GetDocumentIdsWithFilePath(filePath) + |> Seq.exactlyOne + |> solution.GetDocument + + let addProject (workspace: Workspace) projInfo = + if not (workspace.TryApplyChanges(workspace.CurrentSolution.AddProject(projInfo))) then + failwith "Unable to apply workspace changes." + + let removeProject (workspace: Workspace) projId = + if not (workspace.TryApplyChanges(workspace.CurrentSolution.RemoveProject(projId))) then + failwith "Unable to apply workspace changes." + + let assertEmptyDocumentDiagnostics (doc: Document) = + let parseResults, checkResults = doc.GetFSharpParseAndCheckResultsAsync("assertEmptyDocumentDiagnostics") |> Async.RunSynchronously + + Assert.IsEmpty(parseResults.Diagnostics) + Assert.IsEmpty(checkResults.Diagnostics) + + let assertHasDocumentDiagnostics (doc: Document) = + let parseResults, checkResults = doc.GetFSharpParseAndCheckResultsAsync("assertHasDocumentDiagnostics") |> Async.RunSynchronously + + Assert.IsEmpty(parseResults.Diagnostics) + Assert.IsNotEmpty(checkResults.Diagnostics) + type TestFSharpWorkspaceProjectContext(mainProj: Project) = let mutable mainProj = mainProj @@ -64,8 +111,7 @@ module WorkspaceTests = ) ) - if not (solution.Workspace.TryApplyChanges(solution)) then - failwith "Unable to apply workspace changes." + not (solution.Workspace.TryApplyChanges(solution)) |> ignore mainProj <- solution.GetProject(currentProj.Id) @@ -76,39 +122,16 @@ module WorkspaceTests = match miscFilesWorkspace.CurrentSolution.GetDocumentIdsWithFilePath(filePath) |> Seq.tryExactlyOne with | Some docId -> let doc = miscFilesWorkspace.CurrentSolution.GetDocument(docId) - if not (miscFilesWorkspace.TryApplyChanges(miscFilesWorkspace.CurrentSolution.RemoveProject(doc.Project.Id))) then - failwith "Unable to apply workspace changes." + removeProject miscFilesWorkspace doc.Project.Id | _ -> () - let projInfo = RoslynTestHelpers.CreateProjectInfoWithSingleDocument(filePath) - if not (workspace.TryApplyChanges(workspace.CurrentSolution.AddProject(projInfo))) then - failwith "Unable to apply workspace changes." + let projInfo = RoslynTestHelpers.CreateProjectInfoWithSingleDocument(FSharpConstants.FSharpMiscellaneousFilesName, filePath) + addProject workspace projInfo let proj = workspace.CurrentSolution.GetProject(projInfo.Id) new TestFSharpWorkspaceProjectContext(proj) :> IFSharpWorkspaceProjectContext - let createOnDiskScript src = - let tmpFilePath = Path.GetTempFileName() - let tmpRealFilePath = Path.ChangeExtension(tmpFilePath, ".fsx") - try File.Delete(tmpFilePath) with | _ -> () - File.WriteAllText(tmpRealFilePath, src) - tmpRealFilePath - - let createWorkspace() = - new AdhocWorkspace(TestHostServices()) - - let createMiscFileWorkspace() = - createWorkspace() - - let openDocument (workspace: Workspace) (docId: DocumentId) = - use waitHandle = new ManualResetEventSlim(false) - use _sub = workspace.DocumentOpened.Subscribe(fun _ -> - waitHandle.Set() - ) - workspace.OpenDocument(docId) - waitHandle.Wait() - [] let ``Script file opened in misc files workspace will get transferred to normal workspace``() = let workspace = createWorkspace() @@ -126,14 +149,10 @@ let x = 1 """ try - let projInfo = RoslynTestHelpers.CreateProjectInfoWithSingleDocument(filePath) - if not (miscFilesWorkspace.TryApplyChanges(miscFilesWorkspace.CurrentSolution.AddProject(projInfo))) then - failwith "Unable to apply workspace changes." + let projInfo = RoslynTestHelpers.CreateProjectInfoWithSingleDocument(filePath, filePath) + addProject miscFilesWorkspace projInfo - let doc = - miscFilesWorkspace.CurrentSolution.GetDocumentIdsWithFilePath(filePath) - |> Seq.exactlyOne - |> miscFilesWorkspace.CurrentSolution.GetDocument + let doc = getDocument miscFilesWorkspace filePath Assert.IsFalse(miscFilesWorkspace.IsDocumentOpen(doc.Id)) Assert.AreEqual(0, workspace.CurrentSolution.GetDocumentIdsWithFilePath(filePath).Length) @@ -144,7 +163,155 @@ let x = 1 Assert.AreEqual(0, miscFilesWorkspace.CurrentSolution.GetDocumentIdsWithFilePath(filePath).Length) Assert.AreEqual(1, workspace.CurrentSolution.GetDocumentIdsWithFilePath(filePath).Length) + + let doc = getDocument workspace filePath + Assert.IsFalse(workspace.IsDocumentOpen(doc.Id)) + assertEmptyDocumentDiagnostics doc + finally try File.Delete(filePath) with | _ -> () + + [] + let ``Script file referencing another script should have no diagnostics``() = + let workspace = createWorkspace() + let miscFilesWorkspace = createMiscFileWorkspace() + let projectContextFactory = TestFSharpWorkspaceProjectContextFactory(workspace, miscFilesWorkspace) + + let _miscFileService = FSharpMiscellaneousFileService(workspace, miscFilesWorkspace, projectContextFactory) + + let filePath1 = + createOnDiskScript + """ +module Script1 + +let x = 1 + """ + + let filePath2 = + createOnDiskScript + $""" +module Script2 +#load "{ Path.GetFileName(filePath1) }" + +let x = Script1.x + """ + + try + let projInfo2 = RoslynTestHelpers.CreateProjectInfoWithSingleDocument(filePath2, filePath2) + + addProject miscFilesWorkspace projInfo2 + + openDocument miscFilesWorkspace (getDocument miscFilesWorkspace filePath2).Id + + let doc2 = getDocument workspace filePath2 + assertEmptyDocumentDiagnostics doc2 + + finally + try File.Delete(filePath1) with | _ -> () + try File.Delete(filePath2) with | _ -> () + + [] + let ``Script file referencing another script will correct update when the referenced script file changes``() = + let workspace = createWorkspace() + let miscFilesWorkspace = createMiscFileWorkspace() + let projectContextFactory = TestFSharpWorkspaceProjectContextFactory(workspace, miscFilesWorkspace) + + let _miscFileService = FSharpMiscellaneousFileService(workspace, miscFilesWorkspace, projectContextFactory) + + let filePath1 = + createOnDiskScript + """ +module Script1 + """ + + let filePath2 = + createOnDiskScript + $""" +module Script2 +#load "{ Path.GetFileName(filePath1) }" + +let x = Script1.x + """ + + try + let projInfo1 = RoslynTestHelpers.CreateProjectInfoWithSingleDocument(filePath1, filePath1) + let projInfo2 = RoslynTestHelpers.CreateProjectInfoWithSingleDocument(filePath2, filePath2) + + addProject miscFilesWorkspace projInfo1 + addProject miscFilesWorkspace projInfo2 + + openDocument miscFilesWorkspace (getDocument miscFilesWorkspace filePath1).Id + openDocument miscFilesWorkspace (getDocument miscFilesWorkspace filePath2).Id + + let doc1 = getDocument workspace filePath1 + assertEmptyDocumentDiagnostics doc1 + + let doc2 = getDocument workspace filePath2 + assertHasDocumentDiagnostics doc2 + + File.WriteAllText(filePath1, + """ +module Script1 + +let x = 1 + """) + + assertEmptyDocumentDiagnostics doc2 + + finally + try File.Delete(filePath1) with | _ -> () + try File.Delete(filePath2) with | _ -> () + + [] + let ``Script file referencing another script will correct update when the referenced script file changes with opening in reverse order``() = + let workspace = createWorkspace() + let miscFilesWorkspace = createMiscFileWorkspace() + let projectContextFactory = TestFSharpWorkspaceProjectContextFactory(workspace, miscFilesWorkspace) + + let _miscFileService = FSharpMiscellaneousFileService(workspace, miscFilesWorkspace, projectContextFactory) + + let filePath1 = + createOnDiskScript + """ +module Script1 + """ + + let filePath2 = + createOnDiskScript + $""" +module Script2 +#load "{ Path.GetFileName(filePath1) }" + +let x = Script1.x + """ + + try + let projInfo1 = RoslynTestHelpers.CreateProjectInfoWithSingleDocument(filePath1, filePath1) + let projInfo2 = RoslynTestHelpers.CreateProjectInfoWithSingleDocument(filePath2, filePath2) + + addProject miscFilesWorkspace projInfo1 + addProject miscFilesWorkspace projInfo2 + + openDocument miscFilesWorkspace (getDocument miscFilesWorkspace filePath2).Id + openDocument miscFilesWorkspace (getDocument miscFilesWorkspace filePath1).Id + + let doc2 = getDocument workspace filePath2 + assertHasDocumentDiagnostics doc2 + + let doc1 = getDocument workspace filePath1 + assertEmptyDocumentDiagnostics doc1 + + File.WriteAllText(filePath1, + """ +module Script1 + +let x = 1 + """) + + assertEmptyDocumentDiagnostics doc2 + + finally + try File.Delete(filePath1) with | _ -> () + try File.Delete(filePath2) with | _ -> () From 10002a3e6cf7896f61e3610f320e149e56882949 Mon Sep 17 00:00:00 2001 From: Will Smith Date: Thu, 24 Jun 2021 17:02:47 -0700 Subject: [PATCH 14/42] Minor fix --- .../LanguageService/SingleFileWorkspaceMap.fs | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/vsintegration/src/FSharp.Editor/LanguageService/SingleFileWorkspaceMap.fs b/vsintegration/src/FSharp.Editor/LanguageService/SingleFileWorkspaceMap.fs index d82cb40a2ac..d2a13437f1b 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/SingleFileWorkspaceMap.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/SingleFileWorkspaceMap.fs @@ -114,15 +114,17 @@ type internal FSharpMiscellaneousFileService(workspace: Workspace, ) let tryRemove (document: Document) = - optionsManager.ClearSingleFileOptionsCache(document.Id) - - match files.TryRemove(document.FilePath) with - | true, projectContext -> - let projIds = document.Project.Solution.GetDependentProjectIds(document.Project.Id) - if projIds.Count = 0 then - (projectContext :> IDisposable).Dispose() - | _ -> - () + let projIds = document.Project.Solution.GetDependentProjectIds(document.Project.Id) + if projIds.Count = 0 then + optionsManager.ClearSingleFileOptionsCache(document.Id) + + match files.TryRemove(document.FilePath) with + | true, projectContext -> + let projIds = document.Project.Solution.GetDependentProjectIds(document.Project.Id) + if projIds.Count = 0 then + (projectContext :> IDisposable).Dispose() + | _ -> + () do optionsManager.ScriptUpdated.Add(fun scriptProjectOptions -> From 494a2d2ce839fc3caf2aebc488222b10778fc831 Mon Sep 17 00:00:00 2001 From: Will Smith Date: Thu, 24 Jun 2021 17:03:12 -0700 Subject: [PATCH 15/42] Minor fix --- .../FSharp.Editor/LanguageService/SingleFileWorkspaceMap.fs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/vsintegration/src/FSharp.Editor/LanguageService/SingleFileWorkspaceMap.fs b/vsintegration/src/FSharp.Editor/LanguageService/SingleFileWorkspaceMap.fs index d2a13437f1b..b3a646710e0 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/SingleFileWorkspaceMap.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/SingleFileWorkspaceMap.fs @@ -120,9 +120,7 @@ type internal FSharpMiscellaneousFileService(workspace: Workspace, match files.TryRemove(document.FilePath) with | true, projectContext -> - let projIds = document.Project.Solution.GetDependentProjectIds(document.Project.Id) - if projIds.Count = 0 then - (projectContext :> IDisposable).Dispose() + (projectContext :> IDisposable).Dispose() | _ -> () From 7df1647cde3fdab0109e163947801738ea4fd80b Mon Sep 17 00:00:00 2001 From: Will Smith Date: Thu, 24 Jun 2021 17:07:02 -0700 Subject: [PATCH 16/42] Minor fix --- .../LanguageService/SingleFileWorkspaceMap.fs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/vsintegration/src/FSharp.Editor/LanguageService/SingleFileWorkspaceMap.fs b/vsintegration/src/FSharp.Editor/LanguageService/SingleFileWorkspaceMap.fs index b3a646710e0..637c6dd92d7 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/SingleFileWorkspaceMap.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/SingleFileWorkspaceMap.fs @@ -195,12 +195,16 @@ type internal FSharpMiscellaneousFileService(workspace: Workspace, lock gate (fun () -> projRefs |> Array.iter (fun proj -> - if proj.IsFSharpMiscellaneousOrMetadata then - match proj.Documents |> Seq.tryExactlyOne with - | Some doc when not (workspace.IsDocumentOpen(doc.Id)) -> - tryRemove doc - | _ -> - () + let proj = args.NewSolution.GetProject(proj.Id) + match proj with + | null -> () + | _ -> + if proj.IsFSharpMiscellaneousOrMetadata then + match proj.Documents |> Seq.tryExactlyOne with + | Some doc when not (workspace.IsDocumentOpen(doc.Id)) -> + tryRemove doc + | _ -> + () ) ) | _ -> From 8984266419cb462c4a582c1c10beafdba6f75351 Mon Sep 17 00:00:00 2001 From: dotnet bot Date: Sat, 26 Jun 2021 08:33:51 -0700 Subject: [PATCH 17/42] Localized file check-in by OneLocBuild Task (#11728) --- src/fsharp/xlf/FSComp.txt.fr.xlf | 2 +- src/fsharp/xlf/FSComp.txt.ja.xlf | 2 +- src/fsharp/xlf/FSComp.txt.ko.xlf | 2 +- src/fsharp/xlf/FSComp.txt.pt-BR.xlf | 2 +- src/fsharp/xlf/FSComp.txt.ru.xlf | 2 +- src/fsharp/xlf/FSComp.txt.zh-Hant.xlf | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/fsharp/xlf/FSComp.txt.fr.xlf b/src/fsharp/xlf/FSComp.txt.fr.xlf index a22a2e8c4ed..56074979fc4 100644 --- a/src/fsharp/xlf/FSComp.txt.fr.xlf +++ b/src/fsharp/xlf/FSComp.txt.fr.xlf @@ -139,7 +139,7 @@ non-variable patterns to the right of 'as' patterns - non-variable patterns to the right of 'as' patterns + modèles non variables à droite de modèles « as » diff --git a/src/fsharp/xlf/FSComp.txt.ja.xlf b/src/fsharp/xlf/FSComp.txt.ja.xlf index 71ebb5903bb..e08c888ce94 100644 --- a/src/fsharp/xlf/FSComp.txt.ja.xlf +++ b/src/fsharp/xlf/FSComp.txt.ja.xlf @@ -139,7 +139,7 @@ non-variable patterns to the right of 'as' patterns - non-variable patterns to the right of 'as' patterns + 'as' パターンの右側の非変数パターン diff --git a/src/fsharp/xlf/FSComp.txt.ko.xlf b/src/fsharp/xlf/FSComp.txt.ko.xlf index 63dc47b59cd..2314bb83633 100644 --- a/src/fsharp/xlf/FSComp.txt.ko.xlf +++ b/src/fsharp/xlf/FSComp.txt.ko.xlf @@ -139,7 +139,7 @@ non-variable patterns to the right of 'as' patterns - non-variable patterns to the right of 'as' patterns + 'as' 패턴의 오른쪽에 있는 변수가 아닌 패턴 diff --git a/src/fsharp/xlf/FSComp.txt.pt-BR.xlf b/src/fsharp/xlf/FSComp.txt.pt-BR.xlf index 65d87f2f881..a216008109b 100644 --- a/src/fsharp/xlf/FSComp.txt.pt-BR.xlf +++ b/src/fsharp/xlf/FSComp.txt.pt-BR.xlf @@ -139,7 +139,7 @@ non-variable patterns to the right of 'as' patterns - non-variable patterns to the right of 'as' patterns + padrões não-variáveis à direita dos padrões 'as'. diff --git a/src/fsharp/xlf/FSComp.txt.ru.xlf b/src/fsharp/xlf/FSComp.txt.ru.xlf index ba4f66224d0..27a8648ca1e 100644 --- a/src/fsharp/xlf/FSComp.txt.ru.xlf +++ b/src/fsharp/xlf/FSComp.txt.ru.xlf @@ -139,7 +139,7 @@ non-variable patterns to the right of 'as' patterns - non-variable patterns to the right of 'as' patterns + шаблоны без переменных справа от шаблонов "as" diff --git a/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf b/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf index eb1b81feffc..d72760ff13f 100644 --- a/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf @@ -139,7 +139,7 @@ non-variable patterns to the right of 'as' patterns - non-variable patterns to the right of 'as' patterns + 'as' 模式右邊的非變數模式 From ec83cf9072a906764744fb42a8da286f2338ddae Mon Sep 17 00:00:00 2001 From: dotnet bot Date: Sat, 26 Jun 2021 08:34:57 -0700 Subject: [PATCH 18/42] Localized file check-in by OneLocBuild Task (#11727) From f84927af7974f63f546209a8e11a17836d4aa7ea Mon Sep 17 00:00:00 2001 From: Florian Verdonck Date: Mon, 28 Jun 2021 15:29:58 +0200 Subject: [PATCH 19/42] Include range of attributes in extern declaration. (#11736) --- src/fsharp/pars.fsy | 3 ++- tests/service/Symbols.fs | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/fsharp/pars.fsy b/src/fsharp/pars.fsy index 66289f3cf55..60b8a5904c0 100644 --- a/src/fsharp/pars.fsy +++ b/src/fsharp/pars.fsy @@ -2699,9 +2699,10 @@ cPrototype: mRhs) (fun attrs _ -> let bindingId = SynPat.LongIdent (LongIdentWithDots([nm], []), None, Some noInferredTypars, SynArgPats.Pats [SynPat.Tuple(false, args, argsm)], vis, nmm) + let mWholeBindLhs = (mBindLhs, attrs) ||> unionRangeWithListBy (fun (a: SynAttributeList) -> a.Range) let binding = mkSynBinding (xmlDoc, bindingId) - (vis, false, false, mBindLhs, DebugPointAtBinding.NoneAtInvisible, Some rty, rhsExpr, mRhs, [], attrs, None) + (vis, false, false, mWholeBindLhs, DebugPointAtBinding.NoneAtInvisible, Some rty, rhsExpr, mRhs, [], attrs, None) [], [binding]) } /* A list of arguments in an 'extern' DllImport function definition */ diff --git a/tests/service/Symbols.fs b/tests/service/Symbols.fs index 7d94a48b38d..6530451c44f 100644 --- a/tests/service/Symbols.fs +++ b/tests/service/Symbols.fs @@ -91,6 +91,21 @@ extern int private c() |> should equal expected | _ -> Assert.Fail (sprintf "Couldn't get mfv: %s" name)) + [] + let ``Range of attribute should be included in SynDecl.Let and SynBinding`` () = + let parseResults = + getParseResults + """ +[] +extern int AccessibleChildren()""" + + match parseResults with + | ParsedInput.ImplFile (ParsedImplFileInput (modules = [ SynModuleOrNamespace.SynModuleOrNamespace(decls = [ + SynModuleDecl.Let(false, [ SynBinding(range = mb) ] , ml) + ]) ])) -> + assertRange (2, 0) (3, 31) ml + assertRange (2, 0) (3, 31) mb + | _ -> Assert.Fail "Could not get valid AST" module XmlDocSig = From 52130f847134043cf1d4c568ba110bdeba021aeb Mon Sep 17 00:00:00 2001 From: Florian Verdonck Date: Mon, 28 Jun 2021 15:30:36 +0200 Subject: [PATCH 20/42] Define ParsedHashDirective arguments as ParsedHashDirectiveArgument instead of strings. (#11733) --- src/fsharp/ParseAndCheckInputs.fs | 21 ++++--- src/fsharp/SyntaxTree.fs | 12 +++- src/fsharp/SyntaxTree.fsi | 11 +++- src/fsharp/SyntaxTreeOps.fs | 7 +++ src/fsharp/SyntaxTreeOps.fsi | 2 + src/fsharp/fsi/fsi.fs | 18 +++--- src/fsharp/pars.fsy | 11 ++-- .../SurfaceArea.netstandard.fs | 35 +++++++++++- tests/service/Symbols.fs | 57 +++++++++++++++++++ 9 files changed, 147 insertions(+), 27 deletions(-) diff --git a/src/fsharp/ParseAndCheckInputs.fs b/src/fsharp/ParseAndCheckInputs.fs index ffe1bfe4a97..351561f585d 100644 --- a/src/fsharp/ParseAndCheckInputs.fs +++ b/src/fsharp/ParseAndCheckInputs.fs @@ -170,9 +170,12 @@ let GetScopedPragmasForHashDirective hd = [ match hd with | ParsedHashDirective("nowarn", numbers, m) -> for s in numbers do - match GetWarningNumber(m, s) with - | None -> () - | Some n -> yield ScopedPragma.WarningOff(m, n) + match s with + | ParsedHashDirectiveArgument.SourceIdentifier _ -> () + | ParsedHashDirectiveArgument.String (s, _, _) -> + match GetWarningNumber(m, s) with + | None -> () + | Some n -> yield ScopedPragma.WarningOff(m, n) | _ -> () ] let PostParseModuleImpls (defaultNamespace, filename, isLastCompiland, ParsedImplFile (hashDirectives, impls)) = @@ -512,7 +515,7 @@ let ProcessMetaCommandsFromInput let mutable matchedm = range0 try match hash with - | ParsedHashDirective("I", args, m) -> + | ParsedHashDirective("I", ParsedHashDirectiveArguments args, m) -> if not canHaveScriptMetaCommands then errorR(HashIncludeNotAllowedInNonScript m) match args with @@ -523,18 +526,18 @@ let ProcessMetaCommandsFromInput | _ -> errorR(Error(FSComp.SR.buildInvalidHashIDirective(), m)) state - | ParsedHashDirective("nowarn",numbers,m) -> + | ParsedHashDirective("nowarn", ParsedHashDirectiveArguments numbers,m) -> List.fold (fun state d -> nowarnF state (m,d)) state numbers - | ParsedHashDirective(("reference" | "r"), args, m) -> + | ParsedHashDirective(("reference" | "r"), ParsedHashDirectiveArguments args, m) -> matchedm<-m ProcessDependencyManagerDirective Directive.Resolution args m state - | ParsedHashDirective(("i"), args, m) -> + | ParsedHashDirective(("i"), ParsedHashDirectiveArguments args, m) -> matchedm<-m ProcessDependencyManagerDirective Directive.Include args m state - | ParsedHashDirective("load", args, m) -> + | ParsedHashDirective("load", ParsedHashDirectiveArguments args, m) -> if not canHaveScriptMetaCommands then errorR(HashDirectiveNotAllowedInNonScript m) match args with @@ -544,7 +547,7 @@ let ProcessMetaCommandsFromInput | _ -> errorR(Error(FSComp.SR.buildInvalidHashloadDirective(), m)) state - | ParsedHashDirective("time", args, m) -> + | ParsedHashDirective("time", ParsedHashDirectiveArguments args, m) -> if not canHaveScriptMetaCommands then errorR(HashDirectiveNotAllowedInNonScript m) match args with diff --git a/src/fsharp/SyntaxTree.fs b/src/fsharp/SyntaxTree.fs index 92e4dcd3db7..efec365b65d 100644 --- a/src/fsharp/SyntaxTree.fs +++ b/src/fsharp/SyntaxTree.fs @@ -1826,11 +1826,21 @@ type SynModuleOrNamespaceSig = match this with | SynModuleOrNamespaceSig (range=m) -> m +[] +type ParsedHashDirectiveArgument = + | String of value: string * stringKind: SynStringKind * range: Range + | SourceIdentifier of constant: string * value: string * range: Range + + member this.Range = + match this with + | ParsedHashDirectiveArgument.String (range=m) + | ParsedHashDirectiveArgument.SourceIdentifier (range=m) -> m + [] type ParsedHashDirective = | ParsedHashDirective of ident: string * - args: string list * + args: ParsedHashDirectiveArgument list * range: range [] diff --git a/src/fsharp/SyntaxTree.fsi b/src/fsharp/SyntaxTree.fsi index 3c2f8b99654..a04fc70da39 100644 --- a/src/fsharp/SyntaxTree.fsi +++ b/src/fsharp/SyntaxTree.fsi @@ -2014,12 +2014,21 @@ type SynModuleOrNamespaceSig = /// Gets the syntax range of this construct member Range: range +/// Represents a parsed hash directive argument +[] +type ParsedHashDirectiveArgument = + | String of value: string * stringKind: SynStringKind * range: Range + | SourceIdentifier of constant: string * value: string * range: Range + + /// Gets the syntax range of this construct + member Range: range + /// Represents a parsed hash directive [] type ParsedHashDirective = | ParsedHashDirective of ident: string * - args: string list * + args: ParsedHashDirectiveArgument list * range: range /// Represents the syntax tree for the contents of a parsed implementation file diff --git a/src/fsharp/SyntaxTreeOps.fs b/src/fsharp/SyntaxTreeOps.fs index cc0bfde80a2..b620983ec25 100644 --- a/src/fsharp/SyntaxTreeOps.fs +++ b/src/fsharp/SyntaxTreeOps.fs @@ -747,3 +747,10 @@ let rec synExprContainsError inpExpr = | SynInterpolatedStringPart.FillExpr (x, _) -> Some x)) walkExpr inpExpr + +let (|ParsedHashDirectiveArguments|) (input: ParsedHashDirectiveArgument list) = + List.map + (function + | ParsedHashDirectiveArgument.String (s, _, _) -> s + | ParsedHashDirectiveArgument.SourceIdentifier (_, v, _) -> v) + input \ No newline at end of file diff --git a/src/fsharp/SyntaxTreeOps.fsi b/src/fsharp/SyntaxTreeOps.fsi index 48f7812d07b..106b7a61540 100644 --- a/src/fsharp/SyntaxTreeOps.fsi +++ b/src/fsharp/SyntaxTreeOps.fsi @@ -266,3 +266,5 @@ val inferredTyparDecls: SynValTyparDecls val noInferredTypars: SynValTyparDecls val synExprContainsError: inpExpr:SynExpr -> bool + +val ( |ParsedHashDirectiveArguments| ) : ParsedHashDirectiveArgument list -> string list \ No newline at end of file diff --git a/src/fsharp/fsi/fsi.fs b/src/fsharp/fsi/fsi.fs index 61a80b2d1aa..a85d82d90fb 100644 --- a/src/fsharp/fsi/fsi.fs +++ b/src/fsharp/fsi/fsi.fs @@ -2223,26 +2223,26 @@ type internal FsiInteractionProcessor let istate = fsiDynamicCompiler.CommitDependencyManagerText(ctok, istate, lexResourceManager, errorLogger) fsiDynamicCompiler.EvalParsedDefinitions (ctok, errorLogger, istate, true, false, defs) - | ParsedScriptInteraction.HashDirective (ParsedHashDirective("load", sourceFiles, m), _) -> + | ParsedScriptInteraction.HashDirective (ParsedHashDirective("load", ParsedHashDirectiveArguments sourceFiles, m), _) -> let istate = fsiDynamicCompiler.CommitDependencyManagerText(ctok, istate, lexResourceManager, errorLogger) fsiDynamicCompiler.EvalSourceFiles (ctok, istate, m, sourceFiles, lexResourceManager, errorLogger),Completed None - | ParsedScriptInteraction.HashDirective (ParsedHashDirective(("reference" | "r"), [path], m), _) -> + | ParsedScriptInteraction.HashDirective (ParsedHashDirective(("reference" | "r"), ParsedHashDirectiveArguments [path], m), _) -> packageManagerDirective Directive.Resolution path m - | ParsedScriptInteraction.HashDirective (ParsedHashDirective("i", [path], m), _) -> + | ParsedScriptInteraction.HashDirective (ParsedHashDirective("i", ParsedHashDirectiveArguments [path], m), _) -> packageManagerDirective Directive.Include path m - | ParsedScriptInteraction.HashDirective (ParsedHashDirective("I", [path], m), _) -> + | ParsedScriptInteraction.HashDirective (ParsedHashDirective("I", ParsedHashDirectiveArguments [path], m), _) -> tcConfigB.AddIncludePath (m, path, tcConfig.implicitIncludeDir) fsiConsoleOutput.uprintnfnn "%s" (FSIstrings.SR.fsiDidAHashI(tcConfig.MakePathAbsolute path)) istate, Completed None - | ParsedScriptInteraction.HashDirective (ParsedHashDirective("cd", [path], m), _) -> + | ParsedScriptInteraction.HashDirective (ParsedHashDirective("cd", ParsedHashDirectiveArguments [path], m), _) -> ChangeDirectory path m istate, Completed None - | ParsedScriptInteraction.HashDirective (ParsedHashDirective("silentCd", [path], m), _) -> + | ParsedScriptInteraction.HashDirective (ParsedHashDirective("silentCd", ParsedHashDirectiveArguments [path], m), _) -> ChangeDirectory path m fsiConsolePrompt.SkipNext() (* "silent" directive *) istate, Completed None @@ -2257,14 +2257,14 @@ type internal FsiInteractionProcessor fsiConsoleOutput.uprintnfnn "%s" (FSIstrings.SR.fsiTurnedTimingOn()) {istate with timing = not istate.timing}, Completed None - | ParsedScriptInteraction.HashDirective (ParsedHashDirective("time", [("on" | "off") as v], _), _) -> + | ParsedScriptInteraction.HashDirective (ParsedHashDirective("time", ParsedHashDirectiveArguments [("on" | "off") as v], _), _) -> if v <> "on" then fsiConsoleOutput.uprintnfnn "%s" (FSIstrings.SR.fsiTurnedTimingOff()) else fsiConsoleOutput.uprintnfnn "%s" (FSIstrings.SR.fsiTurnedTimingOn()) {istate with timing = (v = "on")}, Completed None - | ParsedScriptInteraction.HashDirective (ParsedHashDirective("nowarn", numbers, m), _) -> + | ParsedScriptInteraction.HashDirective (ParsedHashDirective("nowarn", ParsedHashDirectiveArguments numbers, m), _) -> List.iter (fun (d:string) -> tcConfigB.TurnWarningOff(m, d)) numbers istate, Completed None @@ -2293,7 +2293,7 @@ type internal FsiInteractionProcessor fsiOptions.ShowHelp(m) istate, Completed None - | ParsedScriptInteraction.HashDirective (ParsedHashDirective(c, arg, m), _) -> + | ParsedScriptInteraction.HashDirective (ParsedHashDirective(c, ParsedHashDirectiveArguments arg, m), _) -> warning(Error((FSComp.SR.fsiInvalidDirective(c, String.concat " " arg)), m)) istate, Completed None ) diff --git a/src/fsharp/pars.fsy b/src/fsharp/pars.fsy index 60b8a5904c0..c40d81f511f 100644 --- a/src/fsharp/pars.fsy +++ b/src/fsharp/pars.fsy @@ -649,11 +649,14 @@ hashDirectiveArgs: /* One argument to a #directive */ -hashDirectiveArg: +hashDirectiveArg: | string - { let s, _ = $1 - s } - + { let s, kind = $1 + ParsedHashDirectiveArgument.String (s, kind, lhs parseState) } + | sourceIdentifier + { let c,v = $1 + ParsedHashDirectiveArgument.SourceIdentifier (c, v, lhs parseState) } + /*--------------------------------------------------------------------------*/ /* F# Language Proper - signature files */ diff --git a/tests/FSharp.Compiler.Service.Tests/SurfaceArea.netstandard.fs b/tests/FSharp.Compiler.Service.Tests/SurfaceArea.netstandard.fs index af765bcc81f..b8b5c504c06 100644 --- a/tests/FSharp.Compiler.Service.Tests/SurfaceArea.netstandard.fs +++ b/tests/FSharp.Compiler.Service.Tests/SurfaceArea.netstandard.fs @@ -5353,16 +5353,45 @@ FSharp.Compiler.Syntax.LongIdentWithDots: Microsoft.FSharp.Collections.FSharpLis FSharp.Compiler.Syntax.LongIdentWithDots: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Text.Range] get_dotRanges() FSharp.Compiler.Syntax.LongIdentWithDots: System.String ToString() FSharp.Compiler.Syntax.ParsedHashDirective -FSharp.Compiler.Syntax.ParsedHashDirective: FSharp.Compiler.Syntax.ParsedHashDirective NewParsedHashDirective(System.String, Microsoft.FSharp.Collections.FSharpList`1[System.String], FSharp.Compiler.Text.Range) +FSharp.Compiler.Syntax.ParsedHashDirective: FSharp.Compiler.Syntax.ParsedHashDirective NewParsedHashDirective(System.String, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.ParsedHashDirectiveArgument], FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.ParsedHashDirective: FSharp.Compiler.Text.Range get_range() FSharp.Compiler.Syntax.ParsedHashDirective: FSharp.Compiler.Text.Range range FSharp.Compiler.Syntax.ParsedHashDirective: Int32 Tag FSharp.Compiler.Syntax.ParsedHashDirective: Int32 get_Tag() -FSharp.Compiler.Syntax.ParsedHashDirective: Microsoft.FSharp.Collections.FSharpList`1[System.String] args -FSharp.Compiler.Syntax.ParsedHashDirective: Microsoft.FSharp.Collections.FSharpList`1[System.String] get_args() +FSharp.Compiler.Syntax.ParsedHashDirective: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.ParsedHashDirectiveArgument] args +FSharp.Compiler.Syntax.ParsedHashDirective: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.ParsedHashDirectiveArgument] get_args() FSharp.Compiler.Syntax.ParsedHashDirective: System.String ToString() FSharp.Compiler.Syntax.ParsedHashDirective: System.String get_ident() FSharp.Compiler.Syntax.ParsedHashDirective: System.String ident +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument+SourceIdentifier: FSharp.Compiler.Text.Range get_range() +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument+SourceIdentifier: FSharp.Compiler.Text.Range range +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument+SourceIdentifier: System.String constant +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument+SourceIdentifier: System.String get_constant() +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument+SourceIdentifier: System.String get_value() +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument+SourceIdentifier: System.String value +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument+String: FSharp.Compiler.Syntax.SynStringKind get_stringKind() +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument+String: FSharp.Compiler.Syntax.SynStringKind stringKind +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument+String: FSharp.Compiler.Text.Range get_range() +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument+String: FSharp.Compiler.Text.Range range +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument+String: System.String get_value() +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument+String: System.String value +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument+Tags: Int32 SourceIdentifier +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument+Tags: Int32 String +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument: Boolean IsSourceIdentifier +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument: Boolean IsString +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument: Boolean get_IsSourceIdentifier() +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument: Boolean get_IsString() +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument: FSharp.Compiler.Syntax.ParsedHashDirectiveArgument NewSourceIdentifier(System.String, System.String, FSharp.Compiler.Text.Range) +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument: FSharp.Compiler.Syntax.ParsedHashDirectiveArgument NewString(System.String, FSharp.Compiler.Syntax.SynStringKind, FSharp.Compiler.Text.Range) +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument: FSharp.Compiler.Syntax.ParsedHashDirectiveArgument+SourceIdentifier +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument: FSharp.Compiler.Syntax.ParsedHashDirectiveArgument+String +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument: FSharp.Compiler.Syntax.ParsedHashDirectiveArgument+Tags +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument: FSharp.Compiler.Text.Range Range +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument: FSharp.Compiler.Text.Range get_Range() +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument: Int32 Tag +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument: Int32 get_Tag() +FSharp.Compiler.Syntax.ParsedHashDirectiveArgument: System.String ToString() FSharp.Compiler.Syntax.ParsedImplFile FSharp.Compiler.Syntax.ParsedImplFile: FSharp.Compiler.Syntax.ParsedImplFile NewParsedImplFile(Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.ParsedHashDirective], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.ParsedImplFileFragment]) FSharp.Compiler.Syntax.ParsedImplFile: Int32 Tag diff --git a/tests/service/Symbols.fs b/tests/service/Symbols.fs index 6530451c44f..6bffb542035 100644 --- a/tests/service/Symbols.fs +++ b/tests/service/Symbols.fs @@ -1168,4 +1168,61 @@ type Bird = assertRange (3, 4) (6, 50) getter.Range assertRange (3, 4) (6, 23) mb2 assertRange (3, 4) (6, 50) setter.Range + | _ -> Assert.Fail "Could not get valid AST" + +module ParsedHashDirective = + [] + let ``SourceIdentifier as ParsedHashDirectiveArgument`` () = + let parseResults = + getParseResults + "#I __SOURCE_DIRECTORY__" + + match parseResults with + | ParsedInput.ImplFile (ParsedImplFileInput (modules = [ SynModuleOrNamespace.SynModuleOrNamespace(decls = [ + SynModuleDecl.HashDirective(ParsedHashDirective("I", [ ParsedHashDirectiveArgument.SourceIdentifier(c,_,m) ] , _), _) + ]) ])) -> + Assert.AreEqual("__SOURCE_DIRECTORY__", c) + assertRange (1, 3) (1, 23) m + | _ -> Assert.Fail "Could not get valid AST" + + [] + let ``Regular String as ParsedHashDirectiveArgument`` () = + let parseResults = + getParseResults + "#I \"/tmp\"" + + match parseResults with + | ParsedInput.ImplFile (ParsedImplFileInput (modules = [ SynModuleOrNamespace.SynModuleOrNamespace(decls = [ + SynModuleDecl.HashDirective(ParsedHashDirective("I", [ ParsedHashDirectiveArgument.String(v, SynStringKind.Regular, m) ] , _), _) + ]) ])) -> + Assert.AreEqual("/tmp", v) + assertRange (1, 3) (1, 9) m + | _ -> Assert.Fail "Could not get valid AST" + + [] + let ``Verbatim String as ParsedHashDirectiveArgument`` () = + let parseResults = + getParseResults + "#I @\"C:\\Temp\"" + + match parseResults with + | ParsedInput.ImplFile (ParsedImplFileInput (modules = [ SynModuleOrNamespace.SynModuleOrNamespace(decls = [ + SynModuleDecl.HashDirective(ParsedHashDirective("I", [ ParsedHashDirectiveArgument.String(v, SynStringKind.Verbatim, m) ] , _), _) + ]) ])) -> + Assert.AreEqual("C:\\Temp", v) + assertRange (1, 3) (1, 13) m + | _ -> Assert.Fail "Could not get valid AST" + + [] + let ``Triple quote String as ParsedHashDirectiveArgument`` () = + let parseResults = + getParseResults + "#nowarn \"\"\"40\"\"\"" + + match parseResults with + | ParsedInput.ImplFile (ParsedImplFileInput (modules = [ SynModuleOrNamespace.SynModuleOrNamespace(decls = [ + SynModuleDecl.HashDirective(ParsedHashDirective("nowarn", [ ParsedHashDirectiveArgument.String(v, SynStringKind.TripleQuote, m) ] , _), _) + ]) ])) -> + Assert.AreEqual("40", v) + assertRange (1, 8) (1, 16) m | _ -> Assert.Fail "Could not get valid AST" \ No newline at end of file From 095deb31c22abc742154b61647aa5fe97f726105 Mon Sep 17 00:00:00 2001 From: dotnet bot Date: Mon, 28 Jun 2021 06:31:14 -0700 Subject: [PATCH 21/42] Localized file check-in by OneLocBuild Task: Build definition ID 499: Build ID 1207846 (#11737) --- src/fsharp/xlf/FSComp.txt.cs.xlf | 2 +- src/fsharp/xlf/FSComp.txt.de.xlf | 2 +- src/fsharp/xlf/FSComp.txt.es.xlf | 2 +- src/fsharp/xlf/FSComp.txt.it.xlf | 2 +- src/fsharp/xlf/FSComp.txt.pl.xlf | 2 +- src/fsharp/xlf/FSComp.txt.tr.xlf | 2 +- src/fsharp/xlf/FSComp.txt.zh-Hans.xlf | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/fsharp/xlf/FSComp.txt.cs.xlf b/src/fsharp/xlf/FSComp.txt.cs.xlf index b311718f0be..6273fe0e00c 100644 --- a/src/fsharp/xlf/FSComp.txt.cs.xlf +++ b/src/fsharp/xlf/FSComp.txt.cs.xlf @@ -139,7 +139,7 @@ non-variable patterns to the right of 'as' patterns - non-variable patterns to the right of 'as' patterns + neproměnné vzory napravo od vzorů typu „jako“ diff --git a/src/fsharp/xlf/FSComp.txt.de.xlf b/src/fsharp/xlf/FSComp.txt.de.xlf index 5ec3872f51f..8b1d7bd5e77 100644 --- a/src/fsharp/xlf/FSComp.txt.de.xlf +++ b/src/fsharp/xlf/FSComp.txt.de.xlf @@ -139,7 +139,7 @@ non-variable patterns to the right of 'as' patterns - non-variable patterns to the right of 'as' patterns + Nicht-Variablenmuster rechts neben as-Mustern diff --git a/src/fsharp/xlf/FSComp.txt.es.xlf b/src/fsharp/xlf/FSComp.txt.es.xlf index 4b591533961..0a0b43d351a 100644 --- a/src/fsharp/xlf/FSComp.txt.es.xlf +++ b/src/fsharp/xlf/FSComp.txt.es.xlf @@ -139,7 +139,7 @@ non-variable patterns to the right of 'as' patterns - non-variable patterns to the right of 'as' patterns + patrones no variables a la derecha de los patrones "as" diff --git a/src/fsharp/xlf/FSComp.txt.it.xlf b/src/fsharp/xlf/FSComp.txt.it.xlf index e6fdc8e9747..726b5aa18d1 100644 --- a/src/fsharp/xlf/FSComp.txt.it.xlf +++ b/src/fsharp/xlf/FSComp.txt.it.xlf @@ -139,7 +139,7 @@ non-variable patterns to the right of 'as' patterns - non-variable patterns to the right of 'as' patterns + modelli non variabili a destra dei modelli 'as' diff --git a/src/fsharp/xlf/FSComp.txt.pl.xlf b/src/fsharp/xlf/FSComp.txt.pl.xlf index fc3a8c6b017..1df89f793e6 100644 --- a/src/fsharp/xlf/FSComp.txt.pl.xlf +++ b/src/fsharp/xlf/FSComp.txt.pl.xlf @@ -139,7 +139,7 @@ non-variable patterns to the right of 'as' patterns - non-variable patterns to the right of 'as' patterns + stałe wzorce po prawej stronie wzorców typu „as” diff --git a/src/fsharp/xlf/FSComp.txt.tr.xlf b/src/fsharp/xlf/FSComp.txt.tr.xlf index ea5cce4499b..07a561ce588 100644 --- a/src/fsharp/xlf/FSComp.txt.tr.xlf +++ b/src/fsharp/xlf/FSComp.txt.tr.xlf @@ -139,7 +139,7 @@ non-variable patterns to the right of 'as' patterns - non-variable patterns to the right of 'as' patterns + 'as' desenlerinin sağındaki değişken olmayan desenler diff --git a/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf b/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf index 3f3fc9f5827..f6f3250b78e 100644 --- a/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf @@ -139,7 +139,7 @@ non-variable patterns to the right of 'as' patterns - non-variable patterns to the right of 'as' patterns + "as" 模式右侧的非变量模式 From 23004bccecdfe3c2f0724c5edd601354e6a62d3c Mon Sep 17 00:00:00 2001 From: dotnet bot Date: Mon, 28 Jun 2021 07:32:57 -0700 Subject: [PATCH 22/42] Localized file check-in by OneLocBuild Task: Build definition ID 499: Build ID 1209209 (#11739) --- src/fsharp/xlf/FSComp.txt.de.xlf | 2 +- src/fsharp/xlf/FSComp.txt.es.xlf | 2 +- src/fsharp/xlf/FSComp.txt.fr.xlf | 2 +- src/fsharp/xlf/FSComp.txt.it.xlf | 2 +- src/fsharp/xlf/FSComp.txt.ja.xlf | 2 +- src/fsharp/xlf/FSComp.txt.ko.xlf | 2 +- src/fsharp/xlf/FSComp.txt.ru.xlf | 2 +- src/fsharp/xlf/FSComp.txt.zh-Hant.xlf | 2 +- vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.es.xlf | 4 ++-- vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.fr.xlf | 4 ++-- vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.it.xlf | 4 ++-- vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ja.xlf | 4 ++-- vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ko.xlf | 4 ++-- vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ru.xlf | 4 ++-- vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.zh-Hant.xlf | 4 ++-- .../xlf/Microsoft.VisualStudio.Editors.Designer.de.xlf | 2 +- 16 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/fsharp/xlf/FSComp.txt.de.xlf b/src/fsharp/xlf/FSComp.txt.de.xlf index 8b1d7bd5e77..deb01a0ac2e 100644 --- a/src/fsharp/xlf/FSComp.txt.de.xlf +++ b/src/fsharp/xlf/FSComp.txt.de.xlf @@ -7474,7 +7474,7 @@ A byref pointer returned by a function or method is implicitly dereferenced as of F# 4.5. To acquire the return value as a pointer, use the address-of operator, e.g. '&f(x)' or '&obj.Method(arg1, arg2)'. - Ein byref-Zeiger, der von einer Funktion oder Methode zurückgegeben wird, wird explizit als von F# 4.5 stammend dereferenziert. Verwenden Sie den &-Operator (z.B. "&f(x)" oder "&obj.Method(arg1, arg2)"), um den Rückgabewert als Zeiger abzurufen. + Ein byref-Zeiger, der von einer Funktion oder Methode zurückgegeben wird, wird explizit als von F# 4.5 stammend dereferenziert. Verwenden Sie den Operator (z.B. "&f(x)" oder "&obj.Method(arg1, arg2)"), um den Rückgabewert als Zeiger abzurufen. diff --git a/src/fsharp/xlf/FSComp.txt.es.xlf b/src/fsharp/xlf/FSComp.txt.es.xlf index 0a0b43d351a..ea47b7e40a3 100644 --- a/src/fsharp/xlf/FSComp.txt.es.xlf +++ b/src/fsharp/xlf/FSComp.txt.es.xlf @@ -359,7 +359,7 @@ The .NET SDK for this script could not be determined. dotnet.exe could not be found ensure a .NET SDK is installed. - The .NET SDK for this script could not be determined. dotnet.exe could not be found ensure a .NET SDK is installed. + No se pudo determinar el SDK de .NET para este script. No se encontró dotnet.exe. Asegúrese de tener instalado un SDK de .NET. diff --git a/src/fsharp/xlf/FSComp.txt.fr.xlf b/src/fsharp/xlf/FSComp.txt.fr.xlf index 56074979fc4..0526f8c7fa3 100644 --- a/src/fsharp/xlf/FSComp.txt.fr.xlf +++ b/src/fsharp/xlf/FSComp.txt.fr.xlf @@ -359,7 +359,7 @@ The .NET SDK for this script could not be determined. dotnet.exe could not be found ensure a .NET SDK is installed. - The .NET SDK for this script could not be determined. dotnet.exe could not be found ensure a .NET SDK is installed. + Impossible de déterminer le Kit de développement logiciel (SDK) .NET pour ce script. dotnet.exe est introuvable pour garantir l’installation d’un kit SDK .NET. diff --git a/src/fsharp/xlf/FSComp.txt.it.xlf b/src/fsharp/xlf/FSComp.txt.it.xlf index 726b5aa18d1..3d2019925fd 100644 --- a/src/fsharp/xlf/FSComp.txt.it.xlf +++ b/src/fsharp/xlf/FSComp.txt.it.xlf @@ -359,7 +359,7 @@ The .NET SDK for this script could not be determined. dotnet.exe could not be found ensure a .NET SDK is installed. - The .NET SDK for this script could not be determined. dotnet.exe could not be found ensure a .NET SDK is installed. + Non e stato possibile determinare il Software Development Kit .NET per questo script. Non è stato possibile trovare dotnet.exe; assicurarsi che sia installato un Software Development Kit .NET. diff --git a/src/fsharp/xlf/FSComp.txt.ja.xlf b/src/fsharp/xlf/FSComp.txt.ja.xlf index e08c888ce94..753e38d1b3a 100644 --- a/src/fsharp/xlf/FSComp.txt.ja.xlf +++ b/src/fsharp/xlf/FSComp.txt.ja.xlf @@ -359,7 +359,7 @@ The .NET SDK for this script could not be determined. dotnet.exe could not be found ensure a .NET SDK is installed. - The .NET SDK for this script could not be determined. dotnet.exe could not be found ensure a .NET SDK is installed. + このスクリプトの .NET SDK を特定できませんでした。dotnet.exe が見つかりませんでした。 .NET SDK がインストールされていることをご確認ください。 diff --git a/src/fsharp/xlf/FSComp.txt.ko.xlf b/src/fsharp/xlf/FSComp.txt.ko.xlf index 2314bb83633..52f54536e9b 100644 --- a/src/fsharp/xlf/FSComp.txt.ko.xlf +++ b/src/fsharp/xlf/FSComp.txt.ko.xlf @@ -359,7 +359,7 @@ The .NET SDK for this script could not be determined. dotnet.exe could not be found ensure a .NET SDK is installed. - The .NET SDK for this script could not be determined. dotnet.exe could not be found ensure a .NET SDK is installed. + 이 스크립트의 .NET SDK를 확인할 수 없습니다. dotnet.exe를 찾을 수 없습니다. .NET SDK가 설치되어 있는지 확인하세요. diff --git a/src/fsharp/xlf/FSComp.txt.ru.xlf b/src/fsharp/xlf/FSComp.txt.ru.xlf index 27a8648ca1e..0e6e8ad79af 100644 --- a/src/fsharp/xlf/FSComp.txt.ru.xlf +++ b/src/fsharp/xlf/FSComp.txt.ru.xlf @@ -359,7 +359,7 @@ The .NET SDK for this script could not be determined. dotnet.exe could not be found ensure a .NET SDK is installed. - The .NET SDK for this script could not be determined. dotnet.exe could not be found ensure a .NET SDK is installed. + Не удалось определить пакет SDK .NET для этого сценария. Не удалось найти dotnet.exe. Убедитесь, что пакет SDK .NET установлен. diff --git a/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf b/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf index d72760ff13f..6bf3879256a 100644 --- a/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf @@ -359,7 +359,7 @@ The .NET SDK for this script could not be determined. dotnet.exe could not be found ensure a .NET SDK is installed. - The .NET SDK for this script could not be determined. dotnet.exe could not be found ensure a .NET SDK is installed. + 無法判斷此指令碼的 .NET SDK。找不到 dotnet.exe,請確保已安裝 .NET SDK。 diff --git a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.es.xlf b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.es.xlf index 8911f1f37de..94b05697af1 100644 --- a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.es.xlf +++ b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.es.xlf @@ -14,7 +14,7 @@ Add missing instance member parameter - Add missing instance member parameter + Agregar parámetro de miembro de instancia que falta @@ -259,7 +259,7 @@ Use 'nameof' - Use 'nameof' + Usar 'nameof' diff --git a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.fr.xlf b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.fr.xlf index d65e5fb6cd3..411291f3107 100644 --- a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.fr.xlf +++ b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.fr.xlf @@ -14,7 +14,7 @@ Add missing instance member parameter - Add missing instance member parameter + Ajouter un paramètre de membre d’instance manquant @@ -259,7 +259,7 @@ Use 'nameof' - Use 'nameof' + Utiliser « nameof » diff --git a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.it.xlf b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.it.xlf index c7ab07fb8e4..0135663e689 100644 --- a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.it.xlf +++ b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.it.xlf @@ -14,7 +14,7 @@ Add missing instance member parameter - Add missing instance member parameter + Aggiungi parametro membro di istanza mancante @@ -259,7 +259,7 @@ Use 'nameof' - Use 'nameof' + Usa 'nameof' diff --git a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ja.xlf b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ja.xlf index 605fb96f8d4..4d2eee45eda 100644 --- a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ja.xlf +++ b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ja.xlf @@ -14,7 +14,7 @@ Add missing instance member parameter - Add missing instance member parameter + 見つからないインスタンス メンバー パラメーターを追加する @@ -259,7 +259,7 @@ Use 'nameof' - Use 'nameof' + 'nameof' を使用する diff --git a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ko.xlf b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ko.xlf index 3b0b74dc9dc..62e94f8675a 100644 --- a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ko.xlf +++ b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ko.xlf @@ -14,7 +14,7 @@ Add missing instance member parameter - Add missing instance member parameter + 누락된 인스턴스 멤버 매개 변수 추가 @@ -259,7 +259,7 @@ Use 'nameof' - Use 'nameof' + 'nameof' 사용 diff --git a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ru.xlf b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ru.xlf index f73216b7ec1..fd61cbdc2eb 100644 --- a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ru.xlf +++ b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ru.xlf @@ -14,7 +14,7 @@ Add missing instance member parameter - Add missing instance member parameter + Добавить отсутствующий параметр экземплярного элемента @@ -259,7 +259,7 @@ Use 'nameof' - Use 'nameof' + Использовать "nameof" diff --git a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.zh-Hant.xlf b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.zh-Hant.xlf index 4ca3ae2b40f..43c5ce4f127 100644 --- a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.zh-Hant.xlf +++ b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.zh-Hant.xlf @@ -14,7 +14,7 @@ Add missing instance member parameter - Add missing instance member parameter + 新增缺少的執行個體成員參數 @@ -259,7 +259,7 @@ Use 'nameof' - Use 'nameof' + 使用 'nameof' diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.de.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.de.xlf index 4184f3edc59..0f2031ab4b6 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.de.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.de.xlf @@ -940,7 +940,7 @@ Fehler: The URL is invalid. Please enter a valid URL like "http://www.microsoft.com/" - Die URL ist ungültig. Geben Sie eine gültige URL (beispielsweise "http://www.microsoft.com/de/de/default.aspx") ein. + Die URL ist ungültig. Geben Sie eine gültige URL (beispielsweise "http://www.microsoft.com/") ein. From 784c7ad8bfc77ef3d39f19fe8c98a7e9d10194b6 Mon Sep 17 00:00:00 2001 From: Chet Husk Date: Mon, 28 Jun 2021 09:41:30 -0500 Subject: [PATCH 23/42] use path separator instead of hardcoded semicolon (#11730) Co-authored-by: Vlad Zarytovskii --- .../DependencyManager/NativeDllResolveHandler.fs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/fsharp/DependencyManager/NativeDllResolveHandler.fs b/src/fsharp/DependencyManager/NativeDllResolveHandler.fs index 29d591393b4..9397a04eb3e 100644 --- a/src/fsharp/DependencyManager/NativeDllResolveHandler.fs +++ b/src/fsharp/DependencyManager/NativeDllResolveHandler.fs @@ -111,25 +111,26 @@ type NativeDllResolveHandler (nativeProbingRoots: NativeResolutionProbe) = else None - let appendSemiColon (p: string) = - if not(p.EndsWith(";", StringComparison.OrdinalIgnoreCase)) then - p + ";" + let appendPathSeparator (p: string) = + let separator = string System.IO.Path.PathSeparator + if not(p.EndsWith(separator, StringComparison.OrdinalIgnoreCase)) then + p + separator else p let addedPaths = ConcurrentBag() let addProbeToProcessPath probePath = - let probe = appendSemiColon probePath - let path = appendSemiColon (Environment.GetEnvironmentVariable("PATH")) + let probe = appendPathSeparator probePath + let path = appendPathSeparator (Environment.GetEnvironmentVariable("PATH")) if not (path.Contains(probe)) then Environment.SetEnvironmentVariable("PATH", path + probe) addedPaths.Add probe let removeProbeFromProcessPath probePath = if not(String.IsNullOrWhiteSpace(probePath)) then - let probe = appendSemiColon probePath - let path = appendSemiColon (Environment.GetEnvironmentVariable("PATH")) + let probe = appendPathSeparator probePath + let path = appendPathSeparator (Environment.GetEnvironmentVariable("PATH")) if path.Contains(probe) then Environment.SetEnvironmentVariable("PATH", path.Replace(probe, "")) member internal _.RefreshPathsInEnvironment(roots: string seq) = From ec3323bb71c1e72f6027f24260a818c69aca4ff5 Mon Sep 17 00:00:00 2001 From: dotnet bot Date: Mon, 28 Jun 2021 07:42:09 -0700 Subject: [PATCH 24/42] Localized file check-in by OneLocBuild Task: Build definition ID 499: Build ID 1209210 (#11740) From 4378143f8dc6241463204466bff70e8e9631e942 Mon Sep 17 00:00:00 2001 From: kerams Date: Tue, 29 Jun 2021 17:47:20 +0200 Subject: [PATCH 25/42] Optimize interpolated string with no holes (#11632) --- src/fsharp/CheckExpressions.fs | 42 +++++++++++-------- .../EmittedIL/StringFormatAndInterpolation.fs | 32 ++++++++++++++ .../FSharp.Compiler.ComponentTests.fsproj | 1 + tests/fsharp/core/quotes/test.fsx | 13 ++++++ 4 files changed, 71 insertions(+), 17 deletions(-) create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/StringFormatAndInterpolation.fs diff --git a/src/fsharp/CheckExpressions.fs b/src/fsharp/CheckExpressions.fs index 390f4409574..3babb1945f1 100644 --- a/src/fsharp/CheckExpressions.fs +++ b/src/fsharp/CheckExpressions.fs @@ -6751,27 +6751,35 @@ and TcInterpolatedStringExpr cenv overallTy env m tpenv (parts: SynInterpolatedS UnifyTypes cenv env m printerTupleTy printerTupleTyRequired - // Type check the expressions filling the holes - let flexes = argTys |> List.map (fun _ -> false) - let fillExprs, tpenv = TcExprs cenv env m tpenv flexes argTys synFillExprs + if List.isEmpty synFillExprs then + let str = mkString g m printfFormatString - let fillExprsBoxed = (argTys, fillExprs) ||> List.map2 (mkCallBox g m) - - let argsExpr = mkArray (g.obj_ty, fillExprsBoxed, m) - let percentATysExpr = - if percentATys.Length = 0 then - mkNull m (mkArrayType g g.system_Type_ty) + if isString then + str, tpenv else - let tyExprs = percentATys |> Array.map (mkCallTypeOf g m) |> Array.toList - mkArray (g.system_Type_ty, tyExprs, m) + mkCallNewFormat cenv.g m printerTy printerArgTy printerResidueTy printerResultTy printerTupleTy str, tpenv + else + // Type check the expressions filling the holes + let flexes = argTys |> List.map (fun _ -> false) + let fillExprs, tpenv = TcExprs cenv env m tpenv flexes argTys synFillExprs - let fmtExpr = MakeMethInfoCall cenv.amap m newFormatMethod [] [mkString g m printfFormatString; argsExpr; percentATysExpr] + let fillExprsBoxed = (argTys, fillExprs) ||> List.map2 (mkCallBox g m) - if isString then - // Make the call to sprintf - mkCall_sprintf g m printerTy fmtExpr [], tpenv - else - fmtExpr, tpenv + let argsExpr = mkArray (g.obj_ty, fillExprsBoxed, m) + let percentATysExpr = + if percentATys.Length = 0 then + mkNull m (mkArrayType g g.system_Type_ty) + else + let tyExprs = percentATys |> Array.map (mkCallTypeOf g m) |> Array.toList + mkArray (g.system_Type_ty, tyExprs, m) + + let fmtExpr = MakeMethInfoCall cenv.amap m newFormatMethod [] [mkString g m printfFormatString; argsExpr; percentATysExpr] + + if isString then + // Make the call to sprintf + mkCall_sprintf g m printerTy fmtExpr [], tpenv + else + fmtExpr, tpenv // The case for $"..." used as type FormattableString or IFormattable | Choice2Of2 createFormattableStringMethod -> diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/StringFormatAndInterpolation.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/StringFormatAndInterpolation.fs new file mode 100644 index 00000000000..716568cf837 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/StringFormatAndInterpolation.fs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace FSharp.Compiler.ComponentTests.EmittedIL + +open Xunit +open FSharp.Test.Utilities.Compiler + +module ``StringFormatAndInterpolation`` = + [] + let ``Interpolated string with no holes is reduced to a string or simple format when used in printf``() = + FSharp """ +module StringFormatAndInterpolation + +let stringOnly () = $"no hole" + +let printed () = printf $"printed no hole" + """ + |> compile + |> shouldSucceed + |> verifyIL [""" +IL_0000: ldstr "no hole" +IL_0005: ret""" + """ +IL_0000: ldstr "printed no hole" +IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5::.ctor(string) +IL_000a: stloc.0 +IL_000b: call class [netstandard]System.IO.TextWriter [netstandard]System.Console::get_Out() +IL_0010: ldloc.0 +IL_0011: call !!0 [FSharp.Core]Microsoft.FSharp.Core.PrintfModule::PrintFormatToTextWriter(class [runtime]System.IO.TextWriter, + class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) +IL_0016: pop +IL_0017: ret"""] diff --git a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj index b4b0d58df6a..1fe759318ef 100644 --- a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj +++ b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj @@ -23,6 +23,7 @@ + diff --git a/tests/fsharp/core/quotes/test.fsx b/tests/fsharp/core/quotes/test.fsx index 6415c466a65..35d1a057b45 100644 --- a/tests/fsharp/core/quotes/test.fsx +++ b/tests/fsharp/core/quotes/test.fsx @@ -4119,6 +4119,19 @@ module CheckEliminatedConstructs = """IfThenElse (Call (None, op_Equality, [ValueWithName ([||], ts), Value ()]), Value (true), Value (false))""" +module Interpolation = + let interpolatedNoHoleQuoted = <@ $"abc" @> + let actual1 = interpolatedNoHoleQuoted.ToString() + checkStrings "brewbreebrwhat1" actual1 """Value ("abc")""" + + let interpolatedWithLiteralQuoted = <@ $"abc {1} def" @> + let actual2 = interpolatedWithLiteralQuoted.ToString() + checkStrings "brewbreebrwhat2" actual2 + """Call (None, PrintFormatToString, + [NewObject (PrintfFormat`5, Value ("abc %P() def"), + NewArray (Object, Call (None, Box, [Value (1)])), + Value ())])""" + module TestAssemblyAttributes = let attributes = System.Reflection.Assembly.GetExecutingAssembly().GetCustomAttributes(false) From 83394183b7d7ab75204ea3ad4dc3081904cefacf Mon Sep 17 00:00:00 2001 From: dotnet bot Date: Tue, 29 Jun 2021 08:48:09 -0700 Subject: [PATCH 26/42] Localized file check-in by OneLocBuild Task: Build definition ID 499: Build ID 1211120 (#11745) --- src/fsharp/xlf/FSComp.txt.cs.xlf | 2 +- src/fsharp/xlf/FSComp.txt.de.xlf | 2 +- src/fsharp/xlf/FSComp.txt.pl.xlf | 2 +- src/fsharp/xlf/FSComp.txt.pt-BR.xlf | 2 +- src/fsharp/xlf/FSComp.txt.ru.xlf | 4 ++-- src/fsharp/xlf/FSComp.txt.tr.xlf | 2 +- src/fsharp/xlf/FSComp.txt.zh-Hans.xlf | 2 +- vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.de.xlf | 4 ++-- vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.pl.xlf | 4 ++-- vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.pt-BR.xlf | 4 ++-- vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.tr.xlf | 4 ++-- vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.zh-Hans.xlf | 4 ++-- .../xlf/Microsoft.VisualStudio.Editors.Designer.fr.xlf | 2 +- 13 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/fsharp/xlf/FSComp.txt.cs.xlf b/src/fsharp/xlf/FSComp.txt.cs.xlf index 6273fe0e00c..53b1f65d08f 100644 --- a/src/fsharp/xlf/FSComp.txt.cs.xlf +++ b/src/fsharp/xlf/FSComp.txt.cs.xlf @@ -7474,7 +7474,7 @@ A byref pointer returned by a function or method is implicitly dereferenced as of F# 4.5. To acquire the return value as a pointer, use the address-of operator, e.g. '&f(x)' or '&obj.Method(arg1, arg2)'. - K ukazateli byref vrácenému funkcí nebo metodou se od F# 4.5 implicitně přistupuje přes ukazatel. Pokud chcete návratovou hodnotu získat jako ukazatel, použijte operátor adresy, například &f(x) nebo &obj.Metoda(arg1, arg2). + K ukazateli byref vrácenému funkcí nebo metodou se od F# 4.5 implicitně přistupuje přes ukazatel. Pokud chcete návratovou hodnotu získat jako ukazatel, použijte operátor adresy, například &f(x) nebo &obj.Method(arg1, arg2). diff --git a/src/fsharp/xlf/FSComp.txt.de.xlf b/src/fsharp/xlf/FSComp.txt.de.xlf index deb01a0ac2e..777d8c594b5 100644 --- a/src/fsharp/xlf/FSComp.txt.de.xlf +++ b/src/fsharp/xlf/FSComp.txt.de.xlf @@ -359,7 +359,7 @@ The .NET SDK for this script could not be determined. dotnet.exe could not be found ensure a .NET SDK is installed. - The .NET SDK for this script could not be determined. dotnet.exe could not be found ensure a .NET SDK is installed. + Das .NET SDK für dieses Skript konnte nicht bestimmt werden. "dotnet.exe" konnte nicht gefunden werden, um sicherzustellen, dass ein .NET SDK installiert ist. diff --git a/src/fsharp/xlf/FSComp.txt.pl.xlf b/src/fsharp/xlf/FSComp.txt.pl.xlf index 1df89f793e6..970622d3493 100644 --- a/src/fsharp/xlf/FSComp.txt.pl.xlf +++ b/src/fsharp/xlf/FSComp.txt.pl.xlf @@ -7474,7 +7474,7 @@ A byref pointer returned by a function or method is implicitly dereferenced as of F# 4.5. To acquire the return value as a pointer, use the address-of operator, e.g. '&f(x)' or '&obj.Method(arg1, arg2)'. - Wskaźnik byref zwracany przez funkcję lub metodę jest niejawnie wyłuskiwany w języku F# 4.5 i nowszych. Aby uzyskać wartość zwracaną jako wskaźnik, użyj operatora address-of, np. „&f(x)” lub „&obj.Method(argument1, argument2)”. + Wskaźnik byref zwracany przez funkcję lub metodę jest niejawnie wyłuskiwany w języku F# 4.5 i nowszych. Aby uzyskać wartość zwracaną jako wskaźnik, użyj operatora address-of, np. „&f(x)” lub „&obj.Method(arg1, arg2)”. diff --git a/src/fsharp/xlf/FSComp.txt.pt-BR.xlf b/src/fsharp/xlf/FSComp.txt.pt-BR.xlf index a216008109b..ca61d6606f5 100644 --- a/src/fsharp/xlf/FSComp.txt.pt-BR.xlf +++ b/src/fsharp/xlf/FSComp.txt.pt-BR.xlf @@ -359,7 +359,7 @@ The .NET SDK for this script could not be determined. dotnet.exe could not be found ensure a .NET SDK is installed. - The .NET SDK for this script could not be determined. dotnet.exe could not be found ensure a .NET SDK is installed. + Não foi possível determinar o .NET SDK para este script. Não foi possível encontrar dotnet.exe e certifique-se de que o SDK do .NET esteja instalado. diff --git a/src/fsharp/xlf/FSComp.txt.ru.xlf b/src/fsharp/xlf/FSComp.txt.ru.xlf index 0e6e8ad79af..b9cae3afe6e 100644 --- a/src/fsharp/xlf/FSComp.txt.ru.xlf +++ b/src/fsharp/xlf/FSComp.txt.ru.xlf @@ -7439,12 +7439,12 @@ This expression returns a value of type '{0}' but is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to use the expression as a value in the sequence then use an explicit 'yield'. - Это выражение возвращает значение типа "{0}", но оно неявно отбрасывается. Чтобы привязать результат к какому-то имени, используйте "let", например: "let <результат> = <выражение>". Если вы собирались использовать выражение как значение в последовательности, используйте в явном виде "yield". + Это выражение возвращает значение типа "{0}", но оно неявно отбрасывается. Чтобы привязать результат к какому-то имени, используйте "let", например: "let <результат>= <выражение>". Если вы собирались использовать выражение как значение в последовательности, используйте в явном виде "yield". This expression returns a value of type '{0}' but is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to use the expression as a value in the sequence then use an explicit 'yield!'. - Это выражение возвращает значение типа "{0}", но оно неявно отбрасывается. Чтобы привязать результат к какому-то имени, используйте "let", например: "let <результат> = <выражение>". Если вы собирались использовать выражение как значение в последовательности, используйте в явном виде "yield!". + Это выражение возвращает значение типа "{0}", но оно неявно отбрасывается. Чтобы привязать результат к какому-то имени, используйте "let", например: "let <результат>= <выражение>". Если вы собирались использовать выражение как значение в последовательности, используйте в явном виде "yield!". diff --git a/src/fsharp/xlf/FSComp.txt.tr.xlf b/src/fsharp/xlf/FSComp.txt.tr.xlf index 07a561ce588..ce431d8f0c6 100644 --- a/src/fsharp/xlf/FSComp.txt.tr.xlf +++ b/src/fsharp/xlf/FSComp.txt.tr.xlf @@ -359,7 +359,7 @@ The .NET SDK for this script could not be determined. dotnet.exe could not be found ensure a .NET SDK is installed. - The .NET SDK for this script could not be determined. dotnet.exe could not be found ensure a .NET SDK is installed. + Bu betik için .NET SDK belirlenemedi. dotnet.exe bulunamadı, bir .NET SDK'nın yüklü olduğundan emin olun. diff --git a/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf b/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf index f6f3250b78e..e05baadc867 100644 --- a/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf @@ -359,7 +359,7 @@ The .NET SDK for this script could not be determined. dotnet.exe could not be found ensure a .NET SDK is installed. - The .NET SDK for this script could not be determined. dotnet.exe could not be found ensure a .NET SDK is installed. + 无法确定此脚本的 .NET SDK。找不到 dotnet.exe,请确保安装了 .NET SDK。 diff --git a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.de.xlf b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.de.xlf index bd944dcaa24..f1f58499629 100644 --- a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.de.xlf +++ b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.de.xlf @@ -14,7 +14,7 @@ Add missing instance member parameter - Add missing instance member parameter + Fehlenden Instanzmemberparameter hinzufügen @@ -259,7 +259,7 @@ Use 'nameof' - Use 'nameof' + "nameof" verwenden diff --git a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.pl.xlf b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.pl.xlf index 083e7e538dc..17f87908463 100644 --- a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.pl.xlf +++ b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.pl.xlf @@ -14,7 +14,7 @@ Add missing instance member parameter - Add missing instance member parameter + Dodaj brakujący parametr składowej wystąpienia @@ -259,7 +259,7 @@ Use 'nameof' - Use 'nameof' + Użyj wyrażenia "nameof" diff --git a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.pt-BR.xlf b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.pt-BR.xlf index 621923126a9..ecdeb82bfc2 100644 --- a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.pt-BR.xlf +++ b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.pt-BR.xlf @@ -14,7 +14,7 @@ Add missing instance member parameter - Add missing instance member parameter + Adicionar parâmetro de membro de instância ausente @@ -259,7 +259,7 @@ Use 'nameof' - Use 'nameof' + Usar 'nameof' diff --git a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.tr.xlf b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.tr.xlf index 2a80615d4b5..99c7fe89225 100644 --- a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.tr.xlf +++ b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.tr.xlf @@ -14,7 +14,7 @@ Add missing instance member parameter - Add missing instance member parameter + Eksik örnek üye parametresini ekleyin @@ -259,7 +259,7 @@ Use 'nameof' - Use 'nameof' + “Nameof” kullanın diff --git a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.zh-Hans.xlf b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.zh-Hans.xlf index 70449e9bd87..08ede03e605 100644 --- a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.zh-Hans.xlf +++ b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.zh-Hans.xlf @@ -14,7 +14,7 @@ Add missing instance member parameter - Add missing instance member parameter + 添加缺少的实例成员参数 @@ -259,7 +259,7 @@ Use 'nameof' - Use 'nameof' + 使用 "nameof" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.fr.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.fr.xlf index 95fb291ba91..20ea1fc286e 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.fr.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.fr.xlf @@ -330,7 +330,7 @@ Sélectionnez un chemin de dossier valide. Shutdown: Raised after all application forms are closed. This event is not raised if the application terminates abnormally. - Shutdown : Déclenché après la fermeture de tous les formulaires de l'application. Cet événement n'est pas déclenché si l'application se termine de façon anormale. + Shutdown : Déclenché après la fermeture de tous les formulaires de l'application. Cet événement n'est pas déclenché si l'application se termine de façon anormale. From 2f3c0574712dc6eec067c657311b3282fbce58f8 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 29 Jun 2021 16:40:17 +0000 Subject: [PATCH 27/42] [main] Update dependencies from dotnet/arcade (#11720) Co-authored-by: dotnet-maestro[bot] Co-authored-by: Vlad Zarytovskii --- eng/Version.Details.xml | 4 ++-- eng/common/tools.ps1 | 11 ++++++++++- global.json | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index f1c9aeec802..8a59a1999df 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -8,9 +8,9 @@ - + https://github.com/dotnet/arcade - 28a6403ee97077256fcdc60f599f0ad9e38e3cfa + 685c1a4fa207d81e881a402a32ffa1c0fb191b42 diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 5619c7aaee1..4b255203249 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -378,7 +378,16 @@ function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements = } $msbuildVersionDir = if ([int]$vsMajorVersion -lt 16) { "$vsMajorVersion.0" } else { "Current" } - return $global:_MSBuildExe = Join-Path $vsInstallDir "MSBuild\$msbuildVersionDir\Bin\msbuild.exe" + + $local:BinFolder = Join-Path $vsInstallDir "MSBuild\$msbuildVersionDir\Bin" + $local:Prefer64bit = if (Get-Member -InputObject $vsRequirements -Name 'Prefer64bit') { $vsRequirements.Prefer64bit } else { $false } + if ($local:Prefer64bit -and (Test-Path(Join-Path $local:BinFolder "amd64"))) { + $global:_MSBuildExe = Join-Path $local:BinFolder "amd64\msbuild.exe" + } else { + $global:_MSBuildExe = Join-Path $local:BinFolder "msbuild.exe" + } + + return $global:_MSBuildExe } function InitializeVisualStudioEnvironmentVariables([string] $vsInstallDir, [string] $vsMajorVersion) { diff --git a/global.json b/global.json index 0884f406b36..fd94b4b71a4 100644 --- a/global.json +++ b/global.json @@ -13,7 +13,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21321.2", + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21328.2", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From bd862b8df830fa27f31c0df607a936be9ac1dc64 Mon Sep 17 00:00:00 2001 From: dotnet bot Date: Tue, 29 Jun 2021 09:58:57 -0700 Subject: [PATCH 28/42] Localized file check-in by OneLocBuild Task: Build definition ID 499: Build ID 1211446 (#11746) --- src/fsharp/xlf/FSComp.txt.pl.xlf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fsharp/xlf/FSComp.txt.pl.xlf b/src/fsharp/xlf/FSComp.txt.pl.xlf index 970622d3493..c4626b4d85f 100644 --- a/src/fsharp/xlf/FSComp.txt.pl.xlf +++ b/src/fsharp/xlf/FSComp.txt.pl.xlf @@ -359,7 +359,7 @@ The .NET SDK for this script could not be determined. dotnet.exe could not be found ensure a .NET SDK is installed. - The .NET SDK for this script could not be determined. dotnet.exe could not be found ensure a .NET SDK is installed. + Nie można określić zestawu .NET SDK dla tego skryptu. Nie można odnaleźć pliku dotnet.exe. Upewnij się, że zestaw .NET SDK jest zainstalowany. From 4157807adbc892284079fea321c10a80dfb8da20 Mon Sep 17 00:00:00 2001 From: Ryan Coy Date: Tue, 29 Jun 2021 18:59:38 +0200 Subject: [PATCH 29/42] Add FSC option for retrieving raw lexer tokens (#10578) * Add FSC option for retrieving raw lexer tokens * Added basic tokenizer switch tests Co-authored-by: Kevin Ransom (msft) Co-authored-by: Vlad Zarytovskii --- src/fsharp/CompilerConfig.fs | 11 +++- src/fsharp/CompilerConfig.fsi | 9 ++- src/fsharp/CompilerOptions.fs | 7 ++- src/fsharp/ParseAndCheckInputs.fs | 22 ++++--- .../CompilerOptions/fsc/tokenize/env.lst | 3 + .../fsc/tokenize/tokenize01.fs | 60 +++++++++++++++++++ .../fsc/tokenize/tokenize02.fs | 22 +++++++ tests/fsharpqa/Source/test.lst | 1 + 8 files changed, 121 insertions(+), 14 deletions(-) create mode 100644 tests/fsharpqa/Source/CompilerOptions/fsc/tokenize/env.lst create mode 100644 tests/fsharpqa/Source/CompilerOptions/fsc/tokenize/tokenize01.fs create mode 100644 tests/fsharpqa/Source/CompilerOptions/fsc/tokenize/tokenize02.fs diff --git a/src/fsharp/CompilerConfig.fs b/src/fsharp/CompilerConfig.fs index c7dd623fad6..0bdc81698c5 100644 --- a/src/fsharp/CompilerConfig.fs +++ b/src/fsharp/CompilerConfig.fs @@ -270,6 +270,11 @@ type LStatus = | Unprocessed | Processed +type TokenizeOption = + | AndCompile + | Only + | Unfiltered + type PackageManagerLine = { Directive: Directive LineStatus: LStatus @@ -367,7 +372,7 @@ type TcConfigBuilder = mutable importAllReferencesOnly: bool mutable simulateException: string option mutable printAst: bool - mutable tokenizeOnly: bool + mutable tokenize: TokenizeOption mutable testInteractionParser: bool mutable reportNumDecls: bool mutable printSignature: bool @@ -573,7 +578,7 @@ type TcConfigBuilder = importAllReferencesOnly = false simulateException = None printAst = false - tokenizeOnly = false + tokenize = TokenizeOption.AndCompile testInteractionParser = false reportNumDecls = false printSignature = false @@ -960,7 +965,7 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) = member x.simulateException = data.simulateException member x.printAst = data.printAst member x.targetFrameworkVersion = targetFrameworkVersionValue - member x.tokenizeOnly = data.tokenizeOnly + member x.tokenize = data.tokenize member x.testInteractionParser = data.testInteractionParser member x.reportNumDecls = data.reportNumDecls member x.printSignature = data.printSignature diff --git a/src/fsharp/CompilerConfig.fsi b/src/fsharp/CompilerConfig.fsi index 4c8831e6ba6..acb5f140b3d 100644 --- a/src/fsharp/CompilerConfig.fsi +++ b/src/fsharp/CompilerConfig.fsi @@ -121,6 +121,11 @@ type LStatus = | Unprocessed | Processed +type TokenizeOption = + | AndCompile + | Only + | Unfiltered + type PackageManagerLine = { Directive: Directive LineStatus: LStatus @@ -182,7 +187,7 @@ type TcConfigBuilder = mutable importAllReferencesOnly: bool mutable simulateException: string option mutable printAst: bool - mutable tokenizeOnly: bool + mutable tokenize: TokenizeOption mutable testInteractionParser: bool mutable reportNumDecls: bool mutable printSignature: bool @@ -374,7 +379,7 @@ type TcConfig = member importAllReferencesOnly: bool member simulateException: string option member printAst: bool - member tokenizeOnly: bool + member tokenize: TokenizeOption member testInteractionParser: bool member reportNumDecls: bool member printSignature: bool diff --git a/src/fsharp/CompilerOptions.fs b/src/fsharp/CompilerOptions.fs index b04c13031ab..51339cb8453 100644 --- a/src/fsharp/CompilerOptions.fs +++ b/src/fsharp/CompilerOptions.fs @@ -1139,9 +1139,14 @@ let internalFlags (tcConfigB:TcConfigBuilder) = CompilerOption ("tokenize", tagNone, - OptionUnit (fun () -> tcConfigB.tokenizeOnly <- true), + OptionUnit (fun () -> tcConfigB.tokenize <- TokenizeOption.Only), Some(InternalCommandLineOption("--tokenize", rangeCmdArgs)), None) + CompilerOption + ("tokenize-unfiltered", tagNone, + OptionUnit (fun () -> tcConfigB.tokenize <- TokenizeOption.Unfiltered), + Some(InternalCommandLineOption("--tokenize-unfiltered", rangeCmdArgs)), None) + CompilerOption ("testInteractionParser", tagNone, OptionUnit (fun () -> tcConfigB.testInteractionParser <- true), diff --git a/src/fsharp/ParseAndCheckInputs.fs b/src/fsharp/ParseAndCheckInputs.fs index 351561f585d..3fdcad9d519 100644 --- a/src/fsharp/ParseAndCheckInputs.fs +++ b/src/fsharp/ParseAndCheckInputs.fs @@ -289,11 +289,13 @@ let ParseInput (lexer, errorLogger: ErrorLogger, lexbuf: UnicodeLexing.Lexbuf, d let filteringErrorLogger = GetErrorLoggerFilteringByScopedPragmas(false, scopedPragmas, errorLogger) delayLogger.CommitDelayedDiagnostics filteringErrorLogger +type Tokenizer = unit -> Parser.token + // Show all tokens in the stream, for testing purposes -let ShowAllTokensAndExit (shortFilename, tokenizer: LexFilter.LexFilter, lexbuf: LexBuffer) = +let ShowAllTokensAndExit (shortFilename, tokenizer: Tokenizer, lexbuf: LexBuffer) = while true do printf "tokenize - getting one token from %s\n" shortFilename - let t = tokenizer.GetToken() + let t = tokenizer () printf "tokenize - got %s @ %a\n" (Parser.token_to_string t) outputRange lexbuf.LexemeRange match t with | Parser.EOF _ -> exit 0 @@ -301,11 +303,11 @@ let ShowAllTokensAndExit (shortFilename, tokenizer: LexFilter.LexFilter, lexbuf: if lexbuf.IsPastEndOfStream then printf "!!! at end of stream\n" // Test one of the parser entry points, just for testing purposes -let TestInteractionParserAndExit (tokenizer: LexFilter.LexFilter, lexbuf: LexBuffer) = +let TestInteractionParserAndExit (tokenizer: Tokenizer, lexbuf: LexBuffer) = while true do - match (Parser.interaction (fun _ -> tokenizer.GetToken()) lexbuf) with + match (Parser.interaction (fun _ -> tokenizer ()) lexbuf) with | ParsedScriptInteraction.Definitions(l, m) -> printfn "Parsed OK, got %d defs @ %a" l.Length outputRange m - | ParsedScriptInteraction.HashDirective (_, m) -> printfn "Parsed OK, got hash @ %a" outputRange m + | ParsedScriptInteraction.HashDirective(_, m) -> printfn "Parsed OK, got hash @ %a" outputRange m exit 0 // Report the statistics for testing purposes @@ -369,10 +371,14 @@ let ParseOneInputLexbuf (tcConfig: TcConfig, lexResourceManager, conditionalComp Lexhelp.usingLexbufForParsing (lexbuf, filename) (fun lexbuf -> // Set up the LexFilter over the token stream - let tokenizer = LexFilter.LexFilter(lightStatus, tcConfig.compilingFslib, Lexer.token lexargs skipWhitespaceTokens, lexbuf) + let tokenizer,tokenizeOnly = + match tcConfig.tokenize with + | Unfiltered -> (fun () -> Lexer.token lexargs skipWhitespaceTokens lexbuf), true + | Only -> LexFilter.LexFilter(lightStatus, tcConfig.compilingFslib, Lexer.token lexargs skipWhitespaceTokens, lexbuf).GetToken, true + | _ -> LexFilter.LexFilter(lightStatus, tcConfig.compilingFslib, Lexer.token lexargs skipWhitespaceTokens, lexbuf).GetToken, false // If '--tokenize' then show the tokens now and exit - if tcConfig.tokenizeOnly then + if tokenizeOnly then ShowAllTokensAndExit(shortFilename, tokenizer, lexbuf) // Test hook for one of the parser entry points @@ -380,7 +386,7 @@ let ParseOneInputLexbuf (tcConfig: TcConfig, lexResourceManager, conditionalComp TestInteractionParserAndExit (tokenizer, lexbuf) // Parse the input - let res = ParseInput((fun _ -> tokenizer.GetToken()), errorLogger, lexbuf, None, filename, isLastCompiland) + let res = ParseInput((fun _ -> tokenizer ()), errorLogger, lexbuf, None, filename, isLastCompiland) // Report the statistics for testing purposes if tcConfig.reportNumDecls then diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/tokenize/env.lst b/tests/fsharpqa/Source/CompilerOptions/fsc/tokenize/env.lst new file mode 100644 index 00000000000..5016280a55a --- /dev/null +++ b/tests/fsharpqa/Source/CompilerOptions/fsc/tokenize/env.lst @@ -0,0 +1,3 @@ +# Test tokenize outputs tokens + SOURCE=tokenize01.fs COMPILE_ONLY=1 SCFLAGS="--tokenize" + SOURCE=tokenize02.fs COMPILE_ONLY=1 SCFLAGS="--tokenize-unfiltered" \ No newline at end of file diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/tokenize/tokenize01.fs b/tests/fsharpqa/Source/CompilerOptions/fsc/tokenize/tokenize01.fs new file mode 100644 index 00000000000..48c56e06129 --- /dev/null +++ b/tests/fsharpqa/Source/CompilerOptions/fsc/tokenize/tokenize01.fs @@ -0,0 +1,60 @@ +// #NoMT #CompilerOptions +#light + +namespace N + module M = + let f x = () + f 10 + +//tokenize - got NAMESPACE +//tokenize - got IDENT +//tokenize - got OBLOCKBEGIN +//tokenize - got MODULE_COMING_SOON +//tokenize - got MODULE_COMING_SOON +//tokenize - got MODULE_COMING_SOON +//tokenize - got MODULE_COMING_SOON +//tokenize - got MODULE_COMING_SOON +//tokenize - got MODULE_COMING_SOON +//tokenize - got MODULE_IS_HERE +//tokenize - got IDENT +//tokenize - got EQUALS +//tokenize - got OBLOCKBEGIN +//tokenize - got OLET +//tokenize - got IDENT +//tokenize - got IDENT +//tokenize - got EQUALS +//tokenize - got OBLOCKBEGIN +//tokenize - got LPAREN +//tokenize - got RPAREN_COMING_SOON +//tokenize - got RPAREN_COMING_SOON +//tokenize - got RPAREN_COMING_SOON +//tokenize - got RPAREN_COMING_SOON +//tokenize - got RPAREN_COMING_SOON +//tokenize - got RPAREN_COMING_SOON +//tokenize - got RPAREN_IS_HERE +//tokenize - got OBLOCKEND_COMING_SOON +//tokenize - got OBLOCKEND_COMING_SOON +//tokenize - got OBLOCKEND_COMING_SOON +//tokenize - got OBLOCKEND_COMING_SOON +//tokenize - got OBLOCKEND_COMING_SOON +//tokenize - got OBLOCKEND_COMING_SOON +//tokenize - got OBLOCKEND_IS_HERE +//tokenize - got ODECLEND +//tokenize - got OBLOCKSEP +//tokenize - got IDENT +//tokenize - got INT32 +//tokenize - got OBLOCKEND_COMING_SOON +//tokenize - got OBLOCKEND_COMING_SOON +//tokenize - got OBLOCKEND_COMING_SOON +//tokenize - got OBLOCKEND_COMING_SOON +//tokenize - got OBLOCKEND_COMING_SOON +//tokenize - got OBLOCKEND_COMING_SOON +//tokenize - got OBLOCKEND_IS_HERE +//tokenize - got OBLOCKEND_COMING_SOON +//tokenize - got OBLOCKEND_COMING_SOON +//tokenize - got OBLOCKEND_COMING_SOON +//tokenize - got OBLOCKEND_COMING_SOON +//tokenize - got OBLOCKEND_COMING_SOON +//tokenize - got OBLOCKEND_COMING_SOON +//tokenize - got OBLOCKEND_IS_HERE +//tokenize - got EOF \ No newline at end of file diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/tokenize/tokenize02.fs b/tests/fsharpqa/Source/CompilerOptions/fsc/tokenize/tokenize02.fs new file mode 100644 index 00000000000..d139e72caee --- /dev/null +++ b/tests/fsharpqa/Source/CompilerOptions/fsc/tokenize/tokenize02.fs @@ -0,0 +1,22 @@ +// #NoMT #CompilerOptions +#light + +namespace N + module M = + let f x = () + f 10 + +//tokenize - got NAMESPACE +//tokenize - got IDENT +//tokenize - got MODULE +//tokenize - got IDENT +//tokenize - got EQUALS +//tokenize - got LET +//tokenize - got IDENT +//tokenize - got IDENT +//tokenize - got EQUALS +//tokenize - got LPAREN +//tokenize - got RPAREN +//tokenize - got IDENT +//tokenize - got INT32 +//tokenize - got EOF \ No newline at end of file diff --git a/tests/fsharpqa/Source/test.lst b/tests/fsharpqa/Source/test.lst index e4b9f292d8c..5a8307bdb9f 100644 --- a/tests/fsharpqa/Source/test.lst +++ b/tests/fsharpqa/Source/test.lst @@ -57,6 +57,7 @@ CompilerOptions01,NoMT CompilerOptions\fsc\subsystemversion CompilerOptions01,NoMT CompilerOptions\fsc\tailcalls CompilerOptions01,NoMT CompilerOptions\fsc\target CompilerOptions01,NoMT,NoHostedCompiler CompilerOptions\fsc\times +CompilerOptions01,NoMT,NoHostedCompiler CompilerOptions\fsc\tokenize CompilerOptions01,NoMT CompilerOptions\fsc\warn CompilerOptions01,NoMT CompilerOptions\fsc\warnaserror CompilerOptions01,NoMT CompilerOptions\fsc\warnon From 07382fb17b9f112529e1b5fcf04815ffb3ee4f1f Mon Sep 17 00:00:00 2001 From: Hadrian Tang Date: Wed, 30 Jun 2021 01:36:37 +0800 Subject: [PATCH 30/42] Allow attributes after the 'module' keyword (#11722) Co-authored-by: Vlad Zarytovskii --- src/fsharp/FSComp.txt | 1 + .../FSharp.Compiler.Service.fsproj | 24 +-- src/fsharp/LanguageFeatures.fs | 3 + src/fsharp/LanguageFeatures.fsi | 1 + src/fsharp/LexFilter.fs | 37 ++-- src/fsharp/ParseAndCheckInputs.fs | 3 +- src/fsharp/ParseHelpers.fs | 10 +- src/fsharp/ParseHelpers.fsi | 4 +- src/fsharp/ScriptClosure.fs | 3 +- src/fsharp/UnicodeLexing.fs | 16 +- src/fsharp/UnicodeLexing.fsi | 8 +- src/fsharp/fsi/fsi.fs | 13 +- src/fsharp/lex.fsl | 6 +- src/fsharp/pars.fsy | 42 ++-- src/fsharp/service/FSharpCheckerResults.fs | 3 +- src/fsharp/service/ServiceLexing.fs | 20 +- src/fsharp/utils/prim-lexing.fs | 22 +- src/fsharp/utils/prim-lexing.fsi | 13 +- src/fsharp/xlf/FSComp.txt.cs.xlf | 5 + src/fsharp/xlf/FSComp.txt.de.xlf | 5 + src/fsharp/xlf/FSComp.txt.es.xlf | 5 + src/fsharp/xlf/FSComp.txt.fr.xlf | 5 + src/fsharp/xlf/FSComp.txt.it.xlf | 5 + src/fsharp/xlf/FSComp.txt.ja.xlf | 5 + src/fsharp/xlf/FSComp.txt.ko.xlf | 5 + src/fsharp/xlf/FSComp.txt.pl.xlf | 5 + src/fsharp/xlf/FSComp.txt.pt-BR.xlf | 5 + src/fsharp/xlf/FSComp.txt.ru.xlf | 5 + src/fsharp/xlf/FSComp.txt.tr.xlf | 5 + src/fsharp/xlf/FSComp.txt.zh-Hans.xlf | 5 + src/fsharp/xlf/FSComp.txt.zh-Hant.xlf | 5 + .../ErrorMessages/ModuleAbbreviationTests.fs | 17 -- .../ErrorMessages/ModuleTests.fs | 204 ++++++++++++++++++ .../FSharp.Compiler.ComponentTests.fsproj | 2 +- .../HashIfExpression.fs | 3 +- tests/FSharp.Test.Utilities/Compiler.fs | 4 +- 36 files changed, 405 insertions(+), 119 deletions(-) delete mode 100644 tests/FSharp.Compiler.ComponentTests/ErrorMessages/ModuleAbbreviationTests.fs create mode 100644 tests/FSharp.Compiler.ComponentTests/ErrorMessages/ModuleTests.fs diff --git a/src/fsharp/FSComp.txt b/src/fsharp/FSComp.txt index f3fd98c6d50..33b86c208fc 100644 --- a/src/fsharp/FSComp.txt +++ b/src/fsharp/FSComp.txt @@ -1233,6 +1233,7 @@ featureExpandedMeasurables,"more types support units of measure" featurePrintfBinaryFormat,"binary formatting for integers" featureDiscardUseValue,"discard pattern in use binding" featureNonVariablePatternsToRightOfAsPatterns,"non-variable patterns to the right of 'as' patterns" +featureAttributesToRightOfModuleKeyword,"attributes to the right of the 'module' keyword" 3090,tcIfThenElseMayNotBeUsedWithinQueries,"An if/then/else expression may not be used within queries. Consider using either an if/then expression, or use a sequence expression instead." 3091,ilxgenUnexpectedArgumentToMethodHandleOfDuringCodegen,"Invalid argument to 'methodhandleof' during codegen" 3092,etProvidedTypeReferenceMissingArgument,"A reference to a provided type was missing a value for the static parameter '%s'. You may need to recompile one or more referenced assemblies." diff --git a/src/fsharp/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj b/src/fsharp/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj index dd96b7da59e..996bdaca789 100644 --- a/src/fsharp/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj +++ b/src/fsharp/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj @@ -112,18 +112,6 @@ Facilities\LanguageFeatures.fs - - LexYaccRuntime\prim-lexing.fsi - - - LexYaccRuntime\prim-lexing.fs - - - LexYaccRuntime\prim-parsing.fsi - - - LexYaccRuntime\prim-parsing.fs - Utilities\ResizeArray.fsi @@ -247,6 +235,18 @@ ErrorLogging\ErrorResolutionHints.fs + + LexYaccRuntime\prim-lexing.fsi + + + LexYaccRuntime\prim-lexing.fs + + + LexYaccRuntime\prim-parsing.fsi + + + LexYaccRuntime\prim-parsing.fs + --unicode --lexlib Internal.Utilities.Text.Lexing AbsIL\illex.fsl diff --git a/src/fsharp/LanguageFeatures.fs b/src/fsharp/LanguageFeatures.fs index d3d52796c9c..2e7fd7f4af9 100644 --- a/src/fsharp/LanguageFeatures.fs +++ b/src/fsharp/LanguageFeatures.fs @@ -40,6 +40,7 @@ type LanguageFeature = | PrintfBinaryFormat | UseBindingValueDiscard | NonVariablePatternsToRightOfAsPatterns + | AttributesToRightOfModuleKeyword /// LanguageVersion management type LanguageVersion (specifiedVersionAsString) = @@ -85,6 +86,7 @@ type LanguageVersion (specifiedVersionAsString) = LanguageFeature.PrintfBinaryFormat, previewVersion LanguageFeature.UseBindingValueDiscard, previewVersion LanguageFeature.NonVariablePatternsToRightOfAsPatterns, previewVersion + LanguageFeature.AttributesToRightOfModuleKeyword, previewVersion ] let specified = @@ -162,6 +164,7 @@ type LanguageVersion (specifiedVersionAsString) = | LanguageFeature.PrintfBinaryFormat -> FSComp.SR.featurePrintfBinaryFormat() | LanguageFeature.UseBindingValueDiscard -> FSComp.SR.featureDiscardUseValue() | LanguageFeature.NonVariablePatternsToRightOfAsPatterns -> FSComp.SR.featureNonVariablePatternsToRightOfAsPatterns() + | LanguageFeature.AttributesToRightOfModuleKeyword -> FSComp.SR.featureAttributesToRightOfModuleKeyword() /// Get a version string associated with the given feature. member _.GetFeatureVersionString feature = diff --git a/src/fsharp/LanguageFeatures.fsi b/src/fsharp/LanguageFeatures.fsi index 8ca05f2cede..e7e0a9c12a9 100644 --- a/src/fsharp/LanguageFeatures.fsi +++ b/src/fsharp/LanguageFeatures.fsi @@ -28,6 +28,7 @@ type LanguageFeature = | PrintfBinaryFormat | UseBindingValueDiscard | NonVariablePatternsToRightOfAsPatterns + | AttributesToRightOfModuleKeyword /// LanguageVersion management type LanguageVersion = diff --git a/src/fsharp/LexFilter.fs b/src/fsharp/LexFilter.fs index 152ff46a1af..2e84a4279f3 100644 --- a/src/fsharp/LexFilter.fs +++ b/src/fsharp/LexFilter.fs @@ -47,7 +47,7 @@ type Context = | CtxtTypeDefns of Position // 'type =', not removed when we find the "=" | CtxtNamespaceHead of Position * token - | CtxtModuleHead of Position * token + | CtxtModuleHead of Position * token * LexingModuleAttributes | CtxtMemberHead of Position | CtxtMemberBody of Position // If bool is true then this is "whole file" @@ -65,7 +65,7 @@ type Context = member c.StartPos = match c with - | CtxtNamespaceHead (p, _) | CtxtModuleHead (p, _) | CtxtException p | CtxtModuleBody (p, _) | CtxtNamespaceBody p + | CtxtNamespaceHead (p, _) | CtxtModuleHead (p, _, _) | CtxtException p | CtxtModuleBody (p, _) | CtxtNamespaceBody p | CtxtLetDecl (_, p) | CtxtDo p | CtxtInterfaceHead p | CtxtTypeDefns p | CtxtParen (_, p) | CtxtMemberHead p | CtxtMemberBody p | CtxtWithAsLet p | CtxtWithAsAugment p @@ -108,6 +108,7 @@ type Context = and AddBlockEnd = AddBlockEnd | NoAddBlockEnd | AddOneSidedBlockEnd and FirstInSequence = FirstInSeqBlock | NotFirstInSeqBlock +and LexingModuleAttributes = LexingModuleAttributes | NotLexingModuleAttributes let isInfix token = @@ -1426,19 +1427,27 @@ type LexFilterImpl (lightStatus: LightSyntaxStatus, compilingFsLib, lexer, lexbu // Transition rule. CtxtModuleHead ~~~> push CtxtModuleBody; push CtxtSeqBlock // Applied when a ':' or '=' token is seen - // Otherwise it's a 'head' module declaration, so ignore it - | _, (CtxtModuleHead (moduleTokenPos, prevToken) :: _) -> - match prevToken, token with - | MODULE, GLOBAL when moduleTokenPos.Column < tokenStartPos.Column -> - replaceCtxt tokenTup (CtxtModuleHead (moduleTokenPos, token)) + // Otherwise it's a 'head' module declaration, so ignore it + + // Here prevToken is either 'module', 'rec', 'global' (invalid), '.', or ident, because we skip attribute tokens and access modifier tokens + | _, (CtxtModuleHead (moduleTokenPos, prevToken, lexingModuleAttributes) :: _) -> + match prevToken, token with + | _, GREATER_RBRACK when lexingModuleAttributes = LexingModuleAttributes + && moduleTokenPos.Column < tokenStartPos.Column -> + replaceCtxt tokenTup (CtxtModuleHead (moduleTokenPos, prevToken, NotLexingModuleAttributes)) returnToken tokenLexbufState token - | MODULE, (PUBLIC | PRIVATE | INTERNAL) when moduleTokenPos.Column < tokenStartPos.Column -> + | _ when lexingModuleAttributes = LexingModuleAttributes + && moduleTokenPos.Column < tokenStartPos.Column -> returnToken tokenLexbufState token - | (MODULE | DOT | REC), (REC | IDENT _) when moduleTokenPos.Column < tokenStartPos.Column -> - replaceCtxt tokenTup (CtxtModuleHead (moduleTokenPos, token)) + | MODULE, (PUBLIC | PRIVATE | INTERNAL) when moduleTokenPos.Column < tokenStartPos.Column -> returnToken tokenLexbufState token + | MODULE, GLOBAL + | (MODULE | REC | DOT), (REC | IDENT _) | IDENT _, DOT when moduleTokenPos.Column < tokenStartPos.Column -> - replaceCtxt tokenTup (CtxtModuleHead (moduleTokenPos, token)) + replaceCtxt tokenTup (CtxtModuleHead (moduleTokenPos, token, NotLexingModuleAttributes)) + returnToken tokenLexbufState token + | MODULE, LBRACK_LESS when moduleTokenPos.Column < tokenStartPos.Column -> + replaceCtxt tokenTup (CtxtModuleHead (moduleTokenPos, prevToken, LexingModuleAttributes)) returnToken tokenLexbufState token | _, (EQUALS | COLON) -> if debug then dprintf "CtxtModuleHead: COLON/EQUALS, pushing CtxtModuleBody and CtxtSeqBlock\n" @@ -1453,12 +1462,12 @@ type LexFilterImpl (lightStatus: LightSyntaxStatus, compilingFsLib, lexer, lexbu match tokenTup.Token with | Parser.EOF _ -> returnToken tokenLexbufState token - | _ -> + | _ -> + // We have reached other tokens without encountering '=' or ':', so this is a module declaration spanning the whole file delayToken tokenTup pushCtxt tokenTup (CtxtModuleBody (moduleTokenPos, true)) pushCtxtSeqBlockAt (tokenTup, true, AddBlockEnd) hwTokenFetch false - // Offside rule for SeqBlock. // f x // g x @@ -1769,7 +1778,7 @@ type LexFilterImpl (lightStatus: LightSyntaxStatus, compilingFsLib, lexer, lexbu | MODULE, (_ :: _) -> insertComingSoonTokens("MODULE", MODULE_COMING_SOON, MODULE_IS_HERE) if debug then dprintf "MODULE: entering CtxtModuleHead, awaiting EQUALS to go to CtxtSeqBlock (%a)\n" outputPos tokenStartPos - pushCtxt tokenTup (CtxtModuleHead (tokenStartPos, token)) + pushCtxt tokenTup (CtxtModuleHead (tokenStartPos, token, NotLexingModuleAttributes)) pool.Return tokenTup hwTokenFetch useBlockRule diff --git a/src/fsharp/ParseAndCheckInputs.fs b/src/fsharp/ParseAndCheckInputs.fs index 3fdcad9d519..d6c7991cf7d 100644 --- a/src/fsharp/ParseAndCheckInputs.fs +++ b/src/fsharp/ParseAndCheckInputs.fs @@ -417,7 +417,8 @@ let parseInputFileAux (tcConfig: TcConfig, lexResourceManager, conditionalCompil use reader = fileStream.GetReader(tcConfig.inputCodePage, retryLocked) // Set up the LexBuffer for the file - let lexbuf = UnicodeLexing.StreamReaderAsLexbuf(not tcConfig.compilingFslib, tcConfig.langVersion.SupportsFeature, reader) + let checkLanguageFeatureErrorRecover = ErrorLogger.checkLanguageFeatureErrorRecover tcConfig.langVersion + let lexbuf = UnicodeLexing.StreamReaderAsLexbuf(not tcConfig.compilingFslib, tcConfig.langVersion.SupportsFeature, checkLanguageFeatureErrorRecover, reader) // Parse the file drawing tokens from the lexbuf ParseOneInputLexbuf(tcConfig, lexResourceManager, conditionalCompilationDefines, lexbuf, filename, isLastCompiland, errorLogger) diff --git a/src/fsharp/ParseHelpers.fs b/src/fsharp/ParseHelpers.fs index 35a10a0b1f9..445d44a5a80 100644 --- a/src/fsharp/ParseHelpers.fs +++ b/src/fsharp/ParseHelpers.fs @@ -220,7 +220,7 @@ and LexCont = LexerContinuation // Parse IL assembly code //------------------------------------------------------------------------ -let ParseAssemblyCodeInstructions s reportLibraryOnlyFeatures (isFeatureSupported: LanguageFeature -> bool) m : IL.ILInstr[] = +let ParseAssemblyCodeInstructions s reportLibraryOnlyFeatures (isFeatureSupported: LanguageFeature -> bool) checkLanguageFeatureErrorRecover m : IL.ILInstr[] = #if NO_INLINE_IL_PARSER ignore s ignore isFeatureSupported @@ -231,24 +231,26 @@ let ParseAssemblyCodeInstructions s reportLibraryOnlyFeatures (isFeatureSupporte try FSharp.Compiler.AbstractIL.AsciiParser.ilInstrs FSharp.Compiler.AbstractIL.AsciiLexer.token - (UnicodeLexing.StringAsLexbuf(reportLibraryOnlyFeatures, isFeatureSupported, s)) + (UnicodeLexing.StringAsLexbuf(reportLibraryOnlyFeatures, isFeatureSupported, checkLanguageFeatureErrorRecover, s)) with _ -> errorR(Error(FSComp.SR.astParseEmbeddedILError(), m)); [||] #endif -let ParseAssemblyCodeType s reportLibraryOnlyFeatures (isFeatureSupported: Features.LanguageFeature -> bool) m = +let ParseAssemblyCodeType s reportLibraryOnlyFeatures (isFeatureSupported: Features.LanguageFeature -> bool) (checkLanguageFeatureErrorRecover: Features.LanguageFeature -> range -> unit) m = ignore s ignore isFeatureSupported + ignore checkLanguageFeatureErrorRecover #if NO_INLINE_IL_PARSER errorR(Error((193, "Inline IL not valid in a hosted environment"), m)) IL.PrimaryAssemblyILGlobals.typ_Object #else let isFeatureSupported (_featureId:LanguageFeature) = true + let checkLanguageFeatureErrorRecover (_featureId:LanguageFeature) _range = () try FSharp.Compiler.AbstractIL.AsciiParser.ilType FSharp.Compiler.AbstractIL.AsciiLexer.token - (UnicodeLexing.StringAsLexbuf(reportLibraryOnlyFeatures, isFeatureSupported, s)) + (UnicodeLexing.StringAsLexbuf(reportLibraryOnlyFeatures, isFeatureSupported, checkLanguageFeatureErrorRecover, s)) with RecoverableParseError -> errorR(Error(FSComp.SR.astParseEmbeddedILTypeError(), m)); IL.PrimaryAssemblyILGlobals.typ_Object diff --git a/src/fsharp/ParseHelpers.fsi b/src/fsharp/ParseHelpers.fsi index 716246338a2..3a2e5e511f5 100644 --- a/src/fsharp/ParseHelpers.fsi +++ b/src/fsharp/ParseHelpers.fsi @@ -108,6 +108,6 @@ type LexerContinuation = and LexCont = LexerContinuation -val ParseAssemblyCodeInstructions: s:string -> reportLibraryOnlyFeatures: bool -> isFeatureSupported:(Features.LanguageFeature -> bool) -> m:range -> ILInstr[] +val ParseAssemblyCodeInstructions: s:string -> reportLibraryOnlyFeatures: bool -> isFeatureSupported:(Features.LanguageFeature -> bool) -> checkLanguageFeatureErrorRecover:(Features.LanguageFeature -> range -> unit) -> m:range -> ILInstr[] -val ParseAssemblyCodeType: s:string -> reportLibraryOnlyFeatures: bool -> isFeatureSupported:(Features.LanguageFeature -> bool) -> m:range -> ILType +val ParseAssemblyCodeType: s:string -> reportLibraryOnlyFeatures: bool -> isFeatureSupported:(Features.LanguageFeature -> bool) -> checkLanguageFeatureErrorRecover:(Features.LanguageFeature -> range -> unit) -> m:range -> ILType diff --git a/src/fsharp/ScriptClosure.fs b/src/fsharp/ScriptClosure.fs index c7fa44a6b26..887e1dbe00b 100644 --- a/src/fsharp/ScriptClosure.fs +++ b/src/fsharp/ScriptClosure.fs @@ -111,7 +111,8 @@ module ScriptPreprocessClosure = | CodeContext.Editing -> "EDITING" :: (if IsScript filename then ["INTERACTIVE"] else ["COMPILED"]) let isFeatureSupported featureId = tcConfig.langVersion.SupportsFeature featureId - let lexbuf = UnicodeLexing.SourceTextAsLexbuf(true, isFeatureSupported, sourceText) + let checkLanguageFeatureErrorRecover = ErrorLogger.checkLanguageFeatureErrorRecover tcConfig.langVersion + let lexbuf = UnicodeLexing.SourceTextAsLexbuf(true, isFeatureSupported, checkLanguageFeatureErrorRecover, sourceText) let isLastCompiland = (IsScript filename), tcConfig.target.IsExe // The root compiland is last in the list of compilands. ParseOneInputLexbuf (tcConfig, lexResourceManager, defines, lexbuf, filename, isLastCompiland, errorLogger) diff --git a/src/fsharp/UnicodeLexing.fs b/src/fsharp/UnicodeLexing.fs index 99ee27ff721..946d791844c 100644 --- a/src/fsharp/UnicodeLexing.fs +++ b/src/fsharp/UnicodeLexing.fs @@ -8,18 +8,18 @@ open Internal.Utilities.Text.Lexing type Lexbuf = LexBuffer -let StringAsLexbuf (reportLibraryOnlyFeatures, supportsFeature, s: string) = - LexBuffer.FromChars (reportLibraryOnlyFeatures, supportsFeature, s.ToCharArray()) +let StringAsLexbuf (reportLibraryOnlyFeatures, supportsFeature, checkLanguageFeatureErrorRecover, s: string) = + LexBuffer.FromChars (reportLibraryOnlyFeatures, supportsFeature, checkLanguageFeatureErrorRecover, s.ToCharArray()) -let FunctionAsLexbuf (reportLibraryOnlyFeatures, supportsFeature, bufferFiller) = - LexBuffer.FromFunction(reportLibraryOnlyFeatures, supportsFeature, bufferFiller) +let FunctionAsLexbuf (reportLibraryOnlyFeatures, supportsFeature, checkLanguageFeatureErrorRecover, bufferFiller) = + LexBuffer.FromFunction(reportLibraryOnlyFeatures, supportsFeature, checkLanguageFeatureErrorRecover, bufferFiller) -let SourceTextAsLexbuf (reportLibraryOnlyFeatures, supportsFeature, sourceText) = - LexBuffer.FromSourceText(reportLibraryOnlyFeatures, supportsFeature, sourceText) +let SourceTextAsLexbuf (reportLibraryOnlyFeatures, supportsFeature, checkLanguageFeatureErrorRecover, sourceText) = + LexBuffer.FromSourceText(reportLibraryOnlyFeatures, supportsFeature, checkLanguageFeatureErrorRecover, sourceText) -let StreamReaderAsLexbuf (reportLibraryOnlyFeatures, supportsFeature, reader: StreamReader) = +let StreamReaderAsLexbuf (reportLibraryOnlyFeatures, supportsFeature, checkLanguageFeatureErrorRecover, reader: StreamReader) = let mutable isFinished = false - FunctionAsLexbuf (reportLibraryOnlyFeatures, supportsFeature, fun (chars, start, length) -> + FunctionAsLexbuf (reportLibraryOnlyFeatures, supportsFeature, checkLanguageFeatureErrorRecover, fun (chars, start, length) -> if isFinished then 0 else let nBytesRead = reader.Read(chars, start, length) diff --git a/src/fsharp/UnicodeLexing.fsi b/src/fsharp/UnicodeLexing.fsi index 838b96a6a11..7d2c56ff6f8 100644 --- a/src/fsharp/UnicodeLexing.fsi +++ b/src/fsharp/UnicodeLexing.fsi @@ -9,11 +9,11 @@ open Internal.Utilities.Text.Lexing type Lexbuf = LexBuffer -val internal StringAsLexbuf: reportLibraryOnlyFeatures: bool * (LanguageFeature -> bool) * string -> Lexbuf +val internal StringAsLexbuf: reportLibraryOnlyFeatures: bool * (LanguageFeature -> bool) * (LanguageFeature -> range -> unit) * string -> Lexbuf -val public FunctionAsLexbuf: reportLibraryOnlyFeatures: bool * (LanguageFeature -> bool) * (char [] * int * int -> int) -> Lexbuf +val public FunctionAsLexbuf: reportLibraryOnlyFeatures: bool * (LanguageFeature -> bool) * (LanguageFeature -> range -> unit) * (char [] * int * int -> int) -> Lexbuf -val public SourceTextAsLexbuf: reportLibraryOnlyFeatures: bool * (LanguageFeature -> bool) * ISourceText -> Lexbuf +val public SourceTextAsLexbuf: reportLibraryOnlyFeatures: bool * (LanguageFeature -> bool) * (LanguageFeature -> range -> unit) * ISourceText -> Lexbuf /// Will not dispose of the stream reader. -val public StreamReaderAsLexbuf: reportLibraryOnlyFeatures: bool * (LanguageFeature -> bool) * StreamReader -> Lexbuf +val public StreamReaderAsLexbuf: reportLibraryOnlyFeatures: bool * (LanguageFeature -> bool) * (LanguageFeature -> range -> unit) * StreamReader -> Lexbuf diff --git a/src/fsharp/fsi/fsi.fs b/src/fsharp/fsi/fsi.fs index a85d82d90fb..7329224d5ad 100644 --- a/src/fsharp/fsi/fsi.fs +++ b/src/fsharp/fsi/fsi.fs @@ -2003,10 +2003,11 @@ type internal FsiStdinLexerProvider LightSyntaxStatus (initialLightSyntaxStatus, false (* no warnings *)) let isFeatureSupported featureId = tcConfigB.langVersion.SupportsFeature featureId + let checkLanguageFeatureErrorRecover = ErrorLogger.checkLanguageFeatureErrorRecover tcConfigB.langVersion let LexbufFromLineReader (fsiStdinSyphon: FsiStdinSyphon) readF = UnicodeLexing.FunctionAsLexbuf - (true, isFeatureSupported, (fun (buf: char[], start, len) -> + (true, isFeatureSupported, checkLanguageFeatureErrorRecover, (fun (buf: char[], start, len) -> //fprintf fsiConsoleOutput.Out "Calling ReadLine\n" let inputOption = try Some(readF()) with :? EndOfStreamException -> None inputOption |> Option.iter (fun t -> fsiStdinSyphon.Add (t + "\n")) @@ -2044,6 +2045,7 @@ type internal FsiStdinLexerProvider tokenizer let isFeatureSupported featureId = tcConfigB.langVersion.SupportsFeature featureId + let checkLanguageFeatureErrorRecover = ErrorLogger.checkLanguageFeatureErrorRecover tcConfigB.langVersion // Create a new lexer to read stdin member _.CreateStdinLexer (errorLogger) = @@ -2062,12 +2064,12 @@ type internal FsiStdinLexerProvider // Create a new lexer to read an "included" script file member _.CreateIncludedScriptLexer (sourceFileName, reader, errorLogger) = - let lexbuf = UnicodeLexing.StreamReaderAsLexbuf(true, isFeatureSupported, reader) + let lexbuf = UnicodeLexing.StreamReaderAsLexbuf(true, isFeatureSupported, checkLanguageFeatureErrorRecover, reader) CreateLexerForLexBuffer (sourceFileName, lexbuf, errorLogger) // Create a new lexer to read a string member this.CreateStringLexer (sourceFileName, source, errorLogger) = - let lexbuf = UnicodeLexing.StringAsLexbuf(true, isFeatureSupported, source) + let lexbuf = UnicodeLexing.StringAsLexbuf(true, isFeatureSupported, checkLanguageFeatureErrorRecover, source) CreateLexerForLexBuffer (sourceFileName, lexbuf, errorLogger) member _.ConsoleInput = fsiConsoleInput @@ -2126,6 +2128,7 @@ type internal FsiInteractionProcessor istate, CompletedWithReportedError e let isFeatureSupported featureId = tcConfigB.langVersion.SupportsFeature featureId + let checkLanguageFeatureErrorRecover = ErrorLogger.checkLanguageFeatureErrorRecover tcConfigB.langVersion let rangeStdin = rangeN Lexhelp.stdinMockFilename 0 @@ -2537,7 +2540,7 @@ type internal FsiInteractionProcessor use _unwind1 = ErrorLogger.PushThreadBuildPhaseUntilUnwind(ErrorLogger.BuildPhase.Interactive) use _unwind2 = ErrorLogger.PushErrorLoggerPhaseUntilUnwind(fun _ -> errorLogger) use _scope = SetCurrentUICultureForThread fsiOptions.FsiLCID - let lexbuf = UnicodeLexing.StringAsLexbuf(true, isFeatureSupported, sourceText) + let lexbuf = UnicodeLexing.StringAsLexbuf(true, isFeatureSupported, checkLanguageFeatureErrorRecover, sourceText) let tokenizer = fsiStdinLexerProvider.CreateBufferLexer(scriptFileName, lexbuf, errorLogger) currState |> InteractiveCatch errorLogger (fun istate -> @@ -2554,7 +2557,7 @@ type internal FsiInteractionProcessor use _unwind1 = ErrorLogger.PushThreadBuildPhaseUntilUnwind(ErrorLogger.BuildPhase.Interactive) use _unwind2 = ErrorLogger.PushErrorLoggerPhaseUntilUnwind(fun _ -> errorLogger) use _scope = SetCurrentUICultureForThread fsiOptions.FsiLCID - let lexbuf = UnicodeLexing.StringAsLexbuf(true, isFeatureSupported, sourceText) + let lexbuf = UnicodeLexing.StringAsLexbuf(true, isFeatureSupported, checkLanguageFeatureErrorRecover, sourceText) let tokenizer = fsiStdinLexerProvider.CreateBufferLexer(scriptFileName, lexbuf, errorLogger) currState |> InteractiveCatch errorLogger (fun istate -> diff --git a/src/fsharp/lex.fsl b/src/fsharp/lex.fsl index 40da3928359..409e766fd14 100644 --- a/src/fsharp/lex.fsl +++ b/src/fsharp/lex.fsl @@ -212,8 +212,8 @@ let shouldStartFile args lexbuf (m:range) err tok = if (m.StartColumn <> 0 || m.StartLine <> 1) then fail args lexbuf err tok else tok -let evalIfDefExpression startPos reportLibraryOnlyFeatures isFeatureSupported args (lookup:string->bool) (lexed:string) = - let lexbuf = LexBuffer.FromChars (reportLibraryOnlyFeatures, isFeatureSupported, lexed.ToCharArray ()) +let evalIfDefExpression startPos reportLibraryOnlyFeatures isFeatureSupported errorIfFeatureUnsupported args (lookup:string->bool) (lexed:string) = + let lexbuf = LexBuffer.FromChars (reportLibraryOnlyFeatures, isFeatureSupported, errorIfFeatureUnsupported, lexed.ToCharArray ()) lexbuf.StartPos <- startPos lexbuf.EndPos <- startPos let tokenStream = FSharp.Compiler.PPLexer.tokenstream args @@ -938,7 +938,7 @@ rule token args skip = parse { let m = lexbuf.LexemeRange let lookup id = List.contains id args.defines let lexed = lexeme lexbuf - let isTrue = evalIfDefExpression lexbuf.StartPos lexbuf.ReportLibraryOnlyFeatures lexbuf.SupportsFeature args lookup lexed + let isTrue = evalIfDefExpression lexbuf.StartPos lexbuf.ReportLibraryOnlyFeatures lexbuf.SupportsFeature lexbuf.CheckLanguageFeatureErrorRecover args lookup lexed args.ifdefStack <- (IfDefIf,m) :: args.ifdefStack // Get the token; make sure it starts at zero position & return diff --git a/src/fsharp/pars.fsy b/src/fsharp/pars.fsy index c40d81f511f..334e6d7409c 100644 --- a/src/fsharp/pars.fsy +++ b/src/fsharp/pars.fsy @@ -680,8 +680,10 @@ signatureFile: /* The start of a module declaration */ moduleIntro: - | moduleKeyword opt_access opt_rec path - { $3, $4.Lid, grabXmlDoc(parseState, 1), $2 } + | moduleKeyword opt_attributes opt_access opt_rec path + { if not (isNil $2) then + parseState.LexBuffer.CheckLanguageFeatureErrorRecover LanguageFeature.AttributesToRightOfModuleKeyword <| rhs parseState 4 + $4, $5.Lid, grabXmlDoc(parseState, 1), $3, $2 } /* The start of a namespace declaration */ @@ -726,16 +728,16 @@ fileNamespaceSpec: /* The single module declaration that can make up a signature file */ fileModuleSpec: - | opt_attributes opt_declVisibility moduleIntro moduleSpfnsPossiblyEmptyBlock + | opt_attributes opt_declVisibility moduleIntro moduleSpfnsPossiblyEmptyBlock { if Option.isSome $2 then errorR(Error(FSComp.SR.parsVisibilityDeclarationsShouldComePriorToIdentifier(), rhs parseState 2)) let m2 = rhs parseState 3 let mDeclsAndAttrs = (List.map (fun (a: SynAttributeList) -> a.Range) $1) @ (List.map (fun (d: SynModuleSigDecl) -> d.Range) $4) let m = (m2, mDeclsAndAttrs) ||> unionRangeWithListBy id - let isRec, path2, xml, vis = $3 + let isRec, path2, xml, vis, attribs2 = $3 (fun (isRec2, path, _) -> if not (isNil path) then errorR(Error(FSComp.SR.parsNamespaceOrModuleNotBoth(), m2)) let lid = path@path2 - ParsedSigFileFragment.NamedModule(SynModuleOrNamespaceSig(lid, (isRec || isRec2), SynModuleOrNamespaceKind.NamedModule, $4, xml, $1, vis, m))) } + ParsedSigFileFragment.NamedModule(SynModuleOrNamespaceSig(lid, (isRec || isRec2), SynModuleOrNamespaceKind.NamedModule, $4, xml, $1 @ attribs2, vis, m))) } | moduleSpfnsPossiblyEmptyBlock { let m = (rhs parseState 1) @@ -796,19 +798,20 @@ moduleSpfn: | opt_attributes opt_declVisibility moduleIntro colonOrEquals namedModuleAbbrevBlock { if Option.isSome $2 then errorR(Error(FSComp.SR.parsVisibilityDeclarationsShouldComePriorToIdentifier(), rhs parseState 2)) - let isRec, path, xml, vis = $3 + let isRec, path, xml, vis, attribs2 = $3 if isRec then raiseParseErrorAt (rhs parseState 3) (FSComp.SR.parsInvalidUseOfRec()) if not (isSingleton path) then raiseParseErrorAt (rhs parseState 3) (FSComp.SR.parsModuleAbbreviationMustBeSimpleName()) if not (isNil $1) then raiseParseErrorAt (rhs parseState 1) (FSComp.SR.parsIgnoreAttributesOnModuleAbbreviation()) + if not (isNil attribs2) then raiseParseErrorAt (rhs parseState 3) (FSComp.SR.parsIgnoreAttributesOnModuleAbbreviation()) match vis with | Some vis -> raiseParseErrorAt (rhs parseState 1) (FSComp.SR.parsIgnoreVisibilityOnModuleAbbreviationAlwaysPrivate(vis.ToString())) | _ -> SynModuleSigDecl.ModuleAbbrev(List.head path, $5, rhs2 parseState 1 5) } - | opt_attributes opt_declVisibility moduleIntro colonOrEquals moduleSpecBlock - { let isRec, path, xml, vis = $3 + | opt_attributes opt_declVisibility moduleIntro colonOrEquals moduleSpecBlock + { let isRec, path, xml, vis, attribs2 = $3 if not (isSingleton path) then raiseParseErrorAt (rhs parseState 3) (FSComp.SR.parsModuleDefnMustBeSimpleName()) if isRec then raiseParseErrorAt (rhs parseState 3) (FSComp.SR.parsInvalidUseOfRec()) - let info = SynComponentInfo($1, None, [], path, xml, false, vis, rhs parseState 3) + let info = SynComponentInfo($1 @ attribs2, None, [], path, xml, false, vis, rhs parseState 3) if Option.isSome $2 then errorR(Error(FSComp.SR.parsVisibilityDeclarationsShouldComePriorToIdentifier(), rhs parseState 2)) let m = (rhs2 parseState 1 4, $5) ||> unionRangeWithListBy (fun (d: SynModuleSigDecl) -> d.Range) SynModuleSigDecl.NestedModule(info, isRec, $5, m) } @@ -1167,11 +1170,11 @@ fileModuleImpl: let m2 = rhs parseState 3 let mDeclsAndAttrs = (List.map (fun (a: SynAttributeList) -> a.Range) $1) @ (List.map (fun (d: SynModuleDecl) -> d.Range) $4) let m = (m2, mDeclsAndAttrs) ||> unionRangeWithListBy id - let isRec2, path2, xml, vis = $3 + let isRec2, path2, xml, vis, attribs2 = $3 (fun (isRec, path, _) -> if not (isNil path) then errorR(Error(FSComp.SR.parsNamespaceOrModuleNotBoth(), m2)) let lid = path@path2 - ParsedImplFileFragment.NamedModule(SynModuleOrNamespace(lid, (isRec || isRec2), SynModuleOrNamespaceKind.NamedModule, $4, xml, $1, vis, m))) } + ParsedImplFileFragment.NamedModule(SynModuleOrNamespace(lid, (isRec || isRec2), SynModuleOrNamespaceKind.NamedModule, $4, xml, $1@attribs2, vis, m))) } | moduleDefnsOrExprPossiblyEmptyOrBlock { let m = (rhs parseState 1) @@ -1311,22 +1314,23 @@ moduleDefn: [ SynModuleDecl.Exception(ec, f) ] } /* 'module' definitions */ - | opt_attributes opt_declVisibility moduleIntro EQUALS namedModuleDefnBlock + | opt_attributes opt_declVisibility moduleIntro EQUALS namedModuleDefnBlock { if Option.isSome $2 then errorR(Error(FSComp.SR.parsVisibilityDeclarationsShouldComePriorToIdentifier(), rhs parseState 2)) - let attribs, (isRec, path, xml, vis) = $1, $3 - match $5 with + let attribs, (isRec, path, xml, vis, attribs2) = $1, $3 + match $5 with | Choice1Of2 eqn -> if Option.isSome $2 then errorR(Error(FSComp.SR.parsVisibilityDeclarationsShouldComePriorToIdentifier(), rhs parseState 2)) if isRec then raiseParseErrorAt (rhs parseState 3) (FSComp.SR.parsInvalidUseOfRec()) if not (isSingleton path) then raiseParseErrorAt (rhs parseState 3) (FSComp.SR.parsModuleAbbreviationMustBeSimpleName()) - if not (isNil $1) then raiseParseErrorAt (rhs parseState 1) (FSComp.SR.parsIgnoreAttributesOnModuleAbbreviation()) + if not (isNil attribs) then raiseParseErrorAt (rhs parseState 1) (FSComp.SR.parsIgnoreAttributesOnModuleAbbreviation()) + if not (isNil attribs2) then raiseParseErrorAt (rhs parseState 3) (FSComp.SR.parsIgnoreAttributesOnModuleAbbreviation()) match vis with | Some vis -> raiseParseErrorAt (rhs parseState 1) (FSComp.SR.parsIgnoreAttributesOnModuleAbbreviationAlwaysPrivate(vis.ToString())) - | _ -> () + | None -> () [ SynModuleDecl.ModuleAbbrev(List.head path, eqn, (rhs parseState 3, eqn) ||> unionRangeWithListBy (fun id -> id.idRange) ) ] | Choice2Of2 def -> if not (isSingleton path) then raiseParseErrorAt (rhs parseState 3) (FSComp.SR.parsModuleAbbreviationMustBeSimpleName()) - let info = SynComponentInfo(attribs, None, [], path, xml, false, vis, rhs parseState 3) + let info = SynComponentInfo(attribs @ attribs2, None, [], path, xml, false, vis, rhs parseState 3) [ SynModuleDecl.NestedModule(info, isRec, def, false, (rhs2 parseState 1 4, def) ||> unionRangeWithListBy (fun d -> d.Range) ) ] } /* unattached custom attributes */ @@ -2233,7 +2237,7 @@ tyconDefnOrSpfnSimpleRepr: if parseState.LexBuffer.ReportLibraryOnlyFeatures then libraryOnlyError lhsm if Option.isSome $2 then errorR(Error(FSComp.SR.parsInlineAssemblyCannotHaveVisibilityDeclarations(), rhs parseState 2)) let s, _ = $5 - let ilType = ParseAssemblyCodeType s parseState.LexBuffer.ReportLibraryOnlyFeatures parseState.LexBuffer.SupportsFeature (rhs parseState 5) + let ilType = ParseAssemblyCodeType s parseState.LexBuffer.ReportLibraryOnlyFeatures parseState.LexBuffer.SupportsFeature parseState.LexBuffer.CheckLanguageFeatureErrorRecover (rhs parseState 5) SynTypeDefnSimpleRepr.LibraryOnlyILAssembly (box ilType, lhsm) } @@ -4547,7 +4551,7 @@ inlineAssemblyExpr: { if parseState.LexBuffer.ReportLibraryOnlyFeatures then libraryOnlyWarning (lhs parseState) let (s, _), sm = $2, rhs parseState 2 (fun m -> - let ilInstrs = ParseAssemblyCodeInstructions s parseState.LexBuffer.ReportLibraryOnlyFeatures parseState.LexBuffer.SupportsFeature sm + let ilInstrs = ParseAssemblyCodeInstructions s parseState.LexBuffer.ReportLibraryOnlyFeatures parseState.LexBuffer.SupportsFeature parseState.LexBuffer.CheckLanguageFeatureErrorRecover sm SynExpr.LibraryOnlyILAssembly (box ilInstrs, $3, List.rev $4, $5, m)) } optCurriedArgExprs: diff --git a/src/fsharp/service/FSharpCheckerResults.fs b/src/fsharp/service/FSharpCheckerResults.fs index ecfbcedfb39..d7509fee975 100644 --- a/src/fsharp/service/FSharpCheckerResults.fs +++ b/src/fsharp/service/FSharpCheckerResults.fs @@ -1639,9 +1639,10 @@ module internal ParseAndCheckFile = // Public callers are unable to answer LanguageVersion feature support questions. // External Tools including the VS IDE will enable the default LanguageVersion let isFeatureSupported (_featureId:LanguageFeature) = true + let checkLanguageFeatureErrorRecover _featureId _range = () let createLexbuf sourceText = - UnicodeLexing.SourceTextAsLexbuf(true, isFeatureSupported, sourceText) + UnicodeLexing.SourceTextAsLexbuf(true, isFeatureSupported, checkLanguageFeatureErrorRecover, sourceText) let matchBraces(sourceText: ISourceText, fileName, options: FSharpParsingOptions, userOpName: string, suggestNamesForErrors: bool) = let delayedLogger = CapturingErrorLogger("matchBraces") diff --git a/src/fsharp/service/ServiceLexing.fs b/src/fsharp/service/ServiceLexing.fs index b0b66a6f35d..fb6e2370240 100644 --- a/src/fsharp/service/ServiceLexing.fs +++ b/src/fsharp/service/ServiceLexing.fs @@ -924,6 +924,7 @@ type FSharpSourceTokenizer(conditionalDefines: string list, filename: string opt // Public callers are unable to answer LanguageVersion feature support questions. // External Tools including the VS IDE will enable the default LanguageVersion let isFeatureSupported (_featureId:LanguageFeature) = true + let checkLanguageFeatureErrorRecover (_featureId:LanguageFeature) _range = () let reportLibraryOnlyFeatures = true let lexResourceManager = new Lexhelp.LexResourceManager() @@ -931,11 +932,11 @@ type FSharpSourceTokenizer(conditionalDefines: string list, filename: string opt let lexargs = mkLexargs(conditionalDefines, LightSyntaxStatus(true, false), lexResourceManager, [], DiscardErrorsLogger, PathMap.empty) member _.CreateLineTokenizer(lineText: string) = - let lexbuf = UnicodeLexing.StringAsLexbuf(reportLibraryOnlyFeatures, isFeatureSupported, lineText) + let lexbuf = UnicodeLexing.StringAsLexbuf(reportLibraryOnlyFeatures, isFeatureSupported, checkLanguageFeatureErrorRecover, lineText) FSharpLineTokenizer(lexbuf, Some lineText.Length, filename, lexargs) member _.CreateBufferTokenizer bufferFiller = - let lexbuf = UnicodeLexing.FunctionAsLexbuf(reportLibraryOnlyFeatures, isFeatureSupported, bufferFiller) + let lexbuf = UnicodeLexing.FunctionAsLexbuf(reportLibraryOnlyFeatures, isFeatureSupported, checkLanguageFeatureErrorRecover, bufferFiller) FSharpLineTokenizer(lexbuf, None, filename, lexargs) module FSharpKeywords = @@ -1514,14 +1515,14 @@ type FSharpToken = [] module FSharpLexerImpl = - let lexWithErrorLogger (text: ISourceText) conditionalCompilationDefines (flags: FSharpLexerFlags) reportLibraryOnlyFeatures supportsFeature errorLogger onToken pathMap (ct: CancellationToken) = + let lexWithErrorLogger (text: ISourceText) conditionalCompilationDefines (flags: FSharpLexerFlags) reportLibraryOnlyFeatures supportsFeature checkLanguageFeatureErrorRecover errorLogger onToken pathMap (ct: CancellationToken) = let canSkipTrivia = (flags &&& FSharpLexerFlags.SkipTrivia) = FSharpLexerFlags.SkipTrivia let isLightSyntaxOn = (flags &&& FSharpLexerFlags.LightSyntaxOn) = FSharpLexerFlags.LightSyntaxOn let isCompiling = (flags &&& FSharpLexerFlags.Compiling) = FSharpLexerFlags.Compiling let isCompilingFSharpCore = (flags &&& FSharpLexerFlags.CompilingFSharpCore) = FSharpLexerFlags.CompilingFSharpCore let canUseLexFilter = (flags &&& FSharpLexerFlags.UseLexFilter) = FSharpLexerFlags.UseLexFilter - let lexbuf = UnicodeLexing.SourceTextAsLexbuf(reportLibraryOnlyFeatures, supportsFeature, text) + let lexbuf = UnicodeLexing.SourceTextAsLexbuf(reportLibraryOnlyFeatures, supportsFeature, checkLanguageFeatureErrorRecover, text) let lightStatus = LightSyntaxStatus(isLightSyntaxOn, true) let lexargs = mkLexargs (conditionalCompilationDefines, lightStatus, Lexhelp.LexResourceManager(0), [], errorLogger, pathMap) let lexargs = { lexargs with applyLineDirectives = isCompiling } @@ -1543,22 +1544,23 @@ module FSharpLexerImpl = ct.ThrowIfCancellationRequested () onToken (getNextToken lexbuf) lexbuf.LexemeRange - let lex text conditionalCompilationDefines flags reportLibraryOnlyFeatures supportsFeature lexCallback pathMap ct = + let lex text conditionalCompilationDefines flags reportLibraryOnlyFeatures supportsFeature checkLanguageFeatureErrorRecover lexCallback pathMap ct = let errorLogger = CompilationErrorLogger("Lexer", FSharpDiagnosticOptions.Default) - lexWithErrorLogger text conditionalCompilationDefines flags reportLibraryOnlyFeatures supportsFeature errorLogger lexCallback pathMap ct + lexWithErrorLogger text conditionalCompilationDefines flags reportLibraryOnlyFeatures supportsFeature checkLanguageFeatureErrorRecover errorLogger lexCallback pathMap ct [] type FSharpLexer = static member Tokenize(text: ISourceText, tokenCallback, ?langVersion, ?filePath: string, ?conditionalCompilationDefines, ?flags, ?pathMap, ?ct) = - let langVersion = defaultArg langVersion "latestmajor" + let langVersion = defaultArg langVersion "latestmajor" |> LanguageVersion let flags = defaultArg flags FSharpLexerFlags.Default ignore filePath // can be removed at later point let conditionalCompilationDefines = defaultArg conditionalCompilationDefines [] let pathMap = defaultArg pathMap Map.Empty let ct = defaultArg ct CancellationToken.None - let supportsFeature = (LanguageVersion langVersion).SupportsFeature + let supportsFeature = langVersion.SupportsFeature + let checkLanguageFeatureErrorRecover = ErrorLogger.checkLanguageFeatureErrorRecover langVersion let pathMap = (PathMap.empty, pathMap) @@ -1571,4 +1573,4 @@ type FSharpLexer = | _ -> tokenCallback fsTok let reportLibraryOnlyFeatures = true - lex text conditionalCompilationDefines flags reportLibraryOnlyFeatures supportsFeature onToken pathMap ct + lex text conditionalCompilationDefines flags reportLibraryOnlyFeatures supportsFeature checkLanguageFeatureErrorRecover onToken pathMap ct diff --git a/src/fsharp/utils/prim-lexing.fs b/src/fsharp/utils/prim-lexing.fs index f5d4edee585..fdb0cf56ff6 100644 --- a/src/fsharp/utils/prim-lexing.fs +++ b/src/fsharp/utils/prim-lexing.fs @@ -177,7 +177,7 @@ namespace Internal.Utilities.Text.Lexing type internal LexBufferFiller<'Char> = (LexBuffer<'Char> -> unit) and [] - internal LexBuffer<'Char>(filler: LexBufferFiller<'Char>, reportLibraryOnlyFeatures: bool, supportsFeature:LanguageFeature -> bool) = + internal LexBuffer<'Char>(filler: LexBufferFiller<'Char>, reportLibraryOnlyFeatures: bool, supportsFeature:LanguageFeature -> bool, checkLanguageFeatureErrorRecover:LanguageFeature -> range -> unit) = let context = new Dictionary(1) let mutable buffer = [||] /// number of valid characters beyond bufferScanStart. @@ -249,34 +249,36 @@ namespace Internal.Utilities.Text.Lexing member _.ReportLibraryOnlyFeatures = reportLibraryOnlyFeatures member _.SupportsFeature featureId = supportsFeature featureId + member _.CheckLanguageFeatureErrorRecover featureId range = checkLanguageFeatureErrorRecover featureId range - static member FromFunction (reportLibraryOnlyFeatures, supportsFeature:LanguageFeature -> bool, f : 'Char[] * int * int -> int) : LexBuffer<'Char> = + static member FromFunction (reportLibraryOnlyFeatures, supportsFeature:LanguageFeature -> bool, checkLanguageFeatureErrorRecover, f : 'Char[] * int * int -> int) : LexBuffer<'Char> = let extension= Array.zeroCreate 4096 let filler (lexBuffer: LexBuffer<'Char>) = let n = f (extension,0,extension.Length) lexBuffer.EnsureBufferSize n Array.blit extension 0 lexBuffer.Buffer lexBuffer.BufferScanPos n lexBuffer.BufferMaxScanLength <- lexBuffer.BufferScanLength + n - new LexBuffer<'Char>(filler, reportLibraryOnlyFeatures, supportsFeature) + new LexBuffer<'Char>(filler, reportLibraryOnlyFeatures, supportsFeature, checkLanguageFeatureErrorRecover) // Important: This method takes ownership of the array - static member FromArrayNoCopy (reportLibraryOnlyFeatures, supportsFeature:LanguageFeature -> bool, buffer: 'Char[]) : LexBuffer<'Char> = - let lexBuffer = new LexBuffer<'Char>((fun _ -> ()), reportLibraryOnlyFeatures, supportsFeature) + static member FromArrayNoCopy (reportLibraryOnlyFeatures, supportsFeature:LanguageFeature -> bool, checkLanguageFeatureErrorRecover, buffer: 'Char[]) : LexBuffer<'Char> = + let lexBuffer = new LexBuffer<'Char>((fun _ -> ()), reportLibraryOnlyFeatures, supportsFeature, checkLanguageFeatureErrorRecover) lexBuffer.Buffer <- buffer lexBuffer.BufferMaxScanLength <- buffer.Length lexBuffer // Important: this method does copy the array - static member FromArray (reportLibraryOnlyFeatures, supportsFeature: LanguageFeature -> bool, s: 'Char[]) : LexBuffer<'Char> = + static member FromArray (reportLibraryOnlyFeatures, supportsFeature: LanguageFeature -> bool, checkLanguageFeatureErrorRecover, s: 'Char[]) : LexBuffer<'Char> = let buffer = Array.copy s - LexBuffer<'Char>.FromArrayNoCopy(reportLibraryOnlyFeatures, supportsFeature, buffer) + LexBuffer<'Char>.FromArrayNoCopy(reportLibraryOnlyFeatures, supportsFeature, checkLanguageFeatureErrorRecover, buffer) // Important: This method takes ownership of the array - static member FromChars (reportLibraryOnlyFeatures, supportsFeature:LanguageFeature -> bool, arr:char[]) = LexBuffer.FromArrayNoCopy (reportLibraryOnlyFeatures, supportsFeature, arr) + static member FromChars (reportLibraryOnlyFeatures, supportsFeature:LanguageFeature -> bool, checkLanguageFeatureErrorRecover, arr:char[]) = + LexBuffer.FromArrayNoCopy (reportLibraryOnlyFeatures, supportsFeature, checkLanguageFeatureErrorRecover, arr) - static member FromSourceText (reportLibraryOnlyFeatures, supportsFeature: LanguageFeature -> bool, sourceText: ISourceText) = + static member FromSourceText (reportLibraryOnlyFeatures, supportsFeature: LanguageFeature -> bool, checkLanguageFeatureErrorRecover, sourceText: ISourceText) = let mutable currentSourceIndex = 0 - LexBuffer.FromFunction(reportLibraryOnlyFeatures, supportsFeature, fun (chars, start, length) -> + LexBuffer.FromFunction(reportLibraryOnlyFeatures, supportsFeature, checkLanguageFeatureErrorRecover, fun (chars, start, length) -> let lengthToCopy = if currentSourceIndex + length <= sourceText.Length then length diff --git a/src/fsharp/utils/prim-lexing.fsi b/src/fsharp/utils/prim-lexing.fsi index d8023a76f6d..d3088aa4cc4 100644 --- a/src/fsharp/utils/prim-lexing.fsi +++ b/src/fsharp/utils/prim-lexing.fsi @@ -127,18 +127,21 @@ type internal LexBuffer<'Char> = /// Determines if the parser can report FSharpCore library-only features. member ReportLibraryOnlyFeatures: bool - /// True if the refill of the buffer ever failed , or if explicitly set to True. - member SupportsFeature:LanguageFeature -> bool + /// True if the specified language feature is supported. + member SupportsFeature: LanguageFeature -> bool + + /// Logs a recoverable error if a language feature is unsupported, at the specified range. + member CheckLanguageFeatureErrorRecover: LanguageFeature -> range -> unit /// Create a lex buffer suitable for Unicode lexing that reads characters from the given array. /// Important: does take ownership of the array. - static member FromChars: reportLibraryOnlyFeatures: bool * (LanguageFeature -> bool) * char[] -> LexBuffer + static member FromChars: reportLibraryOnlyFeatures: bool * (LanguageFeature -> bool) * (LanguageFeature -> range -> unit) * char[] -> LexBuffer /// Create a lex buffer that reads character or byte inputs by using the given function. - static member FromFunction: reportLibraryOnlyFeatures: bool * (LanguageFeature -> bool) * ('Char[] * int * int -> int) -> LexBuffer<'Char> + static member FromFunction: reportLibraryOnlyFeatures: bool * (LanguageFeature -> bool) * (LanguageFeature -> range -> unit) * ('Char[] * int * int -> int) -> LexBuffer<'Char> /// Create a lex buffer backed by source text. - static member FromSourceText: reportLibraryOnlyFeatures: bool * (LanguageFeature -> bool) * ISourceText -> LexBuffer + static member FromSourceText: reportLibraryOnlyFeatures: bool * (LanguageFeature -> bool) * (LanguageFeature -> range -> unit) * ISourceText -> LexBuffer /// The type of tables for an unicode lexer generated by fslex.exe. [] diff --git a/src/fsharp/xlf/FSComp.txt.cs.xlf b/src/fsharp/xlf/FSComp.txt.cs.xlf index 53b1f65d08f..8d72673512f 100644 --- a/src/fsharp/xlf/FSComp.txt.cs.xlf +++ b/src/fsharp/xlf/FSComp.txt.cs.xlf @@ -92,6 +92,11 @@ aplikativní výpočetní výrazy + + attributes to the right of the 'module' keyword + attributes to the right of the 'module' keyword + + default interface member consumption využití člena výchozího rozhraní diff --git a/src/fsharp/xlf/FSComp.txt.de.xlf b/src/fsharp/xlf/FSComp.txt.de.xlf index 777d8c594b5..8a093810da2 100644 --- a/src/fsharp/xlf/FSComp.txt.de.xlf +++ b/src/fsharp/xlf/FSComp.txt.de.xlf @@ -92,6 +92,11 @@ applikative Berechnungsausdrücke + + attributes to the right of the 'module' keyword + attributes to the right of the 'module' keyword + + default interface member consumption standardmäßige Schnittstellenmembernutzung diff --git a/src/fsharp/xlf/FSComp.txt.es.xlf b/src/fsharp/xlf/FSComp.txt.es.xlf index ea47b7e40a3..4e29a4e6c8a 100644 --- a/src/fsharp/xlf/FSComp.txt.es.xlf +++ b/src/fsharp/xlf/FSComp.txt.es.xlf @@ -92,6 +92,11 @@ expresiones de cálculo aplicativas + + attributes to the right of the 'module' keyword + attributes to the right of the 'module' keyword + + default interface member consumption consumo de miembros de interfaz predeterminados diff --git a/src/fsharp/xlf/FSComp.txt.fr.xlf b/src/fsharp/xlf/FSComp.txt.fr.xlf index 0526f8c7fa3..8aa67acfba2 100644 --- a/src/fsharp/xlf/FSComp.txt.fr.xlf +++ b/src/fsharp/xlf/FSComp.txt.fr.xlf @@ -92,6 +92,11 @@ expressions de calcul applicatives + + attributes to the right of the 'module' keyword + attributes to the right of the 'module' keyword + + default interface member consumption consommation par défaut des membres d'interface diff --git a/src/fsharp/xlf/FSComp.txt.it.xlf b/src/fsharp/xlf/FSComp.txt.it.xlf index 3d2019925fd..a7a5694e5dc 100644 --- a/src/fsharp/xlf/FSComp.txt.it.xlf +++ b/src/fsharp/xlf/FSComp.txt.it.xlf @@ -92,6 +92,11 @@ espressioni di calcolo applicativo + + attributes to the right of the 'module' keyword + attributes to the right of the 'module' keyword + + default interface member consumption utilizzo predefinito dei membri di interfaccia diff --git a/src/fsharp/xlf/FSComp.txt.ja.xlf b/src/fsharp/xlf/FSComp.txt.ja.xlf index 753e38d1b3a..c0cd41337b5 100644 --- a/src/fsharp/xlf/FSComp.txt.ja.xlf +++ b/src/fsharp/xlf/FSComp.txt.ja.xlf @@ -92,6 +92,11 @@ 適用できる計算式 + + attributes to the right of the 'module' keyword + attributes to the right of the 'module' keyword + + default interface member consumption 既定のインターフェイス メンバーの消費 diff --git a/src/fsharp/xlf/FSComp.txt.ko.xlf b/src/fsharp/xlf/FSComp.txt.ko.xlf index 52f54536e9b..b98ec0679e6 100644 --- a/src/fsharp/xlf/FSComp.txt.ko.xlf +++ b/src/fsharp/xlf/FSComp.txt.ko.xlf @@ -92,6 +92,11 @@ 적용 가능한 계산 식 + + attributes to the right of the 'module' keyword + attributes to the right of the 'module' keyword + + default interface member consumption 기본 인터페이스 멤버 사용 diff --git a/src/fsharp/xlf/FSComp.txt.pl.xlf b/src/fsharp/xlf/FSComp.txt.pl.xlf index c4626b4d85f..ed66a7e0e44 100644 --- a/src/fsharp/xlf/FSComp.txt.pl.xlf +++ b/src/fsharp/xlf/FSComp.txt.pl.xlf @@ -92,6 +92,11 @@ praktyczne wyrażenia obliczeniowe + + attributes to the right of the 'module' keyword + attributes to the right of the 'module' keyword + + default interface member consumption domyślne użycie składowej interfejsu diff --git a/src/fsharp/xlf/FSComp.txt.pt-BR.xlf b/src/fsharp/xlf/FSComp.txt.pt-BR.xlf index ca61d6606f5..d093db2ebae 100644 --- a/src/fsharp/xlf/FSComp.txt.pt-BR.xlf +++ b/src/fsharp/xlf/FSComp.txt.pt-BR.xlf @@ -92,6 +92,11 @@ expressões de computação aplicáveis + + attributes to the right of the 'module' keyword + attributes to the right of the 'module' keyword + + default interface member consumption consumo de membro da interface padrão diff --git a/src/fsharp/xlf/FSComp.txt.ru.xlf b/src/fsharp/xlf/FSComp.txt.ru.xlf index b9cae3afe6e..7bc5ffe2994 100644 --- a/src/fsharp/xlf/FSComp.txt.ru.xlf +++ b/src/fsharp/xlf/FSComp.txt.ru.xlf @@ -92,6 +92,11 @@ применимые вычислительные выражения + + attributes to the right of the 'module' keyword + attributes to the right of the 'module' keyword + + default interface member consumption использование элемента интерфейса по умолчанию diff --git a/src/fsharp/xlf/FSComp.txt.tr.xlf b/src/fsharp/xlf/FSComp.txt.tr.xlf index ce431d8f0c6..6c6d0998d39 100644 --- a/src/fsharp/xlf/FSComp.txt.tr.xlf +++ b/src/fsharp/xlf/FSComp.txt.tr.xlf @@ -92,6 +92,11 @@ uygulama hesaplama ifadeleri + + attributes to the right of the 'module' keyword + attributes to the right of the 'module' keyword + + default interface member consumption varsayılan arabirim üyesi tüketimi diff --git a/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf b/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf index e05baadc867..783834718ef 100644 --- a/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf @@ -92,6 +92,11 @@ 适用的计算表达式 + + attributes to the right of the 'module' keyword + attributes to the right of the 'module' keyword + + default interface member consumption 默认接口成员消耗 diff --git a/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf b/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf index 6bf3879256a..5facb9ddf4d 100644 --- a/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf @@ -92,6 +92,11 @@ 適用的計算運算式 + + attributes to the right of the 'module' keyword + attributes to the right of the 'module' keyword + + default interface member consumption 預設介面成員使用 diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/ModuleAbbreviationTests.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/ModuleAbbreviationTests.fs deleted file mode 100644 index 932fde27aa0..00000000000 --- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/ModuleAbbreviationTests.fs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. - -namespace FSharp.Compiler.ComponentTests.ErrorMessages - -open Xunit -open FSharp.Test.Utilities.Compiler - - -module ``Module Abbreviations`` = - - [] - let ``Public Module Abbreviation``() = - FSharp "module public L1 = List" - |> typecheck - |> shouldFail - |> withSingleDiagnostic (Error 536, Line 1, Col 1, Line 1, Col 7, - "The 'Public' accessibility attribute is not allowed on module abbreviation. Module abbreviations are always private.") diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/ModuleTests.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/ModuleTests.fs new file mode 100644 index 00000000000..f96f59a9ce2 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/ModuleTests.fs @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace FSharp.Compiler.ComponentTests.ErrorMessages + +open Xunit +open FSharp.Test.Utilities.Compiler + + +module Modules = + + [] + let ``Public Module Abbreviation``() = + FSharp "module public L1 = List" + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Error 536, Line 1, Col 1, Line 1, Col 7, + "The 'Public' accessibility attribute is not allowed on module abbreviation. Module abbreviations are always private.") + + [] + let ``Private Module Abbreviation``() = + FSharp "module private L1 = List" + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Error 536, Line 1, Col 1, Line 1, Col 7, + "The 'Private' accessibility attribute is not allowed on module abbreviation. Module abbreviations are always private.") + + [] + let ``Internal Module Abbreviation``() = + FSharp "module internal L1 = List" + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Error 536, Line 1, Col 1, Line 1, Col 7, + "The 'Internal' accessibility attribute is not allowed on module abbreviation. Module abbreviations are always private.") + [] + let ``Rec Module Abbreviation``() = + FSharp "module rec L1 = List" + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Error 3203, Line 1, Col 1, Line 1, Col 14, + "Invalid use of 'rec' keyword") + + [] + let ``Left Attribute Module Abbreviation``() = + FSharp """[] module L1 = List""" + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Error 535, Line 1, Col 1, Line 1, Col 32, + "Ignoring attributes on module abbreviation") + + [] + let ``Right Attribute Module Abbreviation``() = + FSharp """module [] L1 = List""" + |> withLangVersionPreview + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Error 535, Line 1, Col 1, Line 1, Col 35, + "Ignoring attributes on module abbreviation") + + [] + let ``Right Attribute Module Abbreviation without preview (typecheck)``() = + FSharp """module [] L1 = List""" + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Error 535, Line 1, Col 1, Line 1, Col 35, + "Ignoring attributes on module abbreviation") + [] + let ``Right Attribute Module Abbreviation without preview (compile)``() = + FSharp """module [] L1 = List""" + |> compile + |> shouldFail + |> withDiagnostics [ + Error 3350, Line 1, Col 33, Line 1, Col 35, "Feature 'attributes to the right of the 'module' keyword' is not available in F# 5.0. Please use language version 'preview' or greater." + Error 535, Line 1, Col 1, Line 1, Col 35, "Ignoring attributes on module abbreviation" + Error 222, Line 1, Col 1, Line 1, Col 42, "Files in libraries or multiple-file applications must begin with a namespace or module declaration, e.g. 'namespace SomeNamespace.SubNamespace' or 'module SomeNamespace.SomeModule'. Only the last source file of an application may omit such a declaration." + ] + + [] + let ``Attribute Module Abbreviation``() = + FSharp """[] module [] internal L1 = List""" + |> withLangVersionPreview + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Error 535, Line 1, Col 1, Line 1, Col 32, + "Ignoring attributes on module abbreviation") + + [] + let ``Attributes applied successfully``() = + Fsx """ +[] module [] rec L1 = type L2() = do () +match typeof.DeclaringType.GetCustomAttributes false with +| [|:? AutoOpenAttribute; :? ExperimentalAttribute as experimental; :? CompilationMappingAttribute as compilationMapping|] -> + if compilationMapping.SourceConstructFlags <> SourceConstructFlags.Module then failwithf "CompilationMapping attribute did not contain the correct SourceConstructFlags: %A" compilationMapping.SourceConstructFlags + if experimental.Message <> "Hello" then failwithf "Experimental attribute did not contain the correct message: %s" experimental.Message +| t -> failwithf "Attribute array is not of length 3 and correct types: %A" t + """ + |> withLangVersionPreview + |> compileExeAndRun + |> shouldSucceed + [] + let ``Attributes applied successfully 2``() = + Fsx """ +open System +open System.ComponentModel +[] [] module [][] private rec L1 = type L2() = do () +match typeof.DeclaringType.GetCustomAttributes false with +| [|:? ObsoleteAttribute as obsolete + :? BrowsableAttribute as browsable + :? BindableAttribute as bindable + :? AmbientValueAttribute as ambientValue + :? ExperimentalAttribute as experimental + :? CategoryAttribute as category + :? DefaultValueAttribute as defaultValue + :? AutoOpenAttribute + :? CompilationMappingAttribute as compilationMapping|] -> + if obsolete.Message <> "Hi" then failwithf "Obsolete attribute did not contain the correct message: %s" obsolete.Message + if browsable.Browsable <> false then failwithf "Browsable attribute did not contain the correct flag: %b" browsable.Browsable + if bindable.Bindable <> true then failwithf "Bindable attribute did not contain the correct flag: %b" bindable.Bindable + if ambientValue.Value <> box false then failwithf "AmbientValue attribute did not contain the correct value: %O" ambientValue.Value + if experimental.Message <> "Hello" then failwithf "Experimental attribute did not contain the correct message: %s" experimental.Message + if category.Category <> "Oi" then failwithf "Category attribute did not contain the correct category: %s" category.Category + if defaultValue.Value <> box "Howdy" then failwithf "DefaultValue attribute did not contain the correct value: %O" defaultValue.Value + if compilationMapping.SourceConstructFlags <> SourceConstructFlags.Module then failwithf "CompilationMapping attribute did not contain the correct SourceConstructFlags: %O" compilationMapping.SourceConstructFlags +| t -> failwithf "Attribute array is not of length 9 and correct types: %A" t + """ + |> withLangVersionPreview + |> compileExeAndRun + |> shouldSucceed + [] + let ``Fun attribute indentation``() = + Fsx """ +open System +open System.ComponentModel +[][] module + [] + [] + private + rec + L1 + = + type + [] + [] + L2 + () + = + let + [] + [] + a + = + 1 + member _.A = a +match typeof.DeclaringType.GetCustomAttributes false with +| [|:? ObsoleteAttribute as obsolete + :? BrowsableAttribute as browsable + :? BindableAttribute as bindable + :? AmbientValueAttribute as ambientValue + :? ExperimentalAttribute as experimental + :? CategoryAttribute as category + :? DefaultValueAttribute as defaultValue + :? AutoOpenAttribute + :? CompilationMappingAttribute as compilationMapping|] -> + if obsolete.Message <> "Hi" then failwithf "Obsolete attribute did not contain the correct message: %s" obsolete.Message + if browsable.Browsable <> false then failwithf "Browsable attribute did not contain the correct flag: %b" browsable.Browsable + if bindable.Bindable <> true then failwithf "Bindable attribute did not contain the correct flag: %b" bindable.Bindable + if ambientValue.Value <> box false then failwithf "AmbientValue attribute did not contain the correct value: %O" ambientValue.Value + if experimental.Message <> "Hello" then failwithf "Experimental attribute did not contain the correct message: %s" experimental.Message + if category.Category <> "Oi" then failwithf "Category attribute did not contain the correct category: %s" category.Category + if defaultValue.Value <> box "Howdy" then failwithf "DefaultValue attribute did not contain the correct value: %O" defaultValue.Value + if compilationMapping.SourceConstructFlags <> SourceConstructFlags.Module then failwithf "CompilationMapping attribute did not contain the correct SourceConstructFlags: %O" compilationMapping.SourceConstructFlags +| t -> failwithf "Attribute array is not of length 9 and correct types: %A" t + """ + |> withLangVersionPreview + |> compileExeAndRun + |> shouldSucceed + + [] + let ``Offside rule works for attributes inside module declarations``() = + Fsx """ +module [< +AutoOpen>] L1 = do () + """ + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Error 10, Line 3, Col 1, Line 3, Col 9, + "Unexpected start of structured construct in attribute list") + [] + let ``Offside rule works for attributes inside module declarations without preview``() = + Fsx """ +module [< +AutoOpen>] L1 = do () + """ + |> compile + |> shouldFail + |> withDiagnostics [ + Error 10, Line 3, Col 1, Line 3, Col 9, "Unexpected start of structured construct in attribute list" + Error 3350, Line 3, Col 1, Line 3, Col 9, "Feature 'attributes to the right of the 'module' keyword' is not available in F# 5.0. Please use language version 'preview' or greater." + ] \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj index 1fe759318ef..e4ec28b52a9 100644 --- a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj +++ b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj @@ -37,7 +37,7 @@ - + diff --git a/tests/FSharp.Compiler.UnitTests/HashIfExpression.fs b/tests/FSharp.Compiler.UnitTests/HashIfExpression.fs index 201c3291902..039b1c53350 100644 --- a/tests/FSharp.Compiler.UnitTests/HashIfExpression.fs +++ b/tests/FSharp.Compiler.UnitTests/HashIfExpression.fs @@ -70,7 +70,8 @@ type public HashIfExpression() = let parser (s : string) = let isFeatureSupported (_featureId:LanguageFeature) = true - let lexbuf = LexBuffer.FromChars (true, isFeatureSupported, s.ToCharArray ()) + let checkLanguageFeatureErrorRecover _featureId _range = () + let lexbuf = LexBuffer.FromChars (true, isFeatureSupported, checkLanguageFeatureErrorRecover, s.ToCharArray ()) lexbuf.StartPos <- startPos lexbuf.EndPos <- startPos let tokenStream = PPLexer.tokenstream args diff --git a/tests/FSharp.Test.Utilities/Compiler.fs b/tests/FSharp.Test.Utilities/Compiler.fs index 153904e1636..f5f91523128 100644 --- a/tests/FSharp.Test.Utilities/Compiler.fs +++ b/tests/FSharp.Test.Utilities/Compiler.fs @@ -442,10 +442,10 @@ module rec Compiler = let run (result: TestResult) : TestResult = match result with - | Failure f -> failwith (sprintf "Compilation should be successfull in order to run.\n Errors: %A" (f.Diagnostics)) + | Failure f -> failwith (sprintf "Compilation should be successful in order to run.\n Errors: %A" (f.Diagnostics)) | Success s -> match s.OutputPath with - | None -> failwith "Compilation didn't produce any output. Unable to run. (did you forget to set output type to Exe?)" + | None -> failwith "Compilation didn't produce any output. Unable to run. (Did you forget to set output type to Exe?)" | Some p -> let (exitCode, output, errors) = CompilerAssert.ExecuteAndReturnResult (p, s.Dependencies, false) let executionResult = { s with Output = Some (ExecutionOutput { ExitCode = exitCode; StdOut = output; StdErr = errors }) } From 698f1c1e39ea688484dc995b4c2d42566fd1558e Mon Sep 17 00:00:00 2001 From: dotnet bot Date: Tue, 29 Jun 2021 10:40:08 -0700 Subject: [PATCH 31/42] Localized file check-in by OneLocBuild Task (#11747) From 76911eb95131108f220d03b017ebd24ecbc50623 Mon Sep 17 00:00:00 2001 From: Will Smith Date: Tue, 29 Jun 2021 12:03:42 -0700 Subject: [PATCH 32/42] Added script reference test and clearing check file caches on re-created incremental build (#11731) * Added script referencing dll test in WorkspaceTests, but failing * Clear check file caches associated with a re-created incremental build * Minor comment update * Minor comment update * Forgot to delete dll in test * Remove ignore * Using defaultTimeStamp instead of DateTime.MinValue * Added FCS test * Minor update --- src/fsharp/service/IncrementalBuild.fs | 16 +- src/fsharp/service/service.fs | 49 +-- .../Compiler/Service/MultiProjectTests.fs | 116 +++++++ .../LanguageService/SingleFileWorkspaceMap.fs | 78 ++++- .../UnitTests/Workspace/WorkspaceTests.fs | 319 ++++++++++++++---- 5 files changed, 481 insertions(+), 97 deletions(-) diff --git a/src/fsharp/service/IncrementalBuild.fs b/src/fsharp/service/IncrementalBuild.fs index ddcfefd2a5a..828c553e4e9 100644 --- a/src/fsharp/service/IncrementalBuild.fs +++ b/src/fsharp/service/IncrementalBuild.fs @@ -729,13 +729,12 @@ type IncrementalBuilder( #if !NO_EXTENSIONTYPING importsInvalidatedByTypeProvider: Event, #endif - allDependencies) = + allDependencies, + defaultTimeStamp: DateTime) = let fileParsed = new Event() let projectChecked = new Event() - let defaultTimeStamp = DateTime.UtcNow - let mutable isImportsInvalidated = false #if !NO_EXTENSIONTYPING @@ -1075,7 +1074,7 @@ type IncrementalBuilder( let tryGetBeforeSlot (state: IncrementalBuilderState) slot = match slot with | 0 (* first file *) -> - (initialBoundModel, DateTime.MinValue) + (initialBoundModel, defaultTimeStamp) |> Some | _ -> tryGetSlot state (slot - 1) @@ -1083,7 +1082,7 @@ type IncrementalBuilder( let evalUpToTargetSlot (state: IncrementalBuilderState) targetSlot = node { if targetSlot < 0 then - return Some(initialBoundModel, DateTime.MinValue) + return Some(initialBoundModel, defaultTimeStamp) else let! boundModel = state.boundModels.[targetSlot].GetOrComputeValue() return Some(boundModel, state.stampedFileNames.[targetSlot]) @@ -1091,7 +1090,7 @@ type IncrementalBuilder( let MaxTimeStampInDependencies stamps = if Seq.isEmpty stamps then - DateTime.MinValue + defaultTimeStamp else stamps |> Seq.max @@ -1500,6 +1499,8 @@ type IncrementalBuilder( | None -> new DependencyProvider() | Some dependencyProvider -> dependencyProvider + let defaultTimeStamp = DateTime.UtcNow + let! initialBoundModel = CombineImportedAssembliesTask( assemblyName, @@ -1539,7 +1540,8 @@ type IncrementalBuilder( #if !NO_EXTENSIONTYPING importsInvalidatedByTypeProvider, #endif - allDependencies) + allDependencies, + defaultTimeStamp) return Some builder with e -> errorRecoveryNoRange e diff --git a/src/fsharp/service/service.fs b/src/fsharp/service/service.fs index 1ed29a76651..501ad1c4b02 100644 --- a/src/fsharp/service/service.fs +++ b/src/fsharp/service/service.fs @@ -334,6 +334,25 @@ type BackgroundCompiler( return (builderOpt, diagnostics) } + let parseCacheLock = Lock() + + // STATIC ROOT: FSharpLanguageServiceTestable.FSharpChecker.parseFileInProjectCache. Most recently used cache for parsing files. + let parseFileCache = MruCache(parseFileCacheSize, areSimilar = AreSimilarForParsing, areSame = AreSameForParsing) + + // STATIC ROOT: FSharpLanguageServiceTestable.FSharpChecker.checkFileInProjectCache + // + /// Cache which holds recently seen type-checks. + /// This cache may hold out-of-date entries, in two senses + /// - there may be a more recent antecedent state available because the background build has made it available + /// - the source for the file may have changed + + // Also keyed on source. This can only be out of date if the antecedent is out of date + let checkFileInProjectCache = + MruCache> + (keepStrongly=checkFileInProjectCacheSize, + areSame=AreSameForChecking3, + areSimilar=AreSubsumable3) + // STATIC ROOT: FSharpLanguageServiceTestable.FSharpChecker.backgroundCompiler.incrementalBuildersCache. This root typically holds more // live information than anything else in the F# Language Service, since it holds up to 3 (projectCacheStrongSize) background project builds // strongly. @@ -388,6 +407,17 @@ type BackgroundCompiler( Logger.Log LogCompilerFunctionId.Service_IncrementalBuildersCache_GettingCache return builderOpt,creationDiags | _ -> + // The builder could be re-created, + // clear the check file caches that are associated with it. + // We must do this in order to not return stale results when references + // in the project get changed/added/removed. + parseCacheLock.AcquireLock(fun ltok -> + options.SourceFiles + |> Array.iter (fun sourceFile -> + let key = (sourceFile, 0L, options) + checkFileInProjectCache.RemoveAnySimilar(ltok, key) + ) + ) return! createAndGetBuilder (options, userOpName) } | _ -> @@ -413,25 +443,6 @@ type BackgroundCompiler( | _ -> getOrCreateBuilder (options, userOpName) - let parseCacheLock = Lock() - - // STATIC ROOT: FSharpLanguageServiceTestable.FSharpChecker.parseFileInProjectCache. Most recently used cache for parsing files. - let parseFileCache = MruCache(parseFileCacheSize, areSimilar = AreSimilarForParsing, areSame = AreSameForParsing) - - // STATIC ROOT: FSharpLanguageServiceTestable.FSharpChecker.checkFileInProjectCache - // - /// Cache which holds recently seen type-checks. - /// This cache may hold out-of-date entries, in two senses - /// - there may be a more recent antecedent state available because the background build has made it available - /// - the source for the file may have changed - - // Also keyed on source. This can only be out of date if the antecedent is out of date - let checkFileInProjectCache = - MruCache> - (keepStrongly=checkFileInProjectCacheSize, - areSame=AreSameForChecking3, - areSimilar=AreSubsumable3) - /// Should be a fast operation. Ensures that we have only one async lazy object per file and its hash. let getCheckFileNode (parseResults, sourceText, diff --git a/tests/fsharp/Compiler/Service/MultiProjectTests.fs b/tests/fsharp/Compiler/Service/MultiProjectTests.fs index 6b4bedc74f0..9f0bc331786 100644 --- a/tests/fsharp/Compiler/Service/MultiProjectTests.fs +++ b/tests/fsharp/Compiler/Service/MultiProjectTests.fs @@ -72,6 +72,54 @@ let test() = Assert.shouldBeEmpty(checkResults.Diagnostics) WeakReference(ms) + let compileFileAsDll (checker: FSharpChecker) filePath outputFilePath = + try + let result, _ = + checker.Compile([|"fsc.dll";filePath;$"-o:{ outputFilePath }";"--deterministic+";"--optimize+";"--target:library"|]) + |> Async.RunSynchronously + + if result.Length > 0 then + failwith "Compilation has errors." + with + | _ -> + try File.Delete(outputFilePath) with | _ -> () + reraise() + + let createOnDisk src = + let tmpFilePath = Path.GetTempFileName() + let tmpRealFilePath = Path.ChangeExtension(tmpFilePath, ".fs") + try File.Delete(tmpFilePath) with | _ -> () + File.WriteAllText(tmpRealFilePath, src) + tmpRealFilePath + + let createOnDiskCompiledAsDll checker src = + let tmpFilePath = Path.GetTempFileName() + let tmpRealFilePath = Path.ChangeExtension(tmpFilePath, ".fs") + try File.Delete(tmpFilePath) with | _ -> () + File.WriteAllText(tmpRealFilePath, src) + + let outputFilePath = Path.ChangeExtension(tmpRealFilePath, ".dll") + + try + compileFileAsDll checker tmpRealFilePath outputFilePath + outputFilePath + finally + try File.Delete(tmpRealFilePath) with | _ -> () + + let updateFileOnDisk filePath src = + File.WriteAllText(filePath, src) + + let updateCompiledDllOnDisk checker (dllPath: string) src = + if not (File.Exists dllPath) then + failwith $"File {dllPath} does not exist." + + let filePath = createOnDisk src + + try + compileFileAsDll checker filePath dllPath + finally + try File.Delete(filePath) with | _ -> () + [] let ``Using a CSharp reference project in-memory``() = AssertInMemoryCSharpReferenceIsValid() |> ignore @@ -83,5 +131,73 @@ let test() = GC.Collect(2, GCCollectionMode.Forced, true) Assert.shouldBeFalse(weakRef.IsAlive) + [] + let ``Using compiler service, file referencing a DLL will correctly update when the referenced DLL file changes``() = + let checker = CompilerAssert.Checker + + let dllPath1 = + createOnDiskCompiledAsDll checker + """ +module Script1 + +let x = 1 + """ + + let filePath1 = + createOnDisk + """ +module Script2 + +let x = Script1.x + """ + + try + let fsOptions1 = CompilerAssert.DefaultProjectOptions + let fsOptions1 = + { fsOptions1 with + ProjectId = Some(Guid.NewGuid().ToString()) + OtherOptions = [|"-r:" + dllPath1|] + ReferencedProjects = [||] + SourceFiles = [|filePath1|] } + + let checkProjectResults = + checker.ParseAndCheckProject(fsOptions1) + |> Async.RunSynchronously + + Assert.IsEmpty(checkProjectResults.Diagnostics) + + updateFileOnDisk filePath1 + """ +module Script2 + +let x = Script1.x +let y = Script1.y + """ + + let checkProjectResults = + checker.ParseAndCheckProject(fsOptions1) + |> Async.RunSynchronously + + Assert.IsNotEmpty(checkProjectResults.Diagnostics) + + updateCompiledDllOnDisk checker dllPath1 + """ +module Script1 + +let x = 1 +let y = 1 + """ + + let checkProjectResults = + checker.ParseAndCheckProject(fsOptions1) + |> Async.RunSynchronously + + Assert.IsEmpty(checkProjectResults.Diagnostics) + + finally + try File.Delete(dllPath1) with | _ -> () + try File.Delete(filePath1) with | _ -> () + + diff --git a/vsintegration/src/FSharp.Editor/LanguageService/SingleFileWorkspaceMap.fs b/vsintegration/src/FSharp.Editor/LanguageService/SingleFileWorkspaceMap.fs index 637c6dd92d7..908e71ae13d 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/SingleFileWorkspaceMap.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/SingleFileWorkspaceMap.fs @@ -27,13 +27,29 @@ type internal IFSharpWorkspaceProjectContext = abstract SetProjectReferences : IFSharpWorkspaceProjectContext seq -> unit + abstract MetadataReferenceCount : int + + abstract HasMetadataReference : referencePath: string -> bool + + abstract SetMetadataReferences : referencePaths: string seq -> unit + type internal IFSharpWorkspaceProjectContextFactory = abstract CreateProjectContext : filePath: string -> IFSharpWorkspaceProjectContext +type private ProjectContextState = + { + refs: ImmutableDictionary + metadataRefs: ImmutableHashSet + } + type internal FSharpWorkspaceProjectContext(vsProjectContext: IWorkspaceProjectContext) = - let mutable refs = ImmutableDictionary.Create(StringComparer.OrdinalIgnoreCase) + let mutable state = + { + refs = ImmutableDictionary.Create(StringComparer.OrdinalIgnoreCase) + metadataRefs = ImmutableHashSet.Create(equalityComparer = StringComparer.OrdinalIgnoreCase) + } member private _.VisualStudioProjectContext = vsProjectContext @@ -52,20 +68,27 @@ type internal FSharpWorkspaceProjectContext(vsProjectContext: IWorkspaceProjectC | _ -> () + member private _.AddMetadataReference(builder: ImmutableHashSet<_>.Builder, referencePath: string) = + vsProjectContext.AddMetadataReference(referencePath, MetadataReferenceProperties.Assembly) + builder.Add(referencePath) |> ignore + + member private _.RemoveMetadataReference(referencePath: string) = + vsProjectContext.RemoveMetadataReference(referencePath) + interface IFSharpWorkspaceProjectContext with member _.Id = vsProjectContext.Id member _.FilePath = vsProjectContext.ProjectFilePath - member _.ProjectReferenceCount = refs.Count + member _.ProjectReferenceCount = state.refs.Count - member _.HasProjectReference(filePath) = refs.ContainsKey(filePath) + member _.HasProjectReference(filePath) = state.refs.ContainsKey(filePath) member this.SetProjectReferences(projRefs) = let builder = ImmutableDictionary.CreateBuilder() - refs.Values + state.refs.Values |> Seq.iter (fun x -> this.RemoveProjectReference(x) ) @@ -75,7 +98,26 @@ type internal FSharpWorkspaceProjectContext(vsProjectContext: IWorkspaceProjectC this.AddProjectReference(builder, x) ) - refs <- builder.ToImmutable() + state <- { state with refs = builder.ToImmutable() } + + member _.MetadataReferenceCount = state.metadataRefs.Count + + member _.HasMetadataReference(referencePath) = state.metadataRefs.Contains(referencePath) + + member this.SetMetadataReferences(referencePaths) = + let builder = ImmutableHashSet.CreateBuilder() + + state.metadataRefs + |> Seq.iter (fun x -> + this.RemoveMetadataReference(x) + ) + + referencePaths + |> Seq.iter (fun x -> + this.AddMetadataReference(builder, x) + ) + + state <- { state with metadataRefs = builder.ToImmutable() } member _.Dispose() = vsProjectContext.Dispose() @@ -105,7 +147,7 @@ type internal FSharpMiscellaneousFileService(workspace: Workspace, let files = ConcurrentDictionary(StringComparer.OrdinalIgnoreCase) let optionsManager = workspace.Services.GetRequiredService().FSharpProjectOptionsManager - static let mustUpdateProject (refSourceFiles: string []) (projectContext: IFSharpWorkspaceProjectContext) = + static let mustUpdateProjectReferences (refSourceFiles: string []) (projectContext: IFSharpWorkspaceProjectContext) = refSourceFiles.Length <> projectContext.ProjectReferenceCount || ( refSourceFiles @@ -113,6 +155,14 @@ type internal FSharpMiscellaneousFileService(workspace: Workspace, |> not ) + static let mustUpdateMetadataReferences (referencePaths: string []) (projectContext: IFSharpWorkspaceProjectContext) = + referencePaths.Length <> projectContext.MetadataReferenceCount || + ( + referencePaths + |> Seq.forall projectContext.HasMetadataReference + |> not + ) + let tryRemove (document: Document) = let projIds = document.Project.Solution.GetDependentProjectIds(document.Project.Id) if projIds.Count = 0 then @@ -131,9 +181,18 @@ type internal FSharpMiscellaneousFileService(workspace: Workspace, let filePath = scriptProjectOptions.SourceFiles.[scriptProjectOptions.SourceFiles.Length - 1] let refSourceFiles = scriptProjectOptions.SourceFiles |> Array.take (scriptProjectOptions.SourceFiles.Length - 1) + let referencePaths = + scriptProjectOptions.OtherOptions + |> Seq.filter (fun x -> x.StartsWith("-r:", StringComparison.OrdinalIgnoreCase)) + |> Seq.map (fun x -> + let startIndex = "-r:".Length + x.Substring(startIndex, x.Length - startIndex) + ) + |> Array.ofSeq + match files.TryGetValue(filePath) with | true, (projectContext: IFSharpWorkspaceProjectContext) -> - if mustUpdateProject refSourceFiles projectContext then + if mustUpdateProjectReferences refSourceFiles projectContext then lock gate (fun () -> let newProjRefs = refSourceFiles @@ -148,6 +207,11 @@ type internal FSharpMiscellaneousFileService(workspace: Workspace, projectContext.SetProjectReferences(newProjRefs) ) + + if mustUpdateMetadataReferences referencePaths projectContext then + lock gate (fun () -> + projectContext.SetMetadataReferences(referencePaths) + ) | _ -> () ) diff --git a/vsintegration/tests/UnitTests/Workspace/WorkspaceTests.fs b/vsintegration/tests/UnitTests/Workspace/WorkspaceTests.fs index e9c2bfe5fee..f33ffbc52da 100644 --- a/vsintegration/tests/UnitTests/Workspace/WorkspaceTests.fs +++ b/vsintegration/tests/UnitTests/Workspace/WorkspaceTests.fs @@ -2,6 +2,7 @@ open System open System.IO +open System.Text open System.Reflection open System.Linq open System.Composition.Hosting @@ -22,6 +23,21 @@ open NUnit.Framework [] module WorkspaceTests = + let compileFileAsDll (workspace: Workspace) filePath outputFilePath = + let workspaceService = workspace.Services.GetRequiredService() + + try + let result, _ = + workspaceService.Checker.Compile([|"fsc.dll";filePath;$"-o:{ outputFilePath }";"--deterministic+";"--optimize+";"--target:library"|]) + |> Async.RunSynchronously + + if result.Length > 0 then + failwith "Compilation has errors." + with + | _ -> + try File.Delete(outputFilePath) with | _ -> () + reraise() + let createOnDiskScript src = let tmpFilePath = Path.GetTempFileName() let tmpRealFilePath = Path.ChangeExtension(tmpFilePath, ".fsx") @@ -29,13 +45,44 @@ module WorkspaceTests = File.WriteAllText(tmpRealFilePath, src) tmpRealFilePath + let createOnDiskCompiledScriptAsDll (workspace: Workspace) src = + let tmpFilePath = Path.GetTempFileName() + let tmpRealFilePath = Path.ChangeExtension(tmpFilePath, ".fsx") + try File.Delete(tmpFilePath) with | _ -> () + File.WriteAllText(tmpRealFilePath, src) + + let outputFilePath = Path.ChangeExtension(tmpRealFilePath, ".dll") + + try + compileFileAsDll workspace tmpRealFilePath outputFilePath + outputFilePath + finally + try File.Delete(tmpRealFilePath) with | _ -> () + let createWorkspace() = new AdhocWorkspace(TestHostServices()) let createMiscFileWorkspace() = createWorkspace() - let openDocument (workspace: Workspace) (docId: DocumentId) = + let createProjectInfoWithFileOnDisk filePath = + RoslynTestHelpers.CreateProjectInfoWithSingleDocument(filePath, filePath) + + let getDocumentId (workspace: Workspace) filePath = + let solution = workspace.CurrentSolution + solution.GetDocumentIdsWithFilePath(filePath) + |> Seq.exactlyOne + + let getDocument (workspace: Workspace) filePath = + let solution = workspace.CurrentSolution + solution.GetDocumentIdsWithFilePath(filePath) + |> Seq.exactlyOne + |> solution.GetDocument + + let openDocument (workspace: Workspace) (filePath: string) = + let docId = + workspace.CurrentSolution.GetDocumentIdsWithFilePath(filePath) + |> Seq.exactlyOne use waitHandle = new ManualResetEventSlim(false) use _sub = workspace.DocumentOpened.Subscribe(fun _ -> waitHandle.Set() @@ -43,11 +90,71 @@ module WorkspaceTests = workspace.OpenDocument(docId) waitHandle.Wait() - let getDocument (workspace: Workspace) filePath = - let solution = workspace.CurrentSolution - solution.GetDocumentIdsWithFilePath(filePath) - |> Seq.exactlyOne - |> solution.GetDocument + let updateDocumentOnDisk (workspace: Workspace) filePath src = + File.WriteAllText(filePath, src) + + let doc = getDocument workspace filePath + // The adhoc workspaces do not listen for files changing on disk, + // so we simulate the update here. + let newSolution = + doc.Project.Solution.WithDocumentTextLoader( + doc.Id, + new FileTextLoader(doc.FilePath, Encoding.Default), + PreservationMode.PreserveIdentity) + workspace.TryApplyChanges(newSolution) |> ignore + + let updateCompiledDllOnDisk workspace (dllPath: string) src = + if not (File.Exists dllPath) then + failwith $"File {dllPath} does not exist." + + let filePath = createOnDiskScript src + + try + compileFileAsDll workspace filePath dllPath + + let newMetadataReference = + PortableExecutableReference.CreateFromFile( + dllPath, + MetadataReferenceProperties.Assembly + ) + // The adhoc workspaces do not listen for files changing on disk, + // so we simulate the update here. + let solution = workspace.CurrentSolution + let projects = solution.Projects + let newSolution = + (solution, projects) + ||> Seq.fold (fun solution proj -> + let mutable mustUpdate = false + let metadataReferences = + proj.MetadataReferences + |> Array.ofSeq + |> Array.map (fun x -> + match x with + | :? PortableExecutableReference as x -> + if String.Equals(x.FilePath, newMetadataReference.FilePath, StringComparison.OrdinalIgnoreCase) then + mustUpdate <- true + newMetadataReference :> MetadataReference + else + x :> MetadataReference + | _ -> + x + ) + + if mustUpdate then + solution.WithProjectMetadataReferences(proj.Id, metadataReferences) + else + solution + ) + workspace.TryApplyChanges(newSolution) |> ignore + finally + try File.Delete(filePath) with | _ -> () + + let isDocumentOpen (workspace: Workspace) filePath = + let docId = getDocumentId workspace filePath + workspace.IsDocumentOpen(docId) + + let hasDocument (workspace: Workspace) filePath = + workspace.CurrentSolution.GetDocumentIdsWithFilePath(filePath).Length > 0 let addProject (workspace: Workspace) projInfo = if not (workspace.TryApplyChanges(workspace.CurrentSolution.AddProject(projInfo))) then @@ -57,13 +164,15 @@ module WorkspaceTests = if not (workspace.TryApplyChanges(workspace.CurrentSolution.RemoveProject(projId))) then failwith "Unable to apply workspace changes." - let assertEmptyDocumentDiagnostics (doc: Document) = + let assertEmptyDocumentDiagnostics (workspace: Workspace) (filePath: string) = + let doc = getDocument workspace filePath let parseResults, checkResults = doc.GetFSharpParseAndCheckResultsAsync("assertEmptyDocumentDiagnostics") |> Async.RunSynchronously Assert.IsEmpty(parseResults.Diagnostics) Assert.IsEmpty(checkResults.Diagnostics) - let assertHasDocumentDiagnostics (doc: Document) = + let assertHasDocumentDiagnostics (workspace: Workspace) (filePath: string) = + let doc = getDocument workspace filePath let parseResults, checkResults = doc.GetFSharpParseAndCheckResultsAsync("assertHasDocumentDiagnostics") |> Async.RunSynchronously Assert.IsEmpty(parseResults.Diagnostics) @@ -97,7 +206,7 @@ module WorkspaceTests = let currentProj = mainProj let mutable solution = currentProj.Solution - mainProj.ProjectReferences + currentProj.ProjectReferences |> Seq.iter (fun projRef -> solution <- solution.RemoveProjectReference(currentProj.Id, projRef) ) @@ -115,6 +224,42 @@ module WorkspaceTests = mainProj <- solution.GetProject(currentProj.Id) + member this.MetadataReferenceCount: int = mainProj.MetadataReferences.Count + + member this.HasMetadataReference(referencePath: string): bool = + mainProj.MetadataReferences + |> Seq.exists (fun x -> + match x with + | :? PortableExecutableReference as r -> + String.Equals(r.FilePath, referencePath, StringComparison.OrdinalIgnoreCase) + | _ -> + false) + + member this.SetMetadataReferences(referencePaths: string seq): unit = + let currentProj = mainProj + let mutable solution = currentProj.Solution + + currentProj.MetadataReferences + |> Seq.iter (fun r -> + solution <- solution.RemoveMetadataReference(currentProj.Id, r) + ) + + referencePaths + |> Seq.iter (fun referencePath -> + solution <- + solution.AddMetadataReference( + currentProj.Id, + PortableExecutableReference.CreateFromFile( + referencePath, + MetadataReferenceProperties.Assembly + ) + ) + ) + + not (solution.Workspace.TryApplyChanges(solution)) |> ignore + + mainProj <- solution.GetProject(currentProj.Id) + type TestFSharpWorkspaceProjectContextFactory(workspace: Workspace, miscFilesWorkspace: Workspace) = interface IFSharpWorkspaceProjectContextFactory with @@ -134,8 +279,8 @@ module WorkspaceTests = [] let ``Script file opened in misc files workspace will get transferred to normal workspace``() = - let workspace = createWorkspace() - let miscFilesWorkspace = createMiscFileWorkspace() + use workspace = createWorkspace() + use miscFilesWorkspace = createMiscFileWorkspace() let projectContextFactory = TestFSharpWorkspaceProjectContextFactory(workspace, miscFilesWorkspace) let _miscFileService = FSharpMiscellaneousFileService(workspace, miscFilesWorkspace, projectContextFactory) @@ -149,34 +294,31 @@ let x = 1 """ try - let projInfo = RoslynTestHelpers.CreateProjectInfoWithSingleDocument(filePath, filePath) + let projInfo = createProjectInfoWithFileOnDisk filePath addProject miscFilesWorkspace projInfo - - let doc = getDocument miscFilesWorkspace filePath - - Assert.IsFalse(miscFilesWorkspace.IsDocumentOpen(doc.Id)) - Assert.AreEqual(0, workspace.CurrentSolution.GetDocumentIdsWithFilePath(filePath).Length) - openDocument miscFilesWorkspace doc.Id - // Although we opened the document, this is false as it has been transferred to the other workspace. - Assert.IsFalse(miscFilesWorkspace.IsDocumentOpen(doc.Id)) + Assert.IsTrue(hasDocument miscFilesWorkspace filePath) + Assert.IsFalse(hasDocument workspace filePath) - Assert.AreEqual(0, miscFilesWorkspace.CurrentSolution.GetDocumentIdsWithFilePath(filePath).Length) - Assert.AreEqual(1, workspace.CurrentSolution.GetDocumentIdsWithFilePath(filePath).Length) + Assert.IsFalse(isDocumentOpen miscFilesWorkspace filePath) + openDocument miscFilesWorkspace filePath - let doc = getDocument workspace filePath + // Although we opened the document, it has been transferred to the other workspace. + Assert.IsFalse(hasDocument miscFilesWorkspace filePath) + Assert.IsTrue(hasDocument workspace filePath) - Assert.IsFalse(workspace.IsDocumentOpen(doc.Id)) + // Should not be automatically opened when transferred. + Assert.IsFalse(isDocumentOpen workspace filePath) - assertEmptyDocumentDiagnostics doc + assertEmptyDocumentDiagnostics workspace filePath finally try File.Delete(filePath) with | _ -> () [] let ``Script file referencing another script should have no diagnostics``() = - let workspace = createWorkspace() - let miscFilesWorkspace = createMiscFileWorkspace() + use workspace = createWorkspace() + use miscFilesWorkspace = createMiscFileWorkspace() let projectContextFactory = TestFSharpWorkspaceProjectContextFactory(workspace, miscFilesWorkspace) let _miscFileService = FSharpMiscellaneousFileService(workspace, miscFilesWorkspace, projectContextFactory) @@ -199,23 +341,19 @@ let x = Script1.x """ try - let projInfo2 = RoslynTestHelpers.CreateProjectInfoWithSingleDocument(filePath2, filePath2) - + let projInfo2 = createProjectInfoWithFileOnDisk filePath2 addProject miscFilesWorkspace projInfo2 - - openDocument miscFilesWorkspace (getDocument miscFilesWorkspace filePath2).Id - - let doc2 = getDocument workspace filePath2 - assertEmptyDocumentDiagnostics doc2 + openDocument miscFilesWorkspace filePath2 + assertEmptyDocumentDiagnostics workspace filePath2 finally try File.Delete(filePath1) with | _ -> () try File.Delete(filePath2) with | _ -> () [] - let ``Script file referencing another script will correct update when the referenced script file changes``() = - let workspace = createWorkspace() - let miscFilesWorkspace = createMiscFileWorkspace() + let ``Script file referencing another script will correctly update when the referenced script file changes``() = + use workspace = createWorkspace() + use miscFilesWorkspace = createMiscFileWorkspace() let projectContextFactory = TestFSharpWorkspaceProjectContextFactory(workspace, miscFilesWorkspace) let _miscFileService = FSharpMiscellaneousFileService(workspace, miscFilesWorkspace, projectContextFactory) @@ -236,38 +374,35 @@ let x = Script1.x """ try - let projInfo1 = RoslynTestHelpers.CreateProjectInfoWithSingleDocument(filePath1, filePath1) - let projInfo2 = RoslynTestHelpers.CreateProjectInfoWithSingleDocument(filePath2, filePath2) + let projInfo1 = createProjectInfoWithFileOnDisk filePath1 + let projInfo2 = createProjectInfoWithFileOnDisk filePath2 addProject miscFilesWorkspace projInfo1 addProject miscFilesWorkspace projInfo2 - openDocument miscFilesWorkspace (getDocument miscFilesWorkspace filePath1).Id - openDocument miscFilesWorkspace (getDocument miscFilesWorkspace filePath2).Id + openDocument miscFilesWorkspace filePath1 + openDocument miscFilesWorkspace filePath2 - let doc1 = getDocument workspace filePath1 - assertEmptyDocumentDiagnostics doc1 - - let doc2 = getDocument workspace filePath2 - assertHasDocumentDiagnostics doc2 + assertEmptyDocumentDiagnostics workspace filePath1 + assertHasDocumentDiagnostics workspace filePath2 - File.WriteAllText(filePath1, + updateDocumentOnDisk workspace filePath1 """ module Script1 let x = 1 - """) + """ - assertEmptyDocumentDiagnostics doc2 + assertEmptyDocumentDiagnostics workspace filePath2 finally try File.Delete(filePath1) with | _ -> () try File.Delete(filePath2) with | _ -> () [] - let ``Script file referencing another script will correct update when the referenced script file changes with opening in reverse order``() = - let workspace = createWorkspace() - let miscFilesWorkspace = createMiscFileWorkspace() + let ``Script file referencing another script will correctly update when the referenced script file changes with opening in reverse order``() = + use workspace = createWorkspace() + use miscFilesWorkspace = createMiscFileWorkspace() let projectContextFactory = TestFSharpWorkspaceProjectContextFactory(workspace, miscFilesWorkspace) let _miscFileService = FSharpMiscellaneousFileService(workspace, miscFilesWorkspace, projectContextFactory) @@ -288,30 +423,86 @@ let x = Script1.x """ try - let projInfo1 = RoslynTestHelpers.CreateProjectInfoWithSingleDocument(filePath1, filePath1) - let projInfo2 = RoslynTestHelpers.CreateProjectInfoWithSingleDocument(filePath2, filePath2) + let projInfo1 = createProjectInfoWithFileOnDisk filePath1 + let projInfo2 = createProjectInfoWithFileOnDisk filePath2 addProject miscFilesWorkspace projInfo1 addProject miscFilesWorkspace projInfo2 - openDocument miscFilesWorkspace (getDocument miscFilesWorkspace filePath2).Id - openDocument miscFilesWorkspace (getDocument miscFilesWorkspace filePath1).Id + openDocument miscFilesWorkspace filePath2 + openDocument miscFilesWorkspace filePath1 - let doc2 = getDocument workspace filePath2 - assertHasDocumentDiagnostics doc2 - - let doc1 = getDocument workspace filePath1 - assertEmptyDocumentDiagnostics doc1 + assertHasDocumentDiagnostics workspace filePath2 + assertEmptyDocumentDiagnostics workspace filePath1 - File.WriteAllText(filePath1, + updateDocumentOnDisk workspace filePath1 """ module Script1 let x = 1 - """) + """ - assertEmptyDocumentDiagnostics doc2 + assertEmptyDocumentDiagnostics workspace filePath2 finally try File.Delete(filePath1) with | _ -> () try File.Delete(filePath2) with | _ -> () + + [] + let ``Script file referencing a DLL will correctly update when the referenced DLL file changes``() = + use workspace = createWorkspace() + use miscFilesWorkspace = createMiscFileWorkspace() + let projectContextFactory = TestFSharpWorkspaceProjectContextFactory(workspace, miscFilesWorkspace) + + let _miscFileService = FSharpMiscellaneousFileService(workspace, miscFilesWorkspace, projectContextFactory) + + let dllPath1 = + createOnDiskCompiledScriptAsDll workspace + """ +module Script1 + +let x = 1 + """ + + let filePath1 = + createOnDiskScript + $""" +module Script2 +#r "{ Path.GetFileName(dllPath1) }" + +let x = Script1.x + """ + + try + let projInfo1 = createProjectInfoWithFileOnDisk filePath1 + + addProject miscFilesWorkspace projInfo1 + + openDocument miscFilesWorkspace filePath1 + + assertEmptyDocumentDiagnostics workspace filePath1 + + updateDocumentOnDisk workspace filePath1 + $""" +module Script2 +#r "{ Path.GetFileName(dllPath1) }" + +let x = Script1.x +let y = Script1.y + """ + + assertHasDocumentDiagnostics workspace filePath1 + + updateCompiledDllOnDisk workspace dllPath1 + """ +module Script1 + +let x = 1 +let y = 1 + """ + + assertEmptyDocumentDiagnostics workspace filePath1 + + finally + try File.Delete(dllPath1) with | _ -> () + try File.Delete(filePath1) with | _ -> () From 6deea74df913a8c8242b3e1ae4e6659b1d039c97 Mon Sep 17 00:00:00 2001 From: Goswin Date: Wed, 30 Jun 2021 19:41:22 +0200 Subject: [PATCH 33/42] minor fix of duplicate definition in ServiceLexing.fsi (#11756) Co-authored-by: Vlad Zarytovskii --- src/fsharp/service/ServiceLexing.fsi | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/fsharp/service/ServiceLexing.fsi b/src/fsharp/service/ServiceLexing.fsi index 86848ea5990..625ce113db3 100755 --- a/src/fsharp/service/ServiceLexing.fsi +++ b/src/fsharp/service/ServiceLexing.fsi @@ -340,6 +340,7 @@ module FSharpKeywords = val DoesIdentifierNeedQuotation : string -> bool /// Add backticks if the identifier is a keyword. + /// A utility to help determine if an identifier needs to be quoted, this doesn't quote F# keywords. val QuoteIdentifierIfNeeded : string -> string /// Remove backticks if present. @@ -348,9 +349,6 @@ module FSharpKeywords = /// Keywords paired with their descriptions. Used in completion and quick info. val KeywordsWithDescription : (string * string) list - /// A utility to help determine if an identifier needs to be quoted, this doesn't quote F# keywords. - val QuoteIdentifierIfNeeded: string -> string - /// All the keywords in the F# language val KeywordNames: string list @@ -581,4 +579,3 @@ type public FSharpLexer = [] static member Tokenize: text: ISourceText * tokenCallback: (FSharpToken -> unit) * ?langVersion: string * ?filePath: string * ?conditionalCompilationDefines: string list * ?flags: FSharpLexerFlags * ?pathMap: Map * ?ct: CancellationToken -> unit - From f938c0ca0cfa8d14f0fcea6ed1bfb0e6213cac53 Mon Sep 17 00:00:00 2001 From: dotnet bot Date: Wed, 30 Jun 2021 11:46:42 -0700 Subject: [PATCH 34/42] Localized file check-in by OneLocBuild Task: Build definition ID 499: Build ID 1214184 (#11757) --- src/fsharp/xlf/FSComp.txt.cs.xlf | 2 +- src/fsharp/xlf/FSComp.txt.es.xlf | 2 +- src/fsharp/xlf/FSComp.txt.fr.xlf | 2 +- src/fsharp/xlf/FSComp.txt.ja.xlf | 2 +- src/fsharp/xlf/FSComp.txt.ko.xlf | 2 +- src/fsharp/xlf/FSComp.txt.pt-BR.xlf | 2 +- src/fsharp/xlf/FSComp.txt.zh-Hant.xlf | 2 +- vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.cs.xlf | 4 ++-- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/fsharp/xlf/FSComp.txt.cs.xlf b/src/fsharp/xlf/FSComp.txt.cs.xlf index 8d72673512f..3e021f74a7c 100644 --- a/src/fsharp/xlf/FSComp.txt.cs.xlf +++ b/src/fsharp/xlf/FSComp.txt.cs.xlf @@ -364,7 +364,7 @@ The .NET SDK for this script could not be determined. dotnet.exe could not be found ensure a .NET SDK is installed. - The .NET SDK for this script could not be determined. dotnet.exe could not be found ensure a .NET SDK is installed. + Sada .NET SDK pro tento skript nedá určit. dotnet.exe se nepovedlo najít, ujistěte se, že je sada .NET SDK nainstalovaná. diff --git a/src/fsharp/xlf/FSComp.txt.es.xlf b/src/fsharp/xlf/FSComp.txt.es.xlf index 4e29a4e6c8a..7883347a3b5 100644 --- a/src/fsharp/xlf/FSComp.txt.es.xlf +++ b/src/fsharp/xlf/FSComp.txt.es.xlf @@ -94,7 +94,7 @@ attributes to the right of the 'module' keyword - attributes to the right of the 'module' keyword + atributos a la derecha de la palabra clave “módulo” diff --git a/src/fsharp/xlf/FSComp.txt.fr.xlf b/src/fsharp/xlf/FSComp.txt.fr.xlf index 8aa67acfba2..89ce2d2d3ac 100644 --- a/src/fsharp/xlf/FSComp.txt.fr.xlf +++ b/src/fsharp/xlf/FSComp.txt.fr.xlf @@ -94,7 +94,7 @@ attributes to the right of the 'module' keyword - attributes to the right of the 'module' keyword + attributs à droite du mot clé 'module' diff --git a/src/fsharp/xlf/FSComp.txt.ja.xlf b/src/fsharp/xlf/FSComp.txt.ja.xlf index c0cd41337b5..ded89f6ee73 100644 --- a/src/fsharp/xlf/FSComp.txt.ja.xlf +++ b/src/fsharp/xlf/FSComp.txt.ja.xlf @@ -94,7 +94,7 @@ attributes to the right of the 'module' keyword - attributes to the right of the 'module' keyword + 'module' キーワードの右側の属性 diff --git a/src/fsharp/xlf/FSComp.txt.ko.xlf b/src/fsharp/xlf/FSComp.txt.ko.xlf index b98ec0679e6..f7b4c5be466 100644 --- a/src/fsharp/xlf/FSComp.txt.ko.xlf +++ b/src/fsharp/xlf/FSComp.txt.ko.xlf @@ -94,7 +94,7 @@ attributes to the right of the 'module' keyword - attributes to the right of the 'module' keyword + 'module' 키워드 오른쪽에 있는 특성 diff --git a/src/fsharp/xlf/FSComp.txt.pt-BR.xlf b/src/fsharp/xlf/FSComp.txt.pt-BR.xlf index d093db2ebae..b5d25fdbef5 100644 --- a/src/fsharp/xlf/FSComp.txt.pt-BR.xlf +++ b/src/fsharp/xlf/FSComp.txt.pt-BR.xlf @@ -94,7 +94,7 @@ attributes to the right of the 'module' keyword - attributes to the right of the 'module' keyword + atributos à direita da palavra-chave 'módulo' diff --git a/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf b/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf index 5facb9ddf4d..17051040efa 100644 --- a/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf @@ -94,7 +94,7 @@ attributes to the right of the 'module' keyword - attributes to the right of the 'module' keyword + 'module' 關鍵字右邊的屬性 diff --git a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.cs.xlf b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.cs.xlf index 415992efdff..d99141db026 100644 --- a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.cs.xlf +++ b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.cs.xlf @@ -14,7 +14,7 @@ Add missing instance member parameter - Add missing instance member parameter + Přidat chybějící parametr člena instance @@ -259,7 +259,7 @@ Use 'nameof' - Use 'nameof' + Použít nameof From 692eaa4d292b5cea711839e84078c254808b9ebf Mon Sep 17 00:00:00 2001 From: Don Syme Date: Thu, 1 Jul 2021 14:08:24 +0100 Subject: [PATCH 35/42] fix 11620 (#11755) * fix 11620 * fix 11620 * fix 11620 Co-authored-by: Don Syme --- src/fsharp/IlxGen.fs | 32 +++++---- tests/fsharp/core/innerpoly/test.fsx | 39 +++++++++++ tests/fsharp/core/quotes/test.fsx | 2 +- tests/fsharp/single-test.fs | 4 +- tests/fsharp/tests.fs | 98 ++++++++++++++++++++++++++++ 5 files changed, 162 insertions(+), 13 deletions(-) diff --git a/src/fsharp/IlxGen.fs b/src/fsharp/IlxGen.fs index 6cefacd50c3..01e5eaac8e8 100644 --- a/src/fsharp/IlxGen.fs +++ b/src/fsharp/IlxGen.fs @@ -829,14 +829,14 @@ type ValStorage = | Method of ValReprInfo * ValRef * ILMethodSpec * ILMethodSpec * range * Typars * Typars * CurriedArgInfos * ArgReprInfo list * TraitWitnessInfos * TType list * ArgReprInfo /// Indicates the value is stored at the given position in the closure environment accessed via "ldarg 0" - | Env of ILType * ILFieldSpec * NamedLocalIlxClosureInfo ref option + | Env of ILType * ILFieldSpec * (FreeTyvars * NamedLocalIlxClosureInfo ref) option /// Indicates that the value is an argument of a method being generated | Arg of int /// Indicates that the value is stored in local of the method being generated. NamedLocalIlxClosureInfo is normally empty. /// It is non-empty for 'local type functions', see comments on definition of NamedLocalIlxClosureInfo. - | Local of idx: int * realloc: bool * NamedLocalIlxClosureInfo ref option + | Local of idx: int * realloc: bool * (FreeTyvars * NamedLocalIlxClosureInfo ref) option /// Indicates if there is a shadow local storage for a local, to make sure it gets a good name in debugging and OptionalShadowLocal = @@ -4883,16 +4883,25 @@ and GetIlxClosureFreeVars cenv m (thisVars: ValRef list) eenvouter takenNames ex // Partition the free variables when some can be accessed from places besides the immediate environment // Also filter out the current value being bound, if any, as it is available from the "this" // pointer which gives the current closure itself. This is in the case e.g. let rec f = ... f ... + let freeLocals = cloFreeVarResults.FreeLocals |> Zset.elements let cloFreeVars = - cloFreeVarResults.FreeLocals - |> Zset.elements + freeLocals |> List.filter (fun fv -> (thisVars |> List.forall (fun v -> not (valRefEq g (mkLocalValRef fv) v))) && (match StorageForVal cenv.g m fv eenvouter with | (StaticField _ | StaticProperty _ | Method _ | Null) -> false | _ -> true)) - let cloFreeTyvars = cloFreeVarResults.FreeTyvars.FreeTypars |> Zset.elements + // Any closure using values represented as local type functions also captures the type variables captured + // by that local type function + let cloFreeTyvars = + (cloFreeVarResults.FreeTyvars, freeLocals) ||> List.fold (fun ftyvs fv -> + match StorageForVal cenv.g m fv eenvouter with + | Env (_, _, Some (moreFtyvs, _)) + | Local (_, _, Some (moreFtyvs, _)) -> unionFreeTyvars ftyvs moreFtyvs + | _ -> ftyvs) + + let cloFreeTyvars = cloFreeTyvars.FreeTypars |> Zset.elements let cloAttribs = [] @@ -6629,10 +6638,10 @@ and GenSetStorage m cgbuf storage = and CommitGetStorageSequel cenv cgbuf eenv m ty localCloInfo storeSequel = match localCloInfo, storeSequel with - | Some {contents =NamedLocalIlxClosureInfoGenerator _cloinfo}, _ -> + | Some (_, {contents =NamedLocalIlxClosureInfoGenerator _cloinfo}), _ -> error(InternalError("Unexpected generator", m)) - | Some {contents =NamedLocalIlxClosureInfoGenerated cloinfo}, Some (tyargs, args, m, sequel) when not (isNil tyargs) -> + | Some (_, {contents =NamedLocalIlxClosureInfoGenerated cloinfo}), Some (tyargs, args, m, sequel) when not (isNil tyargs) -> let actualRetTy = GenNamedLocalTyFuncCall cenv cgbuf eenv ty cloinfo tyargs m CommitGetStorageSequel cenv cgbuf eenv m actualRetTy None (Some ([], args, m, sequel)) @@ -6729,16 +6738,17 @@ and AllocLocalVal cenv cgbuf v eenv repr scopeMarks = else match repr with | Some r when IsNamedLocalTypeFuncVal g v r -> + let ftyvs = (freeInExpr CollectTypars r).FreeTyvars // known, named, non-escaping type functions let cloinfoGenerate eenv = let eenvinner = {eenv with letBoundVars=(mkLocalValRef v) :: eenv.letBoundVars} - let cloinfo, _, _ = GetIlxClosureInfo cenv v.Range true true [] eenvinner (Option.get repr) + let cloinfo, _, _ = GetIlxClosureInfo cenv v.Range true true [] eenvinner r cloinfo let idx, realloc, eenv = AllocLocal cenv cgbuf eenv v.IsCompilerGenerated (v.CompiledName g.CompilerGlobalState, g.ilg.typ_Object, false) scopeMarks - Local (idx, realloc, Some(ref (NamedLocalIlxClosureInfoGenerator cloinfoGenerate))), eenv + Local (idx, realloc, Some(ftyvs, ref (NamedLocalIlxClosureInfoGenerator cloinfoGenerate))), eenv | _ -> // normal local let idx, realloc, eenv = AllocLocal cenv cgbuf eenv v.IsCompilerGenerated (v.CompiledName g.CompilerGlobalState, GenTypeOfVal cenv eenv v, v.IsFixed) scopeMarks @@ -6759,8 +6769,8 @@ and AllocStorageForBinds cenv cgbuf scopeMarks eenv binds = match reprOpt with | Some repr -> match repr with - | Local(_, _, Some g) - | Env(_, _, Some g) -> + | Local(_, _, Some (_, g)) + | Env(_, _, Some (_, g)) -> match !g with | NamedLocalIlxClosureInfoGenerator f -> g := NamedLocalIlxClosureInfoGenerated (f eenv) | NamedLocalIlxClosureInfoGenerated _ -> () diff --git a/tests/fsharp/core/innerpoly/test.fsx b/tests/fsharp/core/innerpoly/test.fsx index 752ba98a3dd..76c88c8fd78 100644 --- a/tests/fsharp/core/innerpoly/test.fsx +++ b/tests/fsharp/core/innerpoly/test.fsx @@ -439,6 +439,45 @@ module Bug10408 = | [| |] -> x | _ -> x +module Bug11620A = + + let createService (metadata: 'T) : 'Data when 'Data :> System.IComparable = Unchecked.defaultof<'Data> + + let getCreateServiceCallback<'T> (thing: 'T) = + let getService () : 'Data = createService thing + (fun () -> getService) + +// The generated signature for this bug repro has mistakes, we are not enabling it yet +#if !GENERATED_SIGNATURE +module Bug11620B = + + type Data = interface end + and Service<'Data when 'Data :> Data>() = class end + + type IThing = interface end + and Thing<'T> = { Metadata: 'T } with interface IThing + + let createService metadata = (Service<'Data>()) + + let getCreateServiceCallback<'T> (thing: IThing) = + let upcastThing = + thing + :?> Thing<'T> + let getService () = createService upcastThing.Metadata + (fun () -> getService) + + let main _ = + let dummyThing : Thing = { Thing.Metadata = 42 } + // crash occured on the following line + let callback = getCreateServiceCallback dummyThing + let resolvedService = callback () + printfn "Resolved service: %A" resolvedService + 0 + + main () +#endif + + #if TESTS_AS_APP let RUN() = !failures #else diff --git a/tests/fsharp/core/quotes/test.fsx b/tests/fsharp/core/quotes/test.fsx index 35d1a057b45..39d2e4218ed 100644 --- a/tests/fsharp/core/quotes/test.fsx +++ b/tests/fsharp/core/quotes/test.fsx @@ -2912,7 +2912,7 @@ module ReflectionOverTypeInstantiations = let notRequired opname item = let msg = sprintf "The operation '%s' on item '%s' should not be called on provided type, member or parameter" opname item - System.Diagnostics.Debug.Assert (false, msg) + //System.Diagnostics.Debug.Assert (false, msg) raise (System.NotSupportedException msg) /// DO NOT ADJUST THIS TYPE - it is the implementation of symbol types from the F# type provider starer pack. diff --git a/tests/fsharp/single-test.fs b/tests/fsharp/single-test.fs index 31b26fa76cb..b2c6f77242a 100644 --- a/tests/fsharp/single-test.fs +++ b/tests/fsharp/single-test.fs @@ -9,6 +9,7 @@ open FSharp.Compiler.IO type Permutation = | FSC_CORECLR + | FSC_CORECLR_OPT_MINUS | FSC_CORECLR_BUILDONLY | FSI_CORECLR #if !NETCOREAPP @@ -304,6 +305,7 @@ let singleTestBuildAndRunCore cfg copyFiles p languageVersion = match p with | FSC_CORECLR -> executeSingleTestBuildAndRun OutputType.Exe "coreclr" "net5.0" true false + | FSC_CORECLR_OPT_MINUS -> executeSingleTestBuildAndRun OutputType.Exe "coreclr" "net5.0" false false | FSC_CORECLR_BUILDONLY -> executeSingleTestBuildAndRun OutputType.Exe "coreclr" "net5.0" true true | FSI_CORECLR -> executeSingleTestBuildAndRun OutputType.Script "coreclr" "net5.0" true false @@ -333,7 +335,7 @@ let singleTestBuildAndRunCore cfg copyFiles p languageVersion = source1 |> Option.iter (fun from -> copy_y cfg from "tmptest.fs") log "Generated signature file..." - fsc cfg "%s --sig:tmptest.fsi" cfg.fsc_flags ["tmptest.fs"] + fsc cfg "%s --sig:tmptest.fsi --define:GENERATED_SIGNATURE" cfg.fsc_flags ["tmptest.fs"] (if FileSystem.FileExistsShim("FSharp.Core.dll") then log "found fsharp.core.dll after build" else log "found fsharp.core.dll after build") |> ignore log "Compiling against generated signature file..." diff --git a/tests/fsharp/tests.fs b/tests/fsharp/tests.fs index 214fbc8e821..de6642c3964 100644 --- a/tests/fsharp/tests.fs +++ b/tests/fsharp/tests.fs @@ -21,10 +21,12 @@ open HandleExpects #if NETCOREAPP // Use these lines if you want to test CoreCLR let FSC_BASIC = FSC_CORECLR +let FSC_BASIC_OPT_MINUS = FSC_CORECLR_OPT_MINUS let FSC_BUILDONLY = FSC_CORECLR_BUILDONLY let FSI_BASIC = FSI_CORECLR #else let FSC_BASIC = FSC_OPT_PLUS_DEBUG +let FSC_BASIC_OPT_MINUS = FSC_OPT_MINUS_DEBUG let FSI_BASIC = FSI_FILE #endif // ^^^^^^^^^^^^ To run these tests in F# Interactive , 'build net40', then send this chunk, then evaluate body of a test ^^^^^^^^^^^^ @@ -37,99 +39,150 @@ let testConfig = getTestsDirectory >> testConfig [] module CoreTests = // These tests are enabled for .NET Framework and .NET Core + [] + let ``access-FSC_BASIC_OPT_MINUS``() = singleTestBuildAndRun "core/access" FSC_BASIC_OPT_MINUS + [] let ``access-FSC_BASIC``() = singleTestBuildAndRun "core/access" FSC_BASIC [] let ``access-FSI_BASIC``() = singleTestBuildAndRun "core/access" FSI_BASIC + [] + let ``apporder-FSC_BASIC_OPT_MINUS`` () = singleTestBuildAndRun "core/apporder" FSC_BASIC_OPT_MINUS + [] let ``apporder-FSC_BASIC`` () = singleTestBuildAndRun "core/apporder" FSC_BASIC [] let ``apporder-FSI_BASIC`` () = singleTestBuildAndRun "core/apporder" FSI_BASIC + [] + let ``array-FSC_BASIC_OPT_MINUS`` () = singleTestBuildAndRun "core/array" FSC_BASIC_OPT_MINUS + [] let ``array-FSC_BASIC`` () = singleTestBuildAndRun "core/array" FSC_BASIC [] let ``array-FSI_BASIC`` () = singleTestBuildAndRun "core/array" FSI_BASIC + [] + let ``comprehensions-FSC_BASIC_OPT_MINUS`` () = singleTestBuildAndRun "core/comprehensions" FSC_BASIC_OPT_MINUS + [] let ``comprehensions-FSC_BASIC`` () = singleTestBuildAndRun "core/comprehensions" FSC_BASIC [] let ``comprehensions-FSI_BASIC`` () = singleTestBuildAndRun "core/comprehensions" FSI_BASIC + [] + let ``comprehensionshw-FSC_BASIC_OPT_MINUS`` () = singleTestBuildAndRun "core/comprehensions-hw" FSC_BASIC_OPT_MINUS + [] let ``comprehensionshw-FSC_BASIC`` () = singleTestBuildAndRun "core/comprehensions-hw" FSC_BASIC [] let ``comprehensionshw-FSI_BASIC`` () = singleTestBuildAndRun "core/comprehensions-hw" FSI_BASIC + [] + let ``genericmeasures-FSC_BASIC_OPT_MINUS`` () = singleTestBuildAndRun "core/genericmeasures" FSC_BASIC_OPT_MINUS + [] let ``genericmeasures-FSC_BASIC`` () = singleTestBuildAndRun "core/genericmeasures" FSC_BASIC [] let ``genericmeasures-FSI_BASIC`` () = singleTestBuildAndRun "core/genericmeasures" FSI_BASIC + [] + let ``innerpoly-FSC_BASIC_OPT_MINUS`` () = singleTestBuildAndRun "core/innerpoly" FSC_BASIC_OPT_MINUS + [] let ``innerpoly-FSC_BASIC`` () = singleTestBuildAndRun "core/innerpoly" FSC_BASIC [] let ``innerpoly-FSI_BASIC`` () = singleTestBuildAndRun "core/innerpoly" FSI_BASIC + [] + let ``namespaceAttributes-FSC_BASIC_OPT_MINUS`` () = singleTestBuildAndRun "core/namespaces" FSC_BASIC_OPT_MINUS + [] let ``namespaceAttributes-FSC_BASIC`` () = singleTestBuildAndRun "core/namespaces" FSC_BASIC + [] + let ``unicode2-FSC_BASIC_OPT_MINUS`` () = singleTestBuildAndRun "core/unicode" FSC_BASIC_OPT_MINUS // TODO: fails on coreclr + [] let ``unicode2-FSC_BASIC`` () = singleTestBuildAndRun "core/unicode" FSC_BASIC // TODO: fails on coreclr [] let ``unicode2-FSI_BASIC`` () = singleTestBuildAndRun "core/unicode" FSI_BASIC + [] + let ``lazy test-FSC_BASIC_OPT_MINUS`` () = singleTestBuildAndRun "core/lazy" FSC_BASIC_OPT_MINUS + [] let ``lazy test-FSC_BASIC`` () = singleTestBuildAndRun "core/lazy" FSC_BASIC [] let ``lazy test-FSI_BASIC`` () = singleTestBuildAndRun "core/lazy" FSI_BASIC + [] + let ``letrec-FSC_BASIC_OPT_MINUS`` () = singleTestBuildAndRun "core/letrec" FSC_BASIC_OPT_MINUS + [] let ``letrec-FSC_BASIC`` () = singleTestBuildAndRun "core/letrec" FSC_BASIC [] let ``letrec-FSI_BASIC`` () = singleTestBuildAndRun "core/letrec" FSI_BASIC + [] + let ``letrec (mutrec variations part one) FSC_BASIC_OPT_MINUS`` () = singleTestBuildAndRun "core/letrec-mutrec" FSC_BASIC_OPT_MINUS + [] let ``letrec (mutrec variations part one) FSC_BASIC`` () = singleTestBuildAndRun "core/letrec-mutrec" FSC_BASIC [] let ``letrec (mutrec variations part one) FSI_BASIC`` () = singleTestBuildAndRun "core/letrec-mutrec" FSI_BASIC + [] + let ``libtest-FSC_BASIC_OPT_MINUS`` () = singleTestBuildAndRun "core/libtest" FSC_BASIC_OPT_MINUS + [] let ``libtest-FSC_BASIC`` () = singleTestBuildAndRun "core/libtest" FSC_BASIC [] let ``libtest-FSI_BASIC`` () = singleTestBuildAndRun "core/libtest" FSI_BASIC + [] + let ``lift-FSC_BASIC_OPT_MINUS`` () = singleTestBuildAndRun "core/lift" FSC_BASIC_OPT_MINUS + [] let ``lift-FSC_BASIC`` () = singleTestBuildAndRun "core/lift" FSC_BASIC [] let ``lift-FSI_BASIC`` () = singleTestBuildAndRun "core/lift" FSI_BASIC + [] + let ``map-FSC_BASIC_OPT_MINUS`` () = singleTestBuildAndRun "core/map" FSC_BASIC_OPT_MINUS + [] let ``map-FSC_BASIC`` () = singleTestBuildAndRun "core/map" FSC_BASIC [] let ``map-FSI_BASIC`` () = singleTestBuildAndRun "core/map" FSI_BASIC + [] + let ``measures-FSC_BASIC_OPT_MINUS`` () = singleTestBuildAndRun "core/measures" FSC_BASIC_OPT_MINUS + [] let ``measures-FSC_BASIC`` () = singleTestBuildAndRun "core/measures" FSC_BASIC [] let ``measures-FSI_BASIC`` () = singleTestBuildAndRun "core/measures" FSI_BASIC + [] + let ``nested-FSC_BASIC_OPT_MINUS`` () = singleTestBuildAndRun "core/nested" FSC_BASIC_OPT_MINUS + [] let ``nested-FSC_BASIC`` () = singleTestBuildAndRun "core/nested" FSC_BASIC @@ -139,15 +192,24 @@ module CoreTests = [] let ``members-ops-FSC_BASIC`` () = singleTestBuildAndRun "core/members/ops" FSC_BASIC + [] + let ``members-ops-FSC_BASIC_OPT_MINUS`` () = singleTestBuildAndRun "core/members/ops" FSC_BASIC_OPT_MINUS + [] let ``members-ops-FSI_BASIC`` () = singleTestBuildAndRun "core/members/ops" FSI_BASIC + [] + let ``members-ops-mutrec-FSC_BASIC_OPT_MINUS`` () = singleTestBuildAndRun "core/members/ops-mutrec" FSC_BASIC_OPT_MINUS + [] let ``members-ops-mutrec-FSC_BASIC`` () = singleTestBuildAndRun "core/members/ops-mutrec" FSC_BASIC [] let ``members-ops-mutrec-FSI_BASIC`` () = singleTestBuildAndRun "core/members/ops-mutrec" FSI_BASIC + [] + let ``seq-FSC_BASIC_OPT_MINUS`` () = singleTestBuildAndRun "core/seq" FSC_BASIC_OPT_MINUS + [] let ``seq-FSC_BASIC`` () = singleTestBuildAndRun "core/seq" FSC_BASIC @@ -160,36 +222,54 @@ module CoreTests = [] let ``math-numbers-FSI_BASIC`` () = singleTestBuildAndRun "core/math/numbers" FSI_BASIC + [] + let ``members-ctree-FSC_BASIC_OPT_MINUS`` () = singleTestBuildAndRun "core/members/ctree" FSC_BASIC_OPT_MINUS + [] let ``members-ctree-FSC_BASIC`` () = singleTestBuildAndRun "core/members/ctree" FSC_BASIC [] let ``members-ctree-FSI_BASIC`` () = singleTestBuildAndRun "core/members/ctree" FSI_BASIC + [] + let ``members-factors-FSC_BASIC_OPT_MINUS`` () = singleTestBuildAndRun "core/members/factors" FSC_BASIC_OPT_MINUS + [] let ``members-factors-FSC_BASIC`` () = singleTestBuildAndRun "core/members/factors" FSC_BASIC [] let ``members-factors-FSI_BASIC`` () = singleTestBuildAndRun "core/members/factors" FSI_BASIC + [] + let ``members-factors-mutrec-FSC_BASIC_OPT_MINUS`` () = singleTestBuildAndRun "core/members/factors-mutrec" FSC_BASIC_OPT_MINUS + [] let ``members-factors-mutrec-FSC_BASIC`` () = singleTestBuildAndRun "core/members/factors-mutrec" FSC_BASIC [] let ``members-factors-mutrec-FSI_BASIC`` () = singleTestBuildAndRun "core/members/factors-mutrec" FSI_BASIC + [] + let ``graph-FSC_BASIC_OPT_MINUS`` () = singleTestBuildAndRun "perf/graph" FSC_BASIC_OPT_MINUS + [] let ``graph-FSC_BASIC`` () = singleTestBuildAndRun "perf/graph" FSC_BASIC [] let ``graph-FSI_BASIC`` () = singleTestBuildAndRun "perf/graph" FSI_BASIC + [] + let ``nbody-FSC_BASIC_OPT_MINUS`` () = singleTestBuildAndRun "perf/nbody" FSC_BASIC_OPT_MINUS + [] let ``nbody-FSC_BASIC`` () = singleTestBuildAndRun "perf/nbody" FSC_BASIC [] let ``nbody-FSI_BASIC`` () = singleTestBuildAndRun "perf/nbody" FSI_BASIC + [] + let ``letrec (mutrec variations part two) FSC_BASIC_OPT_MINUS`` () = singleTestBuildAndRun "core/letrec-mutrec2" FSC_BASIC_OPT_MINUS + [] let ``letrec (mutrec variations part two) FSC_BASIC`` () = singleTestBuildAndRun "core/letrec-mutrec2" FSC_BASIC @@ -202,36 +282,54 @@ module CoreTests = [] let ``printf-interpolated`` () = singleTestBuildAndRunVersion "core/printf-interpolated" FSC_BASIC "preview" + [] + let ``tlr-FSC_BASIC_OPT_MINUS`` () = singleTestBuildAndRun "core/tlr" FSC_BASIC_OPT_MINUS + [] let ``tlr-FSC_BASIC`` () = singleTestBuildAndRun "core/tlr" FSC_BASIC [] let ``tlr-FSI_BASIC`` () = singleTestBuildAndRun "core/tlr" FSI_BASIC + [] + let ``subtype-FSC_BASIC_OPT_MINUS`` () = singleTestBuildAndRun "core/subtype" FSC_BASIC_OPT_MINUS + [] let ``subtype-FSC_BASIC`` () = singleTestBuildAndRun "core/subtype" FSC_BASIC [] let ``subtype-FSI_BASIC`` () = singleTestBuildAndRun "core/subtype" FSI_BASIC + [] + let ``syntax-FSC_BASIC_OPT_MINUS`` () = singleTestBuildAndRun "core/syntax" FSC_BASIC_OPT_MINUS + [] let ``syntax-FSC_BASIC`` () = singleTestBuildAndRun "core/syntax" FSC_BASIC [] let ``syntax-FSI_BASIC`` () = singleTestBuildAndRun "core/syntax" FSI_BASIC + [] + let ``test int32-FSC_BASIC_OPT_MINUS`` () = singleTestBuildAndRun "core/int32" FSC_BASIC_OPT_MINUS + [] let ``test int32-FSC_BASIC`` () = singleTestBuildAndRun "core/int32" FSC_BASIC [] let ``test int32-FSI_BASIC`` () = singleTestBuildAndRun "core/int32" FSI_BASIC + [] + let ``quotes-FSC-FSC_BASIC_OPT_MINUS`` () = singleTestBuildAndRun "core/quotes" FSC_BASIC_OPT_MINUS + [] let ``quotes-FSC-BASIC`` () = singleTestBuildAndRun "core/quotes" FSC_BASIC [] let ``quotes-FSI-BASIC`` () = singleTestBuildAndRun "core/quotes" FSI_BASIC + [] + let ``recordResolution-FSC_BASIC_OPT_MINUS`` () = singleTestBuildAndRun "core/recordResolution" FSC_BASIC_OPT_MINUS + [] let ``recordResolution-FSC_BASIC`` () = singleTestBuildAndRun "core/recordResolution" FSC_BASIC From 494c5a491e4dd7ade8c0d0eb2b3f5491e3aa3746 Mon Sep 17 00:00:00 2001 From: dotnet bot Date: Thu, 1 Jul 2021 13:07:58 -0700 Subject: [PATCH 36/42] Localized file check-in by OneLocBuild Task (#11766) --- src/fsharp/xlf/FSComp.txt.cs.xlf | 2 +- src/fsharp/xlf/FSComp.txt.it.xlf | 2 +- src/fsharp/xlf/FSComp.txt.pl.xlf | 2 +- src/fsharp/xlf/FSComp.txt.tr.xlf | 2 +- src/fsharp/xlf/FSComp.txt.zh-Hans.xlf | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/fsharp/xlf/FSComp.txt.cs.xlf b/src/fsharp/xlf/FSComp.txt.cs.xlf index 3e021f74a7c..f29bb41061c 100644 --- a/src/fsharp/xlf/FSComp.txt.cs.xlf +++ b/src/fsharp/xlf/FSComp.txt.cs.xlf @@ -94,7 +94,7 @@ attributes to the right of the 'module' keyword - attributes to the right of the 'module' keyword + atributy napravo od klíčového slova Module diff --git a/src/fsharp/xlf/FSComp.txt.it.xlf b/src/fsharp/xlf/FSComp.txt.it.xlf index a7a5694e5dc..189164ce3f9 100644 --- a/src/fsharp/xlf/FSComp.txt.it.xlf +++ b/src/fsharp/xlf/FSComp.txt.it.xlf @@ -94,7 +94,7 @@ attributes to the right of the 'module' keyword - attributes to the right of the 'module' keyword + attributi a destra della parola chiave 'module' diff --git a/src/fsharp/xlf/FSComp.txt.pl.xlf b/src/fsharp/xlf/FSComp.txt.pl.xlf index ed66a7e0e44..d0d617eada3 100644 --- a/src/fsharp/xlf/FSComp.txt.pl.xlf +++ b/src/fsharp/xlf/FSComp.txt.pl.xlf @@ -94,7 +94,7 @@ attributes to the right of the 'module' keyword - attributes to the right of the 'module' keyword + atrybuty po prawej stronie słowa kluczowego "module" diff --git a/src/fsharp/xlf/FSComp.txt.tr.xlf b/src/fsharp/xlf/FSComp.txt.tr.xlf index 6c6d0998d39..fbffea240aa 100644 --- a/src/fsharp/xlf/FSComp.txt.tr.xlf +++ b/src/fsharp/xlf/FSComp.txt.tr.xlf @@ -94,7 +94,7 @@ attributes to the right of the 'module' keyword - attributes to the right of the 'module' keyword + 'modül' anahtar sözcüğünün sağındaki öznitelikler diff --git a/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf b/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf index 783834718ef..0ee28c19e69 100644 --- a/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf @@ -94,7 +94,7 @@ attributes to the right of the 'module' keyword - attributes to the right of the 'module' keyword + "module" 关键字右侧的属性 From 9cbbf4c4b3e8e0e727f1a2f9d1bcf364b839e4a2 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Fri, 2 Jul 2021 17:25:14 +0100 Subject: [PATCH 37/42] Improve debugging of retail and inline code by not erasing locals and debug points intra-assembly (#11717) * improve debugging of retail code by not erasing locals and debug points intra-assembly * fix ranges for optimized code * fix baselines and range for immediate application of inline function * add manual debug stepping tests and fix test baselines * update baselines * prevent multiple top-level values with the same name * update baselines, add optimized version of codegen test Co-authored-by: Don Syme --- src/fsharp/DetupleArgs.fs | 4 +- src/fsharp/InnerLambdasToTopLevelFuncs.fs | 25 +- src/fsharp/Optimizer.fs | 69 +- src/fsharp/TypedTreeOps.fs | 2 +- tests/fsharp/typecheck/sigs/neg117.bsl | 2 +- .../Source/CodeGen/EmittedIL/CompareIL.cmd | 6 +- .../Linq101Grouping01.il.bsl | 6 +- .../Linq101SetOperators01.il.bsl | 8 +- .../ToplevelModule.il.bsl | 1671 ++++++++++- .../ToplevelModuleP.il.bsl | 1737 ----------- .../ToplevelNamespace.il.bsl | 2433 +++++++++++++++- .../ToplevelNamespaceP.il.bsl | 2529 ----------------- .../EmittedIL/SerializableAttribute/env.lst | 4 +- .../TestFunctions/TestFunction24.il.bsl | 48 +- .../EmittedIL/TestFunctions/TestFunction25.fs | 32 + .../TestFunctions/TestFunction25.il.bsl | 849 ++++++ .../CodeGen/EmittedIL/TestFunctions/env.lst | 1 + .../EmittedIL/Tuples/OptionalArg01.il.bsl | 30 +- .../EmittedIL/Tuples/TupleElimination.il.bsl | 14 +- .../Source/Optimizations/CompareIL.cmd | 6 +- .../TheBigFileOfDebugStepping.fsx | 62 + 21 files changed, 5184 insertions(+), 4354 deletions(-) delete mode 100644 tests/fsharpqa/Source/CodeGen/EmittedIL/SerializableAttribute/ToplevelModuleP.il.bsl delete mode 100644 tests/fsharpqa/Source/CodeGen/EmittedIL/SerializableAttribute/ToplevelNamespaceP.il.bsl create mode 100644 tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction25.fs create mode 100644 tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction25.il.bsl diff --git a/src/fsharp/DetupleArgs.fs b/src/fsharp/DetupleArgs.fs index 2ff48082fa5..609ab4c202f 100644 --- a/src/fsharp/DetupleArgs.fs +++ b/src/fsharp/DetupleArgs.fs @@ -715,7 +715,7 @@ let fixupApp (penv: penv) (fx, fty, tys, args, m) = // Is it a val app, where the val has a transform? match fx with - | Expr.Val (vref, _, m) -> + | Expr.Val (vref, _, vm) -> let f = vref.Deref match hasTransfrom penv f with | Some trans -> @@ -723,7 +723,7 @@ let fixupApp (penv: penv) (fx, fty, tys, args, m) = let callPattern = trans.transformCallPattern let transformedVal = trans.transformedVal let fCty = transformedVal.Type - let fCx = exprForVal m transformedVal + let fCx = exprForVal vm transformedVal (* [[f tps args ]] -> transformedVal tps [[COLLAPSED: args]] *) let env = {prefix = "arg";m = m;eg=penv.g} let bindings = [] diff --git a/src/fsharp/InnerLambdasToTopLevelFuncs.fs b/src/fsharp/InnerLambdasToTopLevelFuncs.fs index 7721d0ccbac..fb070b66176 100644 --- a/src/fsharp/InnerLambdasToTopLevelFuncs.fs +++ b/src/fsharp/InnerLambdasToTopLevelFuncs.fs @@ -967,13 +967,14 @@ module Pass4_RewriteAssembly = // pass4: lowertop - convert_vterm_bind on TopLevel binds //------------------------------------------------------------------------- - let ConvertBind g (TBind(v, repr, _) as bind) = + let AdjustBindToTopVal g (TBind(v, repr, _)) = match v.ValReprInfo with - | None -> v.SetValReprInfo (Some (InferArityOfExprBinding g AllowTypeDirectedDetupling.Yes v repr )) + | None -> + v.SetValReprInfo (Some (InferArityOfExprBinding g AllowTypeDirectedDetupling.Yes v repr )) + // Things that don't have an arity from type inference but are top-level are compiler-generated + v.SetIsCompilerGenerated(true) | Some _ -> () - bind - //------------------------------------------------------------------------- // pass4: transBind (translate) //------------------------------------------------------------------------- @@ -1035,6 +1036,9 @@ module Pass4_RewriteAssembly = | None -> List.empty // no env for this mutual binding | Some envp -> envp.ep_pack // environment pack bindings + let forceTopBindToHaveArity penv (bind: Binding) = + if penv.topValS.Contains(bind.Var) then AdjustBindToTopVal penv.g bind + let TransBindings xisRec penv (binds: Bindings) = let tlrBs, nonTlrBs = binds |> List.partition (fun b -> Zset.contains b.Var penv.tlrS) let fclass = BindingGroupSharingSameReqdItems tlrBs @@ -1045,12 +1049,9 @@ module Pass4_RewriteAssembly = // QUERY: we repeat this logic in LowerCallsAndSeqs. Do we really need to do this here? // QUERY: yes and no - if we don't, we have an unrealizable term, and many decisions must // QUERY: correlate with LowerCallsAndSeqs. - let forceTopBindToHaveArity (bind: Binding) = - if penv.topValS.Contains(bind.Var) then ConvertBind penv.g bind - else bind - let nonTlrBs = nonTlrBs |> List.map forceTopBindToHaveArity - let tlrRebinds = tlrRebinds |> List.map forceTopBindToHaveArity + nonTlrBs |> List.iter (forceTopBindToHaveArity penv) + tlrRebinds |> List.iter (forceTopBindToHaveArity penv) // assemble into replacement bindings let bindAs, rebinds = match xisRec with @@ -1067,7 +1068,7 @@ module Pass4_RewriteAssembly = // Is it a val app, where the val f is TLR with arity wf? // CLEANUP NOTE: should be using a mkApps to make all applications match fx with - | Expr.Val (fvref: ValRef, _, m) when + | Expr.Val (fvref: ValRef, _, vm) when (Zset.contains fvref.Deref penv.tlrS) && (let wf = Zmap.force fvref.Deref penv.arityM ("TransApp - wf", nameOfVal) IsArityMet fvref wf tys args) -> @@ -1078,9 +1079,9 @@ module Pass4_RewriteAssembly = let envp = Zmap.force fc penv.envPackM ("TransApp - envp", string) let fHat = Zmap.force f penv.fHatM ("TransApp - fHat", nameOfVal) let tys = (List.map mkTyparTy envp.ep_etps) @ tys - let aenvExprs = List.map (exprForVal m) envp.ep_aenvs + let aenvExprs = List.map (exprForVal vm) envp.ep_aenvs let args = aenvExprs @ args - mkApps penv.g ((exprForVal m fHat, fHat.Type), [tys], args, m) (* change, direct fHat call with closure (reqdTypars, aenvs) *) + mkApps penv.g ((exprForVal vm fHat, fHat.Type), [tys], args, m) (* change, direct fHat call with closure (reqdTypars, aenvs) *) | _ -> if isNil tys && isNil args then fx diff --git a/src/fsharp/Optimizer.fs b/src/fsharp/Optimizer.fs index d579077b081..6c61ca7985b 100644 --- a/src/fsharp/Optimizer.fs +++ b/src/fsharp/Optimizer.fs @@ -97,13 +97,13 @@ type ExprValueInfo = | ConstValue of Const * TType - /// CurriedLambdaValue(id, arity, size, lambdaExpression, ty) + /// CurriedLambdaValue(id, arity, size, lambdaExpression, isCrossAssembly, ty) /// /// arities: The number of bunches of untupled args and type args, and /// the number of args in each bunch. NOTE: This include type arguments. /// expr: The value, a lambda term. /// ty: The type of lambda term - | CurriedLambdaValue of id: Unique * arity: int * size: int * value: Expr * TType + | CurriedLambdaValue of id: Unique * arity: int * size: int * lambdaExpr: Expr * isCrossAssembly: bool * lambdaExprTy: TType /// ConstExprValue(size, value) | ConstExprValue of size: int * value: Expr @@ -202,7 +202,7 @@ let rec exprValueInfoL g exprVal = | TupleValue vinfos -> bracketL (exprValueInfosL g vinfos) | RecdValue (_, vinfos) -> braceL (exprValueInfosL g vinfos) | UnionCaseValue (ucr, vinfos) -> unionCaseRefL ucr ^^ bracketL (exprValueInfosL g vinfos) - | CurriedLambdaValue(_lambdaId, _arities, _bsize, expr, _ety) -> wordL (tagText "lam") ++ exprL expr (* (sprintf "lam(size=%d)" bsize) *) + | CurriedLambdaValue(_lambdaId, _arities, _bsize, expr, _isCrossAssembly, _ety) -> wordL (tagText "lam") ++ exprL expr (* (sprintf "lam(size=%d)" bsize) *) | ConstExprValue (_size, x) -> exprL x and exprValueInfosL g vinfos = commaListL (List.map (exprValueInfoL g) (Array.toList vinfos)) @@ -252,7 +252,7 @@ and SizeOfValueInfo x = | TupleValue vinfos | RecdValue (_, vinfos) | UnionCaseValue (_, vinfos) -> 1 + SizeOfValueInfos vinfos - | CurriedLambdaValue(_lambdaId, _arities, _bsize, _expr, _ety) -> 1 + | CurriedLambdaValue _ -> 1 | ConstExprValue (_size, _) -> 1 let [] minDepthForASizeNode = 5 // for small vinfos do not record size info, save space @@ -279,7 +279,7 @@ let BoundValueInfoBySize vinfo = | UnionCaseValue (ucr, vinfos) -> UnionCaseValue (ucr, Array.map (bound (depth-1)) vinfos) | ConstValue _ -> x | UnknownValue -> x - | CurriedLambdaValue(_lambdaId, _arities, _bsize, _expr, _ety) -> x + | CurriedLambdaValue _ -> x | ConstExprValue (_size, _) -> x let maxDepth = 6 (* beware huge constants! *) let trimDepth = 3 @@ -661,7 +661,7 @@ let (|StripConstValue|_|) ev = let (|StripLambdaValue|_|) ev = match stripValue ev with - | CurriedLambdaValue (id, arity, sz, expr, ty) -> Some (id, arity, sz, expr, ty) + | CurriedLambdaValue (id, arity, sz, expr, isCrossAssembly, ty) -> Some (id, arity, sz, expr, isCrossAssembly, ty) | _ -> None let destTupleValue ev = @@ -1064,7 +1064,7 @@ let AbstractLazyModulInfoByHiding isAssemblyBoundary mhi = else ValValue (vref2, detailR) // Check for escape in lambda - | CurriedLambdaValue (_, _, _, expr, _) | ConstExprValue(_, expr) when + | CurriedLambdaValue (_, _, _, expr, _, _) | ConstExprValue(_, expr) when (let fvs = freeInExpr CollectAll expr (isAssemblyBoundary && not (freeVarsAllPublic fvs)) || Zset.exists hiddenVal fvs.FreeLocals || @@ -1158,7 +1158,7 @@ let AbstractExprInfoByVars (boundVars: Val list, boundTyVars) ivalue = ValValue (v2, detailR) // Check for escape in lambda - | CurriedLambdaValue (_, _, _, expr, _) | ConstExprValue(_, expr) when + | CurriedLambdaValue (_, _, _, expr, _, _) | ConstExprValue(_, expr) when (let fvs = freeInExpr (if isNil boundTyVars then CollectLocals else CollectTyparsAndLocals) expr (not (isNil boundVars) && List.exists (Zset.memberOf fvs.FreeLocals) boundVars) || (not (isNil boundTyVars) && List.exists (Zset.memberOf fvs.FreeTyvars.FreeTypars) boundTyVars) || @@ -1207,7 +1207,7 @@ let RemapOptimizationInfo g tmenv = | UnionCaseValue(cspec, vinfos) -> UnionCaseValue (remapUnionCaseRef tmenv.tyconRefRemap cspec, Array.map remapExprInfo vinfos) | SizeValue(_vdepth, vinfo) -> MakeSizedValueInfo (remapExprInfo vinfo) | UnknownValue -> UnknownValue - | CurriedLambdaValue (uniq, arity, sz, expr, ty) -> CurriedLambdaValue (uniq, arity, sz, remapExpr g CloneAll tmenv expr, remapPossibleForallTy g tmenv ty) + | CurriedLambdaValue (uniq, arity, sz, expr, isCrossAssembly, ty) -> CurriedLambdaValue (uniq, arity, sz, remapExpr g CloneAll tmenv expr, isCrossAssembly, remapPossibleForallTy g tmenv ty) | ConstValue (c, ty) -> ConstValue (c, remapPossibleForallTy g tmenv ty) | ConstExprValue (sz, expr) -> ConstExprValue (sz, remapExpr g CloneAll tmenv expr) @@ -2557,6 +2557,17 @@ and OptimizeTraitCall cenv env (traitInfo, args, m) = let argsR, arginfos = OptimizeExprsThenConsiderSplits cenv env args OptimizeExprOpFallback cenv env (TOp.TraitCall traitInfo, [], argsR, m) arginfos UnknownValue +and CopyExprForInlining cenv isCrossAssembly expr m = + if isCrossAssembly then + // Debug points are erased when doing cross-assembly inlining + // Locals are marked compiler generated when doing cross-assembly inlining + expr + |> copyExpr cenv.g CloneAllAndMarkExprValsAsCompilerGenerated + |> remarkExpr m + else + expr + |> copyExpr cenv.g CloneAll + /// Make optimization decisions once we know the optimization information /// for a value and TryOptimizeVal cenv env (vOpt: ValRef option, mustInline, valInfoForVal, m) = @@ -2579,9 +2590,10 @@ and TryOptimizeVal cenv env (vOpt: ValRef option, mustInline, valInfoForVal, m) // If we have proven 'v = compilerGeneratedValue' // and 'v' is being eliminated in favour of 'compilerGeneratedValue' // then replace the name of 'compilerGeneratedValue' - // by 'v' and mark it not compiler generated so we preserve good debugging and names + // by 'v' and mark it not compiler generated so we preserve good debugging and names. + // Don't do this for things represented statically as it may publish multiple values with the same name. match vOpt with - | Some v when not v.IsCompilerGenerated && vR.IsCompilerGenerated -> + | Some v when not v.IsCompilerGenerated && vR.IsCompilerGenerated && not vR.IsCompiledAsTopLevel && not v.IsCompiledAsTopLevel -> vR.Deref.SetIsCompilerGenerated(false) vR.Deref.SetLogicalName(v.LogicalName) | _ -> () @@ -2590,8 +2602,9 @@ and TryOptimizeVal cenv env (vOpt: ValRef option, mustInline, valInfoForVal, m) | ConstExprValue(_size, expr) -> Some (remarkExpr m (copyExpr cenv.g CloneAllAndMarkExprValsAsCompilerGenerated expr)) - | CurriedLambdaValue (_, _, _, expr, _) when mustInline -> - Some (remarkExpr m (copyExpr cenv.g CloneAllAndMarkExprValsAsCompilerGenerated expr)) + | CurriedLambdaValue (_, _, _, expr, isCrossAssembly, _) when mustInline -> + let exprCopy = CopyExprForInlining cenv isCrossAssembly expr m + Some exprCopy | TupleValue _ | UnionCaseValue _ | RecdValue _ when mustInline -> failwith "tuple, union and record values cannot be marked 'inline'" @@ -2887,7 +2900,7 @@ and TryDevirtualizeApplication cenv env (f, tyargs, args, m) = and TryInlineApplication cenv env finfo (tyargs: TType list, args: Expr list, m) = // Considering inlining app match finfo.Info with - | StripLambdaValue (lambdaId, arities, size, f2, f2ty) when + | StripLambdaValue (lambdaId, arities, size, f2, isCrossAssembly, f2ty) when (// Considering inlining lambda cenv.optimizing && cenv.settings.InlineLambdas () && @@ -2948,7 +2961,8 @@ and TryInlineApplication cenv env finfo (tyargs: TType list, args: Expr list, m) // Inlining lambda (* ---------- printf "Inlining lambda near %a = %s\n" outputRange m (showL (exprL f2)) (* JAMES: *) ----------*) - let f2R = remarkExpr m (copyExpr cenv.g CloneAllAndMarkExprValsAsCompilerGenerated f2) + let f2R = CopyExprForInlining cenv isCrossAssembly f2 m + // Optimizing arguments after inlining // REVIEW: this is a cheapshot way of optimizing the arg expressions as well without the restriction of recursive @@ -2962,6 +2976,16 @@ and TryInlineApplication cenv env finfo (tyargs: TType list, args: Expr list, m) | _ -> None +/// When optimizing a function in an application, use the whole range including arguments for the range +/// to apply to 'inline' code +and OptimizeFuncInApplication cenv env f0 mWithArgs = + let f0 = stripExpr f0 + match f0 with + | Expr.Val (v, _vFlags, _) -> + OptimizeVal cenv env f0 (v, mWithArgs) + | _ -> + OptimizeExpr cenv env f0 + /// Optimize/analyze an application of a function to type and term arguments and OptimizeApplication cenv env (f0, f0ty, tyargs, args, m) = // trying to devirtualize @@ -2970,7 +2994,7 @@ and OptimizeApplication cenv env (f0, f0ty, tyargs, args, m) = // devirtualized res | None -> - let newf0, finfo = OptimizeExpr cenv env f0 + let newf0, finfo = OptimizeFuncInApplication cenv env f0 m match TryInlineApplication cenv env finfo (tyargs, args, m) with | Some res -> // inlined @@ -3086,14 +3110,14 @@ and OptimizeLambdas (vspec: Val option) cenv env topValInfo e ety = // can't inline any values with semi-recursive object references to self or base let valu = match baseValOpt with - | None -> CurriedLambdaValue (lambdaId, arities, bsize, exprR, ety) + | None -> CurriedLambdaValue (lambdaId, arities, bsize, exprR, false, ety) | Some baseVal -> let fvs = freeInExpr CollectLocals bodyR if fvs.UsesMethodLocalConstructs || fvs.FreeLocals.Contains baseVal then UnknownValue else let expr2 = mkMemberLambdas m tps ctorThisValOpt None vsl (bodyR, bodyty) - CurriedLambdaValue (lambdaId, arities, bsize, expr2, ety) + CurriedLambdaValue (lambdaId, arities, bsize, expr2, false, ety) let estimatedSize = match vspec with @@ -3323,7 +3347,7 @@ and OptimizeBinding cenv isRec env (TBind(vref, expr, spBind)) = // Trim out optimization information for expressions that call protected members let rec cut ivalue = match ivalue with - | CurriedLambdaValue (_, arities, size, body, _) -> + | CurriedLambdaValue (_, arities, size, body, _, _) -> if size > (cenv.settings.lambdaInlineThreshold + arities + 2) then // Discarding lambda for large binding UnknownValue @@ -3600,7 +3624,7 @@ let rec p_ExprValueInfo x st = | UnionCaseValue (a, b) -> p_byte 4 st p_tup2 p_ucref (p_array p_ExprValueInfo) (a, b) st - | CurriedLambdaValue (_, b, c, d, e) -> + | CurriedLambdaValue (_, b, c, d, _isCrossAssembly, e) -> p_byte 5 st p_tup4 p_int p_int p_expr p_ty (b, c, d, e) st | ConstExprValue (a, b) -> @@ -3635,11 +3659,12 @@ let rec u_ExprInfo st = | 2 -> u_tup2 u_vref loop st |> (fun (a, b) -> ValValue (a, b)) | 3 -> u_array loop st |> (fun a -> TupleValue a) | 4 -> u_tup2 u_ucref (u_array loop) st |> (fun (a, b) -> UnionCaseValue (a, b)) - | 5 -> u_tup4 u_int u_int u_expr u_ty st |> (fun (b, c, d, e) -> CurriedLambdaValue (newUnique(), b, c, d, e)) + | 5 -> u_tup4 u_int u_int u_expr u_ty st |> (fun (b, c, d, e) -> CurriedLambdaValue (newUnique(), b, c, d, (* isCrossAssembly *) true, e)) | 6 -> u_tup2 u_int u_expr st |> (fun (a, b) -> ConstExprValue (a, b)) | 7 -> u_tup2 u_tcref (u_array loop) st |> (fun (a, b) -> RecdValue (a, b)) | _ -> failwith "loop" - MakeSizedValueInfo (loop st) (* calc size of unpicked ExprValueInfo *) + // calc size of unpicked ExprValueInfo + MakeSizedValueInfo (loop st) and u_ValInfo st = let a, b = u_tup2 u_ExprInfo u_bool st diff --git a/src/fsharp/TypedTreeOps.fs b/src/fsharp/TypedTreeOps.fs index 8ddaa5e7e17..9fd50c3f059 100644 --- a/src/fsharp/TypedTreeOps.fs +++ b/src/fsharp/TypedTreeOps.fs @@ -7539,7 +7539,7 @@ let rec MakeApplicationAndBetaReduceAux g (f, fty, tyargsl: TType list list, arg match f with | Expr.TyLambda (_, tyvs, body, _, bodyty) when tyvs.Length = List.length tyargs -> let tpenv = bindTypars tyvs tyargs emptyTyparInst - let body = remarkExpr m (instExpr g tpenv body) + let body = instExpr g tpenv body let bodyty' = instType tpenv bodyty MakeApplicationAndBetaReduceAux g (body, bodyty', rest, argsl, m) diff --git a/tests/fsharp/typecheck/sigs/neg117.bsl b/tests/fsharp/typecheck/sigs/neg117.bsl index 9ad81d0003f..2c8fbee14c0 100644 --- a/tests/fsharp/typecheck/sigs/neg117.bsl +++ b/tests/fsharp/typecheck/sigs/neg117.bsl @@ -1,5 +1,5 @@ -neg117.fs(79,18,79,59): ilxgen error FS0041: No overloads match for method 'Transform'. +neg117.fs(74,51,74,121): ilxgen error FS0041: No overloads match for method 'Transform'. Known return type: ('a -> Neg117.TargetA.M1 Microsoft.FSharp.Core.[]) diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/CompareIL.cmd b/tests/fsharpqa/Source/CodeGen/EmittedIL/CompareIL.cmd index 0e3c4acf219..ea97cebadcb 100644 --- a/tests/fsharpqa/Source/CodeGen/EmittedIL/CompareIL.cmd +++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/CompareIL.cmd @@ -1,15 +1,17 @@ REM == %1 --> assembly ildasm /TEXT /LINENUM /NOBAR "%~nx1" >"%~n1.il" -IF NOT ERRORLEVEL 0 exit 1 +IF %ERRORLEVEL% NEQ 0 exit /b 1 echo %~dp0..\..\..\testenv\bin\ILComparer.exe "%~n1.il.bsl" "%~n1.il" %~dp0..\..\..\testenv\bin\ILComparer.exe "%~n1.il.bsl" "%~n1.il" +IF %ERRORLEVEL% EQU 0 exit /b 0 + if /i "%TEST_UPDATE_BSL%" == "1" ( echo copy /y "%~n1.il" "%~n1.il.bsl" copy /y "%~n1.il" "%~n1.il.bsl" ) -exit /b %ERRORLEVEL% +exit /b 1 diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Grouping01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Grouping01.il.bsl index e5bad87d725..38346254e8f 100644 --- a/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Grouping01.il.bsl +++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101Grouping01.il.bsl @@ -50,13 +50,13 @@ // Offset: 0x00000408 Length: 0x00000129 } .module Linq101Grouping01.exe -// MVID: {60B78A59-FB79-E5BF-A745-0383598AB760} +// MVID: {60D46F1F-FB79-E5BF-A745-03831F6FD460} .imagebase 0x00400000 .file alignment 0x00000200 .stackreserve 0x00100000 .subsystem 0x0003 // WINDOWS_CUI .corflags 0x00000001 // ILONLY -// Image base: 0x06730000 +// Image base: 0x05800000 // =============== CLASS MEMBERS DECLARATION =================== @@ -371,7 +371,7 @@ { // Code size 8 (0x8) .maxstack 8 - .line 25,25 : 24,25 '' + .line 25,25 : 23,28 '' IL_0000: ldarg.1 IL_0001: ldc.i4.0 IL_0002: callvirt instance char [netstandard]System.String::get_Chars(int32) diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101SetOperators01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101SetOperators01.il.bsl index 02331dbae8c..baba5ea96e7 100644 --- a/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101SetOperators01.il.bsl +++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Linq101SetOperators01.il.bsl @@ -45,13 +45,13 @@ // Offset: 0x00000390 Length: 0x0000011E } .module Linq101SetOperators01.exe -// MVID: {60B78A59-4EE5-349F-A745-0383598AB760} +// MVID: {60D46F1F-4EE5-349F-A745-03831F6FD460} .imagebase 0x00400000 .file alignment 0x00000200 .stackreserve 0x00100000 .subsystem 0x0003 // WINDOWS_CUI .corflags 0x00000001 // ILONLY -// Image base: 0x06940000 +// Image base: 0x04FA0000 // =============== CLASS MEMBERS DECLARATION =================== @@ -846,7 +846,7 @@ IL_0057: ldfld class [mscorlib]System.Collections.Generic.IEnumerator`1 Linq101SetOperators01/productFirstChars@33::'enum' IL_005c: callvirt instance !0 class [mscorlib]System.Collections.Generic.IEnumerator`1::get_Current() IL_0061: stloc.0 - .line 33,33 : 29,30 '' + .line 33,33 : 16,33 '' IL_0062: ldarg.0 IL_0063: ldc.i4.2 IL_0064: stfld int32 Linq101SetOperators01/productFirstChars@33::pc @@ -1196,7 +1196,7 @@ IL_0057: ldfld class [mscorlib]System.Collections.Generic.IEnumerator`1 Linq101SetOperators01/customerFirstChars@39::'enum' IL_005c: callvirt instance !0 class [mscorlib]System.Collections.Generic.IEnumerator`1::get_Current() IL_0061: stloc.0 - .line 39,39 : 29,30 '' + .line 39,39 : 16,33 '' IL_0062: ldarg.0 IL_0063: ldc.i4.2 IL_0064: stfld int32 Linq101SetOperators01/customerFirstChars@39::pc diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/SerializableAttribute/ToplevelModule.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/SerializableAttribute/ToplevelModule.il.bsl index bf83c61d107..e4ab112f177 100644 --- a/tests/fsharpqa/Source/CodeGen/EmittedIL/SerializableAttribute/ToplevelModule.il.bsl +++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/SerializableAttribute/ToplevelModule.il.bsl @@ -1,4 +1,1673 @@ -// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0 +// Microsoft (R) .NET Framework IL Disassembler. Version 4.8.3928.0 // Copyright (c) Microsoft Corporation. All rights reserved. + + +// Metadata version: v4.0.30319 +.assembly extern mscorlib +{ + .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. + .ver 4:0:0:0 +} +.assembly extern FSharp.Core +{ + .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) // .?_....: + .ver 5:0:0:0 +} +.assembly TopLevelModule +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, + int32, + int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) + + // --- The following custom attribute is added automatically, do not uncomment ------- + // .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 01 01 00 00 00 00 ) + + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.TopLevelModule +{ + // Offset: 0x00000000 Length: 0x0000113D +} +.mresource public FSharpOptimizationData.TopLevelModule +{ + // Offset: 0x00001148 Length: 0x000003FD +} +.module TopLevelModule.dll +// MVID: {60D4892F-37F5-C118-A745-03832F89D460} +.imagebase 0x00400000 +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 // WINDOWS_CUI +.corflags 0x00000001 // ILONLY +// Image base: 0x06F60000 + + +// =============== CLASS MEMBERS DECLARATION =================== + +.class public abstract auto ansi sealed ABC + extends [mscorlib]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .class auto autochar serializable sealed nested public beforefieldinit Expr + extends [mscorlib]System.Object + implements class [mscorlib]System.IEquatable`1, + [mscorlib]System.Collections.IStructuralEquatable, + class [mscorlib]System.IComparable`1, + [mscorlib]System.IComparable, + [mscorlib]System.Collections.IStructuralComparable + { + .custom instance void [mscorlib]System.Diagnostics.DebuggerDisplayAttribute::.ctor(string) = ( 01 00 15 7B 5F 5F 44 65 62 75 67 44 69 73 70 6C // ...{__DebugDispl + 61 79 28 29 2C 6E 71 7D 00 00 ) // ay(),nq}.. + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 01 00 00 00 00 00 ) + .field assembly initonly int32 item + .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public static class ABC/Expr + NewNum(int32 item) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 08 00 00 00 00 00 00 00 00 00 ) + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: newobj instance void ABC/Expr::.ctor(int32) + IL_0006: ret + } // end of method Expr::NewNum + + .method assembly specialname rtspecialname + instance void .ctor(int32 item) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 14 (0xe) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld int32 ABC/Expr::item + IL_000d: ret + } // end of method Expr::.ctor + + .method public hidebysig instance int32 + get_Item() cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld int32 ABC/Expr::item + IL_0006: ret + } // end of method Expr::get_Item + + .method public hidebysig instance int32 + get_Tag() cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 4 (0x4) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: pop + IL_0002: ldc.i4.0 + IL_0003: ret + } // end of method Expr::get_Tag + + .method assembly hidebysig specialname + instance object __DebugDisplay() cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 22 (0x16) + .maxstack 8 + IL_0000: ldstr "%+0.8A" + IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,string>::.ctor(string) + IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatToString>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_000f: ldarg.0 + IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0015: ret + } // end of method Expr::__DebugDisplay + + .method public strict virtual instance string + ToString() cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 22 (0x16) + .maxstack 8 + IL_0000: ldstr "%+A" + IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,class ABC/Expr>::.ctor(string) + IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatToString>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_000f: ldarg.0 + IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0015: ret + } // end of method Expr::ToString + + .method public hidebysig virtual final + instance int32 CompareTo(class ABC/Expr obj) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 64 (0x40) + .maxstack 4 + .locals init ([0] class ABC/Expr V_0, + [1] class ABC/Expr V_1, + [2] class [mscorlib]System.Collections.IComparer V_2, + [3] int32 V_3, + [4] int32 V_4) + .language '{AB4F38C9-B6E6-43BA-BE3B-58080B2CCCE3}', '{994B45C4-E6E9-11D2-903F-00C04FA302A1}', '{5A869D0B-6611-11D3-BD2A-0000F80849BD}' + .line 100001,100001 : 0,0 'C:\\GitHub\\dsyme\\fsharp\\tests\\fsharpqa\\source\\CodeGen\\EmittedIL\\SerializableAttribute\\ToplevelModule.fs' + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: cgt.un + IL_0004: brfalse.s IL_0036 + + .line 100001,100001 : 0,0 '' + IL_0006: ldarg.1 + IL_0007: ldnull + IL_0008: cgt.un + IL_000a: brfalse.s IL_0034 + + .line 100001,100001 : 0,0 '' + IL_000c: ldarg.0 + IL_000d: pop + .line 100001,100001 : 0,0 '' + IL_000e: ldarg.0 + IL_000f: stloc.0 + IL_0010: ldarg.1 + IL_0011: stloc.1 + IL_0012: call class [mscorlib]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() + IL_0017: stloc.2 + IL_0018: ldloc.0 + IL_0019: ldfld int32 ABC/Expr::item + IL_001e: stloc.3 + IL_001f: ldloc.1 + IL_0020: ldfld int32 ABC/Expr::item + IL_0025: stloc.s V_4 + IL_0027: ldloc.3 + IL_0028: ldloc.s V_4 + IL_002a: bge.s IL_002e + + .line 100001,100001 : 0,0 '' + IL_002c: ldc.i4.m1 + IL_002d: ret + + .line 100001,100001 : 0,0 '' + IL_002e: ldloc.3 + IL_002f: ldloc.s V_4 + IL_0031: cgt + IL_0033: ret + + .line 100001,100001 : 0,0 '' + IL_0034: ldc.i4.1 + IL_0035: ret + + .line 100001,100001 : 0,0 '' + IL_0036: ldarg.1 + IL_0037: ldnull + IL_0038: cgt.un + IL_003a: brfalse.s IL_003e + + .line 100001,100001 : 0,0 '' + IL_003c: ldc.i4.m1 + IL_003d: ret + + .line 100001,100001 : 0,0 '' + IL_003e: ldc.i4.0 + IL_003f: ret + } // end of method Expr::CompareTo + + .method public hidebysig virtual final + instance int32 CompareTo(object obj) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 13 (0xd) + .maxstack 8 + .line 6,6 : 14,18 '' + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: unbox.any ABC/Expr + IL_0007: callvirt instance int32 ABC/Expr::CompareTo(class ABC/Expr) + IL_000c: ret + } // end of method Expr::CompareTo + + .method public hidebysig virtual final + instance int32 CompareTo(object obj, + class [mscorlib]System.Collections.IComparer comp) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 80 (0x50) + .maxstack 4 + .locals init ([0] class ABC/Expr V_0, + [1] class ABC/Expr V_1, + [2] class ABC/Expr V_2, + [3] class [mscorlib]System.Collections.IComparer V_3, + [4] int32 V_4, + [5] int32 V_5) + .line 6,6 : 14,18 '' + IL_0000: ldarg.1 + IL_0001: unbox.any ABC/Expr + IL_0006: stloc.0 + IL_0007: ldarg.0 + IL_0008: ldnull + IL_0009: cgt.un + IL_000b: brfalse.s IL_0041 + + .line 100001,100001 : 0,0 '' + IL_000d: ldarg.1 + IL_000e: unbox.any ABC/Expr + IL_0013: ldnull + IL_0014: cgt.un + IL_0016: brfalse.s IL_003f + + .line 100001,100001 : 0,0 '' + IL_0018: ldarg.0 + IL_0019: pop + .line 100001,100001 : 0,0 '' + IL_001a: ldarg.0 + IL_001b: stloc.1 + IL_001c: ldloc.0 + IL_001d: stloc.2 + IL_001e: ldarg.2 + IL_001f: stloc.3 + IL_0020: ldloc.1 + IL_0021: ldfld int32 ABC/Expr::item + IL_0026: stloc.s V_4 + IL_0028: ldloc.2 + IL_0029: ldfld int32 ABC/Expr::item + IL_002e: stloc.s V_5 + IL_0030: ldloc.s V_4 + IL_0032: ldloc.s V_5 + IL_0034: bge.s IL_0038 + + .line 100001,100001 : 0,0 '' + IL_0036: ldc.i4.m1 + IL_0037: ret + + .line 100001,100001 : 0,0 '' + IL_0038: ldloc.s V_4 + IL_003a: ldloc.s V_5 + IL_003c: cgt + IL_003e: ret + + .line 100001,100001 : 0,0 '' + IL_003f: ldc.i4.1 + IL_0040: ret + + .line 100001,100001 : 0,0 '' + IL_0041: ldarg.1 + IL_0042: unbox.any ABC/Expr + IL_0047: ldnull + IL_0048: cgt.un + IL_004a: brfalse.s IL_004e + + .line 100001,100001 : 0,0 '' + IL_004c: ldc.i4.m1 + IL_004d: ret + + .line 100001,100001 : 0,0 '' + IL_004e: ldc.i4.0 + IL_004f: ret + } // end of method Expr::CompareTo + + .method public hidebysig virtual final + instance int32 GetHashCode(class [mscorlib]System.Collections.IEqualityComparer comp) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 41 (0x29) + .maxstack 7 + .locals init ([0] int32 V_0, + [1] class ABC/Expr V_1, + [2] class [mscorlib]System.Collections.IEqualityComparer V_2) + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: cgt.un + IL_0004: brfalse.s IL_0027 + + .line 100001,100001 : 0,0 '' + IL_0006: ldc.i4.0 + IL_0007: stloc.0 + IL_0008: ldarg.0 + IL_0009: pop + .line 100001,100001 : 0,0 '' + IL_000a: ldarg.0 + IL_000b: stloc.1 + IL_000c: ldc.i4.0 + IL_000d: stloc.0 + IL_000e: ldc.i4 0x9e3779b9 + IL_0013: ldarg.1 + IL_0014: stloc.2 + IL_0015: ldloc.1 + IL_0016: ldfld int32 ABC/Expr::item + IL_001b: ldloc.0 + IL_001c: ldc.i4.6 + IL_001d: shl + IL_001e: ldloc.0 + IL_001f: ldc.i4.2 + IL_0020: shr + IL_0021: add + IL_0022: add + IL_0023: add + IL_0024: stloc.0 + IL_0025: ldloc.0 + IL_0026: ret + + .line 100001,100001 : 0,0 '' + IL_0027: ldc.i4.0 + IL_0028: ret + } // end of method Expr::GetHashCode + + .method public hidebysig virtual final + instance int32 GetHashCode() cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 12 (0xc) + .maxstack 8 + .line 6,6 : 14,18 '' + IL_0000: ldarg.0 + IL_0001: call class [mscorlib]System.Collections.IEqualityComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericEqualityComparer() + IL_0006: callvirt instance int32 ABC/Expr::GetHashCode(class [mscorlib]System.Collections.IEqualityComparer) + IL_000b: ret + } // end of method Expr::GetHashCode + + .method public hidebysig virtual final + instance bool Equals(object obj, + class [mscorlib]System.Collections.IEqualityComparer comp) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 52 (0x34) + .maxstack 4 + .locals init ([0] class ABC/Expr V_0, + [1] class ABC/Expr V_1, + [2] class ABC/Expr V_2, + [3] class ABC/Expr V_3, + [4] class [mscorlib]System.Collections.IEqualityComparer V_4) + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: cgt.un + IL_0004: brfalse.s IL_002c + + .line 100001,100001 : 0,0 '' + IL_0006: ldarg.1 + IL_0007: isinst ABC/Expr + IL_000c: stloc.0 + IL_000d: ldloc.0 + IL_000e: brfalse.s IL_002a + + .line 100001,100001 : 0,0 '' + IL_0010: ldloc.0 + IL_0011: stloc.1 + IL_0012: ldarg.0 + IL_0013: pop + .line 100001,100001 : 0,0 '' + IL_0014: ldarg.0 + IL_0015: stloc.2 + IL_0016: ldloc.1 + IL_0017: stloc.3 + IL_0018: ldarg.2 + IL_0019: stloc.s V_4 + IL_001b: ldloc.2 + IL_001c: ldfld int32 ABC/Expr::item + IL_0021: ldloc.3 + IL_0022: ldfld int32 ABC/Expr::item + IL_0027: ceq + IL_0029: ret + + .line 100001,100001 : 0,0 '' + IL_002a: ldc.i4.0 + IL_002b: ret + + .line 100001,100001 : 0,0 '' + IL_002c: ldarg.1 + IL_002d: ldnull + IL_002e: cgt.un + IL_0030: ldc.i4.0 + IL_0031: ceq + IL_0033: ret + } // end of method Expr::Equals + + .method public hidebysig virtual final + instance bool Equals(class ABC/Expr obj) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 43 (0x2b) + .maxstack 4 + .locals init ([0] class ABC/Expr V_0, + [1] class ABC/Expr V_1) + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: cgt.un + IL_0004: brfalse.s IL_0023 + + .line 100001,100001 : 0,0 '' + IL_0006: ldarg.1 + IL_0007: ldnull + IL_0008: cgt.un + IL_000a: brfalse.s IL_0021 + + .line 100001,100001 : 0,0 '' + IL_000c: ldarg.0 + IL_000d: pop + .line 100001,100001 : 0,0 '' + IL_000e: ldarg.0 + IL_000f: stloc.0 + IL_0010: ldarg.1 + IL_0011: stloc.1 + IL_0012: ldloc.0 + IL_0013: ldfld int32 ABC/Expr::item + IL_0018: ldloc.1 + IL_0019: ldfld int32 ABC/Expr::item + IL_001e: ceq + IL_0020: ret + + .line 100001,100001 : 0,0 '' + IL_0021: ldc.i4.0 + IL_0022: ret + + .line 100001,100001 : 0,0 '' + IL_0023: ldarg.1 + IL_0024: ldnull + IL_0025: cgt.un + IL_0027: ldc.i4.0 + IL_0028: ceq + IL_002a: ret + } // end of method Expr::Equals + + .method public hidebysig virtual final + instance bool Equals(object obj) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 20 (0x14) + .maxstack 4 + .locals init ([0] class ABC/Expr V_0) + .line 6,6 : 14,18 '' + IL_0000: ldarg.1 + IL_0001: isinst ABC/Expr + IL_0006: stloc.0 + IL_0007: ldloc.0 + IL_0008: brfalse.s IL_0012 + + .line 100001,100001 : 0,0 '' + IL_000a: ldarg.0 + IL_000b: ldloc.0 + IL_000c: callvirt instance bool ABC/Expr::Equals(class ABC/Expr) + IL_0011: ret + + .line 100001,100001 : 0,0 '' + IL_0012: ldc.i4.0 + IL_0013: ret + } // end of method Expr::Equals + + .property instance int32 Tag() + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .get instance int32 ABC/Expr::get_Tag() + } // end of property Expr::Tag + .property instance int32 Item() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32, + int32) = ( 01 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance int32 ABC/Expr::get_Item() + } // end of property Expr::Item + } // end of class Expr + + .class auto ansi serializable nested public beforefieldinit MyExn + extends [mscorlib]System.Exception + implements [mscorlib]System.Collections.IStructuralEquatable + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 05 00 00 00 00 00 ) + .field assembly int32 Data0@ + .method public specialname rtspecialname + instance void .ctor(int32 data0) cil managed + { + // Code size 14 (0xe) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Exception::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld int32 ABC/MyExn::Data0@ + IL_000d: ret + } // end of method MyExn::.ctor + + .method public specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Exception::.ctor() + IL_0006: ret + } // end of method MyExn::.ctor + + .method family specialname rtspecialname + instance void .ctor(class [mscorlib]System.Runtime.Serialization.SerializationInfo info, + valuetype [mscorlib]System.Runtime.Serialization.StreamingContext context) cil managed + { + // Code size 9 (0x9) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: ldarg.2 + IL_0003: call instance void [mscorlib]System.Exception::.ctor(class [mscorlib]System.Runtime.Serialization.SerializationInfo, + valuetype [mscorlib]System.Runtime.Serialization.StreamingContext) + IL_0008: ret + } // end of method MyExn::.ctor + + .method public hidebysig specialname + instance int32 get_Data0() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld int32 ABC/MyExn::Data0@ + IL_0006: ret + } // end of method MyExn::get_Data0 + + .method public hidebysig virtual instance int32 + GetHashCode(class [mscorlib]System.Collections.IEqualityComparer comp) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 40 (0x28) + .maxstack 7 + .locals init ([0] int32 V_0, + [1] class [mscorlib]System.Collections.IEqualityComparer V_1) + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: cgt.un + IL_0004: brfalse.s IL_0026 + + .line 100001,100001 : 0,0 '' + IL_0006: ldc.i4.0 + IL_0007: stloc.0 + IL_0008: ldc.i4 0x9e3779b9 + IL_000d: ldarg.1 + IL_000e: stloc.1 + IL_000f: ldarg.0 + IL_0010: castclass ABC/MyExn + IL_0015: call instance int32 ABC/MyExn::get_Data0() + IL_001a: ldloc.0 + IL_001b: ldc.i4.6 + IL_001c: shl + IL_001d: ldloc.0 + IL_001e: ldc.i4.2 + IL_001f: shr + IL_0020: add + IL_0021: add + IL_0022: add + IL_0023: stloc.0 + IL_0024: ldloc.0 + IL_0025: ret + + .line 100001,100001 : 0,0 '' + IL_0026: ldc.i4.0 + IL_0027: ret + } // end of method MyExn::GetHashCode + + .method public hidebysig virtual instance int32 + GetHashCode() cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 12 (0xc) + .maxstack 8 + .line 7,7 : 19,24 '' + IL_0000: ldarg.0 + IL_0001: call class [mscorlib]System.Collections.IEqualityComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericEqualityComparer() + IL_0006: callvirt instance int32 ABC/MyExn::GetHashCode(class [mscorlib]System.Collections.IEqualityComparer) + IL_000b: ret + } // end of method MyExn::GetHashCode + + .method public hidebysig virtual instance bool + Equals(object obj, + class [mscorlib]System.Collections.IEqualityComparer comp) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 67 (0x43) + .maxstack 4 + .locals init ([0] class [mscorlib]System.Exception V_0, + [1] class [mscorlib]System.Exception V_1, + [2] class [mscorlib]System.Collections.IEqualityComparer V_2) + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: cgt.un + IL_0004: brfalse.s IL_003b + + .line 100001,100001 : 0,0 '' + IL_0006: ldarg.1 + IL_0007: isinst [mscorlib]System.Exception + IL_000c: stloc.0 + IL_000d: ldloc.0 + IL_000e: brfalse.s IL_0039 + + .line 100001,100001 : 0,0 '' + IL_0010: ldloc.0 + IL_0011: stloc.1 + IL_0012: ldloc.0 + IL_0013: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::TypeTestGeneric(object) + IL_0018: brtrue.s IL_001c + + IL_001a: br.s IL_0037 + + .line 100001,100001 : 0,0 '' + IL_001c: ldarg.2 + IL_001d: stloc.2 + IL_001e: ldarg.0 + IL_001f: castclass ABC/MyExn + IL_0024: call instance int32 ABC/MyExn::get_Data0() + IL_0029: ldloc.1 + IL_002a: castclass ABC/MyExn + IL_002f: call instance int32 ABC/MyExn::get_Data0() + IL_0034: ceq + IL_0036: ret + + .line 100001,100001 : 0,0 '' + IL_0037: ldc.i4.0 + IL_0038: ret + + .line 100001,100001 : 0,0 '' + IL_0039: ldc.i4.0 + IL_003a: ret + + .line 100001,100001 : 0,0 '' + IL_003b: ldarg.1 + IL_003c: ldnull + IL_003d: cgt.un + IL_003f: ldc.i4.0 + IL_0040: ceq + IL_0042: ret + } // end of method MyExn::Equals + + .method public hidebysig instance bool + Equals(class [mscorlib]System.Exception obj) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 59 (0x3b) + .maxstack 8 + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: cgt.un + IL_0004: brfalse.s IL_0033 + + .line 100001,100001 : 0,0 '' + IL_0006: ldarg.1 + IL_0007: ldnull + IL_0008: cgt.un + IL_000a: brfalse.s IL_0031 + + .line 100001,100001 : 0,0 '' + IL_000c: ldarg.1 + IL_000d: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::TypeTestGeneric(object) + IL_0012: brtrue.s IL_0016 + + IL_0014: br.s IL_002f + + .line 100001,100001 : 0,0 '' + IL_0016: ldarg.0 + IL_0017: castclass ABC/MyExn + IL_001c: call instance int32 ABC/MyExn::get_Data0() + IL_0021: ldarg.1 + IL_0022: castclass ABC/MyExn + IL_0027: call instance int32 ABC/MyExn::get_Data0() + IL_002c: ceq + IL_002e: ret + + .line 100001,100001 : 0,0 '' + IL_002f: ldc.i4.0 + IL_0030: ret + + .line 100001,100001 : 0,0 '' + IL_0031: ldc.i4.0 + IL_0032: ret + + .line 100001,100001 : 0,0 '' + IL_0033: ldarg.1 + IL_0034: ldnull + IL_0035: cgt.un + IL_0037: ldc.i4.0 + IL_0038: ceq + IL_003a: ret + } // end of method MyExn::Equals + + .method public hidebysig virtual instance bool + Equals(object obj) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 20 (0x14) + .maxstack 4 + .locals init ([0] class [mscorlib]System.Exception V_0) + .line 7,7 : 19,24 '' + IL_0000: ldarg.1 + IL_0001: isinst [mscorlib]System.Exception + IL_0006: stloc.0 + IL_0007: ldloc.0 + IL_0008: brfalse.s IL_0012 + + .line 100001,100001 : 0,0 '' + IL_000a: ldarg.0 + IL_000b: ldloc.0 + IL_000c: callvirt instance bool ABC/MyExn::Equals(class [mscorlib]System.Exception) + IL_0011: ret + + .line 100001,100001 : 0,0 '' + IL_0012: ldc.i4.0 + IL_0013: ret + } // end of method MyExn::Equals + + .property instance int32 Data0() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 04 00 00 00 00 00 00 00 00 00 ) + .get instance int32 ABC/MyExn::get_Data0() + } // end of property MyExn::Data0 + } // end of class MyExn + + .class auto ansi serializable nested public A + extends [mscorlib]System.Object + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) + .field assembly string x + .method public specialname rtspecialname + instance void .ctor(string x) cil managed + { + // Code size 16 (0x10) + .maxstack 8 + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: callvirt instance void [mscorlib]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: pop + .line 8,8 : 16,17 '' + IL_0008: ldarg.0 + IL_0009: ldarg.1 + IL_000a: stfld string ABC/A::x + .line 8,8 : 14,15 '' + IL_000f: ret + } // end of method A::.ctor + + .method public hidebysig specialname + instance string get_X() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + .line 8,8 : 42,43 '' + IL_0000: ldarg.0 + IL_0001: ldfld string ABC/A::x + IL_0006: ret + } // end of method A::get_X + + .property instance string X() + { + .get instance string ABC/A::get_X() + } // end of property A::X + } // end of class A + + .class abstract auto ansi sealed nested public ABC + extends [mscorlib]System.Object + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .class auto autochar serializable sealed nested public beforefieldinit Expr + extends [mscorlib]System.Object + implements class [mscorlib]System.IEquatable`1, + [mscorlib]System.Collections.IStructuralEquatable, + class [mscorlib]System.IComparable`1, + [mscorlib]System.IComparable, + [mscorlib]System.Collections.IStructuralComparable + { + .custom instance void [mscorlib]System.Diagnostics.DebuggerDisplayAttribute::.ctor(string) = ( 01 00 15 7B 5F 5F 44 65 62 75 67 44 69 73 70 6C // ...{__DebugDispl + 61 79 28 29 2C 6E 71 7D 00 00 ) // ay(),nq}.. + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 01 00 00 00 00 00 ) + .field assembly initonly int32 item + .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public static class ABC/ABC/Expr + NewNum(int32 item) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 08 00 00 00 00 00 00 00 00 00 ) + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: newobj instance void ABC/ABC/Expr::.ctor(int32) + IL_0006: ret + } // end of method Expr::NewNum + + .method assembly specialname rtspecialname + instance void .ctor(int32 item) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 14 (0xe) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld int32 ABC/ABC/Expr::item + IL_000d: ret + } // end of method Expr::.ctor + + .method public hidebysig instance int32 + get_Item() cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld int32 ABC/ABC/Expr::item + IL_0006: ret + } // end of method Expr::get_Item + + .method public hidebysig instance int32 + get_Tag() cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 4 (0x4) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: pop + IL_0002: ldc.i4.0 + IL_0003: ret + } // end of method Expr::get_Tag + + .method assembly hidebysig specialname + instance object __DebugDisplay() cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 22 (0x16) + .maxstack 8 + IL_0000: ldstr "%+0.8A" + IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,string>::.ctor(string) + IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatToString>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_000f: ldarg.0 + IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0015: ret + } // end of method Expr::__DebugDisplay + + .method public strict virtual instance string + ToString() cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 22 (0x16) + .maxstack 8 + IL_0000: ldstr "%+A" + IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,class ABC/ABC/Expr>::.ctor(string) + IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatToString>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_000f: ldarg.0 + IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0015: ret + } // end of method Expr::ToString + + .method public hidebysig virtual final + instance int32 CompareTo(class ABC/ABC/Expr obj) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 64 (0x40) + .maxstack 4 + .locals init ([0] class ABC/ABC/Expr V_0, + [1] class ABC/ABC/Expr V_1, + [2] class [mscorlib]System.Collections.IComparer V_2, + [3] int32 V_3, + [4] int32 V_4) + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: cgt.un + IL_0004: brfalse.s IL_0036 + + .line 100001,100001 : 0,0 '' + IL_0006: ldarg.1 + IL_0007: ldnull + IL_0008: cgt.un + IL_000a: brfalse.s IL_0034 + + .line 100001,100001 : 0,0 '' + IL_000c: ldarg.0 + IL_000d: pop + .line 100001,100001 : 0,0 '' + IL_000e: ldarg.0 + IL_000f: stloc.0 + IL_0010: ldarg.1 + IL_0011: stloc.1 + IL_0012: call class [mscorlib]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() + IL_0017: stloc.2 + IL_0018: ldloc.0 + IL_0019: ldfld int32 ABC/ABC/Expr::item + IL_001e: stloc.3 + IL_001f: ldloc.1 + IL_0020: ldfld int32 ABC/ABC/Expr::item + IL_0025: stloc.s V_4 + IL_0027: ldloc.3 + IL_0028: ldloc.s V_4 + IL_002a: bge.s IL_002e + + .line 100001,100001 : 0,0 '' + IL_002c: ldc.i4.m1 + IL_002d: ret + + .line 100001,100001 : 0,0 '' + IL_002e: ldloc.3 + IL_002f: ldloc.s V_4 + IL_0031: cgt + IL_0033: ret + + .line 100001,100001 : 0,0 '' + IL_0034: ldc.i4.1 + IL_0035: ret + + .line 100001,100001 : 0,0 '' + IL_0036: ldarg.1 + IL_0037: ldnull + IL_0038: cgt.un + IL_003a: brfalse.s IL_003e + + .line 100001,100001 : 0,0 '' + IL_003c: ldc.i4.m1 + IL_003d: ret + + .line 100001,100001 : 0,0 '' + IL_003e: ldc.i4.0 + IL_003f: ret + } // end of method Expr::CompareTo + + .method public hidebysig virtual final + instance int32 CompareTo(object obj) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 13 (0xd) + .maxstack 8 + .line 16,16 : 18,22 '' + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: unbox.any ABC/ABC/Expr + IL_0007: callvirt instance int32 ABC/ABC/Expr::CompareTo(class ABC/ABC/Expr) + IL_000c: ret + } // end of method Expr::CompareTo + + .method public hidebysig virtual final + instance int32 CompareTo(object obj, + class [mscorlib]System.Collections.IComparer comp) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 80 (0x50) + .maxstack 4 + .locals init ([0] class ABC/ABC/Expr V_0, + [1] class ABC/ABC/Expr V_1, + [2] class ABC/ABC/Expr V_2, + [3] class [mscorlib]System.Collections.IComparer V_3, + [4] int32 V_4, + [5] int32 V_5) + .line 16,16 : 18,22 '' + IL_0000: ldarg.1 + IL_0001: unbox.any ABC/ABC/Expr + IL_0006: stloc.0 + IL_0007: ldarg.0 + IL_0008: ldnull + IL_0009: cgt.un + IL_000b: brfalse.s IL_0041 + + .line 100001,100001 : 0,0 '' + IL_000d: ldarg.1 + IL_000e: unbox.any ABC/ABC/Expr + IL_0013: ldnull + IL_0014: cgt.un + IL_0016: brfalse.s IL_003f + + .line 100001,100001 : 0,0 '' + IL_0018: ldarg.0 + IL_0019: pop + .line 100001,100001 : 0,0 '' + IL_001a: ldarg.0 + IL_001b: stloc.1 + IL_001c: ldloc.0 + IL_001d: stloc.2 + IL_001e: ldarg.2 + IL_001f: stloc.3 + IL_0020: ldloc.1 + IL_0021: ldfld int32 ABC/ABC/Expr::item + IL_0026: stloc.s V_4 + IL_0028: ldloc.2 + IL_0029: ldfld int32 ABC/ABC/Expr::item + IL_002e: stloc.s V_5 + IL_0030: ldloc.s V_4 + IL_0032: ldloc.s V_5 + IL_0034: bge.s IL_0038 + + .line 100001,100001 : 0,0 '' + IL_0036: ldc.i4.m1 + IL_0037: ret + + .line 100001,100001 : 0,0 '' + IL_0038: ldloc.s V_4 + IL_003a: ldloc.s V_5 + IL_003c: cgt + IL_003e: ret + + .line 100001,100001 : 0,0 '' + IL_003f: ldc.i4.1 + IL_0040: ret + + .line 100001,100001 : 0,0 '' + IL_0041: ldarg.1 + IL_0042: unbox.any ABC/ABC/Expr + IL_0047: ldnull + IL_0048: cgt.un + IL_004a: brfalse.s IL_004e + + .line 100001,100001 : 0,0 '' + IL_004c: ldc.i4.m1 + IL_004d: ret + + .line 100001,100001 : 0,0 '' + IL_004e: ldc.i4.0 + IL_004f: ret + } // end of method Expr::CompareTo + + .method public hidebysig virtual final + instance int32 GetHashCode(class [mscorlib]System.Collections.IEqualityComparer comp) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 41 (0x29) + .maxstack 7 + .locals init ([0] int32 V_0, + [1] class ABC/ABC/Expr V_1, + [2] class [mscorlib]System.Collections.IEqualityComparer V_2) + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: cgt.un + IL_0004: brfalse.s IL_0027 + + .line 100001,100001 : 0,0 '' + IL_0006: ldc.i4.0 + IL_0007: stloc.0 + IL_0008: ldarg.0 + IL_0009: pop + .line 100001,100001 : 0,0 '' + IL_000a: ldarg.0 + IL_000b: stloc.1 + IL_000c: ldc.i4.0 + IL_000d: stloc.0 + IL_000e: ldc.i4 0x9e3779b9 + IL_0013: ldarg.1 + IL_0014: stloc.2 + IL_0015: ldloc.1 + IL_0016: ldfld int32 ABC/ABC/Expr::item + IL_001b: ldloc.0 + IL_001c: ldc.i4.6 + IL_001d: shl + IL_001e: ldloc.0 + IL_001f: ldc.i4.2 + IL_0020: shr + IL_0021: add + IL_0022: add + IL_0023: add + IL_0024: stloc.0 + IL_0025: ldloc.0 + IL_0026: ret + + .line 100001,100001 : 0,0 '' + IL_0027: ldc.i4.0 + IL_0028: ret + } // end of method Expr::GetHashCode + + .method public hidebysig virtual final + instance int32 GetHashCode() cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 12 (0xc) + .maxstack 8 + .line 16,16 : 18,22 '' + IL_0000: ldarg.0 + IL_0001: call class [mscorlib]System.Collections.IEqualityComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericEqualityComparer() + IL_0006: callvirt instance int32 ABC/ABC/Expr::GetHashCode(class [mscorlib]System.Collections.IEqualityComparer) + IL_000b: ret + } // end of method Expr::GetHashCode + + .method public hidebysig virtual final + instance bool Equals(object obj, + class [mscorlib]System.Collections.IEqualityComparer comp) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 52 (0x34) + .maxstack 4 + .locals init ([0] class ABC/ABC/Expr V_0, + [1] class ABC/ABC/Expr V_1, + [2] class ABC/ABC/Expr V_2, + [3] class ABC/ABC/Expr V_3, + [4] class [mscorlib]System.Collections.IEqualityComparer V_4) + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: cgt.un + IL_0004: brfalse.s IL_002c + + .line 100001,100001 : 0,0 '' + IL_0006: ldarg.1 + IL_0007: isinst ABC/ABC/Expr + IL_000c: stloc.0 + IL_000d: ldloc.0 + IL_000e: brfalse.s IL_002a + + .line 100001,100001 : 0,0 '' + IL_0010: ldloc.0 + IL_0011: stloc.1 + IL_0012: ldarg.0 + IL_0013: pop + .line 100001,100001 : 0,0 '' + IL_0014: ldarg.0 + IL_0015: stloc.2 + IL_0016: ldloc.1 + IL_0017: stloc.3 + IL_0018: ldarg.2 + IL_0019: stloc.s V_4 + IL_001b: ldloc.2 + IL_001c: ldfld int32 ABC/ABC/Expr::item + IL_0021: ldloc.3 + IL_0022: ldfld int32 ABC/ABC/Expr::item + IL_0027: ceq + IL_0029: ret + + .line 100001,100001 : 0,0 '' + IL_002a: ldc.i4.0 + IL_002b: ret + + .line 100001,100001 : 0,0 '' + IL_002c: ldarg.1 + IL_002d: ldnull + IL_002e: cgt.un + IL_0030: ldc.i4.0 + IL_0031: ceq + IL_0033: ret + } // end of method Expr::Equals + + .method public hidebysig virtual final + instance bool Equals(class ABC/ABC/Expr obj) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 43 (0x2b) + .maxstack 4 + .locals init ([0] class ABC/ABC/Expr V_0, + [1] class ABC/ABC/Expr V_1) + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: cgt.un + IL_0004: brfalse.s IL_0023 + + .line 100001,100001 : 0,0 '' + IL_0006: ldarg.1 + IL_0007: ldnull + IL_0008: cgt.un + IL_000a: brfalse.s IL_0021 + + .line 100001,100001 : 0,0 '' + IL_000c: ldarg.0 + IL_000d: pop + .line 100001,100001 : 0,0 '' + IL_000e: ldarg.0 + IL_000f: stloc.0 + IL_0010: ldarg.1 + IL_0011: stloc.1 + IL_0012: ldloc.0 + IL_0013: ldfld int32 ABC/ABC/Expr::item + IL_0018: ldloc.1 + IL_0019: ldfld int32 ABC/ABC/Expr::item + IL_001e: ceq + IL_0020: ret + + .line 100001,100001 : 0,0 '' + IL_0021: ldc.i4.0 + IL_0022: ret + + .line 100001,100001 : 0,0 '' + IL_0023: ldarg.1 + IL_0024: ldnull + IL_0025: cgt.un + IL_0027: ldc.i4.0 + IL_0028: ceq + IL_002a: ret + } // end of method Expr::Equals + + .method public hidebysig virtual final + instance bool Equals(object obj) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 20 (0x14) + .maxstack 4 + .locals init ([0] class ABC/ABC/Expr V_0) + .line 16,16 : 18,22 '' + IL_0000: ldarg.1 + IL_0001: isinst ABC/ABC/Expr + IL_0006: stloc.0 + IL_0007: ldloc.0 + IL_0008: brfalse.s IL_0012 + + .line 100001,100001 : 0,0 '' + IL_000a: ldarg.0 + IL_000b: ldloc.0 + IL_000c: callvirt instance bool ABC/ABC/Expr::Equals(class ABC/ABC/Expr) + IL_0011: ret + + .line 100001,100001 : 0,0 '' + IL_0012: ldc.i4.0 + IL_0013: ret + } // end of method Expr::Equals + + .property instance int32 Tag() + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .get instance int32 ABC/ABC/Expr::get_Tag() + } // end of property Expr::Tag + .property instance int32 Item() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32, + int32) = ( 01 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance int32 ABC/ABC/Expr::get_Item() + } // end of property Expr::Item + } // end of class Expr + + .class auto ansi serializable nested public beforefieldinit MyExn + extends [mscorlib]System.Exception + implements [mscorlib]System.Collections.IStructuralEquatable + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 05 00 00 00 00 00 ) + .field assembly int32 Data0@ + .method public specialname rtspecialname + instance void .ctor(int32 data0) cil managed + { + // Code size 14 (0xe) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Exception::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld int32 ABC/ABC/MyExn::Data0@ + IL_000d: ret + } // end of method MyExn::.ctor + + .method public specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Exception::.ctor() + IL_0006: ret + } // end of method MyExn::.ctor + + .method family specialname rtspecialname + instance void .ctor(class [mscorlib]System.Runtime.Serialization.SerializationInfo info, + valuetype [mscorlib]System.Runtime.Serialization.StreamingContext context) cil managed + { + // Code size 9 (0x9) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: ldarg.2 + IL_0003: call instance void [mscorlib]System.Exception::.ctor(class [mscorlib]System.Runtime.Serialization.SerializationInfo, + valuetype [mscorlib]System.Runtime.Serialization.StreamingContext) + IL_0008: ret + } // end of method MyExn::.ctor + + .method public hidebysig specialname + instance int32 get_Data0() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld int32 ABC/ABC/MyExn::Data0@ + IL_0006: ret + } // end of method MyExn::get_Data0 + + .method public hidebysig virtual instance int32 + GetHashCode(class [mscorlib]System.Collections.IEqualityComparer comp) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 40 (0x28) + .maxstack 7 + .locals init ([0] int32 V_0, + [1] class [mscorlib]System.Collections.IEqualityComparer V_1) + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: cgt.un + IL_0004: brfalse.s IL_0026 + + .line 100001,100001 : 0,0 '' + IL_0006: ldc.i4.0 + IL_0007: stloc.0 + IL_0008: ldc.i4 0x9e3779b9 + IL_000d: ldarg.1 + IL_000e: stloc.1 + IL_000f: ldarg.0 + IL_0010: castclass ABC/ABC/MyExn + IL_0015: call instance int32 ABC/ABC/MyExn::get_Data0() + IL_001a: ldloc.0 + IL_001b: ldc.i4.6 + IL_001c: shl + IL_001d: ldloc.0 + IL_001e: ldc.i4.2 + IL_001f: shr + IL_0020: add + IL_0021: add + IL_0022: add + IL_0023: stloc.0 + IL_0024: ldloc.0 + IL_0025: ret + + .line 100001,100001 : 0,0 '' + IL_0026: ldc.i4.0 + IL_0027: ret + } // end of method MyExn::GetHashCode + + .method public hidebysig virtual instance int32 + GetHashCode() cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 12 (0xc) + .maxstack 8 + .line 17,17 : 23,28 '' + IL_0000: ldarg.0 + IL_0001: call class [mscorlib]System.Collections.IEqualityComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericEqualityComparer() + IL_0006: callvirt instance int32 ABC/ABC/MyExn::GetHashCode(class [mscorlib]System.Collections.IEqualityComparer) + IL_000b: ret + } // end of method MyExn::GetHashCode + + .method public hidebysig virtual instance bool + Equals(object obj, + class [mscorlib]System.Collections.IEqualityComparer comp) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 67 (0x43) + .maxstack 4 + .locals init ([0] class [mscorlib]System.Exception V_0, + [1] class [mscorlib]System.Exception V_1, + [2] class [mscorlib]System.Collections.IEqualityComparer V_2) + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: cgt.un + IL_0004: brfalse.s IL_003b + + .line 100001,100001 : 0,0 '' + IL_0006: ldarg.1 + IL_0007: isinst [mscorlib]System.Exception + IL_000c: stloc.0 + IL_000d: ldloc.0 + IL_000e: brfalse.s IL_0039 + + .line 100001,100001 : 0,0 '' + IL_0010: ldloc.0 + IL_0011: stloc.1 + IL_0012: ldloc.0 + IL_0013: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::TypeTestGeneric(object) + IL_0018: brtrue.s IL_001c + + IL_001a: br.s IL_0037 + + .line 100001,100001 : 0,0 '' + IL_001c: ldarg.2 + IL_001d: stloc.2 + IL_001e: ldarg.0 + IL_001f: castclass ABC/ABC/MyExn + IL_0024: call instance int32 ABC/ABC/MyExn::get_Data0() + IL_0029: ldloc.1 + IL_002a: castclass ABC/ABC/MyExn + IL_002f: call instance int32 ABC/ABC/MyExn::get_Data0() + IL_0034: ceq + IL_0036: ret + + .line 100001,100001 : 0,0 '' + IL_0037: ldc.i4.0 + IL_0038: ret + + .line 100001,100001 : 0,0 '' + IL_0039: ldc.i4.0 + IL_003a: ret + + .line 100001,100001 : 0,0 '' + IL_003b: ldarg.1 + IL_003c: ldnull + IL_003d: cgt.un + IL_003f: ldc.i4.0 + IL_0040: ceq + IL_0042: ret + } // end of method MyExn::Equals + + .method public hidebysig instance bool + Equals(class [mscorlib]System.Exception obj) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 59 (0x3b) + .maxstack 8 + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: cgt.un + IL_0004: brfalse.s IL_0033 + + .line 100001,100001 : 0,0 '' + IL_0006: ldarg.1 + IL_0007: ldnull + IL_0008: cgt.un + IL_000a: brfalse.s IL_0031 + + .line 100001,100001 : 0,0 '' + IL_000c: ldarg.1 + IL_000d: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::TypeTestGeneric(object) + IL_0012: brtrue.s IL_0016 + + IL_0014: br.s IL_002f + + .line 100001,100001 : 0,0 '' + IL_0016: ldarg.0 + IL_0017: castclass ABC/ABC/MyExn + IL_001c: call instance int32 ABC/ABC/MyExn::get_Data0() + IL_0021: ldarg.1 + IL_0022: castclass ABC/ABC/MyExn + IL_0027: call instance int32 ABC/ABC/MyExn::get_Data0() + IL_002c: ceq + IL_002e: ret + + .line 100001,100001 : 0,0 '' + IL_002f: ldc.i4.0 + IL_0030: ret + + .line 100001,100001 : 0,0 '' + IL_0031: ldc.i4.0 + IL_0032: ret + + .line 100001,100001 : 0,0 '' + IL_0033: ldarg.1 + IL_0034: ldnull + IL_0035: cgt.un + IL_0037: ldc.i4.0 + IL_0038: ceq + IL_003a: ret + } // end of method MyExn::Equals + + .method public hidebysig virtual instance bool + Equals(object obj) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 20 (0x14) + .maxstack 4 + .locals init ([0] class [mscorlib]System.Exception V_0) + .line 17,17 : 23,28 '' + IL_0000: ldarg.1 + IL_0001: isinst [mscorlib]System.Exception + IL_0006: stloc.0 + IL_0007: ldloc.0 + IL_0008: brfalse.s IL_0012 + + .line 100001,100001 : 0,0 '' + IL_000a: ldarg.0 + IL_000b: ldloc.0 + IL_000c: callvirt instance bool ABC/ABC/MyExn::Equals(class [mscorlib]System.Exception) + IL_0011: ret + + .line 100001,100001 : 0,0 '' + IL_0012: ldc.i4.0 + IL_0013: ret + } // end of method MyExn::Equals + + .property instance int32 Data0() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 04 00 00 00 00 00 00 00 00 00 ) + .get instance int32 ABC/ABC/MyExn::get_Data0() + } // end of property MyExn::Data0 + } // end of class MyExn + + .class auto ansi serializable nested public A + extends [mscorlib]System.Object + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) + .field assembly string x + .method public specialname rtspecialname + instance void .ctor(string x) cil managed + { + // Code size 16 (0x10) + .maxstack 8 + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: callvirt instance void [mscorlib]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: pop + .line 18,18 : 20,21 '' + IL_0008: ldarg.0 + IL_0009: ldarg.1 + IL_000a: stfld string ABC/ABC/A::x + .line 18,18 : 18,19 '' + IL_000f: ret + } // end of method A::.ctor + + .method public hidebysig specialname + instance string get_X() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + .line 18,18 : 46,47 '' + IL_0000: ldarg.0 + IL_0001: ldfld string ABC/ABC/A::x + IL_0006: ret + } // end of method A::get_X + + .property instance string X() + { + .get instance string ABC/ABC/A::get_X() + } // end of property A::X + } // end of class A + + .method public static int32 'add'(int32 x, + int32 y) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + // Code size 4 (0x4) + .maxstack 8 + .line 21,21 : 27,32 '' + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: add + IL_0003: ret + } // end of method ABC::'add' + + .method public specialname static string + get_greeting() cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 6 (0x6) + .maxstack 8 + IL_0000: ldstr "hello" + IL_0005: ret + } // end of method ABC::get_greeting + + .property string greeting() + { + .get string ABC/ABC::get_greeting() + } // end of property ABC::greeting + } // end of class ABC + + .method public static int32 'add'(int32 x, + int32 y) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + // Code size 4 (0x4) + .maxstack 8 + .line 11,11 : 23,28 '' + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: add + IL_0003: ret + } // end of method ABC::'add' + + .method public specialname static string + get_greeting() cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 6 (0x6) + .maxstack 8 + IL_0000: ldstr "hello" + IL_0005: ret + } // end of method ABC::get_greeting + + .property string greeting() + { + .get string ABC::get_greeting() + } // end of property ABC::greeting +} // end of class ABC + +.class private abstract auto ansi sealed ''.$ABC + extends [mscorlib]System.Object +{ + .field static assembly int32 init@ + .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static + void .cctor() cil managed + { + // Code size 13 (0xd) + .maxstack 3 + .locals init ([0] string greeting, + [1] string V_1) + .line 12,12 : 9,31 '' + IL_0000: call string ABC::get_greeting() + IL_0005: stloc.0 + .line 22,22 : 13,35 '' + IL_0006: call string ABC/ABC::get_greeting() + IL_000b: stloc.1 + IL_000c: ret + } // end of method $ABC::.cctor + +} // end of class ''.$ABC + + +// ============================================================= + +// *********** DISASSEMBLY COMPLETE *********************** diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/SerializableAttribute/ToplevelModuleP.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/SerializableAttribute/ToplevelModuleP.il.bsl deleted file mode 100644 index 771eaa3d503..00000000000 --- a/tests/fsharpqa/Source/CodeGen/EmittedIL/SerializableAttribute/ToplevelModuleP.il.bsl +++ /dev/null @@ -1,1737 +0,0 @@ - -// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.81.0 -// Copyright (c) Microsoft Corporation. All rights reserved. - - - -// Metadata version: v4.0.30319 -.assembly extern retargetable mscorlib -{ - .publickeytoken = (7C EC 85 D7 BE A7 79 8E ) // |.....y. - .ver 2:0:5:0 -} -.assembly extern FSharp.Core -{ - .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) // .?_....: - .ver 3:47:41:0 -} -.assembly ToplevelModuleP -{ - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, - int32, - int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) - - // --- The following custom attribute is added automatically, do not uncomment ------- - // .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 00 01 00 00 00 00 ) - - .hash algorithm 0x00008004 - .ver 0:0:0:0 -} -.mresource public FSharpSignatureData.ToplevelModuleP -{ - // Offset: 0x00000000 Length: 0x0000114F -} -.mresource public FSharpOptimizationData.ToplevelModuleP -{ - // Offset: 0x00001158 Length: 0x000003FE -} -.module ToplevelModuleP.dll -// MVID: {576266E1-5A3A-8E4D-A745-0383E1666257} -.imagebase 0x00400000 -.file alignment 0x00000200 -.stackreserve 0x00100000 -.subsystem 0x0003 // WINDOWS_CUI -.corflags 0x00000001 // ILONLY -// Image base: 0x00A70000 - - -// =============== CLASS MEMBERS DECLARATION =================== - -.class public abstract auto ansi sealed ABC - extends [mscorlib]System.Object -{ - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) - .class auto autochar sealed nested public beforefieldinit Expr - extends [mscorlib]System.Object - implements class [mscorlib]System.IEquatable`1, - [mscorlib]System.Collections.IStructuralEquatable, - class [mscorlib]System.IComparable`1, - [mscorlib]System.IComparable, - [mscorlib]System.Collections.IStructuralComparable - { - .custom instance void [mscorlib]System.Diagnostics.DebuggerDisplayAttribute::.ctor(string) = ( 01 00 15 7B 5F 5F 44 65 62 75 67 44 69 73 70 6C // ...{__DebugDispl - 61 79 28 29 2C 6E 71 7D 00 00 ) // ay(),nq}.. - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 01 00 00 00 00 00 ) - .field assembly initonly int32 item - .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method public static class ABC/Expr - NewNum(int32 item) cil managed - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, - int32) = ( 01 00 08 00 00 00 00 00 00 00 00 00 ) - // Code size 7 (0x7) - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: newobj instance void ABC/Expr::.ctor(int32) - IL_0006: ret - } // end of method Expr::NewNum - - .method assembly specialname rtspecialname - instance void .ctor(int32 item) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 14 (0xe) - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void [mscorlib]System.Object::.ctor() - IL_0006: ldarg.0 - IL_0007: ldarg.1 - IL_0008: stfld int32 ABC/Expr::item - IL_000d: ret - } // end of method Expr::.ctor - - .method public hidebysig instance int32 - get_Item() cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 7 (0x7) - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldfld int32 ABC/Expr::item - IL_0006: ret - } // end of method Expr::get_Item - - .method public hidebysig instance int32 - get_Tag() cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 4 (0x4) - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: pop - IL_0002: ldc.i4.0 - IL_0003: ret - } // end of method Expr::get_Tag - - .method assembly hidebysig specialname - instance object __DebugDisplay() cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 22 (0x16) - .maxstack 8 - IL_0000: ldstr "%+0.8A" - IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,string>::.ctor(string) - IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatToString>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) - IL_000f: ldarg.0 - IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_0015: ret - } // end of method Expr::__DebugDisplay - - .method public strict virtual instance string - ToString() cil managed - { - // Code size 22 (0x16) - .maxstack 8 - IL_0000: ldstr "%A" - IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,string>::.ctor(string) - IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatToString>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) - IL_000f: ldarg.0 - IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_0015: ret - } // end of method Expr::ToString - - .method public hidebysig virtual final - instance int32 CompareTo(class ABC/Expr obj) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 81 (0x51) - .maxstack 4 - .locals init (class ABC/Expr V_0, - class ABC/Expr V_1, - class [mscorlib]System.Collections.IComparer V_2, - int32 V_3, - int32 V_4) - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldnull - IL_0003: cgt.un - IL_0005: brfalse.s IL_0009 - - IL_0007: br.s IL_000b - - IL_0009: br.s IL_0043 - - IL_000b: ldarg.1 - IL_000c: ldnull - IL_000d: cgt.un - IL_000f: brfalse.s IL_0013 - - IL_0011: br.s IL_0015 - - IL_0013: br.s IL_0041 - - IL_0015: ldarg.0 - IL_0016: pop - IL_0017: ldarg.0 - IL_0018: stloc.0 - IL_0019: ldarg.1 - IL_001a: stloc.1 - IL_001b: call class [mscorlib]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() - IL_0020: stloc.2 - IL_0021: ldloc.0 - IL_0022: ldfld int32 ABC/Expr::item - IL_0027: stloc.3 - IL_0028: ldloc.1 - IL_0029: ldfld int32 ABC/Expr::item - IL_002e: stloc.s V_4 - IL_0030: ldloc.3 - IL_0031: ldloc.s V_4 - IL_0033: bge.s IL_0037 - - IL_0035: br.s IL_0039 - - IL_0037: br.s IL_003b - - IL_0039: ldc.i4.m1 - IL_003a: ret - - IL_003b: ldloc.3 - IL_003c: ldloc.s V_4 - IL_003e: cgt - IL_0040: ret - - IL_0041: ldc.i4.1 - IL_0042: ret - - IL_0043: ldarg.1 - IL_0044: ldnull - IL_0045: cgt.un - IL_0047: brfalse.s IL_004b - - IL_0049: br.s IL_004d - - IL_004b: br.s IL_004f - - IL_004d: ldc.i4.m1 - IL_004e: ret - - IL_004f: ldc.i4.0 - IL_0050: ret - } // end of method Expr::CompareTo - - .method public hidebysig virtual final - instance int32 CompareTo(object obj) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 14 (0xe) - .maxstack 8 - .language '{AB4F38C9-B6E6-43BA-BE3B-58080B2CCCE3}', '{994B45C4-E6E9-11D2-903F-00C04FA302A1}', '{5A869D0B-6611-11D3-BD2A-0000F80849BD}' - .line 6,6 : 14,18 'C:\\GitHub\\dsyme\\visualfsharp\\tests\\fsharpqa\\Source\\CodeGen\\EmittedIL\\SerializableAttribute\\ToplevelModule.fs' - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldarg.1 - IL_0003: unbox.any ABC/Expr - IL_0008: callvirt instance int32 ABC/Expr::CompareTo(class ABC/Expr) - IL_000d: ret - } // end of method Expr::CompareTo - - .method public hidebysig virtual final - instance int32 CompareTo(object obj, - class [mscorlib]System.Collections.IComparer comp) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 97 (0x61) - .maxstack 4 - .locals init ([0] class ABC/Expr V_0, - [1] class ABC/Expr V_1, - [2] class ABC/Expr V_2, - [3] class [mscorlib]System.Collections.IComparer V_3, - [4] int32 V_4, - [5] int32 V_5) - .line 6,6 : 14,18 - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: unbox.any ABC/Expr - IL_0007: stloc.0 - IL_0008: ldarg.0 - IL_0009: ldnull - IL_000a: cgt.un - IL_000c: brfalse.s IL_0010 - - IL_000e: br.s IL_0012 - - IL_0010: br.s IL_004e - - .line 100001,100001 : 0,0 - IL_0012: ldarg.1 - IL_0013: unbox.any ABC/Expr - IL_0018: ldnull - IL_0019: cgt.un - IL_001b: brfalse.s IL_001f - - IL_001d: br.s IL_0021 - - IL_001f: br.s IL_004c - - .line 100001,100001 : 0,0 - IL_0021: ldarg.0 - IL_0022: pop - .line 100001,100001 : 0,0 - IL_0023: ldarg.0 - IL_0024: stloc.1 - IL_0025: ldloc.0 - IL_0026: stloc.2 - IL_0027: ldarg.2 - IL_0028: stloc.3 - IL_0029: ldloc.1 - IL_002a: ldfld int32 ABC/Expr::item - IL_002f: stloc.s V_4 - IL_0031: ldloc.2 - IL_0032: ldfld int32 ABC/Expr::item - IL_0037: stloc.s V_5 - IL_0039: ldloc.s V_4 - IL_003b: ldloc.s V_5 - IL_003d: bge.s IL_0041 - - IL_003f: br.s IL_0043 - - IL_0041: br.s IL_0045 - - .line 100001,100001 : 0,0 - IL_0043: ldc.i4.m1 - IL_0044: ret - - .line 100001,100001 : 0,0 - IL_0045: ldloc.s V_4 - IL_0047: ldloc.s V_5 - IL_0049: cgt - IL_004b: ret - - .line 100001,100001 : 0,0 - IL_004c: ldc.i4.1 - IL_004d: ret - - .line 100001,100001 : 0,0 - IL_004e: ldarg.1 - IL_004f: unbox.any ABC/Expr - IL_0054: ldnull - IL_0055: cgt.un - IL_0057: brfalse.s IL_005b - - IL_0059: br.s IL_005d - - IL_005b: br.s IL_005f - - .line 100001,100001 : 0,0 - IL_005d: ldc.i4.m1 - IL_005e: ret - - .line 100001,100001 : 0,0 - IL_005f: ldc.i4.0 - IL_0060: ret - } // end of method Expr::CompareTo - - .method public hidebysig virtual final - instance int32 GetHashCode(class [mscorlib]System.Collections.IEqualityComparer comp) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 46 (0x2e) - .maxstack 7 - .locals init (int32 V_0, - class ABC/Expr V_1, - class [mscorlib]System.Collections.IEqualityComparer V_2) - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldnull - IL_0003: cgt.un - IL_0005: brfalse.s IL_0009 - - IL_0007: br.s IL_000b - - IL_0009: br.s IL_002c - - IL_000b: ldc.i4.0 - IL_000c: stloc.0 - IL_000d: ldarg.0 - IL_000e: pop - IL_000f: ldarg.0 - IL_0010: stloc.1 - IL_0011: ldc.i4.0 - IL_0012: stloc.0 - IL_0013: ldc.i4 0x9e3779b9 - IL_0018: ldarg.1 - IL_0019: stloc.2 - IL_001a: ldloc.1 - IL_001b: ldfld int32 ABC/Expr::item - IL_0020: ldloc.0 - IL_0021: ldc.i4.6 - IL_0022: shl - IL_0023: ldloc.0 - IL_0024: ldc.i4.2 - IL_0025: shr - IL_0026: add - IL_0027: add - IL_0028: add - IL_0029: stloc.0 - IL_002a: ldloc.0 - IL_002b: ret - - IL_002c: ldc.i4.0 - IL_002d: ret - } // end of method Expr::GetHashCode - - .method public hidebysig virtual final - instance int32 GetHashCode() cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 13 (0xd) - .maxstack 8 - .line 6,6 : 14,18 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: call class [mscorlib]System.Collections.IEqualityComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericEqualityComparer() - IL_0007: callvirt instance int32 ABC/Expr::GetHashCode(class [mscorlib]System.Collections.IEqualityComparer) - IL_000c: ret - } // end of method Expr::GetHashCode - - .method public hidebysig virtual final - instance bool Equals(object obj, - class [mscorlib]System.Collections.IEqualityComparer comp) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 61 (0x3d) - .maxstack 4 - .locals init (class ABC/Expr V_0, - class ABC/Expr V_1, - class ABC/Expr V_2, - class ABC/Expr V_3, - class [mscorlib]System.Collections.IEqualityComparer V_4) - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldnull - IL_0003: cgt.un - IL_0005: brfalse.s IL_0009 - - IL_0007: br.s IL_000b - - IL_0009: br.s IL_0035 - - IL_000b: ldarg.1 - IL_000c: isinst ABC/Expr - IL_0011: stloc.0 - IL_0012: ldloc.0 - IL_0013: brfalse.s IL_0017 - - IL_0015: br.s IL_0019 - - IL_0017: br.s IL_0033 - - IL_0019: ldloc.0 - IL_001a: stloc.1 - IL_001b: ldarg.0 - IL_001c: pop - IL_001d: ldarg.0 - IL_001e: stloc.2 - IL_001f: ldloc.1 - IL_0020: stloc.3 - IL_0021: ldarg.2 - IL_0022: stloc.s V_4 - IL_0024: ldloc.2 - IL_0025: ldfld int32 ABC/Expr::item - IL_002a: ldloc.3 - IL_002b: ldfld int32 ABC/Expr::item - IL_0030: ceq - IL_0032: ret - - IL_0033: ldc.i4.0 - IL_0034: ret - - IL_0035: ldarg.1 - IL_0036: ldnull - IL_0037: cgt.un - IL_0039: ldc.i4.0 - IL_003a: ceq - IL_003c: ret - } // end of method Expr::Equals - - .method public hidebysig virtual final - instance bool Equals(class ABC/Expr obj) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 52 (0x34) - .maxstack 4 - .locals init (class ABC/Expr V_0, - class ABC/Expr V_1) - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldnull - IL_0003: cgt.un - IL_0005: brfalse.s IL_0009 - - IL_0007: br.s IL_000b - - IL_0009: br.s IL_002c - - IL_000b: ldarg.1 - IL_000c: ldnull - IL_000d: cgt.un - IL_000f: brfalse.s IL_0013 - - IL_0011: br.s IL_0015 - - IL_0013: br.s IL_002a - - IL_0015: ldarg.0 - IL_0016: pop - IL_0017: ldarg.0 - IL_0018: stloc.0 - IL_0019: ldarg.1 - IL_001a: stloc.1 - IL_001b: ldloc.0 - IL_001c: ldfld int32 ABC/Expr::item - IL_0021: ldloc.1 - IL_0022: ldfld int32 ABC/Expr::item - IL_0027: ceq - IL_0029: ret - - IL_002a: ldc.i4.0 - IL_002b: ret - - IL_002c: ldarg.1 - IL_002d: ldnull - IL_002e: cgt.un - IL_0030: ldc.i4.0 - IL_0031: ceq - IL_0033: ret - } // end of method Expr::Equals - - .method public hidebysig virtual final - instance bool Equals(object obj) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 25 (0x19) - .maxstack 4 - .locals init (class ABC/Expr V_0) - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: isinst ABC/Expr - IL_0007: stloc.0 - IL_0008: ldloc.0 - IL_0009: brfalse.s IL_000d - - IL_000b: br.s IL_000f - - IL_000d: br.s IL_0017 - - IL_000f: ldarg.0 - IL_0010: ldloc.0 - IL_0011: callvirt instance bool ABC/Expr::Equals(class ABC/Expr) - IL_0016: ret - - IL_0017: ldc.i4.0 - IL_0018: ret - } // end of method Expr::Equals - - .property instance int32 Tag() - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .get instance int32 ABC/Expr::get_Tag() - } // end of property Expr::Tag - .property instance int32 Item() - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, - int32, - int32) = ( 01 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 ) - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .get instance int32 ABC/Expr::get_Item() - } // end of property Expr::Item - } // end of class Expr - - .class auto ansi nested public beforefieldinit MyExn - extends [mscorlib]System.Exception - implements [mscorlib]System.Collections.IStructuralEquatable - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 05 00 00 00 00 00 ) - .field assembly int32 Data0@ - .method public specialname rtspecialname - instance void .ctor(int32 data0) cil managed - { - // Code size 14 (0xe) - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void [mscorlib]System.Exception::.ctor() - IL_0006: ldarg.0 - IL_0007: ldarg.1 - IL_0008: stfld int32 ABC/MyExn::Data0@ - IL_000d: ret - } // end of method MyExn::.ctor - - .method public specialname rtspecialname - instance void .ctor() cil managed - { - // Code size 7 (0x7) - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void [mscorlib]System.Exception::.ctor() - IL_0006: ret - } // end of method MyExn::.ctor - - .method public hidebysig specialname - instance int32 get_Data0() cil managed - { - // Code size 7 (0x7) - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldfld int32 ABC/MyExn::Data0@ - IL_0006: ret - } // end of method MyExn::get_Data0 - - .method public hidebysig virtual instance int32 - GetHashCode(class [mscorlib]System.Collections.IEqualityComparer comp) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 45 (0x2d) - .maxstack 7 - .locals init (int32 V_0, - class [mscorlib]System.Collections.IEqualityComparer V_1) - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldnull - IL_0003: cgt.un - IL_0005: brfalse.s IL_0009 - - IL_0007: br.s IL_000b - - IL_0009: br.s IL_002b - - IL_000b: ldc.i4.0 - IL_000c: stloc.0 - IL_000d: ldc.i4 0x9e3779b9 - IL_0012: ldarg.1 - IL_0013: stloc.1 - IL_0014: ldarg.0 - IL_0015: castclass ABC/MyExn - IL_001a: call instance int32 ABC/MyExn::get_Data0() - IL_001f: ldloc.0 - IL_0020: ldc.i4.6 - IL_0021: shl - IL_0022: ldloc.0 - IL_0023: ldc.i4.2 - IL_0024: shr - IL_0025: add - IL_0026: add - IL_0027: add - IL_0028: stloc.0 - IL_0029: ldloc.0 - IL_002a: ret - - IL_002b: ldc.i4.0 - IL_002c: ret - } // end of method MyExn::GetHashCode - - .method public hidebysig virtual instance int32 - GetHashCode() cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 13 (0xd) - .maxstack 8 - .line 7,7 : 19,24 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: call class [mscorlib]System.Collections.IEqualityComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericEqualityComparer() - IL_0007: callvirt instance int32 ABC/MyExn::GetHashCode(class [mscorlib]System.Collections.IEqualityComparer) - IL_000c: ret - } // end of method MyExn::GetHashCode - - .method public hidebysig virtual instance bool - Equals(object obj, - class [mscorlib]System.Collections.IEqualityComparer comp) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 76 (0x4c) - .maxstack 4 - .locals init (class [mscorlib]System.Exception V_0, - class [mscorlib]System.Exception V_1, - class [mscorlib]System.Collections.IEqualityComparer V_2) - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldnull - IL_0003: cgt.un - IL_0005: brfalse.s IL_0009 - - IL_0007: br.s IL_000b - - IL_0009: br.s IL_0044 - - IL_000b: ldarg.1 - IL_000c: isinst [mscorlib]System.Exception - IL_0011: stloc.0 - IL_0012: ldloc.0 - IL_0013: brfalse.s IL_0017 - - IL_0015: br.s IL_0019 - - IL_0017: br.s IL_0042 - - IL_0019: ldloc.0 - IL_001a: stloc.1 - IL_001b: ldloc.0 - IL_001c: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::TypeTestGeneric(object) - IL_0021: brtrue.s IL_0025 - - IL_0023: br.s IL_0040 - - IL_0025: ldarg.2 - IL_0026: stloc.2 - IL_0027: ldarg.0 - IL_0028: castclass ABC/MyExn - IL_002d: call instance int32 ABC/MyExn::get_Data0() - IL_0032: ldloc.1 - IL_0033: castclass ABC/MyExn - IL_0038: call instance int32 ABC/MyExn::get_Data0() - IL_003d: ceq - IL_003f: ret - - IL_0040: ldc.i4.0 - IL_0041: ret - - IL_0042: ldc.i4.0 - IL_0043: ret - - IL_0044: ldarg.1 - IL_0045: ldnull - IL_0046: cgt.un - IL_0048: ldc.i4.0 - IL_0049: ceq - IL_004b: ret - } // end of method MyExn::Equals - - .method public hidebysig instance bool - Equals(class [mscorlib]System.Exception obj) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 68 (0x44) - .maxstack 4 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldnull - IL_0003: cgt.un - IL_0005: brfalse.s IL_0009 - - IL_0007: br.s IL_000b - - IL_0009: br.s IL_003c - - IL_000b: ldarg.1 - IL_000c: ldnull - IL_000d: cgt.un - IL_000f: brfalse.s IL_0013 - - IL_0011: br.s IL_0015 - - IL_0013: br.s IL_003a - - IL_0015: ldarg.1 - IL_0016: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::TypeTestGeneric(object) - IL_001b: brtrue.s IL_001f - - IL_001d: br.s IL_0038 - - IL_001f: ldarg.0 - IL_0020: castclass ABC/MyExn - IL_0025: call instance int32 ABC/MyExn::get_Data0() - IL_002a: ldarg.1 - IL_002b: castclass ABC/MyExn - IL_0030: call instance int32 ABC/MyExn::get_Data0() - IL_0035: ceq - IL_0037: ret - - IL_0038: ldc.i4.0 - IL_0039: ret - - IL_003a: ldc.i4.0 - IL_003b: ret - - IL_003c: ldarg.1 - IL_003d: ldnull - IL_003e: cgt.un - IL_0040: ldc.i4.0 - IL_0041: ceq - IL_0043: ret - } // end of method MyExn::Equals - - .method public hidebysig virtual instance bool - Equals(object obj) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 25 (0x19) - .maxstack 4 - .locals init (class [mscorlib]System.Exception V_0) - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: isinst [mscorlib]System.Exception - IL_0007: stloc.0 - IL_0008: ldloc.0 - IL_0009: brfalse.s IL_000d - - IL_000b: br.s IL_000f - - IL_000d: br.s IL_0017 - - IL_000f: ldarg.0 - IL_0010: ldloc.0 - IL_0011: callvirt instance bool ABC/MyExn::Equals(class [mscorlib]System.Exception) - IL_0016: ret - - IL_0017: ldc.i4.0 - IL_0018: ret - } // end of method MyExn::Equals - - .property instance int32 Data0() - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, - int32) = ( 01 00 04 00 00 00 00 00 00 00 00 00 ) - .get instance int32 ABC/MyExn::get_Data0() - } // end of property MyExn::Data0 - } // end of class MyExn - - .class auto ansi nested public A - extends [mscorlib]System.Object - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) - .field assembly string x - .method public specialname rtspecialname - instance void .ctor(string x) cil managed - { - // Code size 17 (0x11) - .maxstack 8 - .line 8,8 : 16,17 - IL_0000: ldarg.0 - IL_0001: callvirt instance void [mscorlib]System.Object::.ctor() - IL_0006: ldarg.0 - IL_0007: pop - IL_0008: nop - IL_0009: ldarg.0 - IL_000a: ldarg.1 - IL_000b: stfld string ABC/A::x - .line 8,8 : 14,15 - IL_0010: ret - } // end of method A::.ctor - - .method public hidebysig specialname - instance string get_X() cil managed - { - // Code size 8 (0x8) - .maxstack 8 - .line 8,8 : 42,43 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldfld string ABC/A::x - IL_0007: ret - } // end of method A::get_X - - .property instance string X() - { - .get instance string ABC/A::get_X() - } // end of property A::X - } // end of class A - - .class abstract auto ansi sealed nested public ABC - extends [mscorlib]System.Object - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) - .class auto autochar sealed nested public beforefieldinit Expr - extends [mscorlib]System.Object - implements class [mscorlib]System.IEquatable`1, - [mscorlib]System.Collections.IStructuralEquatable, - class [mscorlib]System.IComparable`1, - [mscorlib]System.IComparable, - [mscorlib]System.Collections.IStructuralComparable - { - .custom instance void [mscorlib]System.Diagnostics.DebuggerDisplayAttribute::.ctor(string) = ( 01 00 15 7B 5F 5F 44 65 62 75 67 44 69 73 70 6C // ...{__DebugDispl - 61 79 28 29 2C 6E 71 7D 00 00 ) // ay(),nq}.. - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 01 00 00 00 00 00 ) - .field assembly initonly int32 item - .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method public static class ABC/ABC/Expr - NewNum(int32 item) cil managed - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, - int32) = ( 01 00 08 00 00 00 00 00 00 00 00 00 ) - // Code size 7 (0x7) - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: newobj instance void ABC/ABC/Expr::.ctor(int32) - IL_0006: ret - } // end of method Expr::NewNum - - .method assembly specialname rtspecialname - instance void .ctor(int32 item) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 14 (0xe) - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void [mscorlib]System.Object::.ctor() - IL_0006: ldarg.0 - IL_0007: ldarg.1 - IL_0008: stfld int32 ABC/ABC/Expr::item - IL_000d: ret - } // end of method Expr::.ctor - - .method public hidebysig instance int32 - get_Item() cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 7 (0x7) - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldfld int32 ABC/ABC/Expr::item - IL_0006: ret - } // end of method Expr::get_Item - - .method public hidebysig instance int32 - get_Tag() cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 4 (0x4) - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: pop - IL_0002: ldc.i4.0 - IL_0003: ret - } // end of method Expr::get_Tag - - .method assembly hidebysig specialname - instance object __DebugDisplay() cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 22 (0x16) - .maxstack 8 - IL_0000: ldstr "%+0.8A" - IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,string>::.ctor(string) - IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatToString>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) - IL_000f: ldarg.0 - IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_0015: ret - } // end of method Expr::__DebugDisplay - - .method public strict virtual instance string - ToString() cil managed - { - // Code size 22 (0x16) - .maxstack 8 - IL_0000: ldstr "%A" - IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,string>::.ctor(string) - IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatToString>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) - IL_000f: ldarg.0 - IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_0015: ret - } // end of method Expr::ToString - - .method public hidebysig virtual final - instance int32 CompareTo(class ABC/ABC/Expr obj) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 81 (0x51) - .maxstack 4 - .locals init (class ABC/ABC/Expr V_0, - class ABC/ABC/Expr V_1, - class [mscorlib]System.Collections.IComparer V_2, - int32 V_3, - int32 V_4) - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldnull - IL_0003: cgt.un - IL_0005: brfalse.s IL_0009 - - IL_0007: br.s IL_000b - - IL_0009: br.s IL_0043 - - IL_000b: ldarg.1 - IL_000c: ldnull - IL_000d: cgt.un - IL_000f: brfalse.s IL_0013 - - IL_0011: br.s IL_0015 - - IL_0013: br.s IL_0041 - - IL_0015: ldarg.0 - IL_0016: pop - IL_0017: ldarg.0 - IL_0018: stloc.0 - IL_0019: ldarg.1 - IL_001a: stloc.1 - IL_001b: call class [mscorlib]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() - IL_0020: stloc.2 - IL_0021: ldloc.0 - IL_0022: ldfld int32 ABC/ABC/Expr::item - IL_0027: stloc.3 - IL_0028: ldloc.1 - IL_0029: ldfld int32 ABC/ABC/Expr::item - IL_002e: stloc.s V_4 - IL_0030: ldloc.3 - IL_0031: ldloc.s V_4 - IL_0033: bge.s IL_0037 - - IL_0035: br.s IL_0039 - - IL_0037: br.s IL_003b - - IL_0039: ldc.i4.m1 - IL_003a: ret - - IL_003b: ldloc.3 - IL_003c: ldloc.s V_4 - IL_003e: cgt - IL_0040: ret - - IL_0041: ldc.i4.1 - IL_0042: ret - - IL_0043: ldarg.1 - IL_0044: ldnull - IL_0045: cgt.un - IL_0047: brfalse.s IL_004b - - IL_0049: br.s IL_004d - - IL_004b: br.s IL_004f - - IL_004d: ldc.i4.m1 - IL_004e: ret - - IL_004f: ldc.i4.0 - IL_0050: ret - } // end of method Expr::CompareTo - - .method public hidebysig virtual final - instance int32 CompareTo(object obj) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 14 (0xe) - .maxstack 8 - .line 16,16 : 18,22 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldarg.1 - IL_0003: unbox.any ABC/ABC/Expr - IL_0008: callvirt instance int32 ABC/ABC/Expr::CompareTo(class ABC/ABC/Expr) - IL_000d: ret - } // end of method Expr::CompareTo - - .method public hidebysig virtual final - instance int32 CompareTo(object obj, - class [mscorlib]System.Collections.IComparer comp) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 97 (0x61) - .maxstack 4 - .locals init ([0] class ABC/ABC/Expr V_0, - [1] class ABC/ABC/Expr V_1, - [2] class ABC/ABC/Expr V_2, - [3] class [mscorlib]System.Collections.IComparer V_3, - [4] int32 V_4, - [5] int32 V_5) - .line 16,16 : 18,22 - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: unbox.any ABC/ABC/Expr - IL_0007: stloc.0 - IL_0008: ldarg.0 - IL_0009: ldnull - IL_000a: cgt.un - IL_000c: brfalse.s IL_0010 - - IL_000e: br.s IL_0012 - - IL_0010: br.s IL_004e - - .line 100001,100001 : 0,0 - IL_0012: ldarg.1 - IL_0013: unbox.any ABC/ABC/Expr - IL_0018: ldnull - IL_0019: cgt.un - IL_001b: brfalse.s IL_001f - - IL_001d: br.s IL_0021 - - IL_001f: br.s IL_004c - - .line 100001,100001 : 0,0 - IL_0021: ldarg.0 - IL_0022: pop - .line 100001,100001 : 0,0 - IL_0023: ldarg.0 - IL_0024: stloc.1 - IL_0025: ldloc.0 - IL_0026: stloc.2 - IL_0027: ldarg.2 - IL_0028: stloc.3 - IL_0029: ldloc.1 - IL_002a: ldfld int32 ABC/ABC/Expr::item - IL_002f: stloc.s V_4 - IL_0031: ldloc.2 - IL_0032: ldfld int32 ABC/ABC/Expr::item - IL_0037: stloc.s V_5 - IL_0039: ldloc.s V_4 - IL_003b: ldloc.s V_5 - IL_003d: bge.s IL_0041 - - IL_003f: br.s IL_0043 - - IL_0041: br.s IL_0045 - - .line 100001,100001 : 0,0 - IL_0043: ldc.i4.m1 - IL_0044: ret - - .line 100001,100001 : 0,0 - IL_0045: ldloc.s V_4 - IL_0047: ldloc.s V_5 - IL_0049: cgt - IL_004b: ret - - .line 100001,100001 : 0,0 - IL_004c: ldc.i4.1 - IL_004d: ret - - .line 100001,100001 : 0,0 - IL_004e: ldarg.1 - IL_004f: unbox.any ABC/ABC/Expr - IL_0054: ldnull - IL_0055: cgt.un - IL_0057: brfalse.s IL_005b - - IL_0059: br.s IL_005d - - IL_005b: br.s IL_005f - - .line 100001,100001 : 0,0 - IL_005d: ldc.i4.m1 - IL_005e: ret - - .line 100001,100001 : 0,0 - IL_005f: ldc.i4.0 - IL_0060: ret - } // end of method Expr::CompareTo - - .method public hidebysig virtual final - instance int32 GetHashCode(class [mscorlib]System.Collections.IEqualityComparer comp) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 46 (0x2e) - .maxstack 7 - .locals init (int32 V_0, - class ABC/ABC/Expr V_1, - class [mscorlib]System.Collections.IEqualityComparer V_2) - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldnull - IL_0003: cgt.un - IL_0005: brfalse.s IL_0009 - - IL_0007: br.s IL_000b - - IL_0009: br.s IL_002c - - IL_000b: ldc.i4.0 - IL_000c: stloc.0 - IL_000d: ldarg.0 - IL_000e: pop - IL_000f: ldarg.0 - IL_0010: stloc.1 - IL_0011: ldc.i4.0 - IL_0012: stloc.0 - IL_0013: ldc.i4 0x9e3779b9 - IL_0018: ldarg.1 - IL_0019: stloc.2 - IL_001a: ldloc.1 - IL_001b: ldfld int32 ABC/ABC/Expr::item - IL_0020: ldloc.0 - IL_0021: ldc.i4.6 - IL_0022: shl - IL_0023: ldloc.0 - IL_0024: ldc.i4.2 - IL_0025: shr - IL_0026: add - IL_0027: add - IL_0028: add - IL_0029: stloc.0 - IL_002a: ldloc.0 - IL_002b: ret - - IL_002c: ldc.i4.0 - IL_002d: ret - } // end of method Expr::GetHashCode - - .method public hidebysig virtual final - instance int32 GetHashCode() cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 13 (0xd) - .maxstack 8 - .line 16,16 : 18,22 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: call class [mscorlib]System.Collections.IEqualityComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericEqualityComparer() - IL_0007: callvirt instance int32 ABC/ABC/Expr::GetHashCode(class [mscorlib]System.Collections.IEqualityComparer) - IL_000c: ret - } // end of method Expr::GetHashCode - - .method public hidebysig virtual final - instance bool Equals(object obj, - class [mscorlib]System.Collections.IEqualityComparer comp) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 61 (0x3d) - .maxstack 4 - .locals init (class ABC/ABC/Expr V_0, - class ABC/ABC/Expr V_1, - class ABC/ABC/Expr V_2, - class ABC/ABC/Expr V_3, - class [mscorlib]System.Collections.IEqualityComparer V_4) - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldnull - IL_0003: cgt.un - IL_0005: brfalse.s IL_0009 - - IL_0007: br.s IL_000b - - IL_0009: br.s IL_0035 - - IL_000b: ldarg.1 - IL_000c: isinst ABC/ABC/Expr - IL_0011: stloc.0 - IL_0012: ldloc.0 - IL_0013: brfalse.s IL_0017 - - IL_0015: br.s IL_0019 - - IL_0017: br.s IL_0033 - - IL_0019: ldloc.0 - IL_001a: stloc.1 - IL_001b: ldarg.0 - IL_001c: pop - IL_001d: ldarg.0 - IL_001e: stloc.2 - IL_001f: ldloc.1 - IL_0020: stloc.3 - IL_0021: ldarg.2 - IL_0022: stloc.s V_4 - IL_0024: ldloc.2 - IL_0025: ldfld int32 ABC/ABC/Expr::item - IL_002a: ldloc.3 - IL_002b: ldfld int32 ABC/ABC/Expr::item - IL_0030: ceq - IL_0032: ret - - IL_0033: ldc.i4.0 - IL_0034: ret - - IL_0035: ldarg.1 - IL_0036: ldnull - IL_0037: cgt.un - IL_0039: ldc.i4.0 - IL_003a: ceq - IL_003c: ret - } // end of method Expr::Equals - - .method public hidebysig virtual final - instance bool Equals(class ABC/ABC/Expr obj) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 52 (0x34) - .maxstack 4 - .locals init (class ABC/ABC/Expr V_0, - class ABC/ABC/Expr V_1) - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldnull - IL_0003: cgt.un - IL_0005: brfalse.s IL_0009 - - IL_0007: br.s IL_000b - - IL_0009: br.s IL_002c - - IL_000b: ldarg.1 - IL_000c: ldnull - IL_000d: cgt.un - IL_000f: brfalse.s IL_0013 - - IL_0011: br.s IL_0015 - - IL_0013: br.s IL_002a - - IL_0015: ldarg.0 - IL_0016: pop - IL_0017: ldarg.0 - IL_0018: stloc.0 - IL_0019: ldarg.1 - IL_001a: stloc.1 - IL_001b: ldloc.0 - IL_001c: ldfld int32 ABC/ABC/Expr::item - IL_0021: ldloc.1 - IL_0022: ldfld int32 ABC/ABC/Expr::item - IL_0027: ceq - IL_0029: ret - - IL_002a: ldc.i4.0 - IL_002b: ret - - IL_002c: ldarg.1 - IL_002d: ldnull - IL_002e: cgt.un - IL_0030: ldc.i4.0 - IL_0031: ceq - IL_0033: ret - } // end of method Expr::Equals - - .method public hidebysig virtual final - instance bool Equals(object obj) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 25 (0x19) - .maxstack 4 - .locals init (class ABC/ABC/Expr V_0) - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: isinst ABC/ABC/Expr - IL_0007: stloc.0 - IL_0008: ldloc.0 - IL_0009: brfalse.s IL_000d - - IL_000b: br.s IL_000f - - IL_000d: br.s IL_0017 - - IL_000f: ldarg.0 - IL_0010: ldloc.0 - IL_0011: callvirt instance bool ABC/ABC/Expr::Equals(class ABC/ABC/Expr) - IL_0016: ret - - IL_0017: ldc.i4.0 - IL_0018: ret - } // end of method Expr::Equals - - .property instance int32 Tag() - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .get instance int32 ABC/ABC/Expr::get_Tag() - } // end of property Expr::Tag - .property instance int32 Item() - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, - int32, - int32) = ( 01 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 ) - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .get instance int32 ABC/ABC/Expr::get_Item() - } // end of property Expr::Item - } // end of class Expr - - .class auto ansi nested public beforefieldinit MyExn - extends [mscorlib]System.Exception - implements [mscorlib]System.Collections.IStructuralEquatable - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 05 00 00 00 00 00 ) - .field assembly int32 Data0@ - .method public specialname rtspecialname - instance void .ctor(int32 data0) cil managed - { - // Code size 14 (0xe) - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void [mscorlib]System.Exception::.ctor() - IL_0006: ldarg.0 - IL_0007: ldarg.1 - IL_0008: stfld int32 ABC/ABC/MyExn::Data0@ - IL_000d: ret - } // end of method MyExn::.ctor - - .method public specialname rtspecialname - instance void .ctor() cil managed - { - // Code size 7 (0x7) - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void [mscorlib]System.Exception::.ctor() - IL_0006: ret - } // end of method MyExn::.ctor - - .method public hidebysig specialname - instance int32 get_Data0() cil managed - { - // Code size 7 (0x7) - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldfld int32 ABC/ABC/MyExn::Data0@ - IL_0006: ret - } // end of method MyExn::get_Data0 - - .method public hidebysig virtual instance int32 - GetHashCode(class [mscorlib]System.Collections.IEqualityComparer comp) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 45 (0x2d) - .maxstack 7 - .locals init (int32 V_0, - class [mscorlib]System.Collections.IEqualityComparer V_1) - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldnull - IL_0003: cgt.un - IL_0005: brfalse.s IL_0009 - - IL_0007: br.s IL_000b - - IL_0009: br.s IL_002b - - IL_000b: ldc.i4.0 - IL_000c: stloc.0 - IL_000d: ldc.i4 0x9e3779b9 - IL_0012: ldarg.1 - IL_0013: stloc.1 - IL_0014: ldarg.0 - IL_0015: castclass ABC/ABC/MyExn - IL_001a: call instance int32 ABC/ABC/MyExn::get_Data0() - IL_001f: ldloc.0 - IL_0020: ldc.i4.6 - IL_0021: shl - IL_0022: ldloc.0 - IL_0023: ldc.i4.2 - IL_0024: shr - IL_0025: add - IL_0026: add - IL_0027: add - IL_0028: stloc.0 - IL_0029: ldloc.0 - IL_002a: ret - - IL_002b: ldc.i4.0 - IL_002c: ret - } // end of method MyExn::GetHashCode - - .method public hidebysig virtual instance int32 - GetHashCode() cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 13 (0xd) - .maxstack 8 - .line 17,17 : 23,28 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: call class [mscorlib]System.Collections.IEqualityComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericEqualityComparer() - IL_0007: callvirt instance int32 ABC/ABC/MyExn::GetHashCode(class [mscorlib]System.Collections.IEqualityComparer) - IL_000c: ret - } // end of method MyExn::GetHashCode - - .method public hidebysig virtual instance bool - Equals(object obj, - class [mscorlib]System.Collections.IEqualityComparer comp) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 76 (0x4c) - .maxstack 4 - .locals init (class [mscorlib]System.Exception V_0, - class [mscorlib]System.Exception V_1, - class [mscorlib]System.Collections.IEqualityComparer V_2) - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldnull - IL_0003: cgt.un - IL_0005: brfalse.s IL_0009 - - IL_0007: br.s IL_000b - - IL_0009: br.s IL_0044 - - IL_000b: ldarg.1 - IL_000c: isinst [mscorlib]System.Exception - IL_0011: stloc.0 - IL_0012: ldloc.0 - IL_0013: brfalse.s IL_0017 - - IL_0015: br.s IL_0019 - - IL_0017: br.s IL_0042 - - IL_0019: ldloc.0 - IL_001a: stloc.1 - IL_001b: ldloc.0 - IL_001c: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::TypeTestGeneric(object) - IL_0021: brtrue.s IL_0025 - - IL_0023: br.s IL_0040 - - IL_0025: ldarg.2 - IL_0026: stloc.2 - IL_0027: ldarg.0 - IL_0028: castclass ABC/ABC/MyExn - IL_002d: call instance int32 ABC/ABC/MyExn::get_Data0() - IL_0032: ldloc.1 - IL_0033: castclass ABC/ABC/MyExn - IL_0038: call instance int32 ABC/ABC/MyExn::get_Data0() - IL_003d: ceq - IL_003f: ret - - IL_0040: ldc.i4.0 - IL_0041: ret - - IL_0042: ldc.i4.0 - IL_0043: ret - - IL_0044: ldarg.1 - IL_0045: ldnull - IL_0046: cgt.un - IL_0048: ldc.i4.0 - IL_0049: ceq - IL_004b: ret - } // end of method MyExn::Equals - - .method public hidebysig instance bool - Equals(class [mscorlib]System.Exception obj) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 68 (0x44) - .maxstack 4 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldnull - IL_0003: cgt.un - IL_0005: brfalse.s IL_0009 - - IL_0007: br.s IL_000b - - IL_0009: br.s IL_003c - - IL_000b: ldarg.1 - IL_000c: ldnull - IL_000d: cgt.un - IL_000f: brfalse.s IL_0013 - - IL_0011: br.s IL_0015 - - IL_0013: br.s IL_003a - - IL_0015: ldarg.1 - IL_0016: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::TypeTestGeneric(object) - IL_001b: brtrue.s IL_001f - - IL_001d: br.s IL_0038 - - IL_001f: ldarg.0 - IL_0020: castclass ABC/ABC/MyExn - IL_0025: call instance int32 ABC/ABC/MyExn::get_Data0() - IL_002a: ldarg.1 - IL_002b: castclass ABC/ABC/MyExn - IL_0030: call instance int32 ABC/ABC/MyExn::get_Data0() - IL_0035: ceq - IL_0037: ret - - IL_0038: ldc.i4.0 - IL_0039: ret - - IL_003a: ldc.i4.0 - IL_003b: ret - - IL_003c: ldarg.1 - IL_003d: ldnull - IL_003e: cgt.un - IL_0040: ldc.i4.0 - IL_0041: ceq - IL_0043: ret - } // end of method MyExn::Equals - - .method public hidebysig virtual instance bool - Equals(object obj) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 25 (0x19) - .maxstack 4 - .locals init (class [mscorlib]System.Exception V_0) - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: isinst [mscorlib]System.Exception - IL_0007: stloc.0 - IL_0008: ldloc.0 - IL_0009: brfalse.s IL_000d - - IL_000b: br.s IL_000f - - IL_000d: br.s IL_0017 - - IL_000f: ldarg.0 - IL_0010: ldloc.0 - IL_0011: callvirt instance bool ABC/ABC/MyExn::Equals(class [mscorlib]System.Exception) - IL_0016: ret - - IL_0017: ldc.i4.0 - IL_0018: ret - } // end of method MyExn::Equals - - .property instance int32 Data0() - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, - int32) = ( 01 00 04 00 00 00 00 00 00 00 00 00 ) - .get instance int32 ABC/ABC/MyExn::get_Data0() - } // end of property MyExn::Data0 - } // end of class MyExn - - .class auto ansi nested public A - extends [mscorlib]System.Object - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) - .field assembly string x - .method public specialname rtspecialname - instance void .ctor(string x) cil managed - { - // Code size 17 (0x11) - .maxstack 8 - .line 18,18 : 20,21 - IL_0000: ldarg.0 - IL_0001: callvirt instance void [mscorlib]System.Object::.ctor() - IL_0006: ldarg.0 - IL_0007: pop - IL_0008: nop - IL_0009: ldarg.0 - IL_000a: ldarg.1 - IL_000b: stfld string ABC/ABC/A::x - .line 18,18 : 18,19 - IL_0010: ret - } // end of method A::.ctor - - .method public hidebysig specialname - instance string get_X() cil managed - { - // Code size 8 (0x8) - .maxstack 8 - .line 18,18 : 46,47 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldfld string ABC/ABC/A::x - IL_0007: ret - } // end of method A::get_X - - .property instance string X() - { - .get instance string ABC/ABC/A::get_X() - } // end of property A::X - } // end of class A - - .method public static int32 'add'(int32 x, - int32 y) cil managed - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) - // Code size 5 (0x5) - .maxstack 8 - .line 21,21 : 27,32 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldarg.1 - IL_0003: add - IL_0004: ret - } // end of method ABC::'add' - - .method public specialname static string - get_greeting() cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 7 (0x7) - .maxstack 8 - IL_0000: nop - IL_0001: ldstr "hello" - IL_0006: ret - } // end of method ABC::get_greeting - - .property string greeting() - { - .get string ABC/ABC::get_greeting() - } // end of property ABC::greeting - } // end of class ABC - - .method public static int32 'add'(int32 x, - int32 y) cil managed - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) - // Code size 5 (0x5) - .maxstack 8 - .line 11,11 : 23,28 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldarg.1 - IL_0003: add - IL_0004: ret - } // end of method ABC::'add' - - .method public specialname static string - get_greeting() cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 7 (0x7) - .maxstack 8 - IL_0000: nop - IL_0001: ldstr "hello" - IL_0006: ret - } // end of method ABC::get_greeting - - .property string greeting() - { - .get string ABC::get_greeting() - } // end of property ABC::greeting -} // end of class ABC - -.class private abstract auto ansi sealed ''.$ABC - extends [mscorlib]System.Object -{ - .field static assembly int32 init@ - .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method private specialname rtspecialname static - void .cctor() cil managed - { - // Code size 14 (0xe) - .maxstack 3 - .locals init ([0] string greeting, - [1] string V_1) - .line 12,12 : 9,31 '' - IL_0000: nop - IL_0001: call string ABC::get_greeting() - IL_0006: stloc.0 - .line 22,22 : 13,35 '' - IL_0007: call string ABC/ABC::get_greeting() - IL_000c: stloc.1 - IL_000d: ret - } // end of method $ABC::.cctor -} // end of class ''.$ABC - - -// ============================================================= - -// *********** DISASSEMBLY COMPLETE *********************** diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/SerializableAttribute/ToplevelNamespace.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/SerializableAttribute/ToplevelNamespace.il.bsl index bf83c61d107..32f8ac85d82 100644 --- a/tests/fsharpqa/Source/CodeGen/EmittedIL/SerializableAttribute/ToplevelNamespace.il.bsl +++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/SerializableAttribute/ToplevelNamespace.il.bsl @@ -1,4 +1,2435 @@ -// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0 +// Microsoft (R) .NET Framework IL Disassembler. Version 4.8.3928.0 // Copyright (c) Microsoft Corporation. All rights reserved. + + +// Metadata version: v4.0.30319 +.assembly extern mscorlib +{ + .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. + .ver 4:0:0:0 +} +.assembly extern FSharp.Core +{ + .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) // .?_....: + .ver 5:0:0:0 +} +.assembly ToplevelNamespace +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, + int32, + int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) + + // --- The following custom attribute is added automatically, do not uncomment ------- + // .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 01 01 00 00 00 00 ) + + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.ToplevelNamespace +{ + // Offset: 0x00000000 Length: 0x00001848 +} +.mresource public FSharpOptimizationData.ToplevelNamespace +{ + // Offset: 0x00001850 Length: 0x0000055C +} +.module ToplevelNamespace.dll +// MVID: {60D48932-218B-729A-A745-03833289D460} +.imagebase 0x00400000 +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 // WINDOWS_CUI +.corflags 0x00000001 // ILONLY +// Image base: 0x04F20000 + + +// =============== CLASS MEMBERS DECLARATION =================== + +.class public auto autochar serializable sealed beforefieldinit XYZ.Expr + extends [mscorlib]System.Object + implements class [mscorlib]System.IEquatable`1, + [mscorlib]System.Collections.IStructuralEquatable, + class [mscorlib]System.IComparable`1, + [mscorlib]System.IComparable, + [mscorlib]System.Collections.IStructuralComparable +{ + .custom instance void [mscorlib]System.Diagnostics.DebuggerDisplayAttribute::.ctor(string) = ( 01 00 15 7B 5F 5F 44 65 62 75 67 44 69 73 70 6C // ...{__DebugDispl + 61 79 28 29 2C 6E 71 7D 00 00 ) // ay(),nq}.. + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 01 00 00 00 00 00 ) + .field assembly initonly int32 item + .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public static class XYZ.Expr NewNum(int32 item) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 08 00 00 00 00 00 00 00 00 00 ) + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: newobj instance void XYZ.Expr::.ctor(int32) + IL_0006: ret + } // end of method Expr::NewNum + + .method assembly specialname rtspecialname + instance void .ctor(int32 item) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 14 (0xe) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld int32 XYZ.Expr::item + IL_000d: ret + } // end of method Expr::.ctor + + .method public hidebysig instance int32 + get_Item() cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld int32 XYZ.Expr::item + IL_0006: ret + } // end of method Expr::get_Item + + .method public hidebysig instance int32 + get_Tag() cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 4 (0x4) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: pop + IL_0002: ldc.i4.0 + IL_0003: ret + } // end of method Expr::get_Tag + + .method assembly hidebysig specialname + instance object __DebugDisplay() cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 22 (0x16) + .maxstack 8 + IL_0000: ldstr "%+0.8A" + IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,string>::.ctor(string) + IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatToString>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_000f: ldarg.0 + IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0015: ret + } // end of method Expr::__DebugDisplay + + .method public strict virtual instance string + ToString() cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 22 (0x16) + .maxstack 8 + IL_0000: ldstr "%+A" + IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,class XYZ.Expr>::.ctor(string) + IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatToString>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_000f: ldarg.0 + IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0015: ret + } // end of method Expr::ToString + + .method public hidebysig virtual final + instance int32 CompareTo(class XYZ.Expr obj) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 64 (0x40) + .maxstack 4 + .locals init ([0] class XYZ.Expr V_0, + [1] class XYZ.Expr V_1, + [2] class [mscorlib]System.Collections.IComparer V_2, + [3] int32 V_3, + [4] int32 V_4) + .language '{AB4F38C9-B6E6-43BA-BE3B-58080B2CCCE3}', '{994B45C4-E6E9-11D2-903F-00C04FA302A1}', '{5A869D0B-6611-11D3-BD2A-0000F80849BD}' + .line 100001,100001 : 0,0 'C:\\GitHub\\dsyme\\fsharp\\tests\\fsharpqa\\source\\CodeGen\\EmittedIL\\SerializableAttribute\\ToplevelNamespace.fs' + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: cgt.un + IL_0004: brfalse.s IL_0036 + + .line 100001,100001 : 0,0 '' + IL_0006: ldarg.1 + IL_0007: ldnull + IL_0008: cgt.un + IL_000a: brfalse.s IL_0034 + + .line 100001,100001 : 0,0 '' + IL_000c: ldarg.0 + IL_000d: pop + .line 100001,100001 : 0,0 '' + IL_000e: ldarg.0 + IL_000f: stloc.0 + IL_0010: ldarg.1 + IL_0011: stloc.1 + IL_0012: call class [mscorlib]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() + IL_0017: stloc.2 + IL_0018: ldloc.0 + IL_0019: ldfld int32 XYZ.Expr::item + IL_001e: stloc.3 + IL_001f: ldloc.1 + IL_0020: ldfld int32 XYZ.Expr::item + IL_0025: stloc.s V_4 + IL_0027: ldloc.3 + IL_0028: ldloc.s V_4 + IL_002a: bge.s IL_002e + + .line 100001,100001 : 0,0 '' + IL_002c: ldc.i4.m1 + IL_002d: ret + + .line 100001,100001 : 0,0 '' + IL_002e: ldloc.3 + IL_002f: ldloc.s V_4 + IL_0031: cgt + IL_0033: ret + + .line 100001,100001 : 0,0 '' + IL_0034: ldc.i4.1 + IL_0035: ret + + .line 100001,100001 : 0,0 '' + IL_0036: ldarg.1 + IL_0037: ldnull + IL_0038: cgt.un + IL_003a: brfalse.s IL_003e + + .line 100001,100001 : 0,0 '' + IL_003c: ldc.i4.m1 + IL_003d: ret + + .line 100001,100001 : 0,0 '' + IL_003e: ldc.i4.0 + IL_003f: ret + } // end of method Expr::CompareTo + + .method public hidebysig virtual final + instance int32 CompareTo(object obj) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 13 (0xd) + .maxstack 8 + .line 7,7 : 10,14 '' + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: unbox.any XYZ.Expr + IL_0007: callvirt instance int32 XYZ.Expr::CompareTo(class XYZ.Expr) + IL_000c: ret + } // end of method Expr::CompareTo + + .method public hidebysig virtual final + instance int32 CompareTo(object obj, + class [mscorlib]System.Collections.IComparer comp) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 80 (0x50) + .maxstack 4 + .locals init ([0] class XYZ.Expr V_0, + [1] class XYZ.Expr V_1, + [2] class XYZ.Expr V_2, + [3] class [mscorlib]System.Collections.IComparer V_3, + [4] int32 V_4, + [5] int32 V_5) + .line 7,7 : 10,14 '' + IL_0000: ldarg.1 + IL_0001: unbox.any XYZ.Expr + IL_0006: stloc.0 + IL_0007: ldarg.0 + IL_0008: ldnull + IL_0009: cgt.un + IL_000b: brfalse.s IL_0041 + + .line 100001,100001 : 0,0 '' + IL_000d: ldarg.1 + IL_000e: unbox.any XYZ.Expr + IL_0013: ldnull + IL_0014: cgt.un + IL_0016: brfalse.s IL_003f + + .line 100001,100001 : 0,0 '' + IL_0018: ldarg.0 + IL_0019: pop + .line 100001,100001 : 0,0 '' + IL_001a: ldarg.0 + IL_001b: stloc.1 + IL_001c: ldloc.0 + IL_001d: stloc.2 + IL_001e: ldarg.2 + IL_001f: stloc.3 + IL_0020: ldloc.1 + IL_0021: ldfld int32 XYZ.Expr::item + IL_0026: stloc.s V_4 + IL_0028: ldloc.2 + IL_0029: ldfld int32 XYZ.Expr::item + IL_002e: stloc.s V_5 + IL_0030: ldloc.s V_4 + IL_0032: ldloc.s V_5 + IL_0034: bge.s IL_0038 + + .line 100001,100001 : 0,0 '' + IL_0036: ldc.i4.m1 + IL_0037: ret + + .line 100001,100001 : 0,0 '' + IL_0038: ldloc.s V_4 + IL_003a: ldloc.s V_5 + IL_003c: cgt + IL_003e: ret + + .line 100001,100001 : 0,0 '' + IL_003f: ldc.i4.1 + IL_0040: ret + + .line 100001,100001 : 0,0 '' + IL_0041: ldarg.1 + IL_0042: unbox.any XYZ.Expr + IL_0047: ldnull + IL_0048: cgt.un + IL_004a: brfalse.s IL_004e + + .line 100001,100001 : 0,0 '' + IL_004c: ldc.i4.m1 + IL_004d: ret + + .line 100001,100001 : 0,0 '' + IL_004e: ldc.i4.0 + IL_004f: ret + } // end of method Expr::CompareTo + + .method public hidebysig virtual final + instance int32 GetHashCode(class [mscorlib]System.Collections.IEqualityComparer comp) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 41 (0x29) + .maxstack 7 + .locals init ([0] int32 V_0, + [1] class XYZ.Expr V_1, + [2] class [mscorlib]System.Collections.IEqualityComparer V_2) + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: cgt.un + IL_0004: brfalse.s IL_0027 + + .line 100001,100001 : 0,0 '' + IL_0006: ldc.i4.0 + IL_0007: stloc.0 + IL_0008: ldarg.0 + IL_0009: pop + .line 100001,100001 : 0,0 '' + IL_000a: ldarg.0 + IL_000b: stloc.1 + IL_000c: ldc.i4.0 + IL_000d: stloc.0 + IL_000e: ldc.i4 0x9e3779b9 + IL_0013: ldarg.1 + IL_0014: stloc.2 + IL_0015: ldloc.1 + IL_0016: ldfld int32 XYZ.Expr::item + IL_001b: ldloc.0 + IL_001c: ldc.i4.6 + IL_001d: shl + IL_001e: ldloc.0 + IL_001f: ldc.i4.2 + IL_0020: shr + IL_0021: add + IL_0022: add + IL_0023: add + IL_0024: stloc.0 + IL_0025: ldloc.0 + IL_0026: ret + + .line 100001,100001 : 0,0 '' + IL_0027: ldc.i4.0 + IL_0028: ret + } // end of method Expr::GetHashCode + + .method public hidebysig virtual final + instance int32 GetHashCode() cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 12 (0xc) + .maxstack 8 + .line 7,7 : 10,14 '' + IL_0000: ldarg.0 + IL_0001: call class [mscorlib]System.Collections.IEqualityComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericEqualityComparer() + IL_0006: callvirt instance int32 XYZ.Expr::GetHashCode(class [mscorlib]System.Collections.IEqualityComparer) + IL_000b: ret + } // end of method Expr::GetHashCode + + .method public hidebysig virtual final + instance bool Equals(object obj, + class [mscorlib]System.Collections.IEqualityComparer comp) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 52 (0x34) + .maxstack 4 + .locals init ([0] class XYZ.Expr V_0, + [1] class XYZ.Expr V_1, + [2] class XYZ.Expr V_2, + [3] class XYZ.Expr V_3, + [4] class [mscorlib]System.Collections.IEqualityComparer V_4) + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: cgt.un + IL_0004: brfalse.s IL_002c + + .line 100001,100001 : 0,0 '' + IL_0006: ldarg.1 + IL_0007: isinst XYZ.Expr + IL_000c: stloc.0 + IL_000d: ldloc.0 + IL_000e: brfalse.s IL_002a + + .line 100001,100001 : 0,0 '' + IL_0010: ldloc.0 + IL_0011: stloc.1 + IL_0012: ldarg.0 + IL_0013: pop + .line 100001,100001 : 0,0 '' + IL_0014: ldarg.0 + IL_0015: stloc.2 + IL_0016: ldloc.1 + IL_0017: stloc.3 + IL_0018: ldarg.2 + IL_0019: stloc.s V_4 + IL_001b: ldloc.2 + IL_001c: ldfld int32 XYZ.Expr::item + IL_0021: ldloc.3 + IL_0022: ldfld int32 XYZ.Expr::item + IL_0027: ceq + IL_0029: ret + + .line 100001,100001 : 0,0 '' + IL_002a: ldc.i4.0 + IL_002b: ret + + .line 100001,100001 : 0,0 '' + IL_002c: ldarg.1 + IL_002d: ldnull + IL_002e: cgt.un + IL_0030: ldc.i4.0 + IL_0031: ceq + IL_0033: ret + } // end of method Expr::Equals + + .method public hidebysig virtual final + instance bool Equals(class XYZ.Expr obj) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 43 (0x2b) + .maxstack 4 + .locals init ([0] class XYZ.Expr V_0, + [1] class XYZ.Expr V_1) + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: cgt.un + IL_0004: brfalse.s IL_0023 + + .line 100001,100001 : 0,0 '' + IL_0006: ldarg.1 + IL_0007: ldnull + IL_0008: cgt.un + IL_000a: brfalse.s IL_0021 + + .line 100001,100001 : 0,0 '' + IL_000c: ldarg.0 + IL_000d: pop + .line 100001,100001 : 0,0 '' + IL_000e: ldarg.0 + IL_000f: stloc.0 + IL_0010: ldarg.1 + IL_0011: stloc.1 + IL_0012: ldloc.0 + IL_0013: ldfld int32 XYZ.Expr::item + IL_0018: ldloc.1 + IL_0019: ldfld int32 XYZ.Expr::item + IL_001e: ceq + IL_0020: ret + + .line 100001,100001 : 0,0 '' + IL_0021: ldc.i4.0 + IL_0022: ret + + .line 100001,100001 : 0,0 '' + IL_0023: ldarg.1 + IL_0024: ldnull + IL_0025: cgt.un + IL_0027: ldc.i4.0 + IL_0028: ceq + IL_002a: ret + } // end of method Expr::Equals + + .method public hidebysig virtual final + instance bool Equals(object obj) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 20 (0x14) + .maxstack 4 + .locals init ([0] class XYZ.Expr V_0) + .line 7,7 : 10,14 '' + IL_0000: ldarg.1 + IL_0001: isinst XYZ.Expr + IL_0006: stloc.0 + IL_0007: ldloc.0 + IL_0008: brfalse.s IL_0012 + + .line 100001,100001 : 0,0 '' + IL_000a: ldarg.0 + IL_000b: ldloc.0 + IL_000c: callvirt instance bool XYZ.Expr::Equals(class XYZ.Expr) + IL_0011: ret + + .line 100001,100001 : 0,0 '' + IL_0012: ldc.i4.0 + IL_0013: ret + } // end of method Expr::Equals + + .property instance int32 Tag() + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .get instance int32 XYZ.Expr::get_Tag() + } // end of property Expr::Tag + .property instance int32 Item() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32, + int32) = ( 01 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance int32 XYZ.Expr::get_Item() + } // end of property Expr::Item +} // end of class XYZ.Expr + +.class public auto ansi serializable beforefieldinit XYZ.MyExn + extends [mscorlib]System.Exception + implements [mscorlib]System.Collections.IStructuralEquatable +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 05 00 00 00 00 00 ) + .field assembly int32 Data0@ + .method public specialname rtspecialname + instance void .ctor(int32 data0) cil managed + { + // Code size 14 (0xe) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Exception::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld int32 XYZ.MyExn::Data0@ + IL_000d: ret + } // end of method MyExn::.ctor + + .method public specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Exception::.ctor() + IL_0006: ret + } // end of method MyExn::.ctor + + .method family specialname rtspecialname + instance void .ctor(class [mscorlib]System.Runtime.Serialization.SerializationInfo info, + valuetype [mscorlib]System.Runtime.Serialization.StreamingContext context) cil managed + { + // Code size 9 (0x9) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: ldarg.2 + IL_0003: call instance void [mscorlib]System.Exception::.ctor(class [mscorlib]System.Runtime.Serialization.SerializationInfo, + valuetype [mscorlib]System.Runtime.Serialization.StreamingContext) + IL_0008: ret + } // end of method MyExn::.ctor + + .method public hidebysig specialname instance int32 + get_Data0() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld int32 XYZ.MyExn::Data0@ + IL_0006: ret + } // end of method MyExn::get_Data0 + + .method public hidebysig virtual instance int32 + GetHashCode(class [mscorlib]System.Collections.IEqualityComparer comp) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 40 (0x28) + .maxstack 7 + .locals init ([0] int32 V_0, + [1] class [mscorlib]System.Collections.IEqualityComparer V_1) + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: cgt.un + IL_0004: brfalse.s IL_0026 + + .line 100001,100001 : 0,0 '' + IL_0006: ldc.i4.0 + IL_0007: stloc.0 + IL_0008: ldc.i4 0x9e3779b9 + IL_000d: ldarg.1 + IL_000e: stloc.1 + IL_000f: ldarg.0 + IL_0010: castclass XYZ.MyExn + IL_0015: call instance int32 XYZ.MyExn::get_Data0() + IL_001a: ldloc.0 + IL_001b: ldc.i4.6 + IL_001c: shl + IL_001d: ldloc.0 + IL_001e: ldc.i4.2 + IL_001f: shr + IL_0020: add + IL_0021: add + IL_0022: add + IL_0023: stloc.0 + IL_0024: ldloc.0 + IL_0025: ret + + .line 100001,100001 : 0,0 '' + IL_0026: ldc.i4.0 + IL_0027: ret + } // end of method MyExn::GetHashCode + + .method public hidebysig virtual instance int32 + GetHashCode() cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 12 (0xc) + .maxstack 8 + .line 8,8 : 15,20 '' + IL_0000: ldarg.0 + IL_0001: call class [mscorlib]System.Collections.IEqualityComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericEqualityComparer() + IL_0006: callvirt instance int32 XYZ.MyExn::GetHashCode(class [mscorlib]System.Collections.IEqualityComparer) + IL_000b: ret + } // end of method MyExn::GetHashCode + + .method public hidebysig virtual instance bool + Equals(object obj, + class [mscorlib]System.Collections.IEqualityComparer comp) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 67 (0x43) + .maxstack 4 + .locals init ([0] class [mscorlib]System.Exception V_0, + [1] class [mscorlib]System.Exception V_1, + [2] class [mscorlib]System.Collections.IEqualityComparer V_2) + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: cgt.un + IL_0004: brfalse.s IL_003b + + .line 100001,100001 : 0,0 '' + IL_0006: ldarg.1 + IL_0007: isinst [mscorlib]System.Exception + IL_000c: stloc.0 + IL_000d: ldloc.0 + IL_000e: brfalse.s IL_0039 + + .line 100001,100001 : 0,0 '' + IL_0010: ldloc.0 + IL_0011: stloc.1 + IL_0012: ldloc.0 + IL_0013: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::TypeTestGeneric(object) + IL_0018: brtrue.s IL_001c + + IL_001a: br.s IL_0037 + + .line 100001,100001 : 0,0 '' + IL_001c: ldarg.2 + IL_001d: stloc.2 + IL_001e: ldarg.0 + IL_001f: castclass XYZ.MyExn + IL_0024: call instance int32 XYZ.MyExn::get_Data0() + IL_0029: ldloc.1 + IL_002a: castclass XYZ.MyExn + IL_002f: call instance int32 XYZ.MyExn::get_Data0() + IL_0034: ceq + IL_0036: ret + + .line 100001,100001 : 0,0 '' + IL_0037: ldc.i4.0 + IL_0038: ret + + .line 100001,100001 : 0,0 '' + IL_0039: ldc.i4.0 + IL_003a: ret + + .line 100001,100001 : 0,0 '' + IL_003b: ldarg.1 + IL_003c: ldnull + IL_003d: cgt.un + IL_003f: ldc.i4.0 + IL_0040: ceq + IL_0042: ret + } // end of method MyExn::Equals + + .method public hidebysig instance bool + Equals(class [mscorlib]System.Exception obj) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 59 (0x3b) + .maxstack 8 + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: cgt.un + IL_0004: brfalse.s IL_0033 + + .line 100001,100001 : 0,0 '' + IL_0006: ldarg.1 + IL_0007: ldnull + IL_0008: cgt.un + IL_000a: brfalse.s IL_0031 + + .line 100001,100001 : 0,0 '' + IL_000c: ldarg.1 + IL_000d: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::TypeTestGeneric(object) + IL_0012: brtrue.s IL_0016 + + IL_0014: br.s IL_002f + + .line 100001,100001 : 0,0 '' + IL_0016: ldarg.0 + IL_0017: castclass XYZ.MyExn + IL_001c: call instance int32 XYZ.MyExn::get_Data0() + IL_0021: ldarg.1 + IL_0022: castclass XYZ.MyExn + IL_0027: call instance int32 XYZ.MyExn::get_Data0() + IL_002c: ceq + IL_002e: ret + + .line 100001,100001 : 0,0 '' + IL_002f: ldc.i4.0 + IL_0030: ret + + .line 100001,100001 : 0,0 '' + IL_0031: ldc.i4.0 + IL_0032: ret + + .line 100001,100001 : 0,0 '' + IL_0033: ldarg.1 + IL_0034: ldnull + IL_0035: cgt.un + IL_0037: ldc.i4.0 + IL_0038: ceq + IL_003a: ret + } // end of method MyExn::Equals + + .method public hidebysig virtual instance bool + Equals(object obj) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 20 (0x14) + .maxstack 4 + .locals init ([0] class [mscorlib]System.Exception V_0) + .line 8,8 : 15,20 '' + IL_0000: ldarg.1 + IL_0001: isinst [mscorlib]System.Exception + IL_0006: stloc.0 + IL_0007: ldloc.0 + IL_0008: brfalse.s IL_0012 + + .line 100001,100001 : 0,0 '' + IL_000a: ldarg.0 + IL_000b: ldloc.0 + IL_000c: callvirt instance bool XYZ.MyExn::Equals(class [mscorlib]System.Exception) + IL_0011: ret + + .line 100001,100001 : 0,0 '' + IL_0012: ldc.i4.0 + IL_0013: ret + } // end of method MyExn::Equals + + .property instance int32 Data0() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 04 00 00 00 00 00 00 00 00 00 ) + .get instance int32 XYZ.MyExn::get_Data0() + } // end of property MyExn::Data0 +} // end of class XYZ.MyExn + +.class public auto ansi serializable XYZ.A + extends [mscorlib]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) + .field assembly string x + .method public specialname rtspecialname + instance void .ctor(string x) cil managed + { + // Code size 16 (0x10) + .maxstack 8 + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: callvirt instance void [mscorlib]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: pop + .line 9,9 : 12,13 '' + IL_0008: ldarg.0 + IL_0009: ldarg.1 + IL_000a: stfld string XYZ.A::x + .line 9,9 : 10,11 '' + IL_000f: ret + } // end of method A::.ctor + + .method public hidebysig specialname instance string + get_X() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + .line 9,9 : 38,39 '' + IL_0000: ldarg.0 + IL_0001: ldfld string XYZ.A::x + IL_0006: ret + } // end of method A::get_X + + .property instance string X() + { + .get instance string XYZ.A::get_X() + } // end of property A::X +} // end of class XYZ.A + +.class public abstract auto ansi sealed XYZ.ABC + extends [mscorlib]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .class auto autochar serializable sealed nested public beforefieldinit Expr + extends [mscorlib]System.Object + implements class [mscorlib]System.IEquatable`1, + [mscorlib]System.Collections.IStructuralEquatable, + class [mscorlib]System.IComparable`1, + [mscorlib]System.IComparable, + [mscorlib]System.Collections.IStructuralComparable + { + .custom instance void [mscorlib]System.Diagnostics.DebuggerDisplayAttribute::.ctor(string) = ( 01 00 15 7B 5F 5F 44 65 62 75 67 44 69 73 70 6C // ...{__DebugDispl + 61 79 28 29 2C 6E 71 7D 00 00 ) // ay(),nq}.. + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 01 00 00 00 00 00 ) + .field assembly initonly int32 item + .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public static class XYZ.ABC/Expr + NewNum(int32 item) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 08 00 00 00 00 00 00 00 00 00 ) + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: newobj instance void XYZ.ABC/Expr::.ctor(int32) + IL_0006: ret + } // end of method Expr::NewNum + + .method assembly specialname rtspecialname + instance void .ctor(int32 item) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 14 (0xe) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld int32 XYZ.ABC/Expr::item + IL_000d: ret + } // end of method Expr::.ctor + + .method public hidebysig instance int32 + get_Item() cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld int32 XYZ.ABC/Expr::item + IL_0006: ret + } // end of method Expr::get_Item + + .method public hidebysig instance int32 + get_Tag() cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 4 (0x4) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: pop + IL_0002: ldc.i4.0 + IL_0003: ret + } // end of method Expr::get_Tag + + .method assembly hidebysig specialname + instance object __DebugDisplay() cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 22 (0x16) + .maxstack 8 + IL_0000: ldstr "%+0.8A" + IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,string>::.ctor(string) + IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatToString>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_000f: ldarg.0 + IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0015: ret + } // end of method Expr::__DebugDisplay + + .method public strict virtual instance string + ToString() cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 22 (0x16) + .maxstack 8 + IL_0000: ldstr "%+A" + IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,class XYZ.ABC/Expr>::.ctor(string) + IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatToString>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_000f: ldarg.0 + IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0015: ret + } // end of method Expr::ToString + + .method public hidebysig virtual final + instance int32 CompareTo(class XYZ.ABC/Expr obj) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 64 (0x40) + .maxstack 4 + .locals init ([0] class XYZ.ABC/Expr V_0, + [1] class XYZ.ABC/Expr V_1, + [2] class [mscorlib]System.Collections.IComparer V_2, + [3] int32 V_3, + [4] int32 V_4) + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: cgt.un + IL_0004: brfalse.s IL_0036 + + .line 100001,100001 : 0,0 '' + IL_0006: ldarg.1 + IL_0007: ldnull + IL_0008: cgt.un + IL_000a: brfalse.s IL_0034 + + .line 100001,100001 : 0,0 '' + IL_000c: ldarg.0 + IL_000d: pop + .line 100001,100001 : 0,0 '' + IL_000e: ldarg.0 + IL_000f: stloc.0 + IL_0010: ldarg.1 + IL_0011: stloc.1 + IL_0012: call class [mscorlib]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() + IL_0017: stloc.2 + IL_0018: ldloc.0 + IL_0019: ldfld int32 XYZ.ABC/Expr::item + IL_001e: stloc.3 + IL_001f: ldloc.1 + IL_0020: ldfld int32 XYZ.ABC/Expr::item + IL_0025: stloc.s V_4 + IL_0027: ldloc.3 + IL_0028: ldloc.s V_4 + IL_002a: bge.s IL_002e + + .line 100001,100001 : 0,0 '' + IL_002c: ldc.i4.m1 + IL_002d: ret + + .line 100001,100001 : 0,0 '' + IL_002e: ldloc.3 + IL_002f: ldloc.s V_4 + IL_0031: cgt + IL_0033: ret + + .line 100001,100001 : 0,0 '' + IL_0034: ldc.i4.1 + IL_0035: ret + + .line 100001,100001 : 0,0 '' + IL_0036: ldarg.1 + IL_0037: ldnull + IL_0038: cgt.un + IL_003a: brfalse.s IL_003e + + .line 100001,100001 : 0,0 '' + IL_003c: ldc.i4.m1 + IL_003d: ret + + .line 100001,100001 : 0,0 '' + IL_003e: ldc.i4.0 + IL_003f: ret + } // end of method Expr::CompareTo + + .method public hidebysig virtual final + instance int32 CompareTo(object obj) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 13 (0xd) + .maxstack 8 + .line 13,13 : 14,18 '' + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: unbox.any XYZ.ABC/Expr + IL_0007: callvirt instance int32 XYZ.ABC/Expr::CompareTo(class XYZ.ABC/Expr) + IL_000c: ret + } // end of method Expr::CompareTo + + .method public hidebysig virtual final + instance int32 CompareTo(object obj, + class [mscorlib]System.Collections.IComparer comp) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 80 (0x50) + .maxstack 4 + .locals init ([0] class XYZ.ABC/Expr V_0, + [1] class XYZ.ABC/Expr V_1, + [2] class XYZ.ABC/Expr V_2, + [3] class [mscorlib]System.Collections.IComparer V_3, + [4] int32 V_4, + [5] int32 V_5) + .line 13,13 : 14,18 '' + IL_0000: ldarg.1 + IL_0001: unbox.any XYZ.ABC/Expr + IL_0006: stloc.0 + IL_0007: ldarg.0 + IL_0008: ldnull + IL_0009: cgt.un + IL_000b: brfalse.s IL_0041 + + .line 100001,100001 : 0,0 '' + IL_000d: ldarg.1 + IL_000e: unbox.any XYZ.ABC/Expr + IL_0013: ldnull + IL_0014: cgt.un + IL_0016: brfalse.s IL_003f + + .line 100001,100001 : 0,0 '' + IL_0018: ldarg.0 + IL_0019: pop + .line 100001,100001 : 0,0 '' + IL_001a: ldarg.0 + IL_001b: stloc.1 + IL_001c: ldloc.0 + IL_001d: stloc.2 + IL_001e: ldarg.2 + IL_001f: stloc.3 + IL_0020: ldloc.1 + IL_0021: ldfld int32 XYZ.ABC/Expr::item + IL_0026: stloc.s V_4 + IL_0028: ldloc.2 + IL_0029: ldfld int32 XYZ.ABC/Expr::item + IL_002e: stloc.s V_5 + IL_0030: ldloc.s V_4 + IL_0032: ldloc.s V_5 + IL_0034: bge.s IL_0038 + + .line 100001,100001 : 0,0 '' + IL_0036: ldc.i4.m1 + IL_0037: ret + + .line 100001,100001 : 0,0 '' + IL_0038: ldloc.s V_4 + IL_003a: ldloc.s V_5 + IL_003c: cgt + IL_003e: ret + + .line 100001,100001 : 0,0 '' + IL_003f: ldc.i4.1 + IL_0040: ret + + .line 100001,100001 : 0,0 '' + IL_0041: ldarg.1 + IL_0042: unbox.any XYZ.ABC/Expr + IL_0047: ldnull + IL_0048: cgt.un + IL_004a: brfalse.s IL_004e + + .line 100001,100001 : 0,0 '' + IL_004c: ldc.i4.m1 + IL_004d: ret + + .line 100001,100001 : 0,0 '' + IL_004e: ldc.i4.0 + IL_004f: ret + } // end of method Expr::CompareTo + + .method public hidebysig virtual final + instance int32 GetHashCode(class [mscorlib]System.Collections.IEqualityComparer comp) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 41 (0x29) + .maxstack 7 + .locals init ([0] int32 V_0, + [1] class XYZ.ABC/Expr V_1, + [2] class [mscorlib]System.Collections.IEqualityComparer V_2) + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: cgt.un + IL_0004: brfalse.s IL_0027 + + .line 100001,100001 : 0,0 '' + IL_0006: ldc.i4.0 + IL_0007: stloc.0 + IL_0008: ldarg.0 + IL_0009: pop + .line 100001,100001 : 0,0 '' + IL_000a: ldarg.0 + IL_000b: stloc.1 + IL_000c: ldc.i4.0 + IL_000d: stloc.0 + IL_000e: ldc.i4 0x9e3779b9 + IL_0013: ldarg.1 + IL_0014: stloc.2 + IL_0015: ldloc.1 + IL_0016: ldfld int32 XYZ.ABC/Expr::item + IL_001b: ldloc.0 + IL_001c: ldc.i4.6 + IL_001d: shl + IL_001e: ldloc.0 + IL_001f: ldc.i4.2 + IL_0020: shr + IL_0021: add + IL_0022: add + IL_0023: add + IL_0024: stloc.0 + IL_0025: ldloc.0 + IL_0026: ret + + .line 100001,100001 : 0,0 '' + IL_0027: ldc.i4.0 + IL_0028: ret + } // end of method Expr::GetHashCode + + .method public hidebysig virtual final + instance int32 GetHashCode() cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 12 (0xc) + .maxstack 8 + .line 13,13 : 14,18 '' + IL_0000: ldarg.0 + IL_0001: call class [mscorlib]System.Collections.IEqualityComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericEqualityComparer() + IL_0006: callvirt instance int32 XYZ.ABC/Expr::GetHashCode(class [mscorlib]System.Collections.IEqualityComparer) + IL_000b: ret + } // end of method Expr::GetHashCode + + .method public hidebysig virtual final + instance bool Equals(object obj, + class [mscorlib]System.Collections.IEqualityComparer comp) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 52 (0x34) + .maxstack 4 + .locals init ([0] class XYZ.ABC/Expr V_0, + [1] class XYZ.ABC/Expr V_1, + [2] class XYZ.ABC/Expr V_2, + [3] class XYZ.ABC/Expr V_3, + [4] class [mscorlib]System.Collections.IEqualityComparer V_4) + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: cgt.un + IL_0004: brfalse.s IL_002c + + .line 100001,100001 : 0,0 '' + IL_0006: ldarg.1 + IL_0007: isinst XYZ.ABC/Expr + IL_000c: stloc.0 + IL_000d: ldloc.0 + IL_000e: brfalse.s IL_002a + + .line 100001,100001 : 0,0 '' + IL_0010: ldloc.0 + IL_0011: stloc.1 + IL_0012: ldarg.0 + IL_0013: pop + .line 100001,100001 : 0,0 '' + IL_0014: ldarg.0 + IL_0015: stloc.2 + IL_0016: ldloc.1 + IL_0017: stloc.3 + IL_0018: ldarg.2 + IL_0019: stloc.s V_4 + IL_001b: ldloc.2 + IL_001c: ldfld int32 XYZ.ABC/Expr::item + IL_0021: ldloc.3 + IL_0022: ldfld int32 XYZ.ABC/Expr::item + IL_0027: ceq + IL_0029: ret + + .line 100001,100001 : 0,0 '' + IL_002a: ldc.i4.0 + IL_002b: ret + + .line 100001,100001 : 0,0 '' + IL_002c: ldarg.1 + IL_002d: ldnull + IL_002e: cgt.un + IL_0030: ldc.i4.0 + IL_0031: ceq + IL_0033: ret + } // end of method Expr::Equals + + .method public hidebysig virtual final + instance bool Equals(class XYZ.ABC/Expr obj) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 43 (0x2b) + .maxstack 4 + .locals init ([0] class XYZ.ABC/Expr V_0, + [1] class XYZ.ABC/Expr V_1) + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: cgt.un + IL_0004: brfalse.s IL_0023 + + .line 100001,100001 : 0,0 '' + IL_0006: ldarg.1 + IL_0007: ldnull + IL_0008: cgt.un + IL_000a: brfalse.s IL_0021 + + .line 100001,100001 : 0,0 '' + IL_000c: ldarg.0 + IL_000d: pop + .line 100001,100001 : 0,0 '' + IL_000e: ldarg.0 + IL_000f: stloc.0 + IL_0010: ldarg.1 + IL_0011: stloc.1 + IL_0012: ldloc.0 + IL_0013: ldfld int32 XYZ.ABC/Expr::item + IL_0018: ldloc.1 + IL_0019: ldfld int32 XYZ.ABC/Expr::item + IL_001e: ceq + IL_0020: ret + + .line 100001,100001 : 0,0 '' + IL_0021: ldc.i4.0 + IL_0022: ret + + .line 100001,100001 : 0,0 '' + IL_0023: ldarg.1 + IL_0024: ldnull + IL_0025: cgt.un + IL_0027: ldc.i4.0 + IL_0028: ceq + IL_002a: ret + } // end of method Expr::Equals + + .method public hidebysig virtual final + instance bool Equals(object obj) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 20 (0x14) + .maxstack 4 + .locals init ([0] class XYZ.ABC/Expr V_0) + .line 13,13 : 14,18 '' + IL_0000: ldarg.1 + IL_0001: isinst XYZ.ABC/Expr + IL_0006: stloc.0 + IL_0007: ldloc.0 + IL_0008: brfalse.s IL_0012 + + .line 100001,100001 : 0,0 '' + IL_000a: ldarg.0 + IL_000b: ldloc.0 + IL_000c: callvirt instance bool XYZ.ABC/Expr::Equals(class XYZ.ABC/Expr) + IL_0011: ret + + .line 100001,100001 : 0,0 '' + IL_0012: ldc.i4.0 + IL_0013: ret + } // end of method Expr::Equals + + .property instance int32 Tag() + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .get instance int32 XYZ.ABC/Expr::get_Tag() + } // end of property Expr::Tag + .property instance int32 Item() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32, + int32) = ( 01 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance int32 XYZ.ABC/Expr::get_Item() + } // end of property Expr::Item + } // end of class Expr + + .class auto ansi serializable nested public beforefieldinit MyExn + extends [mscorlib]System.Exception + implements [mscorlib]System.Collections.IStructuralEquatable + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 05 00 00 00 00 00 ) + .field assembly int32 Data0@ + .method public specialname rtspecialname + instance void .ctor(int32 data0) cil managed + { + // Code size 14 (0xe) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Exception::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld int32 XYZ.ABC/MyExn::Data0@ + IL_000d: ret + } // end of method MyExn::.ctor + + .method public specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Exception::.ctor() + IL_0006: ret + } // end of method MyExn::.ctor + + .method family specialname rtspecialname + instance void .ctor(class [mscorlib]System.Runtime.Serialization.SerializationInfo info, + valuetype [mscorlib]System.Runtime.Serialization.StreamingContext context) cil managed + { + // Code size 9 (0x9) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: ldarg.2 + IL_0003: call instance void [mscorlib]System.Exception::.ctor(class [mscorlib]System.Runtime.Serialization.SerializationInfo, + valuetype [mscorlib]System.Runtime.Serialization.StreamingContext) + IL_0008: ret + } // end of method MyExn::.ctor + + .method public hidebysig specialname + instance int32 get_Data0() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld int32 XYZ.ABC/MyExn::Data0@ + IL_0006: ret + } // end of method MyExn::get_Data0 + + .method public hidebysig virtual instance int32 + GetHashCode(class [mscorlib]System.Collections.IEqualityComparer comp) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 40 (0x28) + .maxstack 7 + .locals init ([0] int32 V_0, + [1] class [mscorlib]System.Collections.IEqualityComparer V_1) + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: cgt.un + IL_0004: brfalse.s IL_0026 + + .line 100001,100001 : 0,0 '' + IL_0006: ldc.i4.0 + IL_0007: stloc.0 + IL_0008: ldc.i4 0x9e3779b9 + IL_000d: ldarg.1 + IL_000e: stloc.1 + IL_000f: ldarg.0 + IL_0010: castclass XYZ.ABC/MyExn + IL_0015: call instance int32 XYZ.ABC/MyExn::get_Data0() + IL_001a: ldloc.0 + IL_001b: ldc.i4.6 + IL_001c: shl + IL_001d: ldloc.0 + IL_001e: ldc.i4.2 + IL_001f: shr + IL_0020: add + IL_0021: add + IL_0022: add + IL_0023: stloc.0 + IL_0024: ldloc.0 + IL_0025: ret + + .line 100001,100001 : 0,0 '' + IL_0026: ldc.i4.0 + IL_0027: ret + } // end of method MyExn::GetHashCode + + .method public hidebysig virtual instance int32 + GetHashCode() cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 12 (0xc) + .maxstack 8 + .line 14,14 : 19,24 '' + IL_0000: ldarg.0 + IL_0001: call class [mscorlib]System.Collections.IEqualityComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericEqualityComparer() + IL_0006: callvirt instance int32 XYZ.ABC/MyExn::GetHashCode(class [mscorlib]System.Collections.IEqualityComparer) + IL_000b: ret + } // end of method MyExn::GetHashCode + + .method public hidebysig virtual instance bool + Equals(object obj, + class [mscorlib]System.Collections.IEqualityComparer comp) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 67 (0x43) + .maxstack 4 + .locals init ([0] class [mscorlib]System.Exception V_0, + [1] class [mscorlib]System.Exception V_1, + [2] class [mscorlib]System.Collections.IEqualityComparer V_2) + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: cgt.un + IL_0004: brfalse.s IL_003b + + .line 100001,100001 : 0,0 '' + IL_0006: ldarg.1 + IL_0007: isinst [mscorlib]System.Exception + IL_000c: stloc.0 + IL_000d: ldloc.0 + IL_000e: brfalse.s IL_0039 + + .line 100001,100001 : 0,0 '' + IL_0010: ldloc.0 + IL_0011: stloc.1 + IL_0012: ldloc.0 + IL_0013: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::TypeTestGeneric(object) + IL_0018: brtrue.s IL_001c + + IL_001a: br.s IL_0037 + + .line 100001,100001 : 0,0 '' + IL_001c: ldarg.2 + IL_001d: stloc.2 + IL_001e: ldarg.0 + IL_001f: castclass XYZ.ABC/MyExn + IL_0024: call instance int32 XYZ.ABC/MyExn::get_Data0() + IL_0029: ldloc.1 + IL_002a: castclass XYZ.ABC/MyExn + IL_002f: call instance int32 XYZ.ABC/MyExn::get_Data0() + IL_0034: ceq + IL_0036: ret + + .line 100001,100001 : 0,0 '' + IL_0037: ldc.i4.0 + IL_0038: ret + + .line 100001,100001 : 0,0 '' + IL_0039: ldc.i4.0 + IL_003a: ret + + .line 100001,100001 : 0,0 '' + IL_003b: ldarg.1 + IL_003c: ldnull + IL_003d: cgt.un + IL_003f: ldc.i4.0 + IL_0040: ceq + IL_0042: ret + } // end of method MyExn::Equals + + .method public hidebysig instance bool + Equals(class [mscorlib]System.Exception obj) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 59 (0x3b) + .maxstack 8 + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: cgt.un + IL_0004: brfalse.s IL_0033 + + .line 100001,100001 : 0,0 '' + IL_0006: ldarg.1 + IL_0007: ldnull + IL_0008: cgt.un + IL_000a: brfalse.s IL_0031 + + .line 100001,100001 : 0,0 '' + IL_000c: ldarg.1 + IL_000d: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::TypeTestGeneric(object) + IL_0012: brtrue.s IL_0016 + + IL_0014: br.s IL_002f + + .line 100001,100001 : 0,0 '' + IL_0016: ldarg.0 + IL_0017: castclass XYZ.ABC/MyExn + IL_001c: call instance int32 XYZ.ABC/MyExn::get_Data0() + IL_0021: ldarg.1 + IL_0022: castclass XYZ.ABC/MyExn + IL_0027: call instance int32 XYZ.ABC/MyExn::get_Data0() + IL_002c: ceq + IL_002e: ret + + .line 100001,100001 : 0,0 '' + IL_002f: ldc.i4.0 + IL_0030: ret + + .line 100001,100001 : 0,0 '' + IL_0031: ldc.i4.0 + IL_0032: ret + + .line 100001,100001 : 0,0 '' + IL_0033: ldarg.1 + IL_0034: ldnull + IL_0035: cgt.un + IL_0037: ldc.i4.0 + IL_0038: ceq + IL_003a: ret + } // end of method MyExn::Equals + + .method public hidebysig virtual instance bool + Equals(object obj) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 20 (0x14) + .maxstack 4 + .locals init ([0] class [mscorlib]System.Exception V_0) + .line 14,14 : 19,24 '' + IL_0000: ldarg.1 + IL_0001: isinst [mscorlib]System.Exception + IL_0006: stloc.0 + IL_0007: ldloc.0 + IL_0008: brfalse.s IL_0012 + + .line 100001,100001 : 0,0 '' + IL_000a: ldarg.0 + IL_000b: ldloc.0 + IL_000c: callvirt instance bool XYZ.ABC/MyExn::Equals(class [mscorlib]System.Exception) + IL_0011: ret + + .line 100001,100001 : 0,0 '' + IL_0012: ldc.i4.0 + IL_0013: ret + } // end of method MyExn::Equals + + .property instance int32 Data0() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 04 00 00 00 00 00 00 00 00 00 ) + .get instance int32 XYZ.ABC/MyExn::get_Data0() + } // end of property MyExn::Data0 + } // end of class MyExn + + .class auto ansi serializable nested public A + extends [mscorlib]System.Object + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) + .field assembly string x + .method public specialname rtspecialname + instance void .ctor(string x) cil managed + { + // Code size 16 (0x10) + .maxstack 8 + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: callvirt instance void [mscorlib]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: pop + .line 15,15 : 16,17 '' + IL_0008: ldarg.0 + IL_0009: ldarg.1 + IL_000a: stfld string XYZ.ABC/A::x + .line 15,15 : 14,15 '' + IL_000f: ret + } // end of method A::.ctor + + .method public hidebysig specialname + instance string get_X() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + .line 15,15 : 42,43 '' + IL_0000: ldarg.0 + IL_0001: ldfld string XYZ.ABC/A::x + IL_0006: ret + } // end of method A::get_X + + .property instance string X() + { + .get instance string XYZ.ABC/A::get_X() + } // end of property A::X + } // end of class A + + .class abstract auto ansi sealed nested public ABC + extends [mscorlib]System.Object + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .class auto autochar serializable sealed nested public beforefieldinit Expr + extends [mscorlib]System.Object + implements class [mscorlib]System.IEquatable`1, + [mscorlib]System.Collections.IStructuralEquatable, + class [mscorlib]System.IComparable`1, + [mscorlib]System.IComparable, + [mscorlib]System.Collections.IStructuralComparable + { + .custom instance void [mscorlib]System.Diagnostics.DebuggerDisplayAttribute::.ctor(string) = ( 01 00 15 7B 5F 5F 44 65 62 75 67 44 69 73 70 6C // ...{__DebugDispl + 61 79 28 29 2C 6E 71 7D 00 00 ) // ay(),nq}.. + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 01 00 00 00 00 00 ) + .field assembly initonly int32 item + .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public static class XYZ.ABC/ABC/Expr + NewNum(int32 item) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 08 00 00 00 00 00 00 00 00 00 ) + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: newobj instance void XYZ.ABC/ABC/Expr::.ctor(int32) + IL_0006: ret + } // end of method Expr::NewNum + + .method assembly specialname rtspecialname + instance void .ctor(int32 item) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 14 (0xe) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld int32 XYZ.ABC/ABC/Expr::item + IL_000d: ret + } // end of method Expr::.ctor + + .method public hidebysig instance int32 + get_Item() cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld int32 XYZ.ABC/ABC/Expr::item + IL_0006: ret + } // end of method Expr::get_Item + + .method public hidebysig instance int32 + get_Tag() cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 4 (0x4) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: pop + IL_0002: ldc.i4.0 + IL_0003: ret + } // end of method Expr::get_Tag + + .method assembly hidebysig specialname + instance object __DebugDisplay() cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 22 (0x16) + .maxstack 8 + IL_0000: ldstr "%+0.8A" + IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,string>::.ctor(string) + IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatToString>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_000f: ldarg.0 + IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0015: ret + } // end of method Expr::__DebugDisplay + + .method public strict virtual instance string + ToString() cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 22 (0x16) + .maxstack 8 + IL_0000: ldstr "%+A" + IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,class XYZ.ABC/ABC/Expr>::.ctor(string) + IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatToString>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_000f: ldarg.0 + IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0015: ret + } // end of method Expr::ToString + + .method public hidebysig virtual final + instance int32 CompareTo(class XYZ.ABC/ABC/Expr obj) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 64 (0x40) + .maxstack 4 + .locals init ([0] class XYZ.ABC/ABC/Expr V_0, + [1] class XYZ.ABC/ABC/Expr V_1, + [2] class [mscorlib]System.Collections.IComparer V_2, + [3] int32 V_3, + [4] int32 V_4) + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: cgt.un + IL_0004: brfalse.s IL_0036 + + .line 100001,100001 : 0,0 '' + IL_0006: ldarg.1 + IL_0007: ldnull + IL_0008: cgt.un + IL_000a: brfalse.s IL_0034 + + .line 100001,100001 : 0,0 '' + IL_000c: ldarg.0 + IL_000d: pop + .line 100001,100001 : 0,0 '' + IL_000e: ldarg.0 + IL_000f: stloc.0 + IL_0010: ldarg.1 + IL_0011: stloc.1 + IL_0012: call class [mscorlib]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() + IL_0017: stloc.2 + IL_0018: ldloc.0 + IL_0019: ldfld int32 XYZ.ABC/ABC/Expr::item + IL_001e: stloc.3 + IL_001f: ldloc.1 + IL_0020: ldfld int32 XYZ.ABC/ABC/Expr::item + IL_0025: stloc.s V_4 + IL_0027: ldloc.3 + IL_0028: ldloc.s V_4 + IL_002a: bge.s IL_002e + + .line 100001,100001 : 0,0 '' + IL_002c: ldc.i4.m1 + IL_002d: ret + + .line 100001,100001 : 0,0 '' + IL_002e: ldloc.3 + IL_002f: ldloc.s V_4 + IL_0031: cgt + IL_0033: ret + + .line 100001,100001 : 0,0 '' + IL_0034: ldc.i4.1 + IL_0035: ret + + .line 100001,100001 : 0,0 '' + IL_0036: ldarg.1 + IL_0037: ldnull + IL_0038: cgt.un + IL_003a: brfalse.s IL_003e + + .line 100001,100001 : 0,0 '' + IL_003c: ldc.i4.m1 + IL_003d: ret + + .line 100001,100001 : 0,0 '' + IL_003e: ldc.i4.0 + IL_003f: ret + } // end of method Expr::CompareTo + + .method public hidebysig virtual final + instance int32 CompareTo(object obj) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 13 (0xd) + .maxstack 8 + .line 23,23 : 18,22 '' + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: unbox.any XYZ.ABC/ABC/Expr + IL_0007: callvirt instance int32 XYZ.ABC/ABC/Expr::CompareTo(class XYZ.ABC/ABC/Expr) + IL_000c: ret + } // end of method Expr::CompareTo + + .method public hidebysig virtual final + instance int32 CompareTo(object obj, + class [mscorlib]System.Collections.IComparer comp) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 80 (0x50) + .maxstack 4 + .locals init ([0] class XYZ.ABC/ABC/Expr V_0, + [1] class XYZ.ABC/ABC/Expr V_1, + [2] class XYZ.ABC/ABC/Expr V_2, + [3] class [mscorlib]System.Collections.IComparer V_3, + [4] int32 V_4, + [5] int32 V_5) + .line 23,23 : 18,22 '' + IL_0000: ldarg.1 + IL_0001: unbox.any XYZ.ABC/ABC/Expr + IL_0006: stloc.0 + IL_0007: ldarg.0 + IL_0008: ldnull + IL_0009: cgt.un + IL_000b: brfalse.s IL_0041 + + .line 100001,100001 : 0,0 '' + IL_000d: ldarg.1 + IL_000e: unbox.any XYZ.ABC/ABC/Expr + IL_0013: ldnull + IL_0014: cgt.un + IL_0016: brfalse.s IL_003f + + .line 100001,100001 : 0,0 '' + IL_0018: ldarg.0 + IL_0019: pop + .line 100001,100001 : 0,0 '' + IL_001a: ldarg.0 + IL_001b: stloc.1 + IL_001c: ldloc.0 + IL_001d: stloc.2 + IL_001e: ldarg.2 + IL_001f: stloc.3 + IL_0020: ldloc.1 + IL_0021: ldfld int32 XYZ.ABC/ABC/Expr::item + IL_0026: stloc.s V_4 + IL_0028: ldloc.2 + IL_0029: ldfld int32 XYZ.ABC/ABC/Expr::item + IL_002e: stloc.s V_5 + IL_0030: ldloc.s V_4 + IL_0032: ldloc.s V_5 + IL_0034: bge.s IL_0038 + + .line 100001,100001 : 0,0 '' + IL_0036: ldc.i4.m1 + IL_0037: ret + + .line 100001,100001 : 0,0 '' + IL_0038: ldloc.s V_4 + IL_003a: ldloc.s V_5 + IL_003c: cgt + IL_003e: ret + + .line 100001,100001 : 0,0 '' + IL_003f: ldc.i4.1 + IL_0040: ret + + .line 100001,100001 : 0,0 '' + IL_0041: ldarg.1 + IL_0042: unbox.any XYZ.ABC/ABC/Expr + IL_0047: ldnull + IL_0048: cgt.un + IL_004a: brfalse.s IL_004e + + .line 100001,100001 : 0,0 '' + IL_004c: ldc.i4.m1 + IL_004d: ret + + .line 100001,100001 : 0,0 '' + IL_004e: ldc.i4.0 + IL_004f: ret + } // end of method Expr::CompareTo + + .method public hidebysig virtual final + instance int32 GetHashCode(class [mscorlib]System.Collections.IEqualityComparer comp) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 41 (0x29) + .maxstack 7 + .locals init ([0] int32 V_0, + [1] class XYZ.ABC/ABC/Expr V_1, + [2] class [mscorlib]System.Collections.IEqualityComparer V_2) + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: cgt.un + IL_0004: brfalse.s IL_0027 + + .line 100001,100001 : 0,0 '' + IL_0006: ldc.i4.0 + IL_0007: stloc.0 + IL_0008: ldarg.0 + IL_0009: pop + .line 100001,100001 : 0,0 '' + IL_000a: ldarg.0 + IL_000b: stloc.1 + IL_000c: ldc.i4.0 + IL_000d: stloc.0 + IL_000e: ldc.i4 0x9e3779b9 + IL_0013: ldarg.1 + IL_0014: stloc.2 + IL_0015: ldloc.1 + IL_0016: ldfld int32 XYZ.ABC/ABC/Expr::item + IL_001b: ldloc.0 + IL_001c: ldc.i4.6 + IL_001d: shl + IL_001e: ldloc.0 + IL_001f: ldc.i4.2 + IL_0020: shr + IL_0021: add + IL_0022: add + IL_0023: add + IL_0024: stloc.0 + IL_0025: ldloc.0 + IL_0026: ret + + .line 100001,100001 : 0,0 '' + IL_0027: ldc.i4.0 + IL_0028: ret + } // end of method Expr::GetHashCode + + .method public hidebysig virtual final + instance int32 GetHashCode() cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 12 (0xc) + .maxstack 8 + .line 23,23 : 18,22 '' + IL_0000: ldarg.0 + IL_0001: call class [mscorlib]System.Collections.IEqualityComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericEqualityComparer() + IL_0006: callvirt instance int32 XYZ.ABC/ABC/Expr::GetHashCode(class [mscorlib]System.Collections.IEqualityComparer) + IL_000b: ret + } // end of method Expr::GetHashCode + + .method public hidebysig virtual final + instance bool Equals(object obj, + class [mscorlib]System.Collections.IEqualityComparer comp) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 52 (0x34) + .maxstack 4 + .locals init ([0] class XYZ.ABC/ABC/Expr V_0, + [1] class XYZ.ABC/ABC/Expr V_1, + [2] class XYZ.ABC/ABC/Expr V_2, + [3] class XYZ.ABC/ABC/Expr V_3, + [4] class [mscorlib]System.Collections.IEqualityComparer V_4) + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: cgt.un + IL_0004: brfalse.s IL_002c + + .line 100001,100001 : 0,0 '' + IL_0006: ldarg.1 + IL_0007: isinst XYZ.ABC/ABC/Expr + IL_000c: stloc.0 + IL_000d: ldloc.0 + IL_000e: brfalse.s IL_002a + + .line 100001,100001 : 0,0 '' + IL_0010: ldloc.0 + IL_0011: stloc.1 + IL_0012: ldarg.0 + IL_0013: pop + .line 100001,100001 : 0,0 '' + IL_0014: ldarg.0 + IL_0015: stloc.2 + IL_0016: ldloc.1 + IL_0017: stloc.3 + IL_0018: ldarg.2 + IL_0019: stloc.s V_4 + IL_001b: ldloc.2 + IL_001c: ldfld int32 XYZ.ABC/ABC/Expr::item + IL_0021: ldloc.3 + IL_0022: ldfld int32 XYZ.ABC/ABC/Expr::item + IL_0027: ceq + IL_0029: ret + + .line 100001,100001 : 0,0 '' + IL_002a: ldc.i4.0 + IL_002b: ret + + .line 100001,100001 : 0,0 '' + IL_002c: ldarg.1 + IL_002d: ldnull + IL_002e: cgt.un + IL_0030: ldc.i4.0 + IL_0031: ceq + IL_0033: ret + } // end of method Expr::Equals + + .method public hidebysig virtual final + instance bool Equals(class XYZ.ABC/ABC/Expr obj) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 43 (0x2b) + .maxstack 4 + .locals init ([0] class XYZ.ABC/ABC/Expr V_0, + [1] class XYZ.ABC/ABC/Expr V_1) + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: cgt.un + IL_0004: brfalse.s IL_0023 + + .line 100001,100001 : 0,0 '' + IL_0006: ldarg.1 + IL_0007: ldnull + IL_0008: cgt.un + IL_000a: brfalse.s IL_0021 + + .line 100001,100001 : 0,0 '' + IL_000c: ldarg.0 + IL_000d: pop + .line 100001,100001 : 0,0 '' + IL_000e: ldarg.0 + IL_000f: stloc.0 + IL_0010: ldarg.1 + IL_0011: stloc.1 + IL_0012: ldloc.0 + IL_0013: ldfld int32 XYZ.ABC/ABC/Expr::item + IL_0018: ldloc.1 + IL_0019: ldfld int32 XYZ.ABC/ABC/Expr::item + IL_001e: ceq + IL_0020: ret + + .line 100001,100001 : 0,0 '' + IL_0021: ldc.i4.0 + IL_0022: ret + + .line 100001,100001 : 0,0 '' + IL_0023: ldarg.1 + IL_0024: ldnull + IL_0025: cgt.un + IL_0027: ldc.i4.0 + IL_0028: ceq + IL_002a: ret + } // end of method Expr::Equals + + .method public hidebysig virtual final + instance bool Equals(object obj) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 20 (0x14) + .maxstack 4 + .locals init ([0] class XYZ.ABC/ABC/Expr V_0) + .line 23,23 : 18,22 '' + IL_0000: ldarg.1 + IL_0001: isinst XYZ.ABC/ABC/Expr + IL_0006: stloc.0 + IL_0007: ldloc.0 + IL_0008: brfalse.s IL_0012 + + .line 100001,100001 : 0,0 '' + IL_000a: ldarg.0 + IL_000b: ldloc.0 + IL_000c: callvirt instance bool XYZ.ABC/ABC/Expr::Equals(class XYZ.ABC/ABC/Expr) + IL_0011: ret + + .line 100001,100001 : 0,0 '' + IL_0012: ldc.i4.0 + IL_0013: ret + } // end of method Expr::Equals + + .property instance int32 Tag() + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .get instance int32 XYZ.ABC/ABC/Expr::get_Tag() + } // end of property Expr::Tag + .property instance int32 Item() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32, + int32) = ( 01 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance int32 XYZ.ABC/ABC/Expr::get_Item() + } // end of property Expr::Item + } // end of class Expr + + .class auto ansi serializable nested public beforefieldinit MyExn + extends [mscorlib]System.Exception + implements [mscorlib]System.Collections.IStructuralEquatable + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 05 00 00 00 00 00 ) + .field assembly int32 Data0@ + .method public specialname rtspecialname + instance void .ctor(int32 data0) cil managed + { + // Code size 14 (0xe) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Exception::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld int32 XYZ.ABC/ABC/MyExn::Data0@ + IL_000d: ret + } // end of method MyExn::.ctor + + .method public specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Exception::.ctor() + IL_0006: ret + } // end of method MyExn::.ctor + + .method family specialname rtspecialname + instance void .ctor(class [mscorlib]System.Runtime.Serialization.SerializationInfo info, + valuetype [mscorlib]System.Runtime.Serialization.StreamingContext context) cil managed + { + // Code size 9 (0x9) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: ldarg.2 + IL_0003: call instance void [mscorlib]System.Exception::.ctor(class [mscorlib]System.Runtime.Serialization.SerializationInfo, + valuetype [mscorlib]System.Runtime.Serialization.StreamingContext) + IL_0008: ret + } // end of method MyExn::.ctor + + .method public hidebysig specialname + instance int32 get_Data0() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld int32 XYZ.ABC/ABC/MyExn::Data0@ + IL_0006: ret + } // end of method MyExn::get_Data0 + + .method public hidebysig virtual instance int32 + GetHashCode(class [mscorlib]System.Collections.IEqualityComparer comp) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 40 (0x28) + .maxstack 7 + .locals init ([0] int32 V_0, + [1] class [mscorlib]System.Collections.IEqualityComparer V_1) + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: cgt.un + IL_0004: brfalse.s IL_0026 + + .line 100001,100001 : 0,0 '' + IL_0006: ldc.i4.0 + IL_0007: stloc.0 + IL_0008: ldc.i4 0x9e3779b9 + IL_000d: ldarg.1 + IL_000e: stloc.1 + IL_000f: ldarg.0 + IL_0010: castclass XYZ.ABC/ABC/MyExn + IL_0015: call instance int32 XYZ.ABC/ABC/MyExn::get_Data0() + IL_001a: ldloc.0 + IL_001b: ldc.i4.6 + IL_001c: shl + IL_001d: ldloc.0 + IL_001e: ldc.i4.2 + IL_001f: shr + IL_0020: add + IL_0021: add + IL_0022: add + IL_0023: stloc.0 + IL_0024: ldloc.0 + IL_0025: ret + + .line 100001,100001 : 0,0 '' + IL_0026: ldc.i4.0 + IL_0027: ret + } // end of method MyExn::GetHashCode + + .method public hidebysig virtual instance int32 + GetHashCode() cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 12 (0xc) + .maxstack 8 + .line 24,24 : 23,28 '' + IL_0000: ldarg.0 + IL_0001: call class [mscorlib]System.Collections.IEqualityComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericEqualityComparer() + IL_0006: callvirt instance int32 XYZ.ABC/ABC/MyExn::GetHashCode(class [mscorlib]System.Collections.IEqualityComparer) + IL_000b: ret + } // end of method MyExn::GetHashCode + + .method public hidebysig virtual instance bool + Equals(object obj, + class [mscorlib]System.Collections.IEqualityComparer comp) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 67 (0x43) + .maxstack 4 + .locals init ([0] class [mscorlib]System.Exception V_0, + [1] class [mscorlib]System.Exception V_1, + [2] class [mscorlib]System.Collections.IEqualityComparer V_2) + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: cgt.un + IL_0004: brfalse.s IL_003b + + .line 100001,100001 : 0,0 '' + IL_0006: ldarg.1 + IL_0007: isinst [mscorlib]System.Exception + IL_000c: stloc.0 + IL_000d: ldloc.0 + IL_000e: brfalse.s IL_0039 + + .line 100001,100001 : 0,0 '' + IL_0010: ldloc.0 + IL_0011: stloc.1 + IL_0012: ldloc.0 + IL_0013: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::TypeTestGeneric(object) + IL_0018: brtrue.s IL_001c + + IL_001a: br.s IL_0037 + + .line 100001,100001 : 0,0 '' + IL_001c: ldarg.2 + IL_001d: stloc.2 + IL_001e: ldarg.0 + IL_001f: castclass XYZ.ABC/ABC/MyExn + IL_0024: call instance int32 XYZ.ABC/ABC/MyExn::get_Data0() + IL_0029: ldloc.1 + IL_002a: castclass XYZ.ABC/ABC/MyExn + IL_002f: call instance int32 XYZ.ABC/ABC/MyExn::get_Data0() + IL_0034: ceq + IL_0036: ret + + .line 100001,100001 : 0,0 '' + IL_0037: ldc.i4.0 + IL_0038: ret + + .line 100001,100001 : 0,0 '' + IL_0039: ldc.i4.0 + IL_003a: ret + + .line 100001,100001 : 0,0 '' + IL_003b: ldarg.1 + IL_003c: ldnull + IL_003d: cgt.un + IL_003f: ldc.i4.0 + IL_0040: ceq + IL_0042: ret + } // end of method MyExn::Equals + + .method public hidebysig instance bool + Equals(class [mscorlib]System.Exception obj) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 59 (0x3b) + .maxstack 8 + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: cgt.un + IL_0004: brfalse.s IL_0033 + + .line 100001,100001 : 0,0 '' + IL_0006: ldarg.1 + IL_0007: ldnull + IL_0008: cgt.un + IL_000a: brfalse.s IL_0031 + + .line 100001,100001 : 0,0 '' + IL_000c: ldarg.1 + IL_000d: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::TypeTestGeneric(object) + IL_0012: brtrue.s IL_0016 + + IL_0014: br.s IL_002f + + .line 100001,100001 : 0,0 '' + IL_0016: ldarg.0 + IL_0017: castclass XYZ.ABC/ABC/MyExn + IL_001c: call instance int32 XYZ.ABC/ABC/MyExn::get_Data0() + IL_0021: ldarg.1 + IL_0022: castclass XYZ.ABC/ABC/MyExn + IL_0027: call instance int32 XYZ.ABC/ABC/MyExn::get_Data0() + IL_002c: ceq + IL_002e: ret + + .line 100001,100001 : 0,0 '' + IL_002f: ldc.i4.0 + IL_0030: ret + + .line 100001,100001 : 0,0 '' + IL_0031: ldc.i4.0 + IL_0032: ret + + .line 100001,100001 : 0,0 '' + IL_0033: ldarg.1 + IL_0034: ldnull + IL_0035: cgt.un + IL_0037: ldc.i4.0 + IL_0038: ceq + IL_003a: ret + } // end of method MyExn::Equals + + .method public hidebysig virtual instance bool + Equals(object obj) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 20 (0x14) + .maxstack 4 + .locals init ([0] class [mscorlib]System.Exception V_0) + .line 24,24 : 23,28 '' + IL_0000: ldarg.1 + IL_0001: isinst [mscorlib]System.Exception + IL_0006: stloc.0 + IL_0007: ldloc.0 + IL_0008: brfalse.s IL_0012 + + .line 100001,100001 : 0,0 '' + IL_000a: ldarg.0 + IL_000b: ldloc.0 + IL_000c: callvirt instance bool XYZ.ABC/ABC/MyExn::Equals(class [mscorlib]System.Exception) + IL_0011: ret + + .line 100001,100001 : 0,0 '' + IL_0012: ldc.i4.0 + IL_0013: ret + } // end of method MyExn::Equals + + .property instance int32 Data0() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 04 00 00 00 00 00 00 00 00 00 ) + .get instance int32 XYZ.ABC/ABC/MyExn::get_Data0() + } // end of property MyExn::Data0 + } // end of class MyExn + + .class auto ansi serializable nested public A + extends [mscorlib]System.Object + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) + .field assembly string x + .method public specialname rtspecialname + instance void .ctor(string x) cil managed + { + // Code size 16 (0x10) + .maxstack 8 + .line 100001,100001 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: callvirt instance void [mscorlib]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: pop + .line 25,25 : 20,21 '' + IL_0008: ldarg.0 + IL_0009: ldarg.1 + IL_000a: stfld string XYZ.ABC/ABC/A::x + .line 25,25 : 18,19 '' + IL_000f: ret + } // end of method A::.ctor + + .method public hidebysig specialname + instance string get_X() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + .line 25,25 : 46,47 '' + IL_0000: ldarg.0 + IL_0001: ldfld string XYZ.ABC/ABC/A::x + IL_0006: ret + } // end of method A::get_X + + .property instance string X() + { + .get instance string XYZ.ABC/ABC/A::get_X() + } // end of property A::X + } // end of class A + + .method public static int32 'add'(int32 x, + int32 y) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + // Code size 4 (0x4) + .maxstack 8 + .line 28,28 : 27,32 '' + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: add + IL_0003: ret + } // end of method ABC::'add' + + .method public specialname static string + get_greeting() cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 6 (0x6) + .maxstack 8 + IL_0000: ldstr "hello" + IL_0005: ret + } // end of method ABC::get_greeting + + .property string greeting() + { + .get string XYZ.ABC/ABC::get_greeting() + } // end of property ABC::greeting + } // end of class ABC + + .method public static int32 'add'(int32 x, + int32 y) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + // Code size 4 (0x4) + .maxstack 8 + .line 18,18 : 23,28 '' + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: add + IL_0003: ret + } // end of method ABC::'add' + + .method public specialname static string + get_greeting() cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 6 (0x6) + .maxstack 8 + IL_0000: ldstr "hello" + IL_0005: ret + } // end of method ABC::get_greeting + + .property string greeting() + { + .get string XYZ.ABC::get_greeting() + } // end of property ABC::greeting +} // end of class XYZ.ABC + +.class private abstract auto ansi sealed ''.$ToplevelNamespace + extends [mscorlib]System.Object +{ + .field static assembly int32 init@ + .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static + void .cctor() cil managed + { + // Code size 13 (0xd) + .maxstack 3 + .locals init ([0] string greeting, + [1] string V_1) + .line 19,19 : 9,31 '' + IL_0000: call string XYZ.ABC::get_greeting() + IL_0005: stloc.0 + .line 29,29 : 13,35 '' + IL_0006: call string XYZ.ABC/ABC::get_greeting() + IL_000b: stloc.1 + IL_000c: ret + } // end of method $ToplevelNamespace::.cctor + +} // end of class ''.$ToplevelNamespace + + +// ============================================================= + +// *********** DISASSEMBLY COMPLETE *********************** diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/SerializableAttribute/ToplevelNamespaceP.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/SerializableAttribute/ToplevelNamespaceP.il.bsl deleted file mode 100644 index 78d8c5dba0c..00000000000 --- a/tests/fsharpqa/Source/CodeGen/EmittedIL/SerializableAttribute/ToplevelNamespaceP.il.bsl +++ /dev/null @@ -1,2529 +0,0 @@ - -// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.81.0 -// Copyright (c) Microsoft Corporation. All rights reserved. - - - -// Metadata version: v4.0.30319 -.assembly extern retargetable mscorlib -{ - .publickeytoken = (7C EC 85 D7 BE A7 79 8E ) // |.....y. - .ver 2:0:5:0 -} -.assembly extern FSharp.Core -{ - .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) // .?_....: - .ver 3:47:41:0 -} -.assembly ToplevelNamespaceP -{ - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, - int32, - int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) - - // --- The following custom attribute is added automatically, do not uncomment ------- - // .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 00 01 00 00 00 00 ) - - .hash algorithm 0x00008004 - .ver 0:0:0:0 -} -.mresource public FSharpSignatureData.ToplevelNamespaceP -{ - // Offset: 0x00000000 Length: 0x0000185A -} -.mresource public FSharpOptimizationData.ToplevelNamespaceP -{ - // Offset: 0x00001860 Length: 0x0000055D -} -.module ToplevelNamespaceP.dll -// MVID: {576266E4-88D9-D7FD-A745-0383E4666257} -.imagebase 0x00400000 -.file alignment 0x00000200 -.stackreserve 0x00100000 -.subsystem 0x0003 // WINDOWS_CUI -.corflags 0x00000001 // ILONLY -// Image base: 0x01450000 - - -// =============== CLASS MEMBERS DECLARATION =================== - -.class public auto autochar sealed beforefieldinit XYZ.Expr - extends [mscorlib]System.Object - implements class [mscorlib]System.IEquatable`1, - [mscorlib]System.Collections.IStructuralEquatable, - class [mscorlib]System.IComparable`1, - [mscorlib]System.IComparable, - [mscorlib]System.Collections.IStructuralComparable -{ - .custom instance void [mscorlib]System.Diagnostics.DebuggerDisplayAttribute::.ctor(string) = ( 01 00 15 7B 5F 5F 44 65 62 75 67 44 69 73 70 6C // ...{__DebugDispl - 61 79 28 29 2C 6E 71 7D 00 00 ) // ay(),nq}.. - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 01 00 00 00 00 00 ) - .field assembly initonly int32 item - .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method public static class XYZ.Expr NewNum(int32 item) cil managed - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, - int32) = ( 01 00 08 00 00 00 00 00 00 00 00 00 ) - // Code size 7 (0x7) - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: newobj instance void XYZ.Expr::.ctor(int32) - IL_0006: ret - } // end of method Expr::NewNum - - .method assembly specialname rtspecialname - instance void .ctor(int32 item) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 14 (0xe) - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void [mscorlib]System.Object::.ctor() - IL_0006: ldarg.0 - IL_0007: ldarg.1 - IL_0008: stfld int32 XYZ.Expr::item - IL_000d: ret - } // end of method Expr::.ctor - - .method public hidebysig instance int32 - get_Item() cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 7 (0x7) - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldfld int32 XYZ.Expr::item - IL_0006: ret - } // end of method Expr::get_Item - - .method public hidebysig instance int32 - get_Tag() cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 4 (0x4) - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: pop - IL_0002: ldc.i4.0 - IL_0003: ret - } // end of method Expr::get_Tag - - .method assembly hidebysig specialname - instance object __DebugDisplay() cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 22 (0x16) - .maxstack 8 - IL_0000: ldstr "%+0.8A" - IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,string>::.ctor(string) - IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatToString>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) - IL_000f: ldarg.0 - IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_0015: ret - } // end of method Expr::__DebugDisplay - - .method public strict virtual instance string - ToString() cil managed - { - // Code size 22 (0x16) - .maxstack 8 - IL_0000: ldstr "%A" - IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,string>::.ctor(string) - IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatToString>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) - IL_000f: ldarg.0 - IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_0015: ret - } // end of method Expr::ToString - - .method public hidebysig virtual final - instance int32 CompareTo(class XYZ.Expr obj) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 81 (0x51) - .maxstack 4 - .locals init (class XYZ.Expr V_0, - class XYZ.Expr V_1, - class [mscorlib]System.Collections.IComparer V_2, - int32 V_3, - int32 V_4) - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldnull - IL_0003: cgt.un - IL_0005: brfalse.s IL_0009 - - IL_0007: br.s IL_000b - - IL_0009: br.s IL_0043 - - IL_000b: ldarg.1 - IL_000c: ldnull - IL_000d: cgt.un - IL_000f: brfalse.s IL_0013 - - IL_0011: br.s IL_0015 - - IL_0013: br.s IL_0041 - - IL_0015: ldarg.0 - IL_0016: pop - IL_0017: ldarg.0 - IL_0018: stloc.0 - IL_0019: ldarg.1 - IL_001a: stloc.1 - IL_001b: call class [mscorlib]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() - IL_0020: stloc.2 - IL_0021: ldloc.0 - IL_0022: ldfld int32 XYZ.Expr::item - IL_0027: stloc.3 - IL_0028: ldloc.1 - IL_0029: ldfld int32 XYZ.Expr::item - IL_002e: stloc.s V_4 - IL_0030: ldloc.3 - IL_0031: ldloc.s V_4 - IL_0033: bge.s IL_0037 - - IL_0035: br.s IL_0039 - - IL_0037: br.s IL_003b - - IL_0039: ldc.i4.m1 - IL_003a: ret - - IL_003b: ldloc.3 - IL_003c: ldloc.s V_4 - IL_003e: cgt - IL_0040: ret - - IL_0041: ldc.i4.1 - IL_0042: ret - - IL_0043: ldarg.1 - IL_0044: ldnull - IL_0045: cgt.un - IL_0047: brfalse.s IL_004b - - IL_0049: br.s IL_004d - - IL_004b: br.s IL_004f - - IL_004d: ldc.i4.m1 - IL_004e: ret - - IL_004f: ldc.i4.0 - IL_0050: ret - } // end of method Expr::CompareTo - - .method public hidebysig virtual final - instance int32 CompareTo(object obj) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 14 (0xe) - .maxstack 8 - .language '{AB4F38C9-B6E6-43BA-BE3B-58080B2CCCE3}', '{994B45C4-E6E9-11D2-903F-00C04FA302A1}', '{5A869D0B-6611-11D3-BD2A-0000F80849BD}' - .line 7,7 : 10,14 'C:\\GitHub\\dsyme\\visualfsharp\\tests\\fsharpqa\\Source\\CodeGen\\EmittedIL\\SerializableAttribute\\ToplevelNamespace.fs' - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldarg.1 - IL_0003: unbox.any XYZ.Expr - IL_0008: callvirt instance int32 XYZ.Expr::CompareTo(class XYZ.Expr) - IL_000d: ret - } // end of method Expr::CompareTo - - .method public hidebysig virtual final - instance int32 CompareTo(object obj, - class [mscorlib]System.Collections.IComparer comp) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 97 (0x61) - .maxstack 4 - .locals init ([0] class XYZ.Expr V_0, - [1] class XYZ.Expr V_1, - [2] class XYZ.Expr V_2, - [3] class [mscorlib]System.Collections.IComparer V_3, - [4] int32 V_4, - [5] int32 V_5) - .line 7,7 : 10,14 - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: unbox.any XYZ.Expr - IL_0007: stloc.0 - IL_0008: ldarg.0 - IL_0009: ldnull - IL_000a: cgt.un - IL_000c: brfalse.s IL_0010 - - IL_000e: br.s IL_0012 - - IL_0010: br.s IL_004e - - .line 100001,100001 : 0,0 - IL_0012: ldarg.1 - IL_0013: unbox.any XYZ.Expr - IL_0018: ldnull - IL_0019: cgt.un - IL_001b: brfalse.s IL_001f - - IL_001d: br.s IL_0021 - - IL_001f: br.s IL_004c - - .line 100001,100001 : 0,0 - IL_0021: ldarg.0 - IL_0022: pop - .line 100001,100001 : 0,0 - IL_0023: ldarg.0 - IL_0024: stloc.1 - IL_0025: ldloc.0 - IL_0026: stloc.2 - IL_0027: ldarg.2 - IL_0028: stloc.3 - IL_0029: ldloc.1 - IL_002a: ldfld int32 XYZ.Expr::item - IL_002f: stloc.s V_4 - IL_0031: ldloc.2 - IL_0032: ldfld int32 XYZ.Expr::item - IL_0037: stloc.s V_5 - IL_0039: ldloc.s V_4 - IL_003b: ldloc.s V_5 - IL_003d: bge.s IL_0041 - - IL_003f: br.s IL_0043 - - IL_0041: br.s IL_0045 - - .line 100001,100001 : 0,0 - IL_0043: ldc.i4.m1 - IL_0044: ret - - .line 100001,100001 : 0,0 - IL_0045: ldloc.s V_4 - IL_0047: ldloc.s V_5 - IL_0049: cgt - IL_004b: ret - - .line 100001,100001 : 0,0 - IL_004c: ldc.i4.1 - IL_004d: ret - - .line 100001,100001 : 0,0 - IL_004e: ldarg.1 - IL_004f: unbox.any XYZ.Expr - IL_0054: ldnull - IL_0055: cgt.un - IL_0057: brfalse.s IL_005b - - IL_0059: br.s IL_005d - - IL_005b: br.s IL_005f - - .line 100001,100001 : 0,0 - IL_005d: ldc.i4.m1 - IL_005e: ret - - .line 100001,100001 : 0,0 - IL_005f: ldc.i4.0 - IL_0060: ret - } // end of method Expr::CompareTo - - .method public hidebysig virtual final - instance int32 GetHashCode(class [mscorlib]System.Collections.IEqualityComparer comp) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 46 (0x2e) - .maxstack 7 - .locals init (int32 V_0, - class XYZ.Expr V_1, - class [mscorlib]System.Collections.IEqualityComparer V_2) - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldnull - IL_0003: cgt.un - IL_0005: brfalse.s IL_0009 - - IL_0007: br.s IL_000b - - IL_0009: br.s IL_002c - - IL_000b: ldc.i4.0 - IL_000c: stloc.0 - IL_000d: ldarg.0 - IL_000e: pop - IL_000f: ldarg.0 - IL_0010: stloc.1 - IL_0011: ldc.i4.0 - IL_0012: stloc.0 - IL_0013: ldc.i4 0x9e3779b9 - IL_0018: ldarg.1 - IL_0019: stloc.2 - IL_001a: ldloc.1 - IL_001b: ldfld int32 XYZ.Expr::item - IL_0020: ldloc.0 - IL_0021: ldc.i4.6 - IL_0022: shl - IL_0023: ldloc.0 - IL_0024: ldc.i4.2 - IL_0025: shr - IL_0026: add - IL_0027: add - IL_0028: add - IL_0029: stloc.0 - IL_002a: ldloc.0 - IL_002b: ret - - IL_002c: ldc.i4.0 - IL_002d: ret - } // end of method Expr::GetHashCode - - .method public hidebysig virtual final - instance int32 GetHashCode() cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 13 (0xd) - .maxstack 8 - .line 7,7 : 10,14 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: call class [mscorlib]System.Collections.IEqualityComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericEqualityComparer() - IL_0007: callvirt instance int32 XYZ.Expr::GetHashCode(class [mscorlib]System.Collections.IEqualityComparer) - IL_000c: ret - } // end of method Expr::GetHashCode - - .method public hidebysig virtual final - instance bool Equals(object obj, - class [mscorlib]System.Collections.IEqualityComparer comp) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 61 (0x3d) - .maxstack 4 - .locals init (class XYZ.Expr V_0, - class XYZ.Expr V_1, - class XYZ.Expr V_2, - class XYZ.Expr V_3, - class [mscorlib]System.Collections.IEqualityComparer V_4) - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldnull - IL_0003: cgt.un - IL_0005: brfalse.s IL_0009 - - IL_0007: br.s IL_000b - - IL_0009: br.s IL_0035 - - IL_000b: ldarg.1 - IL_000c: isinst XYZ.Expr - IL_0011: stloc.0 - IL_0012: ldloc.0 - IL_0013: brfalse.s IL_0017 - - IL_0015: br.s IL_0019 - - IL_0017: br.s IL_0033 - - IL_0019: ldloc.0 - IL_001a: stloc.1 - IL_001b: ldarg.0 - IL_001c: pop - IL_001d: ldarg.0 - IL_001e: stloc.2 - IL_001f: ldloc.1 - IL_0020: stloc.3 - IL_0021: ldarg.2 - IL_0022: stloc.s V_4 - IL_0024: ldloc.2 - IL_0025: ldfld int32 XYZ.Expr::item - IL_002a: ldloc.3 - IL_002b: ldfld int32 XYZ.Expr::item - IL_0030: ceq - IL_0032: ret - - IL_0033: ldc.i4.0 - IL_0034: ret - - IL_0035: ldarg.1 - IL_0036: ldnull - IL_0037: cgt.un - IL_0039: ldc.i4.0 - IL_003a: ceq - IL_003c: ret - } // end of method Expr::Equals - - .method public hidebysig virtual final - instance bool Equals(class XYZ.Expr obj) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 52 (0x34) - .maxstack 4 - .locals init (class XYZ.Expr V_0, - class XYZ.Expr V_1) - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldnull - IL_0003: cgt.un - IL_0005: brfalse.s IL_0009 - - IL_0007: br.s IL_000b - - IL_0009: br.s IL_002c - - IL_000b: ldarg.1 - IL_000c: ldnull - IL_000d: cgt.un - IL_000f: brfalse.s IL_0013 - - IL_0011: br.s IL_0015 - - IL_0013: br.s IL_002a - - IL_0015: ldarg.0 - IL_0016: pop - IL_0017: ldarg.0 - IL_0018: stloc.0 - IL_0019: ldarg.1 - IL_001a: stloc.1 - IL_001b: ldloc.0 - IL_001c: ldfld int32 XYZ.Expr::item - IL_0021: ldloc.1 - IL_0022: ldfld int32 XYZ.Expr::item - IL_0027: ceq - IL_0029: ret - - IL_002a: ldc.i4.0 - IL_002b: ret - - IL_002c: ldarg.1 - IL_002d: ldnull - IL_002e: cgt.un - IL_0030: ldc.i4.0 - IL_0031: ceq - IL_0033: ret - } // end of method Expr::Equals - - .method public hidebysig virtual final - instance bool Equals(object obj) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 25 (0x19) - .maxstack 4 - .locals init (class XYZ.Expr V_0) - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: isinst XYZ.Expr - IL_0007: stloc.0 - IL_0008: ldloc.0 - IL_0009: brfalse.s IL_000d - - IL_000b: br.s IL_000f - - IL_000d: br.s IL_0017 - - IL_000f: ldarg.0 - IL_0010: ldloc.0 - IL_0011: callvirt instance bool XYZ.Expr::Equals(class XYZ.Expr) - IL_0016: ret - - IL_0017: ldc.i4.0 - IL_0018: ret - } // end of method Expr::Equals - - .property instance int32 Tag() - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .get instance int32 XYZ.Expr::get_Tag() - } // end of property Expr::Tag - .property instance int32 Item() - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, - int32, - int32) = ( 01 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 ) - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .get instance int32 XYZ.Expr::get_Item() - } // end of property Expr::Item -} // end of class XYZ.Expr - -.class public auto ansi beforefieldinit XYZ.MyExn - extends [mscorlib]System.Exception - implements [mscorlib]System.Collections.IStructuralEquatable -{ - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 05 00 00 00 00 00 ) - .field assembly int32 Data0@ - .method public specialname rtspecialname - instance void .ctor(int32 data0) cil managed - { - // Code size 14 (0xe) - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void [mscorlib]System.Exception::.ctor() - IL_0006: ldarg.0 - IL_0007: ldarg.1 - IL_0008: stfld int32 XYZ.MyExn::Data0@ - IL_000d: ret - } // end of method MyExn::.ctor - - .method public specialname rtspecialname - instance void .ctor() cil managed - { - // Code size 7 (0x7) - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void [mscorlib]System.Exception::.ctor() - IL_0006: ret - } // end of method MyExn::.ctor - - .method public hidebysig specialname instance int32 - get_Data0() cil managed - { - // Code size 7 (0x7) - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldfld int32 XYZ.MyExn::Data0@ - IL_0006: ret - } // end of method MyExn::get_Data0 - - .method public hidebysig virtual instance int32 - GetHashCode(class [mscorlib]System.Collections.IEqualityComparer comp) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 45 (0x2d) - .maxstack 7 - .locals init (int32 V_0, - class [mscorlib]System.Collections.IEqualityComparer V_1) - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldnull - IL_0003: cgt.un - IL_0005: brfalse.s IL_0009 - - IL_0007: br.s IL_000b - - IL_0009: br.s IL_002b - - IL_000b: ldc.i4.0 - IL_000c: stloc.0 - IL_000d: ldc.i4 0x9e3779b9 - IL_0012: ldarg.1 - IL_0013: stloc.1 - IL_0014: ldarg.0 - IL_0015: castclass XYZ.MyExn - IL_001a: call instance int32 XYZ.MyExn::get_Data0() - IL_001f: ldloc.0 - IL_0020: ldc.i4.6 - IL_0021: shl - IL_0022: ldloc.0 - IL_0023: ldc.i4.2 - IL_0024: shr - IL_0025: add - IL_0026: add - IL_0027: add - IL_0028: stloc.0 - IL_0029: ldloc.0 - IL_002a: ret - - IL_002b: ldc.i4.0 - IL_002c: ret - } // end of method MyExn::GetHashCode - - .method public hidebysig virtual instance int32 - GetHashCode() cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 13 (0xd) - .maxstack 8 - .line 8,8 : 15,20 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: call class [mscorlib]System.Collections.IEqualityComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericEqualityComparer() - IL_0007: callvirt instance int32 XYZ.MyExn::GetHashCode(class [mscorlib]System.Collections.IEqualityComparer) - IL_000c: ret - } // end of method MyExn::GetHashCode - - .method public hidebysig virtual instance bool - Equals(object obj, - class [mscorlib]System.Collections.IEqualityComparer comp) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 76 (0x4c) - .maxstack 4 - .locals init (class [mscorlib]System.Exception V_0, - class [mscorlib]System.Exception V_1, - class [mscorlib]System.Collections.IEqualityComparer V_2) - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldnull - IL_0003: cgt.un - IL_0005: brfalse.s IL_0009 - - IL_0007: br.s IL_000b - - IL_0009: br.s IL_0044 - - IL_000b: ldarg.1 - IL_000c: isinst [mscorlib]System.Exception - IL_0011: stloc.0 - IL_0012: ldloc.0 - IL_0013: brfalse.s IL_0017 - - IL_0015: br.s IL_0019 - - IL_0017: br.s IL_0042 - - IL_0019: ldloc.0 - IL_001a: stloc.1 - IL_001b: ldloc.0 - IL_001c: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::TypeTestGeneric(object) - IL_0021: brtrue.s IL_0025 - - IL_0023: br.s IL_0040 - - IL_0025: ldarg.2 - IL_0026: stloc.2 - IL_0027: ldarg.0 - IL_0028: castclass XYZ.MyExn - IL_002d: call instance int32 XYZ.MyExn::get_Data0() - IL_0032: ldloc.1 - IL_0033: castclass XYZ.MyExn - IL_0038: call instance int32 XYZ.MyExn::get_Data0() - IL_003d: ceq - IL_003f: ret - - IL_0040: ldc.i4.0 - IL_0041: ret - - IL_0042: ldc.i4.0 - IL_0043: ret - - IL_0044: ldarg.1 - IL_0045: ldnull - IL_0046: cgt.un - IL_0048: ldc.i4.0 - IL_0049: ceq - IL_004b: ret - } // end of method MyExn::Equals - - .method public hidebysig instance bool - Equals(class [mscorlib]System.Exception obj) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 68 (0x44) - .maxstack 4 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldnull - IL_0003: cgt.un - IL_0005: brfalse.s IL_0009 - - IL_0007: br.s IL_000b - - IL_0009: br.s IL_003c - - IL_000b: ldarg.1 - IL_000c: ldnull - IL_000d: cgt.un - IL_000f: brfalse.s IL_0013 - - IL_0011: br.s IL_0015 - - IL_0013: br.s IL_003a - - IL_0015: ldarg.1 - IL_0016: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::TypeTestGeneric(object) - IL_001b: brtrue.s IL_001f - - IL_001d: br.s IL_0038 - - IL_001f: ldarg.0 - IL_0020: castclass XYZ.MyExn - IL_0025: call instance int32 XYZ.MyExn::get_Data0() - IL_002a: ldarg.1 - IL_002b: castclass XYZ.MyExn - IL_0030: call instance int32 XYZ.MyExn::get_Data0() - IL_0035: ceq - IL_0037: ret - - IL_0038: ldc.i4.0 - IL_0039: ret - - IL_003a: ldc.i4.0 - IL_003b: ret - - IL_003c: ldarg.1 - IL_003d: ldnull - IL_003e: cgt.un - IL_0040: ldc.i4.0 - IL_0041: ceq - IL_0043: ret - } // end of method MyExn::Equals - - .method public hidebysig virtual instance bool - Equals(object obj) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 25 (0x19) - .maxstack 4 - .locals init (class [mscorlib]System.Exception V_0) - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: isinst [mscorlib]System.Exception - IL_0007: stloc.0 - IL_0008: ldloc.0 - IL_0009: brfalse.s IL_000d - - IL_000b: br.s IL_000f - - IL_000d: br.s IL_0017 - - IL_000f: ldarg.0 - IL_0010: ldloc.0 - IL_0011: callvirt instance bool XYZ.MyExn::Equals(class [mscorlib]System.Exception) - IL_0016: ret - - IL_0017: ldc.i4.0 - IL_0018: ret - } // end of method MyExn::Equals - - .property instance int32 Data0() - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, - int32) = ( 01 00 04 00 00 00 00 00 00 00 00 00 ) - .get instance int32 XYZ.MyExn::get_Data0() - } // end of property MyExn::Data0 -} // end of class XYZ.MyExn - -.class public auto ansi XYZ.A - extends [mscorlib]System.Object -{ - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) - .field assembly string x - .method public specialname rtspecialname - instance void .ctor(string x) cil managed - { - // Code size 17 (0x11) - .maxstack 8 - .line 9,9 : 12,13 - IL_0000: ldarg.0 - IL_0001: callvirt instance void [mscorlib]System.Object::.ctor() - IL_0006: ldarg.0 - IL_0007: pop - IL_0008: nop - IL_0009: ldarg.0 - IL_000a: ldarg.1 - IL_000b: stfld string XYZ.A::x - .line 9,9 : 10,11 - IL_0010: ret - } // end of method A::.ctor - - .method public hidebysig specialname instance string - get_X() cil managed - { - // Code size 8 (0x8) - .maxstack 8 - .line 9,9 : 38,39 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldfld string XYZ.A::x - IL_0007: ret - } // end of method A::get_X - - .property instance string X() - { - .get instance string XYZ.A::get_X() - } // end of property A::X -} // end of class XYZ.A - -.class public abstract auto ansi sealed XYZ.ABC - extends [mscorlib]System.Object -{ - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) - .class auto autochar sealed nested public beforefieldinit Expr - extends [mscorlib]System.Object - implements class [mscorlib]System.IEquatable`1, - [mscorlib]System.Collections.IStructuralEquatable, - class [mscorlib]System.IComparable`1, - [mscorlib]System.IComparable, - [mscorlib]System.Collections.IStructuralComparable - { - .custom instance void [mscorlib]System.Diagnostics.DebuggerDisplayAttribute::.ctor(string) = ( 01 00 15 7B 5F 5F 44 65 62 75 67 44 69 73 70 6C // ...{__DebugDispl - 61 79 28 29 2C 6E 71 7D 00 00 ) // ay(),nq}.. - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 01 00 00 00 00 00 ) - .field assembly initonly int32 item - .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method public static class XYZ.ABC/Expr - NewNum(int32 item) cil managed - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, - int32) = ( 01 00 08 00 00 00 00 00 00 00 00 00 ) - // Code size 7 (0x7) - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: newobj instance void XYZ.ABC/Expr::.ctor(int32) - IL_0006: ret - } // end of method Expr::NewNum - - .method assembly specialname rtspecialname - instance void .ctor(int32 item) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 14 (0xe) - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void [mscorlib]System.Object::.ctor() - IL_0006: ldarg.0 - IL_0007: ldarg.1 - IL_0008: stfld int32 XYZ.ABC/Expr::item - IL_000d: ret - } // end of method Expr::.ctor - - .method public hidebysig instance int32 - get_Item() cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 7 (0x7) - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldfld int32 XYZ.ABC/Expr::item - IL_0006: ret - } // end of method Expr::get_Item - - .method public hidebysig instance int32 - get_Tag() cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 4 (0x4) - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: pop - IL_0002: ldc.i4.0 - IL_0003: ret - } // end of method Expr::get_Tag - - .method assembly hidebysig specialname - instance object __DebugDisplay() cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 22 (0x16) - .maxstack 8 - IL_0000: ldstr "%+0.8A" - IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,string>::.ctor(string) - IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatToString>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) - IL_000f: ldarg.0 - IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_0015: ret - } // end of method Expr::__DebugDisplay - - .method public strict virtual instance string - ToString() cil managed - { - // Code size 22 (0x16) - .maxstack 8 - IL_0000: ldstr "%A" - IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,string>::.ctor(string) - IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatToString>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) - IL_000f: ldarg.0 - IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_0015: ret - } // end of method Expr::ToString - - .method public hidebysig virtual final - instance int32 CompareTo(class XYZ.ABC/Expr obj) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 81 (0x51) - .maxstack 4 - .locals init (class XYZ.ABC/Expr V_0, - class XYZ.ABC/Expr V_1, - class [mscorlib]System.Collections.IComparer V_2, - int32 V_3, - int32 V_4) - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldnull - IL_0003: cgt.un - IL_0005: brfalse.s IL_0009 - - IL_0007: br.s IL_000b - - IL_0009: br.s IL_0043 - - IL_000b: ldarg.1 - IL_000c: ldnull - IL_000d: cgt.un - IL_000f: brfalse.s IL_0013 - - IL_0011: br.s IL_0015 - - IL_0013: br.s IL_0041 - - IL_0015: ldarg.0 - IL_0016: pop - IL_0017: ldarg.0 - IL_0018: stloc.0 - IL_0019: ldarg.1 - IL_001a: stloc.1 - IL_001b: call class [mscorlib]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() - IL_0020: stloc.2 - IL_0021: ldloc.0 - IL_0022: ldfld int32 XYZ.ABC/Expr::item - IL_0027: stloc.3 - IL_0028: ldloc.1 - IL_0029: ldfld int32 XYZ.ABC/Expr::item - IL_002e: stloc.s V_4 - IL_0030: ldloc.3 - IL_0031: ldloc.s V_4 - IL_0033: bge.s IL_0037 - - IL_0035: br.s IL_0039 - - IL_0037: br.s IL_003b - - IL_0039: ldc.i4.m1 - IL_003a: ret - - IL_003b: ldloc.3 - IL_003c: ldloc.s V_4 - IL_003e: cgt - IL_0040: ret - - IL_0041: ldc.i4.1 - IL_0042: ret - - IL_0043: ldarg.1 - IL_0044: ldnull - IL_0045: cgt.un - IL_0047: brfalse.s IL_004b - - IL_0049: br.s IL_004d - - IL_004b: br.s IL_004f - - IL_004d: ldc.i4.m1 - IL_004e: ret - - IL_004f: ldc.i4.0 - IL_0050: ret - } // end of method Expr::CompareTo - - .method public hidebysig virtual final - instance int32 CompareTo(object obj) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 14 (0xe) - .maxstack 8 - .line 13,13 : 14,18 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldarg.1 - IL_0003: unbox.any XYZ.ABC/Expr - IL_0008: callvirt instance int32 XYZ.ABC/Expr::CompareTo(class XYZ.ABC/Expr) - IL_000d: ret - } // end of method Expr::CompareTo - - .method public hidebysig virtual final - instance int32 CompareTo(object obj, - class [mscorlib]System.Collections.IComparer comp) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 97 (0x61) - .maxstack 4 - .locals init ([0] class XYZ.ABC/Expr V_0, - [1] class XYZ.ABC/Expr V_1, - [2] class XYZ.ABC/Expr V_2, - [3] class [mscorlib]System.Collections.IComparer V_3, - [4] int32 V_4, - [5] int32 V_5) - .line 13,13 : 14,18 - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: unbox.any XYZ.ABC/Expr - IL_0007: stloc.0 - IL_0008: ldarg.0 - IL_0009: ldnull - IL_000a: cgt.un - IL_000c: brfalse.s IL_0010 - - IL_000e: br.s IL_0012 - - IL_0010: br.s IL_004e - - .line 100001,100001 : 0,0 - IL_0012: ldarg.1 - IL_0013: unbox.any XYZ.ABC/Expr - IL_0018: ldnull - IL_0019: cgt.un - IL_001b: brfalse.s IL_001f - - IL_001d: br.s IL_0021 - - IL_001f: br.s IL_004c - - .line 100001,100001 : 0,0 - IL_0021: ldarg.0 - IL_0022: pop - .line 100001,100001 : 0,0 - IL_0023: ldarg.0 - IL_0024: stloc.1 - IL_0025: ldloc.0 - IL_0026: stloc.2 - IL_0027: ldarg.2 - IL_0028: stloc.3 - IL_0029: ldloc.1 - IL_002a: ldfld int32 XYZ.ABC/Expr::item - IL_002f: stloc.s V_4 - IL_0031: ldloc.2 - IL_0032: ldfld int32 XYZ.ABC/Expr::item - IL_0037: stloc.s V_5 - IL_0039: ldloc.s V_4 - IL_003b: ldloc.s V_5 - IL_003d: bge.s IL_0041 - - IL_003f: br.s IL_0043 - - IL_0041: br.s IL_0045 - - .line 100001,100001 : 0,0 - IL_0043: ldc.i4.m1 - IL_0044: ret - - .line 100001,100001 : 0,0 - IL_0045: ldloc.s V_4 - IL_0047: ldloc.s V_5 - IL_0049: cgt - IL_004b: ret - - .line 100001,100001 : 0,0 - IL_004c: ldc.i4.1 - IL_004d: ret - - .line 100001,100001 : 0,0 - IL_004e: ldarg.1 - IL_004f: unbox.any XYZ.ABC/Expr - IL_0054: ldnull - IL_0055: cgt.un - IL_0057: brfalse.s IL_005b - - IL_0059: br.s IL_005d - - IL_005b: br.s IL_005f - - .line 100001,100001 : 0,0 - IL_005d: ldc.i4.m1 - IL_005e: ret - - .line 100001,100001 : 0,0 - IL_005f: ldc.i4.0 - IL_0060: ret - } // end of method Expr::CompareTo - - .method public hidebysig virtual final - instance int32 GetHashCode(class [mscorlib]System.Collections.IEqualityComparer comp) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 46 (0x2e) - .maxstack 7 - .locals init (int32 V_0, - class XYZ.ABC/Expr V_1, - class [mscorlib]System.Collections.IEqualityComparer V_2) - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldnull - IL_0003: cgt.un - IL_0005: brfalse.s IL_0009 - - IL_0007: br.s IL_000b - - IL_0009: br.s IL_002c - - IL_000b: ldc.i4.0 - IL_000c: stloc.0 - IL_000d: ldarg.0 - IL_000e: pop - IL_000f: ldarg.0 - IL_0010: stloc.1 - IL_0011: ldc.i4.0 - IL_0012: stloc.0 - IL_0013: ldc.i4 0x9e3779b9 - IL_0018: ldarg.1 - IL_0019: stloc.2 - IL_001a: ldloc.1 - IL_001b: ldfld int32 XYZ.ABC/Expr::item - IL_0020: ldloc.0 - IL_0021: ldc.i4.6 - IL_0022: shl - IL_0023: ldloc.0 - IL_0024: ldc.i4.2 - IL_0025: shr - IL_0026: add - IL_0027: add - IL_0028: add - IL_0029: stloc.0 - IL_002a: ldloc.0 - IL_002b: ret - - IL_002c: ldc.i4.0 - IL_002d: ret - } // end of method Expr::GetHashCode - - .method public hidebysig virtual final - instance int32 GetHashCode() cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 13 (0xd) - .maxstack 8 - .line 13,13 : 14,18 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: call class [mscorlib]System.Collections.IEqualityComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericEqualityComparer() - IL_0007: callvirt instance int32 XYZ.ABC/Expr::GetHashCode(class [mscorlib]System.Collections.IEqualityComparer) - IL_000c: ret - } // end of method Expr::GetHashCode - - .method public hidebysig virtual final - instance bool Equals(object obj, - class [mscorlib]System.Collections.IEqualityComparer comp) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 61 (0x3d) - .maxstack 4 - .locals init (class XYZ.ABC/Expr V_0, - class XYZ.ABC/Expr V_1, - class XYZ.ABC/Expr V_2, - class XYZ.ABC/Expr V_3, - class [mscorlib]System.Collections.IEqualityComparer V_4) - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldnull - IL_0003: cgt.un - IL_0005: brfalse.s IL_0009 - - IL_0007: br.s IL_000b - - IL_0009: br.s IL_0035 - - IL_000b: ldarg.1 - IL_000c: isinst XYZ.ABC/Expr - IL_0011: stloc.0 - IL_0012: ldloc.0 - IL_0013: brfalse.s IL_0017 - - IL_0015: br.s IL_0019 - - IL_0017: br.s IL_0033 - - IL_0019: ldloc.0 - IL_001a: stloc.1 - IL_001b: ldarg.0 - IL_001c: pop - IL_001d: ldarg.0 - IL_001e: stloc.2 - IL_001f: ldloc.1 - IL_0020: stloc.3 - IL_0021: ldarg.2 - IL_0022: stloc.s V_4 - IL_0024: ldloc.2 - IL_0025: ldfld int32 XYZ.ABC/Expr::item - IL_002a: ldloc.3 - IL_002b: ldfld int32 XYZ.ABC/Expr::item - IL_0030: ceq - IL_0032: ret - - IL_0033: ldc.i4.0 - IL_0034: ret - - IL_0035: ldarg.1 - IL_0036: ldnull - IL_0037: cgt.un - IL_0039: ldc.i4.0 - IL_003a: ceq - IL_003c: ret - } // end of method Expr::Equals - - .method public hidebysig virtual final - instance bool Equals(class XYZ.ABC/Expr obj) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 52 (0x34) - .maxstack 4 - .locals init (class XYZ.ABC/Expr V_0, - class XYZ.ABC/Expr V_1) - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldnull - IL_0003: cgt.un - IL_0005: brfalse.s IL_0009 - - IL_0007: br.s IL_000b - - IL_0009: br.s IL_002c - - IL_000b: ldarg.1 - IL_000c: ldnull - IL_000d: cgt.un - IL_000f: brfalse.s IL_0013 - - IL_0011: br.s IL_0015 - - IL_0013: br.s IL_002a - - IL_0015: ldarg.0 - IL_0016: pop - IL_0017: ldarg.0 - IL_0018: stloc.0 - IL_0019: ldarg.1 - IL_001a: stloc.1 - IL_001b: ldloc.0 - IL_001c: ldfld int32 XYZ.ABC/Expr::item - IL_0021: ldloc.1 - IL_0022: ldfld int32 XYZ.ABC/Expr::item - IL_0027: ceq - IL_0029: ret - - IL_002a: ldc.i4.0 - IL_002b: ret - - IL_002c: ldarg.1 - IL_002d: ldnull - IL_002e: cgt.un - IL_0030: ldc.i4.0 - IL_0031: ceq - IL_0033: ret - } // end of method Expr::Equals - - .method public hidebysig virtual final - instance bool Equals(object obj) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 25 (0x19) - .maxstack 4 - .locals init (class XYZ.ABC/Expr V_0) - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: isinst XYZ.ABC/Expr - IL_0007: stloc.0 - IL_0008: ldloc.0 - IL_0009: brfalse.s IL_000d - - IL_000b: br.s IL_000f - - IL_000d: br.s IL_0017 - - IL_000f: ldarg.0 - IL_0010: ldloc.0 - IL_0011: callvirt instance bool XYZ.ABC/Expr::Equals(class XYZ.ABC/Expr) - IL_0016: ret - - IL_0017: ldc.i4.0 - IL_0018: ret - } // end of method Expr::Equals - - .property instance int32 Tag() - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .get instance int32 XYZ.ABC/Expr::get_Tag() - } // end of property Expr::Tag - .property instance int32 Item() - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, - int32, - int32) = ( 01 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 ) - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .get instance int32 XYZ.ABC/Expr::get_Item() - } // end of property Expr::Item - } // end of class Expr - - .class auto ansi nested public beforefieldinit MyExn - extends [mscorlib]System.Exception - implements [mscorlib]System.Collections.IStructuralEquatable - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 05 00 00 00 00 00 ) - .field assembly int32 Data0@ - .method public specialname rtspecialname - instance void .ctor(int32 data0) cil managed - { - // Code size 14 (0xe) - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void [mscorlib]System.Exception::.ctor() - IL_0006: ldarg.0 - IL_0007: ldarg.1 - IL_0008: stfld int32 XYZ.ABC/MyExn::Data0@ - IL_000d: ret - } // end of method MyExn::.ctor - - .method public specialname rtspecialname - instance void .ctor() cil managed - { - // Code size 7 (0x7) - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void [mscorlib]System.Exception::.ctor() - IL_0006: ret - } // end of method MyExn::.ctor - - .method public hidebysig specialname - instance int32 get_Data0() cil managed - { - // Code size 7 (0x7) - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldfld int32 XYZ.ABC/MyExn::Data0@ - IL_0006: ret - } // end of method MyExn::get_Data0 - - .method public hidebysig virtual instance int32 - GetHashCode(class [mscorlib]System.Collections.IEqualityComparer comp) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 45 (0x2d) - .maxstack 7 - .locals init (int32 V_0, - class [mscorlib]System.Collections.IEqualityComparer V_1) - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldnull - IL_0003: cgt.un - IL_0005: brfalse.s IL_0009 - - IL_0007: br.s IL_000b - - IL_0009: br.s IL_002b - - IL_000b: ldc.i4.0 - IL_000c: stloc.0 - IL_000d: ldc.i4 0x9e3779b9 - IL_0012: ldarg.1 - IL_0013: stloc.1 - IL_0014: ldarg.0 - IL_0015: castclass XYZ.ABC/MyExn - IL_001a: call instance int32 XYZ.ABC/MyExn::get_Data0() - IL_001f: ldloc.0 - IL_0020: ldc.i4.6 - IL_0021: shl - IL_0022: ldloc.0 - IL_0023: ldc.i4.2 - IL_0024: shr - IL_0025: add - IL_0026: add - IL_0027: add - IL_0028: stloc.0 - IL_0029: ldloc.0 - IL_002a: ret - - IL_002b: ldc.i4.0 - IL_002c: ret - } // end of method MyExn::GetHashCode - - .method public hidebysig virtual instance int32 - GetHashCode() cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 13 (0xd) - .maxstack 8 - .line 14,14 : 19,24 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: call class [mscorlib]System.Collections.IEqualityComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericEqualityComparer() - IL_0007: callvirt instance int32 XYZ.ABC/MyExn::GetHashCode(class [mscorlib]System.Collections.IEqualityComparer) - IL_000c: ret - } // end of method MyExn::GetHashCode - - .method public hidebysig virtual instance bool - Equals(object obj, - class [mscorlib]System.Collections.IEqualityComparer comp) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 76 (0x4c) - .maxstack 4 - .locals init (class [mscorlib]System.Exception V_0, - class [mscorlib]System.Exception V_1, - class [mscorlib]System.Collections.IEqualityComparer V_2) - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldnull - IL_0003: cgt.un - IL_0005: brfalse.s IL_0009 - - IL_0007: br.s IL_000b - - IL_0009: br.s IL_0044 - - IL_000b: ldarg.1 - IL_000c: isinst [mscorlib]System.Exception - IL_0011: stloc.0 - IL_0012: ldloc.0 - IL_0013: brfalse.s IL_0017 - - IL_0015: br.s IL_0019 - - IL_0017: br.s IL_0042 - - IL_0019: ldloc.0 - IL_001a: stloc.1 - IL_001b: ldloc.0 - IL_001c: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::TypeTestGeneric(object) - IL_0021: brtrue.s IL_0025 - - IL_0023: br.s IL_0040 - - IL_0025: ldarg.2 - IL_0026: stloc.2 - IL_0027: ldarg.0 - IL_0028: castclass XYZ.ABC/MyExn - IL_002d: call instance int32 XYZ.ABC/MyExn::get_Data0() - IL_0032: ldloc.1 - IL_0033: castclass XYZ.ABC/MyExn - IL_0038: call instance int32 XYZ.ABC/MyExn::get_Data0() - IL_003d: ceq - IL_003f: ret - - IL_0040: ldc.i4.0 - IL_0041: ret - - IL_0042: ldc.i4.0 - IL_0043: ret - - IL_0044: ldarg.1 - IL_0045: ldnull - IL_0046: cgt.un - IL_0048: ldc.i4.0 - IL_0049: ceq - IL_004b: ret - } // end of method MyExn::Equals - - .method public hidebysig instance bool - Equals(class [mscorlib]System.Exception obj) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 68 (0x44) - .maxstack 4 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldnull - IL_0003: cgt.un - IL_0005: brfalse.s IL_0009 - - IL_0007: br.s IL_000b - - IL_0009: br.s IL_003c - - IL_000b: ldarg.1 - IL_000c: ldnull - IL_000d: cgt.un - IL_000f: brfalse.s IL_0013 - - IL_0011: br.s IL_0015 - - IL_0013: br.s IL_003a - - IL_0015: ldarg.1 - IL_0016: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::TypeTestGeneric(object) - IL_001b: brtrue.s IL_001f - - IL_001d: br.s IL_0038 - - IL_001f: ldarg.0 - IL_0020: castclass XYZ.ABC/MyExn - IL_0025: call instance int32 XYZ.ABC/MyExn::get_Data0() - IL_002a: ldarg.1 - IL_002b: castclass XYZ.ABC/MyExn - IL_0030: call instance int32 XYZ.ABC/MyExn::get_Data0() - IL_0035: ceq - IL_0037: ret - - IL_0038: ldc.i4.0 - IL_0039: ret - - IL_003a: ldc.i4.0 - IL_003b: ret - - IL_003c: ldarg.1 - IL_003d: ldnull - IL_003e: cgt.un - IL_0040: ldc.i4.0 - IL_0041: ceq - IL_0043: ret - } // end of method MyExn::Equals - - .method public hidebysig virtual instance bool - Equals(object obj) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 25 (0x19) - .maxstack 4 - .locals init (class [mscorlib]System.Exception V_0) - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: isinst [mscorlib]System.Exception - IL_0007: stloc.0 - IL_0008: ldloc.0 - IL_0009: brfalse.s IL_000d - - IL_000b: br.s IL_000f - - IL_000d: br.s IL_0017 - - IL_000f: ldarg.0 - IL_0010: ldloc.0 - IL_0011: callvirt instance bool XYZ.ABC/MyExn::Equals(class [mscorlib]System.Exception) - IL_0016: ret - - IL_0017: ldc.i4.0 - IL_0018: ret - } // end of method MyExn::Equals - - .property instance int32 Data0() - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, - int32) = ( 01 00 04 00 00 00 00 00 00 00 00 00 ) - .get instance int32 XYZ.ABC/MyExn::get_Data0() - } // end of property MyExn::Data0 - } // end of class MyExn - - .class auto ansi nested public A - extends [mscorlib]System.Object - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) - .field assembly string x - .method public specialname rtspecialname - instance void .ctor(string x) cil managed - { - // Code size 17 (0x11) - .maxstack 8 - .line 15,15 : 16,17 - IL_0000: ldarg.0 - IL_0001: callvirt instance void [mscorlib]System.Object::.ctor() - IL_0006: ldarg.0 - IL_0007: pop - IL_0008: nop - IL_0009: ldarg.0 - IL_000a: ldarg.1 - IL_000b: stfld string XYZ.ABC/A::x - .line 15,15 : 14,15 - IL_0010: ret - } // end of method A::.ctor - - .method public hidebysig specialname - instance string get_X() cil managed - { - // Code size 8 (0x8) - .maxstack 8 - .line 15,15 : 42,43 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldfld string XYZ.ABC/A::x - IL_0007: ret - } // end of method A::get_X - - .property instance string X() - { - .get instance string XYZ.ABC/A::get_X() - } // end of property A::X - } // end of class A - - .class abstract auto ansi sealed nested public ABC - extends [mscorlib]System.Object - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) - .class auto autochar sealed nested public beforefieldinit Expr - extends [mscorlib]System.Object - implements class [mscorlib]System.IEquatable`1, - [mscorlib]System.Collections.IStructuralEquatable, - class [mscorlib]System.IComparable`1, - [mscorlib]System.IComparable, - [mscorlib]System.Collections.IStructuralComparable - { - .custom instance void [mscorlib]System.Diagnostics.DebuggerDisplayAttribute::.ctor(string) = ( 01 00 15 7B 5F 5F 44 65 62 75 67 44 69 73 70 6C // ...{__DebugDispl - 61 79 28 29 2C 6E 71 7D 00 00 ) // ay(),nq}.. - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 01 00 00 00 00 00 ) - .field assembly initonly int32 item - .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method public static class XYZ.ABC/ABC/Expr - NewNum(int32 item) cil managed - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, - int32) = ( 01 00 08 00 00 00 00 00 00 00 00 00 ) - // Code size 7 (0x7) - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: newobj instance void XYZ.ABC/ABC/Expr::.ctor(int32) - IL_0006: ret - } // end of method Expr::NewNum - - .method assembly specialname rtspecialname - instance void .ctor(int32 item) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 14 (0xe) - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void [mscorlib]System.Object::.ctor() - IL_0006: ldarg.0 - IL_0007: ldarg.1 - IL_0008: stfld int32 XYZ.ABC/ABC/Expr::item - IL_000d: ret - } // end of method Expr::.ctor - - .method public hidebysig instance int32 - get_Item() cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 7 (0x7) - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldfld int32 XYZ.ABC/ABC/Expr::item - IL_0006: ret - } // end of method Expr::get_Item - - .method public hidebysig instance int32 - get_Tag() cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 4 (0x4) - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: pop - IL_0002: ldc.i4.0 - IL_0003: ret - } // end of method Expr::get_Tag - - .method assembly hidebysig specialname - instance object __DebugDisplay() cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 22 (0x16) - .maxstack 8 - IL_0000: ldstr "%+0.8A" - IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,string>::.ctor(string) - IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatToString>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) - IL_000f: ldarg.0 - IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_0015: ret - } // end of method Expr::__DebugDisplay - - .method public strict virtual instance string - ToString() cil managed - { - // Code size 22 (0x16) - .maxstack 8 - IL_0000: ldstr "%A" - IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,string>::.ctor(string) - IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatToString>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) - IL_000f: ldarg.0 - IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_0015: ret - } // end of method Expr::ToString - - .method public hidebysig virtual final - instance int32 CompareTo(class XYZ.ABC/ABC/Expr obj) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 81 (0x51) - .maxstack 4 - .locals init (class XYZ.ABC/ABC/Expr V_0, - class XYZ.ABC/ABC/Expr V_1, - class [mscorlib]System.Collections.IComparer V_2, - int32 V_3, - int32 V_4) - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldnull - IL_0003: cgt.un - IL_0005: brfalse.s IL_0009 - - IL_0007: br.s IL_000b - - IL_0009: br.s IL_0043 - - IL_000b: ldarg.1 - IL_000c: ldnull - IL_000d: cgt.un - IL_000f: brfalse.s IL_0013 - - IL_0011: br.s IL_0015 - - IL_0013: br.s IL_0041 - - IL_0015: ldarg.0 - IL_0016: pop - IL_0017: ldarg.0 - IL_0018: stloc.0 - IL_0019: ldarg.1 - IL_001a: stloc.1 - IL_001b: call class [mscorlib]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() - IL_0020: stloc.2 - IL_0021: ldloc.0 - IL_0022: ldfld int32 XYZ.ABC/ABC/Expr::item - IL_0027: stloc.3 - IL_0028: ldloc.1 - IL_0029: ldfld int32 XYZ.ABC/ABC/Expr::item - IL_002e: stloc.s V_4 - IL_0030: ldloc.3 - IL_0031: ldloc.s V_4 - IL_0033: bge.s IL_0037 - - IL_0035: br.s IL_0039 - - IL_0037: br.s IL_003b - - IL_0039: ldc.i4.m1 - IL_003a: ret - - IL_003b: ldloc.3 - IL_003c: ldloc.s V_4 - IL_003e: cgt - IL_0040: ret - - IL_0041: ldc.i4.1 - IL_0042: ret - - IL_0043: ldarg.1 - IL_0044: ldnull - IL_0045: cgt.un - IL_0047: brfalse.s IL_004b - - IL_0049: br.s IL_004d - - IL_004b: br.s IL_004f - - IL_004d: ldc.i4.m1 - IL_004e: ret - - IL_004f: ldc.i4.0 - IL_0050: ret - } // end of method Expr::CompareTo - - .method public hidebysig virtual final - instance int32 CompareTo(object obj) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 14 (0xe) - .maxstack 8 - .line 23,23 : 18,22 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldarg.1 - IL_0003: unbox.any XYZ.ABC/ABC/Expr - IL_0008: callvirt instance int32 XYZ.ABC/ABC/Expr::CompareTo(class XYZ.ABC/ABC/Expr) - IL_000d: ret - } // end of method Expr::CompareTo - - .method public hidebysig virtual final - instance int32 CompareTo(object obj, - class [mscorlib]System.Collections.IComparer comp) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 97 (0x61) - .maxstack 4 - .locals init ([0] class XYZ.ABC/ABC/Expr V_0, - [1] class XYZ.ABC/ABC/Expr V_1, - [2] class XYZ.ABC/ABC/Expr V_2, - [3] class [mscorlib]System.Collections.IComparer V_3, - [4] int32 V_4, - [5] int32 V_5) - .line 23,23 : 18,22 - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: unbox.any XYZ.ABC/ABC/Expr - IL_0007: stloc.0 - IL_0008: ldarg.0 - IL_0009: ldnull - IL_000a: cgt.un - IL_000c: brfalse.s IL_0010 - - IL_000e: br.s IL_0012 - - IL_0010: br.s IL_004e - - .line 100001,100001 : 0,0 - IL_0012: ldarg.1 - IL_0013: unbox.any XYZ.ABC/ABC/Expr - IL_0018: ldnull - IL_0019: cgt.un - IL_001b: brfalse.s IL_001f - - IL_001d: br.s IL_0021 - - IL_001f: br.s IL_004c - - .line 100001,100001 : 0,0 - IL_0021: ldarg.0 - IL_0022: pop - .line 100001,100001 : 0,0 - IL_0023: ldarg.0 - IL_0024: stloc.1 - IL_0025: ldloc.0 - IL_0026: stloc.2 - IL_0027: ldarg.2 - IL_0028: stloc.3 - IL_0029: ldloc.1 - IL_002a: ldfld int32 XYZ.ABC/ABC/Expr::item - IL_002f: stloc.s V_4 - IL_0031: ldloc.2 - IL_0032: ldfld int32 XYZ.ABC/ABC/Expr::item - IL_0037: stloc.s V_5 - IL_0039: ldloc.s V_4 - IL_003b: ldloc.s V_5 - IL_003d: bge.s IL_0041 - - IL_003f: br.s IL_0043 - - IL_0041: br.s IL_0045 - - .line 100001,100001 : 0,0 - IL_0043: ldc.i4.m1 - IL_0044: ret - - .line 100001,100001 : 0,0 - IL_0045: ldloc.s V_4 - IL_0047: ldloc.s V_5 - IL_0049: cgt - IL_004b: ret - - .line 100001,100001 : 0,0 - IL_004c: ldc.i4.1 - IL_004d: ret - - .line 100001,100001 : 0,0 - IL_004e: ldarg.1 - IL_004f: unbox.any XYZ.ABC/ABC/Expr - IL_0054: ldnull - IL_0055: cgt.un - IL_0057: brfalse.s IL_005b - - IL_0059: br.s IL_005d - - IL_005b: br.s IL_005f - - .line 100001,100001 : 0,0 - IL_005d: ldc.i4.m1 - IL_005e: ret - - .line 100001,100001 : 0,0 - IL_005f: ldc.i4.0 - IL_0060: ret - } // end of method Expr::CompareTo - - .method public hidebysig virtual final - instance int32 GetHashCode(class [mscorlib]System.Collections.IEqualityComparer comp) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 46 (0x2e) - .maxstack 7 - .locals init (int32 V_0, - class XYZ.ABC/ABC/Expr V_1, - class [mscorlib]System.Collections.IEqualityComparer V_2) - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldnull - IL_0003: cgt.un - IL_0005: brfalse.s IL_0009 - - IL_0007: br.s IL_000b - - IL_0009: br.s IL_002c - - IL_000b: ldc.i4.0 - IL_000c: stloc.0 - IL_000d: ldarg.0 - IL_000e: pop - IL_000f: ldarg.0 - IL_0010: stloc.1 - IL_0011: ldc.i4.0 - IL_0012: stloc.0 - IL_0013: ldc.i4 0x9e3779b9 - IL_0018: ldarg.1 - IL_0019: stloc.2 - IL_001a: ldloc.1 - IL_001b: ldfld int32 XYZ.ABC/ABC/Expr::item - IL_0020: ldloc.0 - IL_0021: ldc.i4.6 - IL_0022: shl - IL_0023: ldloc.0 - IL_0024: ldc.i4.2 - IL_0025: shr - IL_0026: add - IL_0027: add - IL_0028: add - IL_0029: stloc.0 - IL_002a: ldloc.0 - IL_002b: ret - - IL_002c: ldc.i4.0 - IL_002d: ret - } // end of method Expr::GetHashCode - - .method public hidebysig virtual final - instance int32 GetHashCode() cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 13 (0xd) - .maxstack 8 - .line 23,23 : 18,22 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: call class [mscorlib]System.Collections.IEqualityComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericEqualityComparer() - IL_0007: callvirt instance int32 XYZ.ABC/ABC/Expr::GetHashCode(class [mscorlib]System.Collections.IEqualityComparer) - IL_000c: ret - } // end of method Expr::GetHashCode - - .method public hidebysig virtual final - instance bool Equals(object obj, - class [mscorlib]System.Collections.IEqualityComparer comp) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 61 (0x3d) - .maxstack 4 - .locals init (class XYZ.ABC/ABC/Expr V_0, - class XYZ.ABC/ABC/Expr V_1, - class XYZ.ABC/ABC/Expr V_2, - class XYZ.ABC/ABC/Expr V_3, - class [mscorlib]System.Collections.IEqualityComparer V_4) - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldnull - IL_0003: cgt.un - IL_0005: brfalse.s IL_0009 - - IL_0007: br.s IL_000b - - IL_0009: br.s IL_0035 - - IL_000b: ldarg.1 - IL_000c: isinst XYZ.ABC/ABC/Expr - IL_0011: stloc.0 - IL_0012: ldloc.0 - IL_0013: brfalse.s IL_0017 - - IL_0015: br.s IL_0019 - - IL_0017: br.s IL_0033 - - IL_0019: ldloc.0 - IL_001a: stloc.1 - IL_001b: ldarg.0 - IL_001c: pop - IL_001d: ldarg.0 - IL_001e: stloc.2 - IL_001f: ldloc.1 - IL_0020: stloc.3 - IL_0021: ldarg.2 - IL_0022: stloc.s V_4 - IL_0024: ldloc.2 - IL_0025: ldfld int32 XYZ.ABC/ABC/Expr::item - IL_002a: ldloc.3 - IL_002b: ldfld int32 XYZ.ABC/ABC/Expr::item - IL_0030: ceq - IL_0032: ret - - IL_0033: ldc.i4.0 - IL_0034: ret - - IL_0035: ldarg.1 - IL_0036: ldnull - IL_0037: cgt.un - IL_0039: ldc.i4.0 - IL_003a: ceq - IL_003c: ret - } // end of method Expr::Equals - - .method public hidebysig virtual final - instance bool Equals(class XYZ.ABC/ABC/Expr obj) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 52 (0x34) - .maxstack 4 - .locals init (class XYZ.ABC/ABC/Expr V_0, - class XYZ.ABC/ABC/Expr V_1) - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldnull - IL_0003: cgt.un - IL_0005: brfalse.s IL_0009 - - IL_0007: br.s IL_000b - - IL_0009: br.s IL_002c - - IL_000b: ldarg.1 - IL_000c: ldnull - IL_000d: cgt.un - IL_000f: brfalse.s IL_0013 - - IL_0011: br.s IL_0015 - - IL_0013: br.s IL_002a - - IL_0015: ldarg.0 - IL_0016: pop - IL_0017: ldarg.0 - IL_0018: stloc.0 - IL_0019: ldarg.1 - IL_001a: stloc.1 - IL_001b: ldloc.0 - IL_001c: ldfld int32 XYZ.ABC/ABC/Expr::item - IL_0021: ldloc.1 - IL_0022: ldfld int32 XYZ.ABC/ABC/Expr::item - IL_0027: ceq - IL_0029: ret - - IL_002a: ldc.i4.0 - IL_002b: ret - - IL_002c: ldarg.1 - IL_002d: ldnull - IL_002e: cgt.un - IL_0030: ldc.i4.0 - IL_0031: ceq - IL_0033: ret - } // end of method Expr::Equals - - .method public hidebysig virtual final - instance bool Equals(object obj) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 25 (0x19) - .maxstack 4 - .locals init (class XYZ.ABC/ABC/Expr V_0) - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: isinst XYZ.ABC/ABC/Expr - IL_0007: stloc.0 - IL_0008: ldloc.0 - IL_0009: brfalse.s IL_000d - - IL_000b: br.s IL_000f - - IL_000d: br.s IL_0017 - - IL_000f: ldarg.0 - IL_0010: ldloc.0 - IL_0011: callvirt instance bool XYZ.ABC/ABC/Expr::Equals(class XYZ.ABC/ABC/Expr) - IL_0016: ret - - IL_0017: ldc.i4.0 - IL_0018: ret - } // end of method Expr::Equals - - .property instance int32 Tag() - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .get instance int32 XYZ.ABC/ABC/Expr::get_Tag() - } // end of property Expr::Tag - .property instance int32 Item() - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, - int32, - int32) = ( 01 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 ) - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .get instance int32 XYZ.ABC/ABC/Expr::get_Item() - } // end of property Expr::Item - } // end of class Expr - - .class auto ansi nested public beforefieldinit MyExn - extends [mscorlib]System.Exception - implements [mscorlib]System.Collections.IStructuralEquatable - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 05 00 00 00 00 00 ) - .field assembly int32 Data0@ - .method public specialname rtspecialname - instance void .ctor(int32 data0) cil managed - { - // Code size 14 (0xe) - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void [mscorlib]System.Exception::.ctor() - IL_0006: ldarg.0 - IL_0007: ldarg.1 - IL_0008: stfld int32 XYZ.ABC/ABC/MyExn::Data0@ - IL_000d: ret - } // end of method MyExn::.ctor - - .method public specialname rtspecialname - instance void .ctor() cil managed - { - // Code size 7 (0x7) - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void [mscorlib]System.Exception::.ctor() - IL_0006: ret - } // end of method MyExn::.ctor - - .method public hidebysig specialname - instance int32 get_Data0() cil managed - { - // Code size 7 (0x7) - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldfld int32 XYZ.ABC/ABC/MyExn::Data0@ - IL_0006: ret - } // end of method MyExn::get_Data0 - - .method public hidebysig virtual instance int32 - GetHashCode(class [mscorlib]System.Collections.IEqualityComparer comp) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 45 (0x2d) - .maxstack 7 - .locals init (int32 V_0, - class [mscorlib]System.Collections.IEqualityComparer V_1) - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldnull - IL_0003: cgt.un - IL_0005: brfalse.s IL_0009 - - IL_0007: br.s IL_000b - - IL_0009: br.s IL_002b - - IL_000b: ldc.i4.0 - IL_000c: stloc.0 - IL_000d: ldc.i4 0x9e3779b9 - IL_0012: ldarg.1 - IL_0013: stloc.1 - IL_0014: ldarg.0 - IL_0015: castclass XYZ.ABC/ABC/MyExn - IL_001a: call instance int32 XYZ.ABC/ABC/MyExn::get_Data0() - IL_001f: ldloc.0 - IL_0020: ldc.i4.6 - IL_0021: shl - IL_0022: ldloc.0 - IL_0023: ldc.i4.2 - IL_0024: shr - IL_0025: add - IL_0026: add - IL_0027: add - IL_0028: stloc.0 - IL_0029: ldloc.0 - IL_002a: ret - - IL_002b: ldc.i4.0 - IL_002c: ret - } // end of method MyExn::GetHashCode - - .method public hidebysig virtual instance int32 - GetHashCode() cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 13 (0xd) - .maxstack 8 - .line 24,24 : 23,28 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: call class [mscorlib]System.Collections.IEqualityComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericEqualityComparer() - IL_0007: callvirt instance int32 XYZ.ABC/ABC/MyExn::GetHashCode(class [mscorlib]System.Collections.IEqualityComparer) - IL_000c: ret - } // end of method MyExn::GetHashCode - - .method public hidebysig virtual instance bool - Equals(object obj, - class [mscorlib]System.Collections.IEqualityComparer comp) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 76 (0x4c) - .maxstack 4 - .locals init (class [mscorlib]System.Exception V_0, - class [mscorlib]System.Exception V_1, - class [mscorlib]System.Collections.IEqualityComparer V_2) - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldnull - IL_0003: cgt.un - IL_0005: brfalse.s IL_0009 - - IL_0007: br.s IL_000b - - IL_0009: br.s IL_0044 - - IL_000b: ldarg.1 - IL_000c: isinst [mscorlib]System.Exception - IL_0011: stloc.0 - IL_0012: ldloc.0 - IL_0013: brfalse.s IL_0017 - - IL_0015: br.s IL_0019 - - IL_0017: br.s IL_0042 - - IL_0019: ldloc.0 - IL_001a: stloc.1 - IL_001b: ldloc.0 - IL_001c: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::TypeTestGeneric(object) - IL_0021: brtrue.s IL_0025 - - IL_0023: br.s IL_0040 - - IL_0025: ldarg.2 - IL_0026: stloc.2 - IL_0027: ldarg.0 - IL_0028: castclass XYZ.ABC/ABC/MyExn - IL_002d: call instance int32 XYZ.ABC/ABC/MyExn::get_Data0() - IL_0032: ldloc.1 - IL_0033: castclass XYZ.ABC/ABC/MyExn - IL_0038: call instance int32 XYZ.ABC/ABC/MyExn::get_Data0() - IL_003d: ceq - IL_003f: ret - - IL_0040: ldc.i4.0 - IL_0041: ret - - IL_0042: ldc.i4.0 - IL_0043: ret - - IL_0044: ldarg.1 - IL_0045: ldnull - IL_0046: cgt.un - IL_0048: ldc.i4.0 - IL_0049: ceq - IL_004b: ret - } // end of method MyExn::Equals - - .method public hidebysig instance bool - Equals(class [mscorlib]System.Exception obj) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 68 (0x44) - .maxstack 4 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldnull - IL_0003: cgt.un - IL_0005: brfalse.s IL_0009 - - IL_0007: br.s IL_000b - - IL_0009: br.s IL_003c - - IL_000b: ldarg.1 - IL_000c: ldnull - IL_000d: cgt.un - IL_000f: brfalse.s IL_0013 - - IL_0011: br.s IL_0015 - - IL_0013: br.s IL_003a - - IL_0015: ldarg.1 - IL_0016: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::TypeTestGeneric(object) - IL_001b: brtrue.s IL_001f - - IL_001d: br.s IL_0038 - - IL_001f: ldarg.0 - IL_0020: castclass XYZ.ABC/ABC/MyExn - IL_0025: call instance int32 XYZ.ABC/ABC/MyExn::get_Data0() - IL_002a: ldarg.1 - IL_002b: castclass XYZ.ABC/ABC/MyExn - IL_0030: call instance int32 XYZ.ABC/ABC/MyExn::get_Data0() - IL_0035: ceq - IL_0037: ret - - IL_0038: ldc.i4.0 - IL_0039: ret - - IL_003a: ldc.i4.0 - IL_003b: ret - - IL_003c: ldarg.1 - IL_003d: ldnull - IL_003e: cgt.un - IL_0040: ldc.i4.0 - IL_0041: ceq - IL_0043: ret - } // end of method MyExn::Equals - - .method public hidebysig virtual instance bool - Equals(object obj) cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 25 (0x19) - .maxstack 4 - .locals init (class [mscorlib]System.Exception V_0) - IL_0000: nop - IL_0001: ldarg.1 - IL_0002: isinst [mscorlib]System.Exception - IL_0007: stloc.0 - IL_0008: ldloc.0 - IL_0009: brfalse.s IL_000d - - IL_000b: br.s IL_000f - - IL_000d: br.s IL_0017 - - IL_000f: ldarg.0 - IL_0010: ldloc.0 - IL_0011: callvirt instance bool XYZ.ABC/ABC/MyExn::Equals(class [mscorlib]System.Exception) - IL_0016: ret - - IL_0017: ldc.i4.0 - IL_0018: ret - } // end of method MyExn::Equals - - .property instance int32 Data0() - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, - int32) = ( 01 00 04 00 00 00 00 00 00 00 00 00 ) - .get instance int32 XYZ.ABC/ABC/MyExn::get_Data0() - } // end of property MyExn::Data0 - } // end of class MyExn - - .class auto ansi nested public A - extends [mscorlib]System.Object - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) - .field assembly string x - .method public specialname rtspecialname - instance void .ctor(string x) cil managed - { - // Code size 17 (0x11) - .maxstack 8 - .line 25,25 : 20,21 - IL_0000: ldarg.0 - IL_0001: callvirt instance void [mscorlib]System.Object::.ctor() - IL_0006: ldarg.0 - IL_0007: pop - IL_0008: nop - IL_0009: ldarg.0 - IL_000a: ldarg.1 - IL_000b: stfld string XYZ.ABC/ABC/A::x - .line 25,25 : 18,19 - IL_0010: ret - } // end of method A::.ctor - - .method public hidebysig specialname - instance string get_X() cil managed - { - // Code size 8 (0x8) - .maxstack 8 - .line 25,25 : 46,47 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldfld string XYZ.ABC/ABC/A::x - IL_0007: ret - } // end of method A::get_X - - .property instance string X() - { - .get instance string XYZ.ABC/ABC/A::get_X() - } // end of property A::X - } // end of class A - - .method public static int32 'add'(int32 x, - int32 y) cil managed - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) - // Code size 5 (0x5) - .maxstack 8 - .line 28,28 : 27,32 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldarg.1 - IL_0003: add - IL_0004: ret - } // end of method ABC::'add' - - .method public specialname static string - get_greeting() cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 7 (0x7) - .maxstack 8 - IL_0000: nop - IL_0001: ldstr "hello" - IL_0006: ret - } // end of method ABC::get_greeting - - .property string greeting() - { - .get string XYZ.ABC/ABC::get_greeting() - } // end of property ABC::greeting - } // end of class ABC - - .method public static int32 'add'(int32 x, - int32 y) cil managed - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) - // Code size 5 (0x5) - .maxstack 8 - .line 18,18 : 23,28 - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: ldarg.1 - IL_0003: add - IL_0004: ret - } // end of method ABC::'add' - - .method public specialname static string - get_greeting() cil managed - { - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - // Code size 7 (0x7) - .maxstack 8 - IL_0000: nop - IL_0001: ldstr "hello" - IL_0006: ret - } // end of method ABC::get_greeting - - .property string greeting() - { - .get string XYZ.ABC::get_greeting() - } // end of property ABC::greeting -} // end of class XYZ.ABC - -.class private abstract auto ansi sealed ''.$ToplevelNamespace - extends [mscorlib]System.Object -{ - .field static assembly int32 init@ - .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method private specialname rtspecialname static - void .cctor() cil managed - { - // Code size 14 (0xe) - .maxstack 3 - .locals init ([0] string greeting, - [1] string V_1) - .line 19,19 : 9,31 '' - IL_0000: nop - IL_0001: call string XYZ.ABC::get_greeting() - IL_0006: stloc.0 - .line 29,29 : 13,35 '' - IL_0007: call string XYZ.ABC/ABC::get_greeting() - IL_000c: stloc.1 - IL_000d: ret - } // end of method $ToplevelNamespace::.cctor -} // end of class ''.$ToplevelNamespace - - -// ============================================================= - -// *********** DISASSEMBLY COMPLETE *********************** diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/SerializableAttribute/env.lst b/tests/fsharpqa/Source/CodeGen/EmittedIL/SerializableAttribute/env.lst index 3a3631b97e8..02b9c03bb30 100644 --- a/tests/fsharpqa/Source/CodeGen/EmittedIL/SerializableAttribute/env.lst +++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/SerializableAttribute/env.lst @@ -1,5 +1,5 @@ - SOURCE=ToplevelModule.fs SCFLAGS="-a -g --out:desktop\\TopLevelModule.dll --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd ToplevelModule.dll NetFx20 desktop" # ToplevelModule.fs - Desktop - SOURCE=ToplevelNamespace.fs SCFLAGS="-a -g --out:desktop\\ToplevelNamespace.dll --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd ToplevelNamespace.dll NetFx20 desktop" # ToplevelNamespace.fs - Desktop + SOURCE=ToplevelModule.fs SCFLAGS="-a -g --out:TopLevelModule.dll --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd ToplevelModule.dll" # ToplevelModule.fs - Desktop + SOURCE=ToplevelNamespace.fs SCFLAGS="-a -g --out:ToplevelNamespace.dll --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd ToplevelNamespace.dll" # ToplevelNamespace.fs - Desktop diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction24.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction24.il.bsl index 1063152863a..88351c96ebf 100644 --- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction24.il.bsl +++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction24.il.bsl @@ -36,13 +36,13 @@ // Offset: 0x00000748 Length: 0x00000228 } .module TestFunction24.exe -// MVID: {60B68B97-A643-4587-A745-0383978BB660} +// MVID: {60D4E6CF-A643-4587-A745-0383CFE6D460} .imagebase 0x00400000 .file alignment 0x00000200 .stackreserve 0x00100000 .subsystem 0x0003 // WINDOWS_CUI .corflags 0x00000001 // ILONLY -// Image base: 0x06EA0000 +// Image base: 0x056D0000 // =============== CLASS MEMBERS DECLARATION =================== @@ -865,7 +865,7 @@ .method public static class [mscorlib]System.Tuple`2 pinString() cil managed { - // Code size 77 (0x4d) + // Code size 93 (0x5d) .maxstack 6 .locals init ([0] string str, [1] native int pChar, @@ -873,7 +873,11 @@ [3] native int V_3, [4] int32 V_4, [5] native int V_5, - [6] int32 V_6) + [6] native int V_6, + [7] native int V_7, + [8] int32 V_8, + [9] native int V_9, + [10] native int V_10) .line 28,28 : 5,28 '' IL_0000: ldstr "Hello World" IL_0005: stloc.0 @@ -909,21 +913,29 @@ IL_0022: sizeof [mscorlib]System.Char IL_0028: mul IL_0029: add - IL_002a: ldobj [mscorlib]System.Char - IL_002f: ldloc.1 - IL_0030: stloc.s V_5 - IL_0032: ldc.i4.1 - IL_0033: stloc.s V_6 - IL_0035: ldloc.s V_5 - IL_0037: ldloc.s V_6 - IL_0039: conv.i - IL_003a: sizeof [mscorlib]System.Char - IL_0040: mul - IL_0041: add - IL_0042: ldobj [mscorlib]System.Char - IL_0047: newobj instance void class [mscorlib]System.Tuple`2::.ctor(!0, + IL_002a: stloc.s V_5 + IL_002c: ldloc.s V_5 + IL_002e: stloc.s V_6 + IL_0030: ldloc.s V_6 + IL_0032: ldobj [mscorlib]System.Char + IL_0037: ldloc.1 + IL_0038: stloc.s V_7 + IL_003a: ldc.i4.1 + IL_003b: stloc.s V_8 + IL_003d: ldloc.s V_7 + IL_003f: ldloc.s V_8 + IL_0041: conv.i + IL_0042: sizeof [mscorlib]System.Char + IL_0048: mul + IL_0049: add + IL_004a: stloc.s V_9 + IL_004c: ldloc.s V_9 + IL_004e: stloc.s V_10 + IL_0050: ldloc.s V_10 + IL_0052: ldobj [mscorlib]System.Char + IL_0057: newobj instance void class [mscorlib]System.Tuple`2::.ctor(!0, !1) - IL_004c: ret + IL_005c: ret } // end of method TestFunction24::pinString } // end of class TestFunction24 diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction25.fs b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction25.fs new file mode 100644 index 00000000000..eb297d2f636 --- /dev/null +++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction25.fs @@ -0,0 +1,32 @@ +open FSharp.NativeInterop +// Assume that the following class exists. + +type Point = { mutable x : int; mutable y : int } + +let pinObject() = + let point = { x = 1; y = 2 } + use p1 = fixed &point.x // note, fixed is a keyword and would be highlighted + NativePtr.get p1 0 + NativePtr.get p1 1 + +let pinRef() = + let point = ref 17 + use p1 = fixed &point.contents // note, fixed is a keyword and would be highlighted + NativePtr.read p1 + NativePtr.read p1 + +let pinArray1() = + let arr = [| 0.0; 1.5; 2.3; 3.4; 4.0; 5.9 |] + use p1 = fixed arr + NativePtr.get p1 0 + NativePtr.get p1 1 + +let pinArray2() = + let arr = [| 0.0; 1.5; 2.3; 3.4; 4.0; 5.9 |] + // You can initialize a pointer by using the address of a variable. + use p = fixed &arr.[0] + NativePtr.get p 0 + NativePtr.get p 1 + +let pinString() = + let str = "Hello World" + // The following assignment initializes p by using a string. + use pChar = fixed str + NativePtr.get pChar 0, NativePtr.get pChar 1 + diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction25.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction25.il.bsl new file mode 100644 index 00000000000..7463c4894bc --- /dev/null +++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/TestFunction25.il.bsl @@ -0,0 +1,849 @@ + +// Microsoft (R) .NET Framework IL Disassembler. Version 4.8.3928.0 +// Copyright (c) Microsoft Corporation. All rights reserved. + + + +// Metadata version: v4.0.30319 +.assembly extern mscorlib +{ + .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. + .ver 4:0:0:0 +} +.assembly extern FSharp.Core +{ + .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) // .?_....: + .ver 5:0:0:0 +} +.assembly TestFunction25 +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, + int32, + int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) + + // --- The following custom attribute is added automatically, do not uncomment ------- + // .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 01 00 00 00 00 00 ) + + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.TestFunction25 +{ + // Offset: 0x00000000 Length: 0x00000742 +} +.mresource public FSharpOptimizationData.TestFunction25 +{ + // Offset: 0x00000748 Length: 0x000003D2 +} +.module TestFunction25.exe +// MVID: {60D4E82F-A643-4662-A745-03832FE8D460} +.imagebase 0x00400000 +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 // WINDOWS_CUI +.corflags 0x00000001 // ILONLY +// Image base: 0x04E60000 + + +// =============== CLASS MEMBERS DECLARATION =================== + +.class public abstract auto ansi sealed TestFunction25 + extends [mscorlib]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .class auto ansi serializable sealed nested public Point + extends [mscorlib]System.Object + implements class [mscorlib]System.IEquatable`1, + [mscorlib]System.Collections.IStructuralEquatable, + class [mscorlib]System.IComparable`1, + [mscorlib]System.IComparable, + [mscorlib]System.Collections.IStructuralComparable + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 02 00 00 00 00 00 ) + .field public int32 x@ + .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .field public int32 y@ + .custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .method public hidebysig specialname + instance int32 get_x() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld int32 TestFunction25/Point::x@ + IL_0006: ret + } // end of method Point::get_x + + .method public hidebysig specialname + instance int32 get_y() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld int32 TestFunction25/Point::y@ + IL_0006: ret + } // end of method Point::get_y + + .method public hidebysig specialname + instance void set_x(int32 'value') cil managed + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: stfld int32 TestFunction25/Point::x@ + IL_0007: ret + } // end of method Point::set_x + + .method public hidebysig specialname + instance void set_y(int32 'value') cil managed + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: stfld int32 TestFunction25/Point::y@ + IL_0007: ret + } // end of method Point::set_y + + .method public specialname rtspecialname + instance void .ctor(int32 x, + int32 y) cil managed + { + // Code size 21 (0x15) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld int32 TestFunction25/Point::x@ + IL_000d: ldarg.0 + IL_000e: ldarg.2 + IL_000f: stfld int32 TestFunction25/Point::y@ + IL_0014: ret + } // end of method Point::.ctor + + .method public strict virtual instance string + ToString() cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 22 (0x16) + .maxstack 8 + IL_0000: ldstr "%+A" + IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,class TestFunction25/Point>::.ctor(string) + IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatToString>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_000f: ldarg.0 + IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0015: ret + } // end of method Point::ToString + + .method public hidebysig virtual final + instance int32 CompareTo(class TestFunction25/Point obj) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 101 (0x65) + .maxstack 4 + .locals init ([0] int32 V_0, + [1] class [mscorlib]System.Collections.IComparer V_1, + [2] int32 V_2, + [3] int32 V_3) + .language '{AB4F38C9-B6E6-43BA-BE3B-58080B2CCCE3}', '{994B45C4-E6E9-11D2-903F-00C04FA302A1}', '{5A869D0B-6611-11D3-BD2A-0000F80849BD}' + .line 16707566,16707566 : 0,0 'C:\\GitHub\\dsyme\\fsharp\\tests\\fsharpqa\\source\\CodeGen\\EmittedIL\\TestFunctions\\TestFunction25.fs' + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: cgt.un + IL_0004: brfalse.s IL_005b + + .line 16707566,16707566 : 0,0 '' + IL_0006: ldarg.1 + IL_0007: ldnull + IL_0008: cgt.un + IL_000a: brfalse.s IL_0059 + + .line 16707566,16707566 : 0,0 '' + IL_000c: call class [mscorlib]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() + IL_0011: stloc.1 + IL_0012: ldarg.0 + IL_0013: ldfld int32 TestFunction25/Point::x@ + IL_0018: stloc.2 + IL_0019: ldarg.1 + IL_001a: ldfld int32 TestFunction25/Point::x@ + IL_001f: stloc.3 + IL_0020: ldloc.2 + IL_0021: ldloc.3 + IL_0022: bge.s IL_0028 + + .line 16707566,16707566 : 0,0 '' + IL_0024: ldc.i4.m1 + .line 16707566,16707566 : 0,0 '' + IL_0025: nop + IL_0026: br.s IL_002d + + .line 16707566,16707566 : 0,0 '' + IL_0028: ldloc.2 + IL_0029: ldloc.3 + IL_002a: cgt + .line 16707566,16707566 : 0,0 '' + IL_002c: nop + .line 16707566,16707566 : 0,0 '' + IL_002d: stloc.0 + IL_002e: ldloc.0 + IL_002f: ldc.i4.0 + IL_0030: bge.s IL_0034 + + .line 16707566,16707566 : 0,0 '' + IL_0032: ldloc.0 + IL_0033: ret + + .line 16707566,16707566 : 0,0 '' + IL_0034: ldloc.0 + IL_0035: ldc.i4.0 + IL_0036: ble.s IL_003a + + .line 16707566,16707566 : 0,0 '' + IL_0038: ldloc.0 + IL_0039: ret + + .line 16707566,16707566 : 0,0 '' + IL_003a: call class [mscorlib]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() + IL_003f: stloc.1 + IL_0040: ldarg.0 + IL_0041: ldfld int32 TestFunction25/Point::y@ + IL_0046: stloc.2 + IL_0047: ldarg.1 + IL_0048: ldfld int32 TestFunction25/Point::y@ + IL_004d: stloc.3 + IL_004e: ldloc.2 + IL_004f: ldloc.3 + IL_0050: bge.s IL_0054 + + .line 16707566,16707566 : 0,0 '' + IL_0052: ldc.i4.m1 + IL_0053: ret + + .line 16707566,16707566 : 0,0 '' + IL_0054: ldloc.2 + IL_0055: ldloc.3 + IL_0056: cgt + IL_0058: ret + + .line 16707566,16707566 : 0,0 '' + IL_0059: ldc.i4.1 + IL_005a: ret + + .line 16707566,16707566 : 0,0 '' + IL_005b: ldarg.1 + IL_005c: ldnull + IL_005d: cgt.un + IL_005f: brfalse.s IL_0063 + + .line 16707566,16707566 : 0,0 '' + IL_0061: ldc.i4.m1 + IL_0062: ret + + .line 16707566,16707566 : 0,0 '' + IL_0063: ldc.i4.0 + IL_0064: ret + } // end of method Point::CompareTo + + .method public hidebysig virtual final + instance int32 CompareTo(object obj) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 13 (0xd) + .maxstack 8 + .line 4,4 : 6,11 '' + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: unbox.any TestFunction25/Point + IL_0007: callvirt instance int32 TestFunction25/Point::CompareTo(class TestFunction25/Point) + IL_000c: ret + } // end of method Point::CompareTo + + .method public hidebysig virtual final + instance int32 CompareTo(object obj, + class [mscorlib]System.Collections.IComparer comp) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 106 (0x6a) + .maxstack 4 + .locals init ([0] class TestFunction25/Point V_0, + [1] int32 V_1, + [2] int32 V_2, + [3] int32 V_3) + .line 4,4 : 6,11 '' + IL_0000: ldarg.1 + IL_0001: unbox.any TestFunction25/Point + IL_0006: stloc.0 + IL_0007: ldarg.0 + IL_0008: ldnull + IL_0009: cgt.un + IL_000b: brfalse.s IL_005b + + .line 16707566,16707566 : 0,0 '' + IL_000d: ldarg.1 + IL_000e: unbox.any TestFunction25/Point + IL_0013: ldnull + IL_0014: cgt.un + IL_0016: brfalse.s IL_0059 + + .line 16707566,16707566 : 0,0 '' + IL_0018: ldarg.0 + IL_0019: ldfld int32 TestFunction25/Point::x@ + IL_001e: stloc.2 + IL_001f: ldloc.0 + IL_0020: ldfld int32 TestFunction25/Point::x@ + IL_0025: stloc.3 + IL_0026: ldloc.2 + IL_0027: ldloc.3 + IL_0028: bge.s IL_002e + + .line 16707566,16707566 : 0,0 '' + IL_002a: ldc.i4.m1 + .line 16707566,16707566 : 0,0 '' + IL_002b: nop + IL_002c: br.s IL_0033 + + .line 16707566,16707566 : 0,0 '' + IL_002e: ldloc.2 + IL_002f: ldloc.3 + IL_0030: cgt + .line 16707566,16707566 : 0,0 '' + IL_0032: nop + .line 16707566,16707566 : 0,0 '' + IL_0033: stloc.1 + IL_0034: ldloc.1 + IL_0035: ldc.i4.0 + IL_0036: bge.s IL_003a + + .line 16707566,16707566 : 0,0 '' + IL_0038: ldloc.1 + IL_0039: ret + + .line 16707566,16707566 : 0,0 '' + IL_003a: ldloc.1 + IL_003b: ldc.i4.0 + IL_003c: ble.s IL_0040 + + .line 16707566,16707566 : 0,0 '' + IL_003e: ldloc.1 + IL_003f: ret + + .line 16707566,16707566 : 0,0 '' + IL_0040: ldarg.0 + IL_0041: ldfld int32 TestFunction25/Point::y@ + IL_0046: stloc.2 + IL_0047: ldloc.0 + IL_0048: ldfld int32 TestFunction25/Point::y@ + IL_004d: stloc.3 + IL_004e: ldloc.2 + IL_004f: ldloc.3 + IL_0050: bge.s IL_0054 + + .line 16707566,16707566 : 0,0 '' + IL_0052: ldc.i4.m1 + IL_0053: ret + + .line 16707566,16707566 : 0,0 '' + IL_0054: ldloc.2 + IL_0055: ldloc.3 + IL_0056: cgt + IL_0058: ret + + .line 16707566,16707566 : 0,0 '' + IL_0059: ldc.i4.1 + IL_005a: ret + + .line 16707566,16707566 : 0,0 '' + IL_005b: ldarg.1 + IL_005c: unbox.any TestFunction25/Point + IL_0061: ldnull + IL_0062: cgt.un + IL_0064: brfalse.s IL_0068 + + .line 16707566,16707566 : 0,0 '' + IL_0066: ldc.i4.m1 + IL_0067: ret + + .line 16707566,16707566 : 0,0 '' + IL_0068: ldc.i4.0 + IL_0069: ret + } // end of method Point::CompareTo + + .method public hidebysig virtual final + instance int32 GetHashCode(class [mscorlib]System.Collections.IEqualityComparer comp) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 54 (0x36) + .maxstack 7 + .locals init ([0] int32 V_0) + .line 16707566,16707566 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: cgt.un + IL_0004: brfalse.s IL_0034 + + .line 16707566,16707566 : 0,0 '' + IL_0006: ldc.i4.0 + IL_0007: stloc.0 + IL_0008: ldc.i4 0x9e3779b9 + IL_000d: ldarg.0 + IL_000e: ldfld int32 TestFunction25/Point::y@ + IL_0013: ldloc.0 + IL_0014: ldc.i4.6 + IL_0015: shl + IL_0016: ldloc.0 + IL_0017: ldc.i4.2 + IL_0018: shr + IL_0019: add + IL_001a: add + IL_001b: add + IL_001c: stloc.0 + IL_001d: ldc.i4 0x9e3779b9 + IL_0022: ldarg.0 + IL_0023: ldfld int32 TestFunction25/Point::x@ + IL_0028: ldloc.0 + IL_0029: ldc.i4.6 + IL_002a: shl + IL_002b: ldloc.0 + IL_002c: ldc.i4.2 + IL_002d: shr + IL_002e: add + IL_002f: add + IL_0030: add + IL_0031: stloc.0 + IL_0032: ldloc.0 + IL_0033: ret + + .line 16707566,16707566 : 0,0 '' + IL_0034: ldc.i4.0 + IL_0035: ret + } // end of method Point::GetHashCode + + .method public hidebysig virtual final + instance int32 GetHashCode() cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 12 (0xc) + .maxstack 8 + .line 4,4 : 6,11 '' + IL_0000: ldarg.0 + IL_0001: call class [mscorlib]System.Collections.IEqualityComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericEqualityComparer() + IL_0006: callvirt instance int32 TestFunction25/Point::GetHashCode(class [mscorlib]System.Collections.IEqualityComparer) + IL_000b: ret + } // end of method Point::GetHashCode + + .method public hidebysig virtual final + instance bool Equals(object obj, + class [mscorlib]System.Collections.IEqualityComparer comp) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 57 (0x39) + .maxstack 4 + .locals init ([0] class TestFunction25/Point V_0) + .line 16707566,16707566 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: cgt.un + IL_0004: brfalse.s IL_0031 + + .line 16707566,16707566 : 0,0 '' + IL_0006: ldarg.1 + IL_0007: isinst TestFunction25/Point + IL_000c: stloc.0 + IL_000d: ldloc.0 + IL_000e: brfalse.s IL_002f + + .line 16707566,16707566 : 0,0 '' + IL_0010: ldarg.0 + IL_0011: ldfld int32 TestFunction25/Point::x@ + IL_0016: ldloc.0 + IL_0017: ldfld int32 TestFunction25/Point::x@ + IL_001c: bne.un.s IL_002d + + .line 16707566,16707566 : 0,0 '' + IL_001e: ldarg.0 + IL_001f: ldfld int32 TestFunction25/Point::y@ + IL_0024: ldloc.0 + IL_0025: ldfld int32 TestFunction25/Point::y@ + IL_002a: ceq + IL_002c: ret + + .line 16707566,16707566 : 0,0 '' + IL_002d: ldc.i4.0 + IL_002e: ret + + .line 16707566,16707566 : 0,0 '' + IL_002f: ldc.i4.0 + IL_0030: ret + + .line 16707566,16707566 : 0,0 '' + IL_0031: ldarg.1 + IL_0032: ldnull + IL_0033: cgt.un + IL_0035: ldc.i4.0 + IL_0036: ceq + IL_0038: ret + } // end of method Point::Equals + + .method public hidebysig virtual final + instance bool Equals(class TestFunction25/Point obj) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 53 (0x35) + .maxstack 8 + .line 16707566,16707566 : 0,0 '' + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: cgt.un + IL_0004: brfalse.s IL_002d + + .line 16707566,16707566 : 0,0 '' + IL_0006: ldarg.1 + IL_0007: ldnull + IL_0008: cgt.un + IL_000a: brfalse.s IL_002b + + .line 16707566,16707566 : 0,0 '' + IL_000c: ldarg.0 + IL_000d: ldfld int32 TestFunction25/Point::x@ + IL_0012: ldarg.1 + IL_0013: ldfld int32 TestFunction25/Point::x@ + IL_0018: bne.un.s IL_0029 + + .line 16707566,16707566 : 0,0 '' + IL_001a: ldarg.0 + IL_001b: ldfld int32 TestFunction25/Point::y@ + IL_0020: ldarg.1 + IL_0021: ldfld int32 TestFunction25/Point::y@ + IL_0026: ceq + IL_0028: ret + + .line 16707566,16707566 : 0,0 '' + IL_0029: ldc.i4.0 + IL_002a: ret + + .line 16707566,16707566 : 0,0 '' + IL_002b: ldc.i4.0 + IL_002c: ret + + .line 16707566,16707566 : 0,0 '' + IL_002d: ldarg.1 + IL_002e: ldnull + IL_002f: cgt.un + IL_0031: ldc.i4.0 + IL_0032: ceq + IL_0034: ret + } // end of method Point::Equals + + .method public hidebysig virtual final + instance bool Equals(object obj) cil managed + { + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + // Code size 20 (0x14) + .maxstack 4 + .locals init ([0] class TestFunction25/Point V_0) + .line 4,4 : 6,11 '' + IL_0000: ldarg.1 + IL_0001: isinst TestFunction25/Point + IL_0006: stloc.0 + IL_0007: ldloc.0 + IL_0008: brfalse.s IL_0012 + + .line 16707566,16707566 : 0,0 '' + IL_000a: ldarg.0 + IL_000b: ldloc.0 + IL_000c: callvirt instance bool TestFunction25/Point::Equals(class TestFunction25/Point) + IL_0011: ret + + .line 16707566,16707566 : 0,0 '' + IL_0012: ldc.i4.0 + IL_0013: ret + } // end of method Point::Equals + + .property instance int32 x() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 04 00 00 00 00 00 00 00 00 00 ) + .set instance void TestFunction25/Point::set_x(int32) + .get instance int32 TestFunction25/Point::get_x() + } // end of property Point::x + .property instance int32 y() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 04 00 00 00 01 00 00 00 00 00 ) + .set instance void TestFunction25/Point::set_y(int32) + .get instance int32 TestFunction25/Point::get_y() + } // end of property Point::y + } // end of class Point + + .method public static int32 pinObject() cil managed + { + // Code size 52 (0x34) + .maxstack 6 + .locals init ([0] class TestFunction25/Point point, + [1] native int p1, + [2] int32& pinned V_2) + .line 7,7 : 5,33 '' + IL_0000: ldc.i4.1 + IL_0001: ldc.i4.2 + IL_0002: newobj instance void TestFunction25/Point::.ctor(int32, + int32) + IL_0007: stloc.0 + .line 8,8 : 5,28 '' + IL_0008: ldloc.0 + IL_0009: ldflda int32 TestFunction25/Point::x@ + IL_000e: stloc.2 + IL_000f: ldloc.2 + IL_0010: conv.i + IL_0011: stloc.1 + .line 9,9 : 5,44 '' + IL_0012: ldloc.1 + IL_0013: ldc.i4.0 + IL_0014: conv.i + IL_0015: sizeof [mscorlib]System.Int32 + IL_001b: mul + IL_001c: add + IL_001d: ldobj [mscorlib]System.Int32 + IL_0022: ldloc.1 + IL_0023: ldc.i4.1 + IL_0024: conv.i + IL_0025: sizeof [mscorlib]System.Int32 + IL_002b: mul + IL_002c: add + IL_002d: ldobj [mscorlib]System.Int32 + IL_0032: add + IL_0033: ret + } // end of method TestFunction25::pinObject + + .method public static int32 pinRef() cil managed + { + // Code size 32 (0x20) + .maxstack 4 + .locals init ([0] class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 point, + [1] native int p1, + [2] int32& pinned V_2) + .line 12,12 : 5,23 '' + IL_0000: ldc.i4.s 17 + IL_0002: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::.ctor(!0) + IL_0007: stloc.0 + .line 13,13 : 5,35 '' + IL_0008: ldloc.0 + IL_0009: ldflda !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::contents@ + IL_000e: stloc.2 + IL_000f: ldloc.2 + IL_0010: conv.i + IL_0011: stloc.1 + .line 14,14 : 5,42 '' + IL_0012: ldloc.1 + IL_0013: ldobj [mscorlib]System.Int32 + IL_0018: ldloc.1 + IL_0019: ldobj [mscorlib]System.Int32 + IL_001e: add + IL_001f: ret + } // end of method TestFunction25::pinRef + + .method public static float64 pinArray1() cil managed + { + // Code size 170 (0xaa) + .maxstack 6 + .locals init ([0] float64[] arr, + [1] native int p1, + [2] float64& pinned V_2) + .line 17,17 : 5,49 '' + IL_0000: ldc.i4.6 + IL_0001: newarr [mscorlib]System.Double + IL_0006: dup + IL_0007: ldc.i4.0 + IL_0008: ldc.r8 0.0 + IL_0011: stelem [mscorlib]System.Double + IL_0016: dup + IL_0017: ldc.i4.1 + IL_0018: ldc.r8 1.5 + IL_0021: stelem [mscorlib]System.Double + IL_0026: dup + IL_0027: ldc.i4.2 + IL_0028: ldc.r8 2.2999999999999998 + IL_0031: stelem [mscorlib]System.Double + IL_0036: dup + IL_0037: ldc.i4.3 + IL_0038: ldc.r8 3.3999999999999999 + IL_0041: stelem [mscorlib]System.Double + IL_0046: dup + IL_0047: ldc.i4.4 + IL_0048: ldc.r8 4. + IL_0051: stelem [mscorlib]System.Double + IL_0056: dup + IL_0057: ldc.i4.5 + IL_0058: ldc.r8 5.9000000000000004 + IL_0061: stelem [mscorlib]System.Double + IL_0066: stloc.0 + .line 18,18 : 5,23 '' + IL_0067: ldloc.0 + IL_0068: brfalse.s IL_0084 + + .line 16707566,16707566 : 0,0 '' + IL_006a: ldloc.0 + IL_006b: call int32 [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::Length(!!0[]) + IL_0070: brfalse.s IL_007f + + .line 16707566,16707566 : 0,0 '' + IL_0072: ldloc.0 + IL_0073: ldc.i4.0 + IL_0074: ldelema [mscorlib]System.Double + IL_0079: stloc.2 + IL_007a: ldloc.2 + IL_007b: conv.i + .line 16707566,16707566 : 0,0 '' + IL_007c: nop + IL_007d: br.s IL_0087 + + .line 16707566,16707566 : 0,0 '' + IL_007f: ldc.i4.0 + IL_0080: conv.i + .line 16707566,16707566 : 0,0 '' + IL_0081: nop + IL_0082: br.s IL_0087 + + .line 16707566,16707566 : 0,0 '' + IL_0084: ldc.i4.0 + IL_0085: conv.i + .line 16707566,16707566 : 0,0 '' + IL_0086: nop + .line 16707566,16707566 : 0,0 '' + IL_0087: stloc.1 + .line 19,19 : 5,44 '' + IL_0088: ldloc.1 + IL_0089: ldc.i4.0 + IL_008a: conv.i + IL_008b: sizeof [mscorlib]System.Double + IL_0091: mul + IL_0092: add + IL_0093: ldobj [mscorlib]System.Double + IL_0098: ldloc.1 + IL_0099: ldc.i4.1 + IL_009a: conv.i + IL_009b: sizeof [mscorlib]System.Double + IL_00a1: mul + IL_00a2: add + IL_00a3: ldobj [mscorlib]System.Double + IL_00a8: add + IL_00a9: ret + } // end of method TestFunction25::pinArray1 + + .method public static float64 pinArray2() cil managed + { + // Code size 148 (0x94) + .maxstack 6 + .locals init ([0] float64[] arr, + [1] native int p, + [2] float64& pinned V_2) + .line 22,22 : 5,49 '' + IL_0000: ldc.i4.6 + IL_0001: newarr [mscorlib]System.Double + IL_0006: dup + IL_0007: ldc.i4.0 + IL_0008: ldc.r8 0.0 + IL_0011: stelem [mscorlib]System.Double + IL_0016: dup + IL_0017: ldc.i4.1 + IL_0018: ldc.r8 1.5 + IL_0021: stelem [mscorlib]System.Double + IL_0026: dup + IL_0027: ldc.i4.2 + IL_0028: ldc.r8 2.2999999999999998 + IL_0031: stelem [mscorlib]System.Double + IL_0036: dup + IL_0037: ldc.i4.3 + IL_0038: ldc.r8 3.3999999999999999 + IL_0041: stelem [mscorlib]System.Double + IL_0046: dup + IL_0047: ldc.i4.4 + IL_0048: ldc.r8 4. + IL_0051: stelem [mscorlib]System.Double + IL_0056: dup + IL_0057: ldc.i4.5 + IL_0058: ldc.r8 5.9000000000000004 + IL_0061: stelem [mscorlib]System.Double + IL_0066: stloc.0 + .line 24,24 : 5,27 '' + IL_0067: ldloc.0 + IL_0068: ldc.i4.0 + IL_0069: ldelema [mscorlib]System.Double + IL_006e: stloc.2 + IL_006f: ldloc.2 + IL_0070: conv.i + IL_0071: stloc.1 + .line 25,25 : 5,42 '' + IL_0072: ldloc.1 + IL_0073: ldc.i4.0 + IL_0074: conv.i + IL_0075: sizeof [mscorlib]System.Double + IL_007b: mul + IL_007c: add + IL_007d: ldobj [mscorlib]System.Double + IL_0082: ldloc.1 + IL_0083: ldc.i4.1 + IL_0084: conv.i + IL_0085: sizeof [mscorlib]System.Double + IL_008b: mul + IL_008c: add + IL_008d: ldobj [mscorlib]System.Double + IL_0092: add + IL_0093: ret + } // end of method TestFunction25::pinArray2 + + .method public static class [mscorlib]System.Tuple`2 + pinString() cil managed + { + // Code size 57 (0x39) + .maxstack 6 + .locals init ([0] native int pChar, + [1] string pinned V_1) + .line 30,30 : 5,26 '' + IL_0000: ldstr "Hello World" + IL_0005: stloc.1 + IL_0006: ldstr "Hello World" + IL_000b: conv.i + IL_000c: call int32 [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::get_OffsetToStringData() + IL_0011: add + IL_0012: stloc.0 + .line 31,31 : 5,50 '' + IL_0013: ldloc.0 + IL_0014: ldc.i4.0 + IL_0015: conv.i + IL_0016: sizeof [mscorlib]System.Char + IL_001c: mul + IL_001d: add + IL_001e: ldobj [mscorlib]System.Char + IL_0023: ldloc.0 + IL_0024: ldc.i4.1 + IL_0025: conv.i + IL_0026: sizeof [mscorlib]System.Char + IL_002c: mul + IL_002d: add + IL_002e: ldobj [mscorlib]System.Char + IL_0033: newobj instance void class [mscorlib]System.Tuple`2::.ctor(!0, + !1) + IL_0038: ret + } // end of method TestFunction25::pinString + +} // end of class TestFunction25 + +.class private abstract auto ansi sealed ''.$TestFunction25 + extends [mscorlib]System.Object +{ + .method public static void main@() cil managed + { + .entrypoint + // Code size 1 (0x1) + .maxstack 8 + IL_0000: ret + } // end of method $TestFunction25::main@ + +} // end of class ''.$TestFunction25 + + +// ============================================================= + +// *********** DISASSEMBLY COMPLETE *********************** diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/env.lst b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/env.lst index 6278df20bb0..e70c0627d87 100644 --- a/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/env.lst +++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/TestFunctions/env.lst @@ -44,3 +44,4 @@ SOURCE=Testfunction22h.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd TestFunction22h.exe" # TestFunction22h.fs - SOURCE=TestFunction24.fs SCFLAGS="-g --optimize-" PEVER=/Exp_Fail COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd TestFunction24.exe" # TestFunction24.fs - + SOURCE=TestFunction25.fs SCFLAGS="-g --optimize+" PEVER=/Exp_Fail COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd TestFunction25.exe" # TestFunction25.fs - diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/Tuples/OptionalArg01.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/Tuples/OptionalArg01.il.bsl index 92b9f88d01f..01eb586a73f 100644 --- a/tests/fsharpqa/Source/CodeGen/EmittedIL/Tuples/OptionalArg01.il.bsl +++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/Tuples/OptionalArg01.il.bsl @@ -36,13 +36,13 @@ // Offset: 0x00000460 Length: 0x00000445 } .module OptionalArg01.exe -// MVID: {60B68B97-4F48-B5AF-A745-0383978BB660} +// MVID: {60D46F2D-4F48-B5AF-A745-03832D6FD460} .imagebase 0x00400000 .file alignment 0x00000200 .stackreserve 0x00100000 .subsystem 0x0003 // WINDOWS_CUI .corflags 0x00000001 // ILONLY -// Image base: 0x05C20000 +// Image base: 0x06C40000 // =============== CLASS MEMBERS DECLARATION =================== @@ -205,7 +205,7 @@ { // Code size 7 (0x7) .maxstack 8 - .line 19,19 : 5,11 '' + .line 10,10 : 23,44 '' IL_0000: ldc.i4.0 IL_0001: newobj instance void class [mscorlib]System.Collections.Generic.List`1::.ctor(int32) IL_0006: ret @@ -216,17 +216,20 @@ { // Code size 22 (0x16) .maxstack 4 - .locals init ([0] class OptionalArg01/A V_0, - [1] class [mscorlib]System.Collections.Generic.List`1 V_1) + .locals init ([0] class OptionalArg01/A v1, + [1] class [mscorlib]System.Collections.Generic.List`1 attribs) .line 27,27 : 5,17 '' IL_0000: newobj instance void OptionalArg01/A::.ctor() IL_0005: stloc.0 + .line 10,10 : 9,44 '' IL_0006: ldc.i4.1 IL_0007: newobj instance void class [mscorlib]System.Collections.Generic.List`1::.ctor(int32) IL_000c: stloc.1 + .line 11,11 : 47,62 '' IL_000d: ldloc.1 IL_000e: ldloc.0 IL_000f: callvirt instance void class [mscorlib]System.Collections.Generic.List`1::Add(!0) + .line 13,13 : 9,16 '' IL_0014: ldloc.1 IL_0015: ret } // end of method OptionalArg01::test2 @@ -236,17 +239,20 @@ { // Code size 22 (0x16) .maxstack 4 - .locals init ([0] class OptionalArg01/A V_0, - [1] class [mscorlib]System.Collections.Generic.List`1 V_1) + .locals init ([0] class OptionalArg01/A v2, + [1] class [mscorlib]System.Collections.Generic.List`1 attribs) .line 35,35 : 5,17 '' IL_0000: newobj instance void OptionalArg01/A::.ctor() IL_0005: stloc.0 + .line 10,10 : 9,44 '' IL_0006: ldc.i4.1 IL_0007: newobj instance void class [mscorlib]System.Collections.Generic.List`1::.ctor(int32) IL_000c: stloc.1 + .line 12,12 : 47,62 '' IL_000d: ldloc.1 IL_000e: ldloc.0 IL_000f: callvirt instance void class [mscorlib]System.Collections.Generic.List`1::Add(!0) + .line 13,13 : 9,16 '' IL_0014: ldloc.1 IL_0015: ret } // end of method OptionalArg01::test3 @@ -256,23 +262,27 @@ { // Code size 35 (0x23) .maxstack 4 - .locals init ([0] class OptionalArg01/A V_0, - [1] class OptionalArg01/A V_1, - [2] class [mscorlib]System.Collections.Generic.List`1 V_2) + .locals init ([0] class OptionalArg01/A v1, + [1] class OptionalArg01/A v2, + [2] class [mscorlib]System.Collections.Generic.List`1 attribs) .line 45,45 : 5,25 '' IL_0000: newobj instance void OptionalArg01/A::.ctor() IL_0005: stloc.0 IL_0006: newobj instance void OptionalArg01/A::.ctor() IL_000b: stloc.1 + .line 10,10 : 9,44 '' IL_000c: ldc.i4.2 IL_000d: newobj instance void class [mscorlib]System.Collections.Generic.List`1::.ctor(int32) IL_0012: stloc.2 + .line 11,11 : 47,62 '' IL_0013: ldloc.2 IL_0014: ldloc.0 IL_0015: callvirt instance void class [mscorlib]System.Collections.Generic.List`1::Add(!0) + .line 12,12 : 47,62 '' IL_001a: ldloc.2 IL_001b: ldloc.1 IL_001c: callvirt instance void class [mscorlib]System.Collections.Generic.List`1::Add(!0) + .line 13,13 : 9,16 '' IL_0021: ldloc.2 IL_0022: ret } // end of method OptionalArg01::test4 diff --git a/tests/fsharpqa/Source/CodeGen/EmittedIL/Tuples/TupleElimination.il.bsl b/tests/fsharpqa/Source/CodeGen/EmittedIL/Tuples/TupleElimination.il.bsl index c7180964946..ba2f7ee8e8e 100644 --- a/tests/fsharpqa/Source/CodeGen/EmittedIL/Tuples/TupleElimination.il.bsl +++ b/tests/fsharpqa/Source/CodeGen/EmittedIL/Tuples/TupleElimination.il.bsl @@ -41,13 +41,13 @@ // Offset: 0x00000230 Length: 0x0000007B } .module TupleElimination.exe -// MVID: {60CB69C6-DFDD-92DF-A745-0383C669CB60} +// MVID: {60D46F2D-DFDD-92DF-A745-03832D6FD460} .imagebase 0x00400000 .file alignment 0x00000200 .stackreserve 0x00100000 .subsystem 0x0003 // WINDOWS_CUI .corflags 0x00000001 // ILONLY -// Image base: 0x06AF0000 +// Image base: 0x06A70000 // =============== CLASS MEMBERS DECLARATION =================== @@ -98,11 +98,11 @@ IL_000a: callvirt instance bool class [mscorlib]System.Collections.Generic.Dictionary`2::TryGetValue(!0, !1&) IL_000f: stloc.2 - .line 10,10 : 5,6 '' + .line 10,10 : 5,8 '' IL_0010: ldloc.2 IL_0011: call void TupleElimination::p@5(!!0) IL_0016: nop - .line 11,11 : 5,6 '' + .line 11,11 : 5,8 '' IL_0017: ldloc.1 IL_0018: call void TupleElimination::p@5(!!0) IL_001d: nop @@ -118,15 +118,15 @@ IL_002f: newobj instance void class [mscorlib]System.Tuple`2::.ctor(!0, !1) IL_0034: stloc.s t - .line 15,15 : 5,6 '' + .line 15,15 : 5,8 '' IL_0036: ldloc.s V_4 IL_0038: call void TupleElimination::p@5(!!0) IL_003d: nop - .line 16,16 : 5,6 '' + .line 16,16 : 5,8 '' IL_003e: ldloc.3 IL_003f: call void TupleElimination::p@5(!!0) IL_0044: nop - .line 21,21 : 5,6 '' + .line 21,21 : 5,9 '' IL_0045: ldloc.s t IL_0047: call void TupleElimination::p@5>(!!0) IL_004c: nop diff --git a/tests/fsharpqa/Source/Optimizations/CompareIL.cmd b/tests/fsharpqa/Source/Optimizations/CompareIL.cmd index 3c34a493298..ca278788982 100644 --- a/tests/fsharpqa/Source/Optimizations/CompareIL.cmd +++ b/tests/fsharpqa/Source/Optimizations/CompareIL.cmd @@ -1,15 +1,17 @@ REM == %1 --> assembly ildasm /TEXT /LINENUM /NOBAR "%~nx1" >"%~n1.il" -IF NOT ERRORLEVEL 0 exit 1 +IF %ERRORLEVEL% NEQ 0 exit /b 1 echo ..\..\..\testenv\bin\ILComparer.exe "%~n1.il.bsl" "%~n1.il" ..\..\..\testenv\bin\ILComparer.exe "%~n1.il.bsl" "%~n1.il" +IF %ERRORLEVEL% EQU 0 exit /b 0 + if /i "%TEST_UPDATE_BSL%" == "1" ( echo copy /y "%~n1.il" "%~n1.il.bsl" copy /y "%~n1.il" "%~n1.il.bsl" ) -exit /b %ERRORLEVEL% +exit /b 1 diff --git a/tests/walkthroughs/DebugStepping/TheBigFileOfDebugStepping.fsx b/tests/walkthroughs/DebugStepping/TheBigFileOfDebugStepping.fsx index b5dcc2d6f0b..6dcce384f1f 100644 --- a/tests/walkthroughs/DebugStepping/TheBigFileOfDebugStepping.fsx +++ b/tests/walkthroughs/DebugStepping/TheBigFileOfDebugStepping.fsx @@ -626,6 +626,65 @@ let LocalValueShadowsArgument2 x = null // breakpoint 2 () +module InlinedCode = + // MANUAL TEST: check you can place breakpoints in this method and hit them + // in both Debug and Release code + let inline bodyRunner z body = + let x = 1 + z + printfn "running" + body x + body x + + let test() = + let bodyWrapper = + let x = 1 + System.Random().Next() + bodyRunner 3 (fun n -> + // MANUAL TEST: check you can place breakpoint here and hit it in both Debug and Release code + printfn "line1, x = %d" x + // MANUAL TEST: check you can place breakpoint here and hit it in both Debug and Release code + printfn "line2, n = %d" n) + + let bodyWrapper2 = + // TEST: check you can place breakpoint here and hit it in both Debug and Release code + let x = 1 + System.Random().Next() + bodyRunner 3 <| (fun n -> + // MANUAL TEST: check you can place breakpoint here and hit it in both Debug and Release code + printfn "line1, x = %d" x + // MANUAL TEST: check you can place breakpoint here and hit it in both Debug and Release code + printfn "line2, n = %d" n) + () + +module Pipelined = + let testListPipeline() = + let data = [ 1 .. 5 ] + + // MANUAL TEST: check stepping through this looks ok + let newData = + data + |> List.filter (fun x -> + // MANUAL TEST: check you can place breakpoint here and hit it in both Debug and Release code + x > 3) + |> List.map (fun x -> + // MANUAL TEST: check you can place breakpoint here and hit it in both Debug and Release code + x * x) + + printfn "%A" newData + + let testArrayPipeline() = + let data = [| 1 .. 5 |] + + let newData = + data + |> Array.filter (fun x -> + // MANUAL TEST: check you can place breakpoint here and hit it in both Debug and Release code + x > 3) + |> Array.map (fun x -> + // MANUAL TEST: check you can place breakpoint here and hit it in both Debug code + // TODO: surprisingly no breakpoint hit here in release code + x * x) + + printfn "%A" newData + TailcallRecursionTest1 3 TailcallRecursionTest2 (U2(3,4)) SteppingMatch01 (Choice1Of2 3) @@ -705,3 +764,6 @@ InnerFunctionDefinitionHadTwoBreakpoints "aaaa" |> ignore InnerRecursiveFunctionDefinitionHadTwoBreakpoints "aaaa" |> ignore LocalValueShadowsArgument1 "123" LocalValueShadowsArgument2 "123" +InlinedCode.test() +Pipelined.testListPipeline() +Pipelined.testArrayPipeline() From a85aac5421d8f07f4c2bd05878f3bf6fd8c24c88 Mon Sep 17 00:00:00 2001 From: Will Smith Date: Fri, 2 Jul 2021 09:42:23 -0700 Subject: [PATCH 38/42] Add internal `block` type for use in the compiler. `IncrementalBuilder` only maintains two states (#11750) * Added IncrementalBuilderInitialState * More changes * Added internal 'block' type for use in the compiler. Lifting functions out of IncrementalBuilder * using block * Block feedback * Use IsEmpty --- .../FSharp.Compiler.Service.fsproj | 6 + src/fsharp/block.fs | 187 +++++++++++ src/fsharp/block.fsi | 63 ++++ src/fsharp/lib.fs | 1 + src/fsharp/service/IncrementalBuild.fs | 308 +++++++++++------- tests/FSharp.Compiler.UnitTests/BlockTests.fs | 58 ++++ .../FSharp.Compiler.UnitTests.fsproj | 1 + 7 files changed, 502 insertions(+), 122 deletions(-) create mode 100644 src/fsharp/block.fs create mode 100644 src/fsharp/block.fsi create mode 100644 tests/FSharp.Compiler.UnitTests/BlockTests.fs diff --git a/src/fsharp/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj b/src/fsharp/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj index 996bdaca789..ff2d0cd0770 100644 --- a/src/fsharp/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj +++ b/src/fsharp/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj @@ -190,6 +190,12 @@ Utilities\lib.fs + + Utilities\block.fsi + + + Utilities\block.fs + Utilities\rational.fsi diff --git a/src/fsharp/block.fs b/src/fsharp/block.fs new file mode 100644 index 00000000000..ca74049032f --- /dev/null +++ b/src/fsharp/block.fs @@ -0,0 +1,187 @@ +module Internal.Utilities.Library.Block + +open System.Collections.Immutable + +type block<'T> = ImmutableArray<'T> +type blockbuilder<'T> = ImmutableArray<'T>.Builder + +[] +module BlockBuilder = + + let create size : blockbuilder<'T> = + ImmutableArray.CreateBuilder(size) + +[] +module Block = + + [] + let empty<'T> = ImmutableArray<'T>.Empty + + let init n (f: int -> 'T) : block<_> = + match n with + | 0 -> ImmutableArray.Empty + | 1 -> ImmutableArray.Create(f 0) + | n -> + if n < 0 then + invalidArg "n" "Below zero." + + let builder = ImmutableArray.CreateBuilder(n) + for i = 0 to n - 1 do + builder.Add(f i) + builder.MoveToImmutable() + + let iter f (arr: block<'T>) = + for i = 0 to arr.Length - 1 do + f arr.[i] + + let iteri f (arr: block<'T>) = + for i = 0 to arr.Length - 1 do + f i arr.[i] + + let iter2 f (arr1: block<'T1>) (arr2: block<'T2>) = + if arr1.Length <> arr2.Length then + invalidOp "Block lengths do not match." + + for i = 0 to arr1.Length - 1 do + f arr1.[i] arr2.[i] + + let iteri2 f (arr1: block<'T1>) (arr2: block<'T2>) = + if arr1.Length <> arr2.Length then + invalidOp "Block lengths do not match." + + for i = 0 to arr1.Length - 1 do + f i arr1.[i] arr2.[i] + + let map (mapper: 'T -> 'U) (arr: block<'T>) : block<_> = + match arr.Length with + | 0 -> ImmutableArray.Empty + | 1 -> ImmutableArray.Create(mapper arr.[0]) + | _ -> + let builder = ImmutableArray.CreateBuilder(arr.Length) + for i = 0 to arr.Length - 1 do + builder.Add(mapper arr.[i]) + builder.MoveToImmutable() + + let mapi (mapper: int -> 'T -> 'U) (arr: block<'T>) : block<_> = + match arr.Length with + | 0 -> ImmutableArray.Empty + | 1 -> ImmutableArray.Create(mapper 0 arr.[0]) + | _ -> + let builder = ImmutableArray.CreateBuilder(arr.Length) + for i = 0 to arr.Length - 1 do + builder.Add(mapper i arr.[i]) + builder.MoveToImmutable() + + let map2 (mapper: 'T1 -> 'T2 -> 'T) (arr1: block<'T1>) (arr2: block<'T2>) : block<_> = + if arr1.Length <> arr2.Length then + invalidOp "Block lengths do not match." + + match arr1.Length with + | 0 -> ImmutableArray.Empty + | 1 -> ImmutableArray.Create(mapper arr1.[0] arr2.[0]) + | n -> + let builder = ImmutableArray.CreateBuilder(n) + for i = 0 to n - 1 do + builder.Add(mapper arr1.[i] arr2.[i]) + builder.MoveToImmutable() + + let mapi2 (mapper: int -> 'T1 -> 'T2 -> 'T) (arr1: block<'T1>) (arr2: block<'T2>) : block<_> = + if arr1.Length <> arr2.Length then + invalidOp "Block lengths do not match." + + match arr1.Length with + | 0 -> ImmutableArray.Empty + | 1 -> ImmutableArray.Create(mapper 0 arr1.[0] arr2.[0]) + | n -> + let builder = ImmutableArray.CreateBuilder(n) + for i = 0 to n - 1 do + builder.Add(mapper i arr1.[i] arr2.[i]) + builder.MoveToImmutable() + + let concat (arrs: block>) : block<'T> = + match arrs.Length with + | 0 -> ImmutableArray.Empty + | 1 -> arrs.[0] + | 2 -> arrs.[0].AddRange(arrs.[1]) + | _ -> + let mutable acc = 0 + for h in arrs do + acc <- acc + h.Length + + let builder = ImmutableArray.CreateBuilder(acc) + for i = 0 to arrs.Length - 1 do + builder.AddRange(arrs.[i]) + builder.MoveToImmutable() + + let forall predicate (arr: block<'T>) = + let len = arr.Length + let rec loop i = i >= len || (predicate arr.[i] && loop (i+1)) + loop 0 + + let forall2 predicate (arr1: block<'T1>) (arr2: block<'T2>) = + if arr1.Length <> arr2.Length then + invalidOp "Block lengths do not match." + + let f = OptimizedClosures.FSharpFunc<_, _, _>.Adapt(predicate) + let len1 = arr1.Length + let rec loop i = i >= len1 || (f.Invoke(arr1.[i], arr2.[i]) && loop (i+1)) + loop 0 + + let tryFind predicate (arr: block<'T>) = + let rec loop i = + if i >= arr.Length then None else + if predicate arr.[i] then Some arr.[i] else loop (i+1) + loop 0 + + let tryFindIndex predicate (arr: block<'T>) = + let len = arr.Length + let rec go n = if n >= len then None elif predicate arr.[n] then Some n else go (n+1) + go 0 + + let tryPick chooser (arr: block<'T>) = + let rec loop i = + if i >= arr.Length then None else + match chooser arr.[i] with + | None -> loop(i+1) + | res -> res + loop 0 + + let ofSeq (xs: 'T seq) = + ImmutableArray.CreateRange(xs) + + let append (arr1: block<'T1>) (arr2: block<'T1>) : block<_> = + arr1.AddRange(arr2) + + let createOne (item: 'T) : block<_> = + ImmutableArray.Create(item) + + let filter predicate (arr: block<'T>) : block<'T> = + let builder = ImmutableArray.CreateBuilder(arr.Length) + for i = 0 to arr.Length - 1 do + if predicate arr.[i] then + builder.Add(arr.[i]) + builder.Capacity <- builder.Count + builder.MoveToImmutable() + + let exists predicate (arr: block<'T>) = + let len = arr.Length + let rec loop i = i < len && (predicate arr.[i] || loop (i+1)) + len > 0 && loop 0 + + let choose (chooser: 'T -> 'U option) (arr: block<'T>) : block<'U> = + let builder = ImmutableArray.CreateBuilder(arr.Length) + for i = 0 to arr.Length - 1 do + let result = chooser arr.[i] + if result.IsSome then + builder.Add(result.Value) + builder.Capacity <- builder.Count + builder.MoveToImmutable() + + let isEmpty (arr: block<_>) = arr.IsEmpty + + let fold folder state (arr: block<_>) = + let f = OptimizedClosures.FSharpFunc<_, _, _>.Adapt(folder) + let mutable state = state + for i = 0 to arr.Length - 1 do + state <- f.Invoke(state, arr.[i]) + state diff --git a/src/fsharp/block.fsi b/src/fsharp/block.fsi new file mode 100644 index 00000000000..ec7ef7fa5a0 --- /dev/null +++ b/src/fsharp/block.fsi @@ -0,0 +1,63 @@ +[] +module internal Internal.Utilities.Library.Block + +open System.Collections.Immutable + +/// Type alias for System.Collections.Immutable.ImmutableArray<'T> +type block<'T> = ImmutableArray<'T> + +/// Type alias for System.Collections.Immutable.ImmutableArray<'T>.Builder +type blockbuilder<'T> = ImmutableArray<'T>.Builder + +[] +module BlockBuilder = + + val create : size: int -> blockbuilder<'T> + +[] +module Block = + + [] + val empty<'T> : block<'T> + + val init : n: int -> f: (int -> 'T) -> block<'T> + + val iter : f: ('T -> unit) -> block<'T> -> unit + + val iteri : f: (int -> 'T -> unit) -> block<'T> -> unit + + val iter2 : f: ('T1 -> 'T2 -> unit) -> block<'T1> -> block<'T2> -> unit + + val iteri2 : f: (int -> 'T1 -> 'T2 -> unit) -> block<'T1> -> block<'T2> -> unit + + val map : mapper: ('T1 -> 'T2) -> block<'T1> -> block<'T2> + + val mapi : mapper: (int -> 'T1 -> 'T2) -> block<'T1> -> block<'T2> + + val concat : block> -> block<'T> + + val forall : predicate: ('T -> bool) -> block<'T> -> bool + + val forall2 : predicate: ('T1 -> 'T2 -> bool) -> block<'T1> -> block<'T2> -> bool + + val tryFind : predicate: ('T -> bool) -> block<'T> -> 'T option + + val tryFindIndex : predicate: ('T -> bool) -> block<'T> -> int option + + val tryPick : chooser: ('T1 -> 'T2 option) -> block<'T1> -> 'T2 option + + val ofSeq : seq<'T> -> block<'T> + + val append : block<'T> -> block<'T> -> block<'T> + + val createOne : 'T -> block<'T> + + val filter : predicate: ('T -> bool) -> block<'T> -> block<'T> + + val exists : predicate: ('T -> bool) -> block<'T> -> bool + + val choose : chooser: ('T -> 'U option) -> block<'T> -> block<'U> + + val isEmpty : block<'T> -> bool + + val fold : folder: ('State -> 'T -> 'State) -> 'State -> block<'T> -> 'State \ No newline at end of file diff --git a/src/fsharp/lib.fs b/src/fsharp/lib.fs index 07ba0f0f91f..ef4785546b3 100755 --- a/src/fsharp/lib.fs +++ b/src/fsharp/lib.fs @@ -604,3 +604,4 @@ module ArrayParallel = let inline map f (arr: 'T []) = arr |> mapi (fun _ item -> f item) + \ No newline at end of file diff --git a/src/fsharp/service/IncrementalBuild.fs b/src/fsharp/service/IncrementalBuild.fs index 828c553e4e9..f4267b9d5e6 100644 --- a/src/fsharp/service/IncrementalBuild.fs +++ b/src/fsharp/service/IncrementalBuild.fs @@ -701,48 +701,8 @@ type RawFSharpAssemblyDataBackedByLanguageService (tcConfig, tcGlobals, generate member _.HasAnyFSharpSignatureDataAttribute = true member _.HasMatchingFSharpSignatureDataAttribute = true -type IncrementalBuilderState = - { - // stampedFileNames represent the real stamps of the files. - // logicalStampedFileNames represent the stamps of the files that are used to calculate the project's logical timestamp. - stampedFileNames: ImmutableArray - logicalStampedFileNames: ImmutableArray - stampedReferencedAssemblies: ImmutableArray - initialBoundModel: GraphNode - boundModels: ImmutableArray> - finalizedBoundModel: GraphNode<((ILAssemblyRef * IRawFSharpAssemblyData option * TypedImplFile list option * BoundModel) * DateTime)> - } - -/// Manages an incremental build graph for the build of a single F# project -type IncrementalBuilder( - initialBoundModel: BoundModel, - tcGlobals, - nonFrameworkAssemblyInputs, - tcConfig: TcConfig, - outfile, - assemblyName, - lexResourceManager, - sourceFiles, - enablePartialTypeChecking, - beforeFileChecked: Event, - fileChecked: Event, -#if !NO_EXTENSIONTYPING - importsInvalidatedByTypeProvider: Event, -#endif - allDependencies, - defaultTimeStamp: DateTime) = - - let fileParsed = new Event() - let projectChecked = new Event() - - let mutable isImportsInvalidated = false - -#if !NO_EXTENSIONTYPING - do importsInvalidatedByTypeProvider.Publish.Add(fun () -> isImportsInvalidated <- true) -#endif - - //---------------------------------------------------- - // START OF BUILD TASK FUNCTIONS +[] +module IncrementalBuilderHelpers = /// Get the timestamp of the given file name. let StampFileNameTask (cache: TimeStampCache) (_m: range, filename: string, _isLastCompiland) = @@ -753,7 +713,7 @@ type IncrementalBuilder( timeStamper cache // Link all the assemblies together and produce the input typecheck accumulator - static let CombineImportedAssembliesTask ( + let CombineImportedAssembliesTask ( assemblyName, tcConfig: TcConfig, tcConfigP, @@ -865,14 +825,14 @@ type IncrementalBuilder( } /// Finish up the typechecking to produce outputs for the rest of the compilation process - let FinalizeTypeCheckTask (boundModels: ImmutableArray) = + let FinalizeTypeCheckTask (tcConfig: TcConfig) tcGlobals enablePartialTypeChecking assemblyName outfile (boundModels: block) = node { let errorLogger = CompilationErrorLogger("FinalizeTypeCheckTask", tcConfig.errorSeverityOptions) use _ = new CompilationGlobalsScope(errorLogger, BuildPhase.TypeCheck) let! results = boundModels - |> Seq.map (fun boundModel -> node { + |> Block.map (fun boundModel -> node { if enablePartialTypeChecking then let! tcInfo = boundModel.GetOrComputeTcInfo() return tcInfo, None @@ -880,7 +840,7 @@ type IncrementalBuilder( let! tcInfo, tcInfoExtras = boundModel.GetOrComputeTcInfoWithExtras() return tcInfo, tcInfoExtras.latestImplFile }) - |> Seq.map (fun work -> + |> Block.map (fun work -> node { let! tcInfo, latestImplFile = work return (tcInfo.tcEnvAtEndOfFile, defaultArg tcInfo.topAttribs EmptyTopAttrs, latestImplFile, tcInfo.latestCcuSigForFile) @@ -953,53 +913,134 @@ type IncrementalBuilder( return ilAssemRef, tcAssemblyDataOpt, tcAssemblyExprOpt, finalBoundModelWithErrors } - // END OF BUILD TASK FUNCTIONS - // --------------------------------------------------------------------------------------------- + let GetSyntaxTree tcConfig fileParsed lexResourceManager (sourceRange: range, filename: string, isLastCompiland) = + SyntaxTree(tcConfig, fileParsed, lexResourceManager, sourceRange, filename, isLastCompiland) - // --------------------------------------------------------------------------------------------- - // START OF BUILD DESCRIPTION +[] +type IncrementalBuilderInitialState = + { + initialBoundModel: BoundModel + tcGlobals: TcGlobals + referencedAssemblies: block<(Choice * (TimeStampCache -> DateTime))> + tcConfig: TcConfig + outfile: string + assemblyName: string + lexResourceManager: Lexhelp.LexResourceManager + fileNames: block<(range * string * (bool * bool))> + enablePartialTypeChecking: bool + beforeFileChecked: Event + fileChecked: Event + fileParsed: Event + projectChecked: Event +#if !NO_EXTENSIONTYPING + importsInvalidatedByTypeProvider: Event +#endif + allDependencies: string [] + defaultTimeStamp: DateTime + mutable isImportsInvalidated: bool + } - let GetSyntaxTree (sourceRange: range, filename: string, isLastCompiland) = - SyntaxTree(tcConfig, fileParsed, lexResourceManager, sourceRange, filename, isLastCompiland) + static member Create( + initialBoundModel: BoundModel, + tcGlobals, + nonFrameworkAssemblyInputs, + tcConfig: TcConfig, + outfile, + assemblyName, + lexResourceManager, + sourceFiles, + enablePartialTypeChecking, + beforeFileChecked: Event, + fileChecked: Event, +#if !NO_EXTENSIONTYPING + importsInvalidatedByTypeProvider: Event, +#endif + allDependencies, + defaultTimeStamp: DateTime) = + + let initialState = + { + initialBoundModel = initialBoundModel + tcGlobals = tcGlobals + referencedAssemblies = nonFrameworkAssemblyInputs |> Block.ofSeq + tcConfig = tcConfig + outfile = outfile + assemblyName = assemblyName + lexResourceManager = lexResourceManager + fileNames = sourceFiles |> Block.ofSeq + enablePartialTypeChecking = enablePartialTypeChecking + beforeFileChecked = beforeFileChecked + fileChecked = fileChecked + fileParsed = Event() + projectChecked = Event() +#if !NO_EXTENSIONTYPING + importsInvalidatedByTypeProvider = importsInvalidatedByTypeProvider +#endif + allDependencies = allDependencies + defaultTimeStamp = defaultTimeStamp + isImportsInvalidated = false + } +#if !NO_EXTENSIONTYPING + importsInvalidatedByTypeProvider.Publish.Add(fun () -> initialState.isImportsInvalidated <- true) +#endif + initialState - // Inputs - let fileNames = sourceFiles |> Array.ofList // TODO: This should be an immutable array. - let referencedAssemblies = nonFrameworkAssemblyInputs |> Array.ofList // TODO: This should be an immutable array. +[] +type IncrementalBuilderState = + { + // stampedFileNames represent the real stamps of the files. + // logicalStampedFileNames represent the stamps of the files that are used to calculate the project's logical timestamp. + stampedFileNames: block + logicalStampedFileNames: block + stampedReferencedAssemblies: block + initialBoundModel: GraphNode + boundModels: block> + finalizedBoundModel: GraphNode<((ILAssemblyRef * IRawFSharpAssemblyData option * TypedImplFile list option * BoundModel) * DateTime)> + } + +[] +module IncrementalBuilderStateHelpers = - let createBoundModelGraphNode initialBoundModel (boundModels: ImmutableArray>.Builder) i = - let fileInfo = fileNames.[i] + let createBoundModelGraphNode (initialState: IncrementalBuilderInitialState) initialBoundModel (boundModels: blockbuilder>) i = + let fileInfo = initialState.fileNames.[i] let prevBoundModelGraphNode = match i with | 0 (* first file *) -> initialBoundModel | _ -> boundModels.[i - 1] - let syntaxTree = GetSyntaxTree fileInfo + let syntaxTree = GetSyntaxTree initialState.tcConfig initialState.fileParsed initialState.lexResourceManager fileInfo GraphNode(node { let! prevBoundModel = prevBoundModelGraphNode.GetOrComputeValue() - return! TypeCheckTask enablePartialTypeChecking prevBoundModel syntaxTree + return! TypeCheckTask initialState.enablePartialTypeChecking prevBoundModel syntaxTree }) - let rec createFinalizeBoundModelGraphNode (boundModels: ImmutableArray>.Builder) = + let rec createFinalizeBoundModelGraphNode (initialState: IncrementalBuilderInitialState) (boundModels: blockbuilder>) = GraphNode(node { // Compute last bound model then get all the evaluated models. let! _ = boundModels.[boundModels.Count - 1].GetOrComputeValue() let boundModels = - boundModels - |> Seq.map (fun x -> x.TryPeekValue().Value) - |> ImmutableArray.CreateRange - - let! result = FinalizeTypeCheckTask boundModels + boundModels.ToImmutable() + |> Block.map (fun x -> x.TryPeekValue().Value) + + let! result = + FinalizeTypeCheckTask + initialState.tcConfig + initialState.tcGlobals + initialState.enablePartialTypeChecking + initialState.assemblyName + initialState.outfile + boundModels let result = (result, DateTime.UtcNow) return result }) - and computeStampedFileName (state: IncrementalBuilderState) (cache: TimeStampCache) slot fileInfo = + and computeStampedFileName (initialState: IncrementalBuilderInitialState) (state: IncrementalBuilderState) (cache: TimeStampCache) slot fileInfo = let currentStamp = state.stampedFileNames.[slot] let stamp = StampFileNameTask cache fileInfo if currentStamp <> stamp then match state.boundModels.[slot].TryPeekValue() with // This prevents an implementation file that has a backing signature file from invalidating the rest of the build. - | ValueSome(boundModel) when enablePartialTypeChecking && boundModel.BackingSignature.IsSome -> + | ValueSome(boundModel) when initialState.enablePartialTypeChecking && boundModel.BackingSignature.IsSome -> let newBoundModel = boundModel.ClearTcInfoExtras() { state with boundModels = state.boundModels.RemoveAt(slot).Insert(slot, GraphNode(node { return newBoundModel })) @@ -1013,14 +1054,14 @@ type IncrementalBuilder( // Invalidate the file and all files below it. for j = 0 to stampedFileNames.Count - slot - 1 do - let stamp = StampFileNameTask cache fileNames.[slot + j] + let stamp = StampFileNameTask cache initialState.fileNames.[slot + j] stampedFileNames.[slot + j] <- stamp logicalStampedFileNames.[slot + j] <- stamp - boundModels.[slot + j] <- createBoundModelGraphNode state.initialBoundModel boundModels (slot + j) + boundModels.[slot + j] <- createBoundModelGraphNode initialState state.initialBoundModel boundModels (slot + j) { state with // Something changed, the finalized view of the project must be invalidated. - finalizedBoundModel = createFinalizeBoundModelGraphNode boundModels + finalizedBoundModel = createFinalizeBoundModelGraphNode initialState boundModels stampedFileNames = stampedFileNames.ToImmutable() logicalStampedFileNames = logicalStampedFileNames.ToImmutable() @@ -1029,21 +1070,21 @@ type IncrementalBuilder( else state - and computeStampedFileNames state (cache: TimeStampCache) = + and computeStampedFileNames (initialState: IncrementalBuilderInitialState) state (cache: TimeStampCache) = let mutable i = 0 - (state, fileNames) - ||> Array.fold (fun state fileInfo -> - let newState = computeStampedFileName state cache i fileInfo + (state, initialState.fileNames) + ||> Block.fold (fun state fileInfo -> + let newState = computeStampedFileName initialState state cache i fileInfo i <- i + 1 newState ) - and computeStampedReferencedAssemblies state canTriggerInvalidation (cache: TimeStampCache) = + and computeStampedReferencedAssemblies (initialState: IncrementalBuilderInitialState) state canTriggerInvalidation (cache: TimeStampCache) = let stampedReferencedAssemblies = state.stampedReferencedAssemblies.ToBuilder() let mutable referencesUpdated = false - referencedAssemblies - |> Array.iteri (fun i asmInfo -> + initialState.referencedAssemblies + |> Block.iteri (fun i asmInfo -> let currentStamp = state.stampedReferencedAssemblies.[i] let stamp = StampReferencedAssemblyTask cache asmInfo @@ -1055,14 +1096,63 @@ type IncrementalBuilder( if referencesUpdated then // Build is invalidated. The build must be rebuilt with the newly updated references. - if not isImportsInvalidated && canTriggerInvalidation then - isImportsInvalidated <- true + if not initialState.isImportsInvalidated && canTriggerInvalidation then + initialState.isImportsInvalidated <- true { state with stampedReferencedAssemblies = stampedReferencedAssemblies.ToImmutable() } else state +type IncrementalBuilderState with + + (* + The data below represents a dependency graph. + + ReferencedAssembliesStamps => FileStamps => BoundModels => FinalizedBoundModel + *) + static member Create(initialState: IncrementalBuilderInitialState) = + let defaultTimeStamp = initialState.defaultTimeStamp + let initialBoundModel = initialState.initialBoundModel + let fileNames = initialState.fileNames + let referencedAssemblies = initialState.referencedAssemblies + + let cache = TimeStampCache(defaultTimeStamp) + let initialBoundModel = GraphNode(node { return initialBoundModel }) + let boundModels = BlockBuilder.create fileNames.Length + + for slot = 0 to fileNames.Length - 1 do + boundModels.Add(createBoundModelGraphNode initialState initialBoundModel boundModels slot) + + let state = + { + stampedFileNames = Block.init fileNames.Length (fun _ -> DateTime.MinValue) + logicalStampedFileNames = Block.init fileNames.Length (fun _ -> DateTime.MinValue) + stampedReferencedAssemblies = Block.init referencedAssemblies.Length (fun _ -> DateTime.MinValue) + initialBoundModel = initialBoundModel + boundModels = boundModels.ToImmutable() + finalizedBoundModel = createFinalizeBoundModelGraphNode initialState boundModels + } + let state = computeStampedReferencedAssemblies initialState state false cache + let state = computeStampedFileNames initialState state cache + state + +/// Manages an incremental build graph for the build of a single F# project +type IncrementalBuilder(initialState: IncrementalBuilderInitialState, state: IncrementalBuilderState) = + + let initialBoundModel = initialState.initialBoundModel + let tcConfig = initialState.tcConfig + let fileNames = initialState.fileNames + let beforeFileChecked = initialState.beforeFileChecked + let fileChecked = initialState.fileChecked +#if !NO_EXTENSIONTYPING + let importsInvalidatedByTypeProvider = initialState.importsInvalidatedByTypeProvider +#endif + let allDependencies = initialState.allDependencies + let defaultTimeStamp = initialState.defaultTimeStamp + let fileParsed = initialState.fileParsed + let projectChecked = initialState.projectChecked + let tryGetSlot (state: IncrementalBuilderState) slot = match state.boundModels.[slot].TryPeekValue() with | ValueSome boundModel -> @@ -1095,46 +1185,18 @@ type IncrementalBuilder( stamps |> Seq.max - // END OF BUILD DESCRIPTION - // --------------------------------------------------------------------------------------------- - - (* - The data below represents a dependency graph. - - ReferencedAssembliesStamps => FileStamps => BoundModels => FinalizedBoundModel - *) - - let gate = obj () - let mutable currentState = - let cache = TimeStampCache(defaultTimeStamp) - let initialBoundModel = GraphNode(node { return initialBoundModel }) - let boundModels = ImmutableArray.CreateBuilder(fileNames.Length) - - for slot = 0 to fileNames.Length - 1 do - boundModels.Add(createBoundModelGraphNode initialBoundModel boundModels slot) - - let state = - { - stampedFileNames = Array.init fileNames.Length (fun _ -> DateTime.MinValue) |> ImmutableArray.CreateRange - logicalStampedFileNames = Array.init fileNames.Length (fun _ -> DateTime.MinValue) |> ImmutableArray.CreateRange - stampedReferencedAssemblies = Array.init referencedAssemblies.Length (fun _ -> DateTime.MinValue) |> ImmutableArray.CreateRange - initialBoundModel = initialBoundModel - boundModels = boundModels.ToImmutable() - finalizedBoundModel = createFinalizeBoundModelGraphNode boundModels - } - let state = computeStampedReferencedAssemblies state false cache - let state = computeStampedFileNames state cache - state - let computeProjectTimeStamp (state: IncrementalBuilderState) = let t1 = MaxTimeStampInDependencies state.stampedReferencedAssemblies let t2 = MaxTimeStampInDependencies state.logicalStampedFileNames max t1 t2 + let gate = obj() + let mutable currentState = state + let setCurrentState state cache (ct: CancellationToken) = lock gate (fun () -> ct.ThrowIfCancellationRequested() - currentState <- computeStampedFileNames state cache + currentState <- computeStampedFileNames initialState state cache ) let checkFileTimeStamps (cache: TimeStampCache) = @@ -1161,10 +1223,10 @@ type IncrementalBuilder( member _.IsReferencesInvalidated = // fast path - if isImportsInvalidated then true + if initialState.isImportsInvalidated then true else - computeStampedReferencedAssemblies currentState true (TimeStampCache(defaultTimeStamp)) |> ignore - isImportsInvalidated + computeStampedReferencedAssemblies initialState currentState true (TimeStampCache(defaultTimeStamp)) |> ignore + initialState.isImportsInvalidated member _.AllDependenciesDeprecated = allDependencies @@ -1194,7 +1256,7 @@ type IncrementalBuilder( member builder.TryGetCheckResultsBeforeFileInProject (filename) = let cache = TimeStampCache defaultTimeStamp - let tmpState = computeStampedFileNames currentState cache + let tmpState = computeStampedFileNames initialState currentState cache let slotOfFile = builder.GetSlotOfFileName filename match tryGetBeforeSlot tmpState slotOfFile with @@ -1267,7 +1329,7 @@ type IncrementalBuilder( } member _.GetLogicalTimeStampForProject(cache) = - let tmpState = computeStampedFileNames currentState cache + let tmpState = computeStampedFileNames initialState currentState cache computeProjectTimeStamp tmpState member _.TryGetSlotOfFileName(filename: string) = @@ -1277,7 +1339,7 @@ type IncrementalBuilder( String.Compare(filename, f2, StringComparison.CurrentCultureIgnoreCase)=0 || String.Compare(FileSystem.GetFullPathShim filename, FileSystem.GetFullPathShim f2, StringComparison.CurrentCultureIgnoreCase)=0 result - match fileNames |> Array.tryFindIndex CompareFileNames with + match fileNames |> Block.tryFindIndex CompareFileNames with | Some slot -> Some slot | None -> None @@ -1295,10 +1357,10 @@ type IncrementalBuilder( let slotOfFile = builder.GetSlotOfFileName filename let fileInfo = fileNames.[slotOfFile] // re-parse on demand instead of retaining - let syntaxTree = GetSyntaxTree fileInfo + let syntaxTree = GetSyntaxTree initialState.tcConfig initialState.fileParsed initialState.lexResourceManager fileInfo syntaxTree.Parse None - member _.SourceFiles = sourceFiles |> List.map (fun (_, f, _) -> f) + member _.SourceFiles = fileNames |> Seq.map (fun (_, f, _) -> f) |> List.ofSeq /// CreateIncrementalBuilder (for background type checking). Note that fsc.fs also /// creates an incremental builder used by the command line compiler. @@ -1337,7 +1399,7 @@ type IncrementalBuilder( let tcConfigB, sourceFiles = let getSwitchValue switchString = - match commandLineArgs |> Seq.tryFindIndex(fun s -> s.StartsWithOrdinal switchString) with + match commandLineArgs |> List.tryFindIndex(fun s -> s.StartsWithOrdinal switchString) with | Some idx -> Some(commandLineArgs.[idx].Substring(switchString.Length)) | _ -> None @@ -1524,8 +1586,8 @@ type IncrementalBuilder( importsInvalidatedByTypeProvider ) - let builder = - new IncrementalBuilder( + let initialState = + IncrementalBuilderInitialState.Create( initialBoundModel, tcGlobals, nonFrameworkAssemblyInputs, @@ -1542,6 +1604,8 @@ type IncrementalBuilder( #endif allDependencies, defaultTimeStamp) + + let builder = IncrementalBuilder(initialState, IncrementalBuilderState.Create(initialState)) return Some builder with e -> errorRecoveryNoRange e diff --git a/tests/FSharp.Compiler.UnitTests/BlockTests.fs b/tests/FSharp.Compiler.UnitTests/BlockTests.fs new file mode 100644 index 00000000000..e4f4bdd29fd --- /dev/null +++ b/tests/FSharp.Compiler.UnitTests/BlockTests.fs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +namespace FSharp.Compiler.UnitTests + +open Xunit +open FSharp.Test.Utilities +open Internal.Utilities.Library + +module BlockTests = + + [] + let ``Iter should work correctly``() = + let b = Block.init 5 id + + let results = ResizeArray() + b + |> Block.iter (fun x -> + results.Add(x) + ) + + Assert.Equal( + [ + 0 + 1 + 2 + 3 + 4 + ], + results + ) + + [] + let ``Map should work correctly``() = + let b = Block.init 5 id + + let b2 = b |> Block.map (fun x -> x + 1) + + Assert.Equal( + [ + 1 + 2 + 3 + 4 + 5 + ], + b2 + ) + + [] + let ``Fold should work correctly``() = + let b = Block.init 5 id + + let result = + (0, b) + ||> Block.fold (fun state n -> + state + n + ) + + Assert.Equal(10, result) \ No newline at end of file diff --git a/tests/FSharp.Compiler.UnitTests/FSharp.Compiler.UnitTests.fsproj b/tests/FSharp.Compiler.UnitTests/FSharp.Compiler.UnitTests.fsproj index c3d3ca35aec..dda54a28a49 100644 --- a/tests/FSharp.Compiler.UnitTests/FSharp.Compiler.UnitTests.fsproj +++ b/tests/FSharp.Compiler.UnitTests/FSharp.Compiler.UnitTests.fsproj @@ -24,6 +24,7 @@ + From 1ed872e24c2c95b1a253b89999194131d7b17f9d Mon Sep 17 00:00:00 2001 From: dotnet bot Date: Fri, 2 Jul 2021 11:53:59 -0700 Subject: [PATCH 39/42] Localized file check-in by OneLocBuild Task (#11774) --- src/fsharp/xlf/FSComp.txt.de.xlf | 2 +- src/fsharp/xlf/FSComp.txt.ru.xlf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fsharp/xlf/FSComp.txt.de.xlf b/src/fsharp/xlf/FSComp.txt.de.xlf index 8a093810da2..94581794f64 100644 --- a/src/fsharp/xlf/FSComp.txt.de.xlf +++ b/src/fsharp/xlf/FSComp.txt.de.xlf @@ -94,7 +94,7 @@ attributes to the right of the 'module' keyword - attributes to the right of the 'module' keyword + Attribute rechts vom "Module"-Schlüsselwort diff --git a/src/fsharp/xlf/FSComp.txt.ru.xlf b/src/fsharp/xlf/FSComp.txt.ru.xlf index 7bc5ffe2994..fec0230513f 100644 --- a/src/fsharp/xlf/FSComp.txt.ru.xlf +++ b/src/fsharp/xlf/FSComp.txt.ru.xlf @@ -94,7 +94,7 @@ attributes to the right of the 'module' keyword - attributes to the right of the 'module' keyword + атрибуты справа от ключевого слова "module" From 6cb608f8ae667dc192bca1a629f42f529921b94a Mon Sep 17 00:00:00 2001 From: dotnet bot Date: Fri, 2 Jul 2021 11:54:14 -0700 Subject: [PATCH 40/42] Localized file check-in by OneLocBuild Task (#11773) From 5cfd7ff7c4c8de499cd7369b7352e6743d8a053c Mon Sep 17 00:00:00 2001 From: dotnet bot Date: Fri, 2 Jul 2021 11:55:07 -0700 Subject: [PATCH 41/42] Localized file check-in by OneLocBuild Task (#11768) From dfeb8a95d36f6a30eafd270122515be639877620 Mon Sep 17 00:00:00 2001 From: "Brett V. Forsgren" Date: Sat, 3 Jul 2021 11:17:37 -0600 Subject: [PATCH 42/42] apply source-build patches (#11762) --- .../0005-Fix-package-downgrade-warning.patch | 56 ------------------- .../Microsoft.FSharp.Compiler.nuspec | 4 +- src/fsharp/fsc/fsc.fsproj | 1 + 3 files changed, 3 insertions(+), 58 deletions(-) delete mode 100644 eng/source-build-patches/0005-Fix-package-downgrade-warning.patch diff --git a/eng/source-build-patches/0005-Fix-package-downgrade-warning.patch b/eng/source-build-patches/0005-Fix-package-downgrade-warning.patch deleted file mode 100644 index e13b98068f9..00000000000 --- a/eng/source-build-patches/0005-Fix-package-downgrade-warning.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 7f0d25bfaa9a38da2097c9420461232a08951165 Mon Sep 17 00:00:00 2001 -From: Chris Rummel -Date: Thu, 3 Sep 2020 19:02:07 -0500 -Subject: [PATCH 5/5] Fix package downgrade warning - ---- - .../FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj | 4 ++-- - .../Microsoft.FSharp.Compiler.nuspec | 4 ++-- - src/fsharp/fsc/fsc.fsproj | 1 + - 3 files changed, 7 insertions(+), 6 deletions(-) - -diff --git a/src/fsharp/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj b/src/fsharp/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj -index aced6e1b4..fcdacc30b 100644 ---- a/src/fsharp/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj -+++ b/src/fsharp/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj -@@ -770,8 +770,8 @@ - - - -- -- -+ -+ - - - -diff --git a/src/fsharp/Microsoft.FSharp.Compiler/Microsoft.FSharp.Compiler.nuspec b/src/fsharp/Microsoft.FSharp.Compiler/Microsoft.FSharp.Compiler.nuspec -index b96f90d2a..366488b47 100644 ---- a/src/fsharp/Microsoft.FSharp.Compiler/Microsoft.FSharp.Compiler.nuspec -+++ b/src/fsharp/Microsoft.FSharp.Compiler/Microsoft.FSharp.Compiler.nuspec -@@ -22,8 +22,8 @@ - - - -- -- -+ -+ - - - -diff --git a/src/fsharp/fsc/fsc.fsproj b/src/fsharp/fsc/fsc.fsproj -index 776cddc78..df16c1554 100644 ---- a/src/fsharp/fsc/fsc.fsproj -+++ b/src/fsharp/fsc/fsc.fsproj -@@ -45,6 +45,7 @@ - - - -+ - - - --- -2.18.0 - diff --git a/src/fsharp/Microsoft.FSharp.Compiler/Microsoft.FSharp.Compiler.nuspec b/src/fsharp/Microsoft.FSharp.Compiler/Microsoft.FSharp.Compiler.nuspec index 8f9f4824dd6..f4877b8258c 100644 --- a/src/fsharp/Microsoft.FSharp.Compiler/Microsoft.FSharp.Compiler.nuspec +++ b/src/fsharp/Microsoft.FSharp.Compiler/Microsoft.FSharp.Compiler.nuspec @@ -22,8 +22,8 @@ - - + + diff --git a/src/fsharp/fsc/fsc.fsproj b/src/fsharp/fsc/fsc.fsproj index 211415f64e1..7fa31fc2151 100644 --- a/src/fsharp/fsc/fsc.fsproj +++ b/src/fsharp/fsc/fsc.fsproj @@ -41,6 +41,7 @@ +