diff --git a/.gitignore b/.gitignore index 6162593d1e9..b8bd4c07359 100644 --- a/.gitignore +++ b/.gitignore @@ -100,7 +100,9 @@ ossreadme*.txt *.log *.jrs *.chk -*.bak +*.bak +*.vserr +*.err *.orig *.mdf *.ldf diff --git a/DEVGUIDE.md b/DEVGUIDE.md index 862ac8c58e5..79468cdd556 100644 --- a/DEVGUIDE.md +++ b/DEVGUIDE.md @@ -53,7 +53,17 @@ After you build the first time you can open and use this solution in Visual Stud If you don't have everything installed yet, you'll get prompted by Visual Studio to install a few more things. This is because we use a `.vsconfig` file that specifies all our dependencies. -## Developing on Windows - No Visual Studio +If you are just developing the core compiler and library then building ``FSharp.sln`` will be enough. + +### Developing the F# Compiler (Linux/macOS) + +For Linux/Mac: + + ./build.sh + +Running tests: + + ./build.sh --test We recommend installing the latest released Visual Studio and using that if you are on Windows. However, if you prefer not to do that, you will need to install the following: diff --git a/FSharp.Profiles.props b/FSharp.Profiles.props index 534ba96c04f..6b473ce7eea 100644 --- a/FSharp.Profiles.props +++ b/FSharp.Profiles.props @@ -5,43 +5,22 @@ $(DefineConstants);CROSS_PLATFORM_COMPILER $(DefineConstants);ENABLE_MONO_SUPPORT - $(DefineConstants);BE_SECURITY_TRANSPARENT $(DefineConstants);FX_LCIDFROMCODEPAGE $(DefineConstants);NETSTANDARD $(DefineConstants);FX_NO_APP_DOMAINS - $(DefineConstants);FX_NO_ARRAY_LONG_LENGTH - $(DefineConstants);FX_NO_BEGINEND_READWRITE - $(DefineConstants);FX_NO_BINARY_SERIALIZATION - $(DefineConstants);FX_NO_CONVERTER - $(DefineConstants);FX_NO_DEFAULT_DEPENDENCY_TYPE $(DefineConstants);FX_NO_CORHOST_SIGNER - $(DefineConstants);FX_NO_EVENTWAITHANDLE_IDISPOSABLE - $(DefineConstants);FX_NO_EXIT_CONTEXT_FLAGS $(DefineConstants);FX_NO_LINKEDRESOURCES - $(DefineConstants);FX_NO_PARAMETERIZED_THREAD_START $(DefineConstants);FX_NO_PDB_READER $(DefineConstants);FX_NO_PDB_WRITER - $(DefineConstants);FX_NO_REFLECTION_MODULE_HANDLES - $(DefineConstants);FX_NO_REFLECTION_ONLY - $(DefineConstants);FX_NO_RUNTIMEENVIRONMENT - $(DefineConstants);FX_NO_SECURITY_PERMISSIONS - $(DefineConstants);FX_NO_SERVERCODEPAGES $(DefineConstants);FX_NO_SYMBOLSTORE $(DefineConstants);FX_NO_SYSTEM_CONFIGURATION - $(DefineConstants);FX_NO_THREAD - $(DefineConstants);FX_NO_THREADABORT - $(DefineConstants);FX_NO_WAITONE_MILLISECONDS - $(DefineConstants);FX_NO_WEB_CLIENT $(DefineConstants);FX_NO_WIN_REGISTRY $(DefineConstants);FX_NO_WINFORMS $(DefineConstants);FX_NO_INDENTED_TEXT_WRITER - $(DefineConstants);FX_REDUCED_EXCEPTIONS $(DefineConstants);FX_RESHAPED_REFEMIT - $(DefineConstants);FX_RESHAPED_GLOBALIZATION - $(DefineConstants);FX_RESHAPED_REFLECTION $(DefineConstants);FX_RESHAPED_MSBUILD $(OtherFlags) --simpleresolution diff --git a/FSharpTests.Directory.Build.props b/FSharpTests.Directory.Build.props index 8a7a832a43e..37da8b15930 100644 --- a/FSharpTests.Directory.Build.props +++ b/FSharpTests.Directory.Build.props @@ -16,6 +16,10 @@ + + ($(DefineConstants);TESTING_ON_LINUX + + true diff --git a/Makefile b/Makefile index 10de364b677..a002620f232 100644 --- a/Makefile +++ b/Makefile @@ -29,7 +29,7 @@ restore: build: proto restore $(DotNetExe) build-server shutdown - $(DotNetExe) build -c $(Configuration) -f netstandard1.6 src/fsharp/FSharp.Core/FSharp.Core.fsproj + $(DotNetExe) build -c $(Configuration) -f netstandard2.0 src/fsharp/FSharp.Core/FSharp.Core.fsproj $(DotNetExe) build -c $(Configuration) -f netstandard2.0 src/fsharp/FSharp.Build/FSharp.Build.fsproj $(DotNetExe) build -c $(Configuration) -f netstandard2.0 src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj $(DotNetExe) build -c $(Configuration) -f netcoreapp2.1 src/fsharp/fsc/fsc.fsproj diff --git a/eng/Versions.props b/eng/Versions.props index 286b0af428b..ac79040a674 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -12,7 +12,7 @@ beta - 4.6 + 4.7 $(FSLanguageVersion) $(FSCoreMajorVersion).3 $(FSCoreMajorVersion).0 @@ -55,7 +55,6 @@ https://dotnet.myget.org/F/roslyn-tools/api/v3/index.json; https://api.nuget.org/v3/index.json; https://dotnet.myget.org/F/roslyn/api/v3/index.json; - https://dotnet.myget.org/F/roslyn-analyzers/api/v3/index.json; https://dotnet.myget.org/F/symreader-converter/api/v3/index.json; https://dotnet.myget.org/F/interactive-window/api/v3/index.json; https://myget.org/F/vs-devcore/api/v3/index.json; diff --git a/eng/common/templates/job/publish-build-assets.yml b/eng/common/templates/job/publish-build-assets.yml index 9e77ef1b54b..4a06190dd3e 100644 --- a/eng/common/templates/job/publish-build-assets.yml +++ b/eng/common/templates/job/publish-build-assets.yml @@ -57,6 +57,7 @@ jobs: /p:MaestroApiEndpoint=https://maestro-prod.westus2.cloudapp.azure.com /p:PublishUsingPipelines=${{ parameters.publishUsingPipelines }} /p:Configuration=$(_BuildConfig) + /v:detailed condition: ${{ parameters.condition }} continueOnError: ${{ parameters.continueOnError }} - task: powershell@2 diff --git a/eng/common/templates/post-build/channels/public-dev-release.yml b/eng/common/templates/post-build/channels/public-dev-release.yml index 79c6822db72..94a767bb857 100644 --- a/eng/common/templates/post-build/channels/public-dev-release.yml +++ b/eng/common/templates/post-build/channels/public-dev-release.yml @@ -111,7 +111,6 @@ stages: -PersonalAccessToken $(dn-bot-dnceng-unviersal-packages-rw) enabled: false - - stage: PublishValidation displayName: Publish Validation variables: diff --git a/eng/common/tools.sh b/eng/common/tools.sh index 70d92cf85aa..c2f18a2a142 100644 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -356,6 +356,8 @@ function MSBuild-Core { } } +. "$scriptroot/pipeline-logging-functions.sh" + ResolvePath "${BASH_SOURCE[0]}" _script_dir=`dirname "$_ResolvePath"` diff --git a/fcs/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj b/fcs/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj index c3125e32d13..d6c71b55456 100644 --- a/fcs/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj +++ b/fcs/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj @@ -12,13 +12,9 @@ true - $(DefineConstants);FX_NO_RUNTIMEENVIRONMENT $(DefineConstants);NO_PROJECTCRACKER - - ReshapedReflection.fs - FsUnit.fs diff --git a/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj b/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj index 2bfaa4aa128..5e0d2250f7e 100644 --- a/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj +++ b/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj @@ -34,7 +34,6 @@ $(DefineConstants);FX_NO_SYMBOLSTORE $(DefineConstants);FX_NO_LINKEDRESOURCES $(DefineConstants);FX_NO_APP_DOMAINS - $(DefineConstants);FX_NO_RUNTIMEENVIRONMENT $(DefineConstants);FX_NO_WIN_REGISTRY $(DefineConstants);FX_NO_SYSTEM_CONFIGURATION $(DefineConstants);FX_RESHAPED_REFEMIT @@ -67,9 +66,6 @@ Logger.fs - - Reshaped/reshapedreflection.fs - ErrorText/sformat.fsi @@ -82,6 +78,12 @@ ErrorText/sr.fs + + Driver\LanguageFeatures.fsi + + + Driver\LanguageFeatures.fs + LexYaccRuntime/prim-lexing.fsi @@ -157,6 +159,9 @@ Utilities/bytes.fs + + Utilities\XmlAdapters.fs + Utilities/lib.fs @@ -264,6 +269,9 @@ AbsIL/ilreflect.fs + + ReferenceResolution/reshapedmsbuild.fs + ReferenceResolution/ReferenceResolver.fs @@ -588,9 +596,6 @@ Service/ServiceUntypedParse.fs - - Service/reshapedmsbuild.fs - Service/ServiceDeclarationLists.fsi diff --git a/src/absil/illib.fs b/src/absil/illib.fs index fea0fd92a97..68b7c8d40a8 100644 --- a/src/absil/illib.fs +++ b/src/absil/illib.fs @@ -12,10 +12,6 @@ open System.Reflection open System.Threading open System.Runtime.CompilerServices -#if FX_RESHAPED_REFLECTION -open Microsoft.FSharp.Core.ReflectionAdapters -#endif - // Logical shift right treating int32 as unsigned integer. // Code that uses this should probably be adjusted to use unsigned integer types. let (>>>&) (x: int32) (n: int32) = int32 (uint32 x >>> n) @@ -258,12 +254,6 @@ module Option = module List = - //let item n xs = List.nth xs n -#if FX_RESHAPED_REFLECTION - open PrimReflectionAdapters - open Microsoft.FSharp.Core.ReflectionAdapters -#endif - let sortWithOrder (c: IComparer<'T>) elements = List.sortWith (Order.toFunction c) elements let splitAfter n l = @@ -1272,11 +1262,6 @@ type LayeredMultiMap<'Key, 'Value when 'Key : equality and 'Key : comparison>(co [] module Shim = -#if FX_RESHAPED_REFLECTION - open PrimReflectionAdapters - open Microsoft.FSharp.Core.ReflectionAdapters -#endif - type IFileSystem = /// A shim over File.ReadAllBytes diff --git a/src/absil/ilreflect.fs b/src/absil/ilreflect.fs index 404ebf81b0c..9550c27cb9a 100644 --- a/src/absil/ilreflect.fs +++ b/src/absil/ilreflect.fs @@ -24,10 +24,6 @@ open FSharp.Compiler.ErrorLogger open FSharp.Compiler.Range open FSharp.Core.Printf -#if FX_RESHAPED_REFLECTION -open Microsoft.FSharp.Core.ReflectionAdapters -#endif - let codeLabelOrder = ComparisonIdentity.Structural // Convert the output of convCustomAttr @@ -314,10 +310,8 @@ let convAssemblyRef (aref: ILAssemblyRef) = asmName.Version <- System.Version (int32 version.Major, int32 version.Minor, int32 version.Build, int32 version.Revision) Option.iter setVersion aref.Version // asmName.ProcessorArchitecture <- System.Reflection.ProcessorArchitecture.MSIL -#if !FX_RESHAPED_GLOBALIZATION //Option.iter (fun name -> asmName.CultureInfo <- System.Globalization.CultureInfo.CreateSpecificCulture name) aref.Locale asmName.CultureInfo <- System.Globalization.CultureInfo.InvariantCulture -#endif asmName /// The global environment. @@ -663,9 +657,6 @@ let TypeBuilderInstantiationT = ty let typeIsNotQueryable (ty: Type) = -#if FX_RESHAPED_REFLECTION - let ty = ty.GetTypeInfo() -#endif (ty :? TypeBuilder) || ((ty.GetType()).Equals(TypeBuilderInstantiationT)) //---------------------------------------------------------------------------- // convFieldSpec @@ -794,11 +785,7 @@ let queryableTypeGetMethod cenv emEnv parentT (mref: ILMethodRef) = parentT.GetMethod(mref.Name, cconv ||| BindingFlags.Public ||| BindingFlags.NonPublic, null, argTs, -#if FX_RESHAPED_REFLECTION - (null: obj[])) -#else (null: ParameterModifier[])) -#endif // This can fail if there is an ambiguity w.r.t. return type with _ -> null if (isNonNull methInfo && equalTypes resT methInfo.ReturnType) then @@ -1434,11 +1421,7 @@ let buildGenParamsPass1 _emEnv defineGenericParameters (gps: ILGenericParameterD let buildGenParamsPass1b cenv emEnv (genArgs: Type array) (gps: ILGenericParameterDefs) = -#if FX_RESHAPED_REFLECTION - let genpBs = genArgs |> Array.map (fun x -> (x.GetTypeInfo() :?> GenericTypeParameterBuilder)) -#else let genpBs = genArgs |> Array.map (fun x -> (x :?> GenericTypeParameterBuilder)) -#endif gps |> List.iteri (fun i (gp: ILGenericParameterDef) -> let gpB = genpBs.[i] // the Constraints are either the parent (base) type or interfaces. diff --git a/src/absil/ilwrite.fs b/src/absil/ilwrite.fs index 5d6bfd3ee06..38f9fcfe39f 100644 --- a/src/absil/ilwrite.fs +++ b/src/absil/ilwrite.fs @@ -3035,9 +3035,6 @@ module FileSystemUtilites = open System open System.Reflection open System.Globalization -#if FX_RESHAPED_REFLECTION - open Microsoft.FSharp.Core.ReflectionAdapters -#endif let progress = try System.Environment.GetEnvironmentVariable("FSharp_DebugSetFilePermissions") <> null with _ -> false let setExecutablePermission (filename: string) = diff --git a/src/fsharp/CompileOps.fs b/src/fsharp/CompileOps.fs index 85728909cf3..a38da4fb83c 100644 --- a/src/fsharp/CompileOps.fs +++ b/src/fsharp/CompileOps.fs @@ -28,6 +28,7 @@ open FSharp.Compiler.AttributeChecking open FSharp.Compiler.ConstraintSolver open FSharp.Compiler.DiagnosticMessage open FSharp.Compiler.ErrorLogger +open FSharp.Compiler.Features open FSharp.Compiler.Import open FSharp.Compiler.Infos open FSharp.Compiler.Lexhelp @@ -1739,7 +1740,7 @@ let CollectDiagnostic (implicitIncludeDir, showFullPaths, flattenErrors, errorSt let os = System.Text.StringBuilder() OutputPhasedDiagnostic os err flattenErrors canSuggestNames errors.Add( Diagnostic.Short(isError, os.ToString()) ) - + relatedErrors |> List.iter OutputRelatedError match err with @@ -1789,7 +1790,7 @@ let OutputDiagnosticContext prefix fileLineFn os err = let (++) x s = x @ [s] -//---------------------------------------------------------------------------- +//-------------------------------------------------------------------------- // General file name resolver //-------------------------------------------------------------------------- @@ -1974,7 +1975,7 @@ type ICompilationThread = /// Enqueue work to be done on a compilation thread. abstract EnqueueWork: (CompilationThreadToken -> unit) -> unit -type ImportedBinary = +type ImportedBinary = { FileName: string RawMetadata: IRawFSharpAssemblyData #if !NO_EXTENSIONTYPING @@ -1985,7 +1986,7 @@ type ImportedBinary = ILAssemblyRefs: ILAssemblyRef list ILScopeRef: ILScopeRef } -type ImportedAssembly = +type ImportedAssembly = { ILScopeRef: ILScopeRef FSharpViewOfMetadata: CcuThunk AssemblyAutoOpenAttributes: string list @@ -2000,7 +2001,7 @@ type AvailableImportedAssembly = | ResolvedImportedAssembly of ImportedAssembly | UnresolvedImportedAssembly of string -type CcuLoadFailureAction = +type CcuLoadFailureAction = | RaiseError | ReturnNone @@ -2162,8 +2163,10 @@ type TcConfigBuilder = mutable internalTestSpanStackReferring: bool mutable noConditionalErasure: bool - + mutable pathMap: PathMap + + mutable langVersion: LanguageVersion } static member Initial = @@ -2209,7 +2212,7 @@ type TcConfigBuilder = debuginfo = false testFlagEmitFeeFeeAs100001 = false dumpDebugInfo = false - debugSymbolFile = None + debugSymbolFile = None (* Backend configuration *) typeCheckOnly = false @@ -2303,6 +2306,7 @@ type TcConfigBuilder = internalTestSpanStackReferring = false noConditionalErasure = false pathMap = PathMap.empty + langVersion = LanguageVersion("default") } static member CreateNew(legacyReferenceResolver, defaultFSharpBinariesDir, reduceMemoryUsage, implicitIncludeDir, @@ -2752,6 +2756,7 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) = member x.emitTailcalls = data.emitTailcalls member x.deterministic = data.deterministic member x.pathMap = data.pathMap + member x.langVersion = data.langVersion member x.preferredUiLang = data.preferredUiLang member x.lcid = data.lcid member x.optsOn = data.optsOn @@ -3129,7 +3134,7 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) = member tcConfig.PrimaryAssemblyDllReference() = primaryAssemblyReference member tcConfig.CoreLibraryDllReference() = fslibReference - + let ReportWarning options err = warningOn err (options.WarnLevel) (options.WarnOn) && not (List.contains (GetDiagnosticNumber err) (options.WarnOff)) @@ -3480,8 +3485,8 @@ let ParseOneInputFile (tcConfig: TcConfig, lexResourceManager, conditionalCompil if List.exists (Filename.checkSuffix lower) (FSharpSigFileSuffixes@FSharpImplFileSuffixes) then if not(FileSystem.SafeExists filename) then error(Error(FSComp.SR.buildCouldNotFindSourceFile filename, rangeStartup)) - // bug 3155: if the file name is indirect, use a full path - let lexbuf = UnicodeLexing.UnicodeFileAsLexbuf(filename, tcConfig.inputCodePage, retryLocked) + let isFeatureSupported featureId = tcConfig.langVersion.SupportsFeature featureId + let lexbuf = UnicodeLexing.UnicodeFileAsLexbuf(isFeatureSupported, filename, tcConfig.inputCodePage, retryLocked) ParseOneInputLexbuf(tcConfig, lexResourceManager, conditionalCompilationDefines, lexbuf, filename, isLastCompiland, errorLogger) else error(Error(FSComp.SR.buildInvalidSourceFileExtension(SanitizeFileName filename tcConfig.implicitIncludeDir), rangeStartup)) with e -> (* errorR(Failure("parse failed")); *) errorRecovery e rangeStartup; None @@ -5004,11 +5009,13 @@ module private ScriptPreprocessClosure = | CodeContext.CompilationAndEvaluation -> ["INTERACTIVE"] | CodeContext.Compilation -> ["COMPILED"] | CodeContext.Editing -> "EDITING" :: (if IsScript filename then ["INTERACTIVE"] else ["COMPILED"]) - let lexbuf = UnicodeLexing.SourceTextAsLexbuf(sourceText) - + + let isFeatureSupported featureId = tcConfig.langVersion.SupportsFeature featureId + let lexbuf = UnicodeLexing.SourceTextAsLexbuf(isFeatureSupported, 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) - + /// Create a TcConfig for load closure starting from a single .fsx file let CreateScriptTextTcConfig (legacyReferenceResolver, defaultFSharpBinariesDir, @@ -5220,7 +5227,7 @@ module private ScriptPreprocessClosure = useSimpleResolution, useFsiAuxLib, useSdkRefs, lexResourceManager: Lexhelp.LexResourceManager, applyCommmandLineArgs, assumeDotNetFramework, - tryGetMetadataSnapshot, reduceMemoryUsage) = + tryGetMetadataSnapshot, reduceMemoryUsage) = // Resolve the basic references such as FSharp.Core.dll first, before processing any #I directives in the script // @@ -5318,11 +5325,8 @@ let CheckSimulateException(tcConfig: TcConfig) = | Some("tc-oom") -> raise(System.OutOfMemoryException()) | Some("tc-an") -> raise(System.ArgumentNullException("simulated")) | Some("tc-invop") -> raise(System.InvalidOperationException()) -#if FX_REDUCED_EXCEPTIONS -#else | Some("tc-av") -> raise(System.AccessViolationException()) | Some("tc-nfn") -> raise(System.NotFiniteNumberException()) -#endif | Some("tc-aor") -> raise(System.ArgumentOutOfRangeException()) | Some("tc-dv0") -> raise(System.DivideByZeroException()) | Some("tc-oe") -> raise(System.OverflowException()) diff --git a/src/fsharp/CompileOps.fsi b/src/fsharp/CompileOps.fsi index 71bb7c6f8b6..51bcc2dc2a6 100644 --- a/src/fsharp/CompileOps.fsi +++ b/src/fsharp/CompileOps.fsi @@ -16,6 +16,7 @@ open FSharp.Compiler.TypeChecker open FSharp.Compiler.Range open FSharp.Compiler.Ast open FSharp.Compiler.ErrorLogger +open FSharp.Compiler.Features open FSharp.Compiler.Tast open FSharp.Compiler.TcGlobals open FSharp.Compiler.Text @@ -384,6 +385,8 @@ type TcConfigBuilder = mutable noConditionalErasure: bool mutable pathMap : PathMap + + mutable langVersion : LanguageVersion } static member Initial: TcConfigBuilder diff --git a/src/fsharp/CompileOptions.fs b/src/fsharp/CompileOptions.fs index 0c385cc3670..d107c3f3949 100644 --- a/src/fsharp/CompileOptions.fs +++ b/src/fsharp/CompileOptions.fs @@ -17,6 +17,7 @@ open FSharp.Compiler.TcGlobals open FSharp.Compiler.Tast open FSharp.Compiler.Tastops open FSharp.Compiler.ErrorLogger +open FSharp.Compiler.Features open FSharp.Compiler.Lib open FSharp.Compiler.Range open FSharp.Compiler.IlxGen @@ -525,6 +526,7 @@ let tagAddress = "
" let tagInt = "" let tagPathMap = "" let tagNone = "" +let tagLangVersionValues = "{?|version|latest|preview}" // PrintOptionInfo //---------------- @@ -812,28 +814,41 @@ let codeGenerationFlags isFsi (tcConfigB: TcConfigBuilder) = //---------------------- let defineSymbol tcConfigB s = tcConfigB.conditionalCompilationDefines <- s :: tcConfigB.conditionalCompilationDefines - + let mlCompatibilityFlag (tcConfigB: TcConfigBuilder) = CompilerOption ("mlcompatibility", tagNone, OptionUnit (fun () -> tcConfigB.mlCompatibility<-true; tcConfigB.TurnWarningOff(rangeCmdArgs, "62")), None, Some (FSComp.SR.optsMlcompatibility())) +/// LanguageVersion management +let setLanguageVersion (specifiedVersion) = + + let languageVersion = new LanguageVersion(specifiedVersion) + let dumpAllowedValues () = + printfn "%s" (FSComp.SR.optsSupportedLangVersions()) + for v in languageVersion.ValidOptions do printfn "%s" v + for v in languageVersion.ValidVersions do printfn "%s" v + exit 0 + + if specifiedVersion = "?" then dumpAllowedValues () + if not (languageVersion.ContainsVersion specifiedVersion) then error(Error(FSComp.SR.optsUnrecognizedLanguageVersion specifiedVersion, rangeCmdArgs)) + languageVersion + let languageFlags tcConfigB = [ - CompilerOption - ("checked", tagNone, - OptionSwitch (fun switch -> tcConfigB.checkOverflow <- (switch = OptionSwitch.On)), None, - Some (FSComp.SR.optsChecked())) - - CompilerOption - ("define", tagString, - OptionString (defineSymbol tcConfigB), None, - Some (FSComp.SR.optsDefine())) - + // -langversion:? Display the allowed values for language version + // -langversion: Specify language version such as + // 'default' (latest major version), or + // 'latest' (latest version, including minor versions), + // 'preview' (features for preview) + // or specific versions like '4.7' + CompilerOption("langversion", tagLangVersionValues, OptionString (fun switch -> tcConfigB.langVersion <- setLanguageVersion(switch)), None, Some (FSComp.SR.optsLangVersion())) + + CompilerOption("checked", tagNone, OptionSwitch (fun switch -> tcConfigB.checkOverflow <- (switch = OptionSwitch.On)), None, Some (FSComp.SR.optsChecked())) + CompilerOption("define", tagString, OptionString (defineSymbol tcConfigB), None, Some (FSComp.SR.optsDefine())) mlCompatibilityFlag tcConfigB ] - // OptionBlock: Advanced user options //----------------------------------- @@ -1604,16 +1619,10 @@ let ReportTime (tcConfig:TcConfig) descr = | Some("fsc-oom") -> raise(System.OutOfMemoryException()) | Some("fsc-an") -> raise(System.ArgumentNullException("simulated")) | Some("fsc-invop") -> raise(System.InvalidOperationException()) -#if FX_REDUCED_EXCEPTIONS -#else | Some("fsc-av") -> raise(System.AccessViolationException()) -#endif | Some("fsc-aor") -> raise(System.ArgumentOutOfRangeException()) | Some("fsc-dv0") -> raise(System.DivideByZeroException()) -#if FX_REDUCED_EXCEPTIONS -#else | Some("fsc-nfn") -> raise(System.NotFiniteNumberException()) -#endif | Some("fsc-oe") -> raise(System.OverflowException()) | Some("fsc-atmm") -> raise(System.ArrayTypeMismatchException()) | Some("fsc-bif") -> raise(System.BadImageFormatException()) diff --git a/src/fsharp/ErrorLogger.fs b/src/fsharp/ErrorLogger.fs index 2f9c07173b5..680e7c57967 100755 --- a/src/fsharp/ErrorLogger.fs +++ b/src/fsharp/ErrorLogger.fs @@ -351,10 +351,6 @@ module ErrorLoggerExtensions = /// Reraise an exception if it is one we want to report to Watson. let ReraiseIfWatsonable(exn:exn) = -#if FX_REDUCED_EXCEPTIONS - ignore exn - () -#else match exn with // These few SystemExceptions which we don't report to Watson are because we handle these in some way in Build.fs | :? System.Reflection.TargetInvocationException -> () @@ -366,7 +362,6 @@ module ErrorLoggerExtensions = PreserveStackTrace exn raise exn | _ -> () -#endif type ErrorLogger with @@ -404,10 +399,7 @@ module ErrorLoggerExtensions = // Throws StopProcessing and exceptions raised by the DiagnosticSink(exn) handler. match exn with (* Don't send ThreadAbortException down the error channel *) -#if FX_REDUCED_EXCEPTIONS -#else | :? System.Threading.ThreadAbortException | WrappedError((:? System.Threading.ThreadAbortException), _) -> () -#endif | ReportedError _ | WrappedError(ReportedError _, _) -> () | StopProcessing | WrappedError(StopProcessing, _) -> PreserveStackTrace exn diff --git a/src/fsharp/ExtensionTyping.fs b/src/fsharp/ExtensionTyping.fs index 0513bcf2eea..0c880dd9da3 100755 --- a/src/fsharp/ExtensionTyping.fs +++ b/src/fsharp/ExtensionTyping.fs @@ -140,9 +140,7 @@ module internal ExtensionTyping = let StripException (e: exn) = match e with -#if !FX_REDUCED_EXCEPTIONS | :? System.Reflection.TargetInvocationException as e -> e.InnerException -#endif | :? TypeInitializationException as e -> e.InnerException | _ -> e diff --git a/src/fsharp/FSComp.txt b/src/fsharp/FSComp.txt index ee2b41f2e9d..a324cc9ed4a 100644 --- a/src/fsharp/FSComp.txt +++ b/src/fsharp/FSComp.txt @@ -73,6 +73,7 @@ buildProductNameCommunity,"F# Compiler for F# %s" pickleErrorReadingWritingMetadata,"Error reading/writing metadata for the F# compiled DLL '%s'. Was the DLL compiled with an earlier version of the F# compiler? (error: '%s')." 245,tastTypeOrModuleNotConcrete,"The type/module '%s' is not a concrete module or type" tastTypeHasAssemblyCodeRepresentation,"The type '%s' has an inline assembly code representation" +246,optsUnrecognizedLanguageVersion,"Unrecognized value '%s' for --langversion use --langversion:? for complete list" 247,tastNamespaceAndModuleWithSameNameInAssembly,"A namespace and a module named '%s' both occur in two parts of this assembly" 248,tastTwoModulesWithSameNameInAssembly,"Two modules named '%s' occur in two parts of this assembly" 249,tastDuplicateTypeDefinitionInAssembly,"Two type definitions named '%s' occur in namespace '%s' in two parts of this assembly" @@ -420,6 +421,7 @@ parsAttributesMustComeBeforeVal,"Attributes should be placed before 'val'" 568,parsAllEnumFieldsRequireValues,"All enum fields must be given values" 569,parsInlineAssemblyCannotHaveVisibilityDeclarations,"Accessibility modifiers are not permitted on inline assembly code types" 571,parsUnexpectedIdentifier,"Unexpected identifier: '%s'" +10,parsUnexpectedSymbolDot,"Unexpected symbol '.' in member definition. Expected 'with', '=' or other token." 572,parsUnionCasesCannotHaveVisibilityDeclarations,"Accessibility modifiers are not permitted on union cases. Use 'type U = internal ...' or 'type U = private ...' to give an accessibility to the whole representation." 573,parsEnumFieldsCannotHaveVisibilityDeclarations,"Accessibility modifiers are not permitted on enumeration fields" parsConsiderUsingSeparateRecordType,"Consider using a separate record type instead" @@ -1463,3 +1465,5 @@ notAFunctionButMaybeDeclaration,"This value is not a function and cannot be appl 3301,chkInvalidFunctionReturnType,"The function or method has an invalid return type '%s'. This is not permitted by the rules of Common IL." useSdkRefs,"Use reference assemblies for .NET framework references when available (Enabled by default)." fSharpBannerVersion,"%s for F# %s" +optsLangVersion,"Display the allowed values for language version, specify language version such as 'latest' or 'preview'" +optsSupportedLangVersions,"Supported language versions:" diff --git a/src/fsharp/FSharp.Build/FSharp.Build.fsproj b/src/fsharp/FSharp.Build/FSharp.Build.fsproj index e22c8797018..76b9c7043e9 100644 --- a/src/fsharp/FSharp.Build/FSharp.Build.fsproj +++ b/src/fsharp/FSharp.Build/FSharp.Build.fsproj @@ -19,7 +19,6 @@ - diff --git a/src/fsharp/FSharp.Build/Fsc.fs b/src/fsharp/FSharp.Build/Fsc.fs index 19d8cd171fa..4f1a702d5a5 100644 --- a/src/fsharp/FSharp.Build/Fsc.fs +++ b/src/fsharp/FSharp.Build/Fsc.fs @@ -39,6 +39,7 @@ type public Fsc () as this = let mutable generateInterfaceFile : string = null let mutable highEntropyVA : bool = false let mutable keyFile : string = null + let mutable langVersion : string = null let mutable noFramework = false let mutable optimize : bool = true let mutable otherFlags : string = null @@ -102,15 +103,15 @@ type public Fsc () as this = | "EMBEDDED" -> "embedded" | "FULL" -> "full" | _ -> null) - if embedAllSources then - builder.AppendSwitch("--embed+") + if embedAllSources then builder.AppendSwitch("--embed+") if embeddedFiles <> null then for item in embeddedFiles do builder.AppendSwitchIfNotNull("--embed:", item.ItemSpec) builder.AppendSwitchIfNotNull("--sourcelink:", sourceLink) + builder.AppendSwitchIfNotNull("--langversion:", langVersion) // NoFramework - if noFramework then - builder.AppendSwitch("--noframework") + if noFramework then + builder.AppendSwitch("--noframework") // BaseAddress builder.AppendSwitchIfNotNull("--baseaddress:", baseAddress) // DefineConstants @@ -119,7 +120,6 @@ type public Fsc () as this = builder.AppendSwitchIfNotNull("--define:", item.ItemSpec) // DocumentationFile builder.AppendSwitchIfNotNull("--doc:", documentationFile) - // GenerateInterfaceFile builder.AppendSwitchIfNotNull("--sig:", generateInterfaceFile) // KeyFile @@ -330,6 +330,10 @@ type public Fsc () as this = with get() = keyFile and set(s) = keyFile <- s + member fsc.LangVersion + with get() = langVersion + and set(s) = langVersion <- s + member fsc.LCID with get() = vslcid and set(p) = vslcid <- p @@ -363,7 +367,7 @@ type public Fsc () as this = member fsc.PathMap with get() = pathMap and set(s) = pathMap <- s - + // --pdb : // Name the debug output file member fsc.PdbFile diff --git a/src/fsharp/FSharp.Build/Microsoft.FSharp.Targets b/src/fsharp/FSharp.Build/Microsoft.FSharp.Targets index c36ce52c50f..c10d3fb3055 100644 --- a/src/fsharp/FSharp.Build/Microsoft.FSharp.Targets +++ b/src/fsharp/FSharp.Build/Microsoft.FSharp.Targets @@ -272,9 +272,16 @@ this file. $(OtherFlags) + + + preview + + - - + + Win32ResourceFile="$(Win32Resource)"> diff --git a/src/fsharp/FSharp.Compiler.Interactive.Settings/FSharp.Compiler.Interactive.Settings.fsproj b/src/fsharp/FSharp.Compiler.Interactive.Settings/FSharp.Compiler.Interactive.Settings.fsproj index 70c01bec4f0..75af428f4f1 100644 --- a/src/fsharp/FSharp.Compiler.Interactive.Settings/FSharp.Compiler.Interactive.Settings.fsproj +++ b/src/fsharp/FSharp.Compiler.Interactive.Settings/FSharp.Compiler.Interactive.Settings.fsproj @@ -21,7 +21,6 @@ - diff --git a/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj b/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj index d468a8a9968..e6e08434db6 100644 --- a/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj +++ b/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj @@ -63,12 +63,6 @@ Logger.fs - - Reflection\reshapedreflection.fs - - - Reflection\reshapedmsbuild.fs - ErrorText\sformat.fsi @@ -81,6 +75,12 @@ ErrorText\sr.fs + + Driver\LanguageFeatures.fsi + + + Driver\LanguageFeatures.fs + LexYaccRuntime\prim-lexing.fsi @@ -147,6 +147,9 @@ Utilities\bytes.fs + + Utilities\XmlAdapters.fs + Utilities\InternalCollections.fsi @@ -266,7 +269,9 @@ ReferenceResolution\ReferenceResolver.fs - + + ReferenceResolution/reshapedmsbuild.fs + ReferenceResolution/LegacyMSBuildReferenceResolver.fsi @@ -630,9 +635,6 @@ Service/ServiceXmlDocParser.fs - - Service/reshapedmsbuild.fs - Service/ExternalSymbol.fsi diff --git a/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.netcore.nuspec b/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.netcore.nuspec index 2133f3bcf14..e8af5ff0e4a 100644 --- a/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.netcore.nuspec +++ b/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.netcore.nuspec @@ -4,7 +4,7 @@ FSharp.Compiler.Private.netcore .NET Core compatible version of the fsharp compiler service dll - Supported Platforms: - .NET Core (netstandard1.6) + Supported Platforms: - .NET Core (netstandard2.0) en-US true @@ -15,7 +15,7 @@ $tags$ - + diff --git a/src/fsharp/FSharp.Compiler.nuget/Microsoft.FSharp.Compiler.nuspec b/src/fsharp/FSharp.Compiler.nuget/Microsoft.FSharp.Compiler.nuspec index d3756ebc392..4a07b917ab8 100644 --- a/src/fsharp/FSharp.Compiler.nuget/Microsoft.FSharp.Compiler.nuspec +++ b/src/fsharp/FSharp.Compiler.nuget/Microsoft.FSharp.Compiler.nuspec @@ -45,7 +45,7 @@ - + - + - + true - net45;netstandard1.6 + net45;netstandard2.0 FSharp.Core FSharp.Core.nuspec true diff --git a/src/fsharp/FSharp.Core.nuget/FSharp.Core.nuspec b/src/fsharp/FSharp.Core.nuget/FSharp.Core.nuspec index ee7a88b29d6..e94b3a547c3 100644 --- a/src/fsharp/FSharp.Core.nuget/FSharp.Core.nuspec +++ b/src/fsharp/FSharp.Core.nuget/FSharp.Core.nuspec @@ -5,50 +5,23 @@ https://fsharp.org/img/logo.png en-US - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - + + + + - - - - + + + + - + diff --git a/src/fsharp/FSharp.Core/FSCore.resx b/src/fsharp/FSharp.Core/FSCore.resx index 8b74b1d039c..b90b5442f20 100644 --- a/src/fsharp/FSharp.Core/FSCore.resx +++ b/src/fsharp/FSharp.Core/FSCore.resx @@ -540,4 +540,7 @@ This is not a valid query expression. The construct '{0}' was used in a query but is not recognized by the F#-to-LINQ query translator. Check the specification of permitted queries and consider moving some of the operations out of the query expression. + + maxDegreeOfParallelism must be positive, was {0} + \ No newline at end of file diff --git a/src/fsharp/FSharp.Core/FSharp.Core.fsproj b/src/fsharp/FSharp.Core/FSharp.Core.fsproj index 588f72eaedc..829a118bc81 100644 --- a/src/fsharp/FSharp.Core/FSharp.Core.fsproj +++ b/src/fsharp/FSharp.Core/FSharp.Core.fsproj @@ -4,8 +4,8 @@ Library - net45;netstandard1.6 - netstandard1.6 + net45;netstandard2.0 + netstandard2.0 $(NoWarn);45;55;62;75;1204 true $(DefineConstants);FSHARP_CORE @@ -113,9 +113,6 @@ Collections/set.fs - - Reflection/reshapedreflection.fs - Reflection/reflect.fsi @@ -223,11 +220,6 @@ - - - - - diff --git a/src/fsharp/FSharp.Core/Linq.fs b/src/fsharp/FSharp.Core/Linq.fs index 4663e6f79a5..cd942cf672c 100644 --- a/src/fsharp/FSharp.Core/Linq.fs +++ b/src/fsharp/FSharp.Core/Linq.fs @@ -162,11 +162,6 @@ open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.Patterns open Microsoft.FSharp.Quotations.DerivedPatterns -#if FX_RESHAPED_REFLECTION -open PrimReflectionAdapters -open ReflectionAdapters -#endif - module LeafExpressionConverter = // The following is recognized as a LINQ 'member initialization pattern' in a quotation. @@ -219,11 +214,7 @@ module LeafExpressionConverter = SubstHelperRaw(q, x, y) |> Expr.Cast let showAll = -#if FX_RESHAPED_REFLECTION - true -#else BindingFlags.Public ||| BindingFlags.NonPublic -#endif let NullableConstructor = typedefof>.GetConstructors().[0] diff --git a/src/fsharp/FSharp.Core/Query.fs b/src/fsharp/FSharp.Core/Query.fs index 742f04b32d2..31e78f11dee 100644 --- a/src/fsharp/FSharp.Core/Query.fs +++ b/src/fsharp/FSharp.Core/Query.fs @@ -302,11 +302,6 @@ open Microsoft.FSharp.Quotations.DerivedPatterns open Microsoft.FSharp.Linq.QueryRunExtensions -#if FX_RESHAPED_REFLECTION -open PrimReflectionAdapters -open ReflectionAdapters -#endif - [] module Query = diff --git a/src/fsharp/FSharp.Core/QueryExtensions.fs b/src/fsharp/FSharp.Core/QueryExtensions.fs index 4885899fe89..bfddf7e57ef 100644 --- a/src/fsharp/FSharp.Core/QueryExtensions.fs +++ b/src/fsharp/FSharp.Core/QueryExtensions.fs @@ -15,11 +15,6 @@ open System.Collections.Generic open System.Linq open System.Linq.Expressions -#if FX_RESHAPED_REFLECTION -open PrimReflectionAdapters -open ReflectionAdapters -#endif - // ---------------------------------------------------------------------------- /// A type used to reconstruct a grouping after applying a mutable->immutable mapping transformation @@ -171,11 +166,7 @@ module internal Adapters = let (|RecordFieldGetSimplification|_|) (expr:Expr) = match expr with | Patterns.PropertyGet(Some (Patterns.NewRecord(typ,els)),propInfo,[]) -> -#if FX_RESHAPED_REFLECTION - let fields = Microsoft.FSharp.Reflection.FSharpType.GetRecordFields(typ, true) -#else let fields = Microsoft.FSharp.Reflection.FSharpType.GetRecordFields(typ,System.Reflection.BindingFlags.Public|||System.Reflection.BindingFlags.NonPublic) -#endif match fields |> Array.tryFindIndex (fun p -> p = propInfo) with | None -> None | Some i -> if i < els.Length then Some els.[i] else None diff --git a/src/fsharp/FSharp.Core/array.fs b/src/fsharp/FSharp.Core/array.fs index 8d7ce38869d..0ac47bd39a6 100644 --- a/src/fsharp/FSharp.Core/array.fs +++ b/src/fsharp/FSharp.Core/array.fs @@ -10,9 +10,6 @@ namespace Microsoft.FSharp.Collections open Microsoft.FSharp.Core.Operators open Microsoft.FSharp.Core.CompilerServices open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators -#if FX_RESHAPED_REFLECTION - open System.Reflection -#endif /// Basic operations on arrays [] @@ -191,11 +188,7 @@ namespace Microsoft.FSharp.Collections [] let countBy (projection: 'T->'Key) (array: 'T[]) = checkNonNull "array" array -#if FX_RESHAPED_REFLECTION - if (typeof<'Key>).GetTypeInfo().IsValueType -#else if typeof<'Key>.IsValueType -#endif then countByValueType projection array else countByRefType projection array @@ -445,11 +438,7 @@ namespace Microsoft.FSharp.Collections [] let groupBy (projection: 'T->'Key) (array: 'T[]) = checkNonNull "array" array -#if FX_RESHAPED_REFLECTION - if (typeof<'Key>).GetTypeInfo().IsValueType -#else if typeof<'Key>.IsValueType -#endif then groupByValueType projection array else groupByRefType projection array diff --git a/src/fsharp/FSharp.Core/async.fs b/src/fsharp/FSharp.Core/async.fs index 1f20f7c8110..1d4eb37ecc3 100644 --- a/src/fsharp/FSharp.Core/async.fs +++ b/src/fsharp/FSharp.Core/async.fs @@ -17,10 +17,6 @@ namespace Microsoft.FSharp.Control open Microsoft.FSharp.Control open Microsoft.FSharp.Collections -#if FX_RESHAPED_REFLECTION - open ReflectionAdapters -#endif - type LinkedSubSource(cancellationToken: CancellationToken) = let failureCTS = new CancellationTokenSource() @@ -168,13 +164,11 @@ namespace Microsoft.FSharp.Control let f = unbox<(unit -> AsyncReturn)> o this.ExecuteWithTrampoline f |> unfake) -#if !FX_NO_PARAMETERIZED_THREAD_START // Preallocate this delegate and keep it in the trampoline holder. let threadStartCallbackForStartThreadWithTrampoline = ParameterizedThreadStart (fun o -> let f = unbox<(unit -> AsyncReturn)> o this.ExecuteWithTrampoline f |> unfake) -#endif /// Execute an async computation after installing a trampoline on its synchronous stack. [] @@ -196,22 +190,10 @@ namespace Microsoft.FSharp.Control | null -> this.QueueWorkItemWithTrampoline f | _ -> this.PostWithTrampoline syncCtxt f -#if FX_NO_PARAMETERIZED_THREAD_START - // This should be the only call to Thread.Start in this library. We must always install a trampoline. - member this.StartThreadWithTrampoline (f: unit -> AsyncReturn) = -#if FX_NO_THREAD - this.QueueWorkItemWithTrampoline f -#else - (new Thread((fun _ -> this.Execute f |> unfake), IsBackground=true)).Start() - fake() -#endif - -#else // This should be the only call to Thread.Start in this library. We must always install a trampoline. member __.StartThreadWithTrampoline (f: unit -> AsyncReturn) = (new Thread(threadStartCallbackForStartThreadWithTrampoline, IsBackground=true)).Start(f|>box) fake() -#endif /// Save the exception continuation during propagation of an exception, or prior to raising an exception member inline __.OnExceptionRaised econt = @@ -731,12 +713,7 @@ namespace Microsoft.FSharp.Control match resEvent with | null -> () | ev -> -#if FX_NO_EVENTWAITHANDLE_IDISPOSABLE - ev.Dispose() - System.GC.SuppressFinalize ev -#else ev.Close() -#endif resEvent <- null) interface IDisposable with @@ -824,15 +801,7 @@ namespace Microsoft.FSharp.Control | None -> // OK, let's really wait for the Set signal. This may block. let timeout = defaultArg timeout Threading.Timeout.Infinite -#if FX_NO_EXIT_CONTEXT_FLAGS -#if FX_NO_WAITONE_MILLISECONDS - let ok = resHandle.WaitOne(TimeSpan(int64 timeout*10000L)) -#else - let ok = resHandle.WaitOne(millisecondsTimeout= timeout) -#endif -#else let ok = resHandle.WaitOne(millisecondsTimeout= timeout, exitContext=true) -#endif if ok then // Now the result really must be available result @@ -1196,7 +1165,13 @@ namespace Microsoft.FSharp.Control async { let! cancellationToken = cancellationTokenAsync return AsyncPrimitives.StartAsTask cancellationToken computation taskCreationOptions } - static member Parallel (computations: seq>) = + static member Parallel (computations: seq>) = Async.Parallel(computations, ?maxDegreeOfParallelism=None) + + static member Parallel (computations: seq>, ?maxDegreeOfParallelism: int) = + match maxDegreeOfParallelism with + | Some x when x < 1 -> raise(System.ArgumentException(String.Format(SR.GetString(SR.maxDegreeOfParallelismNotPositive), x), "maxDegreeOfParallelism")) + | _ -> () + MakeAsync (fun ctxt -> let tasks, result = try @@ -1251,19 +1226,61 @@ namespace Microsoft.FSharp.Control | _ -> () finishTask(Interlocked.Decrement &count) - tasks |> Array.iteri (fun i p -> - QueueAsync + // If maxDegreeOfParallelism is set but is higher then the number of tasks we have we set it back to None to fall into the simple + // queue all items branch + let maxDegreeOfParallelism = + match maxDegreeOfParallelism with + | None -> None + | Some maxDegreeOfParallelism -> if maxDegreeOfParallelism >= tasks.Length then None else Some maxDegreeOfParallelism + + // Simple case (no maxDegreeOfParallelism) just queue all the work, if we have maxDegreeOfParallelism set we start that many workers + // which will make progress on the actual computations + match maxDegreeOfParallelism with + | None -> + tasks |> Array.iteri (fun i p -> + QueueAsync + innerCTS.Token + // on success, record the result + (fun res -> recordSuccess i res) + // on exception... + (fun edi -> recordFailure (Choice1Of2 edi)) + // on cancellation... + (fun cexn -> recordFailure (Choice2Of2 cexn)) + p + |> unfake) + | Some maxDegreeOfParallelism -> + let mutable i = -1 + let worker = MakeAsync (fun _ -> + while i < tasks.Length do + let j = Interlocked.Increment &i + if j < tasks.Length then + let trampolineHolder = new TrampolineHolder() + trampolineHolder.ExecuteWithTrampoline (fun () -> + let ctxt = + AsyncActivation.Create + innerCTS.Token + trampolineHolder + (fun res -> recordSuccess j res) + (fun edi -> recordFailure (Choice1Of2 edi)) + (fun cexn -> recordFailure (Choice2Of2 cexn)) + tasks.[j].Invoke ctxt + ) + |> unfake + fake() + ) + for x = 1 to maxDegreeOfParallelism do + QueueAsync innerCTS.Token - // on success, record the result - (fun res -> recordSuccess i res) - // on exception... + (fun _ -> fake()) (fun edi -> recordFailure (Choice1Of2 edi)) - // on cancellation... (fun cexn -> recordFailure (Choice2Of2 cexn)) - p - |> unfake) + worker + |> unfake + fake())) + static member Sequential (computations: seq>) = Async.Parallel(computations, maxDegreeOfParallelism=1) + static member Choice(computations: Async<'T option> seq) : Async<'T option> = MakeAsync (fun ctxt -> let result = @@ -1385,15 +1402,7 @@ namespace Microsoft.FSharp.Control let millisecondsTimeout = defaultArg millisecondsTimeout Threading.Timeout.Infinite if millisecondsTimeout = 0 then async.Delay(fun () -> -#if FX_NO_EXIT_CONTEXT_FLAGS -#if FX_NO_WAITONE_MILLISECONDS - let ok = waitHandle.WaitOne(TimeSpan 0L) -#else - let ok = waitHandle.WaitOne 0 -#endif -#else let ok = waitHandle.WaitOne(0, exitContext=false) -#endif async.Return ok) else CreateDelimitedUserCodeAsync(fun ctxt -> @@ -1683,12 +1692,7 @@ namespace Microsoft.FSharp.Control member stream.AsyncRead(buffer: byte[], ?offset, ?count) = let offset = defaultArg offset 0 let count = defaultArg count buffer.Length -#if FX_NO_BEGINEND_READWRITE - // use combo CreateDelimitedUserCodeAsync + taskContinueWith instead of AwaitTask so we can pass cancellation token to the ReadAsync task - CreateDelimitedUserCodeAsync (fun ctxt -> taskContinueWith (stream.ReadAsync(buffer, offset, count, ctxt.aux.token)) ctxt false) -#else Async.FromBeginEnd (buffer, offset, count, stream.BeginRead, stream.EndRead) -#endif [] // give the extension member a 'nice', unmangled compiled name, unique within this module member stream.AsyncRead count = @@ -1705,12 +1709,7 @@ namespace Microsoft.FSharp.Control member stream.AsyncWrite(buffer:byte[], ?offset:int, ?count:int) = let offset = defaultArg offset 0 let count = defaultArg count buffer.Length -#if FX_NO_BEGINEND_READWRITE - // use combo CreateDelimitedUserCodeAsync + taskContinueWithUnit instead of AwaitTask so we can pass cancellation token to the WriteAsync task - CreateDelimitedUserCodeAsync (fun ctxt -> taskContinueWithUnit (stream.WriteAsync(buffer, offset, count, ctxt.aux.token)) ctxt false) -#else Async.FromBeginEnd (buffer, offset, count, stream.BeginWrite, stream.EndWrite) -#endif type IObservable<'Args> with @@ -1746,8 +1745,6 @@ namespace Microsoft.FSharp.Control | _ -> None) -#if !FX_NO_WEB_CLIENT - type System.Net.WebClient with member inline private this.Download(event: IEvent<'T, _>, handler: _ -> 'T, start, result) = let downloadAsync = @@ -1799,5 +1796,3 @@ namespace Microsoft.FSharp.Control start = (fun userToken -> this.DownloadFileAsync(address, fileName, userToken)), result = (fun _ -> ()) ) -#endif - diff --git a/src/fsharp/FSharp.Core/async.fsi b/src/fsharp/FSharp.Core/async.fsi index b3312c6990d..a0407225810 100644 --- a/src/fsharp/FSharp.Core/async.fsi +++ b/src/fsharp/FSharp.Core/async.fsi @@ -161,6 +161,35 @@ namespace Microsoft.FSharp.Control /// A computation that returns an array of values from the sequence of input computations. static member Parallel : computations:seq> -> Async<'T[]> + /// Creates an asynchronous computation that executes all the given asynchronous computations, + /// initially queueing each as work items and using a fork/join pattern. + /// + /// If all child computations succeed, an array of results is passed to the success continuation. + /// + /// If any child computation raises an exception, then the overall computation will trigger an + /// exception, and cancel the others. + /// + /// The overall computation will respond to cancellation while executing the child computations. + /// If cancelled, the computation will cancel any remaining child computations but will still wait + /// for the other child computations to complete. + /// A sequence of distinct computations to be parallelized. + /// A computation that returns an array of values from the sequence of input computations. + static member Parallel : computations:seq> * ?maxDegreeOfParallelism : int -> Async<'T[]> + + /// Creates an asynchronous computation that executes all the given asynchronous computations sequentially. + /// + /// If all child computations succeed, an array of results is passed to the success continuation. + /// + /// If any child computation raises an exception, then the overall computation will trigger an + /// exception, and cancel the others. + /// + /// The overall computation will respond to cancellation while executing the child computations. + /// If cancelled, the computation will cancel any remaining child computations but will still wait + /// for the other child computations to complete. + /// A sequence of distinct computations to be run in sequence. + /// A computation that returns an array of values from the sequence of input computations. + static member Sequential : computations:seq> -> Async<'T[]> + /// Creates an asynchronous computation that executes all given asynchronous computations in parallel, /// returning the result of the first succeeding computation (one whose result is 'Some x'). /// If all child computations complete with None, the parent computation also returns None. @@ -739,8 +768,7 @@ namespace Microsoft.FSharp.Control /// An asynchronous computation that waits for response to the WebRequest. [] // give the extension member a nice, unmangled compiled name, unique within this module member AsyncGetResponse : unit -> Async - -#if !FX_NO_WEB_CLIENT + type System.Net.WebClient with /// Returns an asynchronous computation that, when run, will wait for the download of the given URI. @@ -761,7 +789,6 @@ namespace Microsoft.FSharp.Control /// An asynchronous computation that will wait for the download of the URI to specified file. [] // give the extension member a nice, unmangled compiled name, unique within this module member AsyncDownloadFile : address:System.Uri * fileName: string -> Async -#endif // Internals used by MailboxProcessor module internal AsyncBuilderImpl = diff --git a/src/fsharp/FSharp.Core/event.fs b/src/fsharp/FSharp.Core/event.fs index 4489c325d5a..8643b669c3e 100644 --- a/src/fsharp/FSharp.Core/event.fs +++ b/src/fsharp/FSharp.Core/event.fs @@ -11,10 +11,6 @@ namespace Microsoft.FSharp.Control open System.Reflection open System.Diagnostics -#if FX_RESHAPED_REFLECTION - open ReflectionAdapters -#endif - [] type DelegateEvent<'Delegate when 'Delegate :> System.Delegate>() = let mutable multicast : System.Delegate = null diff --git a/src/fsharp/FSharp.Core/fslib-extra-pervasives.fs b/src/fsharp/FSharp.Core/fslib-extra-pervasives.fs index dd8d087345e..0917f84a50a 100644 --- a/src/fsharp/FSharp.Core/fslib-extra-pervasives.fs +++ b/src/fsharp/FSharp.Core/fslib-extra-pervasives.fs @@ -166,21 +166,13 @@ module ExtraTopLevelOperators = [] let dict (keyValuePairs:seq<'Key*'T>) : IDictionary<'Key,'T> = -#if FX_RESHAPED_REFLECTION - if (typeof<'Key>).GetTypeInfo().IsValueType -#else if typeof<'Key>.IsValueType -#endif then dictValueType keyValuePairs :> _ else dictRefType keyValuePairs :> _ [] let readOnlyDict (keyValuePairs:seq<'Key*'T>) : IReadOnlyDictionary<'Key,'T> = -#if FX_RESHAPED_REFLECTION - if (typeof<'Key>).GetTypeInfo().IsValueType -#else if typeof<'Key>.IsValueType -#endif then dictValueType keyValuePairs :> _ else dictRefType keyValuePairs :> _ diff --git a/src/fsharp/FSharp.Core/list.fs b/src/fsharp/FSharp.Core/list.fs index 653c557a455..e7fd17ee52d 100644 --- a/src/fsharp/FSharp.Core/list.fs +++ b/src/fsharp/FSharp.Core/list.fs @@ -9,9 +9,6 @@ namespace Microsoft.FSharp.Collections open Microsoft.FSharp.Collections open Microsoft.FSharp.Core.CompilerServices open System.Collections.Generic -#if FX_RESHAPED_REFLECTION - open System.Reflection -#endif [] [] @@ -71,11 +68,7 @@ namespace Microsoft.FSharp.Collections [] let countBy (projection:'T->'Key) (list:'T list) = -#if FX_RESHAPED_REFLECTION - if (typeof<'Key>).GetTypeInfo().IsValueType -#else if typeof<'Key>.IsValueType -#endif then countByValueType projection list else countByRefType projection list @@ -446,11 +439,7 @@ namespace Microsoft.FSharp.Collections [] let groupBy (projection:'T->'Key) (list:'T list) = -#if FX_RESHAPED_REFLECTION - if (typeof<'Key>).GetTypeInfo().IsValueType -#else if typeof<'Key>.IsValueType -#endif then groupByValueType projection list else groupByRefType projection list diff --git a/src/fsharp/FSharp.Core/map.fs b/src/fsharp/FSharp.Core/map.fs index d701fb87cfa..d0fccda1fdb 100644 --- a/src/fsharp/FSharp.Core/map.fs +++ b/src/fsharp/FSharp.Core/map.fs @@ -446,21 +446,19 @@ module MapTree = [] type Map<[]'Key, []'Value when 'Key : comparison >(comparer: IComparer<'Key>, tree: MapTree<'Key, 'Value>) = -#if !FX_NO_BINARY_SERIALIZATION [] - // This type is logically immutable. This field is only mutated during deserialization. - let mutable comparer = comparer + // This type is logically immutable. This field is only mutated during deserialization. + let mutable comparer = comparer [] - // This type is logically immutable. This field is only mutated during deserialization. - let mutable tree = tree + // This type is logically immutable. This field is only mutated during deserialization. + let mutable tree = tree - // This type is logically immutable. This field is only mutated during serialization and deserialization. + // This type is logically immutable. This field is only mutated during serialization and deserialization. // - // WARNING: The compiled name of this field may never be changed because it is part of the logical + // WARNING: The compiled name of this field may never be changed because it is part of the logical // WARNING: permanent serialization format for this type. - let mutable serializedData = null -#endif + let mutable serializedData = null // We use .NET generics per-instantiation static fields to avoid allocating a new object for each empty // set (it is just a lookup into a .NET table of type-instantiation-indexed static fields). @@ -468,7 +466,6 @@ type Map<[]'Key, [ new Map<'Key, 'Value>(comparer, MapTree<_, _>.MapEmpty) -#if !FX_NO_BINARY_SERIALIZATION [] member __.OnSerializing(context: System.Runtime.Serialization.StreamingContext) = ignore context @@ -483,9 +480,8 @@ type Map<[]'Key, [ - tree <- serializedData |> Array.map (fun (KeyValue(k, v)) -> (k, v)) |> MapTree.ofArray comparer + tree <- serializedData |> Array.map (fun (KeyValue(k, v)) -> (k, v)) |> MapTree.ofArray comparer serializedData <- null -#endif static member Empty : Map<'Key, 'Value> = empty diff --git a/src/fsharp/FSharp.Core/prim-types.fs b/src/fsharp/FSharp.Core/prim-types.fs index 2e91dec124f..1fe3d7e841a 100644 --- a/src/fsharp/FSharp.Core/prim-types.fs +++ b/src/fsharp/FSharp.Core/prim-types.fs @@ -374,29 +374,6 @@ namespace Microsoft.FSharp.Core /// Represents a out-argument managed pointer in F# code. This type should only be used with F# 4.5+. type outref<'T> = byref<'T, ByRefKinds.Out> -#if FX_RESHAPED_REFLECTION - module PrimReflectionAdapters = - - open System.Reflection - open System.Linq - // copied from BasicInlinedOperations - let inline box (x:'T) = (# "box !0" type ('T) x : obj #) - let inline unboxPrim<'T>(x:obj) = (# "unbox.any !0" type ('T) x : 'T #) - type System.Type with - member inline this.IsGenericType = this.GetTypeInfo().IsGenericType - member inline this.IsValueType = this.GetTypeInfo().IsValueType - member inline this.IsSealed = this.GetTypeInfo().IsSealed - member inline this.IsAssignableFrom(otherType: Type) = this.GetTypeInfo().IsAssignableFrom(otherType.GetTypeInfo()) - member inline this.GetGenericArguments() = this.GetTypeInfo().GenericTypeArguments - member inline this.GetProperty(name) = this.GetRuntimeProperty(name) - member inline this.GetMethod(name, parameterTypes) = this.GetRuntimeMethod(name, parameterTypes) - member inline this.GetCustomAttributes(attributeType: Type, inherits: bool) : obj[] = - unboxPrim<_> (box (CustomAttributeExtensions.GetCustomAttributes(this.GetTypeInfo(), attributeType, inherits).ToArray())) - - open PrimReflectionAdapters - -#endif - module internal BasicInlinedOperations = let inline unboxPrim<'T>(x:obj) = (# "unbox.any !0" type ('T) x : 'T #) let inline box (x:'T) = (# "box !0" type ('T) x : obj #) @@ -548,12 +525,8 @@ namespace Microsoft.FSharp.Core ignore obj // pretend the variable is used let e = new System.ArgumentException(ErrorStrings.AddressOpNotFirstClassString) (# "throw" (e :> System.Exception) : nativeptr<'T> #) - - + open IntrinsicOperators -#if FX_RESHAPED_REFLECTION - open PrimReflectionAdapters -#endif [] // nested module OK module IntrinsicFunctions = @@ -881,78 +854,6 @@ namespace Microsoft.FSharp.Core /// specialcase: Core implementation of structural comparison on arbitrary arrays. and GenericComparisonArbArrayWithComparer (comp:GenericComparer) (x:System.Array) (y:System.Array) : int = -#if FX_NO_ARRAY_LONG_LENGTH - if x.Rank = 1 && y.Rank = 1 then - let lenx = x.Length - let leny = y.Length - let c = intOrder lenx leny - if c <> 0 then c else - let basex = (x.GetLowerBound(0)) - let basey = (y.GetLowerBound(0)) - let c = intOrder basex basey - if c <> 0 then c else - let rec check i = - if i >= lenx then 0 else - let c = GenericCompare comp ((x.GetValue(i + basex)),(y.GetValue(i + basey))) - if c <> 0 then c else check (i + 1) - check 0 - elif x.Rank = 2 && y.Rank = 2 then - let lenx0 = x.GetLength(0) - let leny0 = y.GetLength(0) - let c = intOrder lenx0 leny0 - if c <> 0 then c else - let lenx1 = x.GetLength(1) - let leny1 = y.GetLength(1) - let c = intOrder lenx1 leny1 - if c <> 0 then c else - let basex0 = (x.GetLowerBound(0)) - let basex1 = (x.GetLowerBound(1)) - let basey0 = (y.GetLowerBound(0)) - let basey1 = (y.GetLowerBound(1)) - let c = intOrder basex0 basey0 - if c <> 0 then c else - let c = intOrder basex1 basey1 - if c <> 0 then c else - let rec check0 i = - let rec check1 j = - if j >= lenx1 then 0 else - let c = GenericCompare comp ((x.GetValue(i + basex0,j + basex1)), (y.GetValue(i + basey0,j + basey1))) - if c <> 0 then c else check1 (j + 1) - if i >= lenx0 then 0 else - let c = check1 0 - if c <> 0 then c else - check0 (i + 1) - check0 0 - else - let c = intOrder x.Rank y.Rank - if c <> 0 then c else - let ndims = x.Rank - // check lengths - let rec precheck k = - if k >= ndims then 0 else - let c = intOrder (x.GetLength(k)) (y.GetLength(k)) - if c <> 0 then c else - let c = intOrder (x.GetLowerBound(k)) (y.GetLowerBound(k)) - if c <> 0 then c else - precheck (k+1) - let c = precheck 0 - if c <> 0 then c else - let idxs : int[] = zeroCreate ndims - let rec checkN k baseIdx i lim = - if i >= lim then 0 else - set idxs k (baseIdx + i) - let c = - if k = ndims - 1 - then GenericCompare comp ((x.GetValue(idxs)), (y.GetValue(idxs))) - else check (k+1) - if c <> 0 then c else - checkN k baseIdx (i + 1) lim - and check k = - if k >= ndims then 0 else - let baseIdx = x.GetLowerBound(k) - checkN k baseIdx 0 (x.GetLength(k)) - check 0 -#else if x.Rank = 1 && y.Rank = 1 then let lenx = x.LongLength let leny = y.LongLength @@ -985,11 +886,11 @@ namespace Microsoft.FSharp.Core let c = int64Order basex1 basey1 if c <> 0 then c else let rec check0 i = - let rec check1 j = + let rec check1 j = if j >=. lenx1 then 0 else let c = GenericCompare comp ((x.GetValue(i +. basex0,j +. basex1)), (y.GetValue(i +. basey0,j +. basey1))) if c <> 0 then c else check1 (j +. 1L) - if i >=. lenx0 then 0 else + if i >=. lenx0 then 0 else let c = check1 0L if c <> 0 then c else check0 (i +. 1L) @@ -998,8 +899,8 @@ namespace Microsoft.FSharp.Core let c = intOrder x.Rank y.Rank if c <> 0 then c else let ndims = x.Rank - // check lengths - let rec precheck k = + // check lengths + let rec precheck k = if k >= ndims then 0 else let c = int64Order (x.GetLongLength(k)) (y.GetLongLength(k)) if c <> 0 then c else @@ -1023,10 +924,9 @@ namespace Microsoft.FSharp.Core let baseIdx = x.GetLowerBound(k) checkN k (int64 baseIdx) 0L (x.GetLongLength(k)) check 0 -#endif - + /// optimized case: Core implementation of structural comparison on object arrays. - and GenericComparisonObjArrayWithComparer (comp:GenericComparer) (x:obj[]) (y:obj[]) : int = + and GenericComparisonObjArrayWithComparer (comp:GenericComparer) (x:obj[]) (y:obj[]) : int = let lenx = x.Length let leny = y.Length let c = intOrder lenx leny @@ -1035,8 +935,8 @@ namespace Microsoft.FSharp.Core let mutable i = 0 let mutable res = 0 while i < lenx do - let c = GenericCompare comp ((get x i), (get y i)) - if c <> 0 then (res <- c; i <- lenx) + let c = GenericCompare comp ((get x i), (get y i)) + if c <> 0 then (res <- c; i <- lenx) else i <- i + 1 res @@ -1058,7 +958,7 @@ namespace Microsoft.FSharp.Core type GenericComparer with interface System.Collections.IComparer with override c.Compare(x:obj,y:obj) = GenericCompare c (x,y) - + /// The unique object for comparing values in PER mode (where local exceptions are thrown when NaNs are compared) let fsComparerPER = GenericComparer(true) @@ -1403,63 +1303,6 @@ namespace Microsoft.FSharp.Core /// specialcase: Core implementation of structural equality on arbitrary arrays. and GenericEqualityArbArray er (iec:System.Collections.IEqualityComparer) (x:System.Array) (y:System.Array) : bool = -#if FX_NO_ARRAY_LONG_LENGTH - if x.Rank = 1 && y.Rank = 1 then - // check lengths - let lenx = x.Length - let leny = y.Length - (int32Eq lenx leny) && - // check contents - let basex = x.GetLowerBound(0) - let basey = y.GetLowerBound(0) - (int32Eq basex basey) && - let rec check i = (i >= lenx) || (GenericEqualityObj er iec ((x.GetValue(basex + i)),(y.GetValue(basey + i))) && check (i + 1)) - check 0 - elif x.Rank = 2 && y.Rank = 2 then - // check lengths - let lenx0 = x.GetLength(0) - let leny0 = y.GetLength(0) - (int32Eq lenx0 leny0) && - let lenx1 = x.GetLength(1) - let leny1 = y.GetLength(1) - (int32Eq lenx1 leny1) && - let basex0 = x.GetLowerBound(0) - let basex1 = x.GetLowerBound(1) - let basey0 = y.GetLowerBound(0) - let basey1 = y.GetLowerBound(1) - (int32Eq basex0 basey0) && - (int32Eq basex1 basey1) && - // check contents - let rec check0 i = - let rec check1 j = (j >= lenx1) || (GenericEqualityObj er iec ((x.GetValue(basex0 + i,basex1 + j)), (y.GetValue(basey0 + i,basey1 + j))) && check1 (j + 1)) - (i >= lenx0) || (check1 0 && check0 (i + 1)) - check0 0 - else - (x.Rank = y.Rank) && - let ndims = x.Rank - // check lengths - let rec precheck k = - (k >= ndims) || - (int32Eq (x.GetLength(k)) (y.GetLength(k)) && - int32Eq (x.GetLowerBound(k)) (y.GetLowerBound(k)) && - precheck (k+1)) - precheck 0 && - let idxs : int32[] = zeroCreate ndims - // check contents - let rec checkN k baseIdx i lim = - (i >= lim) || - (set idxs k (baseIdx + i); - (if k = ndims - 1 - then GenericEqualityObj er iec ((x.GetValue(idxs)),(y.GetValue(idxs))) - else check (k+1)) && - checkN k baseIdx (i + 1) lim) - and check k = - (k >= ndims) || - (let baseIdx = x.GetLowerBound(k) - checkN k baseIdx 0 (x.GetLength(k))) - - check 0 -#else if x.Rank = 1 && y.Rank = 1 then // check lengths let lenx = x.LongLength @@ -1468,9 +1311,9 @@ namespace Microsoft.FSharp.Core // check contents let basex = int64 (x.GetLowerBound(0)) let basey = int64 (y.GetLowerBound(0)) - (int64Eq basex basey) && + (int64Eq basex basey) && let rec check i = (i >=. lenx) || (GenericEqualityObj er iec ((x.GetValue(basex +. i)),(y.GetValue(basey +. i))) && check (i +. 1L)) - check 0L + check 0L elif x.Rank = 2 && y.Rank = 2 then // check lengths let lenx0 = x.GetLongLength(0) @@ -1491,16 +1334,16 @@ namespace Microsoft.FSharp.Core (i >=. lenx0) || (check1 0L && check0 (i +. 1L)) check0 0L else - (x.Rank = y.Rank) && + (x.Rank = y.Rank) && let ndims = x.Rank - // check lengths - let rec precheck k = - (k >= ndims) || - (int64Eq (x.GetLongLength(k)) (y.GetLongLength(k)) && - int32Eq (x.GetLowerBound(k)) (y.GetLowerBound(k)) && + // check lengths + let rec precheck k = + (k >= ndims) || + (int64Eq (x.GetLongLength(k)) (y.GetLongLength(k)) && + int32Eq (x.GetLowerBound(k)) (y.GetLowerBound(k)) && precheck (k+1)) precheck 0 && - let idxs : int64[] = zeroCreate ndims + let idxs : int64[] = zeroCreate ndims // check contents let rec checkN k baseIdx i lim = (i >=. lim) || @@ -1513,10 +1356,8 @@ namespace Microsoft.FSharp.Core (k >= ndims) || (let baseIdx = x.GetLowerBound(k) checkN k (int64 baseIdx) 0L (x.GetLongLength(k))) - check 0 -#endif - + /// optimized case: Core implementation of structural equality on object arrays. and GenericEqualityObjArray er iec (x:obj[]) (y:obj[]) : bool = let lenx = x.Length @@ -2960,7 +2801,6 @@ namespace Microsoft.FSharp.Core [] static member op_Implicit(func : ('T -> 'Res) ) = new System.Func<'T,'Res>(func) -#if !FX_NO_CONVERTER [] static member op_Implicit(f : System.Converter<_,_>) : ('T -> 'Res) = (fun t -> f.Invoke(t)) @@ -2970,7 +2810,6 @@ namespace Microsoft.FSharp.Core static member FromConverter (converter: System.Converter<_,_>) : ('T -> 'Res) = (fun t -> converter.Invoke(t)) static member ToConverter (func: ('T -> 'Res) ) = new System.Converter<'T,'Res>(func) -#endif static member InvokeFast (func:FSharpFunc<_,_>, arg1: 'T, arg2: 'Res) = OptimizedClosures.invokeFast2(func, arg1, arg2) @@ -2986,9 +2825,7 @@ namespace Microsoft.FSharp.Core static member inline ToFSharpFunc (action: Action<_>) = (fun t -> action.Invoke(t)) -#if !FX_NO_CONVERTER static member inline ToFSharpFunc (converter : Converter<_,_>) = (fun t -> converter.Invoke(t)) -#endif // Note: this is not made public in the signature, because of conflicts with the Converter overload. // The method remains in case someone is calling it via reflection. @@ -4268,26 +4105,12 @@ namespace Microsoft.FSharp.Core module Attributes = open System.Runtime.CompilerServices -#if !FX_NO_DEFAULT_DEPENDENCY_TYPE - [] -#endif - -#if !FX_NO_COMVISIBLE [] -#endif [] - -#if BE_SECURITY_TRANSPARENT [] // assembly is fully transparent #if CROSS_PLATFORM_COMPILER #else [] // v4 transparency; soon to be the default, but not yet -#endif -#else -#if !FX_NO_SECURITY_PERMISSIONS - // REVIEW: Need to choose a specific permission for the action to be applied to - [] -#endif #endif do () @@ -4654,13 +4477,10 @@ namespace Microsoft.FSharp.Core when ^T : unativeint = (# "conv.ovf.i.un" value : nativeint #) when ^T : byte = (# "conv.ovf.i.un" value : nativeint #) - module OperatorIntrinsics = - + module OperatorIntrinsics = + open System.Collections -#if FX_RESHAPED_REFLECTION - open PrimReflectionAdapters -#endif - + let notStarted() = raise (new System.InvalidOperationException(SR.GetString(SR.enumerationNotStarted))) let alreadyFinished() = raise (new System.InvalidOperationException(SR.GetString(SR.enumerationAlreadyFinished))) diff --git a/src/fsharp/FSharp.Core/prim-types.fsi b/src/fsharp/FSharp.Core/prim-types.fsi index c977af45417..264cf7ff872 100644 --- a/src/fsharp/FSharp.Core/prim-types.fsi +++ b/src/fsharp/FSharp.Core/prim-types.fsi @@ -1342,20 +1342,6 @@ namespace Microsoft.FSharp.Core [] val inline FastCompareTuple5 : comparer:System.Collections.IComparer -> tuple1:('T1 * 'T2 * 'T3 * 'T4 * 'T5) -> tuple2:('T1 * 'T2 * 'T3 * 'T4 * 'T5) -> int -#if FX_RESHAPED_REFLECTION - module internal PrimReflectionAdapters = - - open System.Reflection - - type System.Type with - member inline IsGenericType : bool - member inline IsValueType : bool - member inline GetMethod : string * parameterTypes : Type[] -> MethodInfo - member inline GetProperty : string -> PropertyInfo - member inline IsAssignableFrom : otherType : Type -> bool - member inline GetCustomAttributes : attributeType : Type * inherits: bool -> obj[] -#endif - //------------------------------------------------------------------------- // F# Choice Types @@ -1503,8 +1489,6 @@ namespace Microsoft.FSharp.Core /// 'U abstract member Invoke : func:'T -> 'U -#if !FX_NO_CONVERTER - /// Convert an F# first class function value to a value of type System.Converter /// The input function. /// A System.Converter of the function type. @@ -1524,7 +1508,6 @@ namespace Microsoft.FSharp.Core /// The input System.Converter. /// An F# function of the same type. static member FromConverter : converter:System.Converter<'T,'U> -> ('T -> 'U) -#endif /// Invoke an F# first class function value with five curried arguments. In some cases this /// will result in a more efficient application than applying the arguments successively. @@ -1575,12 +1558,10 @@ namespace Microsoft.FSharp.Core /// The F# function. static member inline ToFSharpFunc : action:Action<'T> -> ('T -> unit) -#if !FX_NO_CONVERTER /// Convert the given Converter delegate object to an F# function value /// The input Converter delegate. /// The F# function. static member inline ToFSharpFunc : converter:Converter<'T,'U> -> ('T -> 'U) -#endif /// Convert the given Action delegate object to an F# function value /// The input Action delegate. diff --git a/src/fsharp/FSharp.Core/printf.fs b/src/fsharp/FSharp.Core/printf.fs index 141c9752da9..59a3687698f 100644 --- a/src/fsharp/FSharp.Core/printf.fs +++ b/src/fsharp/FSharp.Core/printf.fs @@ -47,11 +47,6 @@ module internal PrintfImpl = open Microsoft.FSharp.Collections open LanguagePrimitives.IntrinsicOperators -#if FX_RESHAPED_REFLECTION - open Microsoft.FSharp.Core.PrimReflectionAdapters - open Microsoft.FSharp.Core.ReflectionAdapters -#endif - open System.IO [] @@ -1070,12 +1065,8 @@ module internal PrintfImpl = static member GenericToString<'T>(spec: FormatSpecifier) = let bindingFlags = -#if FX_RESHAPED_REFLECTION - isPlusForPositives spec.Flags // true - show non-public -#else if isPlusForPositives spec.Flags then BindingFlags.Public ||| BindingFlags.NonPublic else BindingFlags.Public -#endif let useZeroWidth = isPadWithZeros spec.Flags let opts = diff --git a/src/fsharp/FSharp.Core/quotations.fs b/src/fsharp/FSharp.Core/quotations.fs index efd9763e1c5..974e32c7678 100644 --- a/src/fsharp/FSharp.Core/quotations.fs +++ b/src/fsharp/FSharp.Core/quotations.fs @@ -20,11 +20,6 @@ open Microsoft.FSharp.Text.StructuredPrintfImpl.TaggedTextOps #nowarn "52" // The value has been copied to ensure the original is not mutated by this operation -#if FX_RESHAPED_REFLECTION -open PrimReflectionAdapters -open ReflectionAdapters -#endif - //-------------------------------------------------------------------------- // RAW quotations - basic data types //-------------------------------------------------------------------------- @@ -56,11 +51,7 @@ module Helpers = let staticBindingFlags = BindingFlags.Static ||| BindingFlags.Public ||| BindingFlags.NonPublic ||| BindingFlags.DeclaredOnly let staticOrInstanceBindingFlags = BindingFlags.Instance ||| BindingFlags.Static ||| BindingFlags.Public ||| BindingFlags.NonPublic ||| BindingFlags.DeclaredOnly let instanceBindingFlags = BindingFlags.Instance ||| BindingFlags.Public ||| BindingFlags.NonPublic ||| BindingFlags.DeclaredOnly -#if FX_RESHAPED_REFLECTION - let publicOrPrivateBindingFlags = true -#else let publicOrPrivateBindingFlags = BindingFlags.Public ||| BindingFlags.NonPublic -#endif let isDelegateType (typ:Type) = if typ.IsSubclassOf(typeof) then @@ -989,11 +980,7 @@ module Patterns = let resT = instFormal tyargTs rty let methInfo = try -#if FX_RESHAPED_REFLECTION - match parentT.GetMethod(nm, argTs) with -#else match parentT.GetMethod(nm, staticOrInstanceBindingFlags, null, argTs, null) with -#endif | null -> None | res -> Some res with :? AmbiguousMatchException -> None @@ -1021,11 +1008,7 @@ module Patterns = let tyArgs = List.toArray tyArgs let methInfo = try -#if FX_RESHAPED_REFLECTION - match ty.GetMethod(nm, argTypes) with -#else match ty.GetMethod(nm, staticOrInstanceBindingFlags, null, argTypes, null) with -#endif | null -> None | res -> Some res with :? AmbiguousMatchException -> None @@ -1138,21 +1121,13 @@ module Patterns = | _ -> null | ctor -> ctor - let bindProp (tc, propName, retType, argTypes, tyargs) = // We search in the instantiated type, rather than searching the generic type. let typ = mkNamedType (tc, tyargs) let argtyps : Type list = argTypes |> inst tyargs let retType : Type = retType |> inst tyargs |> removeVoid -#if FX_RESHAPED_REFLECTION - try - typ.GetProperty(propName, staticOrInstanceBindingFlags) - with :? AmbiguousMatchException -> null // more than one property found with the specified name and matching binding constraints - return null to initiate manual search - |> bindPropBySearchIfCandidateIsNull typ propName retType (Array.ofList argtyps) - |> checkNonNullResult ("propName", String.Format(SR.GetString(SR.QfailedToBindProperty), propName)) // fxcop may not see "propName" as an arg -#else typ.GetProperty(propName, staticOrInstanceBindingFlags, null, retType, Array.ofList argtyps, null) |> checkNonNullResult ("propName", String.Format(SR.GetString(SR.QfailedToBindProperty), propName)) // fxcop may not see "propName" as an arg -#endif + let bindField (tc, fldName, tyargs) = let typ = mkNamedType (tc, tyargs) typ.GetField(fldName, staticOrInstanceBindingFlags) |> checkNonNullResult ("fldName", String.Format(SR.GetString(SR.QfailedToBindField), fldName)) // fxcop may not see "fldName" as an arg @@ -1163,26 +1138,12 @@ module Patterns = let bindGenericCtor (tc:Type, argTypes:Instantiable) = let argtyps = instFormal (getGenericArguments tc) argTypes -#if FX_RESHAPED_REFLECTION - let argTypes = Array.ofList argtyps - tc.GetConstructor argTypes - |> bindCtorBySearchIfCandidateIsNull tc argTypes - |> checkNonNullResult ("tc", SR.GetString(SR.QfailedToBindConstructor)) -#else tc.GetConstructor(instanceBindingFlags, null, Array.ofList argtyps, null) |> checkNonNullResult ("tc", SR.GetString(SR.QfailedToBindConstructor)) -#endif let bindCtor (tc, argTypes:Instantiable, tyargs) = let typ = mkNamedType (tc, tyargs) let argtyps = argTypes |> inst tyargs -#if FX_RESHAPED_REFLECTION - let argTypes = Array.ofList argtyps - typ.GetConstructor argTypes - |> bindCtorBySearchIfCandidateIsNull typ argTypes - |> checkNonNullResult ("tc", SR.GetString(SR.QfailedToBindConstructor)) -#else typ.GetConstructor(instanceBindingFlags, null, Array.ofList argtyps, null) |> checkNonNullResult ("tc", SR.GetString(SR.QfailedToBindConstructor)) -#endif let chop n xs = if n < 0 then invalidArg "n" (SR.GetString(SR.inputMustBeNonNegative)) @@ -1358,11 +1319,7 @@ module Patterns = if a = "" then mscorlib elif a = "." then st.localAssembly else -#if FX_RESHAPED_REFLECTION - match System.Reflection.Assembly.Load(AssemblyName a) with -#else match System.Reflection.Assembly.Load a with -#endif | null -> raise <| System.InvalidOperationException(String.Format(SR.GetString(SR.QfailedToBindAssembly), a.ToString())) | assembly -> assembly @@ -1684,14 +1641,6 @@ module Patterns = let decodedTopResources = new Dictionary(10, HashIdentity.Structural) -#if FX_NO_REFLECTION_MODULE_HANDLES // not available on Silverlight - [] - type ModuleHandle = ModuleHandle of string * string - type System.Reflection.Module with - member x.ModuleHandle = ModuleHandle(x.Assembly.FullName, x.Name) -#else - type ModuleHandle = System.ModuleHandle -#endif [] type ReflectedDefinitionTableKey = @@ -1735,11 +1684,7 @@ module Patterns = not (decodedTopResources.ContainsKey((assem, resourceName))) then let cmaAttribForResource = -#if FX_RESHAPED_REFLECTION - CustomAttributeExtensions.GetCustomAttributes(assem, typeof) |> Seq.toArray -#else assem.GetCustomAttributes(typeof, false) -#endif |> (function null -> [| |] | x -> x) |> Array.tryPick (fun ca -> match ca with diff --git a/src/fsharp/FSharp.Core/reflect.fs b/src/fsharp/FSharp.Core/reflect.fs index 2024be205bf..f9e0a9daa8e 100644 --- a/src/fsharp/FSharp.Core/reflect.fs +++ b/src/fsharp/FSharp.Core/reflect.fs @@ -27,11 +27,6 @@ module internal ReflectionUtils = [] module internal Impl = -#if FX_RESHAPED_REFLECTION - open PrimReflectionAdapters - open ReflectionAdapters -#endif - let getBindingFlags allowAccess = ReflectionUtils.toBindingFlags (defaultArg allowAccess false) let inline checkNonNull argName (v: 'T) = @@ -56,31 +51,18 @@ module internal Impl = //----------------------------------------------------------------- // GENERAL UTILITIES -#if FX_RESHAPED_REFLECTION - let instanceFieldFlags = BindingFlags.Instance - let instancePropertyFlags = BindingFlags.Instance - let staticPropertyFlags = BindingFlags.Static - let staticFieldFlags = BindingFlags.Static - let staticMethodFlags = BindingFlags.Static -#else let instanceFieldFlags = BindingFlags.GetField ||| BindingFlags.Instance let instancePropertyFlags = BindingFlags.GetProperty ||| BindingFlags.Instance let staticPropertyFlags = BindingFlags.GetProperty ||| BindingFlags.Static let staticFieldFlags = BindingFlags.GetField ||| BindingFlags.Static let staticMethodFlags = BindingFlags.Static -#endif - let getInstancePropertyInfo (typ: Type, propName, bindingFlags) = typ.GetProperty(propName, instancePropertyFlags ||| bindingFlags) let getInstancePropertyInfos (typ, names, bindingFlags) = names |> Array.map (fun nm -> getInstancePropertyInfo (typ, nm, bindingFlags)) - let getInstancePropertyReader (typ: Type, propName, bindingFlags) = match getInstancePropertyInfo(typ, propName, bindingFlags) with | null -> None -#if FX_RESHAPED_REFLECTION - | prop -> Some(fun (obj: obj) -> prop.GetValue (obj, null)) -#else | prop -> Some(fun (obj: obj) -> prop.GetValue (obj, instancePropertyFlags ||| bindingFlags, null, null, null)) -#endif + //----------------------------------------------------------------- // ATTRIBUTE DECOMPILATION @@ -95,7 +77,6 @@ module internal Impl = | None -> failwith "no compilation mapping attribute" | Some a -> a -#if !FX_NO_REFLECTION_ONLY let cmaName = typeof.FullName let assemblyName = typeof.Assembly.GetName().Name let _ = assert (assemblyName = "FSharp.Core") @@ -121,33 +102,26 @@ module internal Impl = match tryFindCompilationMappingAttributeFromData attrs with | None -> failwith "no compilation mapping attribute" | Some a -> a -#endif let tryFindCompilationMappingAttributeFromType (typ: Type) = -#if !FX_NO_REFLECTION_ONLY let assem = typ.Assembly if (not (isNull assem)) && assem.ReflectionOnly then tryFindCompilationMappingAttributeFromData ( typ.GetCustomAttributesData()) else -#endif tryFindCompilationMappingAttribute ( typ.GetCustomAttributes (typeof, false)) let tryFindCompilationMappingAttributeFromMemberInfo (info: MemberInfo) = -#if !FX_NO_REFLECTION_ONLY let assem = info.DeclaringType.Assembly if (not (isNull assem)) && assem.ReflectionOnly then tryFindCompilationMappingAttributeFromData (info.GetCustomAttributesData()) else -#endif tryFindCompilationMappingAttribute (info.GetCustomAttributes (typeof, false)) let findCompilationMappingAttributeFromMemberInfo (info: MemberInfo) = -#if !FX_NO_REFLECTION_ONLY let assem = info.DeclaringType.Assembly if (not (isNull assem)) && assem.ReflectionOnly then findCompilationMappingAttributeFromData (info.GetCustomAttributesData()) else -#endif findCompilationMappingAttribute (info.GetCustomAttributes (typeof, false)) let sequenceNumberOfMember (x: MemberInfo) = let (_, n, _) = findCompilationMappingAttributeFromMemberInfo x in n @@ -285,11 +259,8 @@ module internal Impl = let getUnionCaseRecordReader (typ: Type, tag: int, bindingFlags) = let props = fieldsPropsOfUnionCase (typ, tag, bindingFlags) -#if FX_RESHAPED_REFLECTION - (fun (obj: obj) -> props |> Array.map (fun prop -> prop.GetValue (obj, null))) -#else (fun (obj: obj) -> props |> Array.map (fun prop -> prop.GetValue (obj, bindingFlags, null, null, null))) -#endif + let getUnionTagReader (typ: Type, bindingFlags) : (obj -> int) = if isOptionType typ then (fun (obj: obj) -> match obj with null -> 0 | _ -> 1) @@ -302,20 +273,12 @@ module internal Impl = | Some reader -> (fun (obj: obj) -> reader obj :?> int) | None -> (fun (obj: obj) -> -#if FX_RESHAPED_REFLECTION - let m2b = typ.GetMethod("GetTag", [| typ |]) -#else let m2b = typ.GetMethod("GetTag", BindingFlags.Static ||| bindingFlags, null, [| typ |], null) -#endif m2b.Invoke(null, [|obj|]) :?> int) let getUnionTagMemberInfo (typ: Type, bindingFlags) = match getInstancePropertyInfo (typ, "Tag", bindingFlags) with -#if FX_RESHAPED_REFLECTION - | null -> (typ.GetMethod("GetTag") :> MemberInfo) -#else | null -> (typ.GetMethod("GetTag", BindingFlags.Static ||| bindingFlags) :> MemberInfo) -#endif | info -> (info :> MemberInfo) let isUnionCaseNullary (typ: Type, tag: int, bindingFlags) = @@ -335,11 +298,8 @@ module internal Impl = let getUnionCaseConstructor (typ: Type, tag: int, bindingFlags) = let meth = getUnionCaseConstructorMethod (typ, tag, bindingFlags) (fun args -> -#if FX_RESHAPED_REFLECTION - meth.Invoke(null, args)) -#else meth.Invoke(null, BindingFlags.Static ||| BindingFlags.InvokeMethod ||| bindingFlags, null, args, null)) -#endif + let checkUnionType (unionType, bindingFlags) = checkNonNull "unionType" unionType if not (isUnionType (unionType, bindingFlags)) then @@ -513,18 +473,10 @@ module internal Impl = let ctor = if typ.IsValueType then let fields = typ.GetFields (instanceFieldFlags ||| BindingFlags.Public) |> orderTupleFields -#if FX_RESHAPED_REFLECTION - typ.GetConstructor(fields |> Array.map (fun fi -> fi.FieldType)) -#else typ.GetConstructor(BindingFlags.Public ||| BindingFlags.Instance, null, fields |> Array.map (fun fi -> fi.FieldType), null) -#endif else let props = typ.GetProperties() |> orderTupleProperties -#if FX_RESHAPED_REFLECTION - typ.GetConstructor(props |> Array.map (fun p -> p.PropertyType)) -#else typ.GetConstructor(BindingFlags.Public ||| BindingFlags.Instance, null, props |> Array.map (fun p -> p.PropertyType), null) -#endif match ctor with | null -> raise (ArgumentException (String.Format (SR.GetString (SR.invalidTupleTypeConstructorNotDefined), typ.FullName))) | _ -> () @@ -533,11 +485,7 @@ module internal Impl = let getTupleCtor(typ: Type) = let ctor = getTupleConstructorMethod typ (fun (args: obj[]) -> -#if FX_RESHAPED_REFLECTION - ctor.Invoke args) -#else ctor.Invoke(BindingFlags.InvokeMethod ||| BindingFlags.Instance ||| BindingFlags.Public, null, args, null)) -#endif let rec getTupleReader (typ: Type) = let etys = typ.GetGenericArguments() @@ -639,11 +587,7 @@ module internal Impl = let getRecordConstructorMethod(typ: Type, bindingFlags) = let props = fieldPropsOfRecordType(typ, bindingFlags) -#if FX_RESHAPED_REFLECTION - let ctor = typ.GetConstructor(props |> Array.map (fun p -> p.PropertyType)) -#else let ctor = typ.GetConstructor(BindingFlags.Instance ||| bindingFlags, null, props |> Array.map (fun p -> p.PropertyType), null) -#endif match ctor with | null -> raise <| ArgumentException (String.Format (SR.GetString (SR.invalidRecordTypeConstructorNotDefined), typ.FullName)) | _ -> () @@ -652,11 +596,7 @@ module internal Impl = let getRecordConstructor(typ: Type, bindingFlags) = let ctor = getRecordConstructorMethod(typ, bindingFlags) (fun (args: obj[]) -> -#if FX_RESHAPED_REFLECTION - ctor.Invoke args) -#else ctor.Invoke(BindingFlags.InvokeMethod ||| BindingFlags.Instance ||| bindingFlags, null, args, null)) -#endif /// EXCEPTION DECOMPILATION // Check the base type - if it is also an F# type then @@ -703,10 +643,6 @@ module internal Impl = if not (isTupleType tupleType) then invalidArg argName (String.Format (SR.GetString (SR.notATupleType), tupleType.FullName)) -#if FX_RESHAPED_REFLECTION -open ReflectionAdapters -#endif - [] type UnionCaseInfo(typ: System.Type, tag: int) = diff --git a/src/fsharp/FSharp.Core/seq.fs b/src/fsharp/FSharp.Core/seq.fs index ab48146b631..97326e7315a 100644 --- a/src/fsharp/FSharp.Core/seq.fs +++ b/src/fsharp/FSharp.Core/seq.fs @@ -1071,11 +1071,7 @@ namespace Microsoft.FSharp.Collections [] let groupBy (projection:'T->'Key) (source:seq<'T>) = -#if FX_RESHAPED_REFLECTION - if (typeof<'Key>).GetTypeInfo().IsValueType -#else if typeof<'Key>.IsValueType -#endif then mkDelayedSeq (fun () -> groupByValueType projection source) else mkDelayedSeq (fun () -> groupByRefType projection source) @@ -1164,11 +1160,7 @@ namespace Microsoft.FSharp.Collections let countBy (projection:'T->'Key) (source:seq<'T>) = checkNonNull "source" source -#if FX_RESHAPED_REFLECTION - if (typeof<'Key>).GetTypeInfo().IsValueType -#else if typeof<'Key>.IsValueType -#endif then mkDelayedSeq (fun () -> countByValueType projection source) else mkDelayedSeq (fun () -> countByRefType projection source) diff --git a/src/fsharp/FSharp.Core/set.fs b/src/fsharp/FSharp.Core/set.fs index f0c88dcf581..5da5152f296 100644 --- a/src/fsharp/FSharp.Core/set.fs +++ b/src/fsharp/FSharp.Core/set.fs @@ -512,23 +512,20 @@ module internal SetTree = [>)>] [] [] -type Set<[]'T when 'T: comparison >(comparer:IComparer<'T>, tree: SetTree<'T>) = +type Set<[]'T when 'T: comparison >(comparer:IComparer<'T>, tree: SetTree<'T>) = -#if !FX_NO_BINARY_SERIALIZATION [] - // NOTE: This type is logically immutable. This field is only mutated during deserialization. - let mutable comparer = comparer + // NOTE: This type is logically immutable. This field is only mutated during deserialization. + let mutable comparer = comparer [] - // NOTE: This type is logically immutable. This field is only mutated during deserialization. - let mutable tree = tree + // NOTE: This type is logically immutable. This field is only mutated during deserialization. + let mutable tree = tree - // NOTE: This type is logically immutable. This field is only mutated during serialization and deserialization. - // - // WARNING: The compiled name of this field may never be changed because it is part of the logical + // NOTE: This type is logically immutable. This field is only mutated during serialization and deserialization. + // WARNING: The compiled name of this field may never be changed because it is part of the logical // WARNING: permanent serialization format for this type. - let mutable serializedData = null -#endif + let mutable serializedData = null // We use .NET generics per-instantiation static fields to avoid allocating a new object for each empty // set (it is just a lookup into a .NET table of type-instantiation-indexed static fields). @@ -537,7 +534,6 @@ type Set<[]'T when 'T: comparison >(comparer:IComparer<'T let comparer = LanguagePrimitives.FastGenericComparer<'T> Set<'T>(comparer, SetEmpty) -#if !FX_NO_BINARY_SERIALIZATION [] member __.OnSerializing(context: System.Runtime.Serialization.StreamingContext) = ignore context @@ -554,7 +550,6 @@ type Set<[]'T when 'T: comparison >(comparer:IComparer<'T comparer <- LanguagePrimitives.FastGenericComparer<'T> tree <- SetTree.ofArray comparer serializedData serializedData <- null -#endif [] member internal set.Comparer = comparer diff --git a/src/fsharp/FSharp.Core/xlf/FSCore.cs.xlf b/src/fsharp/FSharp.Core/xlf/FSCore.cs.xlf index 7c8e97d6501..e1e2a27ab6e 100644 --- a/src/fsharp/FSharp.Core/xlf/FSCore.cs.xlf +++ b/src/fsharp/FSharp.Core/xlf/FSCore.cs.xlf @@ -707,6 +707,11 @@ Toto není platný výraz dotazu. V dotazu byla použita konstrukce {0}, která není rozpoznána překladačem dotazu z jazyka F# do jazyka LINQ. Prostudujte si specifikace povolených dotazů a zvažte přesunutí některých operací mimo výraz dotazu. + + maxDegreeOfParallelism must be positive, was {0} + maxDegreeOfParallelism must be positive, was {0} + + \ No newline at end of file diff --git a/src/fsharp/FSharp.Core/xlf/FSCore.de.xlf b/src/fsharp/FSharp.Core/xlf/FSCore.de.xlf index cfcd71290fa..be95b723e68 100644 --- a/src/fsharp/FSharp.Core/xlf/FSCore.de.xlf +++ b/src/fsharp/FSharp.Core/xlf/FSCore.de.xlf @@ -707,6 +707,11 @@ Dies ist kein gültiger Abfrageausdruck. Das Konstrukt "{0}" wurde in einer Abfrage verwendet, wird jedoch vom F#-to-LINQ-Abfragekonvertierungsprogramm nicht erkannt. Überprüfen Sie die Spezifikation zulässiger Abfragen, und entfernen Sie unter Umständen einige Operationen aus dem Abfrageausdruck. + + maxDegreeOfParallelism must be positive, was {0} + maxDegreeOfParallelism must be positive, was {0} + + \ No newline at end of file diff --git a/src/fsharp/FSharp.Core/xlf/FSCore.es.xlf b/src/fsharp/FSharp.Core/xlf/FSCore.es.xlf index 46a617777f6..ad05289fb66 100644 --- a/src/fsharp/FSharp.Core/xlf/FSCore.es.xlf +++ b/src/fsharp/FSharp.Core/xlf/FSCore.es.xlf @@ -707,6 +707,11 @@ Esta no es una expresión de consulta válida. La construcción '{0}' se usó en una consulta, pero el traductor de consultas F#-to-LINQ no la reconoce. Compruebe la especificación de consultas permitidas y considere mover algunas de las operaciones fuera de la expresión de consulta. + + maxDegreeOfParallelism must be positive, was {0} + maxDegreeOfParallelism must be positive, was {0} + + \ No newline at end of file diff --git a/src/fsharp/FSharp.Core/xlf/FSCore.fr.xlf b/src/fsharp/FSharp.Core/xlf/FSCore.fr.xlf index 09dfb48a62c..46f595fa219 100644 --- a/src/fsharp/FSharp.Core/xlf/FSCore.fr.xlf +++ b/src/fsharp/FSharp.Core/xlf/FSCore.fr.xlf @@ -707,6 +707,11 @@ Cette expression de requête n'est pas valide. La construction '{0}' a été utilisée dans une requête, mais n'est pas reconnue par le traducteur de requête F#-to-LINQ. Vérifiez la spécification des requêtes autorisées et envisagez de retirer certaines opérations de l'expression de requête. + + maxDegreeOfParallelism must be positive, was {0} + maxDegreeOfParallelism must be positive, was {0} + + \ No newline at end of file diff --git a/src/fsharp/FSharp.Core/xlf/FSCore.it.xlf b/src/fsharp/FSharp.Core/xlf/FSCore.it.xlf index 5598638a5f4..ea57def3beb 100644 --- a/src/fsharp/FSharp.Core/xlf/FSCore.it.xlf +++ b/src/fsharp/FSharp.Core/xlf/FSCore.it.xlf @@ -707,6 +707,11 @@ Espressione di query non valida. Il costrutto '{0}' è stato utilizzato in una query ma non è stato riconosciuto dal traduttore di query da F# a LINQ. Verificare le specifiche delle query consentite e provare a spostare alcune operazioni all'esterno dell'espressione di query. + + maxDegreeOfParallelism must be positive, was {0} + maxDegreeOfParallelism must be positive, was {0} + + \ No newline at end of file diff --git a/src/fsharp/FSharp.Core/xlf/FSCore.ja.xlf b/src/fsharp/FSharp.Core/xlf/FSCore.ja.xlf index d33e013cb6a..a62609fafb1 100644 --- a/src/fsharp/FSharp.Core/xlf/FSCore.ja.xlf +++ b/src/fsharp/FSharp.Core/xlf/FSCore.ja.xlf @@ -707,6 +707,11 @@ これは有効なクエリ式ではありません。クエリで構造 '{0}' が使用されていますが、F# から LINQ へのクエリ トランスレーターに認識されません。許可されたクエリの仕様を確認し、一部の操作をクエリ式の外に移動することを検討してください。 + + maxDegreeOfParallelism must be positive, was {0} + maxDegreeOfParallelism must be positive, was {0} + + \ No newline at end of file diff --git a/src/fsharp/FSharp.Core/xlf/FSCore.ko.xlf b/src/fsharp/FSharp.Core/xlf/FSCore.ko.xlf index ed24759baaa..018fd4ac35a 100644 --- a/src/fsharp/FSharp.Core/xlf/FSCore.ko.xlf +++ b/src/fsharp/FSharp.Core/xlf/FSCore.ko.xlf @@ -707,6 +707,11 @@ 올바른 쿼리 식이 아닙니다. '{0}' 구문이 쿼리에 사용되었지만 F#-to-LINQ 쿼리 변환기에서 인식할 수 없습니다. 허용되는 쿼리의 사양을 확인하고 일부 연산을 쿼리 식 외부로 이동하세요. + + maxDegreeOfParallelism must be positive, was {0} + maxDegreeOfParallelism must be positive, was {0} + + \ No newline at end of file diff --git a/src/fsharp/FSharp.Core/xlf/FSCore.pl.xlf b/src/fsharp/FSharp.Core/xlf/FSCore.pl.xlf index 3d869bc263b..67c614650b9 100644 --- a/src/fsharp/FSharp.Core/xlf/FSCore.pl.xlf +++ b/src/fsharp/FSharp.Core/xlf/FSCore.pl.xlf @@ -707,6 +707,11 @@ To nie jest prawidłowe wyrażenie zapytania. Konstrukcja „{0}” została użyta w zapytaniu, ale nie rozpoznaje jej translator zapytań z języka F# na język LINQ. Sprawdź specyfikacje dozwolonych zapytań i rozważ przeniesienie niektórych operacji poza wyrażenie zapytania. + + maxDegreeOfParallelism must be positive, was {0} + maxDegreeOfParallelism must be positive, was {0} + + \ No newline at end of file diff --git a/src/fsharp/FSharp.Core/xlf/FSCore.pt-BR.xlf b/src/fsharp/FSharp.Core/xlf/FSCore.pt-BR.xlf index 48c0450f629..01192de3620 100644 --- a/src/fsharp/FSharp.Core/xlf/FSCore.pt-BR.xlf +++ b/src/fsharp/FSharp.Core/xlf/FSCore.pt-BR.xlf @@ -707,6 +707,11 @@ Expressão de consulta inválida. A construção '{0}' foi usada em uma consulta, mas não é reconhecida pelo conversor de consultas F#-to-LINQ. Verifique a especificação de consultas permitidas e considere remover algumas das operações da expressão de consulta. + + maxDegreeOfParallelism must be positive, was {0} + maxDegreeOfParallelism must be positive, was {0} + + \ No newline at end of file diff --git a/src/fsharp/FSharp.Core/xlf/FSCore.ru.xlf b/src/fsharp/FSharp.Core/xlf/FSCore.ru.xlf index cb488ded3eb..81aa2e85617 100644 --- a/src/fsharp/FSharp.Core/xlf/FSCore.ru.xlf +++ b/src/fsharp/FSharp.Core/xlf/FSCore.ru.xlf @@ -707,6 +707,11 @@ Недопустимое выражение запроса. Конструкция "{0}" использовалась запросе, но не была распознана транслятором запросов из F# в LINQ. Проверьте спецификацию разрешенных запросов и попробуйте вынести часть операций за пределы выражения запроса. + + maxDegreeOfParallelism must be positive, was {0} + maxDegreeOfParallelism must be positive, was {0} + + \ No newline at end of file diff --git a/src/fsharp/FSharp.Core/xlf/FSCore.tr.xlf b/src/fsharp/FSharp.Core/xlf/FSCore.tr.xlf index 2baf7f4b07b..ab262b8e56d 100644 --- a/src/fsharp/FSharp.Core/xlf/FSCore.tr.xlf +++ b/src/fsharp/FSharp.Core/xlf/FSCore.tr.xlf @@ -707,6 +707,11 @@ Bu geçerli bir sorgu ifadesi değil. '{0}' yapısı sorguda kullanıldı, ancak F#-to-LINQ çevirmeni tarafından tanınmıyor. İzin verilen soruların belirtimini denetleyin ve işlemlerden bazılarını sorgu ifadesinin dışına taşımayı düşünün. + + maxDegreeOfParallelism must be positive, was {0} + maxDegreeOfParallelism must be positive, was {0} + + \ No newline at end of file diff --git a/src/fsharp/FSharp.Core/xlf/FSCore.zh-Hans.xlf b/src/fsharp/FSharp.Core/xlf/FSCore.zh-Hans.xlf index 9bac5ce1a8b..58fcba36d97 100644 --- a/src/fsharp/FSharp.Core/xlf/FSCore.zh-Hans.xlf +++ b/src/fsharp/FSharp.Core/xlf/FSCore.zh-Hans.xlf @@ -707,6 +707,11 @@ 这不是有效的查询表达式。查询中使用了构造“{0}”,但 F#-LINQ 查询转换器无法识别该构造。请查看有效查询的规范,考虑是否将部分运算移到查询表达式之外。 + + maxDegreeOfParallelism must be positive, was {0} + maxDegreeOfParallelism must be positive, was {0} + + \ No newline at end of file diff --git a/src/fsharp/FSharp.Core/xlf/FSCore.zh-Hant.xlf b/src/fsharp/FSharp.Core/xlf/FSCore.zh-Hant.xlf index e75ede8758c..7ebdf213bf5 100644 --- a/src/fsharp/FSharp.Core/xlf/FSCore.zh-Hant.xlf +++ b/src/fsharp/FSharp.Core/xlf/FSCore.zh-Hant.xlf @@ -707,6 +707,11 @@ 這不是有效的查詢運算式。查詢中使用了建構 '{0}',但 F#-to-LINQ 查詢翻譯工具無法加以辨認。請檢查所允許之查詢的規格,並考慮將一些運算移出查詢運算式。 + + maxDegreeOfParallelism must be positive, was {0} + maxDegreeOfParallelism must be positive, was {0} + + \ No newline at end of file diff --git a/src/fsharp/IlxGen.fs b/src/fsharp/IlxGen.fs index 826045231ac..81f4db67748 100644 --- a/src/fsharp/IlxGen.fs +++ b/src/fsharp/IlxGen.fs @@ -7380,13 +7380,10 @@ and GenExnDef cenv mgbuf eenv m (exnc: Tycon) = mkLdarg 2us mkNormalCall (mkILCtorMethSpecForTy (g.iltyp_Exception, [serializationInfoType; streamingContextType])) ], None)) - -//#if BE_SECURITY_TRANSPARENT + [ilCtorDefForSerialziation] -//#else (* let getObjectDataMethodForSerialization = - let ilMethodDef = mkILNonGenericVirtualMethod ("GetObjectData", ILMemberAccess.Public, @@ -7414,7 +7411,7 @@ and GenExnDef cenv mgbuf eenv m (exnc: Tycon) = | _ -> [] let ilTypeName = tref.Name - + let interfaces = exnc.ImmediateInterfaceTypesOfFSharpTycon |> List.map (GenType cenv.amap m eenv.tyenv) let tdef = mkILGenericClass diff --git a/src/fsharp/LanguageFeatures.fs b/src/fsharp/LanguageFeatures.fs new file mode 100644 index 00000000000..4257cbca9a2 --- /dev/null +++ b/src/fsharp/LanguageFeatures.fs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +/// Coordinating compiler operations - configuration, loading initial context, reporting errors etc. +module internal FSharp.Compiler.Features + +open System + +//------------------------------------------------------------------------------------------------------------------ +// Language version command line switch +//------------------------------------------------------------------------------------------------------------------ +// Add your features to this List - in code use languageVersion.SupportsFeature(LanguageFeatures.yourFeature) +// a return value of false means your feature is not supported by the user's language selection +// All new language features added from now on must be protected by this. +// Note: +// * The fslang design process will require a decision about feature name and whether it is required. +// * When a feature is assigned a release language, we will scrub the code of feature references and apply +// the Release Language version. + +/// LanguageFeature enumeration +[] +type LanguageFeature = + | LanguageVersion46 = 0 + | LanguageVersion47 = 1 + | SingleUnderscorePattern = 2 + | WildCardInForLoop = 3 + | RelaxWhitespace = 4 + +/// LanguageVersion management +type LanguageVersion (specifiedVersion) = + + // When we increment language versions here preview is higher than current RTM version + static let languageVersion46 = 4.6m + static let languageVersion47 = 4.7m + + static let previewVersion = languageVersion47 // Language version when preview specified + static let defaultVersion = languageVersion46 // Language version when default specified + static let latestVersion = defaultVersion // Language version when latest specified + static let latestMajorVersion = languageVersion46 // Language version when latestmajor specified + + static let validOptions = [| "preview"; "default"; "latest"; "latestmajor" |] + static let languageVersions = set [| latestVersion |] + + static let features = dict [| + // Add new LanguageVersions here ... + LanguageFeature.LanguageVersion47, 4.7m + LanguageFeature.LanguageVersion46, 4.6m + LanguageFeature.SingleUnderscorePattern, previewVersion + LanguageFeature.WildCardInForLoop, previewVersion + LanguageFeature.RelaxWhitespace, previewVersion + + // Add new LanguageFeatures here ... + |] + + let specified = + match specifiedVersion with + | "?" -> 0m + | "preview" -> previewVersion + | "default" -> latestVersion + | "latest" -> latestVersion + | "latestmajor" -> latestMajorVersion + | _ -> + match Decimal.TryParse(specifiedVersion) with + | true, v -> v + | _ -> 0m + + /// Check if this feature is supported by the selected langversion + member __.SupportsFeature featureId = + match features.TryGetValue featureId with + | true, v -> v <= specified + | false, _ -> false + + /// Does the languageVersion support this version string + member __.ContainsVersion version = + match version with + | "?" | "preview" | "default" | "latest" | "latestmajor" -> true + | _ -> + match Decimal.TryParse(specifiedVersion) with + | true, v -> languageVersions.Contains v + | _ -> false + + /// Get a list of valid strings for help text + member __.ValidOptions = validOptions + + /// Get a list of valid versions for help text + member __.ValidVersions = [| + for v in languageVersions |> Seq.sort do + let label = if v = defaultVersion || v = latestVersion then "(Default)" else "" + yield sprintf "%M %s" v label + |] + diff --git a/src/fsharp/LanguageFeatures.fsi b/src/fsharp/LanguageFeatures.fsi new file mode 100644 index 00000000000..9d1690c7d82 --- /dev/null +++ b/src/fsharp/LanguageFeatures.fsi @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +/// Coordinating compiler operations - configuration, loading initial context, reporting errors etc. +module internal FSharp.Compiler.Features + +/// LanguageFeature enumeration +[] +type LanguageFeature = + | LanguageVersion46 = 0 + | LanguageVersion47 = 1 + | SingleUnderscorePattern = 2 + | WildCardInForLoop = 3 + | RelaxWhitespace = 4 + +/// LanguageVersion management +type LanguageVersion = + + /// Create a LanguageVersion management object + new: string -> LanguageVersion + + /// Get the list of valid versions + member ContainsVersion: string -> bool + + /// Does the specified LanguageVersion support the specified feature + member SupportsFeature: LanguageFeature -> bool + + /// Get the list of valid versions + member ValidVersions: string array + + /// Get the list of valid options + member ValidOptions: string array diff --git a/src/fsharp/LexFilter.fs b/src/fsharp/LexFilter.fs index 7cfdbcf494a..e37b0c35b1b 100755 --- a/src/fsharp/LexFilter.fs +++ b/src/fsharp/LexFilter.fs @@ -12,9 +12,9 @@ open FSharp.Compiler.AbstractIL.Internal.Library open FSharp.Compiler.AbstractIL.Diagnostics open FSharp.Compiler.Ast open FSharp.Compiler.ErrorLogger +open FSharp.Compiler.Features open FSharp.Compiler.Parser open FSharp.Compiler.Lexhelp - let debug = false let stringOfPos (p: Position) = sprintf "(%d:%d)" p.OriginalLine p.Column @@ -764,8 +764,17 @@ type LexFilterImpl (lightSyntaxStatus: LightSyntaxStatus, compilingFsLib, lexer, // 'type C = class ... ' limited by 'type' // 'type C = interface ... ' limited by 'type' // 'type C = struct ... ' limited by 'type' - | _, (CtxtParen ((CLASS | STRUCT | INTERFACE), _) :: CtxtSeqBlock _ :: (CtxtTypeDefns _ as limitCtxt) :: _) - -> PositionWithColumn(limitCtxt.StartPos, limitCtxt.StartCol + 1) + | _, (CtxtParen ((CLASS | STRUCT | INTERFACE), _) :: CtxtSeqBlock _ :: (CtxtTypeDefns _ as limitCtxt) :: _) + -> PositionWithColumn(limitCtxt.StartPos, limitCtxt.StartCol + 1) + + // 'type C(' limited by 'type' + | _, (CtxtSeqBlock _ :: CtxtParen(LPAREN, _) :: (CtxtTypeDefns _ as limitCtxt) :: _ ) + // 'static member C(' limited by 'static', likewise others + | _, (CtxtSeqBlock _ :: CtxtParen(LPAREN, _) :: (CtxtMemberHead _ as limitCtxt) :: _ ) + // 'static member P with get() = ' limited by 'static', likewise others + | _, (CtxtWithAsLet _ :: (CtxtMemberHead _ as limitCtxt) :: _ ) + when lexbuf.SupportsFeature LanguageFeature.RelaxWhitespace + -> PositionWithColumn(limitCtxt.StartPos, limitCtxt.StartCol + 1) // REVIEW: document these | _, (CtxtSeqBlock _ :: CtxtParen((BEGIN | LPAREN | LBRACK | LBRACK_BAR), _) :: CtxtVanilla _ :: (CtxtSeqBlock _ as limitCtxt) :: _) @@ -780,6 +789,7 @@ type LexFilterImpl (lightSyntaxStatus: LightSyntaxStatus, compilingFsLib, lexer, // else expr | (CtxtIf _ | CtxtElse _ | CtxtThen _), (CtxtIf _ as limitCtxt) :: _rest -> PositionWithColumn(limitCtxt.StartPos, limitCtxt.StartCol) + // Permitted inner-construct precise block alignment: // while ... // do expr diff --git a/src/fsharp/UnicodeLexing.fs b/src/fsharp/UnicodeLexing.fs index bb1c26dabf2..d34092940e2 100644 --- a/src/fsharp/UnicodeLexing.fs +++ b/src/fsharp/UnicodeLexing.fs @@ -7,22 +7,23 @@ module internal FSharp.Compiler.UnicodeLexing // open FSharp.Compiler.AbstractIL.Internal.Library +open FSharp.Compiler.Features open Internal.Utilities -open System.IO +open System.IO open Internal.Utilities.Text.Lexing type Lexbuf = LexBuffer -let StringAsLexbuf (s:string) : Lexbuf = - LexBuffer<_>.FromChars (s.ToCharArray()) - -let FunctionAsLexbuf (bufferFiller: char[] * int * int -> int) : Lexbuf = - LexBuffer<_>.FromFunction bufferFiller +let StringAsLexbuf (supportsFeature: Features.LanguageFeature -> bool, s:string) : Lexbuf = + LexBuffer<_>.FromChars (supportsFeature, s.ToCharArray()) + +let FunctionAsLexbuf (supportsFeature: Features.LanguageFeature -> bool, bufferFiller: char[] * int * int -> int) : Lexbuf = + LexBuffer<_>.FromFunction(supportsFeature, bufferFiller) + +let SourceTextAsLexbuf (supportsFeature: Features.LanguageFeature -> bool, sourceText) = + LexBuffer.FromSourceText(supportsFeature, sourceText) -let SourceTextAsLexbuf sourceText = - LexBuffer.FromSourceText(sourceText) - // The choice of 60 retries times 50 ms is not arbitrary. The NTFS FILETIME structure // uses 2 second resolution for LastWriteTime. We retry long enough to surpass this threshold // plus 1 second. Once past the threshold the incremental builder will be able to retry asynchronously based @@ -41,7 +42,7 @@ let numRetries = 60 /// we can't just return the LexBuffer object, since the file it wraps wouldn't /// get closed when we're finished with the LexBuffer. Hence we return the stream, /// the reader and the LexBuffer. The caller should dispose the first two when done. -let UnicodeFileAsLexbuf (filename,codePage : int option, retryLocked:bool) : Lexbuf = +let UnicodeFileAsLexbuf (supportsFeature: Features.LanguageFeature -> bool, filename, codePage: int option, retryLocked: bool): Lexbuf = // Retry multiple times since other processes may be writing to this file. let rec getSource retryNumber = try @@ -68,5 +69,5 @@ let UnicodeFileAsLexbuf (filename,codePage : int option, retryLocked:bool) : Le else reraise() let source = getSource 0 - let lexbuf = LexBuffer<_>.FromChars(source.ToCharArray()) + let lexbuf = LexBuffer<_>.FromChars(supportsFeature, source.ToCharArray()) lexbuf diff --git a/src/fsharp/UnicodeLexing.fsi b/src/fsharp/UnicodeLexing.fsi index 7c0f0fb68d5..2478c7f857b 100644 --- a/src/fsharp/UnicodeLexing.fsi +++ b/src/fsharp/UnicodeLexing.fsi @@ -2,12 +2,13 @@ module internal FSharp.Compiler.UnicodeLexing +open FSharp.Compiler.Features open FSharp.Compiler.Text open Microsoft.FSharp.Text open Internal.Utilities.Text.Lexing type Lexbuf = LexBuffer -val internal StringAsLexbuf : string -> Lexbuf -val public FunctionAsLexbuf : (char [] * int * int -> int) -> Lexbuf -val public UnicodeFileAsLexbuf :string * int option * (*retryLocked*) bool -> Lexbuf -val public SourceTextAsLexbuf : ISourceText -> Lexbuf +val internal StringAsLexbuf: (Features.LanguageFeature -> bool) * string -> Lexbuf +val public FunctionAsLexbuf: (Features.LanguageFeature -> bool) * (char [] * int * int -> int) -> Lexbuf +val public UnicodeFileAsLexbuf: (Features.LanguageFeature -> bool) * string * int option * (*retryLocked*) bool -> Lexbuf +val public SourceTextAsLexbuf: (Features.LanguageFeature -> bool) * ISourceText -> Lexbuf diff --git a/src/fsharp/XmlAdapters.fs b/src/fsharp/XmlAdapters.fs new file mode 100644 index 00000000000..4f48955945a --- /dev/null +++ b/src/fsharp/XmlAdapters.fs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace Microsoft.FSharp.Core +open System.Reflection + +//Replacement for: System.Security.SecurityElement.Escape(line) All platforms +module internal XmlAdapters = + open System.Text + open Microsoft.FSharp.Collections + + let s_escapeChars = [| '<'; '>'; '\"'; '\''; '&' |] + + let getEscapeSequence c = + match c with + | '<' -> "<" + | '>' -> ">" + | '\"' -> """ + | '\'' -> "'" + | '&' -> "&" + | _ as ch -> ch.ToString() + + let escape str = String.collect getEscapeSequence str + diff --git a/src/fsharp/ast.fs b/src/fsharp/ast.fs index 3c341131fba..57343ec57e4 100644 --- a/src/fsharp/ast.fs +++ b/src/fsharp/ast.fs @@ -12,6 +12,7 @@ open FSharp.Compiler.AbstractIL.Internal.Library open FSharp.Compiler open FSharp.Compiler.UnicodeLexing open FSharp.Compiler.ErrorLogger +open FSharp.Compiler.Features open FSharp.Compiler.PrettyNaming open FSharp.Compiler.Range @@ -1972,36 +1973,51 @@ let PushCurriedPatternsToExpr synArgNameGenerator wholem isMember pats rhs = expr spatsl, expr -/// Helper for parsing the inline IL fragments. +let internal internalParseAssemblyCodeInstructions s isFeatureSupported m = #if NO_INLINE_IL_PARSER -let ParseAssemblyCodeInstructions _s m = + ignore s + ignore isFeatureSupported + errorR(Error((193, "Inline IL not valid in a hosted environment"), m)) [| |] #else -let ParseAssemblyCodeInstructions s m = - try FSharp.Compiler.AbstractIL.Internal.AsciiParser.ilInstrs + try + FSharp.Compiler.AbstractIL.Internal.AsciiParser.ilInstrs FSharp.Compiler.AbstractIL.Internal.AsciiLexer.token - (UnicodeLexing.StringAsLexbuf s) + (UnicodeLexing.StringAsLexbuf(isFeatureSupported, s)) with RecoverableParseError -> - errorR(Error(FSComp.SR.astParseEmbeddedILError(), m)); [| |] + errorR(Error(FSComp.SR.astParseEmbeddedILError(), m)); [||] #endif +let ParseAssemblyCodeInstructions s m = + // Public API can not answer the isFeatureSupported questions, so here we support everything + let isFeatureSupported (_featureId:LanguageFeature) = true + internalParseAssemblyCodeInstructions s isFeatureSupported m + +let internal internalParseAssemblyCodeType s isFeatureSupported m = + ignore s + ignore isFeatureSupported -/// Helper for parsing the inline IL fragments. #if NO_INLINE_IL_PARSER -let ParseAssemblyCodeType _s m = errorR(Error((193, "Inline IL not valid in a hosted environment"), m)) IL.EcmaMscorlibILGlobals.typ_Object #else -let ParseAssemblyCodeType s m = - try FSharp.Compiler.AbstractIL.Internal.AsciiParser.ilType + let isFeatureSupported (_featureId:LanguageFeature) = true + try + FSharp.Compiler.AbstractIL.Internal.AsciiParser.ilType FSharp.Compiler.AbstractIL.Internal.AsciiLexer.token - (UnicodeLexing.StringAsLexbuf s) + (UnicodeLexing.StringAsLexbuf(isFeatureSupported, s)) with RecoverableParseError -> errorR(Error(FSComp.SR.astParseEmbeddedILTypeError(), m)); IL.EcmaMscorlibILGlobals.typ_Object #endif +/// Helper for parsing the inline IL fragments. +let ParseAssemblyCodeType s m = + // Public API can not answer the isFeatureSupported questions, so here we support everything + let isFeatureSupported (_featureId:LanguageFeature) = true + internalParseAssemblyCodeType s isFeatureSupported m + //------------------------------------------------------------------------ // AST constructors //------------------------------------------------------------------------ diff --git a/src/fsharp/fsc.fs b/src/fsharp/fsc.fs index e4e693e99ca..1d13fca5ebb 100644 --- a/src/fsharp/fsc.fs +++ b/src/fsharp/fsc.fs @@ -1066,13 +1066,10 @@ module MainModuleBuilder = elif not(tcConfig.target.IsExe) || not(tcConfig.includewin32manifest) || not(tcConfig.win32res = "") || runningOnMono then "" // otherwise, include the default manifest else -#if FX_NO_RUNTIMEENVIRONMENT - // On coreclr default manifest is alongside the compiler - Path.Combine(System.AppContext.BaseDirectory, @"default.win32manifest") -#else - // On the desktop default manifest is alongside the clr - Path.Combine(System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory(), @"default.win32manifest") -#endif + let path = Path.Combine(System.AppContext.BaseDirectory, @"default.win32manifest") + if File.Exists(path) then path + else Path.Combine(System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory(), @"default.win32manifest") + let nativeResources = [ for av in assemblyVersionResources findAttribute assemblyVersion do yield ILNativeResource.Out av @@ -1720,11 +1717,7 @@ let main0(ctok, argv, legacyReferenceResolver, bannerAlreadyPrinted, let directoryBuildingFrom = Directory.GetCurrentDirectory() let setProcessThreadLocals tcConfigB = match tcConfigB.preferredUiLang with -#if FX_RESHAPED_GLOBALIZATION - | Some s -> CultureInfo.CurrentUICulture <- new CultureInfo(s) -#else | Some s -> Thread.CurrentThread.CurrentUICulture <- new CultureInfo(s) -#endif | None -> () if tcConfigB.utf8output then Console.OutputEncoding <- Encoding.UTF8 diff --git a/src/fsharp/fsi/console.fs b/src/fsharp/fsi/console.fs index 1ac792abc16..04147be7696 100644 --- a/src/fsharp/fsi/console.fs +++ b/src/fsharp/fsi/console.fs @@ -13,8 +13,6 @@ open System.Collections.Generic module internal ConsoleOptions = let readKeyFixup (c:char) = -#if FX_NO_SERVERCODEPAGES -#else // Assumes the c:char is actually a byte in the System.Console.InputEncoding. // Convert it to a Unicode char through the encoding. if 0 <= int c && int c <= 255 then @@ -26,7 +24,6 @@ module internal ConsoleOptions = c // no fix up else assert("readKeyFixHook: given char is outside the 0..255 byte range" = "") -#endif c type internal Style = Prompt | Out | Error diff --git a/src/fsharp/fsi/fsi.fs b/src/fsharp/fsi/fsi.fs index 02b26bf9af1..a0c97ff1c6a 100644 --- a/src/fsharp/fsi/fsi.fs +++ b/src/fsharp/fsi/fsi.fs @@ -27,13 +27,14 @@ open FSharp.Compiler.AbstractIL.ILBinaryReader open FSharp.Compiler.AbstractIL.Internal open FSharp.Compiler.AbstractIL.Internal.Library open FSharp.Compiler.AbstractIL.Extensions.ILX -open FSharp.Compiler.AbstractIL.ILRuntimeWriter +open FSharp.Compiler.AbstractIL.ILRuntimeWriter open FSharp.Compiler.Lib open FSharp.Compiler.AccessibilityLogic open FSharp.Compiler.Ast open FSharp.Compiler.CompileOptions open FSharp.Compiler.CompileOps open FSharp.Compiler.ErrorLogger +open FSharp.Compiler.Features open FSharp.Compiler.Infos open FSharp.Compiler.InfoReader open FSharp.Compiler.NameResolution @@ -389,9 +390,7 @@ type internal FsiValuePrinter(fsi: FsiEvaluationSessionHostConfig, g: TcGlobals, | PrintExpr -> anyToLayoutCall.AnyToLayout(opts, x, ty) with -#if !FX_REDUCED_EXCEPTIONS | :? ThreadAbortException -> Layout.wordL (TaggedTextOps.tagText "") -#endif | e -> #if DEBUG printf "\n\nPrintValue: x = %+A and ty=%s\n" x (ty.FullName) @@ -805,7 +804,6 @@ let internal InstallErrorLoggingOnThisThread errorLogger = SetThreadErrorLoggerNoUnwind(errorLogger) SetThreadBuildPhaseNoUnwind(BuildPhase.Interactive) -#if !FX_NO_SERVERCODEPAGES /// Set the input/output encoding. The use of a thread is due to a known bug on /// on Vista where calls to Console.InputEncoding can block the process. let internal SetServerCodePages(fsiOptions: FsiCommandLineOptions) = @@ -835,7 +833,6 @@ let internal SetServerCodePages(fsiOptions: FsiCommandLineOptions) = if not !successful then System.Windows.Forms.MessageBox.Show(FSIstrings.SR.fsiConsoleProblem()) |> ignore #endif -#endif //---------------------------------------------------------------------------- // Prompt printing @@ -1340,7 +1337,6 @@ type internal FsiDynamicCompiler //---------------------------------------------------------------------------- // ctrl-c handling //---------------------------------------------------------------------------- - module internal NativeMethods = type ControlEventHandler = delegate of int -> bool @@ -1402,14 +1398,6 @@ type internal FsiInterruptController(fsiOptions : FsiCommandLineOptions, Microsoft.FSharp.Silverlight.InterruptThread(threadToKill.ManagedThreadId) ctrlEventActions <- action :: ctrlEventActions; -#else -#if FX_NO_THREADABORT - ignore threadToKill - ignore pauseMilliseconds - ignore fsiConsoleOutput - ignore CTRL_C - ignore fsiOptions - exitViaKillThread <- false #else if !progress then fprintfn fsiConsoleOutput.Out "installing CtrlC handler" // WINDOWS TECHNIQUE: .NET has more safe points, and you can do more when a safe point. @@ -1437,18 +1425,18 @@ type internal FsiInterruptController(fsiOptions : FsiCommandLineOptions, if !progress then fsiConsoleOutput.uprintnfn "%s" (FSIstrings.SR.fsiAbortingMainThread()) killThreadRequest <- NoRequest threadToKill.Abort() - ()),Name="ControlCAbortThread") + ()),Name="ControlCAbortThread") killerThread.IsBackground <- true - killerThread.Start() - + killerThread.Start() + let ctrlEventHandler = new NativeMethods.ControlEventHandler(fun i -> if i = CTRL_C then (raiseCtrlC(); true) else false ) ctrlEventHandlers <- ctrlEventHandler :: ctrlEventHandlers ctrlEventActions <- raiseCtrlC :: ctrlEventActions let _resultOK = NativeMethods.SetConsoleCtrlHandler(ctrlEventHandler,true) exitViaKillThread <- false // don't exit via kill thread - with e -> + with e -> if !progress then fprintfn fsiConsoleOutput.Error "Failed to install ctrl-c handler using Windows technique - trying to install one using Unix signal handling..."; - // UNIX TECHNIQUE: We start up a killer thread, and it watches the mutable reference location. + // UNIX TECHNIQUE: We start up a killer thread, and it watches the mutable reference location. // We can't have a dependency on Mono DLLs (indeed we don't even have them!) // So SOFT BIND the following code: // Mono.Unix.Native.Stdlib.signal(Mono.Unix.Native.Signum.SIGINT,new Mono.Unix.Native.SignalHandler(fun n -> PosixSignalProcessor.PosixInvoke(n))) |> ignore; @@ -1507,8 +1495,6 @@ type internal FsiInterruptController(fsiOptions : FsiCommandLineOptions, | Choice2Of2 e -> fprintf fsiConsoleOutput.Error "%s" (FSIstrings.SR.fsiCouldNotInstallCtrlCHandler(e.Message)) exitViaKillThread <- false -#endif - member x.PosixInvoke(n:int) = // we run this code once with n = -1 to make sure it is JITted before execution begins @@ -1706,9 +1692,11 @@ type internal FsiStdinLexerProvider let initialLightSyntaxStatus = tcConfigB.light <> Some false LightSyntaxStatus (initialLightSyntaxStatus, false (* no warnings *)) + let isFeatureSupported featureId = tcConfigB.langVersion.SupportsFeature featureId + let LexbufFromLineReader (fsiStdinSyphon: FsiStdinSyphon) readf = - UnicodeLexing.FunctionAsLexbuf - (fun (buf: char[], start, len) -> + UnicodeLexing.FunctionAsLexbuf + (isFeatureSupported, (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")) @@ -1724,7 +1712,7 @@ type internal FsiStdinLexerProvider for i = 0 to ntrimmed-1 do buf.[i+start] <- input.[i] ntrimmed - ) + )) //---------------------------------------------------------------------------- // Reading stdin as a lex stream @@ -1745,6 +1733,7 @@ type internal FsiStdinLexerProvider let tokenizer = LexFilter.LexFilter(interactiveInputLightSyntaxStatus, tcConfigB.compilingFslib, Lexer.token lexargs skip, lexbuf) tokenizer + let isFeatureSupported featureId = tcConfigB.langVersion.SupportsFeature featureId // Create a new lexer to read stdin member __.CreateStdinLexer (errorLogger) = @@ -1763,12 +1752,12 @@ type internal FsiStdinLexerProvider // Create a new lexer to read an "included" script file member __.CreateIncludedScriptLexer (sourceFileName, errorLogger) = - let lexbuf = UnicodeLexing.UnicodeFileAsLexbuf(sourceFileName,tcConfigB.inputCodePage,(*retryLocked*)false) + let lexbuf = UnicodeLexing.UnicodeFileAsLexbuf(isFeatureSupported, sourceFileName, tcConfigB.inputCodePage, (*retryLocked*)false) CreateLexerForLexBuffer (sourceFileName, lexbuf, errorLogger) // Create a new lexer to read a string member this.CreateStringLexer (sourceFileName, source, errorLogger) = - let lexbuf = UnicodeLexing.StringAsLexbuf(source) + let lexbuf = UnicodeLexing.StringAsLexbuf(isFeatureSupported, source) CreateLexerForLexBuffer (sourceFileName, lexbuf, errorLogger) member __.ConsoleInput = fsiConsoleInput @@ -1828,6 +1817,7 @@ type internal FsiInteractionProcessor stopProcessingRecovery e range0 istate,CompletedWithReportedError e + let isFeatureSupported featureId = tcConfigB.langVersion.SupportsFeature featureId let rangeStdin = rangeN Lexhelp.stdinMockFilename 0 @@ -2034,13 +2024,11 @@ type internal FsiInteractionProcessor fsiInterruptController.InterruptAllowed <- InterruptIgnored; res with -#if !FX_REDUCED_EXCEPTIONS | :? ThreadAbortException -> fsiInterruptController.ClearInterruptRequest() fsiInterruptController.InterruptAllowed <- InterruptIgnored; (try Thread.ResetAbort() with _ -> ()); (istate,CtrlC) -#endif | e -> fsiInterruptController.ClearInterruptRequest() fsiInterruptController.InterruptAllowed <- InterruptIgnored; @@ -2054,11 +2042,7 @@ type internal FsiInteractionProcessor let parseExpression (tokenizer:LexFilter.LexFilter) = reusingLexbufForParsing tokenizer.LexBuffer (fun () -> Parser.typedSeqExprEOF tokenizer.Lexer tokenizer.LexBuffer) - -// let parseType (tokenizer:LexFilter.LexFilter) = -// reusingLexbufForParsing tokenizer.LexBuffer (fun () -> -// Parser.typEOF tokenizer.Lexer tokenizer.LexBuffer) - + let mainThreadProcessParsedExpression ctok errorLogger (expr, istate) = istate |> InteractiveCatch errorLogger (fun istate -> istate |> mainThreadProcessAction ctok (fun ctok _tcConfig istate -> @@ -2188,7 +2172,7 @@ type internal FsiInteractionProcessor #if FX_LCIDFROMCODEPAGE use _scope = SetCurrentUICultureForThread fsiOptions.FsiLCID #endif - let lexbuf = UnicodeLexing.StringAsLexbuf(sourceText) + let lexbuf = UnicodeLexing.StringAsLexbuf(isFeatureSupported, sourceText) let tokenizer = fsiStdinLexerProvider.CreateBufferLexer(scriptFileName, lexbuf, errorLogger) currState |> InteractiveCatch errorLogger (fun istate -> @@ -2207,7 +2191,7 @@ type internal FsiInteractionProcessor #if FX_LCIDFROMCODEPAGE use _scope = SetCurrentUICultureForThread fsiOptions.FsiLCID #endif - let lexbuf = UnicodeLexing.StringAsLexbuf(sourceText) + let lexbuf = UnicodeLexing.StringAsLexbuf(isFeatureSupported, sourceText) let tokenizer = fsiStdinLexerProvider.CreateBufferLexer(scriptFileName, lexbuf, errorLogger) currState |> InteractiveCatch errorLogger (fun istate -> @@ -2361,7 +2345,6 @@ let internal DriveFsiEventLoop (fsi: FsiEvaluationSessionHostConfig, fsiConsoleO if !progress then fprintfn fsiConsoleOutput.Out "MAIN: entering event loop..."; fsi.EventLoopRun() with -#if !FX_REDUCED_EXCEPTIONS | :? ThreadAbortException -> // If this TAE handler kicks it's almost certainly too late to save the // state of the process - the state of the message loop may have been corrupted @@ -2369,7 +2352,6 @@ let internal DriveFsiEventLoop (fsi: FsiEvaluationSessionHostConfig, fsiConsoleO (try Thread.ResetAbort() with _ -> ()); true // Try again, just case we can restart -#endif | e -> stopProcessingRecovery e range0; true @@ -2466,20 +2448,14 @@ type FsiEvaluationSession (fsi: FsiEvaluationSessionHostConfig, argv:string[], i do match tcConfigB.preferredUiLang with -#if FX_RESHAPED_GLOBALIZATION - | Some s -> System.Globalization.CultureInfo.CurrentUICulture <- new System.Globalization.CultureInfo(s) -#else | Some s -> Thread.CurrentThread.CurrentUICulture <- new System.Globalization.CultureInfo(s) -#endif | None -> () -#if !FX_NO_SERVERCODEPAGES - do - try - SetServerCodePages fsiOptions - with e -> + do + try + SetServerCodePages fsiOptions + with e -> warning(e) -#endif do updateBannerText() // resetting banner text after parsing options @@ -2670,8 +2646,8 @@ type FsiEvaluationSession (fsi: FsiEvaluationSessionHostConfig, argv:string[], i member x.FormatValue(obj:obj, objTy) = fsiDynamicCompiler.FormatValue(obj, objTy) - member x.EvalExpression(sourceText) = - + member x.EvalExpression(sourceText) = + // Explanation: When the user of the FsiInteractiveSession object calls this method, the // code is parsed, checked and evaluated on the calling thread. This means EvalExpression // is not safe to call concurrently. @@ -2680,7 +2656,7 @@ type FsiEvaluationSession (fsi: FsiEvaluationSessionHostConfig, argv:string[], i fsiInteractionProcessor.EvalExpression(ctok, sourceText, dummyScriptFileName, errorLogger) |> commitResult - member x.EvalExpressionNonThrowing(sourceText) = + member x.EvalExpressionNonThrowing(sourceText) = // Explanation: When the user of the FsiInteractiveSession object calls this method, the // code is parsed, checked and evaluated on the calling thread. This means EvalExpression // is not safe to call concurrently. diff --git a/src/fsharp/lex.fsl b/src/fsharp/lex.fsl index c32c9a641b6..0c85eb73999 100644 --- a/src/fsharp/lex.fsl +++ b/src/fsharp/lex.fsl @@ -23,6 +23,7 @@ open FSharp.Compiler open FSharp.Compiler.Range open FSharp.Compiler.Ast open FSharp.Compiler.ErrorLogger +open FSharp.Compiler.Features open FSharp.Compiler.Parser open FSharp.Compiler.Lexhelp open FSharp.Compiler.Lib @@ -85,11 +86,7 @@ let parseInt32 (s:string) = let mutable p = 0 let sign = getSign32 s &p l let specifier = get0OXB s &p l -#if FX_RESHAPED_GLOBALIZATION - match CultureInfo.InvariantCulture.TextInfo.ToLower(specifier) with -#else match Char.ToLower(specifier,CultureInfo.InvariantCulture) with -#endif | 'x' -> sign * (int32 (Convert.ToUInt32(UInt64.Parse(s.Substring(p), NumberStyles.AllowHexSpecifier,CultureInfo.InvariantCulture)))) | 'b' -> sign * (int32 (Convert.ToUInt32(parseBinaryUInt64 s p l))) | 'o' -> sign * (int32 (Convert.ToUInt32(parseOctalUInt64 s p l))) @@ -146,19 +143,17 @@ let tryAppendXmlDoc (buff:option) (s:string) = let shouldStartLine args lexbuf (m:range) err tok = if (m.StartColumn <> 0) then fail args lexbuf err tok else tok - + 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 args (lookup:string->bool) (lexed:string) = - let lexbuf = LexBuffer.FromChars (lexed.ToCharArray ()) + +let evalIfDefExpression startPos isFeatureSupported args (lookup:string->bool) (lexed:string) = + let lexbuf = LexBuffer.FromChars (isFeatureSupported, lexed.ToCharArray ()) lexbuf.StartPos <- startPos lexbuf.EndPos <- startPos let tokenStream = FSharp.Compiler.PPLexer.tokenstream args - let expr = FSharp.Compiler.PPParser.start tokenStream lexbuf - LexerIfdefEval lookup expr } @@ -616,7 +611,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 args lookup lexed + let isTrue = evalIfDefExpression lexbuf.StartPos lexbuf.SupportsFeature 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/lib.fs b/src/fsharp/lib.fs index e7eaf9543fd..bc6b4a77c0f 100755 --- a/src/fsharp/lib.fs +++ b/src/fsharp/lib.fs @@ -513,9 +513,7 @@ module UnmanagedProcessExecutionOptions = extern UInt32 private GetLastError() // Translation of C# from http://swikb/v1/DisplayOnlineDoc.aspx?entryID=826 and copy in bug://5018 -#if !FX_NO_SECURITY_PERMISSIONS [] -#endif let EnableHeapTerminationOnCorruption() = if (System.Environment.OSVersion.Version.Major >= 6 && // If OS is Vista or higher System.Environment.Version.Major < 3) then // and CLR not 3.0 or higher diff --git a/src/fsharp/pars.fsy b/src/fsharp/pars.fsy index 56e6dbfb404..576d2184199 100644 --- a/src/fsharp/pars.fsy +++ b/src/fsharp/pars.fsy @@ -18,6 +18,7 @@ open FSharp.Compiler.Ast open FSharp.Compiler.Lib open FSharp.Compiler.PrettyNaming open FSharp.Compiler.ErrorLogger +open FSharp.Compiler.Features #if DEBUG let debugPrint(s) = @@ -129,9 +130,11 @@ let mkDefnBindings (mWhole,BindingSetPreAttrs(_,isRec,isUse,declsPreAttrs,_bindi let attrDecls = if not (isNil freeAttrs) then [ SynModuleDecl.Attributes (freeAttrs,attrsm) ] else [] attrDecls @ letDecls -let idOfPat m p = - match p with - | SynPat.Named (SynPat.Wild _,id,false,_,_) -> id +let idOfPat (parseState:IParseState) m p = + match p with + | SynPat.Wild r when parseState.LexBuffer.SupportsFeature LanguageFeature.WildCardInForLoop -> + mkSynId r "_" + | SynPat.Named (SynPat.Wild _,id,false,_,_) -> id | SynPat.LongIdent(LongIdentWithDots([id],_),_,None, SynConstructorArgs.Pats [], None,_) -> id | _ -> raiseParseErrorAt m (FSComp.SR.parsIntegerForLoopRequiresSimpleIdentifier()) @@ -1913,8 +1916,12 @@ opt_typ: | /* EMPTY */ { None } | COLON typ { Some $2 } - atomicPatternLongIdent: + | UNDERSCORE DOT pathOp { + if not (parseState.LexBuffer.SupportsFeature LanguageFeature.SingleUnderscorePattern) then + raiseParseErrorAt (rhs parseState 2) (FSComp.SR.parsUnexpectedSymbolDot()) + let (LongIdentWithDots(lid,dotms)) = $3 in (None,LongIdentWithDots(ident("_",rhs parseState 1)::lid, rhs parseState 2::dotms)) + } | GLOBAL DOT pathOp { let (LongIdentWithDots(lid,dotms)) = $3 in (None,LongIdentWithDots(ident(MangledGlobalName,rhs parseState 1) :: lid, rhs parseState 2 :: dotms)) } | pathOp { (None,$1) } | access pathOp { (Some($1), $2) } @@ -2106,7 +2113,7 @@ inlineAssemblyTyconRepr: | HASH stringOrKeywordString HASH { libraryOnlyError (lhs parseState) let lhsm = lhs parseState - SynTypeDefnSimpleRepr.LibraryOnlyILAssembly (ParseAssemblyCodeType $2 (rhs parseState 2),lhsm) } + SynTypeDefnSimpleRepr.LibraryOnlyILAssembly (internalParseAssemblyCodeType $2 parseState.LexBuffer.SupportsFeature (rhs parseState 2),lhsm) } classOrInterfaceOrStruct: | CLASS { TyconClass } @@ -4002,7 +4009,7 @@ forLoopBinder: forLoopRange: | parenPattern EQUALS declExpr forLoopDirection declExpr - { idOfPat (rhs parseState 1) $1,$3,$4,$5 } + { idOfPat parseState (rhs parseState 1) $1,$3,$4,$5 } | parenPattern EQUALS rangeSequenceExpr { raiseParseErrorAt (rhs parseState 2) (FSComp.SR.parsUnexpectedSymbolEqualsInsteadOfIn()) } @@ -4015,11 +4022,11 @@ inlineAssemblyExpr: | HASH stringOrKeywordString opt_inlineAssemblyTypeArg opt_curriedArgExprs opt_inlineAssemblyReturnTypes HASH { libraryOnlyWarning (lhs parseState) let s,sm = $2,rhs parseState 2 - (fun m -> SynExpr.LibraryOnlyILAssembly (ParseAssemblyCodeInstructions s sm,$3,List.rev $4,$5,m)) } - -opt_curriedArgExprs: - | opt_curriedArgExprs argExpr %prec expr_args - { $2 :: $1 } + (fun m -> SynExpr.LibraryOnlyILAssembly (internalParseAssemblyCodeInstructions s parseState.LexBuffer.SupportsFeature sm, $3, List.rev $4, $5, m)) } + +opt_curriedArgExprs: + | opt_curriedArgExprs argExpr %prec expr_args + { $2 :: $1 } | { [] } diff --git a/src/fsharp/service/FSharpCheckerResults.fs b/src/fsharp/service/FSharpCheckerResults.fs index d8cfe81430a..278467ca066 100644 --- a/src/fsharp/service/FSharpCheckerResults.fs +++ b/src/fsharp/service/FSharpCheckerResults.fs @@ -21,6 +21,7 @@ open FSharp.Compiler.Ast open FSharp.Compiler.CompileOps open FSharp.Compiler.CompileOptions open FSharp.Compiler.ErrorLogger +open FSharp.Compiler.Features open FSharp.Compiler.Lib open FSharp.Compiler.PrettyNaming open FSharp.Compiler.Parser @@ -1525,8 +1526,12 @@ module internal ParseAndCheckFile = let tokenizer = LexFilter.LexFilter(lightSyntaxStatus, options.CompilingFsLib, Lexer.token lexargs true, lexbuf) tokenizer.Lexer - let createLexbuf sourceText = - UnicodeLexing.SourceTextAsLexbuf(sourceText) + // 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 createLexbuf sourceText isFeatureSupported = + UnicodeLexing.SourceTextAsLexbuf(isFeatureSupported, sourceText) let matchBraces(sourceText: ISourceText, fileName, options: FSharpParsingOptions, userOpName: string, suggestNamesForErrors: bool) = let delayedLogger = CapturingErrorLogger("matchBraces") @@ -1541,7 +1546,7 @@ module internal ParseAndCheckFile = use _unwindBP = PushThreadBuildPhaseUntilUnwind BuildPhase.Parse let matchingBraces = new ResizeArray<_>() - Lexhelp.usingLexbufForParsing(createLexbuf sourceText, fileName) (fun lexbuf -> + Lexhelp.usingLexbufForParsing(createLexbuf sourceText isFeatureSupported, fileName) (fun lexbuf -> let errHandler = ErrorHandler(false, fileName, options.ErrorSeverityOptions, sourceText, suggestNamesForErrors) let lexfun = createLexerFunction fileName options lexbuf errHandler let parenTokensBalance t1 t2 = @@ -1577,7 +1582,7 @@ module internal ParseAndCheckFile = use unwindBP = PushThreadBuildPhaseUntilUnwind BuildPhase.Parse let parseResult = - Lexhelp.usingLexbufForParsing(createLexbuf sourceText, fileName) (fun lexbuf -> + Lexhelp.usingLexbufForParsing(createLexbuf sourceText isFeatureSupported, fileName) (fun lexbuf -> let lexfun = createLexerFunction fileName options lexbuf errHandler let isLastCompiland = fileName.Equals(options.LastFileName, StringComparison.CurrentCultureIgnoreCase) || diff --git a/src/fsharp/service/Reactor.fs b/src/fsharp/service/Reactor.fs index bae570d0c5f..dd307ca13e1 100755 --- a/src/fsharp/service/Reactor.fs +++ b/src/fsharp/service/Reactor.fs @@ -64,11 +64,7 @@ type Reactor() = Trace.TraceInformation("Reactor: {0:n3} pausing {1} milliseconds", DateTime.Now.TimeOfDay.TotalSeconds, pauseBeforeBackgroundWork) pauseBeforeBackgroundWork return! inbox.TryReceive(timeout) } -#if FX_RESHAPED_GLOBALIZATION - CultureInfo.CurrentUICulture <- culture -#else Thread.CurrentThread.CurrentUICulture <- culture -#endif match msg with | Some (SetBackgroundOp bgOpOpt) -> //Trace.TraceInformation("Reactor: --> set background op, remaining {0}", inbox.CurrentQueueLength) diff --git a/src/fsharp/service/ServiceLexing.fs b/src/fsharp/service/ServiceLexing.fs index a03c1deeffb..41e4b1c9e88 100644 --- a/src/fsharp/service/ServiceLexing.fs +++ b/src/fsharp/service/ServiceLexing.fs @@ -15,6 +15,7 @@ open FSharp.Compiler.Parser open FSharp.Compiler.Range open FSharp.Compiler.Ast open FSharp.Compiler.ErrorLogger +open FSharp.Compiler.Features open FSharp.Compiler.Lexhelp open FSharp.Compiler.Lib open Internal.Utilities @@ -767,18 +768,22 @@ type FSharpLineTokenizer(lexbuf: UnicodeLexing.Lexbuf, [] type FSharpSourceTokenizer(defineConstants: string list, filename: string option) = + + // 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 lexResourceManager = new Lexhelp.LexResourceManager() let lexArgsLightOn = mkLexargs(filename, defineConstants, LightSyntaxStatus(true, false), lexResourceManager, ref [], DiscardErrorsLogger, PathMap.empty) let lexArgsLightOff = mkLexargs(filename, defineConstants, LightSyntaxStatus(false, false), lexResourceManager, ref [], DiscardErrorsLogger, PathMap.empty) member this.CreateLineTokenizer(lineText: string) = - let lexbuf = UnicodeLexing.StringAsLexbuf lineText + let lexbuf = UnicodeLexing.StringAsLexbuf(isFeatureSupported, lineText) FSharpLineTokenizer(lexbuf, Some lineText.Length, filename, lexArgsLightOn, lexArgsLightOff) - member this.CreateBufferTokenizer bufferFiller = - let lexbuf = UnicodeLexing.FunctionAsLexbuf bufferFiller + let lexbuf = UnicodeLexing.FunctionAsLexbuf(isFeatureSupported, bufferFiller) FSharpLineTokenizer(lexbuf, None, filename, lexArgsLightOn, lexArgsLightOff) module Keywords = diff --git a/src/fsharp/service/service.fs b/src/fsharp/service/service.fs index cc7d11b9f9f..1c6d8e8fb32 100644 --- a/src/fsharp/service/service.fs +++ b/src/fsharp/service/service.fs @@ -19,6 +19,7 @@ open FSharp.Compiler.CompileOps open FSharp.Compiler.CompileOptions open FSharp.Compiler.Driver open FSharp.Compiler.ErrorLogger +open FSharp.Compiler.Features open FSharp.Compiler.Lib open FSharp.Compiler.Range open FSharp.Compiler.TcGlobals diff --git a/src/fsharp/symbols/SymbolHelpers.fs b/src/fsharp/symbols/SymbolHelpers.fs index 1440eef5a4c..b1c46d9bd72 100644 --- a/src/fsharp/symbols/SymbolHelpers.fs +++ b/src/fsharp/symbols/SymbolHelpers.fs @@ -69,8 +69,8 @@ type FSharpErrorInfo(fileName, s: pos, e: pos, severity: FSharpErrorSeverity, me /// Decompose a warning or error into parts: position, severity, message, error number static member CreateFromExceptionAndAdjustEof(exn, isError, fallbackRange: range, (linesCount: int, lastLength: int), suggestNames: bool) = let r = FSharpErrorInfo.CreateFromException(exn, isError, fallbackRange, suggestNames) - - // Adjust to make sure that errors reported at Eof are shown at the linesCount + + // Adjust to make sure that errors reported at Eof are shown at the linesCount let startline, schange = min (r.StartLineAlternate, false) (linesCount, true) let endline, echange = min (r.EndLineAlternate, false) (linesCount, true) diff --git a/src/fsharp/xlf/FSComp.txt.cs.xlf b/src/fsharp/xlf/FSComp.txt.cs.xlf index 4ca8437501f..c0998c729b0 100644 --- a/src/fsharp/xlf/FSComp.txt.cs.xlf +++ b/src/fsharp/xlf/FSComp.txt.cs.xlf @@ -7,6 +7,26 @@ {0} pro F# {1} + + Display the allowed values for language version, specify language version such as 'latest' or 'preview' + Display the allowed values for language version, specify language version such as 'latest' or 'preview' + + + + Supported language versions: + Supported language versions: + + + + Unrecognized value '{0}' for --langversion use --langversion:? for complete list + Unrecognized value '{0}' for --langversion use --langversion:? for complete list + + + + Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + + The namespace '{0}' is not defined. Není definovaný obor názvů {0}. diff --git a/src/fsharp/xlf/FSComp.txt.de.xlf b/src/fsharp/xlf/FSComp.txt.de.xlf index 1f0aa761532..f5c38ec416d 100644 --- a/src/fsharp/xlf/FSComp.txt.de.xlf +++ b/src/fsharp/xlf/FSComp.txt.de.xlf @@ -7,6 +7,26 @@ {0} für F# {1} + + Display the allowed values for language version, specify language version such as 'latest' or 'preview' + Display the allowed values for language version, specify language version such as 'latest' or 'preview' + + + + Supported language versions: + Supported language versions: + + + + Unrecognized value '{0}' for --langversion use --langversion:? for complete list + Unrecognized value '{0}' for --langversion use --langversion:? for complete list + + + + Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + + The namespace '{0}' is not defined. Der Namespace "{0}" ist nicht definiert. diff --git a/src/fsharp/xlf/FSComp.txt.es.xlf b/src/fsharp/xlf/FSComp.txt.es.xlf index 1ac646d5892..73a099a9ad4 100644 --- a/src/fsharp/xlf/FSComp.txt.es.xlf +++ b/src/fsharp/xlf/FSComp.txt.es.xlf @@ -7,6 +7,26 @@ {0} para F# {1} + + Display the allowed values for language version, specify language version such as 'latest' or 'preview' + Display the allowed values for language version, specify language version such as 'latest' or 'preview' + + + + Supported language versions: + Supported language versions: + + + + Unrecognized value '{0}' for --langversion use --langversion:? for complete list + Unrecognized value '{0}' for --langversion use --langversion:? for complete list + + + + Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + + The namespace '{0}' is not defined. El espacio de nombres "{0}" no está definido. @@ -114,7 +134,7 @@ All branches of a pattern match expression must return values of the same type as the first branch, which here is '{0}'. This branch returns a value of type '{1}'. - Todas las ramas de una expresión de coincidencia de patrón deben devolver valores del mismo tipo. La primera rama devolvió un valor de tipo "{0}", pero esta rama devolvió un valor de tipo "\{1 \}". + All branches of a pattern match expression must return values of the same type as the first branch, which here is '{0}'. This branch returns a value of type '{1}'. diff --git a/src/fsharp/xlf/FSComp.txt.fr.xlf b/src/fsharp/xlf/FSComp.txt.fr.xlf index f2cd73f377b..a66cc29b2b8 100644 --- a/src/fsharp/xlf/FSComp.txt.fr.xlf +++ b/src/fsharp/xlf/FSComp.txt.fr.xlf @@ -7,6 +7,26 @@ {0} pour F# {1} + + Display the allowed values for language version, specify language version such as 'latest' or 'preview' + Display the allowed values for language version, specify language version such as 'latest' or 'preview' + + + + Supported language versions: + Supported language versions: + + + + Unrecognized value '{0}' for --langversion use --langversion:? for complete list + Unrecognized value '{0}' for --langversion use --langversion:? for complete list + + + + Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + + The namespace '{0}' is not defined. L'espace de noms '{0}' n'est pas défini. diff --git a/src/fsharp/xlf/FSComp.txt.it.xlf b/src/fsharp/xlf/FSComp.txt.it.xlf index 5bf595dea57..bf3c33673f7 100644 --- a/src/fsharp/xlf/FSComp.txt.it.xlf +++ b/src/fsharp/xlf/FSComp.txt.it.xlf @@ -7,6 +7,26 @@ {0} per F# {1} + + Display the allowed values for language version, specify language version such as 'latest' or 'preview' + Display the allowed values for language version, specify language version such as 'latest' or 'preview' + + + + Supported language versions: + Supported language versions: + + + + Unrecognized value '{0}' for --langversion use --langversion:? for complete list + Unrecognized value '{0}' for --langversion use --langversion:? for complete list + + + + Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + + The namespace '{0}' is not defined. Lo spazio dei nomi '{0}' non è definito. diff --git a/src/fsharp/xlf/FSComp.txt.ja.xlf b/src/fsharp/xlf/FSComp.txt.ja.xlf index bcbf7c58ed0..dc8a58a5286 100644 --- a/src/fsharp/xlf/FSComp.txt.ja.xlf +++ b/src/fsharp/xlf/FSComp.txt.ja.xlf @@ -7,6 +7,26 @@ F# {1} の {0} + + Display the allowed values for language version, specify language version such as 'latest' or 'preview' + Display the allowed values for language version, specify language version such as 'latest' or 'preview' + + + + Supported language versions: + Supported language versions: + + + + Unrecognized value '{0}' for --langversion use --langversion:? for complete list + Unrecognized value '{0}' for --langversion use --langversion:? for complete list + + + + Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + + The namespace '{0}' is not defined. 名前空間 '{0}' が定義されていません。 diff --git a/src/fsharp/xlf/FSComp.txt.ko.xlf b/src/fsharp/xlf/FSComp.txt.ko.xlf index 18a45877719..c1597b85efe 100644 --- a/src/fsharp/xlf/FSComp.txt.ko.xlf +++ b/src/fsharp/xlf/FSComp.txt.ko.xlf @@ -7,6 +7,26 @@ F# {1}용 {0} + + Display the allowed values for language version, specify language version such as 'latest' or 'preview' + Display the allowed values for language version, specify language version such as 'latest' or 'preview' + + + + Supported language versions: + Supported language versions: + + + + Unrecognized value '{0}' for --langversion use --langversion:? for complete list + Unrecognized value '{0}' for --langversion use --langversion:? for complete list + + + + Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + + The namespace '{0}' is not defined. '{0}' 네임스페이스가 정의되지 않았습니다. diff --git a/src/fsharp/xlf/FSComp.txt.pl.xlf b/src/fsharp/xlf/FSComp.txt.pl.xlf index 69935ec9433..af1213810f4 100644 --- a/src/fsharp/xlf/FSComp.txt.pl.xlf +++ b/src/fsharp/xlf/FSComp.txt.pl.xlf @@ -7,6 +7,26 @@ {0} dla języka F# {1} + + Display the allowed values for language version, specify language version such as 'latest' or 'preview' + Display the allowed values for language version, specify language version such as 'latest' or 'preview' + + + + Supported language versions: + Supported language versions: + + + + Unrecognized value '{0}' for --langversion use --langversion:? for complete list + Unrecognized value '{0}' for --langversion use --langversion:? for complete list + + + + Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + + The namespace '{0}' is not defined. Nie zdefiniowano przestrzeni nazw „{0}”. diff --git a/src/fsharp/xlf/FSComp.txt.pt-BR.xlf b/src/fsharp/xlf/FSComp.txt.pt-BR.xlf index 52c5bab6c96..e806ec89442 100644 --- a/src/fsharp/xlf/FSComp.txt.pt-BR.xlf +++ b/src/fsharp/xlf/FSComp.txt.pt-BR.xlf @@ -7,6 +7,26 @@ {0} para F# {1} + + Display the allowed values for language version, specify language version such as 'latest' or 'preview' + Display the allowed values for language version, specify language version such as 'latest' or 'preview' + + + + Supported language versions: + Supported language versions: + + + + Unrecognized value '{0}' for --langversion use --langversion:? for complete list + Unrecognized value '{0}' for --langversion use --langversion:? for complete list + + + + Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + + The namespace '{0}' is not defined. O namespace '{0}' não está definido. diff --git a/src/fsharp/xlf/FSComp.txt.ru.xlf b/src/fsharp/xlf/FSComp.txt.ru.xlf index a6a4d1171d7..de5cb30a93f 100644 --- a/src/fsharp/xlf/FSComp.txt.ru.xlf +++ b/src/fsharp/xlf/FSComp.txt.ru.xlf @@ -7,6 +7,26 @@ {0} для F# {1} + + Display the allowed values for language version, specify language version such as 'latest' or 'preview' + Display the allowed values for language version, specify language version such as 'latest' or 'preview' + + + + Supported language versions: + Supported language versions: + + + + Unrecognized value '{0}' for --langversion use --langversion:? for complete list + Unrecognized value '{0}' for --langversion use --langversion:? for complete list + + + + Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + + The namespace '{0}' is not defined. Пространство имен "{0}" не определено. diff --git a/src/fsharp/xlf/FSComp.txt.tr.xlf b/src/fsharp/xlf/FSComp.txt.tr.xlf index ceb68b2207b..1b73a0bacc8 100644 --- a/src/fsharp/xlf/FSComp.txt.tr.xlf +++ b/src/fsharp/xlf/FSComp.txt.tr.xlf @@ -7,6 +7,26 @@ F# {1} için {0} + + Display the allowed values for language version, specify language version such as 'latest' or 'preview' + Display the allowed values for language version, specify language version such as 'latest' or 'preview' + + + + Supported language versions: + Supported language versions: + + + + Unrecognized value '{0}' for --langversion use --langversion:? for complete list + Unrecognized value '{0}' for --langversion use --langversion:? for complete list + + + + Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + + The namespace '{0}' is not defined. '{0}' ad alanı tanımlı değil. diff --git a/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf b/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf index a1a162e0a1a..b29032a560c 100644 --- a/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf @@ -7,6 +7,26 @@ F# {1} 的 {0} + + Display the allowed values for language version, specify language version such as 'latest' or 'preview' + Display the allowed values for language version, specify language version such as 'latest' or 'preview' + + + + Supported language versions: + Supported language versions: + + + + Unrecognized value '{0}' for --langversion use --langversion:? for complete list + Unrecognized value '{0}' for --langversion use --langversion:? for complete list + + + + Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + + The namespace '{0}' is not defined. 未定义命名空间“{0}”。 diff --git a/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf b/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf index e2c21c864b5..fd998bfd5d3 100644 --- a/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf @@ -7,6 +7,26 @@ F # {1} 的 {0} + + Display the allowed values for language version, specify language version such as 'latest' or 'preview' + Display the allowed values for language version, specify language version such as 'latest' or 'preview' + + + + Supported language versions: + Supported language versions: + + + + Unrecognized value '{0}' for --langversion use --langversion:? for complete list + Unrecognized value '{0}' for --langversion use --langversion:? for complete list + + + + Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + + The namespace '{0}' is not defined. 未定義命名空間 '{0}'。 diff --git a/src/utils/CompilerLocationUtils.fs b/src/utils/CompilerLocationUtils.fs index df0c7123b4d..95aa5c5a31e 100644 --- a/src/utils/CompilerLocationUtils.fs +++ b/src/utils/CompilerLocationUtils.fs @@ -23,20 +23,7 @@ module internal FSharpEnvironment = #endif let versionOf<'t> = -#if FX_RESHAPED_REFLECTION - let aq = (typeof<'t>).AssemblyQualifiedName - let version = - if aq <> null then - let x = aq.Split(',', ' ') |> Seq.filter(fun x -> x.StartsWith("Version=", StringComparison.OrdinalIgnoreCase)) |> Seq.tryHead - match x with - | Some(x) -> x.Substring(8) - | _ -> null - else - null - version -#else typeof<'t>.Assembly.GetName().Version.ToString() -#endif let FSharpCoreLibRunningVersion = try match versionOf with @@ -200,7 +187,7 @@ module internal FSharpEnvironment = #else // Check for an app.config setting to redirect the default compiler location // Like fsharp-compiler-location - try + try // FSharp.Compiler support setting an appkey for compiler location. I've never seen this used. let result = tryAppConfig "fsharp-compiler-location" match result with diff --git a/src/utils/prim-lexing.fs b/src/utils/prim-lexing.fs index c397257b46c..1f772d6e87e 100644 --- a/src/utils/prim-lexing.fs +++ b/src/utils/prim-lexing.fs @@ -50,12 +50,12 @@ type StringText(str: string) = lazy getLines str member __.String = str - + override __.GetHashCode() = str.GetHashCode() override __.Equals(obj: obj) = str.Equals(obj) interface ISourceText with - + member __.Item with get index = str.[index] member __.GetLastCharacterPosition() = @@ -106,6 +106,7 @@ namespace Internal.Utilities.Text.Lexing open FSharp.Compiler.Text open Microsoft.FSharp.Core open Microsoft.FSharp.Collections + open FSharp.Compiler.Features open System.Collections.Generic [] @@ -168,11 +169,11 @@ namespace Internal.Utilities.Text.Lexing 0, 0) - type internal LexBufferFiller<'Char> = (LexBuffer<'Char> -> unit) - + type internal LexBufferFiller<'Char> = (LexBuffer<'Char> -> unit) + and [] - internal LexBuffer<'Char>(filler: LexBufferFiller<'Char>) = - let context = new Dictionary(1) + internal LexBuffer<'Char>(filler: LexBufferFiller<'Char>, supportsFeature:LanguageFeature -> bool) = + let context = new Dictionary(1) let mutable buffer = [||] /// number of valid characters beyond bufferScanStart. let mutable bufferMaxScanLength = 0 @@ -195,8 +196,7 @@ namespace Internal.Utilities.Text.Lexing Array.blit keep 0 buffer 0 nkeep bufferScanStart <- 0 bufferMaxScanLength <- nkeep - - + member lexbuf.EndOfScan () : int = //Printf.eprintf "endOfScan, lexBuffer.lexemeLength = %d\n" lexBuffer.lexemeLength; if bufferAcceptAction < 0 then @@ -211,13 +211,12 @@ namespace Internal.Utilities.Text.Lexing member lexbuf.StartPos with get() = startPos and set b = startPos <- b - + member lexbuf.EndPos with get() = endPos and set b = endPos <- b member lexbuf.Lexeme = Array.sub buffer bufferScanStart lexemeLength - member lexbuf.BufferLocalStore = (context :> IDictionary<_,_>) member lexbuf.LexemeLength with get() : int = lexemeLength and set v = lexemeLength <- v member lexbuf.Buffer with get() : 'Char[] = buffer and set v = buffer <- v @@ -238,45 +237,46 @@ namespace Internal.Utilities.Text.Lexing member x.BufferScanPos = bufferScanStart + bufferScanLength member lexbuf.EnsureBufferSize n = - if lexbuf.BufferScanPos + n >= buffer.Length then - let repl = Array.zeroCreate (lexbuf.BufferScanPos + n) + if lexbuf.BufferScanPos + n >= buffer.Length then + let repl = Array.zeroCreate (lexbuf.BufferScanPos + n) Array.blit buffer bufferScanStart repl bufferScanStart bufferScanLength buffer <- repl + member __.SupportsFeature featureId = supportsFeature featureId - static member FromFunction (f : 'Char[] * int * int -> int) : LexBuffer<'Char> = + static member FromFunction (supportsFeature:LanguageFeature -> bool, 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) - + new LexBuffer<'Char>(filler, supportsFeature) + // Important: This method takes ownership of the array - static member FromArrayNoCopy (buffer: 'Char[]) : LexBuffer<'Char> = - let lexBuffer = new LexBuffer<'Char>(fun _ -> ()) + static member FromArrayNoCopy (supportsFeature:LanguageFeature -> bool, buffer: 'Char[]) : LexBuffer<'Char> = + let lexBuffer = new LexBuffer<'Char>((fun _ -> ()), supportsFeature) lexBuffer.Buffer <- buffer lexBuffer.BufferMaxScanLength <- buffer.Length lexBuffer // Important: this method does copy the array - static member FromArray (s: 'Char[]) : LexBuffer<'Char> = + static member FromArray (supportsFeature: LanguageFeature -> bool, s: 'Char[]) : LexBuffer<'Char> = let buffer = Array.copy s - LexBuffer<'Char>.FromArrayNoCopy buffer + LexBuffer<'Char>.FromArrayNoCopy(supportsFeature, buffer) // Important: This method takes ownership of the array - static member FromChars (arr:char[]) = LexBuffer.FromArrayNoCopy arr - - static member FromSourceText (sourceText: ISourceText) = + static member FromChars (supportsFeature:LanguageFeature -> bool, arr:char[]) = LexBuffer.FromArrayNoCopy (supportsFeature, arr) + + static member FromSourceText (supportsFeature: LanguageFeature -> bool, sourceText: ISourceText) = let mutable currentSourceIndex = 0 - LexBuffer.FromFunction(fun (chars, start, length) -> + LexBuffer.FromFunction(supportsFeature, fun (chars, start, length) -> let lengthToCopy = if currentSourceIndex + length <= sourceText.Length then length else sourceText.Length - currentSourceIndex - + if lengthToCopy <= 0 then 0 else sourceText.CopyTo(currentSourceIndex, chars, start, lengthToCopy) @@ -312,7 +312,6 @@ namespace Internal.Utilities.Text.Lexing open GenericImplFragments - [] type internal UnicodeTables(trans: uint16[] array, accept: uint16[]) = let sentinel = 255 * 256 + 255 @@ -334,11 +333,7 @@ namespace Internal.Utilities.Text.Lexing // ways let baseForUnicodeCategories = numLowUnicodeChars+numSpecificUnicodeChars*2 let unicodeCategory = -#if FX_RESHAPED_GLOBALIZATION - System.Globalization.CharUnicodeInfo.GetUnicodeCategory(inp) -#else System.Char.GetUnicodeCategory(inp) -#endif //System.Console.WriteLine("inp = {0}, unicodeCategory = {1}", [| box inp; box unicodeCategory |]); int trans.[state].[baseForUnicodeCategories + int32 unicodeCategory] else @@ -349,10 +344,9 @@ namespace Internal.Utilities.Text.Lexing if c = inp then int trans.[state].[baseForSpecificUnicodeChars+i*2+1] else loop(i+1) - loop 0 let eofPos = numLowUnicodeChars + 2*numSpecificUnicodeChars + numUnicodeCategories - + let rec scanUntilSentinel lexBuffer state = // Return an endOfScan after consuming the input let a = int accept.[state] diff --git a/src/utils/prim-lexing.fsi b/src/utils/prim-lexing.fsi index 4b4fd587171..bf9eb3171c1 100644 --- a/src/utils/prim-lexing.fsi +++ b/src/utils/prim-lexing.fsi @@ -39,6 +39,7 @@ open System.Collections.Generic open FSharp.Compiler.Text open Microsoft.FSharp.Core open Microsoft.FSharp.Control +open FSharp.Compiler.Features /// Position information stored for lexing tokens [] @@ -78,12 +79,12 @@ type internal Position = /// Apply a #line directive. member ApplyLineDirective : fileIdx:int * line:int -> Position - + /// Get an arbitrary position, with the empty string as filename. static member Empty : Position - + static member FirstLine : fileIdx:int -> Position - + [] /// Input buffers consumed by lexers generated by fslex.exe. /// The type must be generic to match the code generated by FsLex and FsYacc (if you would like to @@ -97,24 +98,28 @@ type internal LexBuffer<'Char> = /// The matched string. member Lexeme: 'Char [] - + /// Fast helper to turn the matched characters into a string, avoiding an intermediate array. static member LexemeString : LexBuffer -> string - + /// Dynamically typed, non-lexically scoped parameter table. member BufferLocalStore : IDictionary - + /// True if the refill of the buffer ever failed , or if explicitly set to True. member IsPastEndOfStream: bool with get,set + /// True if the refill of the buffer ever failed , or if explicitly set to True. + member SupportsFeature:LanguageFeature -> bool + /// 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: char[] -> LexBuffer + static member FromChars: (LanguageFeature -> bool) * char[] -> LexBuffer /// Create a lex buffer that reads character or byte inputs by using the given function. - static member FromFunction: ('Char[] * int * int -> int) -> LexBuffer<'Char> + static member FromFunction: (LanguageFeature -> bool) * ('Char[] * int * int -> int) -> LexBuffer<'Char> + /// Create a lex buffer backed by source text. - static member FromSourceText : ISourceText -> LexBuffer + static member FromSourceText : (LanguageFeature -> bool) * ISourceText -> LexBuffer /// The type of tables for an unicode lexer generated by fslex.exe. [] diff --git a/src/utils/reshapedmsbuild.fs b/src/utils/reshapedmsbuild.fs index 75859f44765..20b5cd6f961 100644 --- a/src/utils/reshapedmsbuild.fs +++ b/src/utils/reshapedmsbuild.fs @@ -21,41 +21,45 @@ type ITaskItem = abstract member CopyMetadataTo : ITaskItem -> unit abstract member CloneCustomMetadata : IDictionary -namespace Microsoft.Build.Utilities -open Microsoft.Build.Framework -open Microsoft.FSharp.Core.ReflectionAdapters -open System -open System.Collections -open System.Reflection - -type TaskItem (itemSpec:string) = - let assembly = Assembly.Load(new AssemblyName("Microsoft.Build.Utilities.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")) - let buildUtilitiesTaskType = assembly.GetType("Microsoft.Build.Utilities.Task") - let instance = Activator.CreateInstance(buildUtilitiesTaskType, [|itemSpec|]) - - interface ITaskItem with - member this.ItemSpec - with get () :string = (instance.GetPropertyValue("ItemSpec") :?> string) - and set (value:string) = (instance.SetPropertyValue("ItemSpec", value)); () - member this.MetadataNames - with get () :ICollection = (instance.GetPropertyValue("MetadataNames") :?> ICollection) - member this.MetadataCount - with get () :int = (instance.GetPropertyValue("MetadataCount") :?> int) - member this.CopyMetadataTo(iTaskItem) = - let m = buildUtilitiesTaskType.GetMethod("CopyMetadataTo", [| typeof |]) - m.Invoke(instance, [|iTaskItem :>obj|]) |> ignore - member this.CloneCustomMetadata = - let m = buildUtilitiesTaskType.GetMethod("CloneCustomMetadata", [||]) - (m.Invoke(instance,[||])) :?>IDictionary - member this.GetMetadata(metadataName) = - let m = buildUtilitiesTaskType.GetMethod("GetMetadata", [|typeof|]) - (m.Invoke(instance,[|metadataName|])) :?>string - member this.RemoveMetadata(metadataName) = - let m = buildUtilitiesTaskType.GetMethod("RemoveMetadata", [|typeof|]) - (m.Invoke(instance,[|metadataName|])) :?>string |>ignore - member this.SetMetadata(metadataName, metadataValue) = - let m = buildUtilitiesTaskType.GetMethod("SetMetadata", [|typeof;typeof|]) - (m.Invoke(instance,[|metadataName; metadataValue|])) |>ignore +module Utilities = + open Microsoft.Build.Framework + open System + open System.Collections + open System.Reflection + + type System.Object with + member this.GetPropertyValue(propName) = this.GetType().GetProperty(propName, BindingFlags.Public).GetValue(this, null) + member this.SetPropertyValue(propName, propValue) = this.GetType().GetProperty(propName, BindingFlags.Public).SetValue(this, propValue, null) + member this.GetMethod(methodName, argTypes) = this.GetType().GetMethod(methodName, argTypes, [||]) + + type TaskItem (itemSpec:string) = + let assembly = Assembly.Load(new AssemblyName("Microsoft.Build.Utilities.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")) + let buildUtilitiesTaskType = assembly.GetType("Microsoft.Build.Utilities.Task") + let instance = Activator.CreateInstance(buildUtilitiesTaskType, [|itemSpec|]) + + interface ITaskItem with + member this.ItemSpec + with get () :string = (instance.GetPropertyValue("ItemSpec") :?> string) + and set (value:string) = (instance.SetPropertyValue("ItemSpec", value)); () + member this.MetadataNames + with get () :ICollection = (instance.GetPropertyValue("MetadataNames") :?> ICollection) + member this.MetadataCount + with get () :int = (instance.GetPropertyValue("MetadataCount") :?> int) + member this.CopyMetadataTo(iTaskItem) = + let m = buildUtilitiesTaskType.GetMethod("CopyMetadataTo", [| typeof |]) + m.Invoke(instance, [|iTaskItem :>obj|]) |> ignore + member this.CloneCustomMetadata = + let m = buildUtilitiesTaskType.GetMethod("CloneCustomMetadata", [||]) + (m.Invoke(instance,[||])) :?>IDictionary + member this.GetMetadata(metadataName) = + let m = buildUtilitiesTaskType.GetMethod("GetMetadata", [|typeof|]) + (m.Invoke(instance,[|metadataName|])) :?>string + member this.RemoveMetadata(metadataName) = + let m = buildUtilitiesTaskType.GetMethod("RemoveMetadata", [|typeof|]) + (m.Invoke(instance,[|metadataName|])) :?>string |>ignore + member this.SetMetadata(metadataName, metadataValue) = + let m = buildUtilitiesTaskType.GetMethod("SetMetadata", [|typeof;typeof|]) + (m.Invoke(instance,[|metadataName; metadataValue|])) |>ignore namespace FSharp.Compiler open System @@ -66,11 +70,10 @@ open System.Linq open System.Runtime.Versioning open FSComp open Microsoft.Win32 +open Microsoft.Build.Framework.Utilities module internal MsBuildAdapters = - open Microsoft.FSharp.Core.ReflectionAdapters - /// /// Used to specify the targeted version of the .NET Framework for some methods of ToolLocationHelper. This is meant to mimic /// the official version here: https://source.dot.net/#q=TargetDotNetFrameworkVersion. @@ -102,7 +105,6 @@ module internal MsBuildAdapters = module internal ToolLocationHelper = open Microsoft.Build.Framework - open Microsoft.FSharp.Core.ReflectionAdapters open System.Linq open System.Reflection open MsBuildAdapters diff --git a/src/utils/reshapedreflection.fs b/src/utils/reshapedreflection.fs deleted file mode 100644 index 0b143951dda..00000000000 --- a/src/utils/reshapedreflection.fs +++ /dev/null @@ -1,401 +0,0 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. - -namespace Microsoft.FSharp.Core -open System.Reflection - -//Replacement for: System.Security.SecurityElement.Escape(line) All platforms -module internal XmlAdapters = - open System.Text - open Microsoft.FSharp.Collections - - let s_escapeChars = [| '<'; '>'; '\"'; '\''; '&' |] - - let getEscapeSequence c = - match c with - | '<' -> "<" - | '>' -> ">" - | '\"' -> """ - | '\'' -> "'" - | '&' -> "&" - | _ as ch -> ch.ToString() - - let escape str = String.collect getEscapeSequence str - -#if FX_RESHAPED_REFLECTION -module internal ReflectionAdapters = - open System - open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators - open Microsoft.FSharp.Collections - open PrimReflectionAdapters - - let inline hasFlag (flag : BindingFlags) f = (f &&& flag) = flag - let isDeclaredFlag f = hasFlag BindingFlags.DeclaredOnly f - let isPublicFlag f = hasFlag BindingFlags.Public f - let isStaticFlag f = hasFlag BindingFlags.Static f - let isInstanceFlag f = hasFlag BindingFlags.Instance f - let isNonPublicFlag f = hasFlag BindingFlags.NonPublic f - - let isAcceptable bindingFlags isStatic isPublic = - // 1. check if member kind (static\instance) was specified in flags - ((isStaticFlag bindingFlags && isStatic) || (isInstanceFlag bindingFlags && not isStatic)) && - // 2. check if member accessibility was specified in flags - ((isPublicFlag bindingFlags && isPublic) || (isNonPublicFlag bindingFlags && not isPublic)) - - let publicFlags = BindingFlags.Public ||| BindingFlags.Instance ||| BindingFlags.Static - - let commit (results : _[]) = - match results with - | [||] -> null - | [| m |] -> m - | _ -> raise (AmbiguousMatchException()) - - let canUseAccessor (accessor : MethodInfo) nonPublic = - (not (isNull (box accessor))) && (accessor.IsPublic || nonPublic) - - type System.Type with - member this.GetTypeInfo() = IntrospectionExtensions.GetTypeInfo(this) - member this.GetRuntimeProperties() = RuntimeReflectionExtensions.GetRuntimeProperties(this) - member this.GetRuntimeEvents() = RuntimeReflectionExtensions.GetRuntimeEvents(this) - member this.Attributes = this.GetTypeInfo().Attributes - member this.GetCustomAttributes(attrTy, inherits) : obj[] = downcast box(CustomAttributeExtensions.GetCustomAttributes(this.GetTypeInfo(), attrTy, inherits) |> Seq.toArray) - member this.GetNestedType (name, bindingFlags) = - // MSDN: http://msdn.microsoft.com/en-us/library/0dcb3ad5.aspx - // The following BindingFlags filter flags can be used to define which nested types to include in the search: - // You must specify either BindingFlags.Public or BindingFlags.NonPublic to get a return. - // Specify BindingFlags.Public to include public nested types in the search. - // Specify BindingFlags.NonPublic to include non-public nested types (that is, private, internal, and protected nested types) in the search. - // This method returns only the nested types of the current type. It does not search the base classes of the current type. - // To find types that are nested in base classes, you must walk the inheritance hierarchy, calling GetNestedType at each level. - let nestedTyOpt = - this.GetTypeInfo().DeclaredNestedTypes - |> Seq.tryFind (fun nestedTy -> - nestedTy.Name = name && ( - (isPublicFlag bindingFlags && nestedTy.IsNestedPublic) || - (isNonPublicFlag bindingFlags && (nestedTy.IsNestedPrivate || nestedTy.IsNestedFamily || nestedTy.IsNestedAssembly || nestedTy.IsNestedFamORAssem || nestedTy.IsNestedFamANDAssem)) - ) - ) - |> Option.map (fun ti -> ti.AsType()) - defaultArg nestedTyOpt null - // use different sources based on Declared flag - member this.GetMethods(bindingFlags) = - (if isDeclaredFlag bindingFlags then this.GetTypeInfo().DeclaredMethods else this.GetRuntimeMethods()) - |> Seq.filter (fun m -> isAcceptable bindingFlags m.IsStatic m.IsPublic) - |> Seq.toArray - - // use different sources based on Declared flag - member this.GetFields(bindingFlags) = - (if isDeclaredFlag bindingFlags then this.GetTypeInfo().DeclaredFields else this.GetRuntimeFields()) - |> Seq.filter (fun f -> isAcceptable bindingFlags f.IsStatic f.IsPublic) - |> Seq.toArray - - // use different sources based on Declared flag - member this.GetProperties(?bindingFlags) = - let bindingFlags = defaultArg bindingFlags publicFlags - (if isDeclaredFlag bindingFlags then this.GetTypeInfo().DeclaredProperties else this.GetRuntimeProperties()) - |> Seq.filter (fun pi-> - let mi = match pi.GetMethod with | null -> pi.SetMethod | _ -> pi.GetMethod - if mi = null then false - else isAcceptable bindingFlags mi.IsStatic mi.IsPublic - ) - |> Seq.toArray - - member this.GetEvents(?bindingFlags) = - let bindingFlags = defaultArg bindingFlags publicFlags - (if isDeclaredFlag bindingFlags then this.GetTypeInfo().DeclaredEvents else this.GetRuntimeEvents()) - |> Seq.filter (fun ei-> - let m = ei.GetAddMethod(true) - if m = null then false - else isAcceptable bindingFlags m.IsStatic m.IsPublic - ) - |> Seq.toArray - - member this.GetEvent(name, ?bindingFlags) = - let bindingFlags = defaultArg bindingFlags publicFlags - this.GetEvents(bindingFlags) - |> Array.filter (fun ei -> ei.Name = name) - |> commit - - member this.GetConstructor(bindingFlags, _binder, argsT:Type[], _parameterModifiers) = - this.GetConstructor(bindingFlags,argsT) - - member this.GetMethod(name, ?bindingFlags) = - let bindingFlags = defaultArg bindingFlags publicFlags - this.GetMethods(bindingFlags) - |> Array.filter(fun m -> m.Name = name) - |> commit - - member this.GetMethod(name, _bindingFlags, _binder, argsT:Type[], _parameterModifiers) = - this.GetMethod(name, argsT) - - // use different sources based on Declared flag - member this.GetProperty(name, bindingFlags) = - this.GetProperties(bindingFlags) - |> Array.filter (fun pi -> pi.Name = name) - |> commit - - member this.GetMethod(methodName, args:Type[], ?bindingFlags) = - let bindingFlags = defaultArg bindingFlags publicFlags - let compareSequences parms args = - Seq.compareWith (fun parm arg -> if parm <> arg then 1 else 0) parms args - this.GetMethods(bindingFlags) - |> Array.filter(fun m -> m.Name = methodName && (compareSequences (m.GetParameters() |> Seq.map(fun x -> x.ParameterType)) args) = 0) - |> commit - - member this.GetNestedTypes(?bindingFlags) = - let bindingFlags = defaultArg bindingFlags publicFlags - this.GetTypeInfo().DeclaredNestedTypes - |> Seq.filter (fun nestedTy-> - (isPublicFlag bindingFlags && nestedTy.IsNestedPublic) || - (isNonPublicFlag bindingFlags && (nestedTy.IsNestedPrivate || nestedTy.IsNestedFamily || nestedTy.IsNestedAssembly || nestedTy.IsNestedFamORAssem || nestedTy.IsNestedFamANDAssem))) - |> Seq.map (fun ti -> ti.AsType()) - |> Seq.toArray - - member this.GetEnumUnderlyingType() = - Enum.GetUnderlyingType(this) - - member this.InvokeMember(memberName, bindingFlags, _binder, target:obj, arguments:obj[], _cultureInfo) = - let m = this.GetMethod(memberName, (arguments |> Seq.map(fun x -> x.GetType()) |> Seq.toArray), bindingFlags) - match m with - | null -> raise <| System.MissingMethodException(String.Format("Method '{0}.{1}' not found.", this.FullName, memberName)) - | _ -> m.Invoke(target, arguments) - - member this.IsGenericType = this.GetTypeInfo().IsGenericType - - member this.IsGenericTypeDefinition = this.GetTypeInfo().IsGenericTypeDefinition - - member this.GetGenericArguments() = - if this.IsGenericTypeDefinition then this.GetTypeInfo().GenericTypeParameters - elif this.IsGenericType then this.GenericTypeArguments - else [||] - - member this.IsInterface = this.GetTypeInfo().IsInterface - - member this.IsPublic = this.GetTypeInfo().IsPublic - - member this.IsNestedPublic = this.GetTypeInfo().IsNestedPublic - - member this.IsClass = this.GetTypeInfo().IsClass - - member this.IsValueType = this.GetTypeInfo().IsValueType - - member this.IsSealed = this.GetTypeInfo().IsSealed - - member this.BaseType = this.GetTypeInfo().BaseType - - member this.GetConstructor(bindingFlags, parameterTypes : Type[]) = - this.GetTypeInfo().DeclaredConstructors - |> Seq.filter (fun ci -> isAcceptable bindingFlags ci.IsStatic ci.IsPublic) - |> Seq.filter (fun ci -> - ( - let parameters = ci.GetParameters() - (parameters.Length = parameterTypes.Length) && - (parameterTypes, parameters) ||> Array.forall2 (fun ty pi -> pi.ParameterType.Equals ty) - ) - ) - |> Seq.toArray - |> commit - - member this.GetConstructor(parameterTypes : Type[]) = - this.GetConstructor(BindingFlags.Public ||| BindingFlags.NonPublic ||| BindingFlags.Instance, parameterTypes) - - member this.GetConstructors(?bindingFlags) = - let bindingFlags = defaultArg bindingFlags (BindingFlags.Public ||| BindingFlags.Instance) - // type initializer will also be included in resultset - this.GetTypeInfo().DeclaredConstructors - |> Seq.filter (fun ci -> isAcceptable bindingFlags ci.IsStatic ci.IsPublic) - |> Seq.toArray - - // MSDN: returns an array of Type objects representing all the interfaces implemented or inherited by the current Type. - member this.GetInterfaces() = this.GetTypeInfo().ImplementedInterfaces |> Seq.toArray - - member this.GetMethods() = this.GetMethods(publicFlags) - - member this.Assembly = this.GetTypeInfo().Assembly - - member this.IsSubclassOf(otherTy : Type) = this.GetTypeInfo().IsSubclassOf(otherTy) - - member this.IsEnum = this.GetTypeInfo().IsEnum; - - member this.GetField(name, bindingFlags) = - this.GetFields(bindingFlags) - |> Array.filter (fun fi -> fi.Name = name) - |> commit - - member this.GetField(name) = RuntimeReflectionExtensions.GetRuntimeField(this, name) - - member this.GetProperty(name, propertyType, parameterTypes : Type[]) = - this.GetProperties() - |> Array.filter (fun pi -> - pi.Name = name && - pi.PropertyType = propertyType && - ( - let parameters = pi.GetIndexParameters() - (parameters.Length = parameterTypes.Length) && - (parameterTypes, parameters) ||> Array.forall2 (fun ty pi -> pi.ParameterType.Equals ty) - ) - ) - |> commit - - static member GetTypeCode(ty : Type) = - if typeof.Equals ty then TypeCode.Int32 - elif typeof.Equals ty then TypeCode.Int64 - elif typeof.Equals ty then TypeCode.Byte - elif ty = typeof then TypeCode.SByte - elif ty = typeof then TypeCode.Int16 - elif ty = typeof then TypeCode.UInt16 - elif ty = typeof then TypeCode.UInt32 - elif ty = typeof then TypeCode.UInt64 - elif ty = typeof then TypeCode.Single - elif ty = typeof then TypeCode.Double - elif ty = typeof then TypeCode.Decimal - else TypeCode.Object - - member this.Module = - this.GetTypeInfo().Module - - member this.MetadataToken = - // TODO: is this an adequate replacement for MetadataToken - let s = String.Format("{0}", this.ToString()) - s.GetHashCode() - - type System.Reflection.EventInfo with - - member this.GetAddMethod() = - this.AddMethod - - member this.GetRemoveMethod() = - this.RemoveMethod - - member this.MetadataToken = - // TODO: is this an adequate replacement for MetadataToken - let s = String.Format("{0},{0}", this.DeclaringType.ToString(), this.ToString()) - s.GetHashCode() - - type System.Reflection.FieldInfo with - member this.GetRawConstantValue() = - this.GetValue(null) - - member this.MetadataToken = - // TODO: is this an adequate replacement for MetadataToken - let s = String.Format("{0},{0}", this.DeclaringType.ToString(), this.ToString()) - s.GetHashCode() - - type System.Reflection.MemberInfo with - member this.GetCustomAttributes(attrTy, inherits) : obj[] = downcast box(CustomAttributeExtensions.GetCustomAttributes(this, attrTy, inherits) |> Seq.toArray) - - // TODO: is this an adequate replacement for MetadataToken - member this.MetadataToken = - // TODO: is this an adequate replacement for MetadataToken - let s = String.Format("{0},{0}", this.DeclaringType.ToString(), this.ToString()) - s.GetHashCode() - - type System.Reflection.MethodInfo with - - member this.GetCustomAttributes(inherits : bool) : obj[] = downcast box(CustomAttributeExtensions.GetCustomAttributes(this, inherits) |> Seq.toArray) - - member this.Invoke(obj, _bindingFlags, _binder, args, _ci) = - this.Invoke(obj, args) - - member this.MetadataToken = - // TODO: is this an adequate replacement for MetadataToken - let s = String.Format("{0},{0}", this.DeclaringType.ToString(), this.ToString()) - s.GetHashCode() - - type System.Reflection.ParameterInfo with - - member this.RawDefaultValue = this.DefaultValue - - member this.MetadataToken = - // TODO: is this an adequate replacement for MetadataToken - // I really do not understand why: sprintf "%s,%s" (this.ReflectedType.ToString()) (this.ToString()) did not work - let s = String.Format("{0},{0},{0}", this.Member.DeclaringType.ToString(),this.Member.ToString(), this.ToString()) - s.GetHashCode() - - type System.Reflection.PropertyInfo with - - member this.GetGetMethod(nonPublic) = - let mi = this.GetMethod - if canUseAccessor mi nonPublic then mi - else null - - member this.GetSetMethod(nonPublic) = - let mi = this.SetMethod - if canUseAccessor mi nonPublic then mi - else null - - member this.GetGetMethod() = this.GetMethod - - member this.GetSetMethod() = this.SetMethod - - type System.Reflection.Assembly with - - member this.GetTypes() = - this.DefinedTypes - |> Seq.map (fun ti -> ti.AsType()) - |> Seq.toArray - - member this.GetExportedTypes() = - this.DefinedTypes - |> Seq.filter(fun ti -> ti.IsPublic) - |> Seq.map (fun ti -> ti.AsType()) - |> Seq.toArray - - member this.Location = - this.ManifestModule.FullyQualifiedName - - type System.Delegate with - - static member CreateDelegate(delegateType, methodInfo : MethodInfo) = methodInfo.CreateDelegate(delegateType) - - static member CreateDelegate(delegateType, obj : obj, methodInfo : MethodInfo) = methodInfo.CreateDelegate(delegateType, obj) - - type System.Object with - member this.GetPropertyValue(propName) = - this.GetType().GetProperty(propName, BindingFlags.Public).GetValue(this, null) - - member this.SetPropertyValue(propName, propValue) = - this.GetType().GetProperty(propName, BindingFlags.Public).SetValue(this, propValue, null) - - member this.GetMethod(methodName, argTypes) = - this.GetType().GetMethod(methodName, argTypes, BindingFlags.Public) - - type System.Char with - static member GetUnicodeCategory(c: char) = System.Globalization.CharUnicodeInfo.GetUnicodeCategory(c) - - type System.Reflection.Module with - member this.MetadataToken = - // TODO: is this an adequate replacement for MetadataToken - let s = this.FullyQualifiedName - s.GetHashCode() - -#if COMPILER // This part includes global state in globalLoadContext. Only include this support "once", i.e. when compiling FSharp.Compiler.Private.dll, FSharp.Compiler.Service.dll, fsc-proto.exe - - type CustomAssemblyResolver() = - inherit System.Runtime.Loader.AssemblyLoadContext() - override this.Load (assemblyName:AssemblyName):Assembly = - this.LoadFromAssemblyName(assemblyName) - - let globalLoadContext = - // This is an unfortunate temporary fix!!!! - // ======================================== - // We need to run fsi tests on a very old version of the corclr because of an unfortunate test framework - // This hack detects that, and uses the old code. - // On slightly newer code AssemblyLoadContext.Default is the way to go. - match Seq.tryHead (typeof.GetTypeInfo().Assembly.GetCustomAttributes()) with - | Some a when a.Version = "4.6.24410.01" -> new CustomAssemblyResolver() :> System.Runtime.Loader.AssemblyLoadContext - | _ -> System.Runtime.Loader.AssemblyLoadContext.Default - - type System.Reflection.Assembly with - static member LoadFrom(filename:string) = - globalLoadContext.LoadFromAssemblyPath(filename) - - static member UnsafeLoadFrom(filename:string) = - globalLoadContext.LoadFromAssemblyPath(filename) - - type System.Reflection.AssemblyName with - static member GetAssemblyName(path) = - System.Runtime.Loader.AssemblyLoadContext.GetAssemblyName(path) - -#endif - -#endif diff --git a/src/utils/sformat.fs b/src/utils/sformat.fs index b490283f674..0c8cc5fc2f4 100644 --- a/src/utils/sformat.fs +++ b/src/utils/sformat.fs @@ -38,11 +38,6 @@ namespace Microsoft.FSharp.Text.StructuredPrintfImpl open Microsoft.FSharp.Collections open Microsoft.FSharp.Primitives.Basics -#if FX_RESHAPED_REFLECTION - open PrimReflectionAdapters - open ReflectionAdapters -#endif - [] type LayoutTag = | ActivePatternCase @@ -321,11 +316,7 @@ namespace Microsoft.FSharp.Text.StructuredPrintfImpl StringLimit : int; #endif FormatProvider: System.IFormatProvider; -#if FX_RESHAPED_REFLECTION - ShowNonPublic : bool -#else BindingFlags: System.Reflection.BindingFlags -#endif PrintWidth : int; PrintDepth : int; PrintLength : int; @@ -339,11 +330,7 @@ namespace Microsoft.FSharp.Text.StructuredPrintfImpl StringLimit = System.Int32.MaxValue; #endif AttributeProcessor= (fun _ _ _ -> ()); -#if FX_RESHAPED_REFLECTION - ShowNonPublic = false -#else BindingFlags = System.Reflection.BindingFlags.Public; -#endif FloatingPointFormat = "g10"; PrintWidth = 80 ; PrintDepth = 100 ; @@ -358,11 +345,6 @@ namespace Microsoft.FSharp.Text.StructuredPrintfImpl open System open System.Reflection -#if FX_RESHAPED_REFLECTION - open PrimReflectionAdapters - open Microsoft.FSharp.Core.ReflectionAdapters -#endif - [] type TypeInfo = | TupleType of Type list @@ -404,10 +386,7 @@ namespace Microsoft.FSharp.Text.StructuredPrintfImpl // Analyze an object to see if it the representation // of an F# value. - let GetValueInfoOfObject (bindingFlags:BindingFlags) (obj : obj) = -#if FX_RESHAPED_REFLECTION - let showNonPublic = isNonPublicFlag bindingFlags -#endif + let GetValueInfoOfObject (bindingFlags:BindingFlags) (obj : obj) = match obj with | null -> ObjectValue(obj) | _ -> @@ -429,34 +408,18 @@ namespace Microsoft.FSharp.Text.StructuredPrintfImpl // the type are the actual fields of the type. Again, // we should be reading attributes here that indicate the // true structure of the type, e.g. the order of the fields. -#if FX_RESHAPED_REFLECTION - elif FSharpType.IsUnion(reprty, showNonPublic) then - let tag,vals = FSharpValue.GetUnionFields (obj,reprty, showNonPublic) -#else elif FSharpType.IsUnion(reprty,bindingFlags) then let tag,vals = FSharpValue.GetUnionFields (obj,reprty,bindingFlags) -#endif let props = tag.GetFields() let pvals = (props,vals) ||> Array.map2 (fun prop v -> prop.Name,(v, prop.PropertyType)) ConstructorValue(tag.Name, Array.toList pvals) -#if FX_RESHAPED_REFLECTION - elif FSharpType.IsExceptionRepresentation(reprty, showNonPublic) then - let props = FSharpType.GetExceptionFields(reprty, showNonPublic) - let vals = FSharpValue.GetExceptionFields(obj, showNonPublic) -#else elif FSharpType.IsExceptionRepresentation(reprty,bindingFlags) then let props = FSharpType.GetExceptionFields(reprty,bindingFlags) let vals = FSharpValue.GetExceptionFields(obj,bindingFlags) -#endif let pvals = (props,vals) ||> Array.map2 (fun prop v -> prop.Name,(v, prop.PropertyType)) ExceptionValue(reprty, pvals |> Array.toList) -#if FX_RESHAPED_REFLECTION - elif FSharpType.IsRecord(reprty, showNonPublic) then - let props = FSharpType.GetRecordFields(reprty, showNonPublic) -#else elif FSharpType.IsRecord(reprty,bindingFlags) then let props = FSharpType.GetRecordFields(reprty,bindingFlags) -#endif RecordValue(props |> Array.map (fun prop -> prop.Name, prop.GetValue(obj,null), prop.PropertyType) |> Array.toList) else ObjectValue(obj) @@ -491,12 +454,8 @@ namespace Microsoft.FSharp.Text.StructuredPrintfImpl let string_of_int (i:int) = i.ToString() let typeUsesSystemObjectToString (ty:System.Type) = - try -#if FX_RESHAPED_REFLECTION - let methInfo = ty.GetRuntimeMethod("ToString",[| |]) -#else + try let methInfo = ty.GetMethod("ToString",BindingFlags.Public ||| BindingFlags.Instance,null,[| |],null) -#endif methInfo.DeclaringType = typeof with e -> false /// If "str" ends with "ending" then remove it from "str", otherwise no change. @@ -800,16 +759,8 @@ namespace Microsoft.FSharp.Text.StructuredPrintfImpl // -------------------------------------------------------------------- let getProperty (ty: Type) (obj: obj) name = -#if FX_RESHAPED_REFLECTION - let prop = ty.GetProperty(name, (BindingFlags.Instance ||| BindingFlags.Public ||| BindingFlags.NonPublic)) - if not (isNull prop) then prop.GetValue(obj,[||]) - // Others raise MissingMethodException - else - let msg = System.String.Concat([| "Method '"; ty.FullName; "."; name; "' not found." |]) - raise (System.MissingMethodException(msg)) -#else ty.InvokeMember(name, (BindingFlags.GetProperty ||| BindingFlags.Instance ||| BindingFlags.Public ||| BindingFlags.NonPublic), null, obj, [| |],CultureInfo.InvariantCulture) -#endif + let getField obj (fieldInfo: FieldInfo) = fieldInfo.GetValue(obj) @@ -1177,11 +1128,7 @@ namespace Microsoft.FSharp.Text.StructuredPrintfImpl // If the leafFormatter was directly here, then layout leaves could store strings. match obj with | _ when opts.ShowProperties -> -#if FX_RESHAPED_REFLECTION - let props = ty.GetProperties(BindingFlags.Instance ||| BindingFlags.Public) -#else let props = ty.GetProperties(BindingFlags.GetField ||| BindingFlags.Instance ||| BindingFlags.Public) -#endif let fields = ty.GetFields(BindingFlags.Instance ||| BindingFlags.Public) |> Array.map (fun i -> i :> MemberInfo) let propsAndFields = props |> Array.map (fun i -> i :> MemberInfo) @@ -1197,10 +1144,10 @@ namespace Microsoft.FSharp.Text.StructuredPrintfImpl // massively reign in deep printing of properties let nDepth = depthLim/10 #if NETSTANDARD - Array.Sort((propsAndFields),{ new IComparer with member this.Compare(p1,p2) = compare (p1.Name) (p2.Name) } ); -#else - Array.Sort((propsAndFields :> Array),{ new System.Collections.IComparer with member this.Compare(p1,p2) = compare ((p1 :?> MemberInfo).Name) ((p2 :?> MemberInfo).Name) } ); -#endif + Array.Sort((propsAndFields),{ new IComparer with member this.Compare(p1,p2) = compare (p1.Name) (p2.Name) } ) +#else + Array.Sort((propsAndFields :> Array),{ new System.Collections.IComparer with member this.Compare(p1,p2) = compare ((p1 :?> MemberInfo).Name) ((p2 :?> MemberInfo).Name) } ) +#endif if propsAndFields.Length = 0 || (nDepth <= 0) then basicL else basicL --- @@ -1311,12 +1258,7 @@ namespace Microsoft.FSharp.Text.StructuredPrintfImpl let fsi_any_to_layout opts x = anyL ShowTopLevelBinding BindingFlags.Public opts x #else // FSharp.Core -#if FX_RESHAPED_REFLECTION - let internal anyToStringForPrintf options (showNonPublicMembers : bool) x = - let bindingFlags = ReflectionUtils.toBindingFlags showNonPublicMembers -#else let internal anyToStringForPrintf options (bindingFlags:BindingFlags) x = -#endif x |> anyL ShowAll bindingFlags options |> layout_to_string options #endif diff --git a/src/utils/sformat.fsi b/src/utils/sformat.fsi index f7c053e51fc..e6ff9762bb5 100644 --- a/src/utils/sformat.fsi +++ b/src/utils/sformat.fsi @@ -302,11 +302,7 @@ namespace Microsoft.FSharp.Text.StructuredPrintfImpl StringLimit: int; #endif FormatProvider: System.IFormatProvider -#if FX_RESHAPED_REFLECTION - ShowNonPublic : bool -#else BindingFlags: System.Reflection.BindingFlags -#endif PrintWidth : int PrintDepth : int PrintLength : int @@ -341,11 +337,7 @@ namespace Microsoft.FSharp.Text.StructuredPrintfImpl #if FSHARP_CORE // FSharp.Core.dll: Most functions aren't needed in FSharp.Core.dll, but we add one entry for printf -#if FX_RESHAPED_REFLECTION - val anyToStringForPrintf: options:FormatOptions -> showNonPublicMembers : bool -> value:'T * Type -> string -#else val anyToStringForPrintf: options:FormatOptions -> bindingFlags:System.Reflection.BindingFlags -> value:'T * Type -> string -#endif #else val asTaggedTextWriter: writer: TextWriter -> TaggedTextWriter val any_to_layout : options:FormatOptions -> value:'T * Type -> Layout diff --git a/tests/FSharp.Compiler.UnitTests/HashIfExpression.fs b/tests/FSharp.Compiler.UnitTests/HashIfExpression.fs index 91d7bfcb8d6..21667c727d5 100644 --- a/tests/FSharp.Compiler.UnitTests/HashIfExpression.fs +++ b/tests/FSharp.Compiler.UnitTests/HashIfExpression.fs @@ -12,7 +12,7 @@ open FSharp.Compiler open FSharp.Compiler.Lexer open FSharp.Compiler.Lexhelp open FSharp.Compiler.ErrorLogger -open FSharp.Compiler.ErrorLogger +open FSharp.Compiler.Features open FSharp.Compiler.Ast open Internal.Utilities @@ -69,7 +69,8 @@ type HashIfExpression() = CompileThreadStatic.ErrorLogger <- errorLogger let parser (s : string) = - let lexbuf = LexBuffer.FromChars (s.ToCharArray ()) + let isFeatureSupported (_featureId:LanguageFeature) = true + let lexbuf = LexBuffer.FromChars (isFeatureSupported, s.ToCharArray ()) lexbuf.StartPos <- startPos lexbuf.EndPos <- startPos let tokenStream = PPLexer.tokenstream args diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj b/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj index 24a2132e9c2..cf028bc3d22 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj +++ b/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj @@ -32,6 +32,7 @@ + @@ -80,8 +81,9 @@ - - + + + diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/DiscrimantedUnionType.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/DiscrimantedUnionType.fs index 90d30f40a6c..e5a48ad3007 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/DiscrimantedUnionType.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/DiscrimantedUnionType.fs @@ -10,17 +10,6 @@ open NUnit.Framework open FsCheck open FsCheck.PropOperators -#if FX_RESHAPED_REFLECTION -open FSharp.Reflection.FSharpReflectionExtensions - -[] -module PrimReflectionAdapters = - - type System.Type with - member this.IsValueType = this.GetTypeInfo().IsValueType -#endif - - type EnumUnion = | A | B diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncModule.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncModule.fs index 3e33f34bd5b..b525469322b 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncModule.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncModule.fs @@ -168,8 +168,8 @@ type AsyncModule() = let dispose(d : #IDisposable) = d.Dispose() - let testErrorAndCancelRace computation = - for _ in 1..20 do + let testErrorAndCancelRace testCaseName computation = + for i in 1..20 do let cts = new System.Threading.CancellationTokenSource() use barrier = new System.Threading.ManualResetEvent(false) async { cts.Cancel() } @@ -180,7 +180,7 @@ type AsyncModule() = Async.StartWithContinuations( computation, - (fun _ -> failwith "success not expected"), + (fun _ -> failwith (sprintf "Testcase: %s --- success not expected iterations 1 .. 20 - failed on iteration %d" testCaseName i)), (fun _ -> incr()), (fun _ -> incr()), cts.Token @@ -427,12 +427,11 @@ type AsyncModule() = member this.``RaceBetweenCancellationAndError.AwaitWaitHandle``() = let disposedEvent = new System.Threading.ManualResetEvent(false) dispose disposedEvent - - testErrorAndCancelRace(Async.AwaitWaitHandle disposedEvent) + testErrorAndCancelRace "RaceBetweenCancellationAndError.AwaitWaitHandle" (Async.AwaitWaitHandle disposedEvent) [] member this.``RaceBetweenCancellationAndError.Sleep``() = - testErrorAndCancelRace (Async.Sleep (-5)) + testErrorAndCancelRace "RaceBetweenCancellationAndError.Sleep" (Async.Sleep (-5)) #if EXPENSIVE #if NET46 @@ -626,3 +625,67 @@ type AsyncModule() = } |> Async.RunSynchronously Console.WriteLine "Checking result...." Assert.AreEqual(1, !x) + + [] + member this.``Parallel with maxDegreeOfParallelism`` () = + let mutable i = 1 + let action j = async { + Assert.AreEqual(j, i) + i <- i + 1 + } + let computation = + [| for i in 1 .. 1000 -> action i |] + |> fun cs -> Async.Parallel(cs, 1) + Async.RunSynchronously(computation) |> ignore + + [] + member this.``maxDegreeOfParallelism can not be 0`` () = + try + [| for i in 1 .. 10 -> async { return i } |] + |> fun cs -> Async.Parallel(cs, 0) + |> ignore + Assert.Fail("Unexpected success") + with + | :? System.ArgumentException as exc -> + Assert.AreEqual("maxDegreeOfParallelism", exc.ParamName) + Assert.True(exc.Message.Contains("maxDegreeOfParallelism must be positive, was 0")) + + [] + member this.``maxDegreeOfParallelism can not be negative`` () = + try + [| for i in 1 .. 10 -> async { return i } |] + |> fun cs -> Async.Parallel(cs, -1) + |> ignore + Assert.Fail("Unexpected success") + with + | :? System.ArgumentException as exc -> + Assert.AreEqual("maxDegreeOfParallelism", exc.ParamName) + Assert.True(exc.Message.Contains("maxDegreeOfParallelism must be positive, was -1")) + +// This has been failing very regularly on LINUX --- issue : https://github.com/dotnet/fsharp/issues/7112 +#if !TESTING_ON_LINUX + [] + member this.``RaceBetweenCancellationAndError.Parallel``() = + [| for i in 1 .. 1000 -> async { return i } |] + |> fun cs -> Async.Parallel(cs, 1) + |> testErrorAndCancelRace "RaceBetweenCancellationAndError.Parallel" +#endif + + [] + member this.``error on one workflow should cancel all others with maxDegreeOfParallelism``() = + let counter = + async { + let counter = ref 0 + let job i = async { + if i = 55 then failwith "boom" + else + do! Async.Sleep 1000 + incr counter + } + + let! _ = Async.Parallel ([ for i in 1 .. 100 -> job i ], 2) |> Async.Catch + do! Async.Sleep 5000 + return !counter + } |> Async.RunSynchronously + + Assert.AreEqual(0, counter) \ No newline at end of file diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Reflection/FSharpReflection.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Reflection/FSharpReflection.fs index 7e1dec5a2ff..21df908745d 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Reflection/FSharpReflection.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Reflection/FSharpReflection.fs @@ -26,30 +26,6 @@ Make sure each method works on: * Struct versions of the above *) -#if FX_RESHAPED_REFLECTION -module PrimReflectionAdapters = - open System.Linq - - type System.Type with - member this.Assembly = this.GetTypeInfo().Assembly - member this.IsGenericType = this.GetTypeInfo().IsGenericType - member this.IsValueType = this.GetTypeInfo().IsValueType - member this.IsAssignableFrom(otherTy : Type) = this.GetTypeInfo().IsAssignableFrom(otherTy.GetTypeInfo()) - member this.GetProperty(name) = this.GetRuntimeProperty(name) - member this.GetProperties() = this.GetRuntimeProperties() |> Array.ofSeq - member this.GetMethod(name, parameterTypes) = this.GetRuntimeMethod(name, parameterTypes) - member this.GetCustomAttributes(attrTy : Type, inherits : bool) : obj[] = - unbox (box (CustomAttributeExtensions.GetCustomAttributes(this.GetTypeInfo(), attrTy, inherits).ToArray())) - - type System.Reflection.MemberInfo with - member this.ReflectedType = this.DeclaringType - - type System.Reflection.Assembly with - member this.GetTypes() = this.DefinedTypes |> Seq.map (fun ti -> ti.AsType()) |> Array.ofSeq - -open PrimReflectionAdapters -#endif - module IsModule = type IsModuleType () = member __.M = 1 @@ -1056,22 +1032,14 @@ type FSharpTypeTests() = // Regression for 5588, Reflection: unit is still treated as a record type, but only if you pass BindingFlags.NonPublic [] - member __.``IsRecord.Regression5588``() = - + member __.``IsRecord.Regression5588``() = // negative Assert.IsFalse(FSharpType.IsRecord(typeof)) - -#if FX_RESHAPED_REFLECTION - Assert.IsFalse( FSharpType.IsRecord(typeof, true) ) -#else Assert.IsFalse( FSharpType.IsRecord(typeof, System.Reflection.BindingFlags.NonPublic) ) -#endif () - [] - member __.IsTuple() = - + member __.IsTuple() = // positive Assert.IsTrue(FSharpType.IsTuple(typeof>)) Assert.IsTrue(FSharpType.IsTuple(typeof>)) diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/RecordTypes.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/RecordTypes.fs index 112c3509b1b..e131a9274dd 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/RecordTypes.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/RecordTypes.fs @@ -11,16 +11,6 @@ open NUnit.Framework open FsCheck open FsCheck.PropOperators -#if FX_RESHAPED_REFLECTION -open FSharp.Reflection.FSharpReflectionExtensions - -[] -module PrimReflectionAdapters = - - type System.Type with - member this.IsValueType = this.GetTypeInfo().IsValueType -#endif - type Record = { A: int B: int diff --git a/tests/FSharp.Core.UnitTests/LibraryTestFx.fs b/tests/FSharp.Core.UnitTests/LibraryTestFx.fs index 03adf3fff51..77a9b2a3e60 100644 --- a/tests/FSharp.Core.UnitTests/LibraryTestFx.fs +++ b/tests/FSharp.Core.UnitTests/LibraryTestFx.fs @@ -54,60 +54,29 @@ let CheckThrowsFormatException f = CheckThrowsExn let VerifySeqsEqual (seq1 : seq<'T>) (seq2 : seq<'T>) = CollectionAssert.AreEqual(seq1, seq2) -let sleep(n : int32) = -#if FX_NO_THREAD - async { do! Async.Sleep(n) } |> Async.RunSynchronously -#else +let sleep(n : int32) = System.Threading.Thread.Sleep(n) -#endif -#if VERIFY_SURFACEAREA module SurfaceArea = open System.Reflection open System open System.Text.RegularExpressions - + // gets string form of public surface area for the currently-loaded FSharp.Core let private getActual () = - // get current FSharp.Core let asm = -#if FX_RESHAPED_REFLECTION - typeof.GetTypeInfo().Assembly -#else typeof.Assembly -#endif - + // public types only let types = -#if FX_RESHAPED_REFLECTION - asm.ExportedTypes |> Seq.filter (fun ty -> let ti = ty.GetTypeInfo() in ti.IsPublic || ti.IsNestedPublic) |> Array.ofSeq -#else asm.GetExportedTypes() -#endif // extract canonical string form for every public member of every type let getTypeMemberStrings (t : Type) = // for System.Runtime-based profiles, need to do lots of manual work -#if FX_RESHAPED_REFLECTION - let getMembers (t : Type) = - let ti = t.GetTypeInfo() - let cast (info : #MemberInfo) = (t, info :> MemberInfo) - seq { - yield! t.GetRuntimeEvents() |> Seq.filter (fun m -> m.AddMethod.IsPublic) |> Seq.map cast - yield! t.GetRuntimeProperties() |> Seq.filter (fun m -> m.GetMethod.IsPublic) |> Seq.map cast - yield! t.GetRuntimeMethods() |> Seq.filter (fun m -> m.IsPublic) |> Seq.map cast - yield! t.GetRuntimeFields() |> Seq.filter (fun m -> m.IsPublic) |> Seq.map cast - yield! ti.DeclaredConstructors |> Seq.filter (fun m -> m.IsPublic) |> Seq.map cast - yield! ti.DeclaredNestedTypes |> Seq.filter (fun ty -> ty.IsNestedPublic) |> Seq.map cast - } |> Array.ofSeq - - getMembers t - |> Array.map (fun (ty, m) -> sprintf "%s: %s" (ty.ToString()) (m.ToString())) -#else t.GetMembers() |> Array.map (fun v -> sprintf "%s: %s" (v.ReflectedType.ToString()) (v.ToString())) -#endif let actual = types |> Array.collect getTypeMemberStrings @@ -173,4 +142,4 @@ module SurfaceArea = sb.ToString () Assert.Fail msg -#endif \ No newline at end of file + () diff --git a/tests/FSharp.Core.UnitTests/SurfaceArea.coreclr.fs b/tests/FSharp.Core.UnitTests/SurfaceArea.coreclr.fs index 9de6db290bd..4d1c570e6f6 100644 --- a/tests/FSharp.Core.UnitTests/SurfaceArea.coreclr.fs +++ b/tests/FSharp.Core.UnitTests/SurfaceArea.coreclr.fs @@ -5,7 +5,6 @@ namespace FSharp.Core.UnitTests.Portable.SurfaceArea open NUnit.Framework open FSharp.Core.UnitTests.LibraryTestFx -[] type SurfaceAreaTest() = [] member this.VerifyArea() = @@ -91,6 +90,7 @@ Microsoft.FSharp.Collections.ArrayModule: Microsoft.FSharp.Collections.FSharpLis Microsoft.FSharp.Collections.ArrayModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndexBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], T[]) Microsoft.FSharp.Collections.ArrayModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndex[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], T[]) Microsoft.FSharp.Collections.ArrayModule: Microsoft.FSharp.Core.FSharpOption`1[TResult] TryPick[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpOption`1[TResult]], T[]) +Microsoft.FSharp.Collections.ArrayModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryExactlyOne[T](T[]) Microsoft.FSharp.Collections.ArrayModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFindBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], T[]) Microsoft.FSharp.Collections.ArrayModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFind[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], T[]) Microsoft.FSharp.Collections.ArrayModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryHead[T](T[]) @@ -114,7 +114,6 @@ Microsoft.FSharp.Collections.ArrayModule: System.Tuple`3[T1[],T2[],T3[]] Unzip3[ Microsoft.FSharp.Collections.ArrayModule: System.Type GetType() Microsoft.FSharp.Collections.ArrayModule: T Average[T](T[]) Microsoft.FSharp.Collections.ArrayModule: T ExactlyOne[T](T[]) -Microsoft.FSharp.Collections.ArrayModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryExactlyOne[T](T[]) Microsoft.FSharp.Collections.ArrayModule: T FindBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], T[]) Microsoft.FSharp.Collections.ArrayModule: T Find[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], T[]) Microsoft.FSharp.Collections.ArrayModule: T Get[T](T[], Int32) @@ -345,6 +344,7 @@ Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Collections.FSharpList Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndexBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndex[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Core.FSharpOption`1[TResult] TryPick[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpOption`1[TResult]], Microsoft.FSharp.Collections.FSharpList`1[T]) +Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryExactlyOne[T](Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFindBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFind[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryHead[T](Microsoft.FSharp.Collections.FSharpList`1[T]) @@ -361,7 +361,6 @@ Microsoft.FSharp.Collections.ListModule: System.Tuple`3[Microsoft.FSharp.Collect Microsoft.FSharp.Collections.ListModule: System.Type GetType() Microsoft.FSharp.Collections.ListModule: T Average[T](Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: T ExactlyOne[T](Microsoft.FSharp.Collections.FSharpList`1[T]) -Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryExactlyOne[T](Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: T FindBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: T Find[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: T Get[T](Microsoft.FSharp.Collections.FSharpList`1[T], Int32) @@ -433,6 +432,7 @@ Microsoft.FSharp.Collections.SeqModule: Microsoft.FSharp.Collections.FSharpList` Microsoft.FSharp.Collections.SeqModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndexBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndex[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: Microsoft.FSharp.Core.FSharpOption`1[TResult] TryPick[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpOption`1[TResult]], System.Collections.Generic.IEnumerable`1[T]) +Microsoft.FSharp.Collections.SeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryExactlyOne[T](System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFindBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFind[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryHead[T](System.Collections.Generic.IEnumerable`1[T]) @@ -496,7 +496,6 @@ Microsoft.FSharp.Collections.SeqModule: System.Tuple`2[System.Collections.Generi Microsoft.FSharp.Collections.SeqModule: System.Type GetType() Microsoft.FSharp.Collections.SeqModule: T Average[T](System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: T ExactlyOne[T](System.Collections.Generic.IEnumerable`1[T]) -Microsoft.FSharp.Collections.SeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryExactlyOne[T](System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: T FindBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: T Find[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: T Get[T](Int32, System.Collections.Generic.IEnumerable`1[T]) @@ -621,6 +620,8 @@ Microsoft.FSharp.Control.FSharpAsync: Microsoft.FSharp.Control.FSharpAsync`1[Sys Microsoft.FSharp.Control.FSharpAsync: Microsoft.FSharp.Control.FSharpAsync`1[System.Threading.CancellationToken] get_CancellationToken() Microsoft.FSharp.Control.FSharpAsync: Microsoft.FSharp.Control.FSharpAsync`1[System.Threading.Tasks.Task`1[T]] StartChildAsTask[T](Microsoft.FSharp.Control.FSharpAsync`1[T], Microsoft.FSharp.Core.FSharpOption`1[System.Threading.Tasks.TaskCreationOptions]) Microsoft.FSharp.Control.FSharpAsync: Microsoft.FSharp.Control.FSharpAsync`1[T[]] Parallel[T](System.Collections.Generic.IEnumerable`1[Microsoft.FSharp.Control.FSharpAsync`1[T]]) +Microsoft.FSharp.Control.FSharpAsync: Microsoft.FSharp.Control.FSharpAsync`1[T[]] Parallel[T](System.Collections.Generic.IEnumerable`1[Microsoft.FSharp.Control.FSharpAsync`1[T]], Microsoft.FSharp.Core.FSharpOption`1[System.Int32]) +Microsoft.FSharp.Control.FSharpAsync: Microsoft.FSharp.Control.FSharpAsync`1[T[]] Sequential[T](System.Collections.Generic.IEnumerable`1[Microsoft.FSharp.Control.FSharpAsync`1[T]]) Microsoft.FSharp.Control.FSharpAsync: Microsoft.FSharp.Control.FSharpAsync`1[T] AwaitEvent[TDel,T](Microsoft.FSharp.Control.IEvent`2[TDel,T], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Core.Unit]]) Microsoft.FSharp.Control.FSharpAsync: Microsoft.FSharp.Control.FSharpAsync`1[T] AwaitTask[T](System.Threading.Tasks.Task`1[T]) Microsoft.FSharp.Control.FSharpAsync: Microsoft.FSharp.Control.FSharpAsync`1[T] FromBeginEnd[TArg1,TArg2,TArg3,T](TArg1, TArg2, TArg3, Microsoft.FSharp.Core.FSharpFunc`2[System.Tuple`5[TArg1,TArg2,TArg3,System.AsyncCallback,System.Object],System.IAsyncResult], Microsoft.FSharp.Core.FSharpFunc`2[System.IAsyncResult,T], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Core.Unit]]) @@ -755,6 +756,9 @@ Microsoft.FSharp.Control.ObservableModule: Void Add[T](Microsoft.FSharp.Core.FSh Microsoft.FSharp.Control.WebExtensions: Boolean Equals(System.Object) Microsoft.FSharp.Control.WebExtensions: Int32 GetHashCode() Microsoft.FSharp.Control.WebExtensions: Microsoft.FSharp.Control.FSharpAsync`1[System.Net.WebResponse] AsyncGetResponse(System.Net.WebRequest) +Microsoft.FSharp.Control.WebExtensions: Microsoft.FSharp.Control.FSharpAsync`1[Microsoft.FSharp.Core.Unit] AsyncDownloadFile(System.Net.WebClient, System.Uri, System.String) +Microsoft.FSharp.Control.WebExtensions: Microsoft.FSharp.Control.FSharpAsync`1[System.Byte[]] AsyncDownloadData(System.Net.WebClient, System.Uri) +Microsoft.FSharp.Control.WebExtensions: Microsoft.FSharp.Control.FSharpAsync`1[System.String] AsyncDownloadString(System.Net.WebClient, System.Uri) Microsoft.FSharp.Control.WebExtensions: System.String ToString() Microsoft.FSharp.Control.WebExtensions: System.Type GetType() Microsoft.FSharp.Core.AbstractClassAttribute: Boolean Equals(System.Object) @@ -2136,6 +2140,10 @@ Microsoft.FSharp.Core.FSharpChoice`7[T1,T2,T3,T4,T5,T6,T7]: System.String ToStri Microsoft.FSharp.Core.FSharpChoice`7[T1,T2,T3,T4,T5,T6,T7]: System.Type GetType() Microsoft.FSharp.Core.FSharpFunc`2[T,TResult]: Boolean Equals(System.Object) Microsoft.FSharp.Core.FSharpFunc`2[T,TResult]: Int32 GetHashCode() +Microsoft.FSharp.Core.FSharpFunc`2[T,TResult]: Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] FromConverter(System.Converter`2[T,TResult]) +Microsoft.FSharp.Core.FSharpFunc`2[T,TResult]: Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] op_Implicit(System.Converter`2[T,TResult]) +Microsoft.FSharp.Core.FSharpFunc`2[T,TResult]: System.Converter`2[T,TResult] ToConverter(Microsoft.FSharp.Core.FSharpFunc`2[T,TResult]) +Microsoft.FSharp.Core.FSharpFunc`2[T,TResult]: System.Converter`2[T,TResult] op_Implicit(Microsoft.FSharp.Core.FSharpFunc`2[T,TResult]) Microsoft.FSharp.Core.FSharpFunc`2[T,TResult]: System.String ToString() Microsoft.FSharp.Core.FSharpFunc`2[T,TResult]: System.Type GetType() Microsoft.FSharp.Core.FSharpFunc`2[T,TResult]: TResult Invoke(T) @@ -2250,8 +2258,12 @@ Microsoft.FSharp.Core.FSharpValueOption`1+Tags[T]: System.Type GetType() Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean Equals(Microsoft.FSharp.Core.FSharpValueOption`1[T]) Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean Equals(System.Object) Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean Equals(System.Object, System.Collections.IEqualityComparer) +Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean IsNone +Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean IsSome Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean IsValueNone Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean IsValueSome +Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean get_IsNone() +Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean get_IsSome() Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean get_IsValueNone() Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean get_IsValueSome() Microsoft.FSharp.Core.FSharpValueOption`1[T]: Int32 CompareTo(Microsoft.FSharp.Core.FSharpValueOption`1[T]) @@ -2263,7 +2275,10 @@ Microsoft.FSharp.Core.FSharpValueOption`1[T]: Int32 Tag Microsoft.FSharp.Core.FSharpValueOption`1[T]: Int32 get_Tag() Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1+Tags[T] Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1[T] NewValueSome(T) +Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1[T] None +Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1[T] Some(T) Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1[T] ValueNone +Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1[T] get_None() Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1[T] get_ValueNone() Microsoft.FSharp.Core.FSharpValueOption`1[T]: System.String ToString() Microsoft.FSharp.Core.FSharpValueOption`1[T]: System.Type GetType() @@ -2271,19 +2286,6 @@ Microsoft.FSharp.Core.FSharpValueOption`1[T]: T Item Microsoft.FSharp.Core.FSharpValueOption`1[T]: T Value Microsoft.FSharp.Core.FSharpValueOption`1[T]: T get_Item() Microsoft.FSharp.Core.FSharpValueOption`1[T]: T get_Value() -Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean IsNone -Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean IsSome -Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean get_IsNone() -Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean get_IsSome() -Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1[T] None -Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1[T] Some(T) -Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1[T] get_None() -Microsoft.FSharp.Core.FSharpTypeFunc: Boolean Equals(System.Object) -Microsoft.FSharp.Core.FSharpTypeFunc: Int32 GetHashCode() -Microsoft.FSharp.Core.FSharpTypeFunc: System.Object Specialize[T]() -Microsoft.FSharp.Core.FSharpTypeFunc: System.String ToString() -Microsoft.FSharp.Core.FSharpTypeFunc: System.Type GetType() -Microsoft.FSharp.Core.FSharpTypeFunc: Void .ctor() Microsoft.FSharp.Core.FuncConvert: Boolean Equals(System.Object) Microsoft.FSharp.Core.FuncConvert: Int32 GetHashCode() Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Core.Unit] FromAction(System.Action) @@ -2291,6 +2293,7 @@ Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[Microsoft. Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit] FromAction[T](System.Action`1[T]) Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit] ToFSharpFunc[T](System.Action`1[T]) Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] FromFunc[T,TResult](System.Func`2[T,TResult]) +Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] ToFSharpFunc[T,TResult](System.Converter`2[T,TResult]) Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[T3,Microsoft.FSharp.Core.FSharpFunc`2[T4,Microsoft.FSharp.Core.FSharpFunc`2[T5,Microsoft.FSharp.Core.Unit]]]]] FromAction[T1,T2,T3,T4,T5](System.Action`5[T1,T2,T3,T4,T5]) Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[T3,Microsoft.FSharp.Core.FSharpFunc`2[T4,Microsoft.FSharp.Core.FSharpFunc`2[T5,TResult]]]]] FromFunc[T1,T2,T3,T4,T5,TResult](System.Func`6[T1,T2,T3,T4,T5,TResult]) Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[T3,Microsoft.FSharp.Core.FSharpFunc`2[T4,Microsoft.FSharp.Core.FSharpFunc`2[T5,TResult]]]]] FuncFromTupled[T1,T2,T3,T4,T5,TResult](Microsoft.FSharp.Core.FSharpFunc`2[System.Tuple`5[T1,T2,T3,T4,T5],TResult]) @@ -2874,36 +2877,6 @@ Microsoft.FSharp.Core.OptionModule: TState FoldBack[T,TState](Microsoft.FSharp.C Microsoft.FSharp.Core.OptionModule: TState Fold[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]], TState, Microsoft.FSharp.Core.FSharpOption`1[T]) Microsoft.FSharp.Core.OptionModule: T[] ToArray[T](Microsoft.FSharp.Core.FSharpOption`1[T]) Microsoft.FSharp.Core.OptionModule: Void Iterate[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit], Microsoft.FSharp.Core.FSharpOption`1[T]) -Microsoft.FSharp.Core.ValueOption: Boolean Contains[T](T, Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: Boolean Equals(System.Object) -Microsoft.FSharp.Core.ValueOption: Boolean Exists[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: Boolean ForAll[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: Boolean IsNone[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: Boolean IsSome[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: Int32 Count[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: Int32 GetHashCode() -Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Collections.FSharpList`1[T] ToList[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[TResult] Bind[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpValueOption`1[TResult]], Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[TResult] Map2[T1,T2,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,TResult]], Microsoft.FSharp.Core.FSharpValueOption`1[T1], Microsoft.FSharp.Core.FSharpValueOption`1[T2]) -Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[TResult] Map3[T1,T2,T3,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[T3,TResult]]], Microsoft.FSharp.Core.FSharpValueOption`1[T1], Microsoft.FSharp.Core.FSharpValueOption`1[T2], Microsoft.FSharp.Core.FSharpValueOption`1[T3]) -Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[TResult] Map[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] Filter[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] Flatten[T](Microsoft.FSharp.Core.FSharpValueOption`1[Microsoft.FSharp.Core.FSharpValueOption`1[T]]) -Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OfNullable[T](System.Nullable`1[T]) -Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OfObj[T](T) -Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OrElseWith[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Core.FSharpValueOption`1[T]], Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OrElse[T](Microsoft.FSharp.Core.FSharpValueOption`1[T], Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: System.Nullable`1[T] ToNullable[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: System.String ToString() -Microsoft.FSharp.Core.ValueOption: System.Type GetType() -Microsoft.FSharp.Core.ValueOption: T DefaultValue[T](T, Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: T DefaultWith[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,T], Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: T GetValue[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: T ToObj[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: TState FoldBack[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]], Microsoft.FSharp.Core.FSharpValueOption`1[T], TState) -Microsoft.FSharp.Core.ValueOption: TState Fold[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]], TState, Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: T[] ToArray[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: Void Iterate[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit], Microsoft.FSharp.Core.FSharpValueOption`1[T]) Microsoft.FSharp.Core.OptionalArgumentAttribute: Boolean Equals(System.Object) Microsoft.FSharp.Core.OptionalArgumentAttribute: Boolean IsDefaultAttribute() Microsoft.FSharp.Core.OptionalArgumentAttribute: Boolean Match(System.Object) @@ -3101,6 +3074,36 @@ Microsoft.FSharp.Core.UnverifiableAttribute: System.Object get_TypeId() Microsoft.FSharp.Core.UnverifiableAttribute: System.String ToString() Microsoft.FSharp.Core.UnverifiableAttribute: System.Type GetType() Microsoft.FSharp.Core.UnverifiableAttribute: Void .ctor() +Microsoft.FSharp.Core.ValueOption: Boolean Contains[T](T, Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: Boolean Equals(System.Object) +Microsoft.FSharp.Core.ValueOption: Boolean Exists[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: Boolean ForAll[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: Boolean IsNone[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: Boolean IsSome[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: Int32 Count[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: Int32 GetHashCode() +Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Collections.FSharpList`1[T] ToList[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[TResult] Bind[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpValueOption`1[TResult]], Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[TResult] Map2[T1,T2,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,TResult]], Microsoft.FSharp.Core.FSharpValueOption`1[T1], Microsoft.FSharp.Core.FSharpValueOption`1[T2]) +Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[TResult] Map3[T1,T2,T3,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[T3,TResult]]], Microsoft.FSharp.Core.FSharpValueOption`1[T1], Microsoft.FSharp.Core.FSharpValueOption`1[T2], Microsoft.FSharp.Core.FSharpValueOption`1[T3]) +Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[TResult] Map[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] Filter[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] Flatten[T](Microsoft.FSharp.Core.FSharpValueOption`1[Microsoft.FSharp.Core.FSharpValueOption`1[T]]) +Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OfNullable[T](System.Nullable`1[T]) +Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OfObj[T](T) +Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OrElseWith[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Core.FSharpValueOption`1[T]], Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OrElse[T](Microsoft.FSharp.Core.FSharpValueOption`1[T], Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: System.Nullable`1[T] ToNullable[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: System.String ToString() +Microsoft.FSharp.Core.ValueOption: System.Type GetType() +Microsoft.FSharp.Core.ValueOption: T DefaultValue[T](T, Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: T DefaultWith[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,T], Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: T GetValue[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: T ToObj[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: TState FoldBack[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]], Microsoft.FSharp.Core.FSharpValueOption`1[T], TState) +Microsoft.FSharp.Core.ValueOption: TState Fold[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]], TState, Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: T[] ToArray[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: Void Iterate[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit], Microsoft.FSharp.Core.FSharpValueOption`1[T]) Microsoft.FSharp.Core.VolatileFieldAttribute: Boolean Equals(System.Object) Microsoft.FSharp.Core.VolatileFieldAttribute: Boolean IsDefaultAttribute() Microsoft.FSharp.Core.VolatileFieldAttribute: Boolean Match(System.Object) diff --git a/tests/FSharp.Core.UnitTests/SurfaceArea.net40.fs b/tests/FSharp.Core.UnitTests/SurfaceArea.net40.fs index 16035e67c02..945b341a372 100644 --- a/tests/FSharp.Core.UnitTests/SurfaceArea.net40.fs +++ b/tests/FSharp.Core.UnitTests/SurfaceArea.net40.fs @@ -5,7 +5,6 @@ namespace FSharp.Core.UnitTests.SurfaceArea open NUnit.Framework open FSharp.Core.UnitTests.LibraryTestFx -[] type SurfaceAreaTest() = [] member this.VerifyArea() = @@ -91,6 +90,7 @@ Microsoft.FSharp.Collections.ArrayModule: Microsoft.FSharp.Collections.FSharpLis Microsoft.FSharp.Collections.ArrayModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndexBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], T[]) Microsoft.FSharp.Collections.ArrayModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndex[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], T[]) Microsoft.FSharp.Collections.ArrayModule: Microsoft.FSharp.Core.FSharpOption`1[TResult] TryPick[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpOption`1[TResult]], T[]) +Microsoft.FSharp.Collections.ArrayModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryExactlyOne[T](T[]) Microsoft.FSharp.Collections.ArrayModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFindBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], T[]) Microsoft.FSharp.Collections.ArrayModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFind[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], T[]) Microsoft.FSharp.Collections.ArrayModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryHead[T](T[]) @@ -114,7 +114,6 @@ Microsoft.FSharp.Collections.ArrayModule: System.Tuple`3[T1[],T2[],T3[]] Unzip3[ Microsoft.FSharp.Collections.ArrayModule: System.Type GetType() Microsoft.FSharp.Collections.ArrayModule: T Average[T](T[]) Microsoft.FSharp.Collections.ArrayModule: T ExactlyOne[T](T[]) -Microsoft.FSharp.Collections.ArrayModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryExactlyOne[T](T[]) Microsoft.FSharp.Collections.ArrayModule: T FindBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], T[]) Microsoft.FSharp.Collections.ArrayModule: T Find[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], T[]) Microsoft.FSharp.Collections.ArrayModule: T Get[T](T[], Int32) @@ -239,6 +238,7 @@ Microsoft.FSharp.Collections.FSharpList`1[T]: Void .ctor(T, Microsoft.FSharp.Col Microsoft.FSharp.Collections.FSharpMap`2[TKey,TValue]: Boolean ContainsKey(TKey) Microsoft.FSharp.Collections.FSharpMap`2[TKey,TValue]: Boolean Equals(System.Object) Microsoft.FSharp.Collections.FSharpMap`2[TKey,TValue]: Boolean IsEmpty +Microsoft.FSharp.Collections.FSharpMap`2[TKey,TValue]: Boolean TryGetValue(TKey, TValue ByRef) Microsoft.FSharp.Collections.FSharpMap`2[TKey,TValue]: Boolean get_IsEmpty() Microsoft.FSharp.Collections.FSharpMap`2[TKey,TValue]: Int32 Count Microsoft.FSharp.Collections.FSharpMap`2[TKey,TValue]: Int32 GetHashCode() @@ -246,7 +246,6 @@ Microsoft.FSharp.Collections.FSharpMap`2[TKey,TValue]: Int32 get_Count() Microsoft.FSharp.Collections.FSharpMap`2[TKey,TValue]: Microsoft.FSharp.Collections.FSharpMap`2[TKey,TValue] Add(TKey, TValue) Microsoft.FSharp.Collections.FSharpMap`2[TKey,TValue]: Microsoft.FSharp.Collections.FSharpMap`2[TKey,TValue] Remove(TKey) Microsoft.FSharp.Collections.FSharpMap`2[TKey,TValue]: Microsoft.FSharp.Core.FSharpOption`1[TValue] TryFind(TKey) -Microsoft.FSharp.Collections.FSharpMap`2[TKey,TValue]: Boolean TryGetValue(TKey, TValue ByRef) Microsoft.FSharp.Collections.FSharpMap`2[TKey,TValue]: System.String ToString() Microsoft.FSharp.Collections.FSharpMap`2[TKey,TValue]: System.Type GetType() Microsoft.FSharp.Collections.FSharpMap`2[TKey,TValue]: TValue Item [TKey] @@ -345,6 +344,7 @@ Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Collections.FSharpList Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndexBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndex[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Core.FSharpOption`1[TResult] TryPick[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpOption`1[TResult]], Microsoft.FSharp.Collections.FSharpList`1[T]) +Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryExactlyOne[T](Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFindBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFind[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryHead[T](Microsoft.FSharp.Collections.FSharpList`1[T]) @@ -361,7 +361,6 @@ Microsoft.FSharp.Collections.ListModule: System.Tuple`3[Microsoft.FSharp.Collect Microsoft.FSharp.Collections.ListModule: System.Type GetType() Microsoft.FSharp.Collections.ListModule: T Average[T](Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: T ExactlyOne[T](Microsoft.FSharp.Collections.FSharpList`1[T]) -Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryExactlyOne[T](Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: T FindBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: T Find[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: T Get[T](Microsoft.FSharp.Collections.FSharpList`1[T], Int32) @@ -433,6 +432,7 @@ Microsoft.FSharp.Collections.SeqModule: Microsoft.FSharp.Collections.FSharpList` Microsoft.FSharp.Collections.SeqModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndexBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndex[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: Microsoft.FSharp.Core.FSharpOption`1[TResult] TryPick[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpOption`1[TResult]], System.Collections.Generic.IEnumerable`1[T]) +Microsoft.FSharp.Collections.SeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryExactlyOne[T](System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFindBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFind[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryHead[T](System.Collections.Generic.IEnumerable`1[T]) @@ -496,7 +496,6 @@ Microsoft.FSharp.Collections.SeqModule: System.Tuple`2[System.Collections.Generi Microsoft.FSharp.Collections.SeqModule: System.Type GetType() Microsoft.FSharp.Collections.SeqModule: T Average[T](System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: T ExactlyOne[T](System.Collections.Generic.IEnumerable`1[T]) -Microsoft.FSharp.Collections.SeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryExactlyOne[T](System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: T FindBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: T Find[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: T Get[T](Int32, System.Collections.Generic.IEnumerable`1[T]) @@ -563,10 +562,10 @@ Microsoft.FSharp.Control.AsyncActivation`1[T]: Boolean IsCancellationRequested Microsoft.FSharp.Control.AsyncActivation`1[T]: Boolean get_IsCancellationRequested() Microsoft.FSharp.Control.AsyncActivation`1[T]: Int32 GetHashCode() Microsoft.FSharp.Control.AsyncActivation`1[T]: Microsoft.FSharp.Control.AsyncReturn OnCancellation() -Microsoft.FSharp.Control.AsyncActivation`1[T]: Void OnExceptionRaised() Microsoft.FSharp.Control.AsyncActivation`1[T]: Microsoft.FSharp.Control.AsyncReturn OnSuccess(T) Microsoft.FSharp.Control.AsyncActivation`1[T]: System.String ToString() Microsoft.FSharp.Control.AsyncActivation`1[T]: System.Type GetType() +Microsoft.FSharp.Control.AsyncActivation`1[T]: Void OnExceptionRaised() Microsoft.FSharp.Control.AsyncPrimitives: Boolean Equals(System.Object) Microsoft.FSharp.Control.AsyncPrimitives: Int32 GetHashCode() Microsoft.FSharp.Control.AsyncPrimitives: Microsoft.FSharp.Control.AsyncReturn Bind[T,TResult](Microsoft.FSharp.Control.AsyncActivation`1[T], Microsoft.FSharp.Control.FSharpAsync`1[TResult], Microsoft.FSharp.Core.FSharpFunc`2[TResult,Microsoft.FSharp.Control.FSharpAsync`1[T]]) @@ -621,6 +620,8 @@ Microsoft.FSharp.Control.FSharpAsync: Microsoft.FSharp.Control.FSharpAsync`1[Sys Microsoft.FSharp.Control.FSharpAsync: Microsoft.FSharp.Control.FSharpAsync`1[System.Threading.CancellationToken] get_CancellationToken() Microsoft.FSharp.Control.FSharpAsync: Microsoft.FSharp.Control.FSharpAsync`1[System.Threading.Tasks.Task`1[T]] StartChildAsTask[T](Microsoft.FSharp.Control.FSharpAsync`1[T], Microsoft.FSharp.Core.FSharpOption`1[System.Threading.Tasks.TaskCreationOptions]) Microsoft.FSharp.Control.FSharpAsync: Microsoft.FSharp.Control.FSharpAsync`1[T[]] Parallel[T](System.Collections.Generic.IEnumerable`1[Microsoft.FSharp.Control.FSharpAsync`1[T]]) +Microsoft.FSharp.Control.FSharpAsync: Microsoft.FSharp.Control.FSharpAsync`1[T[]] Parallel[T](System.Collections.Generic.IEnumerable`1[Microsoft.FSharp.Control.FSharpAsync`1[T]], Microsoft.FSharp.Core.FSharpOption`1[System.Int32]) +Microsoft.FSharp.Control.FSharpAsync: Microsoft.FSharp.Control.FSharpAsync`1[T[]] Sequential[T](System.Collections.Generic.IEnumerable`1[Microsoft.FSharp.Control.FSharpAsync`1[T]]) Microsoft.FSharp.Control.FSharpAsync: Microsoft.FSharp.Control.FSharpAsync`1[T] AwaitEvent[TDel,T](Microsoft.FSharp.Control.IEvent`2[TDel,T], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Core.Unit]]) Microsoft.FSharp.Control.FSharpAsync: Microsoft.FSharp.Control.FSharpAsync`1[T] AwaitTask[T](System.Threading.Tasks.Task`1[T]) Microsoft.FSharp.Control.FSharpAsync: Microsoft.FSharp.Control.FSharpAsync`1[T] FromBeginEnd[TArg1,TArg2,TArg3,T](TArg1, TArg2, TArg3, Microsoft.FSharp.Core.FSharpFunc`2[System.Tuple`5[TArg1,TArg2,TArg3,System.AsyncCallback,System.Object],System.IAsyncResult], Microsoft.FSharp.Core.FSharpFunc`2[System.IAsyncResult,T], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Core.Unit]]) @@ -2242,6 +2243,12 @@ Microsoft.FSharp.Core.FSharpResult`2[T,TError]: T ResultValue Microsoft.FSharp.Core.FSharpResult`2[T,TError]: T get_ResultValue() Microsoft.FSharp.Core.FSharpResult`2[T,TError]: TError ErrorValue Microsoft.FSharp.Core.FSharpResult`2[T,TError]: TError get_ErrorValue() +Microsoft.FSharp.Core.FSharpTypeFunc: Boolean Equals(System.Object) +Microsoft.FSharp.Core.FSharpTypeFunc: Int32 GetHashCode() +Microsoft.FSharp.Core.FSharpTypeFunc: System.Object Specialize[T]() +Microsoft.FSharp.Core.FSharpTypeFunc: System.String ToString() +Microsoft.FSharp.Core.FSharpTypeFunc: System.Type GetType() +Microsoft.FSharp.Core.FSharpTypeFunc: Void .ctor() Microsoft.FSharp.Core.FSharpValueOption`1+Tags[T]: Boolean Equals(System.Object) Microsoft.FSharp.Core.FSharpValueOption`1+Tags[T]: Int32 GetHashCode() Microsoft.FSharp.Core.FSharpValueOption`1+Tags[T]: Int32 ValueNone @@ -2251,6 +2258,14 @@ Microsoft.FSharp.Core.FSharpValueOption`1+Tags[T]: System.Type GetType() Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean Equals(Microsoft.FSharp.Core.FSharpValueOption`1[T]) Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean Equals(System.Object) Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean Equals(System.Object, System.Collections.IEqualityComparer) +Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean IsNone +Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean IsSome +Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean IsValueNone +Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean IsValueSome +Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean get_IsNone() +Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean get_IsSome() +Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean get_IsValueNone() +Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean get_IsValueSome() Microsoft.FSharp.Core.FSharpValueOption`1[T]: Int32 CompareTo(Microsoft.FSharp.Core.FSharpValueOption`1[T]) Microsoft.FSharp.Core.FSharpValueOption`1[T]: Int32 CompareTo(System.Object) Microsoft.FSharp.Core.FSharpValueOption`1[T]: Int32 CompareTo(System.Object, System.Collections.IComparer) @@ -2259,12 +2274,11 @@ Microsoft.FSharp.Core.FSharpValueOption`1[T]: Int32 GetHashCode(System.Collectio Microsoft.FSharp.Core.FSharpValueOption`1[T]: Int32 Tag Microsoft.FSharp.Core.FSharpValueOption`1[T]: Int32 get_Tag() Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1+Tags[T] -Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1[T] ValueNone -Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean IsValueNone -Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean IsValueSome -Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean get_IsValueNone() -Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean get_IsValueSome() Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1[T] NewValueSome(T) +Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1[T] None +Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1[T] Some(T) +Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1[T] ValueNone +Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1[T] get_None() Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1[T] get_ValueNone() Microsoft.FSharp.Core.FSharpValueOption`1[T]: System.String ToString() Microsoft.FSharp.Core.FSharpValueOption`1[T]: System.Type GetType() @@ -2272,38 +2286,25 @@ Microsoft.FSharp.Core.FSharpValueOption`1[T]: T Item Microsoft.FSharp.Core.FSharpValueOption`1[T]: T Value Microsoft.FSharp.Core.FSharpValueOption`1[T]: T get_Item() Microsoft.FSharp.Core.FSharpValueOption`1[T]: T get_Value() -Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean IsNone -Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean IsSome -Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean get_IsNone() -Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean get_IsSome() -Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1[T] None -Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1[T] Some(T) -Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1[T] get_None() -Microsoft.FSharp.Core.FSharpTypeFunc: Boolean Equals(System.Object) -Microsoft.FSharp.Core.FSharpTypeFunc: Int32 GetHashCode() -Microsoft.FSharp.Core.FSharpTypeFunc: System.Object Specialize[T]() -Microsoft.FSharp.Core.FSharpTypeFunc: System.String ToString() -Microsoft.FSharp.Core.FSharpTypeFunc: System.Type GetType() -Microsoft.FSharp.Core.FSharpTypeFunc: Void .ctor() Microsoft.FSharp.Core.FuncConvert: Boolean Equals(System.Object) +Microsoft.FSharp.Core.FuncConvert: Int32 GetHashCode() Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Core.Unit] FromAction(System.Action) -Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit] FromAction[T](System.Action`1[T]) -Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.Unit]] FromAction[T1,T2](System.Action`2[T1,T2]) -Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[T3,Microsoft.FSharp.Core.Unit]]] FromAction[T1,T2,T3](System.Action`3[T1,T2,T3]) -Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[T3,Microsoft.FSharp.Core.FSharpFunc`2[T4,Microsoft.FSharp.Core.Unit]]]] FromAction[T1,T2,T3,T4](System.Action`4[T1,T2,T3,T4]) -Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[T3,Microsoft.FSharp.Core.FSharpFunc`2[T4,Microsoft.FSharp.Core.FSharpFunc`2[T5,Microsoft.FSharp.Core.Unit]]]]] FromAction[T1,T2,T3,T4,T5](System.Action`5[T1,T2,T3,T4,T5]) Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,T] FromFunc[T](System.Func`1[T]) -Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] FromFunc[T,TResult](System.Func`2[T,TResult]) -Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,TResult]] FromFunc[T1,T2,TResult](System.Func`3[T1,T2,TResult]) -Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[T3,TResult]]] FromFunc[T1,T2,T3,TResult](System.Func`4[T1,T2,T3,TResult]) -Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[T3,Microsoft.FSharp.Core.FSharpFunc`2[T4,TResult]]]] FromFunc[T1,T2,T3,T4,TResult](System.Func`5[T1,T2,T3,T4,TResult]) -Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[T3,Microsoft.FSharp.Core.FSharpFunc`2[T4,Microsoft.FSharp.Core.FSharpFunc`2[T5,TResult]]]]] FromFunc[T1,T2,T3,T4,T5,TResult](System.Func`6[T1,T2,T3,T4,T5,TResult]) -Microsoft.FSharp.Core.FuncConvert: Int32 GetHashCode() +Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit] FromAction[T](System.Action`1[T]) Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit] ToFSharpFunc[T](System.Action`1[T]) +Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] FromFunc[T,TResult](System.Func`2[T,TResult]) Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] ToFSharpFunc[T,TResult](System.Converter`2[T,TResult]) +Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[T3,Microsoft.FSharp.Core.FSharpFunc`2[T4,Microsoft.FSharp.Core.FSharpFunc`2[T5,Microsoft.FSharp.Core.Unit]]]]] FromAction[T1,T2,T3,T4,T5](System.Action`5[T1,T2,T3,T4,T5]) +Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[T3,Microsoft.FSharp.Core.FSharpFunc`2[T4,Microsoft.FSharp.Core.FSharpFunc`2[T5,TResult]]]]] FromFunc[T1,T2,T3,T4,T5,TResult](System.Func`6[T1,T2,T3,T4,T5,TResult]) Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[T3,Microsoft.FSharp.Core.FSharpFunc`2[T4,Microsoft.FSharp.Core.FSharpFunc`2[T5,TResult]]]]] FuncFromTupled[T1,T2,T3,T4,T5,TResult](Microsoft.FSharp.Core.FSharpFunc`2[System.Tuple`5[T1,T2,T3,T4,T5],TResult]) +Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[T3,Microsoft.FSharp.Core.FSharpFunc`2[T4,Microsoft.FSharp.Core.Unit]]]] FromAction[T1,T2,T3,T4](System.Action`4[T1,T2,T3,T4]) +Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[T3,Microsoft.FSharp.Core.FSharpFunc`2[T4,TResult]]]] FromFunc[T1,T2,T3,T4,TResult](System.Func`5[T1,T2,T3,T4,TResult]) Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[T3,Microsoft.FSharp.Core.FSharpFunc`2[T4,TResult]]]] FuncFromTupled[T1,T2,T3,T4,TResult](Microsoft.FSharp.Core.FSharpFunc`2[System.Tuple`4[T1,T2,T3,T4],TResult]) +Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[T3,Microsoft.FSharp.Core.Unit]]] FromAction[T1,T2,T3](System.Action`3[T1,T2,T3]) +Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[T3,TResult]]] FromFunc[T1,T2,T3,TResult](System.Func`4[T1,T2,T3,TResult]) Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[T3,TResult]]] FuncFromTupled[T1,T2,T3,TResult](Microsoft.FSharp.Core.FSharpFunc`2[System.Tuple`3[T1,T2,T3],TResult]) +Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.Unit]] FromAction[T1,T2](System.Action`2[T1,T2]) +Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,TResult]] FromFunc[T1,T2,TResult](System.Func`3[T1,T2,TResult]) Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,TResult]] FuncFromTupled[T1,T2,TResult](Microsoft.FSharp.Core.FSharpFunc`2[System.Tuple`2[T1,T2],TResult]) Microsoft.FSharp.Core.FuncConvert: System.String ToString() Microsoft.FSharp.Core.FuncConvert: System.Type GetType() @@ -2498,7 +2499,6 @@ Microsoft.FSharp.Core.MatchFailureException: System.String get_Message() Microsoft.FSharp.Core.MatchFailureException: System.String get_Source() Microsoft.FSharp.Core.MatchFailureException: System.String get_StackTrace() Microsoft.FSharp.Core.MatchFailureException: System.Type GetType() -Microsoft.FSharp.Core.MatchFailureException: System.Type GetType() Microsoft.FSharp.Core.MatchFailureException: Void .ctor() Microsoft.FSharp.Core.MatchFailureException: Void .ctor(System.String, Int32, Int32) Microsoft.FSharp.Core.MatchFailureException: Void GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext) @@ -2723,8 +2723,8 @@ Microsoft.FSharp.Core.Operators: System.Collections.Generic.IEnumerable`1[T] op_ Microsoft.FSharp.Core.Operators: System.Collections.Generic.IEnumerable`1[T] op_Range[T](T, T) Microsoft.FSharp.Core.Operators: System.Decimal ToDecimal[T](T) Microsoft.FSharp.Core.Operators: System.Exception Failure(System.String) -Microsoft.FSharp.Core.Operators: System.IO.TextWriter ConsoleError[T]() Microsoft.FSharp.Core.Operators: System.IO.TextReader ConsoleIn[T]() +Microsoft.FSharp.Core.Operators: System.IO.TextWriter ConsoleError[T]() Microsoft.FSharp.Core.Operators: System.IO.TextWriter ConsoleOut[T]() Microsoft.FSharp.Core.Operators: System.Object Box[T](T)" + #if DEBUG @@ -2877,36 +2877,6 @@ Microsoft.FSharp.Core.OptionModule: TState FoldBack[T,TState](Microsoft.FSharp.C Microsoft.FSharp.Core.OptionModule: TState Fold[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]], TState, Microsoft.FSharp.Core.FSharpOption`1[T]) Microsoft.FSharp.Core.OptionModule: T[] ToArray[T](Microsoft.FSharp.Core.FSharpOption`1[T]) Microsoft.FSharp.Core.OptionModule: Void Iterate[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit], Microsoft.FSharp.Core.FSharpOption`1[T]) -Microsoft.FSharp.Core.ValueOption: Boolean Contains[T](T, Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: Boolean Equals(System.Object) -Microsoft.FSharp.Core.ValueOption: Boolean Exists[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: Boolean ForAll[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: Boolean IsNone[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: Boolean IsSome[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: Int32 Count[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: Int32 GetHashCode() -Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Collections.FSharpList`1[T] ToList[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[TResult] Bind[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpValueOption`1[TResult]], Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[TResult] Map2[T1,T2,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,TResult]], Microsoft.FSharp.Core.FSharpValueOption`1[T1], Microsoft.FSharp.Core.FSharpValueOption`1[T2]) -Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[TResult] Map3[T1,T2,T3,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[T3,TResult]]], Microsoft.FSharp.Core.FSharpValueOption`1[T1], Microsoft.FSharp.Core.FSharpValueOption`1[T2], Microsoft.FSharp.Core.FSharpValueOption`1[T3]) -Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[TResult] Map[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] Filter[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] Flatten[T](Microsoft.FSharp.Core.FSharpValueOption`1[Microsoft.FSharp.Core.FSharpValueOption`1[T]]) -Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OfNullable[T](System.Nullable`1[T]) -Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OfObj[T](T) -Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OrElseWith[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Core.FSharpValueOption`1[T]], Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OrElse[T](Microsoft.FSharp.Core.FSharpValueOption`1[T], Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: System.Nullable`1[T] ToNullable[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: System.String ToString() -Microsoft.FSharp.Core.ValueOption: System.Type GetType() -Microsoft.FSharp.Core.ValueOption: T DefaultValue[T](T, Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: T DefaultWith[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,T], Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: T GetValue[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: T ToObj[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: TState FoldBack[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]], Microsoft.FSharp.Core.FSharpValueOption`1[T], TState) -Microsoft.FSharp.Core.ValueOption: TState Fold[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]], TState, Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: T[] ToArray[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: Void Iterate[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit], Microsoft.FSharp.Core.FSharpValueOption`1[T]) Microsoft.FSharp.Core.OptionalArgumentAttribute: Boolean Equals(System.Object) Microsoft.FSharp.Core.OptionalArgumentAttribute: Boolean IsDefaultAttribute() Microsoft.FSharp.Core.OptionalArgumentAttribute: Boolean Match(System.Object) @@ -3104,6 +3074,36 @@ Microsoft.FSharp.Core.UnverifiableAttribute: System.Object get_TypeId() Microsoft.FSharp.Core.UnverifiableAttribute: System.String ToString() Microsoft.FSharp.Core.UnverifiableAttribute: System.Type GetType() Microsoft.FSharp.Core.UnverifiableAttribute: Void .ctor() +Microsoft.FSharp.Core.ValueOption: Boolean Contains[T](T, Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: Boolean Equals(System.Object) +Microsoft.FSharp.Core.ValueOption: Boolean Exists[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: Boolean ForAll[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: Boolean IsNone[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: Boolean IsSome[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: Int32 Count[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: Int32 GetHashCode() +Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Collections.FSharpList`1[T] ToList[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[TResult] Bind[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpValueOption`1[TResult]], Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[TResult] Map2[T1,T2,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,TResult]], Microsoft.FSharp.Core.FSharpValueOption`1[T1], Microsoft.FSharp.Core.FSharpValueOption`1[T2]) +Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[TResult] Map3[T1,T2,T3,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[T3,TResult]]], Microsoft.FSharp.Core.FSharpValueOption`1[T1], Microsoft.FSharp.Core.FSharpValueOption`1[T2], Microsoft.FSharp.Core.FSharpValueOption`1[T3]) +Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[TResult] Map[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] Filter[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] Flatten[T](Microsoft.FSharp.Core.FSharpValueOption`1[Microsoft.FSharp.Core.FSharpValueOption`1[T]]) +Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OfNullable[T](System.Nullable`1[T]) +Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OfObj[T](T) +Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OrElseWith[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Core.FSharpValueOption`1[T]], Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OrElse[T](Microsoft.FSharp.Core.FSharpValueOption`1[T], Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: System.Nullable`1[T] ToNullable[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: System.String ToString() +Microsoft.FSharp.Core.ValueOption: System.Type GetType() +Microsoft.FSharp.Core.ValueOption: T DefaultValue[T](T, Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: T DefaultWith[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,T], Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: T GetValue[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: T ToObj[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: TState FoldBack[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]], Microsoft.FSharp.Core.FSharpValueOption`1[T], TState) +Microsoft.FSharp.Core.ValueOption: TState Fold[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]], TState, Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: T[] ToArray[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: Void Iterate[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit], Microsoft.FSharp.Core.FSharpValueOption`1[T]) Microsoft.FSharp.Core.VolatileFieldAttribute: Boolean Equals(System.Object) Microsoft.FSharp.Core.VolatileFieldAttribute: Boolean IsDefaultAttribute() Microsoft.FSharp.Core.VolatileFieldAttribute: Boolean Match(System.Object) @@ -3401,20 +3401,20 @@ Microsoft.FSharp.Linq.RuntimeHelpers.LeafExpressionConverter: System.String ToSt Microsoft.FSharp.Linq.RuntimeHelpers.LeafExpressionConverter: System.Type GetType() Microsoft.FSharp.Linq.RuntimeHelpers.LeafExpressionConverter: T MemberInitializationHelper[T](T) Microsoft.FSharp.Linq.RuntimeHelpers.LeafExpressionConverter: T NewAnonymousObjectHelper[T](T) -Microsoft.FSharp.NativeInterop.NativePtrModule: T& ToByRefInlined[T](IntPtr) Microsoft.FSharp.NativeInterop.NativePtrModule: Boolean Equals(System.Object) Microsoft.FSharp.NativeInterop.NativePtrModule: Int32 GetHashCode() Microsoft.FSharp.NativeInterop.NativePtrModule: IntPtr AddPointerInlined[T](IntPtr, Int32) Microsoft.FSharp.NativeInterop.NativePtrModule: IntPtr OfNativeIntInlined[T](IntPtr) +Microsoft.FSharp.NativeInterop.NativePtrModule: IntPtr OfVoidPtrInlined[T](Void*) Microsoft.FSharp.NativeInterop.NativePtrModule: IntPtr StackAllocate[T](Int32) Microsoft.FSharp.NativeInterop.NativePtrModule: IntPtr ToNativeIntInlined[T](IntPtr) Microsoft.FSharp.NativeInterop.NativePtrModule: System.String ToString() Microsoft.FSharp.NativeInterop.NativePtrModule: System.Type GetType() Microsoft.FSharp.NativeInterop.NativePtrModule: T GetPointerInlined[T](IntPtr, Int32) Microsoft.FSharp.NativeInterop.NativePtrModule: T ReadPointerInlined[T](IntPtr) +Microsoft.FSharp.NativeInterop.NativePtrModule: T& ToByRefInlined[T](IntPtr) Microsoft.FSharp.NativeInterop.NativePtrModule: Void SetPointerInlined[T](IntPtr, Int32, T) Microsoft.FSharp.NativeInterop.NativePtrModule: Void WritePointerInlined[T](IntPtr, T) -Microsoft.FSharp.NativeInterop.NativePtrModule: IntPtr OfVoidPtrInlined[T](Void*) Microsoft.FSharp.NativeInterop.NativePtrModule: Void* ToVoidPtrInlined[T](IntPtr) Microsoft.FSharp.Quotations.DerivedPatternsModule: Boolean Equals(System.Object) Microsoft.FSharp.Quotations.DerivedPatternsModule: Int32 GetHashCode() @@ -3666,4 +3666,4 @@ Microsoft.FSharp.Reflection.UnionCaseInfo: System.Type get_DeclaringType() // disabled because of slight order and GetMember discrepencies #else SurfaceArea.verify expected "net40" (System.IO.Path.Combine(__SOURCE_DIRECTORY__,__SOURCE_FILE__)) -#endif +#endif \ No newline at end of file diff --git a/tests/fsharp/Compiler/CompilerAssert.fs b/tests/fsharp/Compiler/CompilerAssert.fs index 37946c40872..46f202db266 100644 --- a/tests/fsharp/Compiler/CompilerAssert.fs +++ b/tests/fsharp/Compiler/CompilerAssert.fs @@ -3,9 +3,10 @@ namespace FSharp.Compiler.UnitTests open System +open System.Diagnostics open System.IO open System.Text -open System.Diagnostics + open FSharp.Compiler.Text open FSharp.Compiler.SourceCodeServices open FSharp.Compiler.Interactive.Shell @@ -16,7 +17,6 @@ open NUnit.Framework module CompilerAssert = let checker = FSharpChecker.Create() - let private config = TestFramework.initializeSuite () let private defaultProjectOptions = @@ -34,9 +34,10 @@ module CompilerAssert = |> Path.GetDirectoryName |> Directory.EnumerateFiles |> Seq.toArray - |> Array.filter (fun x -> x.ToLowerInvariant().Contains("system.")) + |> Array.filter (fun x -> x.ToLowerInvariant().Contains("system.") || x.ToLowerInvariant().EndsWith("netstandard.dll")) |> Array.map (fun x -> sprintf "-r:%s" x) Array.append [|"--targetprofile:netcore"; "--noframework"|] assemblies + #endif ReferencedProjects = [||] IsIncompleteTypeCheckEnvironment = false @@ -47,7 +48,7 @@ module CompilerAssert = ExtraProjectInfo = None Stamp = None } - + let lockObj = obj () let Pass (source: string) = @@ -116,4 +117,3 @@ module CompilerAssert = ||> Seq.iter2 (fun expectedErrorMessage errorMessage -> Assert.AreEqual(expectedErrorMessage, errorMessage) ) - \ No newline at end of file diff --git a/tests/fsharp/FSharpSuite.Tests.fsproj b/tests/fsharp/FSharpSuite.Tests.fsproj index 9376f62dcdf..20f62687ca2 100644 --- a/tests/fsharp/FSharpSuite.Tests.fsproj +++ b/tests/fsharp/FSharpSuite.Tests.fsproj @@ -27,6 +27,7 @@ NunitHelpers.fs + diff --git a/tests/fsharp/HandleExpects.fs b/tests/fsharp/HandleExpects.fs new file mode 100644 index 00000000000..76c5267bacf --- /dev/null +++ b/tests/fsharp/HandleExpects.fs @@ -0,0 +1,196 @@ +module HandleExpects + +open System +open System.IO +open System.Text.RegularExpressions +open System.Xml + +type Expects = { status:string; id:string; span:string; pattern:string; mutable matched:bool; line:string } +type ErrorMessage = { source:string; status:string; id:string; span:string; text:string; mutable matched:bool; line:string } +type Span = { startrow:int; startcol:int; endrow:int; endcol:int } + +let tryParseSpan (span:string) = + let s = span.Trim([| '('; ')' |]).Split(',') + match s.Length with + | 2 -> { startrow=Int32.Parse(s.[0]); startcol=Int32.Parse(s.[1]); endrow=Int32.MaxValue; endcol=Int32.MaxValue } + | 4 -> { startrow=Int32.Parse(s.[0]); startcol=Int32.Parse(s.[1]); endrow=Int32.Parse(s.[2]); endcol=Int32.Parse(s.[3]) } + | _ -> raise (InvalidDataException(sprintf "The span : '%s' is invalid" span)); + +let isStringEmpty s = String.IsNullOrWhiteSpace(s) +let isStringNotEmpty s = not (isStringEmpty s) +let stringToLower s = if isStringNotEmpty s then s.ToLower() else s +let areStringsEqual s1 s2 = String.Compare(s1, s2, StringComparison.OrdinalIgnoreCase) = 0 +let areSpansEqual s1 s2 = + let span1 = tryParseSpan s1 + let span2 = tryParseSpan s2 + if span1.startrow <> span2.startrow then false + elif span1.startcol <> span2.startcol then false + elif span1.endrow <> span2.endrow then false + elif span1.endcol <> span2.endcol then false + else true + +let stripFromFileExpectations source = + let readExpect expect = + let pattern = "(?]*>{1})(?.*)(?)" //"().)*-->|<\w*((?!\/<).)*\/>|<(?\w+)[^>]*>(?>[^<]|(?R))*<\/\k\s*>)" + let rx = new Regex(pattern) + let matched = rx.Match(expect) + if matched.Success then + // The content of the Expects group contains a lot of invalid Xml and the Xml reader fails when it sees it. + // So we just save it away, remove it from the xml, then read the xml and put it back + // Save away the contents of the element and strip it out of expect pattern + let content = (matched.Groups.[2]).ToString() + let nocontentxpect = + if isStringEmpty content then expect + else expect.Replace(content, "") + + let rdr = XmlReader.Create(new StringReader(nocontentxpect)) + let mutable element = { status="success"; id = ""; span = ""; pattern = content; matched = false; line=expect } + let mutable insideExpects = false + let mutable foundOne = false + try + let rec loop () = + if rdr.Read() then + match rdr.NodeType with + | XmlNodeType.Element when String.Compare(rdr.Name, "Expects", StringComparison.OrdinalIgnoreCase) = 0 -> + insideExpects <- true + if rdr.AttributeCount > 0 then + let status = stringToLower (rdr.GetAttribute("status")) + let span = rdr.GetAttribute("span") + let id = stringToLower (rdr.GetAttribute("id")) + element <- {element with status=status; id=id; span=span } + foundOne <- true + | XmlNodeType.EndElement when String.Compare(rdr.Name, "Expects", StringComparison.OrdinalIgnoreCase) = 0 -> + insideExpects <- false + | _ -> () + loop () + else () + loop () + if foundOne then Some element + else None + with | e -> printfn "Oops !!! %A" e; reraise() + else None + + File.ReadAllLines(source) + |> Array.filter(fun line -> line.Trim().StartsWith(@"//")) + |> Array.map(fun line -> line.Trim().Substring(2).Trim()) + |> Array.filter(fun line -> line.StartsWith(@" Array.map(fun expect -> readExpect expect) + |> Array.filter(fun expect -> expect.IsSome) + |> Array.map(fun expect -> expect.Value) + +let readErrorMessagesFromOutput output = + //Formats of error messages + // Syntax error in code: + // 1. filename(row,col): (sometext perhaps typecheck) error|warning ErrorNo: ErrorText + // e.g: Program.fs(5,9): error ErrorNo: ErrorText + // 2. Program.fs(5,3,5,20): (sometext perhaps typecheck) error FS0039: ErrorText + // e.g: + // Program.fs(5,3,5,20): (sometext perhaps typecheck) error FS0039: PicturePoint ... + // 3. error ErrorNo: ErrorText + // e.g: error FS0207: No inputs specified + let getErrorMessage line pattern = + let rx = new Regex(pattern) + let matched = rx.Match(line) + let getMatchForName (name:string) = matched.Groups.[name].ToString() + + if matched.Success then Some { + source = (getMatchForName "tagSourceFileName") + status = stringToLower (getMatchForName "tagStatus") + id = stringToLower (getMatchForName "tagErrorNo") + span = (getMatchForName "tagSpan") + text = (getMatchForName "tagText") + matched = false + line = line + } + else None + + let rgxTagSourceFileName = "(?[^(]{1,})(?:[(]{1})" + let rgxTagSpan = "(?[^):]{1,})(?:[)]{1})(?:[(\s:]*)" + let rgxTagStatus = "(?(error|typecheck error|warning|success|notin))" + let rgxColonWhiteSpace = "(?:[\s:]*)" + let rgxWhiteSpace = "(?:[\s]*)" + let rgxTagErrorNo = "(?\s*[^:\s]*)" + let rgxTagText = "(?.*)" + let rgxTagTail = "(?\s\[.*\]$)" + + // E.g: Q:\version46\test.fs(25,13): error FS0010: Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. [Q:\Temp\FSharp.Cambridge\vaw2t1vp.cai\f0bi0hny.wwx.fsproj] + let rgxFull = rgxTagSourceFileName + rgxTagSpan + rgxColonWhiteSpace + rgxTagStatus + rgxWhiteSpace + rgxTagErrorNo + rgxColonWhiteSpace + rgxTagText + rgxWhiteSpace + rgxTagTail + + // E.g: FSC : error FS0010: Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. [Q:\Temp\FSharp.Cambridge\vaw2t1vp.cai\f0bi0hny.wwx.fsproj] + let rgxShort = rgxTagStatus + rgxTagErrorNo + rgxColonWhiteSpace + rgxTagText + rgxWhiteSpace + rgxTagTail + [| + for line in output do + let errorMessage = + getErrorMessage line rgxFull + |> Option.orElse (getErrorMessage line rgxShort) + match errorMessage with + | Some e -> yield e + | _ -> () + |] + +let compareResults output (expectations:Expects array) (errorMessages:ErrorMessage array) = + for expect in expectations do + match expect.status with + | "error" + | "typecheck error" + | "warning" -> + // Check for this error/warning in found errors list + for msg in errorMessages do + let matched = + if isStringNotEmpty expect.id && not (areStringsEqual expect.id msg.id) then false + elif isStringNotEmpty expect.status && not (areStringsEqual expect.status msg.status) then false + elif isStringNotEmpty expect.span && not (areSpansEqual expect.span msg.span) then false + elif isStringNotEmpty expect.pattern then + let regex = new Regex(expect.pattern) + let matched = regex.Match(msg.text) + matched.Success + else true + if matched then + expect.matched <- true + msg.matched <- true + | "success" -> + // In this case search for text in the page + let regex = new Regex(expect.pattern) + for line in output do + let matched = regex.Match(line) + if matched.Success then expect.matched <- true + | "notin" -> + // In this case search for text not appearing in the page + let regex = new Regex(expect.pattern) + let mutable found = false + for line in output do + let matched = regex.Match(line) + if matched.Success then found <- true + if not found then expect.matched <- true + | _ -> () + +let verifyResults source outputPath = + let output = File.ReadAllLines(outputPath) + let expectations = stripFromFileExpectations source + if expectations.Length > 0 then + // There must be at least one to do this testing + let errorMessages = readErrorMessagesFromOutput output + compareResults output expectations errorMessages + + // Print out discovered expects + let verifiedexpectations = + expectations + |> Seq.fold(fun result expects -> + if not (expects.matched) then + printfn "Failed to match expected result '%s'" expects.line + false + else result + ) true + let verifiederrormessages = + errorMessages + |> Seq.fold(fun result msg -> + if not (msg.matched) then + printfn "Failed to match produced error message: '%s'" msg.line + false + else result + ) true + + if not (verifiedexpectations && verifiederrormessages) then + failwith (sprintf "Failed validating error codes") + +//HandleExpects.verifyResults @"C:\Users\kevinr\AppData\Local\Temp\FSharp.Cambridge\bcnyzkvb.ict\test.fs" @"C:\Users\kevinr\AppData\Local\Temp\FSharp.Cambridge\bcnyzkvb.ict\buildoutput.txt" \ No newline at end of file diff --git a/tests/fsharp/core/forexpression/test.fsx b/tests/fsharp/core/forexpression/test.fsx index 6384d113693..0fada85b01b 100644 --- a/tests/fsharp/core/forexpression/test.fsx +++ b/tests/fsharp/core/forexpression/test.fsx @@ -19,6 +19,7 @@ let testData = let expectedArraySum = 167167000 // Find an expression for this sum from count let expectedRangeSum = ((count + 1) * count) / 2 let expectedStringSum = 30 +let expectedWildCard = count + 1 let getTestData (inner : int [] -> #seq) (outer : #seq [] -> #seq<'U>) = (testData |> Array.map inner) |> outer @@ -109,11 +110,7 @@ let sumOverRange () = let sumOverString () = let mutable sum = 0 for i in testString do -#if NETCOREAPP - sum <- sum + ((int (i :?> char)) - (int '0')) -#else sum <- sum + ((int i) - (int '0')) -#endif sum let arraySum = sumOverArray () diff --git a/tests/fsharp/core/forexpression/version46/test.fs b/tests/fsharp/core/forexpression/version46/test.fs new file mode 100644 index 00000000000..c2042a9f0c1 --- /dev/null +++ b/tests/fsharp/core/forexpression/version46/test.fs @@ -0,0 +1,41 @@ +//An integer for loop must use a simple identifier +module Global + +let failures = ref [] + +let report_failure (s : string) = + stderr.Write" NO: " + stderr.WriteLine s + failures := !failures @ [s] + +let test (s : string) b = + stderr.Write(s) + if b then stderr.WriteLine " OK" + else report_failure (s) + +let check s b1 b2 = test s (b1 = b2) + +// usingWildcard counts using a wildcard in a for loop +let usingWildcard () = + let mutable sum = 0 + for _ = 0 to count do + sum <- sum + 1 + + printfn "usingWildcards expected to produce sum of 4 : sum='%d'"sum + +do test "wildCard" (4 = usingWildcard () ) + +#if TESTS_AS_APP +let RUN() = !failures +#else +let aa = + match !failures with + | [] -> + stdout.WriteLine "Test Passed" + System.IO.File.WriteAllText("test.ok","ok") + exit 0 + | _ -> + stdout.WriteLine "Test Failed" + exit 1 +#endif + diff --git a/tests/fsharp/core/forexpression/version47/test.fs b/tests/fsharp/core/forexpression/version47/test.fs new file mode 100644 index 00000000000..868a4757ce2 --- /dev/null +++ b/tests/fsharp/core/forexpression/version47/test.fs @@ -0,0 +1,43 @@ +//usingWildcards expected to produce sum of 4 : sum='4' +#if TESTS_AS_APP +module Core_forexpression_47 +#endif + +let failures = ref [] + +let report_failure (s : string) = + stderr.Write" NO: " + stderr.WriteLine s + failures := !failures @ [s] + +let test (s : string) b = + stderr.Write(s) + if b then stderr.WriteLine " OK" + else report_failure (s) + +let check s b1 b2 = test s (b1 = b2) + +// usingWildcard counts using a wildcard in a for loop +let usingWildcard () = + let mutable sum = 0 + for _ = 0 to count do + sum <- sum + 1 + + printfn "usingWildcards expected to produce sum of 4 : sum='%d'"sum + +do test "wildCard" (4 = usingWildcard () ) + +#if TESTS_AS_APP +let RUN() = !failures +#else +let aa = + match !failures with + | [] -> + stdout.WriteLine "Test Passed" + System.IO.File.WriteAllText("test.ok","ok") + exit 0 + | _ -> + stdout.WriteLine "Test Failed" + exit 1 +#endif + diff --git a/tests/fsharp/core/indent/version46/test.fsx b/tests/fsharp/core/indent/version46/test.fsx new file mode 100644 index 00000000000..7afc6f1dd51 --- /dev/null +++ b/tests/fsharp/core/indent/version46/test.fsx @@ -0,0 +1,121 @@ +//Possible incorrect indentation: this token is offside of context started at position \(59:19\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(59:19\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(63:21\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(63:21\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(69:23\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(69:23\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(77:25\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(77:25\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(83:21\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(83:21\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(88:25\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(88:25\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(91:20\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(91:20\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(95:21\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(95:21\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(100:20\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(100:20\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(104:21\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(104:21\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(59:19\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(59:19\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(63:21\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(63:21\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(69:23\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(69:23\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(77:25\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(77:25\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(83:21\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(83:21\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(88:25\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(88:25\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(91:20\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(91:20\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(95:21\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(95:21\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(100:20\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(100:20\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(104:21\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(104:21\). Try indenting this token further or using standard formatting conventions. + + +module Global + +let failures = ref [] + +let report_failure (s : string) = + stderr.Write" NO: " + stderr.WriteLine s + failures := !failures @ [s] + +let test (s : string) b = + stderr.Write(s) + if b then stderr.WriteLine " OK" + else report_failure (s) + +let check s b1 b2 = test s (b1 = b2) + +type OffsideCheck(a:int, + b:int, c:int, // 4.6 warning: 4.7 no warning + d:int, e:int, + f:int) = + static member M(a:int, + b:int, c:int, // 4.6 warning: 4.7 no warning + d:int, e:int, + f:int) = 1 + +module M = + type OffsideCheck(a:int, + b:int, c:int, // 4.6 warning: 4.7 warning + d:int, e:int, + f:int) = + class end + +module M2 = + type OffsideCheck() = + static member M(a:int, + b:int, c:int, // 4.6 warning: 4.7 warning + d:int, e:int, + f:int) = 1 + +type C() = + static member P with get() = + 1 // 4.6 warning: 4.7 no warning + +module M3 = + type C() = + static member P with get() = + 1 // warning + +type OffsideCheck2(a:int, + b:int, c:int, // 4.6 warning: 4.7 no warning + d:int, e:int, + f:int) = + static member M(a:int, + b:int, c:int, // 4.6 warning: 4.7 no warning + d:int, e:int, + f:int) = 1 + +type OffsideCheck3(a:int, + b:int, c:int, // no warning + d:int, e:int, + f:int) = + static member M(a:int, + b:int, c:int, // 4.6 warning: 4.7 no warning + d:int, e:int, + f:int) = 1 + +#if TESTS_AS_APP +let RUN() = !failures +#else +let aa = + match !failures with + | [] -> + stdout.WriteLine "Test Passed" + System.IO.File.WriteAllText("test.ok","ok") + exit 0 + | _ -> + stdout.WriteLine "Test Failed" + exit 1 +#endif diff --git a/tests/fsharp/core/indent/version47/test.fsx b/tests/fsharp/core/indent/version47/test.fsx new file mode 100644 index 00000000000..97b226e9e52 --- /dev/null +++ b/tests/fsharp/core/indent/version47/test.fsx @@ -0,0 +1,93 @@ +//Possible incorrect indentation: this token is offside of context started at position \(41:5\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(41:5\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(49:9\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(49:9\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(60:9\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(60:9\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(41:5\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(41:5\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(49:9\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(49:9\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(60:9\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(60:9\). Try indenting this token further or using standard formatting conventions. + + +module Global + +let failures = ref [] + +let report_failure (s : string) = + stderr.Write" NO: " + stderr.WriteLine s + failures := !failures @ [s] + +let test (s : string) b = + stderr.Write(s) + if b then stderr.WriteLine " OK" + else report_failure (s) + +let check s b1 b2 = test s (b1 = b2) + +type OffsideCheck(a:int, + b:int, c:int, // no warning + d:int, e:int, + f:int) = + static member M(a:int, + b:int, c:int, // no warning + d:int, e:int, + f:int) = 1 + +module M = + type OffsideCheck(a:int, + b:int, c:int, // 4.6 warning: 4.7 warning + d:int, e:int, + f:int) = + class end + +module M2 = + type OffsideCheck() = + static member M(a:int, + b:int, c:int, // 4.6 warning: 4.7 warning + d:int, e:int, + f:int) = 1 + +type C() = + static member P with get() = + 1 // 4.6 warning: 4.7 no warning + +module M3 = + type C() = + static member P with get() = + 1 // warning + +type OffsideCheck2(a:int, + b:int, c:int, // 4.6 warning: 4.7 no warning + d:int, e:int, + f:int) = + static member M(a:int, + b:int, c:int, // 4.6 warning: 4.7 no warning + d:int, e:int, + f:int) = 1 + +type OffsideCheck3(a:int, + b:int, c:int, // no warning + d:int, e:int, + f:int) = + static member M(a:int, + b:int, c:int, // 4.6 warning: 4.7 no warning + d:int, e:int, + f:int) = 1 + +#if TESTS_AS_APP +let RUN() = !failures +#else +let aa = + match !failures with + | [] -> + stdout.WriteLine "Test Passed" + System.IO.File.WriteAllText("test.ok","ok") + exit 0 + | _ -> + stdout.WriteLine "Test Failed" + exit 1 +#endif diff --git a/tests/fsharp/core/members/self-identifier/version46/test.fs b/tests/fsharp/core/members/self-identifier/version46/test.fs new file mode 100644 index 00000000000..5a53a84a4cb --- /dev/null +++ b/tests/fsharp/core/members/self-identifier/version46/test.fs @@ -0,0 +1,62 @@ +//Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. +//Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. +//Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. +//Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + +module Global + +let failures = ref [] + +let report_failure (s : string) = + stderr.Write" NO: " + stderr.WriteLine s + failures := !failures @ [s] + +let test (s : string) b = + stderr.Write(s) + if b then stderr.WriteLine " OK" + else report_failure (s) + +let check s b1 b2 = test s (b1 = b2) + +//-------------------------------------------------------------- +// Test using "_" as the self identifier introduced in F# 4.7 +type MyTypeWithUnderscoreIdentifier () = + member _.MethodWithUnderscoreSelf() = true + member __.MethodWithDoubleUnderscoreSelf() = true + member _E.MethodWithUnderscoreESelf() = true + +[] +type MyStructWithUnderscoreIdentifier = + member _.MethodWithUnderscoreSelf() = true + member __.MethodWithDoubleUnderscoreSelf() = true + member _E.MethodWithUnderscoreESelf() = true + +type MyClassWithUnderscoreIdentifier () = + class + member _.MethodWithUnderscoreSelf() = true + member __.MethodWithDoubleUnderscoreSelf() = true + member _E.MethodWithUnderscoreESelf() = true + end + +type MyStructTypeWithUnderscoreIdentifier = + struct + member _.MethodWithUnderscoreSelf() = true + member __.MethodWithDoubleUnderscoreSelf() = true + member _E.MethodWithUnderscoreESelf() = true + end + + +#if TESTS_AS_APP +let RUN() = !failures +#else +let aa = + match !failures with + | [] -> + stdout.WriteLine "Test Passed" + System.IO.File.WriteAllText("test.ok","ok") + exit 0 + | _ -> + stdout.WriteLine "Test Failed" + exit 1 +#endif diff --git a/tests/fsharp/core/members/self-identifier/version47/test.fs b/tests/fsharp/core/members/self-identifier/version47/test.fs new file mode 100644 index 00000000000..99629250b65 --- /dev/null +++ b/tests/fsharp/core/members/self-identifier/version47/test.fs @@ -0,0 +1,58 @@ +module Global + +let failures = ref [] + +let report_failure (s : string) = + stderr.Write" NO: " + stderr.WriteLine s + failures := !failures @ [s] + +let test (s : string) b = + stderr.Write(s) + if b then stderr.WriteLine " OK" + else report_failure (s) + +let check s b1 b2 = test s (b1 = b2) + +//-------------------------------------------------------------- +// Test using "_" as the self identifier introduced in F# 4.7 +type MyTypeWithUnderscoreIdentifier () = + member _.MethodWithUnderscoreSelf() = true + member __.MethodWithDoubleUnderscoreSelf() = true + member _E.MethodWithUnderscoreESelf() = true + +[] +type MyStructWithUnderscoreIdentifier = + member _.MethodWithUnderscoreSelf() = true + member __.MethodWithDoubleUnderscoreSelf() = true + member _E.MethodWithUnderscoreESelf() = true + +type MyClassWithUnderscoreIdentifier () = + class + member _.MethodWithUnderscoreSelf() = true + member __.MethodWithDoubleUnderscoreSelf() = true + member _E.MethodWithUnderscoreESelf() = true + end + +type MyStructTypeWithUnderscoreIdentifier = + struct + member _.MethodWithUnderscoreSelf() = true + member __.MethodWithDoubleUnderscoreSelf() = true + member _E.MethodWithUnderscoreESelf() = true + end + + +#if TESTS_AS_APP +let RUN() = !failures +#else +let aa = + match !failures with + | [] -> + stdout.WriteLine "Test Passed" + System.IO.File.WriteAllText("test.ok","ok") + exit 0 + | _ -> + stdout.WriteLine "Test Failed" + exit 1 +#endif + diff --git a/tests/fsharp/core/quotes/test.fsx b/tests/fsharp/core/quotes/test.fsx index 289988569de..8be5e210971 100644 --- a/tests/fsharp/core/quotes/test.fsx +++ b/tests/fsharp/core/quotes/test.fsx @@ -2007,7 +2007,6 @@ module TestQuotationOfCOnstructors = | _ -> false) -#if !FX_RESHAPED_REFLECTION // Also test getting the reflected definition for private members implied by "let f() = ..." bindings let fMethod = (typeof.GetMethod("f", Reflection.BindingFlags.Instance ||| Reflection.BindingFlags.Public ||| Reflection.BindingFlags.NonPublic)) @@ -2020,9 +2019,7 @@ module TestQuotationOfCOnstructors = -> unitVar.Type = typeof | _ -> false) - Expr.TryGetReflectedDefinition fMethod |> printfn "%A" -#endif test "vkjnkvrw0" (match Expr.TryGetReflectedDefinition (typeof.GetConstructors().[0]) with @@ -2312,29 +2309,17 @@ module ReflectedDefinitionOnTypesWithImplicitCodeGen = // This type has an implicit IComparable implementation, it is not accessible as a reflected definition type U = A of int | B of string | C of System.DateTime -#if FX_RESHAPED_REFLECTION - for m in typeof.GetMethods() do -#else for m in typeof.GetMethods(System.Reflection.BindingFlags.DeclaredOnly) do -#endif check "celnwer33" (Quotations.Expr.TryGetReflectedDefinition(m).IsNone) true // This type has some implicit codegen exception X of string * int -#if FX_RESHAPED_REFLECTION - for m in typeof.GetMethods() do -#else for m in typeof.GetMethods(System.Reflection.BindingFlags.DeclaredOnly) do -#endif check "celnwer34" (Quotations.Expr.TryGetReflectedDefinition(m).IsNone) true // This type has an implicit IComparable implementation, it is not accessible as a reflected definition [] type SR = { x:int; y:string; z:System.DateTime } -#if FX_RESHAPED_REFLECTION - for m in typeof.GetMethods() do -#else for m in typeof.GetMethods(System.Reflection.BindingFlags.DeclaredOnly) do -#endif check "celnwer35" (Quotations.Expr.TryGetReflectedDefinition(m).IsNone) true #if !NETCOREAPP @@ -3175,13 +3160,10 @@ module TestMatchBang = | expr -> Error "Delay is incorrect") (Ok ()) - testSimpleMatchBang() - + testSimpleMatchBang() -#if !FX_RESHAPED_REFLECTION module TestAssemblyAttributes = let attributes = System.Reflection.Assembly.GetExecutingAssembly().GetCustomAttributes(false) -#endif #if TESTS_AS_APP let RUN() = !failures diff --git a/tests/fsharp/core/samename/tempet.fsproj b/tests/fsharp/core/samename/tempet.fsproj index d6ac10eab9b..20f63eb9cc1 100644 --- a/tests/fsharp/core/samename/tempet.fsproj +++ b/tests/fsharp/core/samename/tempet.fsproj @@ -1,7 +1,7 @@  - netstandard1.6 + netstandard2.0 diff --git a/tests/fsharp/core/subtype/test.fsx b/tests/fsharp/core/subtype/test.fsx index 381e5b9a658..9751d03e6e3 100644 --- a/tests/fsharp/core/subtype/test.fsx +++ b/tests/fsharp/core/subtype/test.fsx @@ -1386,12 +1386,10 @@ module CoercivePipingTest = check "clwcweki" (f8 3) (box 3) check "clwcweki" (f9 3) (box 3) -#if !FX_RESHAPED_REFLECTION // this was the actual repro let f (info: System.Reflection.MethodInfo) = System.Attribute.GetCustomAttribute(info, typeof) :?> ReflectedDefinitionAttribute -#endif module Test_Dev10_Bug_917383 = @@ -1728,7 +1726,6 @@ module InliningOnSubTypes1 = do check "clkewlijwlkw" (f()) (13, 17) -#if !FX_RESHAPED_REFLECTION module StructUnionSingleCase = [] type S = S @@ -1756,7 +1753,6 @@ module StructUnionSingleCase = do check "wekew0ewek5" (typeof.IsValueType) true do check "wekew0ewek5b" (typeof.BaseType) typeof -#endif // See https://github.com/Microsoft/visualfsharp/issues/238 module GenericPropertyConstraintSolvedByRecord = diff --git a/tests/fsharp/single-test.fs b/tests/fsharp/single-test.fs index 26b257d9449..c1707f619e2 100644 --- a/tests/fsharp/single-test.fs +++ b/tests/fsharp/single-test.fs @@ -5,15 +5,17 @@ open System.IO open System.Diagnostics open NUnit.Framework open TestFramework - +open HandleExpects type Permutation = | FSC_CORECLR + | FSC_CORECLR_BUILDONLY | FSI_CORECLR #if !FSHARP_SUITE_DRIVES_CORECLR_TESTS | FSI_FILE | FSI_STDIN | GENERATED_SIGNATURE + | FSC_BUILDONLY | FSC_OPT_MINUS_DEBUG | FSC_OPT_PLUS_DEBUG | AS_DLL @@ -59,7 +61,6 @@ type ProjectConfiguration = { Optimize:bool } - let replaceTokens tag (replacement:string) (template:string) = template.Replace(tag, replacement) let generateProps testCompilerVersion configuration = @@ -97,7 +98,7 @@ let generateOverrides = // optimize = true or false // configuration = "Release" or "Debug" // -let generateProjectArtifacts (pc:ProjectConfiguration) outputType (targetFramework:string) configuration = +let generateProjectArtifacts (pc:ProjectConfiguration) outputType (targetFramework:string) configuration languageVersion= let fsharpCoreLocation = let compiler = if outputType = OutputType.Script then @@ -106,12 +107,11 @@ let generateProjectArtifacts (pc:ProjectConfiguration) outputType (targetFramewo "FSharp.Core" let targetCore = if targetFramework.StartsWith("netstandard", StringComparison.InvariantCultureIgnoreCase) || targetFramework.StartsWith("netcoreapp", StringComparison.InvariantCultureIgnoreCase) then - "netstandard1.6" + "netstandard2.0" else "net45" (Path.GetFullPath(__SOURCE_DIRECTORY__) + "/../../artifacts/bin/" + compiler + "/" + configuration + "/" + targetCore + "/FSharp.Core.dll") - let computeSourceItems addDirectory addCondition (compileItem:CompileItem) sources = let computeInclude src = let fileName = if addDirectory then Path.Combine(pc.SourceDirectory, src) else src @@ -148,9 +148,9 @@ let generateProjectArtifacts (pc:ProjectConfiguration) outputType (targetFramewo false $(DEBUG) portable + $(LANGUAGEVERSION) $(OPTIMIZE) false - FX_RESHAPED_REFLECTION NETCOREAPP false $(RestoreFromArtifactsPath) @@ -202,12 +202,12 @@ let generateProjectArtifacts (pc:ProjectConfiguration) outputType (targetFramewo |> replaceTokens "$(OPTIMIZE)" optimize |> replaceTokens "$(DEBUG)" debug |> replaceTokens "$(TARGETFRAMEWORK)" targetFramework + |> replaceTokens "$(LANGUAGEVERSION)" languageVersion |> replaceTokens "$(RestoreFromArtifactsPath)" (Path.GetFullPath(__SOURCE_DIRECTORY__) + "/../../artifacts/packages/" + configuration) - generateProjBody let lockObj = obj() -let singleTestBuildAndRunCore cfg copyFiles p = +let singleTestBuildAndRunCore cfg copyFiles p languageVersion = let sources = [] let loadSources = [] let useSources = [] @@ -221,13 +221,13 @@ let singleTestBuildAndRunCore cfg copyFiles p = // compilerType = "coreclr" or "net40" // targetFramework optimize = "net472" OR NETCOREAPP2.1 etc ... // optimize = true or false - let executeSingleTestBuildAndRun outputType compilerType targetFramework optimize = + let executeSingleTestBuildAndRun outputType compilerType targetFramework optimize buildOnly = let mutable result = false let directory = let mutable result = "" lock lockObj <| (fun () -> let rec loop () = - let dir = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()) + let dir = Path.Combine(Path.GetTempPath(), "FSharp.Cambridge", Path.GetRandomFileName()) if Directory.Exists(dir) then loop () else @@ -249,6 +249,13 @@ let singleTestBuildAndRunCore cfg copyFiles p = Optimize = optimize } + let findFirstSourceFile (pc:ProjectConfiguration) = + let sources = List.append pc.SourceItems pc.ExtraSourceItems + let found = sources |> List.tryFind(fun source -> File.Exists(Path.Combine(directory, source))) + match found with + | Some p -> Path.Combine(directory, p) + | None -> failwith "Missing SourceFile in test case" + let targetsBody = generateTargets let overridesBody = generateOverrides let targetsFileName = Path.Combine(directory, "Directory.Build.targets") @@ -262,43 +269,51 @@ let singleTestBuildAndRunCore cfg copyFiles p = try File.Delete(Path.Combine(directory, "FSharp.Core.dll")) with _ -> () emitFile targetsFileName targetsBody emitFile overridesFileName overridesBody + let buildOutputFile = Path.Combine(directory, "buildoutput.txt") if outputType = OutputType.Exe then let executeFsc testCompilerVersion targetFramework = let propsBody = generateProps testCompilerVersion cfg.BUILD_CONFIG emitFile propsFileName propsBody - let projectBody = generateProjectArtifacts pc outputType targetFramework cfg.BUILD_CONFIG + let projectBody = generateProjectArtifacts pc outputType targetFramework cfg.BUILD_CONFIG languageVersion emitFile projectFileName projectBody use testOkFile = new FileGuard(Path.Combine(directory, "test.ok")) - exec { cfg with Directory = directory } cfg.DotNetExe (sprintf "run -f %s" targetFramework) - testOkFile.CheckExists() + let cfg = { cfg with Directory = directory } + let result = execBothToOutNoCheck cfg directory buildOutputFile cfg.DotNetExe (sprintf "run -f %s" targetFramework) + if not (buildOnly) then + result |> checkResult + testOkFile.CheckExists() executeFsc compilerType targetFramework + if buildOnly then verifyResults (findFirstSourceFile pc) buildOutputFile else let executeFsi testCompilerVersion targetFramework = let propsBody = generateProps testCompilerVersion cfg.BUILD_CONFIG emitFile propsFileName propsBody - let projectBody = generateProjectArtifacts pc outputType targetFramework cfg.BUILD_CONFIG + let projectBody = generateProjectArtifacts pc outputType targetFramework cfg.BUILD_CONFIG languageVersion emitFile projectFileName projectBody use testOkFile = new FileGuard(Path.Combine(directory, "test.ok")) - exec { cfg with Directory = directory } cfg.DotNetExe "build /t:RunFSharpScript" + let cfg = { cfg with Directory = directory } + execBothToOut cfg directory buildOutputFile cfg.DotNetExe "build /t:RunFSharpScript" testOkFile.CheckExists() executeFsi compilerType targetFramework - result <- true + result <- true finally if result <> false then - Directory.Delete(directory, true) + try Directory.Delete(directory, true) with _ -> () else printfn "Configuration: %s" cfg.Directory printfn "Directory: %s" directory printfn "Filename: %s" projectFileName match p with - | FSC_CORECLR -> executeSingleTestBuildAndRun OutputType.Exe "coreclr" "netcoreapp2.0" true - | FSI_CORECLR -> executeSingleTestBuildAndRun OutputType.Script "coreclr" "netcoreapp2.0" true + | FSC_CORECLR -> executeSingleTestBuildAndRun OutputType.Exe "coreclr" "netcoreapp2.0" true false + | FSC_CORECLR_BUILDONLY -> executeSingleTestBuildAndRun OutputType.Exe "coreclr" "netcoreapp2.0" true true + | FSI_CORECLR -> executeSingleTestBuildAndRun OutputType.Script "coreclr" "netcoreapp2.0" true false #if !FSHARP_SUITE_DRIVES_CORECLR_TESTS - | FSC_OPT_PLUS_DEBUG -> executeSingleTestBuildAndRun OutputType.Exe "net40" "net472" true - | FSC_OPT_MINUS_DEBUG -> executeSingleTestBuildAndRun OutputType.Exe "net40" "net472" false - | FSI_FILE -> executeSingleTestBuildAndRun OutputType.Script "net40" "net472" true + | FSC_BUILDONLY -> executeSingleTestBuildAndRun OutputType.Exe "net40" "net472" false true + | FSC_OPT_PLUS_DEBUG -> executeSingleTestBuildAndRun OutputType.Exe "net40" "net472" true false + | FSC_OPT_MINUS_DEBUG -> executeSingleTestBuildAndRun OutputType.Exe "net40" "net472" false false + | FSI_FILE -> executeSingleTestBuildAndRun OutputType.Script "net40" "net472" true false | FSI_STDIN -> use cleanup = (cleanUpFSharpCore cfg) @@ -339,8 +354,8 @@ let singleTestBuildAndRunCore cfg copyFiles p = let sources = extraSources |> List.filter (fileExists cfg) - fsc cfg "%s --optimize -a -o:test--optimize-lib.dll -g" cfg.fsc_flags sources - fsc cfg "%s --optimize -r:test--optimize-lib.dll -o:test--optimize-client-of-lib.exe -g" cfg.fsc_flags sources + fsc cfg "%s --optimize -a -o:test--optimize-lib.dll -g --langversion:preview " cfg.fsc_flags sources + fsc cfg "%s --optimize -r:test--optimize-lib.dll -o:test--optimize-client-of-lib.exe -g --langversion:preview " cfg.fsc_flags sources peverify cfg "test--optimize-lib.dll" peverify cfg "test--optimize-client-of-lib.exe" @@ -349,17 +364,20 @@ let singleTestBuildAndRunCore cfg copyFiles p = testOkFile.CheckExists() #endif - + let singleTestBuildAndRunAux cfg p = - singleTestBuildAndRunCore cfg "" p + singleTestBuildAndRunCore cfg "" p "latest" let singleTestBuildAndRunWithCopyDlls cfg copyFiles p = - singleTestBuildAndRunCore cfg copyFiles p + singleTestBuildAndRunCore cfg copyFiles p "latest" let singleTestBuildAndRun dir p = let cfg = testConfig dir singleTestBuildAndRunAux cfg p +let singleTestBuildAndRunVersion dir p version = + let cfg = testConfig dir + singleTestBuildAndRunCore cfg "" p version let singleNegTest (cfg: TestConfig) testname = @@ -377,7 +395,7 @@ let singleNegTest (cfg: TestConfig) testname = testname + "b.mli"; testname + "b.fsi"; testname + "b.ml"; testname + "b.fs"; ] yield! src |> List.filter (fileExists cfg) - + if fileExists cfg "helloWorldProvider.dll" then yield "-r:helloWorldProvider.dll" diff --git a/tests/fsharp/test-framework.fs b/tests/fsharp/test-framework.fs index 6804b829f12..cace5cf935c 100644 --- a/tests/fsharp/test-framework.fs +++ b/tests/fsharp/test-framework.fs @@ -166,7 +166,7 @@ let config configurationName envVars = #else let fscArchitecture = "netcoreapp2.1" let fsiArchitecture = "netcoreapp2.1" - let fsharpCoreArchitecture = "netstandard1.6" + let fsharpCoreArchitecture = "netstandard2.0" let fsharpBuildArchitecture = "netcoreapp2.1" let fsharpCompilerInteractiveSettingsArchitecture = "netstandard2.0" #endif @@ -435,7 +435,8 @@ let execAppendIgnoreExitCode cfg stdoutPath stderrPath p = Command.exec cfg.Dire let exec cfg p = Command.exec cfg.Directory cfg.EnvironmentVariables execArgs p >> checkResult let execExpectFail cfg p = Command.exec cfg.Directory cfg.EnvironmentVariables execArgs p >> checkErrorLevel1 let execIn cfg workDir p = Command.exec workDir cfg.EnvironmentVariables execArgs p >> checkResult -let execBothToOut cfg workDir outFile p = Command.exec workDir cfg.EnvironmentVariables { execArgs with Output = OutputAndErrorToSameFile(Overwrite(outFile)) } p >> checkResult +let execBothToOutNoCheck cfg workDir outFile p = Command.exec workDir cfg.EnvironmentVariables { execArgs with Output = OutputAndErrorToSameFile(Overwrite(outFile)) } p +let execBothToOut cfg workDir outFile p = execBothToOutNoCheck cfg workDir outFile p >> checkResult let execAppendOutIgnoreExitCode cfg workDir outFile p = Command.exec workDir cfg.EnvironmentVariables { execArgs with Output = Output(Append(outFile)) } p >> alwaysSuccess let execAppendErrExpectFail cfg errPath p = Command.exec cfg.Directory cfg.EnvironmentVariables { execArgs with Output = Error(Overwrite(errPath)) } p >> checkErrorLevel1 let execStdin cfg l p = Command.exec cfg.Directory cfg.EnvironmentVariables { Output = Inherit; Input = Some(RedirectInput(l)) } p >> checkResult diff --git a/tests/fsharp/tests.fs b/tests/fsharp/tests.fs index 96c7be28364..cd9a7c8b687 100644 --- a/tests/fsharp/tests.fs +++ b/tests/fsharp/tests.fs @@ -16,10 +16,12 @@ open NUnit.Framework open TestFramework open Scripting open SingleTest +open HandleExpects #if FSHARP_SUITE_DRIVES_CORECLR_TESTS // Use these lines if you want to test CoreCLR let FSC_BASIC = FSC_CORECLR +let FSC_BUILDONLY = FSC_CORECLR_BUILDONLY let FSI_BASIC = FSI_CORECLR #else let FSC_BASIC = FSC_OPT_PLUS_DEBUG @@ -1699,7 +1701,7 @@ module CoreTests = csc cfg """/nologo /r:"%s" /r:lib--optimize.dll /out:test--optimize.exe""" cfg.FSCOREDLLPATH ["test.cs"] - let dicases = ["flag_deterministic_init1.fs"; "lib_deterministic_init1.fs"; "flag_deterministic_init2.fs"; "lib_deterministic_init2.fs"; "flag_deterministic_init3.fs"; "lib_deterministic_init3.fs"; "flag_deterministic_init4.fs"; "lib_deterministic_init4.fs"; "flag_deterministic_init5.fs"; "lib_deterministic_init5.fs"; "flag_deterministic_init6.fs"; "lib_deterministic_init6.fs"; "flag_deterministic_init7.fs"; "lib_deterministic_init7.fs"; "flag_deterministic_init8.fs"; "lib_deterministic_init8.fs"; "flag_deterministic_init9.fs"; "lib_deterministic_init9.fs"; "flag_deterministic_init10.fs"; "lib_deterministic_init10.fs"; "flag_deterministic_init11.fs"; "lib_deterministic_init11.fs"; "flag_deterministic_init12.fs"; "lib_deterministic_init12.fs"; "flag_deterministic_init13.fs"; "lib_deterministic_init13.fs"; "flag_deterministic_init14.fs"; "lib_deterministic_init14.fs"; "flag_deterministic_init15.fs"; "lib_deterministic_init15.fs"; "flag_deterministic_init16.fs"; "lib_deterministic_init16.fs"; "flag_deterministic_init17.fs"; "lib_deterministic_init17.fs"; "flag_deterministic_init18.fs"; "lib_deterministic_init18.fs"; "flag_deterministic_init19.fs"; "lib_deterministic_init19.fs"; "flag_deterministic_init20.fs"; "lib_deterministic_init20.fs"; "flag_deterministic_init21.fs"; "lib_deterministic_init21.fs"; "flag_deterministic_init22.fs"; "lib_deterministic_init22.fs"; "flag_deterministic_init23.fs"; "lib_deterministic_init23.fs"; "flag_deterministic_init24.fs"; "lib_deterministic_init24.fs"; "flag_deterministic_init25.fs"; "lib_deterministic_init25.fs"; "flag_deterministic_init26.fs"; "lib_deterministic_init26.fs"; "flag_deterministic_init27.fs"; "lib_deterministic_init27.fs"; "flag_deterministic_init28.fs"; "lib_deterministic_init28.fs"; "flag_deterministic_init29.fs"; "lib_deterministic_init29.fs"; "flag_deterministic_init30.fs"; "lib_deterministic_init30.fs"; "flag_deterministic_init31.fs"; "lib_deterministic_init31.fs"; "flag_deterministic_init32.fs"; "lib_deterministic_init32.fs"; "flag_deterministic_init33.fs"; "lib_deterministic_init33.fs"; "flag_deterministic_init34.fs"; "lib_deterministic_init34.fs"; "flag_deterministic_init35.fs"; "lib_deterministic_init35.fs"; "flag_deterministic_init36.fs"; "lib_deterministic_init36.fs"; "flag_deterministic_init37.fs"; "lib_deterministic_init37.fs"; "flag_deterministic_init38.fs"; "lib_deterministic_init38.fs"; "flag_deterministic_init39.fs"; "lib_deterministic_init39.fs"; "flag_deterministic_init40.fs"; "lib_deterministic_init40.fs"; "flag_deterministic_init41.fs"; "lib_deterministic_init41.fs"; "flag_deterministic_init42.fs"; "lib_deterministic_init42.fs"; "flag_deterministic_init43.fs"; "lib_deterministic_init43.fs"; "flag_deterministic_init44.fs"; "lib_deterministic_init44.fs"; "flag_deterministic_init45.fs"; "lib_deterministic_init45.fs"; "flag_deterministic_init46.fs"; "lib_deterministic_init46.fs"; "flag_deterministic_init47.fs"; "lib_deterministic_init47.fs"; "flag_deterministic_init48.fs"; "lib_deterministic_init48.fs"; "flag_deterministic_init49.fs"; "lib_deterministic_init49.fs"; "flag_deterministic_init50.fs"; "lib_deterministic_init50.fs"; "flag_deterministic_init51.fs"; "lib_deterministic_init51.fs"; "flag_deterministic_init52.fs"; "lib_deterministic_init52.fs"; "flag_deterministic_init53.fs"; "lib_deterministic_init53.fs"; "flag_deterministic_init54.fs"; "lib_deterministic_init54.fs"; "flag_deterministic_init55.fs"; "lib_deterministic_init55.fs"; "flag_deterministic_init56.fs"; "lib_deterministic_init56.fs"; "flag_deterministic_init57.fs"; "lib_deterministic_init57.fs"; "flag_deterministic_init58.fs"; "lib_deterministic_init58.fs"; "flag_deterministic_init59.fs"; "lib_deterministic_init59.fs"; "flag_deterministic_init60.fs"; "lib_deterministic_init60.fs"; "flag_deterministic_init61.fs"; "lib_deterministic_init61.fs"; "flag_deterministic_init62.fs"; "lib_deterministic_init62.fs"; "flag_deterministic_init63.fs"; "lib_deterministic_init63.fs"; "flag_deterministic_init64.fs"; "lib_deterministic_init64.fs"; "flag_deterministic_init65.fs"; "lib_deterministic_init65.fs"; "flag_deterministic_init66.fs"; "lib_deterministic_init66.fs"; "flag_deterministic_init67.fs"; "lib_deterministic_init67.fs"; "flag_deterministic_init68.fs"; "lib_deterministic_init68.fs"; "flag_deterministic_init69.fs"; "lib_deterministic_init69.fs"; "flag_deterministic_init70.fs"; "lib_deterministic_init70.fs"; "flag_deterministic_init71.fs"; "lib_deterministic_init71.fs"; "flag_deterministic_init72.fs"; "lib_deterministic_init72.fs"; "flag_deterministic_init73.fs"; "lib_deterministic_init73.fs"; "flag_deterministic_init74.fs"; "lib_deterministic_init74.fs"; "flag_deterministic_init75.fs"; "lib_deterministic_init75.fs"; "flag_deterministic_init76.fs"; "lib_deterministic_init76.fs"; "flag_deterministic_init77.fs"; "lib_deterministic_init77.fs"; "flag_deterministic_init78.fs"; "lib_deterministic_init78.fs"; "flag_deterministic_init79.fs"; "lib_deterministic_init79.fs"; "flag_deterministic_init80.fs"; "lib_deterministic_init80.fs"; "flag_deterministic_init81.fs"; "lib_deterministic_init81.fs"; "flag_deterministic_init82.fs"; "lib_deterministic_init82.fs"; "flag_deterministic_init83.fs"; "lib_deterministic_init83.fs"; "flag_deterministic_init84.fs"; "lib_deterministic_init84.fs"; "flag_deterministic_init85.fs"; "lib_deterministic_init85.fs"] + let dicases = ["flag_deterministic_init1.fs"; "lib_deterministic_init1.fs"; "flag_deterministic_init2.fs"; "lib_deterministic_init2.fs"; "flag_deterministic_init3.fs"; "lib_deterministic_init3.fs"; "flag_deterministic_init4.fs"; "lib_deterministic_init4.fs"; "flag_deterministic_init5.fs"; "lib_deterministic_init5.fs"; "flag_deterministic_init6.fs"; "lib_deterministic_init6.fs"; "flag_deterministic_init7.fs"; "lib_deterministic_init7.fs"; "flag_deterministic_init8.fs"; "lib_deterministic_init8.fs"; "flag_deterministic_init9.fs"; "lib_deterministic_init9.fs"; "flag_deterministic_init10.fs"; "lib_deterministic_init10.fs"; "flag_deterministic_init11.fs"; "lib_deterministic_init11.fs"; "flag_deterministic_init12.fs"; "lib_deterministic_init12.fs"; "flag_deterministic_init13.fs"; "lib_deterministic_init13.fs"; "flag_deterministic_init14.fs"; "lib_deterministic_init14.fs"; "flag_deterministic_init15.fs"; "lib_deterministic_init15.fs"; "flag_deterministic_init16.fs"; "lib_deterministic_init16.fs"; "flag_deterministic_init17.fs"; "lib_deterministic_init17.fs"; "flag_deterministic_init18.fs"; "lib_deterministic_init18.fs"; "flag_deterministic_init19.fs"; "lib_deterministic_init19.fs"; "flag_deterministic_init20.fs"; "lib_deterministic_init20.fs"; "flag_deterministic_init21.fs"; "lib_deterministic_init21.fs"; "flag_deterministic_init22.fs"; "lib_deterministic_init22.fs"; "flag_deterministic_init23.fs"; "lib_deterministic_init23.fs"; "flag_deterministic_init24.fs"; "lib_deterministic_init24.fs"; "flag_deterministic_init25.fs"; "lib_deterministic_init25.fs"; "flag_deterministic_init26.fs"; "lib_deterministic_init26.fs"; "flag_deterministic_init27.fs"; "lib_deterministic_init27.fs"; "flag_deterministic_init28.fs"; "lib_deterministic_init28.fs"; "flag_deterministic_init29.fs"; "lib_deterministic_init29.fs"; "flag_deterministic_init30.fs"; "lib_deterministic_init30.fs"; "flag_deterministic_init31.fs"; "lib_deterministic_init31.fs"; "flag_deterministic_init32.fs"; "lib_deterministic_init32.fs"; "flag_deterministic_init33.fs"; "lib_deterministic_init33.fs"; "flag_deterministic_init34.fs"; "lib_deterministic_init34.fs"; "flag_deterministic_init35.fs"; "lib_deterministic_init35.fs"; "flag_deterministic_init36.fs"; "lib_deterministic_init36.fs"; "flag_deterministic_init37.fs"; "lib_deterministic_init37.fs"; "flag_deterministic_init38.fs"; "lib_deterministic_init38.fs"; "flag_deterministic_init39.fs"; "lib_deterministic_init39.fs"; "flag_deterministic_init40.fs"; "lib_deterministic_init40.fs"; "flag_deterministic_init41.fs"; "lib_deterministic_init41.fs"; "flag_deterministic_init42.fs"; "lib_deterministic_init42.fs"; "flag_deterministic_init43.fs"; "lib_deterministic_init43.fs"; "flag_deterministic_init44.fs"; "lib_deterministic_init44.fs"; "flag_deterministic_init45.fs"; "lib_deterministic_init45.fs"; "flag_deterministic_init46.fs"; "lib_deterministic_init46.fs"; "flag_deterministic_init47.fs"; "lib_deterministic_init47.fs"; "flag_deterministic_init48.fs"; "lib_deterministic_init48.fs"; "flag_deterministic_init49.fs"; "lib_deterministic_init49.fs"; "flag_deterministic_init50.fs"; "lib_deterministic_init50.fs"; "flag_deterministic_init51.fs"; "lib_deterministic_init51.fs"; "flag_deterministic_init52.fs"; "lib_deterministic_init52.fs"; "flag_deterministic_init53.fs"; "lib_deterministic_init53.fs"; "flag_deterministic_init54.fs"; "lib_deterministic_init54.fs"; "flag_deterministic_init55.fs"; "lib_deterministic_init55.fs"; "flag_deterministic_init56.fs"; "lib_deterministic_init56.fs"; "flag_deterministic_init57.fs"; "lib_deterministic_init57.fs"; "flag_deterministic_init58.fs"; "lib_deterministic_init58.fs"; "flag_deterministic_init59.fs"; "lib_deterministic_init59.fs"; "flag_deterministic_init60.fs"; "lib_deterministic_init60.fs"; "flag_deterministic_init61.fs"; "lib_deterministic_init61.fs"; "flag_deterministic_init62.fs"; "lib_deterministic_init62.fs"; "flag_deterministic_init63.fs"; "lib_deterministic_init63.fs"; "flag_deterministic_init64.fs"; "lib_deterministic_init64.fs"; "flag_deterministic_init65.fs"; "lib_deterministic_init65.fs"; "flag_deterministic_init66.fs"; "lib_deterministic_init66.fs"; "flag_deterministic_init67.fs"; "lib_deterministic_init67.fs"; "flag_deterministic_init68.fs"; "lib_deterministic_init68.fs"; "flag_deterministic_init69.fs"; "lib_deterministic_init69.fs"; "flag_deterministic_init70.fs"; "lib_deterministic_init70.fs"; "flag_deterministic_init71.fs"; "lib_deterministic_init71.fs"; "flag_deterministic_init72.fs"; "lib_deterministic_init72.fs"; "flag_deterministic_init73.fs"; "lib_deterministic_init73.fs"; "flag_deterministic_init74.fs"; "lib_deterministic_init74.fs"; "flag_deterministic_init75.fs"; "lib_deterministic_init75.fs"; "flag_deterministic_init76.fs"; "lib_deterministic_init76.fs"; "flag_deterministic_init77.fs"; "lib_deterministic_init77.fs"; "flag_deterministic_init78.fs"; "lib_deterministic_init78.fs"; "flag_deterministic_init79.fs"; "lib_deterministic_init79.fs"; "flag_deterministic_init80.fs"; "lib_deterministic_init80.fs"; "flag_deterministic_init81.fs"; "lib_deterministic_init81.fs"; "flag_deterministic_init82.fs"; "lib_deterministic_init82.fs"; "flag_deterministic_init83.fs"; "lib_deterministic_init83.fs"; "flag_deterministic_init84.fs"; "lib_deterministic_init84.fs"; "flag_deterministic_init85.fs"; "lib_deterministic_init85.fs"] fsc cfg "%s --optimize- -o test_deterministic_init.exe" cfg.fsc_flags (dicases @ ["test_deterministic_init.fs"]) @@ -1784,7 +1786,7 @@ module CoreTests = exec cfg ("." ++ "test.exe") "" testOkFile.CheckExists() - + [] let verify () = let cfg = testConfig "core/verify" @@ -1802,6 +1804,20 @@ module CoreTests = peverifyWithArgs cfg "/nologo" "xmlverify.exe" #endif +module VersionTests = + [] + let ``member-selfidentifier-version4.6``() = singleTestBuildAndRunVersion "core/members/self-identifier/version46" FSC_BUILDONLY "4.6" + + [] + let ``member-selfidentifier-version4.7``() = singleTestBuildAndRunVersion "core/members/self-identifier/version47" FSC_BUILDONLY "preview" + + [] + let ``indent-version4.6``() = singleTestBuildAndRunVersion "core/indent/version46" FSC_BUILDONLY "4.6" + + [] + let ``indent-version4.7``() = singleTestBuildAndRunVersion "core/indent/version47" FSC_BUILDONLY "preview" + + #if !FSHARP_SUITE_DRIVES_CORECLR_TESTS module ToolsTests = @@ -1811,7 +1827,7 @@ module ToolsTests = let cfg = testConfig "tools/bundle" fsc cfg "%s --progress --standalone -o:test-one-fsharp-module.exe -g" cfg.fsc_flags ["test-one-fsharp-module.fs"] - + peverify cfg "test-one-fsharp-module.exe" fsc cfg "%s -a -o:test_two_fsharp_modules_module_1.dll -g" cfg.fsc_flags ["test_two_fsharp_modules_module_1.fs"] @@ -2090,10 +2106,8 @@ module TypecheckTests = let cfg = testConfig "typecheck/full-rank-arrays" SingleTest.singleTestBuildAndRunWithCopyDlls cfg "full-rank-arrays.dll" FSC_BASIC -#if !FX_NO_CONVERTER [] let misc () = singleTestBuildAndRun "typecheck/misc" FSC_BASIC -#endif #if !FSHARP_SUITE_DRIVES_CORECLR_TESTS diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/help/help40.437.1033.bsl b/tests/fsharpqa/Source/CompilerOptions/fsc/help/help40.437.1033.bsl index b0fd6746810..d1321663d01 100644 --- a/tests/fsharpqa/Source/CompilerOptions/fsc/help/help40.437.1033.bsl +++ b/tests/fsharpqa/Source/CompilerOptions/fsc/help/help40.437.1033.bsl @@ -98,6 +98,10 @@ Copyright (c) Microsoft Corporation. All Rights Reserved. - LANGUAGE - +--langversion:{?|version|latest|preview} Display the allowed values for + language version, specify language + version such as 'latest' or + 'preview' --checked[+|-] Generate overflow checks --define: Define conditional compilation symbols (Short form: -d) diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/langversion/badlangversion.fsx b/tests/fsharpqa/Source/CompilerOptions/fsc/langversion/badlangversion.fsx new file mode 100644 index 00000000000..b41237cd0b3 --- /dev/null +++ b/tests/fsharpqa/Source/CompilerOptions/fsc/langversion/badlangversion.fsx @@ -0,0 +1,5 @@ +// #NoMT #CompilerOptions #RequiresENU +// Unrecognized value '4.5' for --langversion use --langversion:? for complete list +// +#light +exit 0 diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/langversion/dummy.fsx b/tests/fsharpqa/Source/CompilerOptions/fsc/langversion/dummy.fsx new file mode 100644 index 00000000000..c5ecbb36434 --- /dev/null +++ b/tests/fsharpqa/Source/CompilerOptions/fsc/langversion/dummy.fsx @@ -0,0 +1,3 @@ +// #NoMT #CompilerOptions #RequiresENU +#light +exit 0 diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/langversion/env.lst b/tests/fsharpqa/Source/CompilerOptions/fsc/langversion/env.lst new file mode 100644 index 00000000000..bba306f616a --- /dev/null +++ b/tests/fsharpqa/Source/CompilerOptions/fsc/langversion/env.lst @@ -0,0 +1,4 @@ +# ReqENU means that the test is non-localized + +ReqENU SOURCE=dummy.fsx COMPILE_ONLY=1 PRECMD="\$FSC_PIPE >langversionhelp.txt --langversion:? 2>&1" POSTCMD="\$FSI_PIPE --nologo --quiet --exec ..\\..\\..\\comparer.fsx langversionhelp.txt langversionhelp.437.1033.bsl" # --langversion:? +ReqENU SOURCE=badlangversion.fsx SCFLAGS=" --langversion:4.5" # --langversion:4.5 diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/langversion/langversionhelp.437.1033.bsl b/tests/fsharpqa/Source/CompilerOptions/fsc/langversion/langversionhelp.437.1033.bsl new file mode 100644 index 00000000000..c98bf799621 --- /dev/null +++ b/tests/fsharpqa/Source/CompilerOptions/fsc/langversion/langversionhelp.437.1033.bsl @@ -0,0 +1,6 @@ +Supported language versions: +preview +default +latest +latestmajor +4.6 (Default) \ No newline at end of file diff --git a/tests/fsharpqa/Source/CompilerOptions/fsi/exename/help40.437.1033.bsl b/tests/fsharpqa/Source/CompilerOptions/fsi/exename/help40.437.1033.bsl index d19a024e300..8a9d6d418ab 100644 --- a/tests/fsharpqa/Source/CompilerOptions/fsi/exename/help40.437.1033.bsl +++ b/tests/fsharpqa/Source/CompilerOptions/fsi/exename/help40.437.1033.bsl @@ -49,6 +49,10 @@ Usage: fsharpi [script.fsx []] - LANGUAGE - +--langversion:{?|version|latest|preview} Display the allowed values for + language version, specify language + version such as 'latest' or + 'preview' --checked[+|-] Generate overflow checks --define: Define conditional compilation symbols (Short form: -d) diff --git a/tests/fsharpqa/Source/CompilerOptions/fsi/help/help40-nologo.437.1033.bsl b/tests/fsharpqa/Source/CompilerOptions/fsi/help/help40-nologo.437.1033.bsl index 242cb274d2d..041e86b8287 100644 --- a/tests/fsharpqa/Source/CompilerOptions/fsi/help/help40-nologo.437.1033.bsl +++ b/tests/fsharpqa/Source/CompilerOptions/fsi/help/help40-nologo.437.1033.bsl @@ -49,6 +49,10 @@ Usage: fsi.exe [script.fsx []] - LANGUAGE - +--langversion:{?|version|latest|preview} Display the allowed values for + language version, specify language + version such as 'latest' or + 'preview' --checked[+|-] Generate overflow checks --define: Define conditional compilation symbols (Short form: -d) diff --git a/tests/fsharpqa/Source/CompilerOptions/fsi/help/help40.437.1033.bsl b/tests/fsharpqa/Source/CompilerOptions/fsi/help/help40.437.1033.bsl index 34d28e5f70b..24fbfc4de40 100644 --- a/tests/fsharpqa/Source/CompilerOptions/fsi/help/help40.437.1033.bsl +++ b/tests/fsharpqa/Source/CompilerOptions/fsi/help/help40.437.1033.bsl @@ -51,6 +51,10 @@ Usage: fsi.exe [script.fsx []] - LANGUAGE - +--langversion:{?|version|latest|preview} Display the allowed values for + language version, specify language + version such as 'latest' or + 'preview' --checked[+|-] Generate overflow checks --define: Define conditional compilation symbols (Short form: -d) diff --git a/tests/fsharpqa/Source/CompilerOptions/fsi/langversion/badlangversion.fsx b/tests/fsharpqa/Source/CompilerOptions/fsi/langversion/badlangversion.fsx new file mode 100644 index 00000000000..b41237cd0b3 --- /dev/null +++ b/tests/fsharpqa/Source/CompilerOptions/fsi/langversion/badlangversion.fsx @@ -0,0 +1,5 @@ +// #NoMT #CompilerOptions #RequiresENU +// Unrecognized value '4.5' for --langversion use --langversion:? for complete list +// +#light +exit 0 diff --git a/tests/fsharpqa/Source/CompilerOptions/fsi/langversion/dummy.fsx b/tests/fsharpqa/Source/CompilerOptions/fsi/langversion/dummy.fsx new file mode 100644 index 00000000000..c5ecbb36434 --- /dev/null +++ b/tests/fsharpqa/Source/CompilerOptions/fsi/langversion/dummy.fsx @@ -0,0 +1,3 @@ +// #NoMT #CompilerOptions #RequiresENU +#light +exit 0 diff --git a/tests/fsharpqa/Source/CompilerOptions/fsi/langversion/env.lst b/tests/fsharpqa/Source/CompilerOptions/fsi/langversion/env.lst new file mode 100644 index 00000000000..fa31a7b0e41 --- /dev/null +++ b/tests/fsharpqa/Source/CompilerOptions/fsi/langversion/env.lst @@ -0,0 +1,4 @@ +# ReqENU means that the test is non-localized + +ReqENU SOURCE=dummy.fsx COMPILE_ONLY=1 SCFLAGS="--nologo" FSIMODE=EXEC PRECMD="\$FSI_PIPE --langversion:? >langversionhelp.txt 2>&1" POSTCMD="\$FSI_PIPE --nologo --quiet --exec ..\\..\\..\\comparer.fsx langversionhelp.txt langversionhelp.437.1033.bsl" # --langversion:? +ReqENU SOURCE=badlangversion.fsx SCFLAGS=" --langversion:4.5" # --langversion:4.5 diff --git a/tests/fsharpqa/Source/CompilerOptions/fsi/langversion/langversionhelp.437.1033.bsl b/tests/fsharpqa/Source/CompilerOptions/fsi/langversion/langversionhelp.437.1033.bsl new file mode 100644 index 00000000000..c98bf799621 --- /dev/null +++ b/tests/fsharpqa/Source/CompilerOptions/fsi/langversion/langversionhelp.437.1033.bsl @@ -0,0 +1,6 @@ +Supported language versions: +preview +default +latest +latestmajor +4.6 (Default) \ No newline at end of file diff --git a/tests/fsharpqa/Source/Misc/AsyncOperations.fs b/tests/fsharpqa/Source/Misc/AsyncOperations.fs index 4b53b0ccff7..2bc7738de70 100644 --- a/tests/fsharpqa/Source/Misc/AsyncOperations.fs +++ b/tests/fsharpqa/Source/Misc/AsyncOperations.fs @@ -127,8 +127,7 @@ namespace Microsoft.FSharp.Control type System.Net.WebRequest with member req.AsyncGetResponse() = callFSharpCoreAsyncGetResponse req // this calls the FSharp.Core method member req.GetResponseAsync() = callFSharpCoreAsyncGetResponse req // this calls the FSharp.Core method - -#if !FX_NO_WEB_CLIENT + [] module WebClientExtensions = open System.Net @@ -138,5 +137,4 @@ namespace Microsoft.FSharp.Control type WebClient with member this.AsyncDownloadString address = callFSharpCoreAsyncDownloadString this address -#endif diff --git a/tests/fsharpqa/Source/test.lst b/tests/fsharpqa/Source/test.lst index f3d79d7a03f..6e453b8d7b8 100644 --- a/tests/fsharpqa/Source/test.lst +++ b/tests/fsharpqa/Source/test.lst @@ -42,6 +42,7 @@ CompilerOptions01,NoMT CompilerOptions\fsc\flaterrors CompilerOptions02,NoMT CompilerOptions\fsc\gccerrors CompilerOptions01,NoMT,help CompilerOptions\fsc\help CompilerOptions01,NoMT CompilerOptions\fsc\highentropyva +CompilerOptions01,NoMT CompilerOptions\fsc\langversion CompilerOptions01,NoMT CompilerOptions\fsc\lib CompilerOptions01,NoMT CompilerOptions\fsc\noframework CompilerOptions01,NoMT CompilerOptions\fsc\nologo @@ -63,6 +64,7 @@ CompilerOptions01,NoMT CompilerOptions\fsc\warnon CompilerOptions01,NoMT CompilerOptions\fsc\responsefile CompilerOptions01,NoMT,help CompilerOptions\fsi\help CompilerOptions01,NoMT CompilerOptions\fsi\highentropyva +CompilerOptions01,NoMT CompilerOptions\fsi\langversion CompilerOptions01,NoMT CompilerOptions\fsi\nologo CompilerOptions01,NoMT CompilerOptions\fsi\subsystemversion CompilerOptions01,NoMT CompilerOptions\fsi\times diff --git a/tests/fsharpqa/comparer.fsx b/tests/fsharpqa/comparer.fsx new file mode 100644 index 00000000000..26bff8cb785 --- /dev/null +++ b/tests/fsharpqa/comparer.fsx @@ -0,0 +1,44 @@ +// #NoMT #CompilerOptions #RequiresENU +#light +open System +open System.IO +open System.Text.RegularExpressions + +let arg0 = Environment.GetCommandLineArgs().[0] +let path = Environment.GetEnvironmentVariable("PATH") +let fn1 = fsi.CommandLineArgs.[1] +let fn2 = fsi.CommandLineArgs.[2] + +// Read file into an array +let File2List (filename:string) = File.ReadAllLines(filename) + +let f1 = File2List fn1 +let f2 = File2List fn2 + +let mutable i = 0 +let compare (f1:string[]) (f2:string[]) = + if f1.Length <> f2.Length then failwithf "Help text did not match. f1.Length = %d, f2.Length = %d, Check you have right fsi on path. fsi = %s, PATH=%s" f1.Length f2.Length arg0 path + (f1, f2) ||> Array.forall2 (fun (a:string) (b:string) -> + + let replace (sourcepattern:string) (replacement:string) (str:string) : string = + Regex.Replace(str, sourcepattern, replacement) + + let normalizeText (str:string) = + str |> replace @"F# Interactive version .+" "F# Interactive" + |> replace @"F# Compiler version .+" "F# Compiler" + |> replace "fsiAnyCpu.exe" "fsi.exe" + + let aa = normalizeText a + let bb = normalizeText b + + i <- i+1 + if (aa = bb) then + true + else + printfn "Files differ at line %d:" i + printfn "\t>> %s" a + printfn "\t<< %s" b + false + ) + +exit (if compare f1 f2 then 0 else 1) diff --git a/tests/projects/Sample_NETCoreSDK_FSharp_Library_netstandard1.6/Sample_NETCoreSDK_FSharp_Library_netstandard1.6.fsproj b/tests/projects/Sample_NETCoreSDK_FSharp_Library_netstandard1.6/Sample_NETCoreSDK_FSharp_Library_netstandard1.6.fsproj index abac283cf0c..a237159916f 100644 --- a/tests/projects/Sample_NETCoreSDK_FSharp_Library_netstandard1.6/Sample_NETCoreSDK_FSharp_Library_netstandard1.6.fsproj +++ b/tests/projects/Sample_NETCoreSDK_FSharp_Library_netstandard1.6/Sample_NETCoreSDK_FSharp_Library_netstandard1.6.fsproj @@ -1,6 +1,6 @@ - netstandard1.6 + netstandard2.0 diff --git a/tests/service/Common.fs b/tests/service/Common.fs index 0ec9aa2ab3c..6920e682afe 100644 --- a/tests/service/Common.fs +++ b/tests/service/Common.fs @@ -6,10 +6,6 @@ open System.Collections.Generic open FSharp.Compiler open FSharp.Compiler.SourceCodeServices -#if FX_RESHAPED_REFLECTION -open ReflectionAdapters -#endif - #if NETCOREAPP2_0 let readRefs (folder : string) (projectFile: string) = let runProcess (workingDir: string) (exePath: string) (args: string) = @@ -71,14 +67,10 @@ let sysLib nm = #if !NETCOREAPP2_0 if System.Environment.OSVersion.Platform = System.PlatformID.Win32NT then // file references only valid on Windows let programFilesx86Folder = System.Environment.GetEnvironmentVariable("PROGRAMFILES(X86)") - programFilesx86Folder + @"\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\" + nm + ".dll" + programFilesx86Folder + @"\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\" + nm + ".dll" else #endif -#if FX_NO_RUNTIMEENVIRONMENT let sysDir = System.AppContext.BaseDirectory -#else - let sysDir = System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory() -#endif let (++) a b = System.IO.Path.Combine(a,b) sysDir ++ nm + ".dll" diff --git a/tests/service/FscTests.fs b/tests/service/FscTests.fs index 9bedfd38b1b..b7ff870675e 100644 --- a/tests/service/FscTests.fs +++ b/tests/service/FscTests.fs @@ -20,10 +20,6 @@ open FSharp.Compiler.Service.Tests.Common open NUnit.Framework -#if FX_RESHAPED_REFLECTION -open ReflectionAdapters -#endif - exception VerificationException of (*assembly:*)string * (*errorCode:*)int * (*output:*)string with override e.Message = sprintf "Verification of '%s' failed with code %d, message <<<%s>>>" e.Data0 e.Data1 e.Data2 diff --git a/tests/service/ReshapedReflection.fs b/tests/service/ReshapedReflection.fs deleted file mode 100644 index 3b1ba07ce81..00000000000 --- a/tests/service/ReshapedReflection.fs +++ /dev/null @@ -1,9 +0,0 @@ -namespace FSharp.Compiler.Service.Tests - -#if FX_RESHAPED_REFLECTION -module internal ReflectionAdapters = - open System.Reflection - - type System.Type with - member this.Assembly = this.GetTypeInfo().Assembly -#endif diff --git a/tests/service/data/samename/tempet.fsproj b/tests/service/data/samename/tempet.fsproj index 682a3ec1a30..03da397c8db 100644 --- a/tests/service/data/samename/tempet.fsproj +++ b/tests/service/data/samename/tempet.fsproj @@ -1,6 +1,6 @@ - netstandard1.6 + netstandard2.0 diff --git a/vsintegration/Utils/LanguageServiceProfiling/Options.fs b/vsintegration/Utils/LanguageServiceProfiling/Options.fs index 8ffb41aef0f..0fd262541a5 100644 --- a/vsintegration/Utils/LanguageServiceProfiling/Options.fs +++ b/vsintegration/Utils/LanguageServiceProfiling/Options.fs @@ -29,7 +29,6 @@ let FCS (repositoryDir: string) : Options = @"src\fsharp\FSharp.Compiler.Service\obj\Release\FSIstrings.fs" @"src\assemblyinfo\assemblyinfo.FSharp.Compiler.Private.dll.fs" @"src\assemblyinfo\assemblyinfo.shared.fs" - @"src\utils\reshapedreflection.fs" @"src\utils\sformat.fsi" @"src\utils\sformat.fs" @"src\fsharp\sr.fsi" @@ -207,7 +206,7 @@ let FCS (repositoryDir: string) : Options = [|@"-o:obj\Release\FSharp.Compiler.Private.dll"; "-g"; "--noframework"; @"--baseaddress:0x06800000"; "--define:DEBUG"; @"--define:CROSS_PLATFORM_COMPILER"; - @"--define:FX_ATLEAST_40"; "--define:BE_SECURITY_TRANSPARENT"; + @"--define:FX_ATLEAST_40"; @"--define:COMPILER"; @"--define:ENABLE_MONO_SUPPORT"; "--define:FX_MSBUILDRESOLVER_RUNTIMELIKE"; @"--define:FX_LCIDFROMCODEPAGE"; "--define:FX_RESX_RESOURCE_READER"; diff --git a/vsintegration/src/FSharp.Editor/CodeFix/RenameUnusedValue.fs b/vsintegration/src/FSharp.Editor/CodeFix/RenameUnusedValue.fs index 57d4eff5eff..67379326323 100644 --- a/vsintegration/src/FSharp.Editor/CodeFix/RenameUnusedValue.fs +++ b/vsintegration/src/FSharp.Editor/CodeFix/RenameUnusedValue.fs @@ -69,12 +69,8 @@ type internal FSharpRenameUnusedValueCodeFixProvider match symbolUse.Symbol with | :? FSharpMemberOrFunctionOrValue as func -> createCodeFix(context, symbolName, SR.PrefixValueNameWithUnderscore(), TextChange(TextSpan(context.Span.Start, 0), "_")) - - if func.IsMemberThisValue then - createCodeFix(context, symbolName, SR.RenameValueToDoubleUnderscore(), TextChange(context.Span, "__")) - elif func.IsValue then - createCodeFix(context, symbolName, SR.RenameValueToUnderscore(), TextChange(context.Span, "_")) + if func.IsValue then createCodeFix(context, symbolName, SR.RenameValueToUnderscore(), TextChange(context.Span, "_")) | _ -> () } |> Async.Ignore - |> RoslynHelpers.StartAsyncUnitAsTask(context.CancellationToken) \ No newline at end of file + |> RoslynHelpers.StartAsyncUnitAsTask(context.CancellationToken) diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.cs.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.cs.xlf index a678a4bcfeb..860555f3440 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.cs.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.cs.xlf @@ -1828,8 +1828,9 @@ CONSIDER: get this from CodeDom {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size + # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" 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 662133483e3..65b4328fdc2 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 @@ -1828,8 +1828,9 @@ CONSIDER: get this from CodeDom {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size + # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.es.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.es.xlf index 41dbc88f0bd..1153755c3dd 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.es.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.es.xlf @@ -1828,8 +1828,9 @@ CONSIDER: get this from CodeDom {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size + # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" 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 0f1e16e95f2..cd60e9f07e9 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 @@ -1828,8 +1828,9 @@ CONSIDER: get this from CodeDom {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size + # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.it.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.it.xlf index 8902030751c..dd58cb9a119 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.it.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.it.xlf @@ -1828,8 +1828,9 @@ CONSIDER: get this from CodeDom {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size + # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ja.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ja.xlf index a39e49dfa0d..bdb896a5c83 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ja.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ja.xlf @@ -1828,8 +1828,9 @@ CONSIDER: get this from CodeDom {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size + # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ko.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ko.xlf index e7191ac3c4a..6f540b54250 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ko.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ko.xlf @@ -1828,8 +1828,9 @@ CONSIDER: get this from CodeDom {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size + # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.pl.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.pl.xlf index d0675bd2fcb..73bef853b9f 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.pl.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.pl.xlf @@ -1828,8 +1828,9 @@ CONSIDER: get this from CodeDom {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size + # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.pt-BR.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.pt-BR.xlf index acfade88845..3e8a1693485 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.pt-BR.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.pt-BR.xlf @@ -1828,8 +1828,9 @@ CONSIDER: get this from CodeDom {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size + # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ru.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ru.xlf index 355d363084e..2b5303d91de 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ru.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ru.xlf @@ -1828,8 +1828,9 @@ CONSIDER: get this from CodeDom {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size + # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.tr.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.tr.xlf index 86ac32f4b37..73a72b806a2 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.tr.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.tr.xlf @@ -1828,8 +1828,9 @@ CONSIDER: get this from CodeDom {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size + # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.zh-Hans.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.zh-Hans.xlf index 0537632d5fc..474f99a3dcd 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.zh-Hans.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.zh-Hans.xlf @@ -1828,8 +1828,9 @@ CONSIDER: get this from CodeDom {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size + # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.zh-Hant.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.zh-Hant.xlf index 17c64ffefb9..16b7339b2a4 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.zh-Hant.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.zh-Hant.xlf @@ -1828,8 +1828,9 @@ CONSIDER: get this from CodeDom {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size + # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456"